{ "version": 3, "sources": ["../../../node_modules/@rails/actioncable/src/adapters.js", "../../../node_modules/@rails/actioncable/src/logger.js", "../../../node_modules/@rails/actioncable/src/connection_monitor.js", "../../../node_modules/@rails/actioncable/src/internal.js", "../../../node_modules/@rails/actioncable/src/connection.js", "../../../node_modules/@rails/actioncable/src/subscription.js", "../../../node_modules/@rails/actioncable/src/subscription_guarantor.js", "../../../node_modules/@rails/actioncable/src/subscriptions.js", "../../../node_modules/@rails/actioncable/src/consumer.js", "../../../node_modules/@rails/actioncable/src/index.js", "../../../node_modules/ripple-effects/dist/ripple.umd.min.js", "../../../node_modules/tiny-slider/dist/tiny-slider.js", "../../../node_modules/vanilla-lazyload/dist/lazyload.min.js", "../../../node_modules/@tarekraafat/autocomplete.js/dist/autoComplete.min.js", "../../../node_modules/sprintf-js/src/sprintf.js", "../../../node_modules/smooth-scroll/dist/smooth-scroll.polyfills.min.js", "../../../node_modules/core-js/internals/global-this.js", "../../../node_modules/core-js/internals/fails.js", "../../../node_modules/core-js/internals/descriptors.js", "../../../node_modules/core-js/internals/function-bind-native.js", "../../../node_modules/core-js/internals/function-call.js", "../../../node_modules/core-js/internals/object-property-is-enumerable.js", "../../../node_modules/core-js/internals/create-property-descriptor.js", "../../../node_modules/core-js/internals/function-uncurry-this.js", "../../../node_modules/core-js/internals/classof-raw.js", "../../../node_modules/core-js/internals/indexed-object.js", "../../../node_modules/core-js/internals/is-null-or-undefined.js", "../../../node_modules/core-js/internals/require-object-coercible.js", "../../../node_modules/core-js/internals/to-indexed-object.js", "../../../node_modules/core-js/internals/is-callable.js", "../../../node_modules/core-js/internals/is-object.js", "../../../node_modules/core-js/internals/get-built-in.js", "../../../node_modules/core-js/internals/object-is-prototype-of.js", "../../../node_modules/core-js/internals/environment-user-agent.js", "../../../node_modules/core-js/internals/environment-v8-version.js", "../../../node_modules/core-js/internals/symbol-constructor-detection.js", "../../../node_modules/core-js/internals/use-symbol-as-uid.js", "../../../node_modules/core-js/internals/is-symbol.js", "../../../node_modules/core-js/internals/try-to-string.js", "../../../node_modules/core-js/internals/a-callable.js", "../../../node_modules/core-js/internals/get-method.js", "../../../node_modules/core-js/internals/ordinary-to-primitive.js", "../../../node_modules/core-js/internals/is-pure.js", "../../../node_modules/core-js/internals/define-global-property.js", "../../../node_modules/core-js/internals/shared-store.js", "../../../node_modules/core-js/internals/shared.js", "../../../node_modules/core-js/internals/to-object.js", "../../../node_modules/core-js/internals/has-own-property.js", "../../../node_modules/core-js/internals/uid.js", "../../../node_modules/core-js/internals/well-known-symbol.js", "../../../node_modules/core-js/internals/to-primitive.js", "../../../node_modules/core-js/internals/to-property-key.js", "../../../node_modules/core-js/internals/document-create-element.js", "../../../node_modules/core-js/internals/ie8-dom-define.js", "../../../node_modules/core-js/internals/object-get-own-property-descriptor.js", "../../../node_modules/core-js/internals/v8-prototype-define-bug.js", "../../../node_modules/core-js/internals/an-object.js", "../../../node_modules/core-js/internals/object-define-property.js", "../../../node_modules/core-js/internals/create-non-enumerable-property.js", "../../../node_modules/core-js/internals/function-name.js", "../../../node_modules/core-js/internals/inspect-source.js", "../../../node_modules/core-js/internals/weak-map-basic-detection.js", "../../../node_modules/core-js/internals/shared-key.js", "../../../node_modules/core-js/internals/hidden-keys.js", "../../../node_modules/core-js/internals/internal-state.js", "../../../node_modules/core-js/internals/make-built-in.js", "../../../node_modules/core-js/internals/define-built-in.js", "../../../node_modules/core-js/internals/math-trunc.js", "../../../node_modules/core-js/internals/to-integer-or-infinity.js", "../../../node_modules/core-js/internals/to-absolute-index.js", "../../../node_modules/core-js/internals/to-length.js", "../../../node_modules/core-js/internals/length-of-array-like.js", "../../../node_modules/core-js/internals/array-includes.js", "../../../node_modules/core-js/internals/object-keys-internal.js", "../../../node_modules/core-js/internals/enum-bug-keys.js", "../../../node_modules/core-js/internals/object-get-own-property-names.js", "../../../node_modules/core-js/internals/object-get-own-property-symbols.js", "../../../node_modules/core-js/internals/own-keys.js", "../../../node_modules/core-js/internals/copy-constructor-properties.js", "../../../node_modules/core-js/internals/is-forced.js", "../../../node_modules/core-js/internals/export.js", "../../../node_modules/core-js/internals/function-apply.js", "../../../node_modules/core-js/internals/function-uncurry-this-accessor.js", "../../../node_modules/core-js/internals/is-possible-prototype.js", "../../../node_modules/core-js/internals/a-possible-prototype.js", "../../../node_modules/core-js/internals/object-set-prototype-of.js", "../../../node_modules/core-js/internals/proxy-accessor.js", "../../../node_modules/core-js/internals/inherit-if-required.js", "../../../node_modules/core-js/internals/to-string-tag-support.js", "../../../node_modules/core-js/internals/classof.js", "../../../node_modules/core-js/internals/to-string.js", "../../../node_modules/core-js/internals/normalize-string-argument.js", "../../../node_modules/core-js/internals/install-error-cause.js", "../../../node_modules/core-js/internals/error-stack-clear.js", "../../../node_modules/core-js/internals/error-stack-installable.js", "../../../node_modules/core-js/internals/error-stack-install.js", "../../../node_modules/core-js/internals/wrap-error-constructor-with-cause.js", "../../../node_modules/core-js/modules/es.error.cause.js", "../../../node_modules/core-js/internals/is-array.js", "../../../node_modules/core-js/internals/array-set-length.js", "../../../node_modules/core-js/internals/does-not-exceed-safe-integer.js", "../../../node_modules/core-js/modules/es.array.push.js", "../../../node_modules/core-js/internals/set-helpers.js", "../../../node_modules/core-js/internals/a-set.js", "../../../node_modules/core-js/internals/iterate-simple.js", "../../../node_modules/core-js/internals/set-iterate.js", "../../../node_modules/core-js/internals/set-clone.js", "../../../node_modules/core-js/internals/set-size.js", "../../../node_modules/core-js/internals/get-iterator-direct.js", "../../../node_modules/core-js/internals/get-set-record.js", "../../../node_modules/core-js/internals/set-difference.js", "../../../node_modules/core-js/internals/set-method-accept-set-like.js", "../../../node_modules/core-js/modules/es.set.difference.v2.js", "../../../node_modules/core-js/internals/set-intersection.js", "../../../node_modules/core-js/modules/es.set.intersection.v2.js", "../../../node_modules/core-js/internals/iterator-close.js", "../../../node_modules/core-js/internals/set-is-disjoint-from.js", "../../../node_modules/core-js/modules/es.set.is-disjoint-from.v2.js", "../../../node_modules/core-js/internals/set-is-subset-of.js", "../../../node_modules/core-js/modules/es.set.is-subset-of.v2.js", "../../../node_modules/core-js/internals/set-is-superset-of.js", "../../../node_modules/core-js/modules/es.set.is-superset-of.v2.js", "../../../node_modules/core-js/internals/set-symmetric-difference.js", "../../../node_modules/core-js/modules/es.set.symmetric-difference.v2.js", "../../../node_modules/core-js/internals/set-union.js", "../../../node_modules/core-js/modules/es.set.union.v2.js", "../../../node_modules/core-js/internals/function-uncurry-this-clause.js", "../../../node_modules/core-js/internals/function-bind-context.js", "../../../node_modules/core-js/internals/html.js", "../../../node_modules/core-js/internals/array-slice.js", "../../../node_modules/core-js/internals/validate-arguments-length.js", "../../../node_modules/core-js/internals/environment-is-ios.js", "../../../node_modules/core-js/internals/environment.js", "../../../node_modules/core-js/internals/environment-is-node.js", "../../../node_modules/core-js/internals/task.js", "../../../node_modules/core-js/modules/web.clear-immediate.js", "../../../node_modules/core-js/internals/schedulers-fix.js", "../../../node_modules/core-js/modules/web.set-immediate.js", "../../../node_modules/core-js/modules/web.immediate.js", "../../../node_modules/dompurify/src/utils.js", "../../../node_modules/dompurify/src/tags.js", "../../../node_modules/dompurify/src/attrs.js", "../../../node_modules/dompurify/src/regexp.js", "../../../node_modules/dompurify/src/purify.js", "../../../node_modules/moment/moment.js", "../../../node_modules/handsontable/helpers/array.mjs", "../../../node_modules/handsontable/helpers/templateLiteralTag.mjs", "../../../node_modules/handsontable/helpers/mixed.mjs", "../../../node_modules/handsontable/helpers/string.mjs", "../../../node_modules/handsontable/helpers/a11y.mjs", "../../../node_modules/handsontable/helpers/dom/element.mjs", "../../../node_modules/handsontable/helpers/function.mjs", "../../../node_modules/core-js/internals/get-json-replacer-function.js", "../../../node_modules/core-js/modules/es.json.stringify.js", "../../../node_modules/handsontable/helpers/object.mjs", "../../../node_modules/handsontable/helpers/feature.mjs", "../../../node_modules/handsontable/helpers/browser.mjs", "../../../node_modules/handsontable/helpers/unicode.mjs", "../../../node_modules/handsontable/helpers/dom/event.mjs", "../../../node_modules/core-js/internals/object-keys.js", "../../../node_modules/core-js/internals/object-define-properties.js", "../../../node_modules/core-js/internals/object-create.js", "../../../node_modules/core-js/internals/add-to-unscopables.js", "../../../node_modules/core-js/modules/es.array.unscopables.flat-map.js", "../../../node_modules/handsontable/helpers/console.mjs", "../../../node_modules/handsontable/pluginHooks.mjs", "../../../node_modules/handsontable/utils/staticRegister.mjs", "../../../node_modules/handsontable/editors/registry.mjs", "../../../node_modules/handsontable/eventManager.mjs", "../../../node_modules/handsontable/editorManager.mjs", "../../../node_modules/handsontable/focusManager.mjs", "../../../node_modules/core-js/internals/is-regexp.js", "../../../node_modules/core-js/internals/regexp-flags.js", "../../../node_modules/core-js/internals/regexp-get-flags.js", "../../../node_modules/core-js/internals/get-substitution.js", "../../../node_modules/core-js/modules/es.string.replace-all.js", "../../../node_modules/handsontable/utils/parseTable.mjs", "../../../node_modules/handsontable/helpers/number.mjs", "../../../node_modules/handsontable/utils/dataStructures/priorityMap.mjs", "../../../node_modules/handsontable/utils/dataStructures/uniqueMap.mjs", "../../../node_modules/handsontable/utils/dataStructures/uniqueSet.mjs", "../../../node_modules/handsontable/plugins/registry.mjs", "../../../node_modules/handsontable/renderers/registry.mjs", "../../../node_modules/handsontable/validators/registry.mjs", "../../../node_modules/core-js/modules/es.array.at.js", "../../../node_modules/core-js/modules/es.string.at-alternative.js", "../../../node_modules/handsontable/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/calculator/calculationType/renderedAllColumns.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/calculator/calculationType/renderedAllRows.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/calculator/viewportBase.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/calculator/viewportColumns.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/calculator/viewportRows.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/calculator/index.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/cell/coords.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/cell/range.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/event.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/filter/column.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/filter/row.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/orderView/constants.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/orderView/viewSize.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/orderView/view.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/orderView/sharedView.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/orderView/index.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/nodesPool.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/renderer/_base.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/renderer/rowHeaders.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/renderer/columnHeaders.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/renderer/colGroup.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/renderer/rows.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/renderer/cells.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/renderer/table.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/renderer/index.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/columnStretching.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/column.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/row.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/table.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/table/bottomInlineStartCorner.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/overlay/constants.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/scroll.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/core/_base.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/core/clone.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/overlay/_base.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/overlay/bottomInlineStartCorner.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/table/bottom.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/overlay/bottom.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/table/inlineStart.mjs", "../../../node_modules/handsontable/mixins/localHooks.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/selection/selection.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/selection/constants.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/selection/border/constants.mjs", "../../../node_modules/core-js/modules/es.array.unscopables.flat.js", "../../../node_modules/handsontable/3rdparty/walkontable/src/selection/scanner.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/selection/border/border.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/selection/manager.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/selection/index.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/overlay/inlineStart.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/table/topInlineStartCorner.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/table/top.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/overlay/top.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/overlay/index.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/overlays.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/settings.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/table/master.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/viewport.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/core/core.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/facade/core.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/index.mjs", "../../../node_modules/handsontable/selection/mouseEventHandler.mjs", "../../../node_modules/handsontable/utils/rootInstance.mjs", "../../../node_modules/handsontable/tableView.mjs", "../../../node_modules/handsontable/helpers/data.mjs", "../../../node_modules/handsontable/dataMap/dataSource.mjs", "../../../node_modules/handsontable/translations/maps/indexMap.mjs", "../../../node_modules/handsontable/translations/maps/utils/physicallyIndexed.mjs", "../../../node_modules/handsontable/translations/maps/physicalIndexToValueMap.mjs", "../../../node_modules/handsontable/translations/maps/hidingMap.mjs", "../../../node_modules/handsontable/translations/maps/utils/indexesSequence.mjs", "../../../node_modules/handsontable/translations/maps/utils/actionsOnIndexes.mjs", "../../../node_modules/handsontable/translations/maps/linkedPhysicalIndexToValueMap.mjs", "../../../node_modules/handsontable/translations/maps/trimmingMap.mjs", "../../../node_modules/handsontable/translations/maps/utils/index.mjs", "../../../node_modules/handsontable/translations/maps/indexesSequence.mjs", "../../../node_modules/handsontable/translations/maps/index.mjs", "../../../node_modules/handsontable/translations/mapCollections/mapCollection.mjs", "../../../node_modules/handsontable/translations/mapCollections/aggregatedCollection.mjs", "../../../node_modules/handsontable/translations/mapCollections/index.mjs", "../../../node_modules/handsontable/translations/changesObservable/observer.mjs", "../../../node_modules/handsontable/translations/changesObservable/utils.mjs", "../../../node_modules/handsontable/translations/changesObservable/observable.mjs", "../../../node_modules/handsontable/translations/indexMapper.mjs", "../../../node_modules/handsontable/translations/index.mjs", "../../../node_modules/handsontable/i18n/utils.mjs", "../../../node_modules/handsontable/i18n/phraseFormatters/pluralize.mjs", "../../../node_modules/handsontable/i18n/phraseFormatters/index.mjs", "../../../node_modules/handsontable/i18n/constants.mjs", "../../../node_modules/handsontable/i18n/languages/en-US.mjs", "../../../node_modules/handsontable/i18n/registry.mjs", "../../../node_modules/handsontable/selection/highlight/visualSelection.mjs", "../../../node_modules/handsontable/selection/highlight/types/activeHeader.mjs", "../../../node_modules/handsontable/selection/highlight/types/areaLayered.mjs", "../../../node_modules/handsontable/selection/highlight/types/area.mjs", "../../../node_modules/handsontable/selection/highlight/types/column.mjs", "../../../node_modules/handsontable/selection/highlight/types/focus.mjs", "../../../node_modules/handsontable/selection/highlight/types/customSelection.mjs", "../../../node_modules/handsontable/selection/highlight/types/fill.mjs", "../../../node_modules/handsontable/selection/highlight/types/header.mjs", "../../../node_modules/handsontable/selection/highlight/types/row.mjs", "../../../node_modules/handsontable/selection/highlight/highlight.mjs", "../../../node_modules/handsontable/selection/range.mjs", "../../../node_modules/handsontable/selection/transformation.mjs", "../../../node_modules/handsontable/selection/utils.mjs", "../../../node_modules/handsontable/selection/selection.mjs", "../../../node_modules/handsontable/selection/index.mjs", "../../../node_modules/handsontable/3rdparty/SheetClip/SheetClip.mjs", "../../../node_modules/handsontable/3rdparty/SheetClip/index.mjs", "../../../node_modules/handsontable/dataMap/dataMap.mjs", "../../../node_modules/handsontable/cellTypes/registry.mjs", "../../../node_modules/handsontable/dataMap/metaManager/utils.mjs", "../../../node_modules/handsontable/dataMap/metaManager/metaSchema.mjs", "../../../node_modules/handsontable/dataMap/metaManager/metaLayers/globalMeta.mjs", "../../../node_modules/handsontable/dataMap/metaManager/metaLayers/tableMeta.mjs", "../../../node_modules/handsontable/dataMap/metaManager/lazyFactoryMap.mjs", "../../../node_modules/handsontable/dataMap/metaManager/metaLayers/columnMeta.mjs", "../../../node_modules/handsontable/dataMap/metaManager/metaLayers/cellMeta.mjs", "../../../node_modules/handsontable/dataMap/metaManager/index.mjs", "../../../node_modules/handsontable/dataMap/replaceData.mjs", "../../../node_modules/handsontable/dataMap/metaManager/mods/dynamicCellMeta.mjs", "../../../node_modules/handsontable/dataMap/metaManager/mods/extendMetaProperties.mjs", "../../../node_modules/handsontable/dataMap/index.mjs", "../../../node_modules/handsontable/shortcutContexts/constants.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/editor/closeAndSave.mjs", "../../../node_modules/handsontable/mixins/hooksRefRegisterer.mjs", "../../../node_modules/handsontable/editors/baseEditor/baseEditor.mjs", "../../../node_modules/handsontable/editors/baseEditor/index.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/editor/closeAndSaveByArrowKeys.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/editor/closeAndSaveByEnter.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/editor/closeWithoutSaving.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/editor/fastOpen.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/editor/open.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/editor/index.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/down.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/left.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/right.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/toColumns.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/toRows.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/up.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/extendCellsSelection/index.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/down.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/inlineStart.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/left.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/right.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/toMostRight.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/toMostTop.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/up.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/moveCellSelection/index.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/emptySelectedCells.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/scrollToFocusedCell.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/selectAllCells.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/selectAllCellsAndHeaders.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/populateSelectedCellsData.mjs", "../../../node_modules/handsontable/shortcutContexts/commands/index.mjs", "../../../node_modules/handsontable/shortcutContexts/editor.mjs", "../../../node_modules/handsontable/shortcutContexts/grid.mjs", "../../../node_modules/handsontable/shortcutContexts/index.mjs", "../../../node_modules/handsontable/core/focusCatcher/focusDetector.mjs", "../../../node_modules/handsontable/core/focusCatcher/index.mjs", "../../../node_modules/handsontable/core/viewportScroll/scrollStrategies/columnHeaderScroll.mjs", "../../../node_modules/handsontable/core/viewportScroll/scrollStrategies/cornerHeaderScroll.mjs", "../../../node_modules/handsontable/core/viewportScroll/scrollStrategies/focusScroll.mjs", "../../../node_modules/handsontable/core/viewportScroll/scrollStrategies/multipleScroll.mjs", "../../../node_modules/handsontable/core/viewportScroll/scrollStrategies/noncontiguousScroll.mjs", "../../../node_modules/handsontable/core/viewportScroll/scrollStrategies/rowHeaderScroll.mjs", "../../../node_modules/handsontable/core/viewportScroll/scrollStrategies/singleScroll.mjs", "../../../node_modules/handsontable/core/viewportScroll/index.mjs", "../../../node_modules/handsontable/core/index.mjs", "../../../node_modules/handsontable/shortcuts/utils.mjs", "../../../node_modules/handsontable/shortcuts/context.mjs", "../../../node_modules/handsontable/shortcuts/keyObserver.mjs", "../../../node_modules/handsontable/shortcuts/recorder.mjs", "../../../node_modules/handsontable/shortcuts/manager.mjs", "../../../node_modules/handsontable/shortcuts/index.mjs", "../../../node_modules/handsontable/core.mjs", "../../../node_modules/handsontable/utils/autoResize.mjs", "../../../node_modules/handsontable/editors/textEditor/caretPositioner.mjs", "../../../node_modules/handsontable/editors/textEditor/textEditor.mjs", "../../../node_modules/handsontable/editors/textEditor/index.mjs", "../../../node_modules/handsontable/renderers/baseRenderer/baseRenderer.mjs", "../../../node_modules/handsontable/renderers/baseRenderer/index.mjs", "../../../node_modules/handsontable/renderers/textRenderer/textRenderer.mjs", "../../../node_modules/handsontable/renderers/textRenderer/index.mjs", "../../../node_modules/handsontable/cellTypes/textType/textType.mjs", "../../../node_modules/handsontable/cellTypes/textType/index.mjs", "../../../node_modules/handsontable/base.mjs", "../../../node_modules/handsontable/editors/handsontableEditor/handsontableEditor.mjs", "../../../node_modules/handsontable/editors/handsontableEditor/index.mjs", "../../../node_modules/handsontable/editors/autocompleteEditor/autocompleteEditor.mjs", "../../../node_modules/handsontable/editors/autocompleteEditor/index.mjs", "../../../node_modules/handsontable/editors/checkboxEditor/checkboxEditor.mjs", "../../../node_modules/handsontable/editors/checkboxEditor/index.mjs", "../../../node_modules/@handsontable/pikaday/pikaday.mjs", "../../../node_modules/handsontable/editors/dateEditor/dateEditor.mjs", "../../../node_modules/handsontable/editors/dateEditor/index.mjs", "../../../node_modules/handsontable/editors/dropdownEditor/dropdownEditor.mjs", "../../../node_modules/handsontable/editors/dropdownEditor/index.mjs", "../../../node_modules/handsontable/editors/numericEditor/numericEditor.mjs", "../../../node_modules/handsontable/editors/numericEditor/index.mjs", "../../../node_modules/handsontable/editors/passwordEditor/passwordEditor.mjs", "../../../node_modules/handsontable/editors/passwordEditor/index.mjs", "../../../node_modules/handsontable/editors/selectEditor/selectEditor.mjs", "../../../node_modules/handsontable/editors/selectEditor/index.mjs", "../../../node_modules/handsontable/editors/timeEditor/timeEditor.mjs", "../../../node_modules/handsontable/editors/timeEditor/index.mjs", "../../../node_modules/handsontable/editors/index.mjs", "../../../node_modules/handsontable/renderers/htmlRenderer/htmlRenderer.mjs", "../../../node_modules/handsontable/renderers/htmlRenderer/index.mjs", "../../../node_modules/handsontable/renderers/autocompleteRenderer/autocompleteRenderer.mjs", "../../../node_modules/handsontable/renderers/autocompleteRenderer/index.mjs", "../../../node_modules/handsontable/renderers/dropdownRenderer/dropdownRenderer.mjs", "../../../node_modules/handsontable/renderers/dropdownRenderer/index.mjs", "../../../node_modules/handsontable/renderers/checkboxRenderer/checkboxRenderer.mjs", "../../../node_modules/handsontable/renderers/checkboxRenderer/index.mjs", "../../../node_modules/handsontable/renderers/handsontableRenderer/handsontableRenderer.mjs", "../../../node_modules/handsontable/renderers/handsontableRenderer/index.mjs", "../../../node_modules/numbro/dist/node_modules/browser-pack/_prelude.js", "../../../node_modules/numbro/dist/node_modules/bignumber.js/bignumber.js", "../../../node_modules/numbro/dist/src/en-US.js", "../../../node_modules/numbro/dist/src/formatting.js", "../../../node_modules/numbro/dist/src/globalState.js", "../../../node_modules/numbro/dist/src/loading.js", "../../../node_modules/numbro/dist/src/manipulating.js", "../../../node_modules/numbro/dist/src/numbro.js", "../../../node_modules/numbro/dist/src/parsing.js", "../../../node_modules/numbro/dist/src/unformatting.js", "../../../node_modules/numbro/dist/src/validating.js", "../../../node_modules/handsontable/renderers/numericRenderer/numericRenderer.mjs", "../../../node_modules/handsontable/renderers/numericRenderer/index.mjs", "../../../node_modules/handsontable/renderers/passwordRenderer/passwordRenderer.mjs", "../../../node_modules/handsontable/renderers/passwordRenderer/index.mjs", "../../../node_modules/handsontable/renderers/selectRenderer/selectRenderer.mjs", "../../../node_modules/handsontable/renderers/selectRenderer/index.mjs", "../../../node_modules/handsontable/renderers/timeRenderer/timeRenderer.mjs", "../../../node_modules/handsontable/renderers/timeRenderer/index.mjs", "../../../node_modules/handsontable/renderers/index.mjs", "../../../node_modules/handsontable/validators/autocompleteValidator/autocompleteValidator.mjs", "../../../node_modules/handsontable/validators/autocompleteValidator/index.mjs", "../../../node_modules/handsontable/helpers/date.mjs", "../../../node_modules/handsontable/validators/dateValidator/dateValidator.mjs", "../../../node_modules/handsontable/validators/dateValidator/index.mjs", "../../../node_modules/handsontable/validators/dropdownValidator/dropdownValidator.mjs", "../../../node_modules/handsontable/validators/dropdownValidator/index.mjs", "../../../node_modules/handsontable/validators/numericValidator/numericValidator.mjs", "../../../node_modules/handsontable/validators/numericValidator/index.mjs", "../../../node_modules/handsontable/validators/timeValidator/timeValidator.mjs", "../../../node_modules/handsontable/validators/timeValidator/index.mjs", "../../../node_modules/handsontable/validators/index.mjs", "../../../node_modules/handsontable/cellTypes/autocompleteType/autocompleteType.mjs", "../../../node_modules/handsontable/cellTypes/autocompleteType/index.mjs", "../../../node_modules/handsontable/cellTypes/checkboxType/checkboxType.mjs", "../../../node_modules/handsontable/cellTypes/checkboxType/index.mjs", "../../../node_modules/handsontable/renderers/dateRenderer/dateRenderer.mjs", "../../../node_modules/handsontable/renderers/dateRenderer/index.mjs", "../../../node_modules/handsontable/cellTypes/dateType/dateType.mjs", "../../../node_modules/handsontable/cellTypes/dateType/index.mjs", "../../../node_modules/handsontable/cellTypes/dropdownType/dropdownType.mjs", "../../../node_modules/handsontable/cellTypes/dropdownType/index.mjs", "../../../node_modules/handsontable/cellTypes/handsontableType/handsontableType.mjs", "../../../node_modules/handsontable/cellTypes/handsontableType/index.mjs", "../../../node_modules/handsontable/cellTypes/numericType/numericType.mjs", "../../../node_modules/handsontable/cellTypes/numericType/index.mjs", "../../../node_modules/handsontable/cellTypes/passwordType/passwordType.mjs", "../../../node_modules/handsontable/cellTypes/passwordType/index.mjs", "../../../node_modules/handsontable/cellTypes/selectType/selectType.mjs", "../../../node_modules/handsontable/cellTypes/selectType/index.mjs", "../../../node_modules/handsontable/cellTypes/timeType/timeType.mjs", "../../../node_modules/handsontable/cellTypes/timeType/index.mjs", "../../../node_modules/handsontable/cellTypes/index.mjs", "../../../node_modules/handsontable/plugins/base/base.mjs", "../../../node_modules/handsontable/plugins/base/index.mjs", "../../../node_modules/handsontable/utils/ghostTable.mjs", "../../../node_modules/handsontable/utils/samplesGenerator.mjs", "../../../node_modules/handsontable/plugins/autoColumnSize/autoColumnSize.mjs", "../../../node_modules/handsontable/plugins/autoColumnSize/index.mjs", "../../../node_modules/handsontable/plugins/autofill/utils.mjs", "../../../node_modules/handsontable/plugins/autofill/autofill.mjs", "../../../node_modules/handsontable/plugins/autofill/index.mjs", "../../../node_modules/handsontable/plugins/autoRowSize/autoRowSize.mjs", "../../../node_modules/handsontable/plugins/autoRowSize/index.mjs", "../../../node_modules/handsontable/plugins/bindRowsWithHeaders/maps/looseBindsMap.mjs", "../../../node_modules/handsontable/plugins/bindRowsWithHeaders/maps/strictBindsMap.mjs", "../../../node_modules/handsontable/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs", "../../../node_modules/handsontable/plugins/bindRowsWithHeaders/index.mjs", "../../../node_modules/handsontable/plugins/collapsibleColumns/collapsibleColumns.mjs", "../../../node_modules/handsontable/plugins/collapsibleColumns/index.mjs", "../../../node_modules/handsontable/plugins/columnSorting/columnStatesManager.mjs", "../../../node_modules/handsontable/plugins/columnSorting/sortFunction/default.mjs", "../../../node_modules/handsontable/plugins/columnSorting/sortFunction/numeric.mjs", "../../../node_modules/handsontable/plugins/columnSorting/sortFunction/checkbox.mjs", "../../../node_modules/handsontable/plugins/columnSorting/sortFunction/date.mjs", "../../../node_modules/handsontable/plugins/columnSorting/sortFunction/time.mjs", "../../../node_modules/handsontable/plugins/columnSorting/sortService/registry.mjs", "../../../node_modules/handsontable/plugins/columnSorting/sortService/engine.mjs", "../../../node_modules/handsontable/plugins/columnSorting/sortService/index.mjs", "../../../node_modules/handsontable/plugins/columnSorting/utils.mjs", "../../../node_modules/handsontable/plugins/columnSorting/domHelpers.mjs", "../../../node_modules/handsontable/plugins/columnSorting/rootComparator.mjs", "../../../node_modules/handsontable/plugins/columnSorting/columnSorting.mjs", "../../../node_modules/handsontable/plugins/columnSorting/index.mjs", "../../../node_modules/handsontable/plugins/columnSummary/endpoints.mjs", "../../../node_modules/handsontable/plugins/columnSummary/utils.mjs", "../../../node_modules/handsontable/plugins/columnSummary/columnSummary.mjs", "../../../node_modules/handsontable/plugins/columnSummary/index.mjs", "../../../node_modules/handsontable/plugins/comments/editorResizeObserver.mjs", "../../../node_modules/handsontable/plugins/comments/commentEditor.mjs", "../../../node_modules/handsontable/plugins/comments/displaySwitch.mjs", "../../../node_modules/handsontable/plugins/contextMenu/utils.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/separator.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/alignment.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/clearColumn.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/columnLeft.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/columnRight.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/readOnly.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/redo.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/removeColumn.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/removeRow.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/rowAbove.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/rowBelow.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/noItems.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/undo.mjs", "../../../node_modules/handsontable/plugins/contextMenu/predefinedItems/index.mjs", "../../../node_modules/handsontable/plugins/comments/contextMenuItem/addEditComment.mjs", "../../../node_modules/handsontable/plugins/comments/contextMenuItem/removeComment.mjs", "../../../node_modules/handsontable/plugins/comments/contextMenuItem/readOnlyComment.mjs", "../../../node_modules/handsontable/plugins/comments/comments.mjs", "../../../node_modules/handsontable/plugins/comments/index.mjs", "../../../node_modules/core-js/internals/delete-property-or-throw.js", "../../../node_modules/core-js/modules/es.array.unshift.js", "../../../node_modules/handsontable/plugins/contextMenu/commandExecutor.mjs", "../../../node_modules/handsontable/plugins/contextMenu/itemsFactory.mjs", "../../../node_modules/handsontable/plugins/contextMenu/menu/cursor.mjs", "../../../node_modules/handsontable/plugins/contextMenu/menu/positioner.mjs", "../../../node_modules/handsontable/utils/paginator.mjs", "../../../node_modules/handsontable/plugins/contextMenu/menu/utils.mjs", "../../../node_modules/handsontable/plugins/contextMenu/menu/navigator.mjs", "../../../node_modules/handsontable/plugins/contextMenu/menu/defaultShortcutsList.mjs", "../../../node_modules/handsontable/plugins/contextMenu/menu/shortcuts.mjs", "../../../node_modules/handsontable/plugins/contextMenu/menu/menuItemRenderer.mjs", "../../../node_modules/handsontable/plugins/contextMenu/menu/menu.mjs", "../../../node_modules/handsontable/plugins/contextMenu/menu/index.mjs", "../../../node_modules/handsontable/plugins/contextMenu/contextMenu.mjs", "../../../node_modules/handsontable/plugins/contextMenu/index.mjs", "../../../node_modules/handsontable/plugins/copyPaste/contextMenuItem/copy.mjs", "../../../node_modules/handsontable/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs", "../../../node_modules/handsontable/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs", "../../../node_modules/handsontable/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs", "../../../node_modules/handsontable/plugins/copyPaste/contextMenuItem/cut.mjs", "../../../node_modules/handsontable/plugins/copyPaste/clipboardData.mjs", "../../../node_modules/handsontable/plugins/copyPaste/pasteEvent.mjs", "../../../node_modules/handsontable/plugins/copyPaste/copyableRanges.mjs", "../../../node_modules/handsontable/plugins/copyPaste/copyPaste.mjs", "../../../node_modules/handsontable/plugins/copyPaste/index.mjs", "../../../node_modules/handsontable/plugins/customBorders/utils.mjs", "../../../node_modules/handsontable/plugins/customBorders/contextMenuItem/bottom.mjs", "../../../node_modules/handsontable/plugins/customBorders/contextMenuItem/left.mjs", "../../../node_modules/handsontable/plugins/customBorders/contextMenuItem/noBorders.mjs", "../../../node_modules/handsontable/plugins/customBorders/contextMenuItem/right.mjs", "../../../node_modules/handsontable/plugins/customBorders/contextMenuItem/top.mjs", "../../../node_modules/handsontable/plugins/customBorders/contextMenuItem/index.mjs", "../../../node_modules/handsontable/plugins/customBorders/customBorders.mjs", "../../../node_modules/handsontable/plugins/customBorders/index.mjs", "../../../node_modules/handsontable/plugins/dragToScroll/dragToScroll.mjs", "../../../node_modules/handsontable/plugins/dragToScroll/index.mjs", "../../../node_modules/handsontable/plugins/dropdownMenu/dropdownMenu.mjs", "../../../node_modules/handsontable/plugins/dropdownMenu/index.mjs", "../../../node_modules/handsontable/plugins/exportFile/dataProvider.mjs", "../../../node_modules/handsontable/plugins/exportFile/types/_base.mjs", "../../../node_modules/handsontable/plugins/exportFile/types/csv.mjs", "../../../node_modules/handsontable/plugins/exportFile/typeFactory.mjs", "../../../node_modules/handsontable/plugins/exportFile/exportFile.mjs", "../../../node_modules/handsontable/plugins/exportFile/index.mjs", "../../../node_modules/handsontable/plugins/filters/component/_base.mjs", "../../../node_modules/handsontable/plugins/filters/conditionRegisterer.mjs", "../../../node_modules/handsontable/plugins/filters/condition/none.mjs", "../../../node_modules/handsontable/plugins/filters/condition/empty.mjs", "../../../node_modules/handsontable/plugins/filters/condition/notEmpty.mjs", "../../../node_modules/handsontable/plugins/filters/condition/equal.mjs", "../../../node_modules/handsontable/plugins/filters/condition/notEqual.mjs", "../../../node_modules/handsontable/plugins/filters/condition/greaterThan.mjs", "../../../node_modules/handsontable/plugins/filters/condition/greaterThanOrEqual.mjs", "../../../node_modules/handsontable/plugins/filters/condition/lessThan.mjs", "../../../node_modules/handsontable/plugins/filters/condition/lessThanOrEqual.mjs", "../../../node_modules/handsontable/plugins/filters/condition/date/after.mjs", "../../../node_modules/handsontable/plugins/filters/condition/date/before.mjs", "../../../node_modules/handsontable/plugins/filters/condition/between.mjs", "../../../node_modules/handsontable/plugins/filters/condition/notBetween.mjs", "../../../node_modules/handsontable/plugins/filters/condition/beginsWith.mjs", "../../../node_modules/handsontable/plugins/filters/condition/endsWith.mjs", "../../../node_modules/handsontable/plugins/filters/condition/contains.mjs", "../../../node_modules/handsontable/plugins/filters/condition/notContains.mjs", "../../../node_modules/handsontable/plugins/filters/condition/date/tomorrow.mjs", "../../../node_modules/handsontable/plugins/filters/condition/date/today.mjs", "../../../node_modules/handsontable/plugins/filters/condition/date/yesterday.mjs", "../../../node_modules/handsontable/plugins/filters/utils.mjs", "../../../node_modules/handsontable/plugins/filters/condition/byValue.mjs", "../../../node_modules/handsontable/plugins/filters/logicalOperationRegisterer.mjs", "../../../node_modules/handsontable/plugins/filters/logicalOperations/conjunction.mjs", "../../../node_modules/handsontable/plugins/filters/logicalOperations/disjunction.mjs", "../../../node_modules/handsontable/plugins/filters/logicalOperations/disjunctionWithExtraCondition.mjs", "../../../node_modules/handsontable/plugins/filters/constants.mjs", "../../../node_modules/handsontable/plugins/filters/ui/_base.mjs", "../../../node_modules/handsontable/plugins/filters/ui/input.mjs", "../../../node_modules/handsontable/plugins/filters/ui/select.mjs", "../../../node_modules/handsontable/plugins/filters/component/condition.mjs", "../../../node_modules/handsontable/plugins/filters/ui/radioInput.mjs", "../../../node_modules/handsontable/plugins/filters/component/operators.mjs", "../../../node_modules/handsontable/plugins/filters/ui/link.mjs", "../../../node_modules/handsontable/plugins/filters/ui/multipleSelect.mjs", "../../../node_modules/handsontable/plugins/filters/component/value.mjs", "../../../node_modules/handsontable/plugins/filters/component/actionBar.mjs", "../../../node_modules/handsontable/plugins/filters/conditionCollection.mjs", "../../../node_modules/handsontable/plugins/filters/dataFilter.mjs", "../../../node_modules/handsontable/plugins/filters/conditionUpdateObserver.mjs", "../../../node_modules/handsontable/plugins/filters/menu/focusNavigator.mjs", "../../../node_modules/handsontable/plugins/filters/menu/focusController.mjs", "../../../node_modules/handsontable/plugins/filters/filters.mjs", "../../../node_modules/handsontable/plugins/filters/index.mjs", "../../../node_modules/handsontable/plugins/formulas/engine/settings.mjs", "../../../node_modules/handsontable/plugins/formulas/engine/register.mjs", "../../../node_modules/handsontable/plugins/formulas/utils.mjs", "../../../node_modules/handsontable/helpers/moves.mjs", "../../../node_modules/handsontable/plugins/formulas/indexSyncer/axisSyncer.mjs", "../../../node_modules/handsontable/plugins/formulas/indexSyncer/index.mjs", "../../../node_modules/handsontable/plugins/formulas/formulas.mjs", "../../../node_modules/handsontable/plugins/formulas/index.mjs", "../../../node_modules/handsontable/plugins/hiddenColumns/contextMenuItem/hideColumn.mjs", "../../../node_modules/handsontable/plugins/hiddenColumns/contextMenuItem/showColumn.mjs", "../../../node_modules/handsontable/plugins/hiddenColumns/hiddenColumns.mjs", "../../../node_modules/handsontable/plugins/hiddenColumns/index.mjs", "../../../node_modules/handsontable/plugins/hiddenRows/contextMenuItem/hideRow.mjs", "../../../node_modules/handsontable/plugins/hiddenRows/contextMenuItem/showRow.mjs", "../../../node_modules/handsontable/plugins/hiddenRows/hiddenRows.mjs", "../../../node_modules/handsontable/plugins/hiddenRows/index.mjs", "../../../node_modules/handsontable/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs", "../../../node_modules/handsontable/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs", "../../../node_modules/handsontable/plugins/manualColumnFreeze/manualColumnFreeze.mjs", "../../../node_modules/handsontable/plugins/manualColumnFreeze/index.mjs", "../../../node_modules/handsontable/plugins/manualColumnMove/ui/_base.mjs", "../../../node_modules/handsontable/plugins/manualColumnMove/ui/backlight.mjs", "../../../node_modules/handsontable/plugins/manualColumnMove/ui/guideline.mjs", "../../../node_modules/handsontable/plugins/manualColumnMove/manualColumnMove.mjs", "../../../node_modules/handsontable/plugins/manualColumnMove/index.mjs", "../../../node_modules/handsontable/plugins/manualColumnResize/manualColumnResize.mjs", "../../../node_modules/handsontable/plugins/manualColumnResize/index.mjs", "../../../node_modules/handsontable/plugins/manualRowMove/ui/_base.mjs", "../../../node_modules/handsontable/plugins/manualRowMove/ui/backlight.mjs", "../../../node_modules/handsontable/plugins/manualRowMove/ui/guideline.mjs", "../../../node_modules/handsontable/plugins/manualRowMove/manualRowMove.mjs", "../../../node_modules/handsontable/plugins/manualRowMove/index.mjs", "../../../node_modules/handsontable/plugins/manualRowResize/manualRowResize.mjs", "../../../node_modules/handsontable/plugins/manualRowResize/index.mjs", "../../../node_modules/handsontable/plugins/mergeCells/cellCoords.mjs", "../../../node_modules/handsontable/plugins/mergeCells/cellsCollection.mjs", "../../../node_modules/handsontable/plugins/mergeCells/calculations/autofill.mjs", "../../../node_modules/handsontable/plugins/mergeCells/calculations/selection.mjs", "../../../node_modules/handsontable/plugins/mergeCells/contextMenuItem/toggleMerge.mjs", "../../../node_modules/handsontable/utils/dataStructures/linkedList.mjs", "../../../node_modules/handsontable/plugins/mergeCells/focusOrder.mjs", "../../../node_modules/handsontable/plugins/mergeCells/renderer.mjs", "../../../node_modules/handsontable/plugins/mergeCells/mergeCells.mjs", "../../../node_modules/handsontable/plugins/mergeCells/index.mjs", "../../../node_modules/handsontable/plugins/multiColumnSorting/rootComparator.mjs", "../../../node_modules/handsontable/plugins/multiColumnSorting/utils.mjs", "../../../node_modules/handsontable/plugins/multiColumnSorting/domHelpers.mjs", "../../../node_modules/handsontable/plugins/multiColumnSorting/multiColumnSorting.mjs", "../../../node_modules/handsontable/plugins/multiColumnSorting/index.mjs", "../../../node_modules/handsontable/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs", "../../../node_modules/handsontable/plugins/multipleSelectionHandles/index.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/stateManager/utils.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/stateManager/settingsNormalizer.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/stateManager/sourceSettings.mjs", "../../../node_modules/handsontable/utils/dataStructures/tree.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/stateManager/headersTree.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/stateManager/nodeModifiers/utils/tree.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/stateManager/nodeModifiers/expand.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/stateManager/nodeModifiers/hideColumn.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/stateManager/nodeModifiers/showColumn.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/stateManager/nodeModifiers/index.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/stateManager/matrixGenerator.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/stateManager/index.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/utils/ghostTable.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/nestedHeaders.mjs", "../../../node_modules/handsontable/plugins/nestedHeaders/index.mjs", "../../../node_modules/handsontable/plugins/nestedRows/data/dataManager.mjs", "../../../node_modules/handsontable/plugins/nestedRows/ui/_base.mjs", "../../../node_modules/handsontable/plugins/nestedRows/ui/headers.mjs", "../../../node_modules/handsontable/plugins/nestedRows/ui/collapsing.mjs", "../../../node_modules/handsontable/plugins/nestedRows/ui/contextMenu.mjs", "../../../node_modules/handsontable/plugins/nestedRows/utils/rowMoveController.mjs", "../../../node_modules/handsontable/plugins/nestedRows/nestedRows.mjs", "../../../node_modules/handsontable/plugins/nestedRows/index.mjs", "../../../node_modules/handsontable/plugins/persistentState/storage.mjs", "../../../node_modules/handsontable/plugins/persistentState/persistentState.mjs", "../../../node_modules/handsontable/plugins/persistentState/index.mjs", "../../../node_modules/handsontable/plugins/search/search.mjs", "../../../node_modules/handsontable/plugins/search/index.mjs", "../../../node_modules/handsontable/plugins/touchScroll/touchScroll.mjs", "../../../node_modules/handsontable/plugins/touchScroll/index.mjs", "../../../node_modules/handsontable/plugins/trimRows/trimRows.mjs", "../../../node_modules/handsontable/plugins/trimRows/index.mjs", "../../../node_modules/core-js/internals/iterators.js", "../../../node_modules/core-js/internals/is-array-iterator-method.js", "../../../node_modules/core-js/internals/get-iterator-method.js", "../../../node_modules/core-js/internals/get-iterator.js", "../../../node_modules/core-js/internals/iterate.js", "../../../node_modules/core-js/internals/create-property.js", "../../../node_modules/core-js/modules/es.object.from-entries.js", "../../../node_modules/handsontable/plugins/undoRedo/undoRedo.mjs", "../../../node_modules/handsontable/plugins/undoRedo/index.mjs", "../../../node_modules/handsontable/plugins/index.mjs", "../../../node_modules/handsontable/registry.mjs", "../../../node_modules/handsontable/helpers/wrappers/jquery.mjs", "../../../node_modules/handsontable/index.mjs", "../../javascript/controllers/transfer/import_jobs/columns.js", "../../javascript/controllers/transfer/import_jobs/cells.js", "../../javascript/controllers/transfer/base/import_status_renderer.js", "../../javascript/controllers/transfer/import_jobs/selections.js", "../../javascript/controllers/transfer/base/validators.js", "../../javascript/controllers/transfer/import_talents/columns.js", "../../javascript/controllers/transfer/import_talents/cells.js", "../../javascript/controllers/transfer/base/company_member_renderer.js", "../../javascript/controllers/transfer/base/salary_renderer.js", "../../javascript/controllers/transfer/import_talents/selections.js", "../../javascript/controllers/transfer/import_talents/attachments.js", "../../../node_modules/trix/dist/trix.js", "../../../node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/snakeize.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable_stream_source_element.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/fetch_requests.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/index.js", "../../../node_modules/@hotwired/stimulus/dist/stimulus.js", "../../javascript/controllers/application.js", "../../javascript/controllers/companies/applications/form_acceptation_controller.js", "../../../node_modules/slim-select/dist/slimselect.es.js", "../../javascript/controllers/companies/applications/select_controller.js", "../../javascript/controllers/companies/image_controller.js", "../../javascript/controllers/companies/information/tabs_controller.js", "../../javascript/controllers/companies/information_controller.js", "../../javascript/controllers/companies/inputs/form_controller.js", "../../javascript/controllers/companies/members/division_permission_controller.js", "../../javascript/controllers/companies/members/image_controller.js", "../../javascript/controllers/companies/members/inputs/password_controller.js", "../../javascript/controllers/companies/members/menu_controller.js", "../../javascript/controllers/companies/members/role_controller.js", "../../javascript/controllers/companies/members/select_controller.js", "../../javascript/controllers/companies/members/switch_controller.js", "../../javascript/controllers/companies/menu_controller.js", "../../../node_modules/@popperjs/core/lib/index.js", "../../../node_modules/@popperjs/core/lib/enums.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js", "../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js", "../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js", "../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js", "../../../node_modules/@popperjs/core/lib/utils/math.js", "../../../node_modules/@popperjs/core/lib/utils/userAgent.js", "../../../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/contains.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js", "../../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js", "../../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js", "../../../node_modules/@popperjs/core/lib/utils/within.js", "../../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js", "../../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js", "../../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js", "../../../node_modules/@popperjs/core/lib/modifiers/arrow.js", "../../../node_modules/@popperjs/core/lib/utils/getVariation.js", "../../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js", "../../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js", "../../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js", "../../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js", "../../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js", "../../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js", "../../../node_modules/@popperjs/core/lib/utils/computeOffsets.js", "../../../node_modules/@popperjs/core/lib/utils/detectOverflow.js", "../../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js", "../../../node_modules/@popperjs/core/lib/modifiers/flip.js", "../../../node_modules/@popperjs/core/lib/modifiers/hide.js", "../../../node_modules/@popperjs/core/lib/modifiers/offset.js", "../../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js", "../../../node_modules/@popperjs/core/lib/utils/getAltAxis.js", "../../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js", "../../../node_modules/@popperjs/core/lib/utils/orderModifiers.js", "../../../node_modules/@popperjs/core/lib/utils/debounce.js", "../../../node_modules/@popperjs/core/lib/utils/format.js", "../../../node_modules/@popperjs/core/lib/utils/validateModifiers.js", "../../../node_modules/@popperjs/core/lib/utils/uniqueBy.js", "../../../node_modules/@popperjs/core/lib/utils/mergeByName.js", "../../../node_modules/@popperjs/core/lib/createPopper.js", "../../../node_modules/@popperjs/core/lib/popper-lite.js", "../../../node_modules/@popperjs/core/lib/popper.js", "../../../node_modules/bootstrap/js/src/util/index.js", "../../../node_modules/bootstrap/js/src/dom/event-handler.js", "../../../node_modules/bootstrap/js/src/dom/data.js", "../../../node_modules/bootstrap/js/src/dom/manipulator.js", "../../../node_modules/bootstrap/js/src/util/config.js", "../../../node_modules/bootstrap/js/src/base-component.js", "../../../node_modules/bootstrap/js/src/util/component-functions.js", "../../../node_modules/bootstrap/js/src/alert.js", "../../../node_modules/bootstrap/js/src/button.js", "../../../node_modules/bootstrap/js/src/dom/selector-engine.js", "../../../node_modules/bootstrap/js/src/util/swipe.js", "../../../node_modules/bootstrap/js/src/carousel.js", "../../../node_modules/bootstrap/js/src/collapse.js", "../../../node_modules/bootstrap/js/src/dropdown.js", "../../../node_modules/bootstrap/js/src/util/scrollbar.js", "../../../node_modules/bootstrap/js/src/util/backdrop.js", "../../../node_modules/bootstrap/js/src/util/focustrap.js", "../../../node_modules/bootstrap/js/src/modal.js", "../../../node_modules/bootstrap/js/src/offcanvas.js", "../../../node_modules/bootstrap/js/src/util/sanitizer.js", "../../../node_modules/bootstrap/js/src/util/template-factory.js", "../../../node_modules/bootstrap/js/src/tooltip.js", "../../../node_modules/bootstrap/js/src/popover.js", "../../../node_modules/bootstrap/js/src/scrollspy.js", "../../../node_modules/bootstrap/js/src/tab.js", "../../../node_modules/bootstrap/js/src/toast.js", "../../javascript/controllers/companies/modal_confirmation_controller.js", "../../javascript/controllers/companies/modal_controller.js", "../../javascript/controllers/company_members/inputs/password_controller.js", "../../../node_modules/driver.js/dist/driver.js.mjs", "../../../node_modules/@lottiefiles/dotlottie-web/src/animation-frame-manager.ts", "../../../node_modules/@lottiefiles/dotlottie-web/src/constants.ts", "../../../node_modules/@lottiefiles/dotlottie-web/src/core/dotlottie-player.js", "../../../node_modules/@lottiefiles/dotlottie-web/src/core/dotlottie-wasm-loader.ts", "../../../node_modules/@lottiefiles/dotlottie-web/src/event-manager.ts", "../../../node_modules/@lottiefiles/dotlottie-web/src/offscreen-observer.ts", "../../../node_modules/@lottiefiles/dotlottie-web/src/resize-observer.ts", "../../../node_modules/@lottiefiles/dotlottie-web/src/utils.ts", "../../../node_modules/@lottiefiles/dotlottie-web/src/dotlottie.ts", "../../../node_modules/@lottiefiles/dotlottie-web/dist/inline-worker:/home/runner/work/dotlottie-web/dotlottie-web/packages/web/src/worker/dotlottie.worker", "../../../node_modules/@lottiefiles/dotlottie-web/src/worker/worker-manager.ts", "../../../node_modules/@lottiefiles/dotlottie-web/src/worker/dotlottie.ts", "../../../node_modules/@egjs/component/src/utils.ts", "../../../node_modules/@egjs/component/src/ActualComponentEvent.ts", "../../../node_modules/@egjs/component/src/Component.ts", "../../../node_modules/@egjs/component/src/ComponentEvent.ts", "../../../node_modules/@egjs/component/src/index.ts", "../../../node_modules/@egjs/agent/src/utils.ts", "../../../node_modules/@egjs/agent/src/presets.ts", "../../../node_modules/@egjs/agent/src/userAgent.ts", "../../../node_modules/@egjs/agent/src/userAgentData.ts", "../../../node_modules/@egjs/agent/src/agent.ts", "../../../node_modules/@egjs/axes/node_modules/@cfcs/core/src/core/utils.ts", "../../../node_modules/@egjs/axes/node_modules/@cfcs/core/src/dom/utils.ts", "../../../node_modules/@egjs/axes/node_modules/@cfcs/core/src/reactive/const.ts", "../../../node_modules/@egjs/axes/node_modules/@cfcs/core/src/reactive/detectDependencies.ts", "../../../node_modules/@egjs/axes/node_modules/@cfcs/core/src/reactive/Observer.ts", "../../../node_modules/@egjs/axes/node_modules/@cfcs/core/src/reactive/ComputedObserver.ts", "../../../node_modules/@egjs/axes/node_modules/@cfcs/core/src/reactive/decorators/Observe.ts", "../../../node_modules/@egjs/axes/node_modules/@cfcs/core/src/reactive/decorators/ReactiveSubscribe.ts", "../../../node_modules/@egjs/axes/node_modules/@cfcs/core/src/reactive/inline.ts", "../../../node_modules/@egjs/axes/node_modules/@cfcs/core/src/reactive/utils.ts", "../../../node_modules/@egjs/axes/node_modules/@cfcs/core/src/reactive/adaptReactive.ts", "../../../node_modules/@egjs/axes/node_modules/@cfcs/core/src/reactive/decorators/Computed.ts", "../../../node_modules/@egjs/axes/src/browser.ts", "../../../node_modules/@egjs/axes/src/const.ts", "../../../node_modules/@egjs/axes/src/utils.ts", "../../../node_modules/@egjs/axes/src/EventManager.ts", "../../../node_modules/@egjs/axes/src/InterruptManager.ts", "../../../node_modules/@egjs/axes/src/Coordinate.ts", "../../../node_modules/@egjs/axes/src/AxisManager.ts", "../../../node_modules/@egjs/axes/src/eventInput/EventInput.ts", "../../../node_modules/@egjs/axes/src/eventInput/MouseEventInput.ts", "../../../node_modules/@egjs/axes/src/eventInput/TouchEventInput.ts", "../../../node_modules/@egjs/axes/src/eventInput/PointerEventInput.ts", "../../../node_modules/@egjs/axes/src/eventInput/TouchMouseEventInput.ts", "../../../node_modules/@egjs/axes/src/inputType/InputType.ts", "../../../node_modules/@egjs/axes/src/InputObserver.ts", "../../../node_modules/@egjs/axes/src/animation/AnimationManager.ts", "../../../node_modules/@egjs/axes/src/animation/EasingManager.ts", "../../../node_modules/@egjs/axes/src/Axes.ts", "../../../node_modules/@egjs/axes/src/inputType/PanInput.ts", "../../../node_modules/@egjs/axes/src/inputType/RotatePanInput.ts", "../../../node_modules/@egjs/axes/src/inputType/PinchInput.ts", "../../../node_modules/@egjs/axes/src/inputType/WheelInput.ts", "../../../node_modules/@egjs/axes/src/inputType/MoveKeyInput.ts", "../../../node_modules/@egjs/axes/src/reactive.ts", "../../../node_modules/@egjs/axes/src/index.ts", "../../../node_modules/@egjs/imready/src/consts.ts", "../../../node_modules/@egjs/imready/src/utils.ts", "../../../node_modules/@egjs/imready/src/AutoSizer.ts", "../../../node_modules/@egjs/imready/src/loaders/Loader.ts", "../../../node_modules/@egjs/imready/src/loaders/ElementLoader.ts", "../../../node_modules/@egjs/imready/src/ImReadyManager.ts", "../../../node_modules/@egjs/imready/src/loaders/ImageLoader.ts", "../../../node_modules/@egjs/imready/src/loaders/VideoLoader.ts", "../../../node_modules/@egjs/imready/src/ImReady.ts", "../../../node_modules/@egjs/imready/src/reactive.ts", "../../../node_modules/@egjs/imready/src/index.ts", "../../../node_modules/@egjs/flicking/src/const/error.ts", "../../../node_modules/@egjs/flicking/src/const/external.ts", "../../../node_modules/@egjs/flicking/src/utils.ts", "../../../node_modules/@egjs/flicking/src/core/FlickingError.ts", "../../../node_modules/@egjs/flicking/src/core/Viewport.ts", "../../../node_modules/@egjs/flicking/src/core/AutoResizer.ts", "../../../node_modules/@egjs/flicking/src/core/panel/provider/VanillaElementProvider.ts", "../../../node_modules/@egjs/flicking/src/core/panel/provider/VirtualElementProvider.ts", "../../../node_modules/@egjs/flicking/src/core/VirtualManager.ts", "../../../node_modules/@egjs/flicking/src/const/axes.ts", "../../../node_modules/@egjs/flicking/src/control/states/State.ts", "../../../node_modules/@egjs/flicking/src/control/states/IdleState.ts", "../../../node_modules/@egjs/flicking/src/control/states/HoldingState.ts", "../../../node_modules/@egjs/flicking/src/control/states/DraggingState.ts", "../../../node_modules/@egjs/flicking/src/control/states/AnimatingState.ts", "../../../node_modules/@egjs/flicking/src/control/states/DisabledState.ts", "../../../node_modules/@egjs/flicking/src/control/StateMachine.ts", "../../../node_modules/@egjs/flicking/src/control/AxesController.ts", "../../../node_modules/@egjs/flicking/src/control/Control.ts", "../../../node_modules/@egjs/flicking/src/core/AnchorPoint.ts", "../../../node_modules/@egjs/flicking/src/control/SnapControl.ts", "../../../node_modules/@egjs/flicking/src/control/FreeControl.ts", "../../../node_modules/@egjs/flicking/src/control/StrictControl.ts", "../../../node_modules/@egjs/flicking/src/camera/mode/CameraMode.ts", "../../../node_modules/@egjs/flicking/src/camera/mode/LinearCameraMode.ts", "../../../node_modules/@egjs/flicking/src/camera/mode/CircularCameraMode.ts", "../../../node_modules/@egjs/flicking/src/camera/mode/BoundCameraMode.ts", "../../../node_modules/@egjs/flicking/src/camera/Camera.ts", "../../../node_modules/@egjs/flicking/src/renderer/Renderer.ts", "../../../node_modules/@egjs/flicking/src/renderer/VanillaRenderer.ts", "../../../node_modules/@egjs/flicking/src/renderer/ExternalRenderer.ts", "../../../node_modules/@egjs/flicking/src/core/panel/Panel.ts", "../../../node_modules/@egjs/flicking/src/renderer/strategy/NormalRenderingStrategy.ts", "../../../node_modules/@egjs/flicking/src/core/panel/VirtualPanel.ts", "../../../node_modules/@egjs/flicking/src/renderer/strategy/VirtualRenderingStrategy.ts", "../../../node_modules/@egjs/flicking/src/Flicking.ts", "../../../node_modules/@egjs/flicking/src/cfc/withFlickingMethods.ts", "../../../node_modules/@egjs/flicking/src/cfc/sync.ts", "../../../node_modules/@egjs/flicking/src/cfc/getRenderingPanels.ts", "../../../node_modules/@egjs/flicking/src/cfc/getDefaultCameraTransform.ts", "../../../node_modules/@egjs/flicking/src/index.ts", "../../../node_modules/@egjs/flicking-plugins/src/Parallax.ts", "../../../node_modules/@egjs/flicking-plugins/src/Fade.ts", "../../../node_modules/@egjs/flicking-plugins/src/AutoPlay.ts", "../../../node_modules/@egjs/flicking-plugins/src/event.ts", "../../../node_modules/@egjs/flicking-plugins/src/const.ts", "../../../node_modules/@egjs/flicking-plugins/src/utils.ts", "../../../node_modules/@egjs/flicking-plugins/src/Arrow.ts", "../../../node_modules/@egjs/flicking-plugins/src/Sync.ts", "../../../node_modules/@egjs/flicking-plugins/src/Perspective.ts", "../../../node_modules/@egjs/flicking-plugins/src/pagination/renderer/Renderer.ts", "../../../node_modules/@egjs/flicking-plugins/src/pagination/renderer/BulletRenderer.ts", "../../../node_modules/@egjs/flicking-plugins/src/pagination/renderer/FractionRenderer.ts", "../../../node_modules/@egjs/flicking-plugins/src/pagination/renderer/ScrollBulletRenderer.ts", "../../../node_modules/@egjs/flicking-plugins/src/pagination/Pagination.ts", "../../../node_modules/@egjs/flicking-plugins/src/index.ts", "../../javascript/controllers/dashboard/tour_controller.js", "../../../node_modules/gsap/gsap-core.js", "../../../node_modules/gsap/CSSPlugin.js", "../../../node_modules/gsap/index.js", "../../../node_modules/gsap/Observer.js", "../../../node_modules/gsap/ScrollTrigger.js", "../../javascript/controllers/home/banner_animation_controller.js", "../../javascript/controllers/home/banner_sliders_controller.js", "../../javascript/controllers/home/faq_controller.js", "../../javascript/controllers/home/index/benefits_animation_controller.js", "../../javascript/controllers/home/index/experiencing_animation_controller.js", "../../javascript/controllers/home/index/faq_animation_controller.js", "../../javascript/controllers/home/index/intro_animation_controller.js", "../../javascript/controllers/home/index/our_partner_animation_controller.js", "../../javascript/controllers/home/index/start_today_animation_controller.js", "../../javascript/controllers/home/index/steps_animation_controller.js", "../../javascript/controllers/home/index/workflow_animation_controller.js", "../../javascript/controllers/home/partner_sliders_controller.js", "../../../node_modules/gsap/ScrollToPlugin.js", "../../javascript/controllers/home/scrolling_controller.js", "../../javascript/controllers/home/workflow_sliders_controller.js", "../../javascript/controllers/inputs/file_controller.js", "../../javascript/controllers/inputs/select_date_controller.js", "../../../node_modules/autosize/dist/autosize.esm.js", "../../javascript/controllers/inputs/textarea_controller.js", "../../javascript/controllers/jobs/filters_controller.js", "../../javascript/controllers/jobs/inputs/select_controller.js", "../../javascript/controllers/jobs/inputs/text_controller.js", "../../javascript/controllers/jobs/menu_controller.js", "../../javascript/controllers/jobs/modal_confirmation_controller.js", "../../javascript/controllers/jobs/modal_leaving_controller.js", "../../javascript/controllers/jobs/tabs_controller.js", "../../javascript/controllers/jobs/tour/index_controller.js", "../../javascript/controllers/jobs/tour/new_controller.js", "../../javascript/controllers/jobs/tour/show_controller.js", "../../javascript/controllers/layouts/check_list_controller.js", "../../javascript/controllers/layouts/header_controller.js", "../../javascript/controllers/layouts/header_flash_controller.js", "../../javascript/controllers/layouts/header_user_menu_controller.js", "../../../node_modules/body-scroll-lock/lib/bodyScrollLock.esm.js", "../../javascript/controllers/layouts_controller.js", "../../javascript/controllers/my_tasks/filters_controller.js", "../../javascript/controllers/my_tasks/tasks_list_controller.js", "../../javascript/controllers/selection_processes/filters_controller.js", "../../javascript/controllers/selection_processes/inputs/filter_select_controller.js", "../../javascript/controllers/selection_processes/inputs/form_controller.js", "../../javascript/controllers/selection_processes/inputs/select_controller.js", "../../javascript/controllers/selection_processes/inputs/text_controller.js", "../../javascript/controllers/selection_processes/inputs/textarea_controller.js", "../../javascript/controllers/selection_processes/modal_controller.js", "../../../node_modules/scrollbooster/src/index.js", "../../javascript/controllers/selection_processes/sections_controller.js", "../../javascript/controllers/selection_processes/tabs_controller.js", "../../javascript/controllers/talents/filters_controller.js", "../../javascript/controllers/talents/form_task_controller.js", "../../javascript/controllers/talents/image_controller.js", "../../javascript/controllers/talents/inputs/select_active_job_controller.js", "../../javascript/controllers/talents/inputs/select_controller.js", "../../javascript/controllers/talents/inputs/select_date_controller.js", "../../javascript/controllers/talents/inputs/select_task_owner_controller.js", "../../javascript/controllers/talents/inputs/text_controller.js", "../../javascript/controllers/talents/memo_mobile_controller.js", "../../javascript/controllers/talents/menu_controller.js", "../../javascript/controllers/talents/modal_confirmation_controller.js", "../../javascript/controllers/talents/modal_leaving_controller.js", "../../javascript/controllers/talents/tabs_controller.js", "../../javascript/controllers/talents/tasks/status_controller.js", "../../javascript/controllers/talents/tour/index_controller.js", "../../javascript/controllers/talents/tour/new_controller.js", "../../javascript/controllers/talents/tour/show_controller.js", "../../javascript/controllers/transfer/export_controller.js", "../../javascript/controllers/transfer/import_jobs_controller.js", "../../javascript/controllers/transfer/import_talents_controller.js", "../../javascript/controllers/index.js", "../../javascript/application.js", "../../../node_modules/@rails/actiontext/app/assets/javascripts/actiontext.js"], "sourcesContent": ["export default {\n logger: self.console,\n WebSocket: self.WebSocket\n}\n", "import adapters from \"./adapters\"\n\n// The logger is disabled by default. You can enable it with:\n//\n// ActionCable.logger.enabled = true\n//\n// Example:\n//\n// import * as ActionCable from '@rails/actioncable'\n//\n// ActionCable.logger.enabled = true\n// ActionCable.logger.log('Connection Established.')\n//\n\nexport default {\n log(...messages) {\n if (this.enabled) {\n messages.push(Date.now())\n adapters.logger.log(\"[ActionCable]\", ...messages)\n }\n },\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring the cable connection is in good health by validating the heartbeat pings sent from the server, and attempting\n// revival reconnections if things go astray. Internal class, not intended for direct user manipulation.\n\nconst now = () => new Date().getTime()\n\nconst secondsSince = time => (now() - time) / 1000\n\nclass ConnectionMonitor {\n constructor(connection) {\n this.visibilityDidChange = this.visibilityDidChange.bind(this)\n this.connection = connection\n this.reconnectAttempts = 0\n }\n\n start() {\n if (!this.isRunning()) {\n this.startedAt = now()\n delete this.stoppedAt\n this.startPolling()\n addEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`)\n }\n }\n\n stop() {\n if (this.isRunning()) {\n this.stoppedAt = now()\n this.stopPolling()\n removeEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(\"ConnectionMonitor stopped\")\n }\n }\n\n isRunning() {\n return this.startedAt && !this.stoppedAt\n }\n\n recordPing() {\n this.pingedAt = now()\n }\n\n recordConnect() {\n this.reconnectAttempts = 0\n this.recordPing()\n delete this.disconnectedAt\n logger.log(\"ConnectionMonitor recorded connect\")\n }\n\n recordDisconnect() {\n this.disconnectedAt = now()\n logger.log(\"ConnectionMonitor recorded disconnect\")\n }\n\n // Private\n\n startPolling() {\n this.stopPolling()\n this.poll()\n }\n\n stopPolling() {\n clearTimeout(this.pollTimeout)\n }\n\n poll() {\n this.pollTimeout = setTimeout(() => {\n this.reconnectIfStale()\n this.poll()\n }\n , this.getPollInterval())\n }\n\n getPollInterval() {\n const { staleThreshold, reconnectionBackoffRate } = this.constructor\n const backoff = Math.pow(1 + reconnectionBackoffRate, Math.min(this.reconnectAttempts, 10))\n const jitterMax = this.reconnectAttempts === 0 ? 1.0 : reconnectionBackoffRate\n const jitter = jitterMax * Math.random()\n return staleThreshold * 1000 * backoff * (1 + jitter)\n }\n\n reconnectIfStale() {\n if (this.connectionIsStale()) {\n logger.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`)\n this.reconnectAttempts++\n if (this.disconnectedRecently()) {\n logger.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(this.disconnectedAt)} s`)\n } else {\n logger.log(\"ConnectionMonitor reopening\")\n this.connection.reopen()\n }\n }\n }\n\n get refreshedAt() {\n return this.pingedAt ? this.pingedAt : this.startedAt\n }\n\n connectionIsStale() {\n return secondsSince(this.refreshedAt) > this.constructor.staleThreshold\n }\n\n disconnectedRecently() {\n return this.disconnectedAt && (secondsSince(this.disconnectedAt) < this.constructor.staleThreshold)\n }\n\n visibilityDidChange() {\n if (document.visibilityState === \"visible\") {\n setTimeout(() => {\n if (this.connectionIsStale() || !this.connection.isOpen()) {\n logger.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`)\n this.connection.reopen()\n }\n }\n , 200)\n }\n }\n\n}\n\nConnectionMonitor.staleThreshold = 6 // Server::Connections::BEAT_INTERVAL * 2 (missed two pings)\nConnectionMonitor.reconnectionBackoffRate = 0.15\n\nexport default ConnectionMonitor\n", "export default {\n \"message_types\": {\n \"welcome\": \"welcome\",\n \"disconnect\": \"disconnect\",\n \"ping\": \"ping\",\n \"confirmation\": \"confirm_subscription\",\n \"rejection\": \"reject_subscription\"\n },\n \"disconnect_reasons\": {\n \"unauthorized\": \"unauthorized\",\n \"invalid_request\": \"invalid_request\",\n \"server_restart\": \"server_restart\"\n },\n \"default_mount_path\": \"/cable\",\n \"protocols\": [\n \"actioncable-v1-json\",\n \"actioncable-unsupported\"\n ]\n}\n", "import adapters from \"./adapters\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport INTERNAL from \"./internal\"\nimport logger from \"./logger\"\n\n// Encapsulate the cable connection held by the consumer. This is an internal class not intended for direct user manipulation.\n\nconst {message_types, protocols} = INTERNAL\nconst supportedProtocols = protocols.slice(0, protocols.length - 1)\n\nconst indexOf = [].indexOf\n\nclass Connection {\n constructor(consumer) {\n this.open = this.open.bind(this)\n this.consumer = consumer\n this.subscriptions = this.consumer.subscriptions\n this.monitor = new ConnectionMonitor(this)\n this.disconnected = true\n }\n\n send(data) {\n if (this.isOpen()) {\n this.webSocket.send(JSON.stringify(data))\n return true\n } else {\n return false\n }\n }\n\n open() {\n if (this.isActive()) {\n logger.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`)\n return false\n } else {\n logger.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${protocols}`)\n if (this.webSocket) { this.uninstallEventHandlers() }\n this.webSocket = new adapters.WebSocket(this.consumer.url, protocols)\n this.installEventHandlers()\n this.monitor.start()\n return true\n }\n }\n\n close({allowReconnect} = {allowReconnect: true}) {\n if (!allowReconnect) { this.monitor.stop() }\n // Avoid closing websockets in a \"connecting\" state due to Safari 15.1+ bug. See: https://github.com/rails/rails/issues/43835#issuecomment-1002288478\n if (this.isOpen()) {\n return this.webSocket.close()\n }\n }\n\n reopen() {\n logger.log(`Reopening WebSocket, current state is ${this.getState()}`)\n if (this.isActive()) {\n try {\n return this.close()\n } catch (error) {\n logger.log(\"Failed to reopen WebSocket\", error)\n }\n finally {\n logger.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`)\n setTimeout(this.open, this.constructor.reopenDelay)\n }\n } else {\n return this.open()\n }\n }\n\n getProtocol() {\n if (this.webSocket) {\n return this.webSocket.protocol\n }\n }\n\n isOpen() {\n return this.isState(\"open\")\n }\n\n isActive() {\n return this.isState(\"open\", \"connecting\")\n }\n\n // Private\n\n isProtocolSupported() {\n return indexOf.call(supportedProtocols, this.getProtocol()) >= 0\n }\n\n isState(...states) {\n return indexOf.call(states, this.getState()) >= 0\n }\n\n getState() {\n if (this.webSocket) {\n for (let state in adapters.WebSocket) {\n if (adapters.WebSocket[state] === this.webSocket.readyState) {\n return state.toLowerCase()\n }\n }\n }\n return null\n }\n\n installEventHandlers() {\n for (let eventName in this.events) {\n const handler = this.events[eventName].bind(this)\n this.webSocket[`on${eventName}`] = handler\n }\n }\n\n uninstallEventHandlers() {\n for (let eventName in this.events) {\n this.webSocket[`on${eventName}`] = function() {}\n }\n }\n\n}\n\nConnection.reopenDelay = 500\n\nConnection.prototype.events = {\n message(event) {\n if (!this.isProtocolSupported()) { return }\n const {identifier, message, reason, reconnect, type} = JSON.parse(event.data)\n switch (type) {\n case message_types.welcome:\n this.monitor.recordConnect()\n return this.subscriptions.reload()\n case message_types.disconnect:\n logger.log(`Disconnecting. Reason: ${reason}`)\n return this.close({allowReconnect: reconnect})\n case message_types.ping:\n return this.monitor.recordPing()\n case message_types.confirmation:\n this.subscriptions.confirmSubscription(identifier)\n return this.subscriptions.notify(identifier, \"connected\")\n case message_types.rejection:\n return this.subscriptions.reject(identifier)\n default:\n return this.subscriptions.notify(identifier, \"received\", message)\n }\n },\n\n open() {\n logger.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`)\n this.disconnected = false\n if (!this.isProtocolSupported()) {\n logger.log(\"Protocol is unsupported. Stopping monitor and disconnecting.\")\n return this.close({allowReconnect: false})\n }\n },\n\n close(event) {\n logger.log(\"WebSocket onclose event\")\n if (this.disconnected) { return }\n this.disconnected = true\n this.monitor.recordDisconnect()\n return this.subscriptions.notifyAll(\"disconnected\", {willAttemptReconnect: this.monitor.isRunning()})\n },\n\n error() {\n logger.log(\"WebSocket onerror event\")\n }\n}\n\nexport default Connection\n", "// A new subscription is created through the ActionCable.Subscriptions instance available on the consumer.\n// It provides a number of callbacks and a method for calling remote procedure calls on the corresponding\n// Channel instance on the server side.\n//\n// An example demonstrates the basic functionality:\n//\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\", {\n// connected() {\n// // Called once the subscription has been successfully completed\n// },\n//\n// disconnected({ willAttemptReconnect: boolean }) {\n// // Called when the client has disconnected with the server.\n// // The object will have an `willAttemptReconnect` property which\n// // says whether the client has the intention of attempting\n// // to reconnect.\n// },\n//\n// appear() {\n// this.perform('appear', {appearing_on: this.appearingOn()})\n// },\n//\n// away() {\n// this.perform('away')\n// },\n//\n// appearingOn() {\n// $('main').data('appearing-on')\n// }\n// })\n//\n// The methods #appear and #away forward their intent to the remote AppearanceChannel instance on the server\n// by calling the `perform` method with the first parameter being the action (which maps to AppearanceChannel#appear/away).\n// The second parameter is a hash that'll get JSON encoded and made available on the server in the data parameter.\n//\n// This is how the server component would look:\n//\n// class AppearanceChannel < ApplicationActionCable::Channel\n// def subscribed\n// current_user.appear\n// end\n//\n// def unsubscribed\n// current_user.disappear\n// end\n//\n// def appear(data)\n// current_user.appear on: data['appearing_on']\n// end\n//\n// def away\n// current_user.away\n// end\n// end\n//\n// The \"AppearanceChannel\" name is automatically mapped between the client-side subscription creation and the server-side Ruby class name.\n// The AppearanceChannel#appear/away public methods are exposed automatically to client-side invocation through the perform method.\n\nconst extend = function(object, properties) {\n if (properties != null) {\n for (let key in properties) {\n const value = properties[key]\n object[key] = value\n }\n }\n return object\n}\n\nexport default class Subscription {\n constructor(consumer, params = {}, mixin) {\n this.consumer = consumer\n this.identifier = JSON.stringify(params)\n extend(this, mixin)\n }\n\n // Perform a channel action with the optional data passed as an attribute\n perform(action, data = {}) {\n data.action = action\n return this.send(data)\n }\n\n send(data) {\n return this.consumer.send({command: \"message\", identifier: this.identifier, data: JSON.stringify(data)})\n }\n\n unsubscribe() {\n return this.consumer.subscriptions.remove(this)\n }\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring channel subscribe command is confirmed, retrying until confirmation is received.\n// Internal class, not intended for direct user manipulation.\n\nclass SubscriptionGuarantor {\n constructor(subscriptions) {\n this.subscriptions = subscriptions\n this.pendingSubscriptions = []\n }\n\n guarantee(subscription) {\n if(this.pendingSubscriptions.indexOf(subscription) == -1){ \n logger.log(`SubscriptionGuarantor guaranteeing ${subscription.identifier}`)\n this.pendingSubscriptions.push(subscription) \n }\n else {\n logger.log(`SubscriptionGuarantor already guaranteeing ${subscription.identifier}`)\n }\n this.startGuaranteeing()\n }\n\n forget(subscription) {\n logger.log(`SubscriptionGuarantor forgetting ${subscription.identifier}`)\n this.pendingSubscriptions = (this.pendingSubscriptions.filter((s) => s !== subscription))\n }\n\n startGuaranteeing() {\n this.stopGuaranteeing()\n this.retrySubscribing()\n }\n \n stopGuaranteeing() {\n clearTimeout(this.retryTimeout)\n }\n\n retrySubscribing() {\n this.retryTimeout = setTimeout(() => {\n if (this.subscriptions && typeof(this.subscriptions.subscribe) === \"function\") {\n this.pendingSubscriptions.map((subscription) => {\n logger.log(`SubscriptionGuarantor resubscribing ${subscription.identifier}`)\n this.subscriptions.subscribe(subscription)\n })\n }\n }\n , 500)\n }\n}\n\nexport default SubscriptionGuarantor", "import Subscription from \"./subscription\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport logger from \"./logger\"\n\n// Collection class for creating (and internally managing) channel subscriptions.\n// The only method intended to be triggered by the user is ActionCable.Subscriptions#create,\n// and it should be called through the consumer like so:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n\nexport default class Subscriptions {\n constructor(consumer) {\n this.consumer = consumer\n this.guarantor = new SubscriptionGuarantor(this)\n this.subscriptions = []\n }\n\n create(channelName, mixin) {\n const channel = channelName\n const params = typeof channel === \"object\" ? channel : {channel}\n const subscription = new Subscription(this.consumer, params, mixin)\n return this.add(subscription)\n }\n\n // Private\n\n add(subscription) {\n this.subscriptions.push(subscription)\n this.consumer.ensureActiveConnection()\n this.notify(subscription, \"initialized\")\n this.subscribe(subscription)\n return subscription\n }\n\n remove(subscription) {\n this.forget(subscription)\n if (!this.findAll(subscription.identifier).length) {\n this.sendCommand(subscription, \"unsubscribe\")\n }\n return subscription\n }\n\n reject(identifier) {\n return this.findAll(identifier).map((subscription) => {\n this.forget(subscription)\n this.notify(subscription, \"rejected\")\n return subscription\n })\n }\n\n forget(subscription) {\n this.guarantor.forget(subscription)\n this.subscriptions = (this.subscriptions.filter((s) => s !== subscription))\n return subscription\n }\n\n findAll(identifier) {\n return this.subscriptions.filter((s) => s.identifier === identifier)\n }\n\n reload() {\n return this.subscriptions.map((subscription) =>\n this.subscribe(subscription))\n }\n\n notifyAll(callbackName, ...args) {\n return this.subscriptions.map((subscription) =>\n this.notify(subscription, callbackName, ...args))\n }\n\n notify(subscription, callbackName, ...args) {\n let subscriptions\n if (typeof subscription === \"string\") {\n subscriptions = this.findAll(subscription)\n } else {\n subscriptions = [subscription]\n }\n\n return subscriptions.map((subscription) =>\n (typeof subscription[callbackName] === \"function\" ? subscription[callbackName](...args) : undefined))\n }\n\n subscribe(subscription) {\n if (this.sendCommand(subscription, \"subscribe\")) {\n this.guarantor.guarantee(subscription)\n }\n }\n\n confirmSubscription(identifier) {\n logger.log(`Subscription confirmed ${identifier}`)\n this.findAll(identifier).map((subscription) =>\n this.guarantor.forget(subscription))\n }\n\n sendCommand(subscription, command) {\n const {identifier} = subscription\n return this.consumer.send({command, identifier})\n }\n}\n", "import Connection from \"./connection\"\nimport Subscriptions from \"./subscriptions\"\n\n// The ActionCable.Consumer establishes the connection to a server-side Ruby Connection object. Once established,\n// the ActionCable.ConnectionMonitor will ensure that its properly maintained through heartbeats and checking for stale updates.\n// The Consumer instance is also the gateway to establishing subscriptions to desired channels through the #createSubscription\n// method.\n//\n// The following example shows how this can be set up:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n//\n// When a consumer is created, it automatically connects with the server.\n//\n// To disconnect from the server, call\n//\n// App.cable.disconnect()\n//\n// and to restart the connection:\n//\n// App.cable.connect()\n//\n// Any channel subscriptions which existed prior to disconnecting will\n// automatically resubscribe.\n\nexport default class Consumer {\n constructor(url) {\n this._url = url\n this.subscriptions = new Subscriptions(this)\n this.connection = new Connection(this)\n }\n\n get url() {\n return createWebSocketURL(this._url)\n }\n\n send(data) {\n return this.connection.send(data)\n }\n\n connect() {\n return this.connection.open()\n }\n\n disconnect() {\n return this.connection.close({allowReconnect: false})\n }\n\n ensureActiveConnection() {\n if (!this.connection.isActive()) {\n return this.connection.open()\n }\n }\n}\n\nexport function createWebSocketURL(url) {\n if (typeof url === \"function\") {\n url = url()\n }\n\n if (url && !/^wss?:/i.test(url)) {\n const a = document.createElement(\"a\")\n a.href = url\n // Fix populating Location properties in IE. Otherwise, protocol will be blank.\n a.href = a.href\n a.protocol = a.protocol.replace(\"http\", \"ws\")\n return a.href\n } else {\n return url\n }\n}\n", "import Connection from \"./connection\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport Consumer, { createWebSocketURL } from \"./consumer\"\nimport INTERNAL from \"./internal\"\nimport Subscription from \"./subscription\"\nimport Subscriptions from \"./subscriptions\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport adapters from \"./adapters\"\nimport logger from \"./logger\"\n\nexport {\n Connection,\n ConnectionMonitor,\n Consumer,\n INTERNAL,\n Subscription,\n Subscriptions,\n SubscriptionGuarantor,\n adapters,\n createWebSocketURL,\n logger,\n}\n\nexport function createConsumer(url = getConfig(\"url\") || INTERNAL.default_mount_path) {\n return new Consumer(url)\n}\n\nexport function getConfig(name) {\n const element = document.head.querySelector(`meta[name='action-cable-${name}']`)\n if (element) {\n return element.getAttribute(\"content\")\n }\n}\n", "/*!\n * ripple-effects\n * customizable ripple effect with one line of code\n *\n * @version v1.0.2\n * @author Cris Fandi\u00F1o \n */\n!function(e,t){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define(t):(e=\"undefined\"!=typeof globalThis?globalThis:e||self).ripple=t()}(this,(function(){\"use strict\";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function n(n){for(var o=1;o-1}function c(e){var t,n={top:0,left:0};return t=(e&&e.ownerDocument).documentElement,void 0!==e.getBoundingClientRect&&(n=e.getBoundingClientRect()),{top:n.top+window.pageYOffset-t.clientTop,left:n.left+window.pageXOffset-t.clientLeft}}function u(e){for(var t=[],n=0;n1&&void 0!==arguments[1]?arguments[1]:document,n=e instanceof HTMLCollection||e instanceof NodeList;return n?u(e):e instanceof Element?[e]:u(t.querySelectorAll(e))}var l=Object.freeze({__proto__:null,tag:r,styles:i,edit:a,isSelfTag:s,offset:c,elementToArray:f}),p={background:\"rgb(150,150,150)\",opacity:.5,zIndex:99,duration:700,timing:\"ease\",outDuration:800},d=r,h=a,g=c,b=f,y=s,m=i;function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:\"_\",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=t=n(n({},p),t),r=o.background,i=o.opacity,a=o.zIndex,s=o.duration,c=o.timing,u=o.height,f=o.width,l=o.triggerOnChild,v=void 0===l||l,w=o.triggerExcept,O=void 0===w?\"_\":w,_=o.outDuration,P=\"ontouchstart\"in window;function j(e){if(!(b(O,this).indexOf(e.target)>-1)&&(e.target===this||v)){var t,n;\"static\"===m(this,\"position\").toLowerCase()&&(this.style.position=\"relative\");var o=g(this).top,l=g(this).left;try{if(e.touches[1])return;n=e.touches[0].pageX-l,t=e.touches[0].pageY-o}catch(r){n=e.pageX-l,t=e.pageY-o}var p=this.offsetWidth,y=this.offsetHeight,w=d(\"div\",{appendTo:this,className:\"ripleParent__\",style:{zIndex:a,height:y+\"px\",width:p+\"px\",borderRadius:m(this,\"borderRadius\"),clipPath:m(this,\"clipPath\"),transition:\"opacity \".concat(_,\"ms linear\")}});d(\"div\",{appendTo:w,className:\"riple__\",style:{top:t+\"px\",left:n+\"px\",opacity:i,width:f||p*Math.PI+\"px\",height:u||p*Math.PI+\"px\",background:r,animation:\"ripple__ \".concat(s,\"ms \").concat(c,\" both\")}});var j=P?\"touchend touchcancel\":\"mouseleave mouseup\";h(this).on(j,(function e(){var t=this;w.style.opacity=0,setTimeout((function(){return t.removeChild(w)}),_),h(this).off(j,e)}))}}var x=b(e),C=P?\"touchstart\":\"mousedown\";return x.forEach((function(e){if(y(e))return console.error(\"Ripple is not allowed on self closing tag you need to wrap it\");h(e).on(C,j)})),{destroy:function(){x.forEach((function(e){return h(e).off(C,j)}))}}}return d(\"style\",{innerHTML:\".ripleParent__{pointer-events:none;overflow:hidden;background:transparent;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.riple__{border-radius:50%;position: absolute;will-change:transform; pointer-events:none;}@keyframes ripple__{0%{transform: translate(-50%,-50%) scale(0);}100%{transform: translate(-50%,-50%) scale(1);}}\",appendTo:document.head}),v.utils=l,v}));\n", "'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar win$1 = window;\nvar raf = win$1.requestAnimationFrame || win$1.webkitRequestAnimationFrame || win$1.mozRequestAnimationFrame || win$1.msRequestAnimationFrame || function (cb) {\n return setTimeout(cb, 16);\n};\n\nvar win = window;\nvar caf = win.cancelAnimationFrame || win.mozCancelAnimationFrame || function (id) {\n clearTimeout(id);\n};\n\nfunction extend() {\n var obj,\n name,\n copy,\n target = arguments[0] || {},\n i = 1,\n length = arguments.length;\n\n for (; i < length; i++) {\n if ((obj = arguments[i]) !== null) {\n for (name in obj) {\n copy = obj[name];\n\n if (target === copy) {\n continue;\n } else if (copy !== undefined) {\n target[name] = copy;\n }\n }\n }\n }\n\n return target;\n}\n\nfunction checkStorageValue(value) {\n return ['true', 'false'].indexOf(value) >= 0 ? JSON.parse(value) : value;\n}\n\nfunction setLocalStorage(storage, key, value, access) {\n if (access) {\n try {\n storage.setItem(key, value);\n } catch (e) {}\n }\n\n return value;\n}\n\nfunction getSlideId() {\n var id = window.tnsId;\n window.tnsId = !id ? 1 : id + 1;\n return 'tns' + window.tnsId;\n}\n\nfunction getBody() {\n var doc = document,\n body = doc.body;\n\n if (!body) {\n body = doc.createElement('body');\n body.fake = true;\n }\n\n return body;\n}\n\nvar docElement = document.documentElement;\n\nfunction setFakeBody(body) {\n var docOverflow = '';\n\n if (body.fake) {\n docOverflow = docElement.style.overflow; //avoid crashing IE8, if background image is used\n\n body.style.background = ''; //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible\n\n body.style.overflow = docElement.style.overflow = 'hidden';\n docElement.appendChild(body);\n }\n\n return docOverflow;\n}\n\nfunction resetFakeBody(body, docOverflow) {\n if (body.fake) {\n body.remove();\n docElement.style.overflow = docOverflow; // Trigger layout so kinetic scrolling isn't disabled in iOS6+\n // eslint-disable-next-line\n\n docElement.offsetHeight;\n }\n}\n\n// get css-calc \nfunction calc() {\n var doc = document,\n body = getBody(),\n docOverflow = setFakeBody(body),\n div = doc.createElement('div'),\n result = false;\n body.appendChild(div);\n\n try {\n var str = '(10px * 10)',\n vals = ['calc' + str, '-moz-calc' + str, '-webkit-calc' + str],\n val;\n\n for (var i = 0; i < 3; i++) {\n val = vals[i];\n div.style.width = val;\n\n if (div.offsetWidth === 100) {\n result = val.replace(str, '');\n break;\n }\n }\n } catch (e) {}\n\n body.fake ? resetFakeBody(body, docOverflow) : div.remove();\n return result;\n}\n\n// get subpixel support value\nfunction percentageLayout() {\n // check subpixel layout supporting\n var doc = document,\n body = getBody(),\n docOverflow = setFakeBody(body),\n wrapper = doc.createElement('div'),\n outer = doc.createElement('div'),\n str = '',\n count = 70,\n perPage = 3,\n supported = false;\n wrapper.className = \"tns-t-subp2\";\n outer.className = \"tns-t-ct\";\n\n for (var i = 0; i < count; i++) {\n str += '
';\n }\n\n outer.innerHTML = str;\n wrapper.appendChild(outer);\n body.appendChild(wrapper);\n supported = Math.abs(wrapper.getBoundingClientRect().left - outer.children[count - perPage].getBoundingClientRect().left) < 2;\n body.fake ? resetFakeBody(body, docOverflow) : wrapper.remove();\n return supported;\n}\n\nfunction mediaquerySupport() {\n if (window.matchMedia || window.msMatchMedia) {\n return true;\n }\n\n var doc = document,\n body = getBody(),\n docOverflow = setFakeBody(body),\n div = doc.createElement('div'),\n style = doc.createElement('style'),\n rule = '@media all and (min-width:1px){.tns-mq-test{position:absolute}}',\n position;\n style.type = 'text/css';\n div.className = 'tns-mq-test';\n body.appendChild(style);\n body.appendChild(div);\n\n if (style.styleSheet) {\n style.styleSheet.cssText = rule;\n } else {\n style.appendChild(doc.createTextNode(rule));\n }\n\n position = window.getComputedStyle ? window.getComputedStyle(div).position : div.currentStyle['position'];\n body.fake ? resetFakeBody(body, docOverflow) : div.remove();\n return position === \"absolute\";\n}\n\n// create and append style sheet\nfunction createStyleSheet(media, nonce) {\n // Create the '].join('');\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n/**\n * @description\n * Copy, cut, and paste data by using the `CopyPaste` plugin.\n *\n * Control the `CopyPaste` plugin programmatically through its [API methods](#methods).\n *\n * The user can access the copy-paste features through:\n * - The [context menu](@/guides/cell-features/clipboard/clipboard.md#context-menu).\n * - The [keyboard shortcuts](@/guides/cell-features/clipboard/clipboard.md#related-keyboard-shortcuts).\n * - The browser's menu bar.\n *\n * Read more:\n * - [Guides: Clipboard](@/guides/cell-features/clipboard/clipboard.md)\n * - [Configuration options: `copyPaste`](@/api/options.md#copypaste)\n *\n * @example\n * ```js\n * // enable the plugin with the default configuration\n * copyPaste: true,\n *\n * // or, enable the plugin with a custom configuration\n * copyPaste: {\n * columnsLimit: 25,\n * rowsLimit: 50,\n * pasteMode: 'shift_down',\n * copyColumnHeaders: true,\n * copyColumnGroupHeaders: true,\n * copyColumnHeadersOnly: true,\n * uiContainer: document.body,\n * },\n * ```\n * @class CopyPaste\n * @plugin CopyPaste\n */\nvar _enableCopyColumnHeaders = /*#__PURE__*/new WeakMap();\nvar _enableCopyColumnGroupHeaders = /*#__PURE__*/new WeakMap();\nvar _enableCopyColumnHeadersOnly = /*#__PURE__*/new WeakMap();\nvar _copyMode = /*#__PURE__*/new WeakMap();\nvar _isTriggeredByCopy = /*#__PURE__*/new WeakMap();\nvar _isTriggeredByCut = /*#__PURE__*/new WeakMap();\nvar _copyableRangesFactory = /*#__PURE__*/new WeakMap();\nvar _preventViewportScrollOnPaste = /*#__PURE__*/new WeakMap();\nvar _CopyPaste_brand = /*#__PURE__*/new WeakSet();\nexport class CopyPaste extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * Ensure that the `copy`/`cut` events get triggered properly in Safari.\n *\n * @param {string} eventName Name of the event to get triggered.\n */\n _classPrivateMethodInitSpec(this, _CopyPaste_brand);\n /**\n * The maximum number of columns than can be copied to the clipboard.\n *\n * @type {number}\n * @default Infinity\n */\n _defineProperty(this, \"columnsLimit\", Infinity);\n /**\n * The maximum number of rows than can be copied to the clipboard.\n *\n * @type {number}\n * @default Infinity\n */\n _defineProperty(this, \"rowsLimit\", Infinity);\n /**\n * When pasting:\n * - `'overwrite'` - overwrite the currently-selected cells\n * - `'shift_down'` - move currently-selected cells down\n * - `'shift_right'` - move currently-selected cells to the right\n *\n * @type {string}\n * @default 'overwrite'\n */\n _defineProperty(this, \"pasteMode\", 'overwrite');\n /**\n * The UI container for the secondary focusable element.\n *\n * @type {HTMLElement}\n */\n _defineProperty(this, \"uiContainer\", this.hot.rootDocument.body);\n /**\n * Shows the \"Copy with headers\" item in the context menu and extends the context menu with the\n * `'copy_with_column_headers'` option that can be used for creating custom menus arrangements.\n *\n * @type {boolean}\n * @default false\n */\n _classPrivateFieldInitSpec(this, _enableCopyColumnHeaders, false);\n /**\n * Shows the \"Copy with group headers\" item in the context menu and extends the context menu with the\n * `'copy_with_column_group headers'` option that can be used for creating custom menus arrangements.\n *\n * @type {boolean}\n * @default false\n */\n _classPrivateFieldInitSpec(this, _enableCopyColumnGroupHeaders, false);\n /**\n * Shows the \"Copy headers only\" item in the context menu and extends the context menu with the\n * `'copy_column_headers_only'` option that can be used for creating custom menus arrangements.\n *\n * @type {boolean}\n * @default false\n */\n _classPrivateFieldInitSpec(this, _enableCopyColumnHeadersOnly, false);\n /**\n * Defines the data range to copy. Possible values:\n * * `'cells-only'` Copy selected cells only;\n * * `'column-headers-only'` Copy column headers only;\n * * `'with-column-group-headers'` Copy cells with all column headers;\n * * `'with-column-headers'` Copy cells with column headers;\n *\n * @type {'cells-only' | 'column-headers-only' | 'with-column-group-headers' | 'with-column-headers'}\n */\n _classPrivateFieldInitSpec(this, _copyMode, 'cells-only');\n /**\n * Flag that is used to prevent copying when the native shortcut was not pressed.\n *\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _isTriggeredByCopy, false);\n /**\n * Flag that is used to prevent cutting when the native shortcut was not pressed.\n *\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _isTriggeredByCut, false);\n /**\n * Class that helps generate copyable ranges based on the current selection for different copy mode\n * types.\n *\n * @type {CopyableRangesFactory}\n */\n _classPrivateFieldInitSpec(this, _copyableRangesFactory, new CopyableRangesFactory({\n countRows: () => this.hot.countRows(),\n countColumns: () => this.hot.countCols(),\n rowsLimit: () => this.rowsLimit,\n columnsLimit: () => this.columnsLimit,\n countColumnHeaders: () => this.hot.view.getColumnHeadersCount()\n }));\n /**\n * Flag that indicates if the viewport scroll should be prevented after pasting the data.\n *\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _preventViewportScrollOnPaste, false);\n /**\n * Ranges of the cells coordinates, which should be used to copy/cut/paste actions.\n *\n * @private\n * @type {Array<{startRow: number, startCol: number, endRow: number, endCol: number}>}\n */\n _defineProperty(this, \"copyableRanges\", []);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get SETTING_KEYS() {\n return [PLUGIN_KEY, ...SETTING_KEYS];\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the [`CopyPaste`](#copypaste) plugin is enabled.\n *\n * This method gets called by Handsontable's [`beforeInit`](@/api/hooks.md#beforeinit) hook.\n * If it returns `true`, the [`enablePlugin()`](#enableplugin) method gets called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the [`CopyPaste`](#copypaste) plugin for your Handsontable instance.\n */\n enablePlugin() {\n var _this = this;\n if (this.enabled) {\n return;\n }\n const {\n [PLUGIN_KEY]: settings\n } = this.hot.getSettings();\n if (typeof settings === 'object') {\n var _settings$pasteMode, _settings$uiContainer;\n this.pasteMode = (_settings$pasteMode = settings.pasteMode) !== null && _settings$pasteMode !== void 0 ? _settings$pasteMode : this.pasteMode;\n this.rowsLimit = isNaN(settings.rowsLimit) ? this.rowsLimit : settings.rowsLimit;\n this.columnsLimit = isNaN(settings.columnsLimit) ? this.columnsLimit : settings.columnsLimit;\n _classPrivateFieldSet(_enableCopyColumnHeaders, this, !!settings.copyColumnHeaders);\n _classPrivateFieldSet(_enableCopyColumnGroupHeaders, this, !!settings.copyColumnGroupHeaders);\n _classPrivateFieldSet(_enableCopyColumnHeadersOnly, this, !!settings.copyColumnHeadersOnly);\n this.uiContainer = (_settings$uiContainer = settings.uiContainer) !== null && _settings$uiContainer !== void 0 ? _settings$uiContainer : this.uiContainer;\n }\n this.addHook('afterContextMenuDefaultOptions', options => _assertClassBrand(_CopyPaste_brand, this, _onAfterContextMenuDefaultOptions).call(this, options));\n this.addHook('afterSelection', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _assertClassBrand(_CopyPaste_brand, _this, _onAfterSelection).call(_this, ...args);\n });\n this.addHook('afterSelectionEnd', () => _assertClassBrand(_CopyPaste_brand, this, _onAfterSelectionEnd).call(this));\n this.eventManager.addEventListener(this.hot.rootDocument, 'copy', function () {\n return _this.onCopy(...arguments);\n });\n this.eventManager.addEventListener(this.hot.rootDocument, 'cut', function () {\n return _this.onCut(...arguments);\n });\n this.eventManager.addEventListener(this.hot.rootDocument, 'paste', function () {\n return _this.onPaste(...arguments);\n });\n\n // Without this workaround Safari (tested on Safari@16.5.2) does allow copying/cutting from the browser menu.\n if (isSafari()) {\n this.eventManager.addEventListener(this.hot.rootDocument.body, 'mouseenter', function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _assertClassBrand(_CopyPaste_brand, _this, _onSafariMouseEnter).call(_this, ...args);\n });\n this.eventManager.addEventListener(this.hot.rootDocument.body, 'mouseleave', function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n return _assertClassBrand(_CopyPaste_brand, _this, _onSafariMouseLeave).call(_this, ...args);\n });\n this.addHook('afterSelection', () => _assertClassBrand(_CopyPaste_brand, this, _onSafariAfterSelection).call(this));\n }\n super.enablePlugin();\n }\n\n /**\n * Updates the state of the [`CopyPaste`](#copypaste) plugin.\n *\n * Gets called when [`updateSettings()`](@/api/core.md#updatesettings)\n * is invoked with any of the following configuration options:\n * - [`copyPaste`](@/api/options.md#copypaste)\n * - [`fragmentSelection`](@/api/options.md#fragmentselection)\n */\n updatePlugin() {\n this.disablePlugin();\n this.enablePlugin();\n super.updatePlugin();\n }\n\n /**\n * Disables the [`CopyPaste`](#copypaste) plugin for your Handsontable instance.\n */\n disablePlugin() {\n super.disablePlugin();\n }\n\n /**\n * Copies the contents of the selected cells (and/or their related column headers) to the system clipboard.\n *\n * Takes an optional parameter (`copyMode`) that defines the scope of copying:\n *\n * | `copyMode` value | Description |\n * | ----------------------------- | --------------------------------------------------------------- |\n * | `'cells-only'` (default) | Copy the selected cells |\n * | `'with-column-headers'` | - Copy the selected cells
- Copy the nearest column headers |\n * | `'with-column-group-headers'` | - Copy the selected cells
- Copy all related columns headers |\n * | `'column-headers-only'` | Copy the nearest column headers (without copying cells) |\n *\n * @param {string} [copyMode='cells-only'] Copy mode.\n */\n copy() {\n let copyMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'cells-only';\n _classPrivateFieldSet(_copyMode, this, copyMode);\n _classPrivateFieldSet(_isTriggeredByCopy, this, true);\n _assertClassBrand(_CopyPaste_brand, this, _ensureClipboardEventsGetTriggered).call(this, 'copy');\n }\n\n /**\n * Copies the contents of the selected cells.\n */\n copyCellsOnly() {\n this.copy('cells-only');\n }\n /**\n * Copies the contents of column headers that are nearest to the selected cells.\n */\n copyColumnHeadersOnly() {\n this.copy('column-headers-only');\n }\n /**\n * Copies the contents of the selected cells and all their related column headers.\n */\n copyWithAllColumnHeaders() {\n this.copy('with-column-group-headers');\n }\n /**\n * Copies the contents of the selected cells and their nearest column headers.\n */\n copyWithColumnHeaders() {\n this.copy('with-column-headers');\n }\n\n /**\n * Cuts the contents of the selected cells to the system clipboard.\n */\n cut() {\n _classPrivateFieldSet(_isTriggeredByCut, this, true);\n _assertClassBrand(_CopyPaste_brand, this, _ensureClipboardEventsGetTriggered).call(this, 'cut');\n }\n\n /**\n * Converts the contents of multiple ranges (`ranges`) into a single string.\n *\n * @param {Array<{startRow: number, startCol: number, endRow: number, endCol: number}>} ranges Array of objects with properties `startRow`, `endRow`, `startCol` and `endCol`.\n * @returns {string} A string that will be copied to the clipboard.\n */\n getRangedCopyableData(ranges) {\n return stringify(this.getRangedData(ranges));\n }\n\n /**\n * Converts the contents of multiple ranges (`ranges`) into an array of arrays.\n *\n * @param {Array<{startRow: number, startCol: number, endRow: number, endCol: number}>} ranges Array of objects with properties `startRow`, `startCol`, `endRow` and `endCol`.\n * @returns {Array[]} An array of arrays that will be copied to the clipboard.\n */\n getRangedData(ranges) {\n const data = [];\n const {\n rows,\n columns\n } = normalizeRanges(ranges);\n\n // concatenate all rows and columns data defined in ranges into one copyable string\n arrayEach(rows, row => {\n const rowSet = [];\n arrayEach(columns, column => {\n if (row < 0) {\n // `row` as the second argument acts here as the `headerLevel` argument\n rowSet.push(this.hot.getColHeader(column, row));\n } else {\n rowSet.push(this.hot.getCopyableData(row, column));\n }\n });\n data.push(rowSet);\n });\n return data;\n }\n\n /**\n * Simulates the paste action.\n *\n * For security reasons, modern browsers don't allow reading from the system clipboard.\n *\n * @param {string} pastableText The value to paste, as a raw string.\n * @param {string} [pastableHtml=''] The value to paste, as HTML.\n */\n paste() {\n let pastableText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n let pastableHtml = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : pastableText;\n if (!pastableText && !pastableHtml) {\n return;\n }\n const pasteData = new PasteEvent();\n if (pastableText) {\n pasteData.clipboardData.setData('text/plain', pastableText);\n }\n if (pastableHtml) {\n pasteData.clipboardData.setData('text/html', pastableHtml);\n }\n this.onPaste(pasteData);\n }\n\n /**\n * Prepares copyable text from the cells selection in the invisible textarea.\n */\n setCopyableText() {\n const selectionRange = this.hot.getSelectedRangeLast();\n if (!selectionRange) {\n return;\n }\n if (selectionRange.isSingleHeader()) {\n this.copyableRanges = [];\n return;\n }\n _classPrivateFieldGet(_copyableRangesFactory, this).setSelectedRange(selectionRange);\n const groupedRanges = new Map([['headers', null], ['cells', null]]);\n if (_classPrivateFieldGet(_copyMode, this) === 'column-headers-only') {\n groupedRanges.set('headers', _classPrivateFieldGet(_copyableRangesFactory, this).getMostBottomColumnHeadersRange());\n } else {\n if (_classPrivateFieldGet(_copyMode, this) === 'with-column-headers') {\n groupedRanges.set('headers', _classPrivateFieldGet(_copyableRangesFactory, this).getMostBottomColumnHeadersRange());\n } else if (_classPrivateFieldGet(_copyMode, this) === 'with-column-group-headers') {\n groupedRanges.set('headers', _classPrivateFieldGet(_copyableRangesFactory, this).getAllColumnHeadersRange());\n }\n groupedRanges.set('cells', _classPrivateFieldGet(_copyableRangesFactory, this).getCellsRange());\n }\n this.copyableRanges = Array.from(groupedRanges.values()).filter(range => range !== null).map(_ref => {\n let {\n startRow,\n startCol,\n endRow,\n endCol\n } = _ref;\n return {\n startRow,\n startCol,\n endRow,\n endCol\n };\n });\n this.copyableRanges = this.hot.runHooks('modifyCopyableRange', this.copyableRanges);\n const cellsRange = groupedRanges.get('cells');\n if (cellsRange !== null && cellsRange.isRangeTrimmed) {\n const {\n startRow,\n startCol,\n endRow,\n endCol\n } = cellsRange;\n this.hot.runHooks('afterCopyLimit', endRow - startRow + 1, endCol - startCol + 1, this.rowsLimit, this.columnsLimit);\n }\n }\n\n /**\n * Verifies if editor exists and is open.\n *\n * @private\n * @returns {boolean}\n */\n isEditorOpened() {\n var _this$hot$getActiveEd;\n return (_this$hot$getActiveEd = this.hot.getActiveEditor()) === null || _this$hot$getActiveEd === void 0 ? void 0 : _this$hot$getActiveEd.isOpened();\n }\n /**\n * Prepares new values to populate them into datasource.\n *\n * @private\n * @param {Array} inputArray An array of the data to populate.\n * @param {Array} [selection] The selection which indicates from what position the data will be populated.\n * @returns {Array} Range coordinates after populate data.\n */\n populateValues(inputArray) {\n let selection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.hot.getSelectedRangeLast();\n if (!inputArray.length) {\n return;\n }\n const populatedRowsLength = inputArray.length;\n const populatedColumnsLength = inputArray[0].length;\n const newRows = [];\n const {\n row: startRow,\n col: startColumn\n } = selection.getTopStartCorner();\n const {\n row: endRowFromSelection,\n col: endColumnFromSelection\n } = selection.getBottomEndCorner();\n let visualRowForPopulatedData = startRow;\n let visualColumnForPopulatedData = startColumn;\n let lastVisualRow = startRow;\n let lastVisualColumn = startColumn;\n\n // We try to populate just all copied data or repeat copied data within a selection. Please keep in mind that we\n // don't know whether populated data is bigger than selection on start as there are some cells for which values\n // should be not inserted (it's known right after getting cell meta).\n while (newRows.length < populatedRowsLength || visualRowForPopulatedData <= endRowFromSelection) {\n const {\n skipRowOnPaste,\n visualRow\n } = this.hot.getCellMeta(visualRowForPopulatedData, startColumn);\n visualRowForPopulatedData = visualRow + 1;\n if (skipRowOnPaste === true) {\n /* eslint-disable no-continue */\n continue;\n }\n lastVisualRow = visualRow;\n visualColumnForPopulatedData = startColumn;\n const newRow = [];\n const insertedRow = newRows.length % populatedRowsLength;\n while (newRow.length < populatedColumnsLength || visualColumnForPopulatedData <= endColumnFromSelection) {\n const {\n skipColumnOnPaste,\n visualCol\n } = this.hot.getCellMeta(startRow, visualColumnForPopulatedData);\n visualColumnForPopulatedData = visualCol + 1;\n if (skipColumnOnPaste === true) {\n /* eslint-disable no-continue */\n continue;\n }\n lastVisualColumn = visualCol;\n const insertedColumn = newRow.length % populatedColumnsLength;\n newRow.push(inputArray[insertedRow][insertedColumn]);\n }\n newRows.push(newRow);\n }\n _classPrivateFieldSet(_preventViewportScrollOnPaste, this, true);\n this.hot.populateFromArray(startRow, startColumn, newRows, undefined, undefined, 'CopyPaste.paste', this.pasteMode);\n return [startRow, startColumn, lastVisualRow, lastVisualColumn];\n }\n\n /**\n * Add the `contenteditable` attribute to the highlighted cell and select its content.\n */\n\n /**\n * `copy` event callback on textarea element.\n *\n * @param {Event} event ClipboardEvent.\n * @private\n */\n onCopy(event) {\n var _event$target;\n const focusedElement = this.hot.getFocusManager().getRefocusElement();\n const isHotInput = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.hasAttribute('data-hot-input');\n if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened() || event.target instanceof HTMLElement && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body)) {\n return;\n }\n event.preventDefault();\n this.setCopyableText();\n _classPrivateFieldSet(_isTriggeredByCopy, this, false);\n const data = this.getRangedData(this.copyableRanges);\n const copiedHeadersCount = _assertClassBrand(_CopyPaste_brand, this, _countCopiedHeaders).call(this, this.copyableRanges);\n const allowCopying = !!this.hot.runHooks('beforeCopy', data, this.copyableRanges, copiedHeadersCount);\n if (allowCopying) {\n const textPlain = stringify(data);\n if (event && event.clipboardData) {\n const textHTML = _dataToHTML(data, this.hot.rootDocument);\n event.clipboardData.setData('text/plain', textPlain);\n event.clipboardData.setData('text/html', [META_HEAD, textHTML].join(''));\n } else if (typeof ClipboardEvent === 'undefined') {\n this.hot.rootWindow.clipboardData.setData('Text', textPlain);\n }\n this.hot.runHooks('afterCopy', data, this.copyableRanges, copiedHeadersCount);\n }\n _classPrivateFieldSet(_copyMode, this, 'cells-only');\n }\n\n /**\n * `cut` event callback on textarea element.\n *\n * @param {Event} event ClipboardEvent.\n * @private\n */\n onCut(event) {\n var _event$target2;\n const focusedElement = this.hot.getFocusManager().getRefocusElement();\n const isHotInput = (_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.hasAttribute('data-hot-input');\n if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened() || event.target instanceof HTMLElement && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body)) {\n return;\n }\n event.preventDefault();\n this.setCopyableText();\n _classPrivateFieldSet(_isTriggeredByCut, this, false);\n const rangedData = this.getRangedData(this.copyableRanges);\n const allowCuttingOut = !!this.hot.runHooks('beforeCut', rangedData, this.copyableRanges);\n if (allowCuttingOut) {\n const textPlain = stringify(rangedData);\n if (event && event.clipboardData) {\n const textHTML = _dataToHTML(rangedData, this.hot.rootDocument);\n event.clipboardData.setData('text/plain', textPlain);\n event.clipboardData.setData('text/html', [META_HEAD, textHTML].join(''));\n } else if (typeof ClipboardEvent === 'undefined') {\n this.hot.rootWindow.clipboardData.setData('Text', textPlain);\n }\n this.hot.emptySelectedCells('CopyPaste.cut');\n this.hot.runHooks('afterCut', rangedData, this.copyableRanges);\n }\n }\n\n /**\n * `paste` event callback on textarea element.\n *\n * @param {Event} event ClipboardEvent or pseudo ClipboardEvent, if paste was called manually.\n * @private\n */\n onPaste(event) {\n var _event$target3;\n const focusedElement = this.hot.getFocusManager().getRefocusElement();\n const isHotInput = (_event$target3 = event.target) === null || _event$target3 === void 0 ? void 0 : _event$target3.hasAttribute('data-hot-input');\n if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected() || event.target instanceof HTMLElement && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body)) {\n return;\n }\n event.preventDefault();\n let pastedData;\n if (event && typeof event.clipboardData !== 'undefined') {\n const textHTML = sanitize(event.clipboardData.getData('text/html'), {\n ADD_TAGS: ['meta'],\n ADD_ATTR: ['content'],\n FORCE_BODY: true\n });\n if (textHTML && /( {\n this.hot.rootDocument.execCommand(eventName);\n });\n }\n }\n } else {\n this.hot.rootDocument.execCommand(eventName);\n }\n}\n/**\n * Counts how many column headers will be copied based on the passed range.\n *\n * @private\n * @param {Array<{startRow: number, startCol: number, endRow: number, endCol: number}>} ranges Array of objects with properties `startRow`, `startCol`, `endRow` and `endCol`.\n * @returns {{ columnHeadersCount: number }} Returns an object with keys that holds\n * information with the number of copied headers.\n */\nfunction _countCopiedHeaders(ranges) {\n const {\n rows\n } = normalizeRanges(ranges);\n let columnHeadersCount = 0;\n for (let row = 0; row < rows.length; row++) {\n if (rows[row] >= 0) {\n break;\n }\n columnHeadersCount += 1;\n }\n return {\n columnHeadersCount\n };\n}\nfunction _addContentEditableToHighlightedCell() {\n if (this.hot.isListening()) {\n const lastSelectedRange = this.hot.getSelectedRangeLast();\n if (lastSelectedRange) {\n const {\n row: highlightRow,\n col: highlightColumn\n } = lastSelectedRange.highlight;\n const currentlySelectedCell = this.hot.getCell(highlightRow, highlightColumn, true);\n if (currentlySelectedCell) {\n makeElementContentEditableAndSelectItsContent(currentlySelectedCell);\n }\n }\n }\n}\n/**\n * Remove the `contenteditable` attribute from the highlighted cell and deselect its content.\n */\nfunction _removeContentEditableFromHighlightedCell() {\n // If the instance is not listening, the workaround is not needed.\n if (this.hot.isListening()) {\n const lastSelectedRange = this.hot.getSelectedRangeLast();\n if (lastSelectedRange) {\n const {\n row: highlightRow,\n col: highlightColumn\n } = lastSelectedRange.highlight;\n const currentlySelectedCell = this.hot.getCell(highlightRow, highlightColumn, true);\n if (currentlySelectedCell !== null && currentlySelectedCell !== void 0 && currentlySelectedCell.hasAttribute('contenteditable')) {\n removeContentEditableFromElementAndDeselect(currentlySelectedCell);\n }\n }\n }\n}\nfunction _onAfterContextMenuDefaultOptions(options) {\n options.items.push({\n name: '---------'\n }, copyItem(this));\n if (_classPrivateFieldGet(_enableCopyColumnHeaders, this)) {\n options.items.push(copyWithColumnHeadersItem(this));\n }\n if (_classPrivateFieldGet(_enableCopyColumnGroupHeaders, this)) {\n options.items.push(copyWithColumnGroupHeadersItem(this));\n }\n if (_classPrivateFieldGet(_enableCopyColumnHeadersOnly, this)) {\n options.items.push(copyColumnHeadersOnlyItem(this));\n }\n options.items.push(cutItem(this));\n}\n/**\n * Disables the viewport scroll after pasting the data.\n *\n * @param {number} fromRow Selection start row visual index.\n * @param {number} fromColumn Selection start column visual index.\n * @param {number} toRow Selection end row visual index.\n * @param {number} toColumn Selection end column visual index.\n * @param {object} preventScrolling Object with `value` property. If `true`, the viewport scroll will be prevented.\n */\nfunction _onAfterSelection(fromRow, fromColumn, toRow, toColumn, preventScrolling) {\n if (_classPrivateFieldGet(_preventViewportScrollOnPaste, this)) {\n preventScrolling.value = true;\n }\n _classPrivateFieldSet(_preventViewportScrollOnPaste, this, false);\n}\n/**\n * Force focus on focusableElement after end of the selection.\n */\nfunction _onAfterSelectionEnd() {\n if (this.isEditorOpened()) {\n return;\n }\n if (this.hot.getSettings().fragmentSelection) {\n return;\n }\n this.setCopyableText();\n}\n/**\n * `document.body` `mouseenter` callback used to work around a Safari's problem with copying/cutting from the\n * browser's menu.\n */\nfunction _onSafariMouseEnter() {\n _assertClassBrand(_CopyPaste_brand, this, _removeContentEditableFromHighlightedCell).call(this);\n}\n/**\n * `document.body` `mouseleave` callback used to work around a Safari's problem with copying/cutting from the\n * browser's menu.\n */\nfunction _onSafariMouseLeave() {\n _assertClassBrand(_CopyPaste_brand, this, _addContentEditableToHighlightedCell).call(this);\n}\n/**\n * `afterSelection` hook callback triggered only on Safari.\n */\nfunction _onSafariAfterSelection() {\n _assertClassBrand(_CopyPaste_brand, this, _removeContentEditableFromHighlightedCell).call(this);\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, CopyPaste } from \"./copyPaste.mjs\";", "import { hasOwnProperty, isObject } from \"../../helpers/object.mjs\";\nimport { isDefined } from \"../../helpers/mixed.mjs\";\nimport { arrayEach } from \"../../helpers/array.mjs\";\n/**\n * Create separated id for borders for each cell.\n *\n * @param {number} row Visual row index.\n * @param {number} col Visual column index.\n * @returns {string}\n */\nexport function createId(row, col) {\n return `border_row${row}col${col}`;\n}\n\n/**\n * Create default single border for each position (top/right/bottom/left).\n *\n * @returns {object} `{{width: number, color: string}}`.\n */\nexport function createDefaultCustomBorder() {\n return {\n width: 1,\n color: '#000'\n };\n}\n\n/**\n * Create default object for empty border.\n *\n * @returns {object} `{{hide: boolean}}`.\n */\nexport function createSingleEmptyBorder() {\n return {\n hide: true\n };\n}\n\n/**\n * Create default Handsontable border object.\n *\n * @returns {object} `{{width: number, color: string, cornerVisible: boolean}}`.\n */\nexport function createDefaultHtBorder() {\n return {\n width: 1,\n color: '#000',\n cornerVisible: false\n };\n}\n\n/**\n * Normalizes the border object to be compatible with the Border API from the Walkontable.\n * The function translates the \"left\"/\"right\" properties to \"start\"/\"end\" prop names.\n *\n * @param {object} border The configuration object of the border.\n * @returns {object}\n */\nexport function normalizeBorder(border) {\n if (isDefined(border.start) || isDefined(border.left)) {\n var _border$start;\n border.start = (_border$start = border.start) !== null && _border$start !== void 0 ? _border$start : border.left;\n }\n if (isDefined(border.end) || isDefined(border.right)) {\n var _border$end;\n border.end = (_border$end = border.end) !== null && _border$end !== void 0 ? _border$end : border.right;\n }\n delete border.left;\n delete border.right;\n return border;\n}\n\n/**\n * Denormalizes the border object to be backward compatible with the previous version of the CustomBorders\n * plugin API. The function extends the border configuration object for the backward compatible \"left\"/\"right\"\n * properties.\n *\n * @param {object} border The configuration object of the border.\n * @returns {object}\n */\nexport function denormalizeBorder(border) {\n if (isDefined(border.start)) {\n border.left = border.start;\n }\n if (isDefined(border.end)) {\n border.right = border.end;\n }\n return border;\n}\n\n/**\n * Prepare empty border for each cell with all custom borders hidden.\n *\n * @param {number} row Visual row index.\n * @param {number} col Visual column index.\n * @returns {{id: string, border: any, row: number, col: number, top: {hide: boolean}, bottom: {hide: boolean}, start: {hide: boolean}, end: {hide: boolean}}} Returns border configuration containing visual indexes.\n */\nexport function createEmptyBorders(row, col) {\n return {\n id: createId(row, col),\n border: createDefaultHtBorder(),\n row,\n col,\n top: createSingleEmptyBorder(),\n bottom: createSingleEmptyBorder(),\n start: createSingleEmptyBorder(),\n end: createSingleEmptyBorder()\n };\n}\n\n/**\n * @param {object} defaultBorder The default border object.\n * @param {object} customBorder The border object with custom settings.\n * @returns {object}\n */\nexport function extendDefaultBorder(defaultBorder, customBorder) {\n if (hasOwnProperty(customBorder, 'border') && customBorder.border) {\n defaultBorder.border = customBorder.border;\n }\n if (hasOwnProperty(customBorder, 'top') && isDefined(customBorder.top)) {\n if (customBorder.top) {\n if (!isObject(customBorder.top)) {\n customBorder.top = createDefaultCustomBorder();\n }\n defaultBorder.top = customBorder.top;\n } else {\n customBorder.top = createSingleEmptyBorder();\n defaultBorder.top = customBorder.top;\n }\n }\n if (hasOwnProperty(customBorder, 'bottom') && isDefined(customBorder.bottom)) {\n if (customBorder.bottom) {\n if (!isObject(customBorder.bottom)) {\n customBorder.bottom = createDefaultCustomBorder();\n }\n defaultBorder.bottom = customBorder.bottom;\n } else {\n customBorder.bottom = createSingleEmptyBorder();\n defaultBorder.bottom = customBorder.bottom;\n }\n }\n if (hasOwnProperty(customBorder, 'start') && isDefined(customBorder.start)) {\n if (customBorder.start) {\n if (!isObject(customBorder.start)) {\n customBorder.start = createDefaultCustomBorder();\n }\n defaultBorder.start = customBorder.start;\n } else {\n customBorder.start = createSingleEmptyBorder();\n defaultBorder.start = customBorder.start;\n }\n }\n if (hasOwnProperty(customBorder, 'end') && isDefined(customBorder.end)) {\n if (customBorder.end) {\n if (!isObject(customBorder.end)) {\n customBorder.end = createDefaultCustomBorder();\n }\n defaultBorder.end = customBorder.end;\n } else {\n customBorder.end = createSingleEmptyBorder();\n defaultBorder.end = customBorder.end;\n }\n }\n return defaultBorder;\n}\n\n/**\n * Check if selection has border.\n *\n * @param {Core} hot The Handsontable instance.\n * @param {string} [direction] If set ('left' or 'top') then only the specified border side will be checked.\n * @returns {boolean}\n */\nexport function checkSelectionBorders(hot, direction) {\n let atLeastOneHasBorder = false;\n arrayEach(hot.getSelectedRange(), range => {\n range.forAll((r, c) => {\n if (r < 0 || c < 0) {\n return;\n }\n const metaBorders = hot.getCellMeta(r, c).borders;\n if (metaBorders) {\n if (direction) {\n if (!hasOwnProperty(metaBorders[direction], 'hide') || metaBorders[direction].hide === false) {\n atLeastOneHasBorder = true;\n return false; // breaks forAll\n }\n } else {\n atLeastOneHasBorder = true;\n return false; // breaks forAll\n }\n }\n });\n });\n return atLeastOneHasBorder;\n}\n\n/**\n * Mark label in contextMenu as selected.\n *\n * @param {string} label The label text.\n * @returns {string}\n */\nexport function markSelected(label) {\n return `${String.fromCharCode(10003)}${label}`; // workaround for https://github.com/handsontable/handsontable/issues/1946\n}\n\n/**\n * Checks if in the borders config there are defined \"left\" or \"right\" border properties.\n *\n * @param {object[]} borders The custom border plugin's options.\n * @returns {boolean}\n */\nexport function hasLeftRightTypeOptions(borders) {\n return borders.some(border => isDefined(border.left) || isDefined(border.right));\n}\n\n/**\n * Checks if in the borders config there are defined \"start\" or \"end\" border properties.\n *\n * @param {object[]} borders The custom border plugin's options.\n * @returns {boolean}\n */\nexport function hasStartEndTypeOptions(borders) {\n return borders.some(border => isDefined(border.start) || isDefined(border.end));\n}\nconst physicalToInlinePropNames = new Map([['left', 'start'], ['right', 'end']]);\n\n/**\n * Translates the physical horizontal direction to logical ones. If not known property name is\n * passed it will be returned without modification.\n *\n * @param {string} propName The physical direction property name (\"left\" or \"right\").\n * @returns {string}\n */\nexport function toInlinePropName(propName) {\n var _physicalToInlineProp;\n return (_physicalToInlineProp = physicalToInlinePropNames.get(propName)) !== null && _physicalToInlineProp !== void 0 ? _physicalToInlineProp : propName;\n}", "import * as C from \"../../../i18n/constants.mjs\";\nimport { checkSelectionBorders, markSelected } from \"../utils.mjs\";\n/**\n * @param {CustomBorders} customBordersPlugin The plugin instance.\n * @returns {object}\n */\nexport default function bottom(customBordersPlugin) {\n return {\n key: 'borders:bottom',\n name() {\n let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_BORDERS_BOTTOM);\n const hasBorder = checkSelectionBorders(this, 'bottom');\n if (hasBorder) {\n label = markSelected(label);\n }\n return label;\n },\n callback(key, selected) {\n const hasBorder = checkSelectionBorders(this, 'bottom');\n customBordersPlugin.prepareBorder(selected, 'bottom', hasBorder);\n }\n };\n}", "import * as C from \"../../../i18n/constants.mjs\";\nimport { checkSelectionBorders, markSelected } from \"../utils.mjs\";\n/**\n * @param {CustomBorders} customBordersPlugin The plugin instance.\n * @returns {object}\n */\nexport default function left(customBordersPlugin) {\n const borderDirection = customBordersPlugin.hot.isRtl() ? 'end' : 'start';\n return {\n key: 'borders:left',\n name() {\n let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_BORDERS_LEFT);\n const hasBorder = checkSelectionBorders(this, borderDirection);\n if (hasBorder) {\n label = markSelected(label);\n }\n return label;\n },\n callback(key, selected) {\n const hasBorder = checkSelectionBorders(this, borderDirection);\n customBordersPlugin.prepareBorder(selected, borderDirection, hasBorder);\n }\n };\n}", "import * as C from \"../../../i18n/constants.mjs\";\nimport { checkSelectionBorders } from \"../utils.mjs\";\n/**\n * @param {CustomBorders} customBordersPlugin The plugin instance.\n * @returns {object}\n */\nexport default function noBorders(customBordersPlugin) {\n return {\n key: 'borders:no_borders',\n name() {\n return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_REMOVE_BORDERS);\n },\n callback(key, selected) {\n customBordersPlugin.prepareBorder(selected, 'noBorders');\n },\n disabled() {\n return !checkSelectionBorders(this);\n }\n };\n}", "import * as C from \"../../../i18n/constants.mjs\";\nimport { checkSelectionBorders, markSelected } from \"../utils.mjs\";\n/**\n * @param {CustomBorders} customBordersPlugin The plugin instance.\n * @returns {object}\n */\nexport default function right(customBordersPlugin) {\n const borderDirection = customBordersPlugin.hot.isRtl() ? 'start' : 'end';\n return {\n key: 'borders:right',\n name() {\n let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_BORDERS_RIGHT);\n const hasBorder = checkSelectionBorders(this, borderDirection);\n if (hasBorder) {\n label = markSelected(label);\n }\n return label;\n },\n callback(key, selected) {\n const hasBorder = checkSelectionBorders(this, borderDirection);\n customBordersPlugin.prepareBorder(selected, borderDirection, hasBorder);\n }\n };\n}", "import * as C from \"../../../i18n/constants.mjs\";\nimport { checkSelectionBorders, markSelected } from \"../utils.mjs\";\n/**\n * @param {CustomBorders} customBordersPlugin The plugin instance.\n * @returns {object}\n */\nexport default function top(customBordersPlugin) {\n return {\n key: 'borders:top',\n name() {\n let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_BORDERS_TOP);\n const hasBorder = checkSelectionBorders(this, 'top');\n if (hasBorder) {\n label = markSelected(label);\n }\n return label;\n },\n callback(key, selected) {\n const hasBorder = checkSelectionBorders(this, 'top');\n customBordersPlugin.prepareBorder(selected, 'top', hasBorder);\n }\n };\n}", "import bottom from \"./bottom.mjs\";\nimport left from \"./left.mjs\";\nimport noBorders from \"./noBorders.mjs\";\nimport right from \"./right.mjs\";\nimport top from \"./top.mjs\";\nexport { bottom, left, noBorders, right, top };", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport { hasOwnProperty, deepClone } from \"../../helpers/object.mjs\";\nimport { rangeEach } from \"../../helpers/number.mjs\";\nimport { arrayEach, arrayReduce, arrayMap } from \"../../helpers/array.mjs\";\nimport * as C from \"../../i18n/constants.mjs\";\nimport { top as menuItemTop, bottom as menuItemBottom, left as menuItemLeft, right as menuItemRight, noBorders as menuItemNoBorders } from \"./contextMenuItem/index.mjs\";\nimport { createId, createDefaultCustomBorder, createSingleEmptyBorder, createEmptyBorders, extendDefaultBorder, hasLeftRightTypeOptions, hasStartEndTypeOptions, toInlinePropName, normalizeBorder, denormalizeBorder } from \"./utils.mjs\";\nimport { detectSelectionType, normalizeSelectionFactory } from \"../../selection/index.mjs\";\nexport const PLUGIN_KEY = 'customBorders';\nexport const PLUGIN_PRIORITY = 90;\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @plugin CustomBorders\n * @class CustomBorders\n *\n * @description\n * This plugin enables an option to apply custom borders through the context menu (configurable with context menu key\n * `borders`).\n *\n * To initialize Handsontable with predefined custom borders, provide cell coordinates and border styles in a form\n * of an array.\n *\n * See [`customBorders` configuration option](@/api/options.md#customBorders) or go to\n * [Custom cell borders demo](@/guides/cell-features/formatting-cells/formatting-cells.md#custom-cell-borders) for more examples.\n *\n * @example\n * ```js\n * customBorders: [\n * {\n * range: {\n * from: {\n * row: 1,\n * col: 1\n * },\n * to: {\n * row: 3,\n * col: 4\n * },\n * },\n * start: {},\n * end: {},\n * top: {},\n * bottom: {},\n * },\n * ],\n *\n * // or\n * customBorders: [\n * { row: 2,\n * col: 2,\n * start: {\n * width: 2,\n * color: 'red',\n * },\n * end: {\n * width: 1,\n * color: 'green',\n * },\n * top: '',\n * bottom: '',\n * }\n * ],\n * ```\n */\nvar _CustomBorders_brand = /*#__PURE__*/new WeakSet();\nexport class CustomBorders extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * Add border options to context menu.\n *\n * @param {object} defaultOptions Context menu items.\n */\n _classPrivateMethodInitSpec(this, _CustomBorders_brand);\n /**\n * Saved borders.\n *\n * @private\n * @type {Array}\n */\n _defineProperty(this, \"savedBorders\", []);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link CustomBorders#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n if (this.enabled) {\n return;\n }\n this.addHook('afterContextMenuDefaultOptions', options => _assertClassBrand(_CustomBorders_brand, this, _onAfterContextMenuDefaultOptions).call(this, options));\n this.addHook('init', () => _assertClassBrand(_CustomBorders_brand, this, _onAfterInit).call(this));\n super.enablePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n this.hideBorders();\n super.disablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`customBorders`](@/api/options.md#customborders)\n */\n updatePlugin() {\n this.disablePlugin();\n this.enablePlugin();\n this.changeBorderSettings();\n super.updatePlugin();\n }\n\n /**\n * Set custom borders.\n *\n * @example\n * ```js\n * const customBordersPlugin = hot.getPlugin('customBorders');\n *\n * // Using an array of arrays (produced by `.getSelected()` method).\n * customBordersPlugin.setBorders([[1, 1, 2, 2], [6, 2, 0, 2]], {start: {width: 2, color: 'blue'}});\n *\n * // Using an array of CellRange objects (produced by `.getSelectedRange()` method).\n * // Selecting a cell range.\n * hot.selectCell(0, 0, 2, 2);\n * // Returning selected cells' range with the getSelectedRange method.\n * customBordersPlugin.setBorders(hot.getSelectedRange(), {start: {hide: false, width: 2, color: 'blue'}});\n * ```\n *\n * @param {Array[]|CellRange[]} selectionRanges Array of selection ranges.\n * @param {object} borderObject Object with `top`, `right`, `bottom` and `start` properties.\n */\n setBorders(selectionRanges, borderObject) {\n let borderKeys = ['top', 'bottom', 'start', 'end'];\n let normBorder = null;\n if (borderObject) {\n this.checkSettingsCohesion([borderObject]);\n borderKeys = Object.keys(borderObject);\n normBorder = normalizeBorder(borderObject);\n }\n const selectionType = detectSelectionType(selectionRanges);\n const selectionSchemaNormalizer = normalizeSelectionFactory(selectionType, {\n createCellCoords: this.hot._createCellCoords.bind(this.hot),\n createCellRange: this.hot._createCellRange.bind(this.hot)\n });\n arrayEach(selectionRanges, selection => {\n selectionSchemaNormalizer(selection).forAll((row, col) => {\n arrayEach(borderKeys, borderKey => {\n this.prepareBorderFromCustomAdded(row, col, normBorder, toInlinePropName(borderKey));\n });\n });\n });\n\n /*\n The line below triggers a re-render of Handsontable. This will be a \"fastDraw\"\n render, because that is the default for the TableView class.\n The re-render is needed for borders on cells that did not have a border before.\n The way this call works is that it calls Table.refreshSelections, which calls\n Selection.getBorder, which creates a new instance of Border.\n Seems wise to keep this single-direction flow of creating new Borders\n */\n this.hot.view.render();\n }\n\n /**\n * Get custom borders.\n *\n * @example\n * ```js\n * const customBordersPlugin = hot.getPlugin('customBorders');\n *\n * // Using an array of arrays (produced by `.getSelected()` method).\n * customBordersPlugin.getBorders([[1, 1, 2, 2], [6, 2, 0, 2]]);\n * // Using an array of CellRange objects (produced by `.getSelectedRange()` method).\n * customBordersPlugin.getBorders(hot.getSelectedRange());\n * // Using without param - return all customBorders.\n * customBordersPlugin.getBorders();\n * ```\n *\n * @param {Array[]|CellRange[]} selectionRanges Array of selection ranges.\n * @returns {object[]} Returns array of border objects.\n */\n getBorders(selectionRanges) {\n if (!Array.isArray(selectionRanges)) {\n return this.savedBorders;\n }\n const selectionType = detectSelectionType(selectionRanges);\n const selectionSchemaNormalizer = normalizeSelectionFactory(selectionType, {\n createCellCoords: this.hot._createCellCoords.bind(this.hot),\n createCellRange: this.hot._createCellRange.bind(this.hot)\n });\n const selectedBorders = [];\n arrayEach(selectionRanges, selection => {\n selectionSchemaNormalizer(selection).forAll((row, col) => {\n arrayEach(this.savedBorders, border => {\n if (border.row === row && border.col === col) {\n selectedBorders.push(denormalizeBorder(border));\n }\n });\n });\n });\n return selectedBorders;\n }\n\n /**\n * Clear custom borders.\n *\n * @example\n * ```js\n * const customBordersPlugin = hot.getPlugin('customBorders');\n *\n * // Using an array of arrays (produced by `.getSelected()` method).\n * customBordersPlugin.clearBorders([[1, 1, 2, 2], [6, 2, 0, 2]]);\n * // Using an array of CellRange objects (produced by `.getSelectedRange()` method).\n * customBordersPlugin.clearBorders(hot.getSelectedRange());\n * // Using without param - clear all customBorders.\n * customBordersPlugin.clearBorders();\n * ```\n *\n * @param {Array[]|CellRange[]} selectionRanges Array of selection ranges.\n */\n clearBorders(selectionRanges) {\n if (selectionRanges) {\n this.setBorders(selectionRanges);\n } else {\n arrayEach(this.savedBorders, border => {\n this.clearBordersFromSelectionSettings(border.id);\n this.clearNullCellRange();\n this.hot.removeCellMeta(border.row, border.col, 'borders');\n });\n this.savedBorders.length = 0;\n }\n }\n\n /**\n * Insert WalkontableSelection instance into Walkontable settings.\n *\n * @private\n * @param {object} border Object with `row` and `col`, `start`, `end`, `top` and `bottom`, `id` and `border` ({Object} with `color`, `width` and `cornerVisible` property) properties.\n * @param {string} [place] Coordinate where add/remove border - `top`, `bottom`, `start`, `end`.\n */\n insertBorderIntoSettings(border, place) {\n const hasSavedBorders = this.checkSavedBorders(border);\n if (!hasSavedBorders) {\n this.savedBorders.push(border);\n }\n const visualCellRange = this.hot._createCellRange(this.hot._createCellCoords(border.row, border.col));\n const hasCustomSelections = this.checkCustomSelections(border, visualCellRange, place);\n if (!hasCustomSelections) {\n this.hot.selection.highlight.addCustomSelection({\n border,\n visualCellRange\n });\n }\n }\n\n /**\n * Prepare borders from setting (single cell).\n *\n * @private\n * @param {number} row Visual row index.\n * @param {number} column Visual column index.\n * @param {object} borderDescriptor Object with `row` and `col`, `start`, `end`, `top` and `bottom` properties.\n * @param {string} [place] Coordinate where add/remove border - `top`, `bottom`, `start`, `end`.\n */\n prepareBorderFromCustomAdded(row, column, borderDescriptor, place) {\n const nrOfRows = this.hot.countRows();\n const nrOfColumns = this.hot.countCols();\n if (row >= nrOfRows || column >= nrOfColumns) {\n return;\n }\n let border = createEmptyBorders(row, column);\n if (borderDescriptor) {\n border = extendDefaultBorder(border, borderDescriptor);\n arrayEach(this.hot.selection.highlight.customSelections, customSelection => {\n if (border.id === customSelection.settings.id) {\n Object.assign(customSelection.settings, borderDescriptor);\n border.id = customSelection.settings.id;\n border.top = customSelection.settings.top;\n border.bottom = customSelection.settings.bottom;\n border.start = customSelection.settings.start;\n border.end = customSelection.settings.end;\n return false; // breaks forAll\n }\n });\n }\n this.hot.setCellMeta(row, column, 'borders', denormalizeBorder(border));\n this.insertBorderIntoSettings(border, place);\n }\n\n /**\n * Prepare borders from setting (object).\n *\n * @private\n * @param {object} range {CellRange} The CellRange object.\n * @param {object} customBorder Object with `start`, `end`, `top` and `bottom` properties.\n */\n prepareBorderFromCustomAddedRange(range, customBorder) {\n const lastRowIndex = Math.min(range.to.row, this.hot.countRows() - 1);\n const lastColumnIndex = Math.min(range.to.col, this.hot.countCols() - 1);\n rangeEach(range.from.row, lastRowIndex, rowIndex => {\n rangeEach(range.from.col, lastColumnIndex, colIndex => {\n const border = createEmptyBorders(rowIndex, colIndex);\n let add = 0;\n if (rowIndex === range.from.row) {\n if (hasOwnProperty(customBorder, 'top')) {\n add += 1;\n border.top = customBorder.top;\n }\n }\n\n // Please keep in mind that `range.to.row` may be beyond the table boundaries. The border won't be rendered.\n if (rowIndex === range.to.row) {\n if (hasOwnProperty(customBorder, 'bottom')) {\n add += 1;\n border.bottom = customBorder.bottom;\n }\n }\n if (colIndex === range.from.col) {\n if (hasOwnProperty(customBorder, 'start')) {\n add += 1;\n border.start = customBorder.start;\n }\n }\n\n // Please keep in mind that `range.to.col` may be beyond the table boundaries. The border won't be rendered.\n if (colIndex === range.to.col) {\n if (hasOwnProperty(customBorder, 'end')) {\n add += 1;\n border.end = customBorder.end;\n }\n }\n if (add > 0) {\n this.hot.setCellMeta(rowIndex, colIndex, 'borders', denormalizeBorder(border));\n this.insertBorderIntoSettings(border);\n } else {\n // TODO sometimes it enters here. Why?\n }\n });\n });\n }\n\n /**\n * Remove border (triggered from context menu).\n *\n * @private\n * @param {number} row Visual row index.\n * @param {number} column Visual column index.\n */\n removeAllBorders(row, column) {\n const borderId = createId(row, column);\n this.spliceBorder(borderId);\n this.clearBordersFromSelectionSettings(borderId);\n this.clearNullCellRange();\n this.hot.removeCellMeta(row, column, 'borders');\n }\n\n /**\n * Set borders for each cell re. To border position.\n *\n * @private\n * @param {number} row Visual row index.\n * @param {number} column Visual column index.\n * @param {string} place Coordinate where add/remove border - `top`, `bottom`, `start`, `end` and `noBorders`.\n * @param {boolean} remove True when remove borders, and false when add borders.\n */\n setBorder(row, column, place, remove) {\n let bordersMeta = this.hot.getCellMeta(row, column).borders;\n if (!bordersMeta || bordersMeta.border === undefined) {\n bordersMeta = createEmptyBorders(row, column);\n } else {\n bordersMeta = normalizeBorder(bordersMeta);\n }\n if (remove) {\n bordersMeta[place] = createSingleEmptyBorder();\n const hideCount = this.countHide(bordersMeta);\n if (hideCount === 4) {\n this.removeAllBorders(row, column);\n } else {\n const customSelectionsChecker = this.checkCustomSelectionsFromContextMenu(bordersMeta, place, remove);\n if (!customSelectionsChecker) {\n this.insertBorderIntoSettings(bordersMeta);\n }\n this.hot.setCellMeta(row, column, 'borders', denormalizeBorder(bordersMeta));\n }\n } else {\n bordersMeta[place] = createDefaultCustomBorder();\n const customSelectionsChecker = this.checkCustomSelectionsFromContextMenu(bordersMeta, place, remove);\n if (!customSelectionsChecker) {\n this.insertBorderIntoSettings(bordersMeta);\n }\n this.hot.setCellMeta(row, column, 'borders', denormalizeBorder(bordersMeta));\n }\n }\n\n /**\n * Prepare borders based on cell and border position.\n *\n * @private\n * @param {CellRange[]} selected An array of CellRange objects.\n * @param {string} place Coordinate where add/remove border - `top`, `bottom`, `left`, `right` and `noBorders`.\n * @param {boolean} remove True when remove borders, and false when add borders.\n */\n prepareBorder(selected, place, remove) {\n arrayEach(selected, _ref => {\n let {\n start,\n end\n } = _ref;\n if (start.row === end.row && start.col === end.col) {\n if (place === 'noBorders') {\n this.removeAllBorders(start.row, start.col);\n } else {\n this.setBorder(start.row, start.col, place, remove);\n }\n } else {\n switch (place) {\n case 'noBorders':\n rangeEach(start.col, end.col, colIndex => {\n rangeEach(start.row, end.row, rowIndex => {\n this.removeAllBorders(rowIndex, colIndex);\n });\n });\n break;\n case 'top':\n rangeEach(start.col, end.col, topCol => {\n this.setBorder(start.row, topCol, place, remove);\n });\n break;\n case 'bottom':\n rangeEach(start.col, end.col, bottomCol => {\n this.setBorder(end.row, bottomCol, place, remove);\n });\n break;\n case 'start':\n rangeEach(start.row, end.row, rowStart => {\n this.setBorder(rowStart, start.col, place, remove);\n });\n break;\n case 'end':\n rangeEach(start.row, end.row, rowEnd => {\n this.setBorder(rowEnd, end.col, place, remove);\n });\n break;\n default:\n break;\n }\n }\n });\n }\n\n /**\n * Create borders from settings.\n *\n * @private\n * @param {Array} customBorders Object with `row` and `col`, `start`, `end`, `top` and `bottom` properties.\n */\n createCustomBorders(customBorders) {\n arrayEach(customBorders, customBorder => {\n const normCustomBorder = normalizeBorder(customBorder);\n if (customBorder.range) {\n this.prepareBorderFromCustomAddedRange(customBorder.range, normCustomBorder);\n } else {\n this.prepareBorderFromCustomAdded(customBorder.row, customBorder.col, normCustomBorder);\n }\n });\n }\n\n /**\n * Count hide property in border object.\n *\n * @private\n * @param {object} border Object with `row` and `col`, `start`, `end`, `top` and `bottom`, `id` and\n * `border` ({Object} with `color`, `width` and `cornerVisible` property) properties.\n * @returns {number}\n */\n countHide(border) {\n const {\n top,\n bottom,\n start,\n end\n } = border;\n const values = [top, bottom, start, end];\n return arrayReduce(values, (accumulator, value) => {\n let result = accumulator;\n if (value && value.hide) {\n result += 1;\n }\n return result;\n }, 0);\n }\n\n /**\n * Clear borders settings from custom selections.\n *\n * @private\n * @param {string} borderId Border id name as string.\n */\n clearBordersFromSelectionSettings(borderId) {\n const index = arrayMap(this.hot.selection.highlight.customSelections, customSelection => customSelection.settings.id).indexOf(borderId);\n if (index > -1) {\n this.hot.selection.highlight.customSelections[index].clear();\n }\n }\n\n /**\n * Clear cellRange with null value.\n *\n * @private\n */\n clearNullCellRange() {\n arrayEach(this.hot.selection.highlight.customSelections, (customSelection, index) => {\n if (customSelection.cellRange === null) {\n this.hot.selection.highlight.customSelections[index].destroy();\n this.hot.selection.highlight.customSelections.splice(index, 1);\n return false; // breaks forAll\n }\n });\n }\n\n /**\n * Hide custom borders.\n *\n * @private\n */\n hideBorders() {\n arrayEach(this.savedBorders, border => {\n this.clearBordersFromSelectionSettings(border.id);\n this.clearNullCellRange();\n });\n }\n\n /**\n * Splice border from savedBorders.\n *\n * @private\n * @param {string} borderId Border id name as string.\n */\n spliceBorder(borderId) {\n const index = arrayMap(this.savedBorders, border => border.id).indexOf(borderId);\n if (index > -1) {\n this.savedBorders.splice(index, 1);\n }\n }\n\n /**\n * Check if an border already exists in the savedBorders array, and if true update border in savedBorders.\n *\n * @private\n * @param {object} border Object with `row` and `col`, `start`, `end`, `top` and `bottom`, `id` and\n * `border` ({Object} with `color`, `width` and `cornerVisible` property) properties.\n *\n * @returns {boolean}\n */\n checkSavedBorders(border) {\n let check = false;\n const hideCount = this.countHide(border);\n if (hideCount === 4) {\n this.spliceBorder(border.id);\n check = true;\n } else {\n arrayEach(this.savedBorders, (savedBorder, index) => {\n if (border.id === savedBorder.id) {\n this.savedBorders[index] = border;\n check = true;\n return false; // breaks forAll\n }\n });\n }\n return check;\n }\n\n /**\n * Check if an border already exists in the customSelections, and if true call toggleHiddenClass method.\n *\n * @private\n * @param {object} border Object with `row` and `col`, `start`, `end`, `top` and `bottom`, `id` and\n * `border` ({Object} with `color`, `width` and `cornerVisible` property) properties.\n * @param {string} place Coordinate where add/remove border - `top`, `bottom`, `start`, `end` and `noBorders`.\n * @param {boolean} remove True when remove borders, and false when add borders.\n *\n * @returns {boolean}\n */\n checkCustomSelectionsFromContextMenu(border, place, remove) {\n let check = false;\n arrayEach(this.hot.selection.highlight.customSelections, customSelection => {\n if (border.id === customSelection.settings.id) {\n const borders = this.hot.view._wt.selectionManager.getBorderInstances(customSelection);\n arrayEach(borders, borderObject => {\n borderObject.toggleHiddenClass(place, remove); // TODO this also bad?\n });\n check = true;\n return false; // breaks forAll\n }\n });\n return check;\n }\n\n /**\n * Check if an border already exists in the customSelections, and if true reset cellRange.\n *\n * @private\n * @param {object} border Object with `row` and `col`, `start`, `end`, `top` and `bottom`, `id` and\n * `border` ({Object} with `color`, `width` and `cornerVisible` property) properties.\n * @param {CellRange} cellRange The selection range to check.\n * @param {string} [place] Coordinate where add/remove border - `top`, `bottom`, `start`, `end`.\n * @returns {boolean}\n */\n checkCustomSelections(border, cellRange, place) {\n const hideCount = this.countHide(border);\n let check = false;\n if (hideCount === 4) {\n this.removeAllBorders(border.row, border.col);\n check = true;\n } else {\n arrayEach(this.hot.selection.highlight.customSelections, customSelection => {\n if (border.id === customSelection.settings.id) {\n customSelection.visualCellRange = cellRange;\n customSelection.commit();\n if (place) {\n const borders = this.hot.view._wt.selectionManager.getBorderInstances(customSelection);\n arrayEach(borders, borderObject => {\n borderObject.changeBorderStyle(place, border);\n });\n }\n check = true;\n return false; // breaks forAll\n }\n });\n }\n return check;\n }\n\n /**\n * Change borders from settings.\n *\n * @private\n */\n changeBorderSettings() {\n const customBorders = this.hot.getSettings()[PLUGIN_KEY];\n if (Array.isArray(customBorders)) {\n const bordersClone = deepClone(customBorders);\n this.checkSettingsCohesion(bordersClone);\n if (!bordersClone.length) {\n this.savedBorders = bordersClone;\n }\n this.createCustomBorders(bordersClone);\n } else if (customBorders !== undefined) {\n this.createCustomBorders(this.savedBorders);\n }\n }\n\n /**\n * Checks the settings cohesion. The properties such like \"left\"/\"right\" are supported only\n * in the LTR mode and the \"left\"/\"right\" options can not be used together with \"start\"/\"end\" properties.\n *\n * @private\n * @param {object[]} customBorders The user defined custom border objects array.\n */\n checkSettingsCohesion(customBorders) {\n const hasLeftOrRight = hasLeftRightTypeOptions(customBorders);\n const hasStartOrEnd = hasStartEndTypeOptions(customBorders);\n if (hasLeftOrRight && hasStartOrEnd) {\n throw new Error('The \"left\"/\"right\" and \"start\"/\"end\" options should not be used together. ' + 'Please use only the option \"start\"/\"end\".');\n }\n if (this.hot.isRtl() && hasLeftOrRight) {\n throw new Error('The \"left\"/\"right\" properties are not supported for RTL. Please use option \"start\"/\"end\".');\n }\n }\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n super.destroy();\n }\n}\nfunction _onAfterContextMenuDefaultOptions(defaultOptions) {\n if (!this.hot.getSettings()[PLUGIN_KEY]) {\n return;\n }\n defaultOptions.items.push({\n name: '---------'\n }, {\n key: 'borders',\n name() {\n return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_BORDERS);\n },\n disabled() {\n const range = this.getSelectedRangeLast();\n if (!range) {\n return true;\n }\n if (range.isSingleHeader()) {\n return true;\n }\n return this.selection.isSelectedByCorner();\n },\n submenu: {\n items: [menuItemTop(this), menuItemRight(this), menuItemBottom(this), menuItemLeft(this), menuItemNoBorders(this)]\n }\n });\n}\n/**\n * `afterInit` hook callback.\n */\nfunction _onAfterInit() {\n this.changeBorderSettings();\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, CustomBorders } from \"./customBorders.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport { isRightClick } from \"../../helpers/dom/event.mjs\";\nimport { getParentWindow } from \"../../helpers/dom/element.mjs\";\nexport const PLUGIN_KEY = 'dragToScroll';\nexport const PLUGIN_PRIORITY = 100;\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @description\n * Plugin used to scroll Handsontable by selecting a cell and dragging outside of the visible viewport.\n *\n *\n * @class DragToScroll\n * @plugin DragToScroll\n */\nvar _DragToScroll_brand = /*#__PURE__*/new WeakSet();\nexport class DragToScroll extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * On after on cell/cellCorner mouse down listener.\n *\n * @param {MouseEvent} event The mouse event object.\n */\n _classPrivateMethodInitSpec(this, _DragToScroll_brand);\n /**\n * Size of an element and its position relative to the viewport,\n * e.g. {bottom: 449, height: 441, left: 8, right: 814, top: 8, width: 806, x: 8, y:8}.\n *\n * @type {DOMRect}\n */\n _defineProperty(this, \"boundaries\", null);\n /**\n * Callback function.\n *\n * @private\n * @type {Function}\n */\n _defineProperty(this, \"callback\", null);\n /**\n * Flag indicates mouseDown/mouseUp.\n *\n * @private\n * @type {boolean}\n */\n _defineProperty(this, \"listening\", false);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link DragToScroll#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n if (this.enabled) {\n return;\n }\n this.addHook('afterOnCellMouseDown', event => _assertClassBrand(_DragToScroll_brand, this, _setupListening).call(this, event));\n this.addHook('afterOnCellCornerMouseDown', event => _assertClassBrand(_DragToScroll_brand, this, _setupListening).call(this, event));\n this.registerEvents();\n super.enablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`dragToScroll`](@/api/options.md#dragtoscroll)\n */\n updatePlugin() {\n this.disablePlugin();\n this.enablePlugin();\n super.updatePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n this.unregisterEvents();\n super.disablePlugin();\n }\n\n /**\n * Sets the boundaries/dimensions of the scrollable viewport.\n *\n * @param {DOMRect|{left: number, right: number, top: number, bottom: number}} [boundaries] An object with\n * coordinates. Contains the window boundaries by default. The object is compatible with DOMRect.\n */\n setBoundaries() {\n let boundaries = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {\n left: 0,\n right: this.hot.rootWindow.innerWidth,\n top: 0,\n bottom: this.hot.rootWindow.innerHeight\n };\n this.boundaries = boundaries;\n }\n\n /**\n * Changes callback function.\n *\n * @param {Function} callback The callback function.\n */\n setCallback(callback) {\n this.callback = callback;\n }\n\n /**\n * Checks if the mouse position (X, Y) is outside the viewport and fires a callback with calculated X an Y diffs\n * between passed boundaries.\n *\n * @param {number} x Mouse X coordinate to check.\n * @param {number} y Mouse Y coordinate to check.\n */\n check(x, y) {\n let diffX = 0;\n let diffY = 0;\n if (y < this.boundaries.top) {\n // y is less than top\n diffY = y - this.boundaries.top;\n } else if (y > this.boundaries.bottom) {\n // y is more than bottom\n diffY = y - this.boundaries.bottom;\n }\n if (x < this.boundaries.left) {\n // x is less than left\n diffX = x - this.boundaries.left;\n } else if (x > this.boundaries.right) {\n // x is more than right\n diffX = x - this.boundaries.right;\n }\n this.callback(diffX, diffY);\n }\n\n /**\n * Enables listening on `mousemove` event.\n *\n * @private\n */\n listen() {\n this.listening = true;\n }\n\n /**\n * Disables listening on `mousemove` event.\n *\n * @private\n */\n unlisten() {\n this.listening = false;\n }\n\n /**\n * Returns current state of listening.\n *\n * @private\n * @returns {boolean}\n */\n isListening() {\n return this.listening;\n }\n\n /**\n * Registers dom listeners.\n *\n * @private\n */\n registerEvents() {\n const {\n rootWindow\n } = this.hot;\n let frame = rootWindow;\n while (frame) {\n this.eventManager.addEventListener(frame.document, 'contextmenu', () => this.unlisten());\n this.eventManager.addEventListener(frame.document, 'mouseup', () => this.unlisten());\n this.eventManager.addEventListener(frame.document, 'mousemove', event => this.onMouseMove(event));\n frame = getParentWindow(frame);\n }\n }\n\n /**\n * Unbinds the events used by the plugin.\n *\n * @private\n */\n unregisterEvents() {\n this.eventManager.clear();\n }\n /**\n * 'mouseMove' event callback.\n *\n * @private\n * @param {MouseEvent} event `mousemove` event properties.\n */\n onMouseMove(event) {\n if (!this.isListening()) {\n return;\n }\n this.check(event.clientX, event.clientY);\n }\n\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n super.destroy();\n }\n}\nfunction _setupListening(event) {\n if (isRightClick(event)) {\n return;\n }\n const scrollHandler = this.hot.view._wt.wtOverlays.topOverlay.mainTableScrollableElement;\n this.setBoundaries(scrollHandler !== this.hot.rootWindow ? scrollHandler.getBoundingClientRect() : undefined);\n this.setCallback((scrollX, scrollY) => {\n var _scrollHandler$scroll, _scrollHandler$scroll2;\n const horizontalScrollValue = (_scrollHandler$scroll = scrollHandler.scrollLeft) !== null && _scrollHandler$scroll !== void 0 ? _scrollHandler$scroll : scrollHandler.scrollX;\n const verticalScrollValue = (_scrollHandler$scroll2 = scrollHandler.scrollTop) !== null && _scrollHandler$scroll2 !== void 0 ? _scrollHandler$scroll2 : scrollHandler.scrollY;\n scrollHandler.scroll(horizontalScrollValue + Math.sign(scrollX) * 50, verticalScrollValue + Math.sign(scrollY) * 20);\n });\n this.listen();\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, DragToScroll } from \"./dragToScroll.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport { arrayEach } from \"../../helpers/array.mjs\";\nimport { objectEach } from \"../../helpers/object.mjs\";\nimport { CommandExecutor } from \"../contextMenu/commandExecutor.mjs\";\nimport { getDocumentOffsetByElement } from \"../contextMenu/utils.mjs\";\nimport { hasClass, setAttribute } from \"../../helpers/dom/element.mjs\";\nimport { ItemsFactory } from \"../contextMenu/itemsFactory.mjs\";\nimport { Menu } from \"../contextMenu/menu/index.mjs\";\nimport Hooks from \"../../pluginHooks.mjs\";\nimport { COLUMN_LEFT, COLUMN_RIGHT, REMOVE_COLUMN, CLEAR_COLUMN, READ_ONLY, ALIGNMENT, SEPARATOR } from \"../contextMenu/predefinedItems/index.mjs\";\nimport { A11Y_HASPOPUP, A11Y_HIDDEN, A11Y_LABEL } from \"../../helpers/a11y.mjs\";\nHooks.getSingleton().register('afterDropdownMenuDefaultOptions');\nHooks.getSingleton().register('beforeDropdownMenuShow');\nHooks.getSingleton().register('afterDropdownMenuShow');\nHooks.getSingleton().register('afterDropdownMenuHide');\nHooks.getSingleton().register('afterDropdownMenuExecute');\nexport const PLUGIN_KEY = 'dropdownMenu';\nexport const PLUGIN_PRIORITY = 230;\nconst BUTTON_CLASS_NAME = 'changeType';\nconst SHORTCUTS_GROUP = PLUGIN_KEY;\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n/**\n * @plugin DropdownMenu\n * @class DropdownMenu\n *\n * @description\n * This plugin creates the Handsontable Dropdown Menu. It allows to create a new column at any place in the grid\n * among [other features](@/guides/accessories-and-menus/context-menu/context-menu.md#context-menu-with-specific-options).\n * Possible values:\n * * `true` (to enable default options),\n * * `false` (to disable completely).\n *\n * or array of any available strings:\n * * `[\"col_left\", \"col_right\", \"remove_col\", \"---------\", \"undo\", \"redo\"]`.\n *\n * See [the dropdown menu demo](@/guides/columns/column-menu/column-menu.md) for examples.\n *\n * @example\n * ::: only-for javascript\n * ```js\n * const container = document.getElementById('example');\n * const hot = new Handsontable(container, {\n * data: data,\n * colHeaders: true,\n * // enable dropdown menu\n * dropdownMenu: true\n * });\n *\n * // or\n * const hot = new Handsontable(container, {\n * data: data,\n * colHeaders: true,\n * // enable and configure dropdown menu\n * dropdownMenu: ['remove_col', '---------', 'make_read_only', 'alignment']\n * });\n * ```\n * :::\n *\n * ::: only-for react\n * ```jsx\n * \n * ```\n * :::\n */\nvar _isButtonClicked = /*#__PURE__*/new WeakMap();\nvar _DropdownMenu_brand = /*#__PURE__*/new WeakSet();\nexport class DropdownMenu extends BasePlugin {\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n static get PLUGIN_DEPS() {\n return ['plugin:AutoColumnSize'];\n }\n\n /**\n * Default menu items order when `dropdownMenu` is enabled by setting the config item to `true`.\n *\n * @returns {Array}\n */\n static get DEFAULT_ITEMS() {\n return [COLUMN_LEFT, COLUMN_RIGHT, SEPARATOR, REMOVE_COLUMN, SEPARATOR, CLEAR_COLUMN, SEPARATOR, READ_ONLY, SEPARATOR, ALIGNMENT];\n }\n\n /**\n * Instance of {@link CommandExecutor}.\n *\n * @private\n * @type {CommandExecutor}\n */\n\n constructor(hotInstance) {\n super(hotInstance);\n\n // One listener for enable/disable functionality\n /**\n * Add custom shortcuts to the provided menu instance.\n *\n * @param {Menu} menuInstance The menu instance.\n */\n _classPrivateMethodInitSpec(this, _DropdownMenu_brand);\n _defineProperty(this, \"commandExecutor\", new CommandExecutor(this.hot));\n /**\n * Instance of {@link ItemsFactory}.\n *\n * @private\n * @type {ItemsFactory}\n */\n _defineProperty(this, \"itemsFactory\", null);\n /**\n * Instance of {@link Menu}.\n *\n * @private\n * @type {Menu}\n */\n _defineProperty(this, \"menu\", null);\n /**\n * Flag which determines if the button that opens the menu was clicked.\n *\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _isButtonClicked, false);\n this.hot.addHook('afterGetColHeader', (col, TH) => _assertClassBrand(_DropdownMenu_brand, this, _onAfterGetColHeader).call(this, col, TH));\n }\n\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link DropdownMenu#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n *\n * @fires Hooks#afterDropdownMenuDefaultOptions\n * @fires Hooks#beforeDropdownMenuSetItems\n */\n enablePlugin() {\n var _this = this;\n if (this.enabled) {\n return;\n }\n this.itemsFactory = new ItemsFactory(this.hot, DropdownMenu.DEFAULT_ITEMS);\n this.addHook('beforeOnCellMouseDown', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _assertClassBrand(_DropdownMenu_brand, _this, _onBeforeOnCellMouseDown).call(_this, ...args);\n });\n this.addHook('beforeViewportScrollHorizontally', function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _assertClassBrand(_DropdownMenu_brand, _this, _onBeforeViewportScrollHorizontally).call(_this, ...args);\n });\n const settings = this.hot.getSettings()[PLUGIN_KEY];\n const predefinedItems = {\n items: this.itemsFactory.getItems(settings)\n };\n this.registerEvents();\n if (typeof settings.callback === 'function') {\n this.commandExecutor.setCommonCallback(settings.callback);\n }\n this.registerShortcuts();\n super.enablePlugin();\n this.callOnPluginsReady(() => {\n this.hot.runHooks('afterDropdownMenuDefaultOptions', predefinedItems);\n this.itemsFactory.setPredefinedItems(predefinedItems.items);\n const menuItems = this.itemsFactory.getItems(settings);\n if (this.menu) {\n this.menu.destroy();\n }\n this.menu = new Menu(this.hot, {\n className: 'htDropdownMenu',\n keepInViewport: true,\n container: settings.uiContainer || this.hot.rootDocument.body\n });\n this.hot.runHooks('beforeDropdownMenuSetItems', menuItems);\n this.menu.setMenuItems(menuItems);\n this.menu.addLocalHook('beforeOpen', () => _assertClassBrand(_DropdownMenu_brand, this, _onMenuBeforeOpen).call(this));\n this.menu.addLocalHook('afterOpen', () => _assertClassBrand(_DropdownMenu_brand, this, _onMenuAfterOpen).call(this));\n this.menu.addLocalHook('afterSubmenuOpen', subMenuInstance => _assertClassBrand(_DropdownMenu_brand, this, _onSubMenuAfterOpen).call(this, subMenuInstance));\n this.menu.addLocalHook('afterClose', () => _assertClassBrand(_DropdownMenu_brand, this, _onMenuAfterClose).call(this));\n this.menu.addLocalHook('executeCommand', function () {\n for (var _len3 = arguments.length, params = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n params[_key3] = arguments[_key3];\n }\n return _this.executeCommand.call(_this, ...params);\n });\n\n // Register all commands. Predefined and added by user or by plugins\n arrayEach(menuItems, command => this.commandExecutor.registerCommand(command.key, command));\n });\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`dropdownMenu`](@/api/options.md#dropdownmenu)\n */\n updatePlugin() {\n this.disablePlugin();\n this.enablePlugin();\n super.updatePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n this.close();\n if (this.menu) {\n this.menu.destroy();\n }\n this.unregisterShortcuts();\n super.disablePlugin();\n }\n\n /**\n * Register shortcuts responsible for toggling dropdown menu.\n *\n * @private\n */\n registerShortcuts() {\n const gridContext = this.hot.getShortcutManager().getContext('grid');\n const callback = () => {\n const {\n highlight\n } = this.hot.getSelectedRangeLast();\n if ((highlight.isHeader() && highlight.row === -1 || highlight.isCell()) && highlight.col >= 0) {\n this.hot.selectColumns(highlight.col, highlight.col, -1);\n const {\n from\n } = this.hot.getSelectedRangeLast();\n const offset = getDocumentOffsetByElement(this.menu.container, this.hot.rootDocument);\n const target = this.hot.getCell(-1, from.col, true).querySelector(`.${BUTTON_CLASS_NAME}`);\n const rect = target.getBoundingClientRect();\n this.open({\n left: rect.left + offset.left,\n top: rect.top + target.offsetHeight + offset.top\n }, {\n left: rect.width,\n right: 0,\n above: 0,\n below: 3\n });\n // Make sure the first item is selected (role=menuitem). Otherwise, screen readers\n // will block the Esc key for the whole menu.\n this.menu.getNavigator().toFirstItem();\n }\n };\n gridContext.addShortcuts([{\n keys: [['Shift', 'Alt', 'ArrowDown'], ['Control/Meta', 'Enter']],\n callback,\n runOnlyIf: () => {\n var _this$hot$getSelected;\n const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;\n return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader() && !this.menu.isOpened();\n },\n captureCtrl: true,\n group: SHORTCUTS_GROUP\n }, {\n keys: [['Shift', 'Alt', 'ArrowDown']],\n callback,\n runOnlyIf: () => {\n var _this$hot$getSelected2;\n const highlight = (_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.highlight;\n return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isCell() && !this.menu.isOpened();\n },\n group: SHORTCUTS_GROUP\n }]);\n }\n\n /**\n * Unregister shortcuts responsible for toggling dropdown menu.\n *\n * @private\n */\n unregisterShortcuts() {\n this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);\n }\n\n /**\n * Registers the DOM listeners.\n *\n * @private\n */\n registerEvents() {\n this.eventManager.addEventListener(this.hot.rootElement, 'click', event => _assertClassBrand(_DropdownMenu_brand, this, _onTableClick).call(this, event));\n }\n\n /**\n * Opens menu and re-position it based on the passed coordinates.\n *\n * @param {{ top: number, left: number }|Event} position An object with `top` and `left` properties\n * which contains coordinates relative to the browsers viewport (without included scroll offsets).\n * Or if the native event is passed the menu will be positioned based on the `pageX` and `pageY`\n * coordinates.\n * @param {{ above: number, below: number, left: number, right: number }} offset An object allows applying\n * the offset to the menu position.\n * @fires Hooks#beforeDropdownMenuShow\n * @fires Hooks#afterDropdownMenuShow\n */\n open(position) {\n var _this$menu;\n let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n above: 0,\n below: 0,\n left: 0,\n right: 0\n };\n if ((_this$menu = this.menu) !== null && _this$menu !== void 0 && _this$menu.isOpened()) {\n return;\n }\n this.menu.open();\n objectEach(offset, (value, key) => {\n this.menu.setOffset(key, value);\n });\n this.menu.setPosition(position);\n }\n\n /**\n * Closes dropdown menu.\n */\n close() {\n var _this$menu2;\n (_this$menu2 = this.menu) === null || _this$menu2 === void 0 || _this$menu2.close();\n }\n\n /**\n * Executes context menu command.\n *\n * The `executeCommand()` method works only for selected cells.\n *\n * When no cells are selected, `executeCommand()` doesn't do anything.\n *\n * You can execute all predefined commands:\n * * `'col_left'` - Insert column left\n * * `'col_right'` - Insert column right\n * * `'clear_column'` - Clear selected column\n * * `'remove_col'` - Remove column\n * * `'undo'` - Undo last action\n * * `'redo'` - Redo last action\n * * `'make_read_only'` - Make cell read only\n * * `'alignment:left'` - Alignment to the left\n * * `'alignment:top'` - Alignment to the top\n * * `'alignment:right'` - Alignment to the right\n * * `'alignment:bottom'` - Alignment to the bottom\n * * `'alignment:middle'` - Alignment to the middle\n * * `'alignment:center'` - Alignment to the center (justify).\n *\n * Or you can execute command registered in settings where `key` is your command name.\n *\n * @param {string} commandName Command name to execute.\n * @param {*} params Additional parameters passed to the command executor.\n */\n executeCommand(commandName) {\n for (var _len4 = arguments.length, params = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n params[_key4 - 1] = arguments[_key4];\n }\n this.commandExecutor.execute(commandName, ...params);\n }\n\n /**\n * Turns on / off listening on dropdown menu.\n *\n * @private\n * @param {boolean} listen Turn on listening when value is set to true, otherwise turn it off.\n */\n setListening() {\n let listen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n if (this.menu.isOpened()) {\n if (listen) {\n this.menu.hotMenu.listen();\n } else {\n this.menu.hotMenu.unlisten();\n }\n }\n }\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n this.close();\n if (this.menu) {\n this.menu.destroy();\n }\n super.destroy();\n }\n}\nfunction _addCustomShortcuts(menuInstance) {\n menuInstance.getKeyboardShortcutsCtrl().addCustomShortcuts([{\n keys: [['Control/Meta', 'A']],\n callback: () => false\n }]);\n}\n/**\n * Table click listener.\n *\n * @private\n * @param {Event} event The mouse event object.\n */\nfunction _onTableClick(event) {\n if (hasClass(event.target, BUTTON_CLASS_NAME)) {\n const offset = getDocumentOffsetByElement(this.menu.container, this.hot.rootDocument);\n const rect = event.target.getBoundingClientRect();\n event.stopPropagation();\n _classPrivateFieldSet(_isButtonClicked, this, false);\n this.open({\n left: rect.left + offset.left,\n top: rect.top + event.target.offsetHeight + offset.top\n }, {\n left: rect.width,\n right: 0,\n above: 0,\n below: 3\n });\n }\n}\n/**\n * On after get column header listener.\n *\n * @private\n * @param {number} col Visual column index.\n * @param {HTMLTableCellElement} TH Header's TH element.\n */\nfunction _onAfterGetColHeader(col, TH) {\n // Corner or a higher-level header\n const headerRow = TH.parentNode;\n if (!headerRow) {\n return;\n }\n const headerRowList = headerRow.parentNode.childNodes;\n const level = Array.prototype.indexOf.call(headerRowList, headerRow);\n if (col < 0 || level !== headerRowList.length - 1) {\n return;\n }\n const existingButton = TH.querySelector(`.${BUTTON_CLASS_NAME}`);\n\n // Plugin enabled and buttons already exists, return.\n if (this.enabled && existingButton) {\n return;\n }\n // Plugin disabled and buttons still exists, so remove them.\n if (!this.enabled) {\n if (existingButton) {\n existingButton.parentNode.removeChild(existingButton);\n }\n return;\n }\n const button = this.hot.rootDocument.createElement('button');\n button.className = BUTTON_CLASS_NAME;\n button.type = 'button';\n button.tabIndex = -1;\n if (this.hot.getSettings().ariaTags) {\n setAttribute(button, [A11Y_HIDDEN(), A11Y_LABEL(' ')]);\n setAttribute(TH, [A11Y_HASPOPUP('menu')]);\n }\n\n // prevent page reload on button click\n button.onclick = function () {\n return false;\n };\n TH.firstChild.insertBefore(button, TH.firstChild.firstChild);\n}\n/**\n * On menu before open listener.\n *\n * @private\n * @fires Hooks#beforeDropdownMenuShow\n */\nfunction _onMenuBeforeOpen() {\n this.hot.runHooks('beforeDropdownMenuShow', this);\n}\n/**\n * On menu after open listener.\n *\n * @private\n * @fires Hooks#afterDropdownMenuShow\n */\nfunction _onMenuAfterOpen() {\n this.hot.runHooks('afterDropdownMenuShow', this);\n _assertClassBrand(_DropdownMenu_brand, this, _addCustomShortcuts).call(this, this.menu);\n}\n/**\n * Listener for the `afterSubmenuOpen` hook.\n *\n * @private\n * @param {Menu} subMenuInstance The opened sub menu instance.\n */\nfunction _onSubMenuAfterOpen(subMenuInstance) {\n _assertClassBrand(_DropdownMenu_brand, this, _addCustomShortcuts).call(this, subMenuInstance);\n}\n/**\n * On menu after close listener.\n *\n * @private\n * @fires Hooks#afterDropdownMenuHide\n */\nfunction _onMenuAfterClose() {\n this.hot.listen();\n this.hot.runHooks('afterDropdownMenuHide', this);\n}\n/**\n * Hook allows blocking horizontal scroll when the menu is opened by clicking on\n * the column header button. This prevents from scrolling the viewport (jump effect) when\n * the button is clicked.\n *\n * @param {number} visualColumn Visual column index.\n * @returns {number | null}\n */\nfunction _onBeforeViewportScrollHorizontally(visualColumn) {\n return _classPrivateFieldGet(_isButtonClicked, this) ? null : visualColumn;\n}\n/**\n * Hook sets the internal flag to `true` when the button is clicked.\n *\n * @param {MouseEvent} event The mouse event object.\n */\nfunction _onBeforeOnCellMouseDown(event) {\n if (hasClass(event.target, BUTTON_CLASS_NAME)) {\n _classPrivateFieldSet(_isButtonClicked, this, true);\n }\n}\nDropdownMenu.SEPARATOR = {\n name: SEPARATOR\n};", "export { PLUGIN_KEY, PLUGIN_PRIORITY, DropdownMenu } from \"./dropdownMenu.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { rangeEach } from \"../../helpers/number.mjs\";\n/**\n * @private\n */\nclass DataProvider {\n constructor(hotInstance) {\n /**\n * Handsontable instance.\n *\n * @type {Core}\n */\n _defineProperty(this, \"hot\", void 0);\n /**\n * Format type class options.\n *\n * @type {object}\n */\n _defineProperty(this, \"options\", {});\n this.hot = hotInstance;\n }\n\n /**\n * Set options for data provider.\n *\n * @param {object} options Object with specified options.\n */\n setOptions(options) {\n this.options = options;\n }\n\n /**\n * Get table data based on provided settings to the class constructor.\n *\n * @returns {Array}\n */\n getData() {\n const {\n startRow,\n startCol,\n endRow,\n endCol\n } = this._getDataRange();\n const options = this.options;\n const data = [];\n rangeEach(startRow, endRow, rowIndex => {\n const row = [];\n if (!options.exportHiddenRows && this._isHiddenRow(rowIndex)) {\n return;\n }\n rangeEach(startCol, endCol, colIndex => {\n if (!options.exportHiddenColumns && this._isHiddenColumn(colIndex)) {\n return;\n }\n row.push(this.hot.getDataAtCell(rowIndex, colIndex));\n });\n data.push(row);\n });\n return data;\n }\n\n /**\n * Gets list of row headers.\n *\n * @returns {Array}\n */\n getRowHeaders() {\n const headers = [];\n if (this.options.rowHeaders) {\n const {\n startRow,\n endRow\n } = this._getDataRange();\n const rowHeaders = this.hot.getRowHeader();\n rangeEach(startRow, endRow, row => {\n if (!this.options.exportHiddenRows && this._isHiddenRow(row)) {\n return;\n }\n headers.push(rowHeaders[row]);\n });\n }\n return headers;\n }\n\n /**\n * Gets list of columns headers.\n *\n * @returns {Array}\n */\n getColumnHeaders() {\n const headers = [];\n if (this.options.columnHeaders) {\n const {\n startCol,\n endCol\n } = this._getDataRange();\n const colHeaders = this.hot.getColHeader();\n rangeEach(startCol, endCol, column => {\n if (!this.options.exportHiddenColumns && this._isHiddenColumn(column)) {\n return;\n }\n headers.push(colHeaders[column]);\n });\n }\n return headers;\n }\n\n /**\n * Get data range object based on settings provided in the class constructor.\n *\n * @private\n * @returns {object} Returns object with keys `startRow`, `startCol`, `endRow` and `endCol`.\n */\n _getDataRange() {\n const cols = this.hot.countCols() - 1;\n const rows = this.hot.countRows() - 1;\n let [startRow = 0, startCol = 0, endRow = rows, endCol = cols] = this.options.range;\n startRow = Math.max(startRow, 0);\n startCol = Math.max(startCol, 0);\n endRow = Math.min(endRow, rows);\n endCol = Math.min(endCol, cols);\n return {\n startRow,\n startCol,\n endRow,\n endCol\n };\n }\n\n /**\n * Check if row at specified row index is hidden.\n *\n * @private\n * @param {number} row Row index.\n * @returns {boolean}\n */\n _isHiddenRow(row) {\n return this.hot.rowIndexMapper.isHidden(this.hot.toPhysicalRow(row));\n }\n\n /**\n * Check if column at specified column index is hidden.\n *\n * @private\n * @param {number} column Visual column index.\n * @returns {boolean}\n */\n _isHiddenColumn(column) {\n return this.hot.columnIndexMapper.isHidden(this.hot.toPhysicalColumn(column));\n }\n}\nexport default DataProvider;", "import \"core-js/modules/es.error.cause.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { extend, clone } from \"../../../helpers/object.mjs\";\nimport { substitute } from \"../../../helpers/string.mjs\";\n/**\n * @private\n */\nclass BaseType {\n /**\n * Default options.\n *\n * @returns {object}\n */\n static get DEFAULT_OPTIONS() {\n return {\n mimeType: 'text/plain',\n fileExtension: 'txt',\n filename: 'Handsontable [YYYY]-[MM]-[DD]',\n encoding: 'utf-8',\n bom: false,\n columnHeaders: false,\n rowHeaders: false,\n exportHiddenColumns: false,\n exportHiddenRows: false,\n range: []\n };\n }\n\n /**\n * Data provider.\n *\n * @type {DataProvider}\n */\n\n constructor(dataProvider, options) {\n _defineProperty(this, \"dataProvider\", void 0);\n /**\n * Format type class options.\n *\n * @type {object}\n */\n _defineProperty(this, \"options\", void 0);\n this.dataProvider = dataProvider;\n this.options = this._mergeOptions(options);\n this.dataProvider.setOptions(this.options);\n }\n\n /**\n * Merge options provided by users with defaults.\n *\n * @param {object} options An object with options to merge with.\n * @returns {object} Returns new options object.\n */\n _mergeOptions(options) {\n let _options = clone(this.constructor.DEFAULT_OPTIONS);\n const date = new Date();\n _options = extend(clone(BaseType.DEFAULT_OPTIONS), _options);\n _options = extend(_options, options);\n _options.filename = substitute(_options.filename, {\n YYYY: date.getFullYear(),\n MM: `${date.getMonth() + 1}`.padStart(2, '0'),\n DD: `${date.getDate()}`.padStart(2, '0')\n });\n return _options;\n }\n}\nexport default BaseType;", "import { arrayEach, arrayMap } from \"../../../helpers/array.mjs\";\nimport { stringify } from \"../../../helpers/mixed.mjs\";\nimport BaseType from \"./_base.mjs\";\nconst CHAR_CARRIAGE_RETURN = String.fromCharCode(13);\nconst CHAR_DOUBLE_QUOTES = String.fromCharCode(34);\nconst CHAR_LINE_FEED = String.fromCharCode(10);\n\n/**\n * @private\n */\nclass Csv extends BaseType {\n /**\n * Default options for exporting CSV format.\n *\n * @returns {object}\n */\n static get DEFAULT_OPTIONS() {\n return {\n mimeType: 'text/csv',\n fileExtension: 'csv',\n bom: true,\n columnDelimiter: ',',\n rowDelimiter: '\\r\\n'\n };\n }\n\n /**\n * Create string body in desired format.\n *\n * @returns {string}\n */\n export() {\n const options = this.options;\n const data = this.dataProvider.getData();\n let columnHeaders = this.dataProvider.getColumnHeaders();\n const hasColumnHeaders = columnHeaders.length > 0;\n const rowHeaders = this.dataProvider.getRowHeaders();\n const hasRowHeaders = rowHeaders.length > 0;\n let result = options.bom ? String.fromCharCode(0xFEFF) : '';\n if (hasColumnHeaders) {\n columnHeaders = arrayMap(columnHeaders, value => this._escapeCell(value, true));\n if (hasRowHeaders) {\n result += options.columnDelimiter;\n }\n result += columnHeaders.join(options.columnDelimiter);\n result += options.rowDelimiter;\n }\n arrayEach(data, (value, index) => {\n if (index > 0) {\n result += options.rowDelimiter;\n }\n if (hasRowHeaders) {\n result += this._escapeCell(rowHeaders[index]) + options.columnDelimiter;\n }\n result += value.map(cellValue => this._escapeCell(cellValue)).join(options.columnDelimiter);\n });\n return result;\n }\n\n /**\n * Escape cell value.\n *\n * @param {*} value Cell value.\n * @param {boolean} [force=false] Indicates if cell value will be escaped forcefully.\n * @returns {string}\n */\n _escapeCell(value) {\n let force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let escapedValue = stringify(value);\n if (escapedValue !== '' && (force || escapedValue.indexOf(CHAR_CARRIAGE_RETURN) >= 0 || escapedValue.indexOf(CHAR_DOUBLE_QUOTES) >= 0 || escapedValue.indexOf(CHAR_LINE_FEED) >= 0 || escapedValue.indexOf(this.options.columnDelimiter) >= 0)) {\n escapedValue = escapedValue.replace(new RegExp('\"', 'g'), '\"\"');\n escapedValue = `\"${escapedValue}\"`;\n }\n return escapedValue;\n }\n}\nexport default Csv;", "import Csv from \"./types/csv.mjs\";\nexport const TYPE_CSV = 'csv';\nexport const TYPE_EXCEL = 'excel'; // TODO\nexport const TYPE_PDF = 'pdf'; // TODO\n\nexport const EXPORT_TYPES = {\n [TYPE_CSV]: Csv\n};\n\n/**\n * @private\n * @param {string} type The exporter type.\n * @param {DataProvider} dataProvider The data provider.\n * @param {object} options Constructor options for exporter class.\n * @returns {BaseType|null}\n */\nexport default function typeFactory(type, dataProvider, options) {\n if (typeof EXPORT_TYPES[type] === 'function') {\n return new EXPORT_TYPES[type](dataProvider, options);\n }\n return null;\n}", "import \"core-js/modules/es.error.cause.js\";\nimport { BasePlugin } from \"../base/index.mjs\";\nimport DataProvider from \"./dataProvider.mjs\";\nimport typeFactory, { EXPORT_TYPES } from \"./typeFactory.mjs\";\nexport const PLUGIN_KEY = 'exportFile';\nexport const PLUGIN_PRIORITY = 240;\n\n/**\n * @plugin ExportFile\n * @class ExportFile\n *\n * @description\n * The `ExportFile` plugin lets you export table data as a string, blob, or downloadable CSV file.\n *\n * See [the export file demo](@/guides/accessories-and-menus/export-to-csv/export-to-csv.md) for examples.\n *\n * @example\n * ::: only-for javascript\n * ```js\n * const container = document.getElementById('example');\n * const hot = new Handsontable(container, {\n * data: getData()\n * });\n *\n * // access to exportFile plugin instance\n * const exportPlugin = hot.getPlugin('exportFile');\n *\n * // export as a string\n * exportPlugin.exportAsString('csv');\n *\n * // export as a blob object\n * exportPlugin.exportAsBlob('csv');\n *\n * // export to downloadable file (named: MyFile.csv)\n * exportPlugin.downloadFile('csv', {filename: 'MyFile'});\n *\n * // export as a string (with specified data range):\n * exportPlugin.exportAsString('csv', {\n * exportHiddenRows: true, // default false\n * exportHiddenColumns: true, // default false\n * columnHeaders: true, // default false\n * rowHeaders: true, // default false\n * columnDelimiter: ';', // default ','\n * range: [1, 1, 6, 6] // [startRow, endRow, startColumn, endColumn]\n * });\n * ```\n * :::\n *\n * ::: only-for react\n * ```jsx\n * const hotRef = useRef(null);\n *\n * ...\n *\n * \n *\n * const hot = hotRef.current.hotInstance;\n * // access to exportFile plugin instance\n * const exportPlugin = hot.getPlugin('exportFile');\n *\n * // export as a string\n * exportPlugin.exportAsString('csv');\n *\n * // export as a blob object\n * exportPlugin.exportAsBlob('csv');\n *\n * // export to downloadable file (named: MyFile.csv)\n * exportPlugin.downloadFile('csv', {filename: 'MyFile'});\n *\n * // export as a string (with specified data range):\n * exportPlugin.exportAsString('csv', {\n * exportHiddenRows: true, // default false\n * exportHiddenColumns: true, // default false\n * columnHeaders: true, // default false\n * rowHeaders: true, // default false\n * columnDelimiter: ';', // default ','\n * range: [1, 1, 6, 6] // [startRow, endRow, startColumn, endColumn]\n * });\n * ```\n * :::\n */\nexport class ExportFile extends BasePlugin {\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link ExportFile#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return true;\n }\n\n /**\n * @typedef ExportOptions\n * @memberof ExportFile\n * @type {object}\n * @property {boolean} [exportHiddenRows=false] Include hidden rows in the exported file.\n * @property {boolean} [exportHiddenColumns=false] Include hidden columns in the exported file.\n * @property {boolean} [columnHeaders=false] Include column headers in the exported file.\n * @property {boolean} [rowHeaders=false] Include row headers in the exported file.\n * @property {string} [columnDelimiter=','] Column delimiter.\n * @property {string} [range=[]] Cell range that will be exported to file.\n */\n\n /**\n * Exports table data as a string.\n *\n * @param {string} format Export format type eq. `'csv'`.\n * @param {ExportOptions} options Export options.\n * @returns {string}\n */\n exportAsString(format) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return this._createTypeFormatter(format, options).export();\n }\n\n /**\n * Exports table data as a blob object.\n *\n * @param {string} format Export format type eq. `'csv'`.\n * @param {ExportOptions} options Export options.\n * @returns {Blob}\n */\n exportAsBlob(format) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return this._createBlob(this._createTypeFormatter(format, options));\n }\n\n /**\n * Exports table data as a downloadable file.\n *\n * @param {string} format Export format type eq. `'csv'`.\n * @param {ExportOptions} options Export options.\n */\n downloadFile(format) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n const {\n rootDocument,\n rootWindow\n } = this.hot;\n const formatter = this._createTypeFormatter(format, options);\n const blob = this._createBlob(formatter);\n const URL = rootWindow.URL || rootWindow.webkitURL;\n const a = rootDocument.createElement('a');\n const name = `${formatter.options.filename}.${formatter.options.fileExtension}`;\n if (a.download !== undefined) {\n const url = URL.createObjectURL(blob);\n a.style.display = 'none';\n a.setAttribute('href', url);\n a.setAttribute('download', name);\n rootDocument.body.appendChild(a);\n a.dispatchEvent(new MouseEvent('click'));\n rootDocument.body.removeChild(a);\n setTimeout(() => {\n URL.revokeObjectURL(url);\n }, 100);\n } else if (navigator.msSaveOrOpenBlob) {\n // IE10+\n navigator.msSaveOrOpenBlob(blob, name);\n }\n }\n\n /**\n * Creates and returns class formatter for specified export type.\n *\n * @private\n * @param {string} format Export format type eq. `'csv'`.\n * @param {ExportOptions} options Export options.\n * @returns {BaseType}\n */\n _createTypeFormatter(format) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n if (!EXPORT_TYPES[format]) {\n throw new Error(`Export format type \"${format}\" is not supported.`);\n }\n return typeFactory(format, new DataProvider(this.hot), options);\n }\n\n /**\n * Creates blob object based on provided type formatter class.\n *\n * @private\n * @param {BaseType} typeFormatter The instance of the specyfic formatter/exporter.\n * @returns {Blob}\n */\n _createBlob(typeFormatter) {\n let formatter = null;\n if (typeof Blob !== 'undefined') {\n formatter = new Blob([typeFormatter.export()], {\n type: `${typeFormatter.options.mimeType};charset=${typeFormatter.options.encoding}`\n });\n }\n return formatter;\n }\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, ExportFile } from \"./exportFile.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { arrayEach } from \"../../../helpers/array.mjs\";\nimport { mixin } from \"../../../helpers/object.mjs\";\nimport localHooks from \"../../../mixins/localHooks.mjs\";\nimport { LinkedPhysicalIndexToValueMap as IndexToValueMap } from \"../../../translations/index.mjs\";\n/**\n * @private\n * @class BaseComponent\n */\nexport class BaseComponent {\n constructor(hotInstance, _ref) {\n let {\n id,\n stateless = true\n } = _ref;\n /**\n * The Handsontable instance.\n *\n * @type {Core}\n */\n _defineProperty(this, \"hot\", void 0);\n /**\n * The component uniq id.\n *\n * @type {string}\n */\n _defineProperty(this, \"id\", void 0);\n /**\n * List of registered component UI elements.\n *\n * @type {Array}\n */\n _defineProperty(this, \"elements\", []);\n /**\n * Flag which determines if element is hidden.\n *\n * @type {boolean}\n */\n _defineProperty(this, \"hidden\", false);\n /**\n * The component states id.\n *\n * @type {string}\n */\n _defineProperty(this, \"stateId\", '');\n /**\n * Index map which stores component states for each column.\n *\n * @type {LinkedPhysicalIndexToValueMap|null}\n */\n _defineProperty(this, \"state\", void 0);\n this.hot = hotInstance;\n this.id = id;\n this.stateId = `Filters.component.${this.id}`;\n this.state = stateless ? null : this.hot.columnIndexMapper.registerMap(this.stateId, new IndexToValueMap());\n }\n\n /**\n * Gets the list of elements from which the component is built.\n *\n * @returns {BaseUI[]}\n */\n getElements() {\n return this.elements;\n }\n\n /**\n * Reset elements to its initial state.\n */\n reset() {\n arrayEach(this.elements, ui => ui.reset());\n }\n\n /**\n * Hide component.\n */\n hide() {\n this.hidden = true;\n }\n\n /**\n * Show component.\n */\n show() {\n this.hidden = false;\n }\n\n /**\n * Check if component is hidden.\n *\n * @returns {boolean}\n */\n isHidden() {\n return this.hot === null || this.hidden;\n }\n\n /**\n * Restores the component state from the given physical column index. The method\n * internally calls the `setState` method. The state then is individually processed\n * by each component.\n *\n * @param {number} physicalColumn The physical column index.\n */\n restoreState(physicalColumn) {\n if (this.state) {\n this.setState(this.state.getValueAtIndex(physicalColumn));\n }\n }\n\n /**\n * The custom logic for component state restoring.\n */\n setState() {\n throw new Error('The state setting logic is not implemented');\n }\n\n /**\n * Saves the component state to the given physical column index. The method\n * internally calls the `getState` method, which returns the current state of\n * the component.\n *\n * @param {number} physicalColumn The physical column index.\n */\n saveState(physicalColumn) {\n if (this.state) {\n this.state.setValueAtIndex(physicalColumn, this.getState());\n }\n }\n\n /**\n * The custom logic for component state gathering (for stateful components).\n */\n getState() {\n throw new Error('The state gathering logic is not implemented');\n }\n\n /**\n * Destroy element.\n */\n destroy() {\n this.hot.columnIndexMapper.unregisterMap(this.stateId);\n this.clearLocalHooks();\n arrayEach(this.elements, ui => ui.destroy());\n this.state = null;\n this.elements = null;\n this.hot = null;\n }\n}\nmixin(BaseComponent, localHooks);", "import \"core-js/modules/es.error.cause.js\";\nexport const conditions = {};\n\n/**\n * Get condition closure with pre-bound arguments.\n *\n * @param {string} name Condition name.\n * @param {Array} args Condition arguments.\n * @returns {Function}\n */\nexport function getCondition(name, args) {\n if (!conditions[name]) {\n throw Error(`Filter condition \"${name}\" does not exist.`);\n }\n const {\n condition,\n descriptor\n } = conditions[name];\n let conditionArguments = args;\n if (descriptor.inputValuesDecorator) {\n conditionArguments = descriptor.inputValuesDecorator(conditionArguments);\n }\n return function (dataRow) {\n return condition.apply(dataRow.meta.instance, [].concat([dataRow], [conditionArguments]));\n };\n}\n\n/**\n * Get condition object descriptor which defines some additional informations about this condition.\n *\n * @param {string} name Condition name.\n * @returns {object}\n */\nexport function getConditionDescriptor(name) {\n if (!conditions[name]) {\n throw Error(`Filter condition \"${name}\" does not exist.`);\n }\n return conditions[name].descriptor;\n}\n\n/**\n * Condition registerer.\n *\n * @param {string} name Condition name.\n * @param {Function} condition Condition function.\n * @param {object} descriptor Condition descriptor.\n */\nexport function registerCondition(name, condition, descriptor) {\n descriptor.key = name;\n conditions[name] = {\n condition,\n descriptor\n };\n}", "import * as C from \"../../../i18n/constants.mjs\";\nimport { registerCondition } from \"../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'none';\n\n/**\n * @returns {boolean}\n */\nexport function condition() {\n return true;\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_NONE,\n inputsCount: 0,\n showOperators: false\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { registerCondition } from \"../conditionRegisterer.mjs\";\nimport { isEmpty } from \"../../../helpers/mixed.mjs\";\nexport const CONDITION_NAME = 'empty';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @returns {boolean}\n */\nexport function condition(dataRow) {\n return isEmpty(dataRow.value);\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_EMPTY,\n inputsCount: 0,\n showOperators: true\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { registerCondition, getCondition } from \"../conditionRegisterer.mjs\";\nimport { CONDITION_NAME as CONDITION_EMPTY } from \"./empty.mjs\";\nexport const CONDITION_NAME = 'not_empty';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @returns {boolean}\n */\nexport function condition(dataRow, inputValues) {\n return !getCondition(CONDITION_EMPTY, inputValues)(dataRow);\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_NOT_EMPTY,\n inputsCount: 0,\n showOperators: true\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { stringify } from \"../../../helpers/mixed.mjs\";\nimport { registerCondition } from \"../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'eq';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @param {Array} inputValues.\"0\" Value to check if it same as row's data.\n * @returns {boolean}\n */\nexport function condition(dataRow, _ref) {\n let [value] = _ref;\n return stringify(dataRow.value).toLocaleLowerCase(dataRow.meta.locale) === stringify(value);\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_EQUAL,\n inputsCount: 1,\n showOperators: true\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { registerCondition, getCondition } from \"../conditionRegisterer.mjs\";\nimport { CONDITION_NAME as CONDITION_EQUAL } from \"./equal.mjs\";\nexport const CONDITION_NAME = 'neq';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @returns {boolean}\n */\nexport function condition(dataRow, inputValues) {\n return !getCondition(CONDITION_EQUAL, inputValues)(dataRow);\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_NOT_EQUAL,\n inputsCount: 1,\n showOperators: true\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { registerCondition } from \"../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'gt';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @param {any} inputValues.\"0\" Condition value to compare numbers.\n * @returns {boolean}\n */\nexport function condition(dataRow, _ref) {\n let [value] = _ref;\n let conditionValue = value;\n if (dataRow.meta.type === 'numeric') {\n conditionValue = parseFloat(conditionValue, 10);\n }\n return dataRow.value > conditionValue;\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_GREATER_THAN,\n inputsCount: 1,\n showOperators: true\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { registerCondition } from \"../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'gte';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @param {*} inputValues.\"0\" Condition value to compare numbers.\n * @returns {boolean}\n */\nexport function condition(dataRow, _ref) {\n let [value] = _ref;\n let conditionValue = value;\n if (dataRow.meta.type === 'numeric') {\n conditionValue = parseFloat(conditionValue, 10);\n }\n return dataRow.value >= conditionValue;\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_GREATER_THAN_OR_EQUAL,\n inputsCount: 1,\n showOperators: true\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { registerCondition } from \"../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'lt';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @param {*} inputValues.\"0\" Condition value to compare numbers.\n * @returns {boolean}\n */\nexport function condition(dataRow, _ref) {\n let [value] = _ref;\n let conditionValue = value;\n if (dataRow.meta.type === 'numeric') {\n conditionValue = parseFloat(conditionValue, 10);\n }\n return dataRow.value < conditionValue;\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_LESS_THAN,\n inputsCount: 1,\n showOperators: true\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { registerCondition } from \"../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'lte';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @param {*} inputValues.\"0\" Condition value to compare numbers.\n * @returns {boolean}\n */\nexport function condition(dataRow, _ref) {\n let [value] = _ref;\n let conditionValue = value;\n if (dataRow.meta.type === 'numeric') {\n conditionValue = parseFloat(conditionValue, 10);\n }\n return dataRow.value <= conditionValue;\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_LESS_THAN_OR_EQUAL,\n inputsCount: 1,\n showOperators: true\n});", "import moment from 'moment';\nimport * as C from \"../../../../i18n/constants.mjs\";\nimport { registerCondition } from \"../../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'date_after';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @param {*} inputValues.\"0\" Minimum date of a range.\n * @returns {boolean}\n */\nexport function condition(dataRow, _ref) {\n let [value] = _ref;\n const date = moment(dataRow.value, dataRow.meta.dateFormat);\n const inputDate = moment(value, dataRow.meta.dateFormat);\n if (!date.isValid() || !inputDate.isValid()) {\n return false;\n }\n return date.diff(inputDate) >= 0;\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_AFTER,\n inputsCount: 1,\n showOperators: true\n});", "import moment from 'moment';\nimport * as C from \"../../../../i18n/constants.mjs\";\nimport { registerCondition } from \"../../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'date_before';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @param {*} inputValues.\"0\" Maximum date of a range.\n * @returns {boolean}\n */\nexport function condition(dataRow, _ref) {\n let [value] = _ref;\n const date = moment(dataRow.value, dataRow.meta.dateFormat);\n const inputDate = moment(value, dataRow.meta.dateFormat);\n if (!date.isValid() || !inputDate.isValid()) {\n return false;\n }\n return date.diff(inputDate) <= 0;\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_BEFORE,\n inputsCount: 1,\n showOperators: true\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { registerCondition, getCondition } from \"../conditionRegisterer.mjs\";\nimport { CONDITION_NAME as CONDITION_DATE_AFTER } from \"./date/after.mjs\";\nimport { CONDITION_NAME as CONDITION_DATE_BEFORE } from \"./date/before.mjs\";\nexport const CONDITION_NAME = 'between';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @param {number} inputValues.\"0\" The minimum value of the range.\n * @param {number} inputValues.\"1\" The maximum value of the range.\n * @returns {boolean}\n */\nexport function condition(dataRow, _ref) {\n let [from, to] = _ref;\n let fromValue = from;\n let toValue = to;\n if (dataRow.meta.type === 'numeric') {\n const _from = parseFloat(fromValue, 10);\n const _to = parseFloat(toValue, 10);\n fromValue = Math.min(_from, _to);\n toValue = Math.max(_from, _to);\n } else if (dataRow.meta.type === 'date') {\n const dateBefore = getCondition(CONDITION_DATE_BEFORE, [toValue]);\n const dateAfter = getCondition(CONDITION_DATE_AFTER, [fromValue]);\n return dateBefore(dataRow) && dateAfter(dataRow);\n }\n return dataRow.value >= fromValue && dataRow.value <= toValue;\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_BETWEEN,\n inputsCount: 2,\n showOperators: true\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { registerCondition, getCondition } from \"../conditionRegisterer.mjs\";\nimport { CONDITION_NAME as CONDITION_BETWEEN } from \"./between.mjs\";\nexport const CONDITION_NAME = 'not_between';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @returns {boolean}\n */\nexport function condition(dataRow, inputValues) {\n return !getCondition(CONDITION_BETWEEN, inputValues)(dataRow);\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_NOT_BETWEEN,\n inputsCount: 2,\n showOperators: true\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { stringify } from \"../../../helpers/mixed.mjs\";\nimport { registerCondition } from \"../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'begins_with';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @param {*} inputValues.\"0\" Value to check if it occurs at the beginning.\n * @returns {boolean}\n */\nexport function condition(dataRow, _ref) {\n let [value] = _ref;\n return stringify(dataRow.value).toLocaleLowerCase(dataRow.meta.locale).startsWith(stringify(value));\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_BEGINS_WITH,\n inputsCount: 1,\n showOperators: true\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { stringify } from \"../../../helpers/mixed.mjs\";\nimport { registerCondition } from \"../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'ends_with';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @param {*} inputValues.\"0\" Value to check if it occurs at the end.\n * @returns {boolean}\n */\nexport function condition(dataRow, _ref) {\n let [value] = _ref;\n return stringify(dataRow.value).toLocaleLowerCase(dataRow.meta.locale).endsWith(stringify(value));\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_ENDS_WITH,\n inputsCount: 1,\n showOperators: true\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { stringify } from \"../../../helpers/mixed.mjs\";\nimport { registerCondition } from \"../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'contains';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @param {*} inputValues.\"0\" A value to check if it occurs in the row's data.\n * @returns {boolean}\n */\nexport function condition(dataRow, _ref) {\n let [value] = _ref;\n return stringify(dataRow.value).toLocaleLowerCase(dataRow.meta.locale).indexOf(stringify(value)) >= 0;\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_CONTAINS,\n inputsCount: 1,\n showOperators: true\n});", "import * as C from \"../../../i18n/constants.mjs\";\nimport { registerCondition, getCondition } from \"../conditionRegisterer.mjs\";\nimport { CONDITION_NAME as CONDITION_CONTAINS } from \"./contains.mjs\";\nexport const CONDITION_NAME = 'not_contains';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @returns {boolean}\n */\nexport function condition(dataRow, inputValues) {\n return !getCondition(CONDITION_CONTAINS, inputValues)(dataRow);\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_NOT_CONTAIN,\n inputsCount: 1,\n showOperators: true\n});", "import moment from 'moment';\nimport * as C from \"../../../../i18n/constants.mjs\";\nimport { registerCondition } from \"../../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'date_tomorrow';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @returns {boolean}\n */\nexport function condition(dataRow) {\n const date = moment(dataRow.value, dataRow.meta.dateFormat);\n if (!date.isValid()) {\n return false;\n }\n return date.isSame(moment().subtract(-1, 'days').startOf('day'), 'd');\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_TOMORROW,\n inputsCount: 0\n});", "import moment from 'moment';\nimport * as C from \"../../../../i18n/constants.mjs\";\nimport { registerCondition } from \"../../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'date_today';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @returns {boolean}\n */\nexport function condition(dataRow) {\n const date = moment(dataRow.value, dataRow.meta.dateFormat);\n if (!date.isValid()) {\n return false;\n }\n return date.isSame(moment().startOf('day'), 'd');\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_TODAY,\n inputsCount: 0\n});", "import moment from 'moment';\nimport * as C from \"../../../../i18n/constants.mjs\";\nimport { registerCondition } from \"../../conditionRegisterer.mjs\";\nexport const CONDITION_NAME = 'date_yesterday';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @returns {boolean}\n */\nexport function condition(dataRow) {\n const date = moment(dataRow.value, dataRow.meta.dateFormat);\n if (!date.isValid()) {\n return false;\n }\n return date.isSame(moment().subtract(1, 'days').startOf('day'), 'd');\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: C.FILTERS_CONDITIONS_YESTERDAY,\n inputsCount: 0\n});", "import \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/es.set.difference.v2.js\";\nimport \"core-js/modules/es.set.intersection.v2.js\";\nimport \"core-js/modules/es.set.is-disjoint-from.v2.js\";\nimport \"core-js/modules/es.set.is-subset-of.v2.js\";\nimport \"core-js/modules/es.set.is-superset-of.v2.js\";\nimport \"core-js/modules/es.set.symmetric-difference.v2.js\";\nimport \"core-js/modules/es.set.union.v2.js\";\nimport { getComparisonFunction } from \"../../helpers/feature.mjs\";\nimport { arrayUnique, arrayEach } from \"../../helpers/array.mjs\";\nconst sortCompare = getComparisonFunction();\n\n/**\n * Comparison function for sorting purposes.\n *\n * @param {*} a The first value to compare.\n * @param {*} b The second value to compare.\n * @returns {number} Returns number from -1 to 1.\n */\nexport function sortComparison(a, b) {\n if (typeof a === 'number' && typeof b === 'number') {\n return a - b;\n }\n return sortCompare(a, b);\n}\n\n/**\n * Convert raw value into visual value.\n *\n * @param {*} value The value to convert.\n * @param {string} defaultEmptyValue Default value for empty cells.\n * @returns {*}\n */\nexport function toVisualValue(value, defaultEmptyValue) {\n let visualValue = value;\n if (visualValue === '') {\n visualValue = `(${defaultEmptyValue})`;\n }\n return visualValue;\n}\nconst SUPPORT_SET_CONSTRUCTOR = new Set([1]).has(1);\nconst SUPPORT_FAST_DEDUPE = SUPPORT_SET_CONSTRUCTOR && typeof Array.from === 'function';\n\n/**\n * Create an array assertion to compare if an element exists in that array (in a more efficient way than .indexOf).\n *\n * @param {Array} initialData Values to compare.\n * @returns {Function}\n */\nexport function createArrayAssertion(initialData) {\n let dataset = initialData;\n if (SUPPORT_SET_CONSTRUCTOR) {\n dataset = new Set(dataset);\n }\n return function (value) {\n let result;\n if (SUPPORT_SET_CONSTRUCTOR) {\n result = dataset.has(value);\n } else {\n /* eslint-disable no-bitwise */\n result = !!~dataset.indexOf(value);\n }\n return result;\n };\n}\n\n/**\n * Convert empty-ish values like null and undefined to an empty string.\n *\n * @param {*} value Value to check.\n * @returns {string}\n */\nexport function toEmptyString(value) {\n return value === null || value === undefined ? '' : value;\n}\n\n/**\n * Unify column values (remove duplicated values and sort them).\n *\n * @param {Array} values An array of values.\n * @returns {Array}\n */\nexport function unifyColumnValues(values) {\n let unifiedValues = values;\n if (SUPPORT_FAST_DEDUPE) {\n unifiedValues = Array.from(new Set(unifiedValues));\n } else {\n unifiedValues = arrayUnique(unifiedValues);\n }\n unifiedValues = unifiedValues.sort((a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a - b;\n }\n if (a === b) {\n return 0;\n }\n return a > b ? 1 : -1;\n });\n return unifiedValues;\n}\n\n/**\n * Intersect 'base' values with 'selected' values and return an array of object.\n *\n * @param {Array} base An array of base values.\n * @param {Array} selected An array of selected values.\n * @param {string} defaultEmptyValue Default value for empty cells.\n * @param {Function} [callback] A callback function which is invoked for every item in an array.\n * @returns {Array}\n */\nexport function intersectValues(base, selected, defaultEmptyValue, callback) {\n const result = [];\n const same = base === selected;\n let selectedItemsAssertion;\n if (!same) {\n selectedItemsAssertion = createArrayAssertion(selected);\n }\n arrayEach(base, value => {\n let checked = false;\n if (same || selectedItemsAssertion(value)) {\n checked = true;\n }\n const item = {\n checked,\n value,\n visualValue: toVisualValue(value, defaultEmptyValue)\n };\n if (callback) {\n callback(item);\n }\n result.push(item);\n });\n return result;\n}", "import { registerCondition } from \"../conditionRegisterer.mjs\";\nimport { createArrayAssertion } from \"../utils.mjs\";\nexport const CONDITION_NAME = 'by_value';\n\n/**\n * @param {object} dataRow The object which holds and describes the single cell value.\n * @param {Array} inputValues An array of values to compare with.\n * @param {Function} inputValues.\"0\" A function to compare row's data.\n * @returns {boolean}\n */\nexport function condition(dataRow, _ref) {\n let [value] = _ref;\n return value(dataRow.value);\n}\nregisterCondition(CONDITION_NAME, condition, {\n name: 'By value',\n inputsCount: 0,\n inputValuesDecorator(_ref2) {\n let [data] = _ref2;\n return [createArrayAssertion(data)];\n },\n showOperators: false\n});", "import \"core-js/modules/es.error.cause.js\";\nexport const operations = {};\n\n/**\n * Get operation closure with pre-bound arguments.\n *\n * @param {string} id Operator `id`.\n * @returns {Function}\n */\nexport function getOperationFunc(id) {\n if (!operations[id]) {\n throw Error(`Operation with id \"${id}\" does not exist.`);\n }\n const func = operations[id].func;\n return function (conditions, value) {\n return func(conditions, value);\n };\n}\n\n/**\n * Return name of operation which is displayed inside UI component, basing on it's `id`.\n *\n * @param {string} id `Id` of operation.\n * @returns {string}\n */\nexport function getOperationName(id) {\n return operations[id].name;\n}\n\n/**\n * Operator registerer.\n *\n * @param {string} id Operation `id`.\n * @param {string} name Operation name which is displayed inside UI component.\n * @param {Function} func Operation function.\n */\nexport function registerOperation(id, name, func) {\n operations[id] = {\n name,\n func\n };\n}", "import * as C from \"../../../i18n/constants.mjs\";\nimport { registerOperation } from \"../logicalOperationRegisterer.mjs\";\nexport const OPERATION_ID = 'conjunction';\nexport const SHORT_NAME_FOR_COMPONENT = C.FILTERS_LABELS_CONJUNCTION;\n// p AND q AND w AND x AND... === TRUE?\n\n/**\n * @param {Array} conditions An array with values to check.\n * @param {*} value The comparable value.\n * @returns {boolean}\n */\nexport function operationResult(conditions, value) {\n return conditions.every(condition => condition.func(value));\n}\nregisterOperation(OPERATION_ID, SHORT_NAME_FOR_COMPONENT, operationResult);", "import * as C from \"../../../i18n/constants.mjs\";\nimport { registerOperation } from \"../logicalOperationRegisterer.mjs\";\nexport const OPERATION_ID = 'disjunction';\nexport const SHORT_NAME_FOR_COMPONENT = C.FILTERS_LABELS_DISJUNCTION;\n// (p OR q OR w OR x OR...) === TRUE?\n\n/**\n * @param {Array} conditions An array with values to check.\n * @param {*} value The comparable value.\n * @returns {boolean}\n */\nexport function operationResult(conditions, value) {\n return conditions.some(condition => condition.func(value));\n}\nregisterOperation(OPERATION_ID, SHORT_NAME_FOR_COMPONENT, operationResult);", "import \"core-js/modules/es.error.cause.js\";\nimport * as C from \"../../../i18n/constants.mjs\";\nimport { registerOperation } from \"../logicalOperationRegisterer.mjs\";\nexport const OPERATION_ID = 'disjunctionWithExtraCondition';\nexport const SHORT_NAME_FOR_COMPONENT = C.FILTERS_LABELS_DISJUNCTION;\n// ((p OR q OR w OR x OR...) AND z) === TRUE?\n\n/**\n * @param {Array} conditions An array with values to check.\n * @param {*} value The comparable value.\n * @returns {boolean}\n */\nexport function operationResult(conditions, value) {\n if (conditions.length < 3) {\n throw Error('Operation doesn\\'t work on less then three conditions.');\n }\n return conditions.slice(0, conditions.length - 1).some(condition => condition.func(value)) && conditions[conditions.length - 1].func(value);\n}\nregisterOperation(OPERATION_ID, SHORT_NAME_FOR_COMPONENT, operationResult);", "import \"core-js/modules/es.array.push.js\";\nimport { clone } from \"../../helpers/object.mjs\";\nimport { arrayEach } from \"../../helpers/array.mjs\";\nimport { SEPARATOR } from \"../contextMenu/predefinedItems/index.mjs\";\nimport { getConditionDescriptor } from \"./conditionRegisterer.mjs\";\nimport { CONDITION_NAME as CONDITION_NONE } from \"./condition/none.mjs\";\nimport { CONDITION_NAME as CONDITION_EMPTY } from \"./condition/empty.mjs\";\nimport { CONDITION_NAME as CONDITION_NOT_EMPTY } from \"./condition/notEmpty.mjs\";\nimport { CONDITION_NAME as CONDITION_EQUAL } from \"./condition/equal.mjs\";\nimport { CONDITION_NAME as CONDITION_NOT_EQUAL } from \"./condition/notEqual.mjs\";\nimport { CONDITION_NAME as CONDITION_GREATER_THAN } from \"./condition/greaterThan.mjs\";\nimport { CONDITION_NAME as CONDITION_GREATER_THAN_OR_EQUAL } from \"./condition/greaterThanOrEqual.mjs\";\nimport { CONDITION_NAME as CONDITION_LESS_THAN } from \"./condition/lessThan.mjs\";\nimport { CONDITION_NAME as CONDITION_LESS_THAN_OR_EQUAL } from \"./condition/lessThanOrEqual.mjs\";\nimport { CONDITION_NAME as CONDITION_BETWEEN } from \"./condition/between.mjs\";\nimport { CONDITION_NAME as CONDITION_NOT_BETWEEN } from \"./condition/notBetween.mjs\";\nimport { CONDITION_NAME as CONDITION_BEGINS_WITH } from \"./condition/beginsWith.mjs\";\nimport { CONDITION_NAME as CONDITION_ENDS_WITH } from \"./condition/endsWith.mjs\";\nimport { CONDITION_NAME as CONDITION_CONTAINS } from \"./condition/contains.mjs\";\nimport { CONDITION_NAME as CONDITION_NOT_CONTAINS } from \"./condition/notContains.mjs\";\nimport { CONDITION_NAME as CONDITION_DATE_BEFORE } from \"./condition/date/before.mjs\";\nimport { CONDITION_NAME as CONDITION_DATE_AFTER } from \"./condition/date/after.mjs\";\nimport { CONDITION_NAME as CONDITION_TOMORROW } from \"./condition/date/tomorrow.mjs\";\nimport { CONDITION_NAME as CONDITION_TODAY } from \"./condition/date/today.mjs\";\nimport { CONDITION_NAME as CONDITION_YESTERDAY } from \"./condition/date/yesterday.mjs\";\nimport { CONDITION_NAME as CONDITION_BY_VALUE } from \"./condition/byValue.mjs\";\nimport { CONDITION_NAME as CONDITION_TRUE } from \"./condition/true.mjs\";\nimport { CONDITION_NAME as CONDITION_FALSE } from \"./condition/false.mjs\";\nimport { OPERATION_ID as OPERATION_AND } from \"./logicalOperations/conjunction.mjs\";\nimport { OPERATION_ID as OPERATION_OR } from \"./logicalOperations/disjunction.mjs\";\nimport { OPERATION_ID as OPERATION_OR_THEN_VARIABLE } from \"./logicalOperations/disjunctionWithExtraCondition.mjs\";\nexport { CONDITION_NONE, CONDITION_EMPTY, CONDITION_NOT_EMPTY, CONDITION_EQUAL, CONDITION_NOT_EQUAL, CONDITION_GREATER_THAN, CONDITION_GREATER_THAN_OR_EQUAL, CONDITION_LESS_THAN, CONDITION_LESS_THAN_OR_EQUAL, CONDITION_BETWEEN, CONDITION_NOT_BETWEEN, CONDITION_BEGINS_WITH, CONDITION_ENDS_WITH, CONDITION_CONTAINS, CONDITION_NOT_CONTAINS, CONDITION_DATE_BEFORE, CONDITION_DATE_AFTER, CONDITION_TOMORROW, CONDITION_TODAY, CONDITION_YESTERDAY, CONDITION_BY_VALUE, CONDITION_TRUE, CONDITION_FALSE, OPERATION_AND, OPERATION_OR, OPERATION_OR_THEN_VARIABLE };\nexport const TYPE_NUMERIC = 'numeric';\nexport const TYPE_TEXT = 'text';\nexport const TYPE_DATE = 'date';\n/**\n * Default types and order for filter conditions.\n *\n * @type {object}\n */\nexport const TYPES = {\n [TYPE_NUMERIC]: [CONDITION_NONE, SEPARATOR, CONDITION_EMPTY, CONDITION_NOT_EMPTY, SEPARATOR, CONDITION_EQUAL, CONDITION_NOT_EQUAL, SEPARATOR, CONDITION_GREATER_THAN, CONDITION_GREATER_THAN_OR_EQUAL, CONDITION_LESS_THAN, CONDITION_LESS_THAN_OR_EQUAL, CONDITION_BETWEEN, CONDITION_NOT_BETWEEN],\n [TYPE_TEXT]: [CONDITION_NONE, SEPARATOR, CONDITION_EMPTY, CONDITION_NOT_EMPTY, SEPARATOR, CONDITION_EQUAL, CONDITION_NOT_EQUAL, SEPARATOR, CONDITION_BEGINS_WITH, CONDITION_ENDS_WITH, SEPARATOR, CONDITION_CONTAINS, CONDITION_NOT_CONTAINS],\n [TYPE_DATE]: [CONDITION_NONE, SEPARATOR, CONDITION_EMPTY, CONDITION_NOT_EMPTY, SEPARATOR, CONDITION_EQUAL, CONDITION_NOT_EQUAL, SEPARATOR, CONDITION_DATE_BEFORE, CONDITION_DATE_AFTER, CONDITION_BETWEEN, SEPARATOR, CONDITION_TOMORROW, CONDITION_TODAY, CONDITION_YESTERDAY]\n};\n\n/**\n * Get options list for conditional filter by data type (e.q: `'text'`, `'numeric'`, `'date'`).\n *\n * @private\n * @param {string} type The data type.\n * @returns {object}\n */\nexport default function getOptionsList(type) {\n const items = [];\n let typeName = type;\n if (!TYPES[typeName]) {\n typeName = TYPE_TEXT;\n }\n arrayEach(TYPES[typeName], typeValue => {\n let option;\n if (typeValue === SEPARATOR) {\n option = {\n name: SEPARATOR\n };\n } else {\n option = clone(getConditionDescriptor(typeValue));\n }\n items.push(option);\n });\n return items;\n}", "import \"core-js/modules/es.error.cause.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { clone, extend, mixin, objectEach } from \"../../../helpers/object.mjs\";\nimport localHooks from \"../../../mixins/localHooks.mjs\";\nimport EventManager from \"../../../eventManager.mjs\";\nimport { addClass } from \"../../../helpers/dom/element.mjs\";\nimport { arrayEach } from \"../../../helpers/array.mjs\";\nimport * as C from \"../../../i18n/constants.mjs\";\nconst STATE_BUILT = 'built';\nconst STATE_BUILDING = 'building';\nconst EVENTS_TO_REGISTER = ['click', 'input', 'keydown', 'keypress', 'keyup', 'focus', 'blur', 'change'];\n\n/**\n * @private\n */\nexport class BaseUI {\n static get DEFAULTS() {\n return clone({\n className: '',\n value: '',\n tagName: 'div',\n children: [],\n wrapIt: true\n });\n }\n\n /**\n * Instance of Handsontable.\n *\n * @type {Core}\n */\n\n constructor(hotInstance, options) {\n _defineProperty(this, \"hot\", void 0);\n /**\n * Instance of EventManager.\n *\n * @type {EventManager}\n */\n _defineProperty(this, \"eventManager\", new EventManager(this));\n /**\n * List of element options.\n *\n * @type {object}\n */\n _defineProperty(this, \"options\", void 0);\n /**\n * Build root DOM element.\n *\n * @type {Element}\n * @private\n */\n _defineProperty(this, \"_element\", void 0);\n /**\n * Flag which determines build state of element.\n *\n * @type {string}\n */\n _defineProperty(this, \"buildState\", void 0);\n this.hot = hotInstance;\n this.options = extend(BaseUI.DEFAULTS, options);\n this._element = this.hot.rootDocument.createElement(this.options.wrapIt ? 'div' : this.options.tagName);\n }\n\n /**\n * Set the element value.\n *\n * @param {*} value Set the component value.\n */\n setValue(value) {\n this.options.value = value;\n this.update();\n }\n\n /**\n * Get the element value.\n *\n * @returns {*}\n */\n getValue() {\n return this.options.value;\n }\n\n /**\n * Get element as a DOM object.\n *\n * @returns {Element}\n */\n get element() {\n if (this.buildState === STATE_BUILDING) {\n return this._element;\n }\n if (this.buildState === STATE_BUILT) {\n this.update();\n return this._element;\n }\n this.buildState = STATE_BUILDING;\n this.build();\n this.buildState = STATE_BUILT;\n return this._element;\n }\n\n /**\n * Check if element was built (built whole DOM structure).\n *\n * @returns {boolean}\n */\n isBuilt() {\n return this.buildState === STATE_BUILT;\n }\n\n /**\n * Translate value if it is possible. It's checked if value belongs to namespace of translated phrases.\n *\n * @param {*} value Value which will may be translated.\n * @returns {*} Translated value if translation was possible, original value otherwise.\n */\n translateIfPossible(value) {\n if (typeof value === 'string' && value.startsWith(C.FILTERS_NAMESPACE)) {\n return this.hot.getTranslatedPhrase(value);\n }\n return value;\n }\n\n /**\n * Build DOM structure.\n */\n build() {\n const registerEvent = (element, eventName) => {\n this.eventManager.addEventListener(element, eventName, event => this.runLocalHooks(eventName, event, this));\n };\n if (!this.buildState) {\n this.buildState = STATE_BUILDING;\n }\n\n // prevents \"hot.unlisten()\" call when clicked\n // (https://github.com/handsontable/handsontable/blob/master/handsontable/src/tableView.js#L317-L321)\n this._element.setAttribute('data-hot-input', true);\n if (this.options.tabIndex !== undefined) {\n this._element.setAttribute('tabindex', this.options.tabIndex);\n }\n if (this.options.role !== undefined) {\n this._element.setAttribute('role', this.options.role);\n }\n if (this.options.className) {\n addClass(this._element, this.options.className);\n }\n if (this.options.children.length) {\n arrayEach(this.options.children, element => this._element.appendChild(element.element));\n } else if (this.options.wrapIt) {\n const element = this.hot.rootDocument.createElement(this.options.tagName);\n\n // prevents \"hot.unlisten()\" call when clicked\n // (https://github.com/handsontable/handsontable/blob/master/handsontable/src/tableView.js#L317-L321)\n element.setAttribute('data-hot-input', true);\n objectEach(this.options, (value, key) => {\n if (element[key] !== undefined && key !== 'className' && key !== 'tagName' && key !== 'children') {\n element[key] = this.translateIfPossible(value);\n }\n });\n this._element.appendChild(element);\n arrayEach(EVENTS_TO_REGISTER, eventName => registerEvent(element, eventName));\n } else {\n arrayEach(EVENTS_TO_REGISTER, eventName => registerEvent(this._element, eventName));\n }\n }\n\n /**\n * Update DOM structure.\n */\n update() {}\n\n /**\n * Reset to initial state.\n */\n reset() {\n this.options.value = '';\n this.update();\n }\n\n /**\n * Show element.\n */\n show() {\n this.element.style.display = '';\n }\n\n /**\n * Hide element.\n */\n hide() {\n this.element.style.display = 'none';\n }\n\n /**\n * Focus element.\n */\n focus() {}\n destroy() {\n this.eventManager.destroy();\n this.eventManager = null;\n this.hot = null;\n if (this._element.parentNode) {\n this._element.parentNode.removeChild(this._element);\n }\n this._element = null;\n }\n}\nmixin(BaseUI, localHooks);", "import \"core-js/modules/es.error.cause.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { addClass } from \"../../../helpers/dom/element.mjs\";\nimport { clone, extend } from \"../../../helpers/object.mjs\";\nimport { BaseUI } from \"./_base.mjs\";\n/**\n * @private\n * @class InputUI\n */\nvar _input = /*#__PURE__*/new WeakMap();\nvar _InputUI_brand = /*#__PURE__*/new WeakSet();\nexport class InputUI extends BaseUI {\n static get DEFAULTS() {\n return clone({\n placeholder: '',\n type: 'text',\n tagName: 'input',\n tabIndex: -1\n });\n }\n\n /**\n * The reference to the input element.\n *\n * @type {HTMLInputElement}\n */\n\n constructor(hotInstance, options) {\n super(hotInstance, extend(InputUI.DEFAULTS, options));\n /**\n * OnKeyup listener.\n *\n * @param {Event} event The mouse event object.\n */\n _classPrivateMethodInitSpec(this, _InputUI_brand);\n _classPrivateFieldInitSpec(this, _input, void 0);\n this.registerHooks();\n }\n\n /**\n * Register all necessary hooks.\n */\n registerHooks() {\n this.addLocalHook('keyup', event => _assertClassBrand(_InputUI_brand, this, _onKeyup).call(this, event));\n }\n\n /**\n * Build DOM structure.\n */\n build() {\n super.build();\n const icon = this.hot.rootDocument.createElement('div');\n _classPrivateFieldSet(_input, this, this._element.firstChild);\n addClass(this._element, 'htUIInput');\n addClass(icon, 'htUIInputIcon');\n this._element.appendChild(icon);\n this.update();\n }\n\n /**\n * Update element.\n */\n update() {\n if (!this.isBuilt()) {\n return;\n }\n _classPrivateFieldGet(_input, this).type = this.options.type;\n _classPrivateFieldGet(_input, this).placeholder = this.translateIfPossible(this.options.placeholder);\n _classPrivateFieldGet(_input, this).value = this.translateIfPossible(this.options.value);\n }\n\n /**\n * Focus element.\n */\n focus() {\n if (this.isBuilt()) {\n _classPrivateFieldGet(_input, this).focus();\n }\n }\n}\nfunction _onKeyup(event) {\n this.options.value = event.target.value;\n}", "import \"core-js/modules/es.error.cause.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { Menu } from \"../../../plugins/contextMenu/menu/index.mjs\";\nimport { clone, extend } from \"../../../helpers/object.mjs\";\nimport { arrayEach } from \"../../../helpers/array.mjs\";\nimport { setAttribute } from \"../../../helpers/dom/element.mjs\";\nimport * as C from \"../../../i18n/constants.mjs\";\nimport { SEPARATOR } from \"../../../plugins/contextMenu/predefinedItems/index.mjs\";\nimport { BaseUI } from \"./_base.mjs\";\nimport { A11Y_HIDDEN, A11Y_LISTBOX } from \"../../../helpers/a11y.mjs\";\n/**\n * @private\n * @class SelectUI\n */\nvar _menu = /*#__PURE__*/new WeakMap();\nvar _items = /*#__PURE__*/new WeakMap();\nvar _caption = /*#__PURE__*/new WeakMap();\nvar _captionElement = /*#__PURE__*/new WeakMap();\nvar _dropdown = /*#__PURE__*/new WeakMap();\nvar _SelectUI_brand = /*#__PURE__*/new WeakSet();\nexport class SelectUI extends BaseUI {\n static get DEFAULTS() {\n return clone({\n className: 'htUISelect',\n wrapIt: false,\n tabIndex: -1\n });\n }\n\n /**\n * Instance of {@link Menu}.\n *\n * @type {Menu}\n */\n\n constructor(hotInstance, options) {\n super(hotInstance, extend(SelectUI.DEFAULTS, options));\n /**\n * On menu selected listener.\n *\n * @param {object} command Selected item.\n */\n _classPrivateMethodInitSpec(this, _SelectUI_brand);\n _classPrivateFieldInitSpec(this, _menu, null);\n /**\n * List of available select options.\n *\n * @type {Array}\n */\n _classPrivateFieldInitSpec(this, _items, []);\n /**\n * The reference to the BaseUI instance of the caption.\n *\n * @type {BaseUI}\n */\n _classPrivateFieldInitSpec(this, _caption, void 0);\n /**\n * The reference to the table caption element.\n *\n * @type {HTMLTableCaptionElement}\n */\n _classPrivateFieldInitSpec(this, _captionElement, void 0);\n /**\n * The reference to the BaseUI instance of the dropdown.\n *\n * @type {BaseUI}\n */\n _classPrivateFieldInitSpec(this, _dropdown, void 0);\n this.registerHooks();\n }\n\n /**\n * Gets the instance of the Menu.\n *\n * @returns {Menu}\n */\n getMenu() {\n return _classPrivateFieldGet(_menu, this);\n }\n\n /**\n * Register all necessary hooks.\n */\n registerHooks() {\n this.addLocalHook('click', () => _assertClassBrand(_SelectUI_brand, this, _onClick).call(this));\n }\n\n /**\n * Set options which can be selected in the list.\n *\n * @param {Array} items Array of objects with required keys `key` and `name`.\n */\n setItems(items) {\n _classPrivateFieldSet(_items, this, this.translateNames(items));\n if (_classPrivateFieldGet(_menu, this)) {\n _classPrivateFieldGet(_menu, this).setMenuItems(_classPrivateFieldGet(_items, this));\n }\n }\n\n /**\n * Translate names of menu items.\n *\n * @param {Array} items Array of objects with required keys `key` and `name`.\n * @returns {Array} Items with translated `name` keys.\n */\n translateNames(items) {\n arrayEach(items, item => {\n item.name = this.translateIfPossible(item.name);\n });\n return items;\n }\n\n /**\n * Build DOM structure.\n */\n build() {\n super.build();\n _classPrivateFieldSet(_menu, this, new Menu(this.hot, {\n className: 'htSelectUI htFiltersConditionsMenu',\n keepInViewport: false,\n standalone: true,\n container: this.options.menuContainer\n }));\n _classPrivateFieldGet(_menu, this).setMenuItems(_classPrivateFieldGet(_items, this));\n const caption = new BaseUI(this.hot, {\n className: 'htUISelectCaption'\n });\n const dropdown = new BaseUI(this.hot, {\n className: 'htUISelectDropdown'\n });\n _classPrivateFieldSet(_caption, this, caption);\n _classPrivateFieldSet(_captionElement, this, caption.element);\n _classPrivateFieldSet(_dropdown, this, dropdown);\n if (this.hot.getSettings().ariaTags) {\n setAttribute(dropdown.element, [A11Y_HIDDEN()]);\n setAttribute(this._element, [A11Y_LISTBOX()]);\n }\n arrayEach([caption, dropdown], element => this._element.appendChild(element.element));\n _classPrivateFieldGet(_menu, this).addLocalHook('select', command => _assertClassBrand(_SelectUI_brand, this, _onMenuSelect).call(this, command));\n _classPrivateFieldGet(_menu, this).addLocalHook('afterClose', () => _assertClassBrand(_SelectUI_brand, this, _onMenuClosed).call(this));\n this.update();\n }\n\n /**\n * Update DOM structure.\n */\n update() {\n if (!this.isBuilt()) {\n return;\n }\n let conditionName;\n if (this.options.value) {\n conditionName = this.options.value.name;\n } else {\n conditionName = _classPrivateFieldGet(_menu, this).hot.getTranslatedPhrase(C.FILTERS_CONDITIONS_NONE);\n }\n _classPrivateFieldGet(_captionElement, this).textContent = conditionName;\n super.update();\n }\n\n /**\n * Open select dropdown menu with available options.\n */\n openOptions() {\n const rect = this.element.getBoundingClientRect();\n if (_classPrivateFieldGet(_menu, this)) {\n _classPrivateFieldGet(_menu, this).open();\n _classPrivateFieldGet(_menu, this).setPosition({\n left: this.hot.isLtr() ? rect.left - 5 : rect.left - 31,\n top: rect.top - 1,\n width: rect.width,\n height: rect.height\n });\n _classPrivateFieldGet(_menu, this).getNavigator().toFirstItem();\n _classPrivateFieldGet(_menu, this).getKeyboardShortcutsCtrl().addCustomShortcuts([{\n keys: [['Tab'], ['Shift', 'Tab']],\n callback: event => {\n this.closeOptions();\n this.runLocalHooks('tabKeydown', event);\n }\n }, {\n keys: [['Control/Meta', 'A']],\n callback: () => false\n }]);\n }\n }\n\n /**\n * Close select dropdown menu.\n */\n closeOptions() {\n if (_classPrivateFieldGet(_menu, this)) {\n _classPrivateFieldGet(_menu, this).close();\n }\n }\n\n /**\n * Focus element.\n */\n focus() {\n if (this.isBuilt()) {\n this.element.focus();\n }\n }\n /**\n * Destroy instance.\n */\n destroy() {\n if (_classPrivateFieldGet(_menu, this)) {\n _classPrivateFieldGet(_menu, this).destroy();\n _classPrivateFieldSet(_menu, this, null);\n }\n if (_classPrivateFieldGet(_caption, this)) {\n _classPrivateFieldGet(_caption, this).destroy();\n }\n if (_classPrivateFieldGet(_dropdown, this)) {\n _classPrivateFieldGet(_dropdown, this).destroy();\n }\n super.destroy();\n }\n}\nfunction _onMenuSelect(command) {\n if (command.name !== SEPARATOR) {\n this.options.value = command;\n this.update();\n this.runLocalHooks('select', this.options.value);\n }\n}\n/**\n * On menu closed listener.\n */\nfunction _onMenuClosed() {\n this.runLocalHooks('afterClose');\n}\n/**\n * On element click listener.\n *\n * @private\n */\nfunction _onClick() {\n this.openOptions();\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { addClass } from \"../../../helpers/dom/element.mjs\";\nimport { stopImmediatePropagation } from \"../../../helpers/dom/event.mjs\";\nimport { arrayEach } from \"../../../helpers/array.mjs\";\nimport { isKey } from \"../../../helpers/unicode.mjs\";\nimport { clone } from \"../../../helpers/object.mjs\";\nimport * as C from \"../../../i18n/constants.mjs\";\nimport { BaseComponent } from \"./_base.mjs\";\nimport getOptionsList, { CONDITION_NONE } from \"../constants.mjs\";\nimport { InputUI } from \"../ui/input.mjs\";\nimport { SelectUI } from \"../ui/select.mjs\";\nimport { getConditionDescriptor } from \"../conditionRegisterer.mjs\";\n/**\n * @private\n * @class ConditionComponent\n */\nvar _ConditionComponent_brand = /*#__PURE__*/new WeakSet();\nexport class ConditionComponent extends BaseComponent {\n constructor(hotInstance, options) {\n super(hotInstance, {\n id: options.id,\n stateless: false\n });\n /**\n * On condition select listener.\n *\n * @param {object} command Menu item object (command).\n */\n _classPrivateMethodInitSpec(this, _ConditionComponent_brand);\n /**\n * The name of the component.\n *\n * @type {string}\n */\n _defineProperty(this, \"name\", '');\n /**\n * @type {boolean}\n */\n _defineProperty(this, \"addSeparator\", false);\n this.name = options.name;\n this.addSeparator = options.addSeparator;\n this.elements.push(new SelectUI(this.hot, {\n menuContainer: options.menuContainer\n }));\n this.elements.push(new InputUI(this.hot, {\n placeholder: C.FILTERS_BUTTONS_PLACEHOLDER_VALUE\n }));\n this.elements.push(new InputUI(this.hot, {\n placeholder: C.FILTERS_BUTTONS_PLACEHOLDER_SECOND_VALUE\n }));\n this.registerHooks();\n }\n\n /**\n * Register all necessary hooks.\n *\n * @private\n */\n registerHooks() {\n this.getSelectElement().addLocalHook('select', command => _assertClassBrand(_ConditionComponent_brand, this, _onConditionSelect).call(this, command)).addLocalHook('afterClose', () => this.runLocalHooks('afterClose')).addLocalHook('tabKeydown', event => this.runLocalHooks('selectTabKeydown', event));\n arrayEach(this.getInputElements(), input => {\n input.addLocalHook('keydown', event => _assertClassBrand(_ConditionComponent_brand, this, _onInputKeyDown).call(this, event));\n });\n }\n\n /**\n * Set state of the component.\n *\n * @param {object} value State to restore.\n */\n setState(value) {\n this.reset();\n if (!value) {\n return;\n }\n const copyOfCommand = clone(value.command);\n if (copyOfCommand.name.startsWith(C.FILTERS_CONDITIONS_NAMESPACE)) {\n copyOfCommand.name = this.hot.getTranslatedPhrase(copyOfCommand.name);\n }\n this.getSelectElement().setValue(copyOfCommand);\n arrayEach(value.args, (arg, index) => {\n if (index > copyOfCommand.inputsCount - 1) {\n return false;\n }\n const element = this.getInputElement(index);\n element.setValue(arg);\n element[copyOfCommand.inputsCount > index ? 'show' : 'hide']();\n if (!index) {\n this.hot._registerTimeout(() => element.focus(), 10);\n }\n });\n }\n\n /**\n * Export state of the component (get selected filter and filter arguments).\n *\n * @returns {object} Returns object where `command` key keeps used condition filter and `args` key its arguments.\n */\n getState() {\n const command = this.getSelectElement().getValue() || getConditionDescriptor(CONDITION_NONE);\n const args = [];\n arrayEach(this.getInputElements(), (element, index) => {\n if (command.inputsCount > index) {\n args.push(element.getValue());\n }\n });\n return {\n command,\n args\n };\n }\n\n /**\n * Update state of component.\n *\n * @param {object} condition The condition object.\n * @param {object} condition.command The command object with condition name as `key` property.\n * @param {Array} condition.args An array of values to compare.\n * @param {number} column Physical column index.\n */\n updateState(condition, column) {\n const command = condition ? getConditionDescriptor(condition.name) : getConditionDescriptor(CONDITION_NONE);\n this.state.setValueAtIndex(column, {\n command,\n args: condition ? condition.args : []\n });\n if (!condition) {\n arrayEach(this.getInputElements(), element => element.setValue(null));\n }\n }\n\n /**\n * Get select element.\n *\n * @returns {SelectUI}\n */\n getSelectElement() {\n return this.elements.filter(element => element instanceof SelectUI)[0];\n }\n\n /**\n * Get input element.\n *\n * @param {number} index Index an array of elements.\n * @returns {InputUI}\n */\n getInputElement() {\n let index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n return this.getInputElements()[index];\n }\n\n /**\n * Get input elements.\n *\n * @returns {Array}\n */\n getInputElements() {\n return this.elements.filter(element => element instanceof InputUI);\n }\n\n /**\n * Get menu object descriptor.\n *\n * @returns {object}\n */\n getMenuItemDescriptor() {\n return {\n key: this.id,\n name: this.name,\n isCommand: false,\n disableSelection: true,\n hidden: () => this.isHidden(),\n renderer: (hot, wrapper, row, col, prop, value) => {\n addClass(wrapper.parentNode, 'htFiltersMenuCondition');\n if (this.addSeparator) {\n addClass(wrapper.parentNode, 'border');\n }\n const label = this.hot.rootDocument.createElement('div');\n addClass(label, 'htFiltersMenuLabel');\n label.textContent = value;\n wrapper.appendChild(label);\n\n // The SelectUI should not extend the menu width (it should adjust to the menu item width only).\n // That's why it's skipped from rendering when the GhostTable tries to render it.\n if (!wrapper.parentElement.hasAttribute('ghost-table')) {\n arrayEach(this.elements, ui => wrapper.appendChild(ui.element));\n }\n return wrapper;\n }\n };\n }\n\n /**\n * Reset elements to their initial state.\n */\n reset() {\n const selectedColumn = this.hot.getPlugin('filters').getSelectedColumn();\n let items = [getConditionDescriptor(CONDITION_NONE)];\n if (selectedColumn !== null) {\n const {\n visualIndex\n } = selectedColumn;\n items = getOptionsList(this.hot.getDataType(0, visualIndex, this.hot.countRows(), visualIndex));\n }\n arrayEach(this.getInputElements(), element => element.hide());\n this.getSelectElement().setItems(items);\n super.reset();\n // Select element as default 'None'\n this.getSelectElement().setValue(items[0]);\n }\n}\nfunction _onConditionSelect(command) {\n arrayEach(this.getInputElements(), (element, index) => {\n element[command.inputsCount > index ? 'show' : 'hide']();\n if (index === 0) {\n this.hot._registerTimeout(() => element.focus(), 10);\n }\n });\n this.runLocalHooks('change', command);\n}\n/**\n * Key down listener.\n *\n * @param {Event} event The DOM event object.\n */\nfunction _onInputKeyDown(event) {\n if (isKey(event.keyCode, 'ESCAPE')) {\n this.runLocalHooks('cancel');\n stopImmediatePropagation(event);\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { clone, extend } from \"../../../helpers/object.mjs\";\nimport { BaseUI } from \"./_base.mjs\";\n/**\n * @private\n * @class RadioInputUI\n */\nvar _input = /*#__PURE__*/new WeakMap();\nvar _label = /*#__PURE__*/new WeakMap();\nexport class RadioInputUI extends BaseUI {\n static get DEFAULTS() {\n return clone({\n type: 'radio',\n tagName: 'input',\n className: 'htUIRadio',\n label: {}\n });\n }\n\n /**\n * The reference to the input element.\n *\n * @type {HTMLInputElement}\n */\n\n constructor(hotInstance, options) {\n super(hotInstance, extend(RadioInputUI.DEFAULTS, options));\n _classPrivateFieldInitSpec(this, _input, void 0);\n /**\n * The reference to the label element.\n *\n * @type {HTMLLabelElement}\n */\n _classPrivateFieldInitSpec(this, _label, void 0);\n }\n\n /**\n * Build DOM structure.\n */\n build() {\n super.build();\n const label = this.hot.rootDocument.createElement('label');\n label.textContent = this.translateIfPossible(this.options.label.textContent);\n label.htmlFor = this.translateIfPossible(this.options.label.htmlFor);\n _classPrivateFieldSet(_label, this, label);\n _classPrivateFieldSet(_input, this, this._element.firstChild);\n _classPrivateFieldGet(_input, this).checked = this.options.checked;\n this._element.appendChild(label);\n this.update();\n }\n\n /**\n * Update element.\n */\n update() {\n if (!this.isBuilt()) {\n return;\n }\n _classPrivateFieldGet(_label, this).textContent = this.translateIfPossible(this.options.label.textContent);\n }\n\n /**\n * Check if radio button is checked.\n *\n * @returns {boolean}\n */\n isChecked() {\n return this.isBuilt() ? _classPrivateFieldGet(_input, this).checked : false;\n }\n\n /**\n * Set input checked attribute.\n *\n * @param {boolean} value Set the component state.\n */\n setChecked() {\n let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n if (this.isBuilt()) {\n _classPrivateFieldGet(_input, this).checked = value;\n }\n }\n\n /**\n * Focus element.\n */\n focus() {\n if (this.isBuilt()) {\n _classPrivateFieldGet(_input, this).focus();\n }\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { addClass } from \"../../../helpers/dom/element.mjs\";\nimport { arrayEach } from \"../../../helpers/array.mjs\";\nimport { toSingleLine } from \"../../../helpers/templateLiteralTag.mjs\";\nimport { BaseComponent } from \"./_base.mjs\";\nimport { getOperationName } from \"../logicalOperationRegisterer.mjs\";\nimport { OPERATION_ID as OPERATION_AND } from \"../logicalOperations/conjunction.mjs\";\nimport { OPERATION_ID as OPERATION_OR } from \"../logicalOperations/disjunction.mjs\";\nimport { OPERATION_ID as OPERATION_OR_THEN_VARIABLE } from \"../logicalOperations/disjunctionWithExtraCondition.mjs\";\nimport { RadioInputUI } from \"../ui/radioInput.mjs\";\nconst SELECTED_AT_START_ELEMENT_INDEX = 0;\n\n/**\n * @private\n * @class OperatorsComponent\n */\nvar _OperatorsComponent_brand = /*#__PURE__*/new WeakSet();\nexport class OperatorsComponent extends BaseComponent {\n constructor(hotInstance, options) {\n super(hotInstance, {\n id: options.id,\n stateless: false\n });\n /**\n * OnChange listener.\n *\n * @param {Event} event The DOM event object.\n */\n _classPrivateMethodInitSpec(this, _OperatorsComponent_brand);\n /**\n * The name of the component.\n *\n * @type {string}\n */\n _defineProperty(this, \"name\", '');\n this.name = options.name;\n this.buildOperatorsElement();\n }\n\n /**\n * Get menu object descriptor.\n *\n * @returns {object}\n */\n getMenuItemDescriptor() {\n return {\n key: this.id,\n name: this.name,\n isCommand: false,\n disableSelection: true,\n hidden: () => this.isHidden(),\n renderer: (hot, wrapper) => {\n addClass(wrapper.parentNode, 'htFiltersMenuOperators');\n arrayEach(this.elements, ui => wrapper.appendChild(ui.element));\n return wrapper;\n }\n };\n }\n\n /**\n * Add RadioInputUI elements to component.\n *\n * @private\n */\n buildOperatorsElement() {\n const operationKeys = [OPERATION_AND, OPERATION_OR];\n arrayEach(operationKeys, operation => {\n const radioInput = new RadioInputUI(this.hot, {\n name: 'operator',\n label: {\n htmlFor: operation,\n textContent: getOperationName(operation)\n },\n value: operation,\n checked: operation === operationKeys[SELECTED_AT_START_ELEMENT_INDEX],\n id: operation\n });\n radioInput.addLocalHook('change', event => _assertClassBrand(_OperatorsComponent_brand, this, _onRadioInputChange).call(this, event));\n this.elements.push(radioInput);\n });\n }\n\n /**\n * Set state of operators component to check radio input at specific `index`.\n *\n * @param {number} searchedIndex Index of radio input to check.\n */\n setChecked(searchedIndex) {\n if (this.elements.length < searchedIndex) {\n throw Error(toSingleLine`Radio button with index ${searchedIndex} doesn't exist.`);\n }\n arrayEach(this.elements, (element, index) => {\n element.setChecked(index === searchedIndex);\n });\n }\n\n /**\n * Get `id` of active operator.\n *\n * @returns {string}\n */\n getActiveOperationId() {\n const operationElement = this.elements.find(element => element instanceof RadioInputUI && element.isChecked());\n if (operationElement) {\n return operationElement.getValue();\n }\n return OPERATION_AND;\n }\n\n /**\n * Export state of the component (get selected operator).\n *\n * @returns {string} Returns `id` of selected operator.\n */\n getState() {\n return this.getActiveOperationId();\n }\n\n /**\n * Set state of the component.\n *\n * @param {object} value State to restore.\n */\n setState(value) {\n this.reset();\n if (value && this.getActiveOperationId() !== value) {\n arrayEach(this.elements, element => {\n element.setChecked(element.getValue() === value);\n });\n }\n }\n\n /**\n * Update state of component.\n *\n * @param {string} [operationId='conjunction'] Id of selected operation.\n * @param {number} column Physical column index.\n */\n updateState() {\n let operationId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : OPERATION_AND;\n let column = arguments.length > 1 ? arguments[1] : undefined;\n let selectedOperationId = operationId;\n if (selectedOperationId === OPERATION_OR_THEN_VARIABLE) {\n selectedOperationId = OPERATION_OR;\n }\n this.state.setValueAtIndex(column, selectedOperationId);\n }\n\n /**\n * Reset elements to their initial state.\n */\n reset() {\n this.setChecked(SELECTED_AT_START_ELEMENT_INDEX);\n }\n}\nfunction _onRadioInputChange(event) {\n this.setState(event.target.value);\n}", "import \"core-js/modules/es.error.cause.js\";\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { clone, extend } from \"../../../helpers/object.mjs\";\nimport { BaseUI } from \"./_base.mjs\";\n/**\n * @private\n * @class LinkUI\n */\nvar _link = /*#__PURE__*/new WeakMap();\nexport class LinkUI extends BaseUI {\n static get DEFAULTS() {\n return clone({\n href: '#',\n tagName: 'a',\n tabIndex: -1,\n role: 'button'\n });\n }\n\n /**\n * The reference to the link element.\n *\n * @type {HTMLLinkElement}\n */\n\n constructor(hotInstance, options) {\n super(hotInstance, extend(LinkUI.DEFAULTS, options));\n _classPrivateFieldInitSpec(this, _link, void 0);\n }\n\n /**\n * Build DOM structure.\n */\n build() {\n super.build();\n _classPrivateFieldSet(_link, this, this._element.firstChild);\n }\n\n /**\n * Update element.\n */\n update() {\n if (!this.isBuilt()) {\n return;\n }\n _classPrivateFieldGet(_link, this).textContent = this.translateIfPossible(this.options.textContent);\n }\n\n /**\n * Focus element.\n */\n focus() {\n if (this.isBuilt()) {\n _classPrivateFieldGet(_link, this).focus();\n }\n }\n\n /**\n * Activate the element.\n */\n activate() {\n _classPrivateFieldGet(_link, this).click();\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { addClass, getScrollbarWidth } from \"../../../helpers/dom/element.mjs\";\nimport { clone, extend } from \"../../../helpers/object.mjs\";\nimport { isKey } from \"../../../helpers/unicode.mjs\";\nimport { partial } from \"../../../helpers/function.mjs\";\nimport { dataRowToChangesArray } from \"../../../helpers/data.mjs\";\nimport * as C from \"../../../i18n/constants.mjs\";\nimport { stopImmediatePropagation } from \"../../../helpers/dom/event.mjs\";\nimport { BaseUI } from \"./_base.mjs\";\nimport { InputUI } from \"./input.mjs\";\nimport { LinkUI } from \"./link.mjs\";\nimport { createArrayAssertion } from \"../utils.mjs\";\nconst SHORTCUTS_GROUP = 'multipleSelect.itemBox';\n\n/**\n * @private\n * @class MultipleSelectUI\n */\nvar _items = /*#__PURE__*/new WeakMap();\nvar _itemsBox = /*#__PURE__*/new WeakMap();\nvar _locale = /*#__PURE__*/new WeakMap();\nvar _searchInput = /*#__PURE__*/new WeakMap();\nvar _selectAllUI = /*#__PURE__*/new WeakMap();\nvar _clearAllUI = /*#__PURE__*/new WeakMap();\nvar _MultipleSelectUI_brand = /*#__PURE__*/new WeakSet();\nexport class MultipleSelectUI extends BaseUI {\n static get DEFAULTS() {\n return clone({\n className: 'htUIMultipleSelect',\n value: []\n });\n }\n\n /**\n * List of available select options.\n *\n * @type {Array}\n */\n\n constructor(hotInstance, options) {\n super(hotInstance, extend(MultipleSelectUI.DEFAULTS, options));\n /**\n * 'input' event listener for input element.\n *\n * @param {Event} event DOM event.\n */\n _classPrivateMethodInitSpec(this, _MultipleSelectUI_brand);\n _classPrivateFieldInitSpec(this, _items, []);\n /**\n * Handsontable instance used as items list element.\n *\n * @type {Handsontable}\n */\n _classPrivateFieldInitSpec(this, _itemsBox, void 0);\n /**\n * A locale for the component used to compare filtered values.\n *\n * @type {string}\n */\n _classPrivateFieldInitSpec(this, _locale, void 0);\n /**\n * Input element.\n *\n * @type {InputUI}\n */\n _classPrivateFieldInitSpec(this, _searchInput, void 0);\n /**\n * \"Select all\" UI element.\n *\n * @type {LinkUI}\n */\n _classPrivateFieldInitSpec(this, _selectAllUI, void 0);\n /**\n * \"Clear\" UI element.\n *\n * @type {LinkUI}\n */\n _classPrivateFieldInitSpec(this, _clearAllUI, void 0);\n _classPrivateFieldSet(_searchInput, this, new InputUI(this.hot, {\n placeholder: C.FILTERS_BUTTONS_PLACEHOLDER_SEARCH,\n className: 'htUIMultipleSelectSearch'\n }));\n _classPrivateFieldSet(_selectAllUI, this, new LinkUI(this.hot, {\n textContent: C.FILTERS_BUTTONS_SELECT_ALL,\n className: 'htUISelectAll'\n }));\n _classPrivateFieldSet(_clearAllUI, this, new LinkUI(this.hot, {\n textContent: C.FILTERS_BUTTONS_CLEAR,\n className: 'htUIClearAll'\n }));\n this.registerHooks();\n }\n\n /**\n * Gets the instance of the internal Handsontable that acts here as a listbox component.\n *\n * @returns {Handsontable}\n */\n getItemsBox() {\n return _classPrivateFieldGet(_itemsBox, this);\n }\n\n /**\n * Register all necessary hooks.\n */\n registerHooks() {\n _classPrivateFieldGet(_searchInput, this).addLocalHook('keydown', event => _assertClassBrand(_MultipleSelectUI_brand, this, _onInputKeyDown).call(this, event));\n _classPrivateFieldGet(_searchInput, this).addLocalHook('input', event => _assertClassBrand(_MultipleSelectUI_brand, this, _onInput).call(this, event));\n _classPrivateFieldGet(_selectAllUI, this).addLocalHook('click', event => _assertClassBrand(_MultipleSelectUI_brand, this, _onSelectAllClick).call(this, event));\n _classPrivateFieldGet(_clearAllUI, this).addLocalHook('click', event => _assertClassBrand(_MultipleSelectUI_brand, this, _onClearAllClick).call(this, event));\n }\n\n /**\n * Set available options.\n *\n * @param {Array} items Array of objects with `checked` and `label` property.\n */\n setItems(items) {\n var _classPrivateFieldGet2;\n _classPrivateFieldSet(_items, this, items);\n (_classPrivateFieldGet2 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.loadData(_classPrivateFieldGet(_items, this));\n }\n\n /**\n * Set a locale for the component.\n *\n * @param {string} locale Locale used for filter actions performed on data, ie. `en-US`.\n */\n setLocale(locale) {\n _classPrivateFieldSet(_locale, this, locale);\n }\n\n /**\n * Get a locale for the component.\n *\n * @returns {string}\n */\n getLocale() {\n return _classPrivateFieldGet(_locale, this);\n }\n\n /**\n * Get all available options.\n *\n * @returns {Array}\n */\n getItems() {\n return [..._classPrivateFieldGet(_items, this)];\n }\n\n /**\n * Get element value.\n *\n * @returns {Array} Array of selected values.\n */\n getValue() {\n return itemsToValue(_classPrivateFieldGet(_items, this));\n }\n\n /**\n * Gets the instance of the search input element.\n *\n * @returns {InputUI}\n */\n getSearchInputElement() {\n return _classPrivateFieldGet(_searchInput, this);\n }\n\n /**\n * Gets the instance of the \"select all\" link element.\n *\n * @returns {LinkUI}\n */\n getSelectAllElement() {\n return _classPrivateFieldGet(_selectAllUI, this);\n }\n\n /**\n * Gets the instance of the \"clear\" link element.\n *\n * @returns {LinkUI}\n */\n getClearAllElement() {\n return _classPrivateFieldGet(_clearAllUI, this);\n }\n\n /**\n * Check if all values listed in element are selected.\n *\n * @returns {boolean}\n */\n isSelectedAllValues() {\n return _classPrivateFieldGet(_items, this).length === this.getValue().length;\n }\n\n /**\n * Build DOM structure.\n */\n build() {\n super.build();\n const {\n rootDocument\n } = this.hot;\n const itemsBoxWrapper = rootDocument.createElement('div');\n const selectionControl = new BaseUI(this.hot, {\n className: 'htUISelectionControls',\n children: [_classPrivateFieldGet(_selectAllUI, this), _classPrivateFieldGet(_clearAllUI, this)]\n });\n this._element.appendChild(_classPrivateFieldGet(_searchInput, this).element);\n this._element.appendChild(selectionControl.element);\n this._element.appendChild(itemsBoxWrapper);\n const hotInitializer = wrapper => {\n var _classPrivateFieldGet3;\n if (!this._element) {\n return;\n }\n (_classPrivateFieldGet3 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.destroy();\n addClass(wrapper, 'htUIMultipleSelectHot');\n\n // Constructs and initializes a new Handsontable instance\n _classPrivateFieldSet(_itemsBox, this, new this.hot.constructor(wrapper, {\n data: _classPrivateFieldGet(_items, this),\n columns: [{\n data: 'checked',\n type: 'checkbox',\n label: {\n property: 'visualValue',\n position: 'after'\n }\n }],\n beforeRenderer: (TD, row, col, prop, value, cellProperties) => {\n TD.title = cellProperties.instance.getDataAtRowProp(row, cellProperties.label.property);\n },\n afterListen: () => {\n this.runLocalHooks('focus', this);\n },\n beforeOnCellMouseUp: () => {\n _classPrivateFieldGet(_itemsBox, this).listen();\n },\n colWidths: () => _classPrivateFieldGet(_itemsBox, this).container.scrollWidth - getScrollbarWidth(rootDocument),\n maxCols: 1,\n autoWrapCol: true,\n height: 110,\n copyPaste: false,\n disableVisualSelection: 'area',\n fillHandle: false,\n fragmentSelection: 'cell',\n tabMoves: {\n row: 1,\n col: 0\n },\n layoutDirection: this.hot.isRtl() ? 'rtl' : 'ltr'\n }));\n _classPrivateFieldGet(_itemsBox, this).init();\n const shortcutManager = _classPrivateFieldGet(_itemsBox, this).getShortcutManager();\n const gridContext = shortcutManager.getContext('grid');\n gridContext.removeShortcutsByKeys(['Tab']);\n gridContext.removeShortcutsByKeys(['Shift', 'Tab']);\n gridContext.addShortcut({\n keys: [['Escape']],\n callback: event => {\n this.runLocalHooks('keydown', event, this);\n },\n group: SHORTCUTS_GROUP\n });\n gridContext.addShortcut({\n keys: [['Tab'], ['Shift', 'Tab']],\n callback: event => {\n _classPrivateFieldGet(_itemsBox, this).deselectCell();\n this.runLocalHooks('keydown', event, this);\n this.runLocalHooks('listTabKeydown', event, this);\n },\n group: SHORTCUTS_GROUP\n });\n };\n hotInitializer(itemsBoxWrapper);\n this.hot._registerTimeout(() => hotInitializer(itemsBoxWrapper), 100);\n }\n\n /**\n * Focus element.\n */\n focus() {\n if (this.isBuilt()) {\n _classPrivateFieldGet(_itemsBox, this).listen();\n }\n }\n\n /**\n * Reset DOM structure.\n */\n reset() {\n _classPrivateFieldGet(_searchInput, this).reset();\n _classPrivateFieldGet(_selectAllUI, this).reset();\n _classPrivateFieldGet(_clearAllUI, this).reset();\n }\n\n /**\n * Update DOM structure.\n */\n update() {\n if (!this.isBuilt()) {\n return;\n }\n _classPrivateFieldGet(_itemsBox, this).loadData(valueToItems(_classPrivateFieldGet(_items, this), this.options.value));\n super.update();\n }\n\n /**\n * Destroy instance.\n */\n destroy() {\n var _classPrivateFieldGet4;\n (_classPrivateFieldGet4 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.destroy();\n _classPrivateFieldGet(_searchInput, this).destroy();\n _classPrivateFieldGet(_clearAllUI, this).destroy();\n _classPrivateFieldGet(_selectAllUI, this).destroy();\n _classPrivateFieldSet(_searchInput, this, null);\n _classPrivateFieldSet(_clearAllUI, this, null);\n _classPrivateFieldSet(_selectAllUI, this, null);\n _classPrivateFieldSet(_itemsBox, this, null);\n _classPrivateFieldSet(_items, this, null);\n super.destroy();\n }\n}\nfunction _onInput(event) {\n const value = event.target.value.toLocaleLowerCase(this.getLocale());\n let filteredItems;\n if (value === '') {\n filteredItems = [..._classPrivateFieldGet(_items, this)];\n } else {\n filteredItems = _classPrivateFieldGet(_items, this).filter(item => `${item.value}`.toLocaleLowerCase(this.getLocale()).indexOf(value) >= 0);\n }\n _classPrivateFieldGet(_itemsBox, this).loadData(filteredItems);\n}\n/**\n * 'keydown' event listener for input element.\n *\n * @param {Event} event DOM event.\n */\nfunction _onInputKeyDown(event) {\n this.runLocalHooks('keydown', event, this);\n const isKeyCode = partial(isKey, event.keyCode);\n if (isKeyCode('ARROW_DOWN')) {\n event.preventDefault();\n stopImmediatePropagation(event);\n _classPrivateFieldGet(_itemsBox, this).listen();\n _classPrivateFieldGet(_itemsBox, this).selectCell(0, 0);\n }\n}\n/**\n * On click listener for \"Select all\" link.\n *\n * @param {DOMEvent} event The mouse event object.\n */\nfunction _onSelectAllClick(event) {\n const changes = [];\n event.preventDefault();\n _classPrivateFieldGet(_itemsBox, this).getSourceData().forEach((row, rowIndex) => {\n row.checked = true;\n changes.push(dataRowToChangesArray(row, rowIndex)[0]);\n });\n _classPrivateFieldGet(_itemsBox, this).setSourceDataAtCell(changes);\n}\n/**\n * On click listener for \"Clear\" link.\n *\n * @param {DOMEvent} event The mouse event object.\n */\nfunction _onClearAllClick(event) {\n const changes = [];\n event.preventDefault();\n _classPrivateFieldGet(_itemsBox, this).getSourceData().forEach((row, rowIndex) => {\n row.checked = false;\n changes.push(dataRowToChangesArray(row, rowIndex)[0]);\n });\n _classPrivateFieldGet(_itemsBox, this).setSourceDataAtCell(changes);\n}\nexport default MultipleSelectUI;\n\n/**\n * Pick up object items based on selected values.\n *\n * @param {Array} availableItems Base collection to compare values.\n * @param {Array} selectedValue Flat array with selected values.\n * @returns {Array}\n */\nfunction valueToItems(availableItems, selectedValue) {\n const arrayAssertion = createArrayAssertion(selectedValue);\n return availableItems.map(item => {\n item.checked = arrayAssertion(item.value);\n return item;\n });\n}\n\n/**\n * Convert all checked items into flat array.\n *\n * @param {Array} availableItems Base collection.\n * @returns {Array}\n */\nfunction itemsToValue(availableItems) {\n const items = [];\n availableItems.forEach(item => {\n if (item.checked) {\n items.push(item.value);\n }\n });\n return items;\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { addClass } from \"../../../helpers/dom/element.mjs\";\nimport { stopImmediatePropagation } from \"../../../helpers/dom/event.mjs\";\nimport { arrayEach, arrayFilter, arrayMap } from \"../../../helpers/array.mjs\";\nimport { isKey } from \"../../../helpers/unicode.mjs\";\nimport * as C from \"../../../i18n/constants.mjs\";\nimport { unifyColumnValues, intersectValues, toEmptyString } from \"../utils.mjs\";\nimport { BaseComponent } from \"./_base.mjs\";\nimport { MultipleSelectUI } from \"../ui/multipleSelect.mjs\";\nimport { CONDITION_BY_VALUE, CONDITION_NONE } from \"../constants.mjs\";\nimport { getConditionDescriptor } from \"../conditionRegisterer.mjs\";\nimport { getRenderedValue as getRenderedNumericValue } from \"../../../renderers/numericRenderer/index.mjs\";\n/**\n * @private\n * @class ValueComponent\n */\nvar _ValueComponent_brand = /*#__PURE__*/new WeakSet();\nexport class ValueComponent extends BaseComponent {\n constructor(hotInstance, options) {\n super(hotInstance, {\n id: options.id,\n stateless: false\n });\n /**\n * Key down listener.\n *\n * @param {Event} event The DOM event object.\n */\n _classPrivateMethodInitSpec(this, _ValueComponent_brand);\n /**\n * The name of the component.\n *\n * @type {string}\n */\n _defineProperty(this, \"name\", '');\n this.name = options.name;\n this.elements.push(new MultipleSelectUI(this.hot));\n this.registerHooks();\n }\n\n /**\n * Register all necessary hooks.\n *\n * @private\n */\n registerHooks() {\n this.getMultipleSelectElement().addLocalHook('keydown', event => _assertClassBrand(_ValueComponent_brand, this, _onInputKeyDown).call(this, event)).addLocalHook('listTabKeydown', event => this.runLocalHooks('listTabKeydown', event));\n this.hot.addHook('modifyFiltersMultiSelectValue', (value, meta) => _assertClassBrand(_ValueComponent_brand, this, _onModifyDisplayedValue).call(this, value, meta));\n }\n\n /**\n * Gets the list of elements from which the component is built.\n *\n * @returns {BaseUI[]}\n */\n getElements() {\n const selectElement = this.getMultipleSelectElement();\n return [selectElement.getSearchInputElement(), selectElement.getSelectAllElement(), selectElement.getClearAllElement(), this.getMultipleSelectElement()];\n }\n\n /**\n * Set state of the component.\n *\n * @param {object} value The component value.\n */\n setState(value) {\n this.reset();\n if (value && value.command.key === CONDITION_BY_VALUE) {\n const select = this.getMultipleSelectElement();\n select.setItems(value.itemsSnapshot);\n select.setValue(value.args[0]);\n select.setLocale(value.locale);\n }\n }\n\n /**\n * Export state of the component (get selected filter and filter arguments).\n *\n * @returns {object} Returns object where `command` key keeps used condition filter and `args` key its arguments.\n */\n getState() {\n const select = this.getMultipleSelectElement();\n const availableItems = select.getItems();\n return {\n command: {\n key: select.isSelectedAllValues() || !availableItems.length ? CONDITION_NONE : CONDITION_BY_VALUE\n },\n args: [select.getValue()],\n itemsSnapshot: availableItems\n };\n }\n\n /**\n * Update state of component.\n *\n * @param {object} stateInfo Information about state containing stack of edited column,\n * stack of dependent conditions, data factory and optional condition arguments change. It's described by object containing keys:\n * `editedConditionStack`, `dependentConditionStacks`, `visibleDataFactory` and `conditionArgsChange`.\n */\n updateState(stateInfo) {\n const updateColumnState = (physicalColumn, conditions, conditionArgsChange, filteredRowsFactory, conditionsStack) => {\n const [firstByValueCondition] = arrayFilter(conditions, condition => condition.name === CONDITION_BY_VALUE);\n const state = {};\n const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);\n if (firstByValueCondition) {\n const filteredRows = filteredRowsFactory(physicalColumn, conditionsStack);\n const rowValues = arrayMap(filteredRows, row => row.value);\n const rowMetaMap = new Map(filteredRows.map(row => [row.value, this.hot.getCellMeta(row.meta.visualRow, row.meta.visualCol)]));\n const unifiedRowValues = unifyColumnValues(rowValues);\n if (conditionArgsChange) {\n firstByValueCondition.args[0] = conditionArgsChange;\n }\n const selectedValues = [];\n const itemsSnapshot = intersectValues(unifiedRowValues, firstByValueCondition.args[0], defaultBlankCellValue, item => {\n if (item.checked) {\n selectedValues.push(item.value);\n }\n _assertClassBrand(_ValueComponent_brand, this, _triggerModifyMultipleSelectionValueHook).call(this, item, rowMetaMap);\n });\n const column = stateInfo.editedConditionStack.column;\n state.locale = this.hot.getCellMeta(0, column).locale;\n state.args = [selectedValues];\n state.command = getConditionDescriptor(CONDITION_BY_VALUE);\n state.itemsSnapshot = itemsSnapshot;\n } else {\n state.args = [];\n state.command = getConditionDescriptor(CONDITION_NONE);\n }\n this.state.setValueAtIndex(physicalColumn, state);\n };\n updateColumnState(stateInfo.editedConditionStack.column, stateInfo.editedConditionStack.conditions, stateInfo.conditionArgsChange, stateInfo.filteredRowsFactory);\n\n // Update the next \"by_value\" component (filter column conditions added after this condition).\n // Its list of values has to be updated. As the new values by default are unchecked,\n // the further component update is unnecessary.\n if (stateInfo.dependentConditionStacks.length) {\n updateColumnState(stateInfo.dependentConditionStacks[0].column, stateInfo.dependentConditionStacks[0].conditions, stateInfo.conditionArgsChange, stateInfo.filteredRowsFactory, stateInfo.editedConditionStack);\n }\n }\n\n /**\n * Get multiple select element.\n *\n * @returns {MultipleSelectUI}\n */\n getMultipleSelectElement() {\n return this.elements.filter(element => element instanceof MultipleSelectUI)[0];\n }\n\n /**\n * Get object descriptor for menu item entry.\n *\n * @returns {object}\n */\n getMenuItemDescriptor() {\n return {\n key: this.id,\n name: this.name,\n isCommand: false,\n disableSelection: true,\n hidden: () => this.isHidden(),\n renderer: (hot, wrapper, row, col, prop, value) => {\n addClass(wrapper.parentNode, 'htFiltersMenuValue');\n const label = this.hot.rootDocument.createElement('div');\n addClass(label, 'htFiltersMenuLabel');\n label.textContent = value;\n wrapper.appendChild(label);\n\n // The MultipleSelectUI should not extend the menu width (it should adjust to the menu item width only).\n // That's why it's skipped from rendering when the GhostTable tries to render it.\n if (!wrapper.parentElement.hasAttribute('ghost-table')) {\n arrayEach(this.elements, ui => wrapper.appendChild(ui.element));\n }\n return wrapper;\n }\n };\n }\n\n /**\n * Reset elements to their initial state.\n */\n reset() {\n const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);\n const rowEntries = this._getColumnVisibleValues();\n const rowValues = rowEntries.map(entry => entry.value);\n const rowMetaMap = new Map(rowEntries.map(row => [row.value, row.meta]));\n const values = unifyColumnValues(rowValues);\n const items = intersectValues(values, values, defaultBlankCellValue, item => {\n _assertClassBrand(_ValueComponent_brand, this, _triggerModifyMultipleSelectionValueHook).call(this, item, rowMetaMap);\n });\n this.getMultipleSelectElement().setItems(items);\n super.reset();\n this.getMultipleSelectElement().setValue(values);\n const selectedColumn = this.hot.getPlugin('filters').getSelectedColumn();\n if (selectedColumn !== null) {\n this.getMultipleSelectElement().setLocale(this.hot.getCellMeta(0, selectedColumn.visualIndex).locale);\n }\n }\n /**\n * Get data for currently selected column.\n *\n * @returns {Array}\n * @private\n */\n _getColumnVisibleValues() {\n const selectedColumn = this.hot.getPlugin('filters').getSelectedColumn();\n if (selectedColumn === null) {\n return [];\n }\n return arrayMap(this.hot.getDataAtCol(selectedColumn.visualIndex), (v, rowIndex) => {\n return {\n value: toEmptyString(v),\n meta: this.hot.getCellMeta(rowIndex, selectedColumn.visualIndex)\n };\n });\n }\n}\nfunction _onInputKeyDown(event) {\n if (isKey(event.keyCode, 'ESCAPE')) {\n this.runLocalHooks('cancel');\n stopImmediatePropagation(event);\n }\n}\n/**\n * Trigger the `modifyFiltersMultiSelectValue` hook.\n *\n * @param {object} item Item from the multiple select list.\n * @param {Map} metaMap Map of row meta objects.\n */\nfunction _triggerModifyMultipleSelectionValueHook(item, metaMap) {\n if (this.hot.hasHook('modifyFiltersMultiSelectValue')) {\n item.visualValue = this.hot.runHooks('modifyFiltersMultiSelectValue', item.visualValue, metaMap.get(item.value));\n }\n}\n/**\n * Modify the value displayed in the multiple select list.\n *\n * @param {*} value Cell value.\n * @param {object} meta The cell meta object.\n * @returns {*} Returns the modified value.\n */\nfunction _onModifyDisplayedValue(value, meta) {\n switch (meta.type) {\n case 'numeric':\n return getRenderedNumericValue(value, meta);\n default:\n return value;\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nvar _ActionBarComponent;\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { addClass } from \"../../../helpers/dom/element.mjs\";\nimport { arrayEach } from \"../../../helpers/array.mjs\";\nimport * as C from \"../../../i18n/constants.mjs\";\nimport { BaseComponent } from \"./_base.mjs\";\nimport { InputUI } from \"../ui/input.mjs\";\n/**\n * @private\n * @class ActionBarComponent\n */\nvar _ActionBarComponent_brand = /*#__PURE__*/new WeakSet();\nexport class ActionBarComponent extends BaseComponent {\n static get BUTTON_OK() {\n return 'ok';\n }\n static get BUTTON_CANCEL() {\n return 'cancel';\n }\n constructor(hotInstance, options) {\n super(hotInstance, {\n id: options.id,\n stateless: true\n });\n /**\n * On button click listener.\n *\n * @param {Event} event DOM event.\n * @param {InputUI} button InputUI object.\n */\n _classPrivateMethodInitSpec(this, _ActionBarComponent_brand);\n /**\n * The name of the component.\n *\n * @type {string}\n */\n _defineProperty(this, \"name\", '');\n this.name = options.name;\n this.elements.push(new InputUI(this.hot, {\n type: 'button',\n value: C.FILTERS_BUTTONS_OK,\n className: 'htUIButton htUIButtonOK',\n identifier: ActionBarComponent.BUTTON_OK\n }));\n this.elements.push(new InputUI(this.hot, {\n type: 'button',\n value: C.FILTERS_BUTTONS_CANCEL,\n className: 'htUIButton htUIButtonCancel',\n identifier: ActionBarComponent.BUTTON_CANCEL\n }));\n this.registerHooks();\n }\n\n /**\n * Register all necessary hooks.\n *\n * @private\n */\n registerHooks() {\n arrayEach(this.elements, element => {\n element.addLocalHook('click', (event, button) => _assertClassBrand(_ActionBarComponent_brand, this, _onButtonClick).call(this, event, button));\n });\n }\n\n /**\n * Get menu object descriptor.\n *\n * @returns {object}\n */\n getMenuItemDescriptor() {\n return {\n key: this.id,\n name: this.name,\n isCommand: false,\n disableSelection: true,\n hidden: () => this.isHidden(),\n renderer: (hot, wrapper) => {\n addClass(wrapper.parentNode, 'htFiltersMenuActionBar');\n arrayEach(this.elements, ui => wrapper.appendChild(ui.element));\n return wrapper;\n }\n };\n }\n\n /**\n * Fire accept event.\n */\n accept() {\n this.runLocalHooks('accept');\n }\n\n /**\n * Fire cancel event.\n */\n cancel() {\n this.runLocalHooks('cancel');\n }\n}\n_ActionBarComponent = ActionBarComponent;\nfunction _onButtonClick(event, button) {\n if (button.options.identifier === _ActionBarComponent.BUTTON_OK) {\n this.accept();\n } else {\n this.cancel();\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { arrayEach, arrayMap, arrayReduce } from \"../../helpers/array.mjs\";\nimport { mixin } from \"../../helpers/object.mjs\";\nimport { toSingleLine } from \"../../helpers/templateLiteralTag.mjs\";\nimport localHooks from \"../../mixins/localHooks.mjs\";\nimport { getCondition } from \"./conditionRegisterer.mjs\";\nimport { OPERATION_ID as OPERATION_AND } from \"./logicalOperations/conjunction.mjs\";\nimport { operations, getOperationFunc } from \"./logicalOperationRegisterer.mjs\";\nimport { isUndefined } from \"../../helpers/mixed.mjs\";\nimport { LinkedPhysicalIndexToValueMap as IndexToValueMap } from \"../../translations/index.mjs\";\nconst MAP_NAME = 'ConditionCollection.filteringStates';\n\n/**\n * @private\n * @class ConditionCollection\n */\nclass ConditionCollection {\n constructor(hot) {\n let isMapRegistrable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n /**\n * Handsontable instance.\n *\n * @type {Core}\n */\n _defineProperty(this, \"hot\", void 0);\n /**\n * Indicates whether the internal IndexMap should be registered or not. Generally,\n * registered Maps responds to the index changes. Within that collection, sometimes\n * this is not necessary.\n *\n * @type {boolean}\n */\n _defineProperty(this, \"isMapRegistrable\", void 0);\n /**\n * Index map storing filtering states for every column. ConditionCollection write and read to/from element.\n *\n * @type {LinkedPhysicalIndexToValueMap}\n */\n _defineProperty(this, \"filteringStates\", new IndexToValueMap());\n /**\n * Stores the previous state of the condition stack before the latest filter operation.\n * This is used in the `beforeFilter` plugin to allow performing the undo operation.\n *\n * @type {null|Array}\n */\n _defineProperty(this, \"previousConditionStack\", null);\n this.hot = hot;\n this.isMapRegistrable = isMapRegistrable;\n if (this.isMapRegistrable === true) {\n this.hot.columnIndexMapper.registerMap(MAP_NAME, this.filteringStates);\n } else {\n this.filteringStates.init(this.hot.columnIndexMapper.getNumberOfIndexes());\n }\n }\n\n /**\n * Check if condition collection is empty (so no needed to filter data).\n *\n * @returns {boolean}\n */\n isEmpty() {\n return this.getFilteredColumns().length === 0;\n }\n\n /**\n * Check if value is matched to the criteria of conditions chain.\n *\n * @param {object} value Object with `value` and `meta` keys.\n * @param {number} column The physical column index.\n * @returns {boolean}\n */\n isMatch(value, column) {\n var _stateForColumn$condi;\n const stateForColumn = this.filteringStates.getValueAtIndex(column);\n const conditions = (_stateForColumn$condi = stateForColumn === null || stateForColumn === void 0 ? void 0 : stateForColumn.conditions) !== null && _stateForColumn$condi !== void 0 ? _stateForColumn$condi : [];\n const operation = stateForColumn === null || stateForColumn === void 0 ? void 0 : stateForColumn.operation;\n return this.isMatchInConditions(conditions, value, operation);\n }\n\n /**\n * Check if the value is matches the conditions.\n *\n * @param {Array} conditions List of conditions.\n * @param {object} value Object with `value` and `meta` keys.\n * @param {string} [operationType='conjunction'] Type of conditions operation.\n * @returns {boolean}\n */\n isMatchInConditions(conditions, value) {\n let operationType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : OPERATION_AND;\n if (conditions.length) {\n return getOperationFunc(operationType)(conditions, value);\n }\n return true;\n }\n\n /**\n * Add condition to the collection.\n *\n * @param {number} column The physical column index.\n * @param {object} conditionDefinition Object with keys:\n * * `command` Object, Command object with condition name as `key` property.\n * * `args` Array, Condition arguments.\n * @param {string} [operation='conjunction'] Type of conditions operation.\n * @param {number} [position] Position to which condition will be added. When argument is undefined\n * the condition will be processed as the last condition.\n * @fires ConditionCollection#beforeAdd\n * @fires ConditionCollection#afterAdd\n */\n addCondition(column, conditionDefinition) {\n let operation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : OPERATION_AND;\n let position = arguments.length > 3 ? arguments[3] : undefined;\n const localeForColumn = this.hot.getCellMeta(0, column).locale;\n const args = arrayMap(conditionDefinition.args, v => typeof v === 'string' ? v.toLocaleLowerCase(localeForColumn) : v);\n const name = conditionDefinition.name || conditionDefinition.command.key;\n\n // If there's no previous condition stack defined (which means the condition stack was not cleared after the\n // previous filter operation or that there was no filter operation performed yet), store the current conditions as\n // the previous condition stack.\n if (this.previousConditionStack === null) {\n this.setPreviousConditionStack(this.exportAllConditions());\n }\n this.runLocalHooks('beforeAdd', column);\n const columnType = this.getOperation(column);\n if (columnType) {\n if (columnType !== operation) {\n throw Error(toSingleLine`The column of index ${column} has been already applied with a \\`${columnType}\\`\\x20\n filter operation. Use \\`removeConditions\\` to clear the current conditions and then add new ones.\\x20\n Mind that you cannot mix different types of operations (for instance, if you use \\`conjunction\\`,\\x20\n use it consequently for a particular column).`);\n }\n } else if (isUndefined(operations[operation])) {\n throw new Error(toSingleLine`Unexpected operation named \\`${operation}\\`. Possible ones are\\x20\n \\`disjunction\\` and \\`conjunction\\`.`);\n }\n const conditionsForColumn = this.getConditions(column);\n if (conditionsForColumn.length === 0) {\n // Create first condition for particular column.\n this.filteringStates.setValueAtIndex(column, {\n operation,\n conditions: [{\n name,\n args,\n func: getCondition(name, args)\n }]\n }, position);\n } else {\n // Add next condition for particular column (by reference).\n conditionsForColumn.push({\n name,\n args,\n func: getCondition(name, args)\n });\n }\n this.runLocalHooks('afterAdd', column);\n }\n\n /**\n * Get all added conditions from the collection at specified column index.\n *\n * @param {number} column The physical column index.\n * @returns {Array} Returns conditions collection as an array.\n */\n getConditions(column) {\n var _this$filteringStates, _this$filteringStates2;\n return (_this$filteringStates = (_this$filteringStates2 = this.filteringStates.getValueAtIndex(column)) === null || _this$filteringStates2 === void 0 ? void 0 : _this$filteringStates2.conditions) !== null && _this$filteringStates !== void 0 ? _this$filteringStates : [];\n }\n\n /**\n * Get operation for particular column.\n *\n * @param {number} column The physical column index.\n * @returns {string|undefined}\n */\n getOperation(column) {\n var _this$filteringStates3;\n return (_this$filteringStates3 = this.filteringStates.getValueAtIndex(column)) === null || _this$filteringStates3 === void 0 ? void 0 : _this$filteringStates3.operation;\n }\n\n /**\n * Get all filtered physical columns in the order in which actions are performed.\n *\n * @returns {Array}\n */\n getFilteredColumns() {\n return this.filteringStates.getEntries().map(_ref => {\n let [physicalColumn] = _ref;\n return physicalColumn;\n });\n }\n\n /**\n * Gets position in the filtering states stack for the specific column.\n *\n * @param {number} column The physical column index.\n * @returns {number} Returns -1 when the column doesn't exist in the stack.\n */\n getColumnStackPosition(column) {\n return this.getFilteredColumns().indexOf(column);\n }\n\n /**\n * Export all previously added conditions.\n *\n * @returns {Array}\n */\n exportAllConditions() {\n return arrayReduce(this.filteringStates.getEntries(), (allConditions, _ref2) => {\n let [column, {\n operation,\n conditions\n }] = _ref2;\n allConditions.push({\n column,\n operation,\n conditions: arrayMap(conditions, _ref3 => {\n let {\n name,\n args\n } = _ref3;\n return {\n name,\n args\n };\n })\n });\n return allConditions;\n }, []);\n }\n\n /**\n * Import conditions to the collection.\n *\n * @param {Array} conditions The collection of the conditions.\n */\n importAllConditions(conditions) {\n this.clean();\n arrayEach(conditions, stack => {\n arrayEach(stack.conditions, condition => this.addCondition(stack.column, condition));\n });\n }\n\n /**\n * Remove conditions at given column index.\n *\n * @param {number} column The physical column index.\n * @fires ConditionCollection#beforeRemove\n * @fires ConditionCollection#afterRemove\n */\n removeConditions(column) {\n // Store the current conditions as the previous condition stack before it's cleared.\n this.setPreviousConditionStack(this.exportAllConditions());\n this.runLocalHooks('beforeRemove', column);\n this.filteringStates.clearValue(column);\n this.runLocalHooks('afterRemove', column);\n }\n\n /**\n * Clean all conditions collection and reset order stack.\n *\n * @fires ConditionCollection#beforeClean\n * @fires ConditionCollection#afterClean\n */\n clean() {\n this.runLocalHooks('beforeClean');\n this.filteringStates.clear();\n this.runLocalHooks('afterClean');\n }\n\n /**\n * Check if at least one condition was added at specified column index. And if second parameter is passed then additionally\n * check if condition exists under its name.\n *\n * @param {number} column The physical column index.\n * @param {string} [name] Condition name.\n * @returns {boolean}\n */\n hasConditions(column, name) {\n const conditions = this.getConditions(column);\n if (name) {\n return conditions.some(condition => condition.name === name);\n }\n return conditions.length > 0;\n }\n\n /**\n * Updates the `previousConditionStack` property with the provided stack.\n * It is used to store the current conditions before they are modified, allowing for undo operations.\n *\n * @param {Array|null} previousConditionStack The stack of previous conditions.\n */\n setPreviousConditionStack(previousConditionStack) {\n this.previousConditionStack = previousConditionStack;\n }\n\n /**\n * Destroy object.\n */\n destroy() {\n if (this.isMapRegistrable) {\n this.hot.columnIndexMapper.unregisterMap(MAP_NAME);\n }\n this.filteringStates = null;\n this.clearLocalHooks();\n }\n}\nmixin(ConditionCollection, localHooks);\nexport default ConditionCollection;", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { arrayEach } from \"../../helpers/array.mjs\";\n/**\n * @private\n * @class DataFilter\n */\nclass DataFilter {\n constructor(conditionCollection) {\n let columnDataFactory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => [];\n /**\n * Reference to the instance of {ConditionCollection}.\n *\n * @type {ConditionCollection}\n */\n _defineProperty(this, \"conditionCollection\", void 0);\n /**\n * Function which provide source data factory for specified column.\n *\n * @type {Function}\n */\n _defineProperty(this, \"columnDataFactory\", void 0);\n this.conditionCollection = conditionCollection;\n this.columnDataFactory = columnDataFactory;\n }\n\n /**\n * Filter data based on the conditions collection.\n *\n * @returns {Array}\n */\n filter() {\n let filteredData = [];\n arrayEach(this.conditionCollection.getFilteredColumns(), (physicalColumn, index) => {\n let columnData = this.columnDataFactory(physicalColumn);\n if (index) {\n columnData = this._getIntersectData(columnData, filteredData);\n }\n filteredData = this.filterByColumn(physicalColumn, columnData);\n });\n return filteredData;\n }\n\n /**\n * Filter data based on specified physical column index.\n *\n * @param {number} column The physical column index.\n * @param {Array} [dataSource] Data source as array of objects with `value` and `meta` keys (e.g. `{value: 'foo', meta: {}}`).\n * @returns {Array} Returns filtered data.\n */\n filterByColumn(column) {\n let dataSource = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n const filteredData = [];\n arrayEach(dataSource, dataRow => {\n if (dataRow !== undefined && this.conditionCollection.isMatch(dataRow, column)) {\n filteredData.push(dataRow);\n }\n });\n return filteredData;\n }\n\n /**\n * Intersect data.\n *\n * @private\n * @param {Array} data The data to intersect.\n * @param {Array} needles The collection intersected rows with the data.\n * @returns {Array}\n */\n _getIntersectData(data, needles) {\n const result = [];\n arrayEach(needles, needleRow => {\n const row = needleRow.meta.visualRow;\n if (data[row] !== undefined) {\n result[row] = data[row];\n }\n });\n return result;\n }\n}\nexport default DataFilter;", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { arrayEach, arrayMap, arrayFilter } from \"../../helpers/array.mjs\";\nimport { mixin, objectEach } from \"../../helpers/object.mjs\";\nimport { curry } from \"../../helpers/function.mjs\";\nimport localHooks from \"../../mixins/localHooks.mjs\";\nimport ConditionCollection from \"./conditionCollection.mjs\";\nimport DataFilter from \"./dataFilter.mjs\";\nimport { createArrayAssertion } from \"./utils.mjs\";\n/**\n * Class which is designed for observing changes in condition collection. When condition is changed by user at specified\n * column it's necessary to update all conditions defined after this edited one.\n *\n * Object fires `update` hook for every column conditions change.\n *\n * @private\n * @class ConditionUpdateObserver\n */\nvar _ConditionUpdateObserver_brand = /*#__PURE__*/new WeakSet();\nclass ConditionUpdateObserver {\n constructor(hot, conditionCollection) {\n let columnDataFactory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : () => [];\n /**\n * On before modify condition (add or remove from collection),.\n *\n * @param {number} column Column index.\n * @private\n */\n _classPrivateMethodInitSpec(this, _ConditionUpdateObserver_brand);\n /**\n * Handsontable instance.\n *\n * @type {Core}\n */\n _defineProperty(this, \"hot\", void 0);\n /**\n * Reference to the instance of {@link ConditionCollection}.\n *\n * @type {ConditionCollection}\n */\n _defineProperty(this, \"conditionCollection\", void 0);\n /**\n * Function which provide source data factory for specified column.\n *\n * @type {Function}\n */\n _defineProperty(this, \"columnDataFactory\", void 0);\n /**\n * Collected changes when grouping is enabled.\n *\n * @type {Array}\n * @default []\n */\n _defineProperty(this, \"changes\", []);\n /**\n * Flag which determines if grouping events is enabled.\n *\n * @type {boolean}\n */\n _defineProperty(this, \"grouping\", false);\n /**\n * The latest known position of edited conditions at specified column index.\n *\n * @type {number}\n * @default -1\n */\n _defineProperty(this, \"latestEditedColumnPosition\", -1);\n /**\n * The latest known order of conditions stack.\n *\n * @type {Array}\n */\n _defineProperty(this, \"latestOrderStack\", []);\n this.hot = hot;\n this.conditionCollection = conditionCollection;\n this.columnDataFactory = columnDataFactory;\n this.conditionCollection.addLocalHook('beforeRemove', column => _assertClassBrand(_ConditionUpdateObserver_brand, this, _onConditionBeforeModify).call(this, column));\n this.conditionCollection.addLocalHook('afterRemove', column => this.updateStatesAtColumn(column));\n this.conditionCollection.addLocalHook('afterAdd', column => this.updateStatesAtColumn(column));\n this.conditionCollection.addLocalHook('beforeClean', () => _assertClassBrand(_ConditionUpdateObserver_brand, this, _onConditionBeforeClean).call(this));\n this.conditionCollection.addLocalHook('afterClean', () => _assertClassBrand(_ConditionUpdateObserver_brand, this, _onConditionAfterClean).call(this));\n }\n\n /**\n * Enable grouping changes. Grouping is helpful in situations when a lot of conditions is added in one moment. Instead of\n * trigger `update` hook for every condition by adding/removing you can group this changes and call `flush` method to trigger\n * it once.\n */\n groupChanges() {\n this.grouping = true;\n }\n\n /**\n * Flush all collected changes. This trigger `update` hook for every previously collected change from condition collection.\n */\n flush() {\n this.grouping = false;\n arrayEach(this.changes, column => {\n this.updateStatesAtColumn(column);\n });\n this.changes.length = 0;\n }\n /**\n * Update all related states which should be changed after invoking changes applied to current column.\n *\n * @param {number} column The column index.\n * @param {object} conditionArgsChange Object describing condition changes which can be handled by filters on `update` hook.\n * It contains keys `conditionKey` and `conditionValue` which refers to change specified key of condition to specified value\n * based on referred keys.\n */\n updateStatesAtColumn(column, conditionArgsChange) {\n var _this = this;\n if (this.grouping) {\n if (this.changes.indexOf(column) === -1) {\n this.changes.push(column);\n }\n return;\n }\n const allConditions = this.conditionCollection.exportAllConditions();\n let editedColumnPosition = this.conditionCollection.getColumnStackPosition(column);\n if (editedColumnPosition === -1) {\n editedColumnPosition = this.latestEditedColumnPosition;\n }\n\n // Collection of all conditions defined before currently edited `column` (without edited one)\n const conditionsBefore = allConditions.slice(0, editedColumnPosition);\n // Collection of all conditions defined after currently edited `column` (with edited one)\n const conditionsAfter = allConditions.slice(editedColumnPosition);\n\n // Make sure that conditionAfter doesn't contain edited column conditions\n if (conditionsAfter.length && conditionsAfter[0].column === column) {\n conditionsAfter.shift();\n }\n const visibleDataFactory = curry(function (curriedConditionsBefore, curriedColumn) {\n let conditionsStack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n const splitConditionCollection = new ConditionCollection(_this.hot, false);\n const curriedConditionsBeforeArray = [].concat(curriedConditionsBefore, conditionsStack);\n\n // Create new condition collection to determine what rows should be visible in \"filter by value\" box\n // in the next conditions in the chain\n splitConditionCollection.importAllConditions(curriedConditionsBeforeArray);\n const allRows = _this.columnDataFactory(curriedColumn);\n let visibleRows;\n if (splitConditionCollection.isEmpty()) {\n visibleRows = allRows;\n } else {\n visibleRows = new DataFilter(splitConditionCollection, columnData => _this.columnDataFactory(columnData)).filter();\n }\n visibleRows = arrayMap(visibleRows, rowData => rowData.meta.visualRow);\n const visibleRowsAssertion = createArrayAssertion(visibleRows);\n splitConditionCollection.destroy();\n return arrayFilter(allRows, rowData => visibleRowsAssertion(rowData.meta.visualRow));\n })(conditionsBefore);\n const editedConditions = [].concat(this.conditionCollection.getConditions(column));\n this.runLocalHooks('update', {\n editedConditionStack: {\n column,\n conditions: editedConditions\n },\n dependentConditionStacks: conditionsAfter,\n filteredRowsFactory: visibleDataFactory,\n conditionArgsChange\n });\n }\n\n /**\n * On before conditions clean listener.\n *\n * @private\n */\n\n /**\n * Destroy instance.\n */\n destroy() {\n this.clearLocalHooks();\n objectEach(this, (value, property) => {\n this[property] = null;\n });\n }\n}\nfunction _onConditionBeforeModify(column) {\n this.latestEditedColumnPosition = this.conditionCollection.getColumnStackPosition(column);\n}\nfunction _onConditionBeforeClean() {\n this.latestOrderStack = this.conditionCollection.getFilteredColumns();\n}\n/**\n * On after conditions clean listener.\n *\n * @private\n */\nfunction _onConditionAfterClean() {\n arrayEach(this.latestOrderStack, column => {\n this.updateStatesAtColumn(column);\n });\n}\nmixin(ConditionUpdateObserver, localHooks);\nexport default ConditionUpdateObserver;", "import { createPaginator } from \"../../../utils/paginator.mjs\";\nimport { isVisible } from \"../../../helpers/dom/element.mjs\";\nimport { MultipleSelectUI } from \"../ui/multipleSelect.mjs\";\n/**\n * Creates navigator for switching the focus of the filter's elements.\n *\n * @param {BaseUI[]} elements The elements to paginate to.\n * @returns {Paginator}\n */\nexport function createFocusNavigator(elements) {\n const navigator = createPaginator({\n initialPage: 0,\n size: () => elements.length,\n onItemSelect: (currentIndex, directItemChange) => {\n const element = elements[currentIndex];\n if (element instanceof MultipleSelectUI) {\n return directItemChange;\n }\n if (element.element && !isVisible(element.element)) {\n return false;\n }\n element.focus();\n }\n });\n return navigator;\n}", "import { createFocusNavigator } from \"./focusNavigator.mjs\";\nimport { SelectUI } from \"../ui/select.mjs\";\nimport { BaseUI } from \"../ui/_base.mjs\";\nimport { LinkUI } from \"../ui/link.mjs\";\nconst SHORTCUTS_MENU_CONTEXT = 'filters';\n\n/**\n * @typedef MenuFocusNavigator\n * @property {function(number): void} setCurrentPage Sets the current index of the selected focus.\n * @property {function(): number} getCurrentPage Gets the index of currently focus element.\n * @property {function(): void} toFirstItem Move the focus index to the first element in the list.\n * @property {function(): void} toLastItem Move the focus index to the last element in the list.\n * @property {function(): void} toNextItem Move the focus index to the next element in the list.\n * @property {function(): void} toPreviousItem Move the focus index to the previous element in the list.\n * @property {function(): void} clear Clear the internal state of the navigator.\n * @property {function(): void} listen Activate the navigator by listening the keyboard shortcuts.\n */\n/**\n * Creates navigator controller for filter subcomponents in the menu.\n *\n * @param {Menu} mainMenu The main Menu instance.\n * @param {BaseUI[]} menuItems The list of the component's elements to paginate to.\n * @returns {Paginator}\n */\nexport function createMenuFocusController(mainMenu, menuItems) {\n /**\n * @type {number} The last selected menu item (before clearing the the menu state after going\n * into the focus mode triggered by the TAB or SHIFT+TAB keys).\n */\n let lastSelectedMenuItem = -1;\n const focusNavigator = createFocusNavigator(menuItems);\n const updateNavigatorPosition = element => () => {\n if (mainMenu.isOpened()) {\n mainMenu.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);\n }\n focusNavigator.setCurrentPage(menuItems.indexOf(element));\n };\n\n // update navigator position (internal state) to element that was recently clicked or focused\n menuItems.forEach(element => {\n if (element instanceof BaseUI) {\n element.addLocalHook('click', updateNavigatorPosition(element));\n element.addLocalHook('focus', updateNavigatorPosition(element));\n element.addLocalHook('afterClose', updateNavigatorPosition(element));\n }\n });\n mainMenu.addLocalHook('afterSelectionChange', selectedItem => {\n if (!selectedItem.key.startsWith('filter_')) {\n focusNavigator.clear();\n }\n });\n\n /**\n * Extends the menu and submenus with new keyboard shortcuts.\n *\n * @param {*} menu The menu (as main menu or submenu) instance.\n */\n function addKeyboardShortcuts(menu) {\n const mainMenuShortcutsCtrl = mainMenu.getKeyboardShortcutsCtrl();\n const currentMenuShortcutsCtrl = menu.getKeyboardShortcutsCtrl();\n focusNavigator.clear();\n currentMenuShortcutsCtrl.addCustomShortcuts([{\n keys: [['Tab'], ['Shift', 'Tab']],\n forwardToContext: mainMenuShortcutsCtrl.getContext(SHORTCUTS_MENU_CONTEXT),\n callback: () => {\n if (menu.isSubMenu()) {\n menu.close();\n }\n mainMenuShortcutsCtrl.listen(SHORTCUTS_MENU_CONTEXT);\n }\n }]);\n if (menu.isSubMenu()) {\n return;\n }\n mainMenuShortcutsCtrl.addCustomShortcuts([{\n keys: [['Tab'], ['Shift', 'Tab']],\n callback: event => {\n const menuNavigator = mainMenu.getNavigator();\n if (menuNavigator.getCurrentPage() > -1) {\n lastSelectedMenuItem = menuNavigator.getCurrentPage();\n }\n menuNavigator.clear();\n if (event.shiftKey) {\n focusNavigator.toPreviousItem();\n } else {\n focusNavigator.toNextItem();\n }\n }\n }, {\n keys: [['Escape']],\n callback: () => {\n mainMenu.close();\n }\n }, {\n keys: [['Enter'], ['Space']],\n preventDefault: false,\n callback: event => {\n const element = menuItems[focusNavigator.getCurrentPage()];\n if (element instanceof SelectUI) {\n element.openOptions();\n event.preventDefault();\n }\n if (element instanceof LinkUI) {\n element.activate();\n event.preventDefault();\n }\n if (!(element instanceof BaseUI)) {\n event.preventDefault();\n }\n }\n }], SHORTCUTS_MENU_CONTEXT);\n }\n mainMenu.addLocalHook('afterSubmenuOpen', addKeyboardShortcuts);\n mainMenu.addLocalHook('afterOpen', addKeyboardShortcuts);\n\n /**\n * Focuses the menu and switches its shortcut context to that one which controls\n * the focus navigation.\n */\n function listen() {\n mainMenu.focus();\n mainMenu.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);\n }\n\n /**\n * Retrieves the last selected menu item (before clearing the state after going into the focus mode).\n *\n * @returns {number} The last selected menu item.\n */\n function getLastMenuPage() {\n return lastSelectedMenuItem;\n }\n return {\n ...focusNavigator,\n listen,\n getLastMenuPage\n };\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/es.array.unscopables.flat.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport { arrayEach, arrayMap } from \"../../helpers/array.mjs\";\nimport { toSingleLine } from \"../../helpers/templateLiteralTag.mjs\";\nimport { warn } from \"../../helpers/console.mjs\";\nimport { rangeEach } from \"../../helpers/number.mjs\";\nimport { addClass, removeClass } from \"../../helpers/dom/element.mjs\";\nimport { isKey } from \"../../helpers/unicode.mjs\";\nimport { SEPARATOR } from \"../contextMenu/predefinedItems/index.mjs\";\nimport * as constants from \"../../i18n/constants.mjs\";\nimport { ConditionComponent } from \"./component/condition.mjs\";\nimport { OperatorsComponent } from \"./component/operators.mjs\";\nimport { ValueComponent } from \"./component/value.mjs\";\nimport { ActionBarComponent } from \"./component/actionBar.mjs\";\nimport ConditionCollection from \"./conditionCollection.mjs\";\nimport DataFilter from \"./dataFilter.mjs\";\nimport ConditionUpdateObserver from \"./conditionUpdateObserver.mjs\";\nimport { createArrayAssertion, toEmptyString, unifyColumnValues } from \"./utils.mjs\";\nimport { createMenuFocusController } from \"./menu/focusController.mjs\";\nimport { CONDITION_NONE, CONDITION_BY_VALUE, OPERATION_AND, OPERATION_OR, OPERATION_OR_THEN_VARIABLE } from \"./constants.mjs\";\nimport { TrimmingMap } from \"../../translations/index.mjs\";\nexport const PLUGIN_KEY = 'filters';\nexport const PLUGIN_PRIORITY = 250;\nconst SHORTCUTS_GROUP = PLUGIN_KEY;\n\n/**\n * @plugin Filters\n * @class Filters\n *\n * @description\n * The plugin allows filtering the table data either by the built-in component or with the API.\n *\n * See [the filtering demo](@/guides/columns/column-filter/column-filter.md) for examples.\n *\n * @example\n * ::: only-for javascript\n * ```js\n * const container = document.getElementById('example');\n * const hot = new Handsontable(container, {\n * data: getData(),\n * colHeaders: true,\n * rowHeaders: true,\n * dropdownMenu: true,\n * filters: true\n * });\n * ```\n * :::\n *\n * ::: only-for react\n * ```jsx\n * \n * ```\n * :::\n */\nvar _menuFocusNavigator = /*#__PURE__*/new WeakMap();\nvar _Filters_brand = /*#__PURE__*/new WeakSet();\nexport class Filters extends BasePlugin {\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n static get PLUGIN_DEPS() {\n return ['plugin:DropdownMenu', 'plugin:HiddenRows', 'cell-type:checkbox'];\n }\n\n /**\n * Instance of {@link DropdownMenu}.\n *\n * @private\n * @type {DropdownMenu}\n */\n\n constructor(hotInstance) {\n super(hotInstance);\n // One listener for the enable/disable functionality\n /**\n * `afterChange` listener.\n *\n * @param {Array} changes Array of changes.\n */\n _classPrivateMethodInitSpec(this, _Filters_brand);\n _defineProperty(this, \"dropdownMenuPlugin\", null);\n /**\n * Instance of {@link ConditionCollection}.\n *\n * @private\n * @type {ConditionCollection}\n */\n _defineProperty(this, \"conditionCollection\", null);\n /**\n * Instance of {@link ConditionUpdateObserver}.\n *\n * @private\n * @type {ConditionUpdateObserver}\n */\n _defineProperty(this, \"conditionUpdateObserver\", null);\n /**\n * Map, where key is component identifier and value represent `BaseComponent` element or it derivatives.\n *\n * @private\n * @type {Map}\n */\n _defineProperty(this, \"components\", new Map([['filter_by_condition', null], ['filter_operators', null], ['filter_by_condition2', null], ['filter_by_value', null], ['filter_action_bar', null]]));\n /**\n * Map of skipped rows by plugin.\n *\n * @private\n * @type {null|TrimmingMap}\n */\n _defineProperty(this, \"filtersRowsMap\", null);\n /**\n * Menu focus navigator allows switching the focus position through Tab and Shift Tab keys.\n *\n * @type {MenuFocusNavigator|undefined}\n */\n _classPrivateFieldInitSpec(this, _menuFocusNavigator, void 0);\n this.hot.addHook('afterGetColHeader', (col, TH) => _assertClassBrand(_Filters_brand, this, _onAfterGetColHeader).call(this, col, TH));\n }\n\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link Filters#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n /* eslint-disable no-unneeded-ternary */\n return this.hot.getSettings()[PLUGIN_KEY] ? true : false;\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n if (this.enabled) {\n return;\n }\n this.filtersRowsMap = this.hot.rowIndexMapper.registerMap(this.pluginName, new TrimmingMap());\n this.dropdownMenuPlugin = this.hot.getPlugin('dropdownMenu');\n const dropdownSettings = this.hot.getSettings().dropdownMenu;\n const menuContainer = dropdownSettings && dropdownSettings.uiContainer || this.hot.rootDocument.body;\n const addConfirmationHooks = component => {\n component.addLocalHook('accept', () => _assertClassBrand(_Filters_brand, this, _onActionBarSubmit).call(this, 'accept'));\n component.addLocalHook('cancel', () => _assertClassBrand(_Filters_brand, this, _onActionBarSubmit).call(this, 'cancel'));\n component.addLocalHook('change', command => _assertClassBrand(_Filters_brand, this, _onComponentChange).call(this, component, command));\n return component;\n };\n const filterByConditionLabel = () => `${this.hot.getTranslatedPhrase(constants.FILTERS_DIVS_FILTER_BY_CONDITION)}:`;\n const filterValueLabel = () => `${this.hot.getTranslatedPhrase(constants.FILTERS_DIVS_FILTER_BY_VALUE)}:`;\n if (!this.components.get('filter_by_condition')) {\n const conditionComponent = new ConditionComponent(this.hot, {\n id: 'filter_by_condition',\n name: filterByConditionLabel,\n addSeparator: false,\n menuContainer\n });\n conditionComponent.addLocalHook('afterClose', () => _assertClassBrand(_Filters_brand, this, _onSelectUIClosed).call(this));\n this.components.set('filter_by_condition', addConfirmationHooks(conditionComponent));\n }\n if (!this.components.get('filter_operators')) {\n this.components.set('filter_operators', new OperatorsComponent(this.hot, {\n id: 'filter_operators',\n name: 'Operators'\n }));\n }\n if (!this.components.get('filter_by_condition2')) {\n const conditionComponent = new ConditionComponent(this.hot, {\n id: 'filter_by_condition2',\n name: '',\n addSeparator: true,\n menuContainer\n });\n conditionComponent.addLocalHook('afterClose', () => _assertClassBrand(_Filters_brand, this, _onSelectUIClosed).call(this));\n this.components.set('filter_by_condition2', addConfirmationHooks(conditionComponent));\n }\n if (!this.components.get('filter_by_value')) {\n this.components.set('filter_by_value', addConfirmationHooks(new ValueComponent(this.hot, {\n id: 'filter_by_value',\n name: filterValueLabel\n })));\n }\n if (!this.components.get('filter_action_bar')) {\n this.components.set('filter_action_bar', addConfirmationHooks(new ActionBarComponent(this.hot, {\n id: 'filter_action_bar',\n name: 'Action bar'\n })));\n }\n if (!this.conditionCollection) {\n this.conditionCollection = new ConditionCollection(this.hot);\n }\n if (!this.conditionUpdateObserver) {\n this.conditionUpdateObserver = new ConditionUpdateObserver(this.hot, this.conditionCollection, physicalColumn => this.getDataMapAtColumn(physicalColumn));\n this.conditionUpdateObserver.addLocalHook('update', conditionState => _assertClassBrand(_Filters_brand, this, _updateComponents).call(this, conditionState));\n }\n this.components.forEach(component => component.show());\n this.addHook('afterDropdownMenuDefaultOptions', defaultOptions => _assertClassBrand(_Filters_brand, this, _onAfterDropdownMenuDefaultOptions).call(this, defaultOptions));\n this.addHook('afterDropdownMenuShow', () => _assertClassBrand(_Filters_brand, this, _onAfterDropdownMenuShow).call(this));\n this.addHook('afterDropdownMenuHide', () => _assertClassBrand(_Filters_brand, this, _onAfterDropdownMenuHide).call(this));\n this.addHook('afterChange', changes => _assertClassBrand(_Filters_brand, this, _onAfterChange).call(this, changes));\n\n // Temp. solution (extending menu items bug in contextMenu/dropdownMenu)\n if (this.hot.getSettings().dropdownMenu && this.dropdownMenuPlugin) {\n this.dropdownMenuPlugin.disablePlugin();\n this.dropdownMenuPlugin.enablePlugin();\n }\n if (!_classPrivateFieldGet(_menuFocusNavigator, this) && this.dropdownMenuPlugin.enabled) {\n const mainMenu = this.dropdownMenuPlugin.menu;\n const focusableItems = [\n // A fake menu item that once focused allows escaping from the focus navigation (using Tab keys)\n // to the menu navigation using arrow keys.\n {\n focus: () => {\n const menuNavigator = mainMenu.getNavigator();\n const lastSelectedMenuItem = _classPrivateFieldGet(_menuFocusNavigator, this).getLastMenuPage();\n mainMenu.focus();\n if (lastSelectedMenuItem > 0) {\n menuNavigator.setCurrentPage(lastSelectedMenuItem);\n } else {\n menuNavigator.toFirstItem();\n }\n }\n }, ...Array.from(this.components).map(_ref => {\n let [, component] = _ref;\n return component.getElements();\n }).flat()];\n _classPrivateFieldSet(_menuFocusNavigator, this, createMenuFocusController(mainMenu, focusableItems));\n const forwardToFocusNavigation = event => {\n _classPrivateFieldGet(_menuFocusNavigator, this).listen();\n event.preventDefault();\n if (isKey(event.keyCode, 'TAB')) {\n if (event.shiftKey) {\n _classPrivateFieldGet(_menuFocusNavigator, this).toPreviousItem();\n } else {\n _classPrivateFieldGet(_menuFocusNavigator, this).toNextItem();\n }\n }\n };\n this.components.get('filter_by_value').addLocalHook('listTabKeydown', forwardToFocusNavigation);\n this.components.get('filter_by_condition').addLocalHook('selectTabKeydown', forwardToFocusNavigation);\n }\n this.registerShortcuts();\n super.enablePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n if (this.enabled) {\n var _this$dropdownMenuPlu;\n if ((_this$dropdownMenuPlu = this.dropdownMenuPlugin) !== null && _this$dropdownMenuPlu !== void 0 && _this$dropdownMenuPlu.enabled) {\n this.dropdownMenuPlugin.menu.clearLocalHooks();\n }\n this.components.forEach((component, key) => {\n component.destroy();\n this.components.set(key, null);\n });\n this.conditionCollection.destroy();\n this.conditionCollection = null;\n this.hot.rowIndexMapper.unregisterMap(this.pluginName);\n }\n this.unregisterShortcuts();\n super.disablePlugin();\n }\n\n /**\n * Register shortcuts responsible for clearing the filters.\n *\n * @private\n */\n registerShortcuts() {\n this.hot.getShortcutManager().getContext('grid').addShortcut({\n keys: [['Alt', 'A']],\n stopPropagation: true,\n callback: () => {\n const selection = this.hot.getSelected();\n this.clearConditions();\n this.filter();\n if (selection) {\n this.hot.selectCells(selection);\n }\n },\n group: SHORTCUTS_GROUP\n });\n }\n\n /**\n * Unregister shortcuts responsible for clearing the filters.\n *\n * @private\n */\n unregisterShortcuts() {\n this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);\n }\n\n /* eslint-disable jsdoc/require-description-complete-sentence */\n /**\n * @memberof Filters#\n * @function addCondition\n * @description\n * Adds condition to the conditions collection at specified column index.\n *\n * Possible predefined conditions:\n * * `begins_with` - Begins with\n * * `between` - Between\n * * `by_value` - By value\n * * `contains` - Contains\n * * `date_after` - After a date\n * * `date_before` - Before a date\n * * `date_today` - Today\n * * `date_tomorrow` - Tomorrow\n * * `date_yesterday` - Yesterday\n * * `empty` - Empty\n * * `ends_with` - Ends with\n * * `eq` - Equal\n * * `gt` - Greater than\n * * `gte` - Greater than or equal\n * * `lt` - Less than\n * * `lte` - Less than or equal\n * * `none` - None (no filter)\n * * `not_between` - Not between\n * * `not_contains` - Not contains\n * * `not_empty` - Not empty\n * * `neq` - Not equal.\n *\n * Possible operations on collection of conditions:\n * * `conjunction` - [**Conjunction**](https://en.wikipedia.org/wiki/Logical_conjunction) on conditions collection (by default), i.e. for such operation:
c1 AND c2 AND c3 AND c4 ... AND cn === TRUE, where c1 ... cn are conditions.\n * * `disjunction` - [**Disjunction**](https://en.wikipedia.org/wiki/Logical_disjunction) on conditions collection, i.e. for such operation:
c1 OR c2 OR c3 OR c4 ... OR cn === TRUE, where c1, c2, c3, c4 ... cn are conditions.\n * * `disjunctionWithExtraCondition` - **Disjunction** on first `n - 1`\\* conditions from collection with an extra requirement computed from the last condition, i.e. for such operation:
c1 OR c2 OR c3 OR c4 ... OR cn-1 AND cn === TRUE, where c1, c2, c3, c4 ... cn are conditions.\n *\n * \\* when `n` is collection size; it's used i.e. for one operation introduced from UI (when choosing from filter's drop-down menu two conditions with OR operator between them, mixed with choosing values from the multiple choice select)\n *\n * **Note**: Mind that you cannot mix different types of operations (for instance, if you use `conjunction`, use it consequently for a particular column).\n *\n * @example\n * ::: only-for javascript\n * ```js\n * const container = document.getElementById('example');\n * const hot = new Handsontable(container, {\n * data: getData(),\n * filters: true\n * });\n *\n * // access to filters plugin instance\n * const filtersPlugin = hot.getPlugin('filters');\n *\n * // add filter \"Greater than\" 95 to column at index 1\n * filtersPlugin.addCondition(1, 'gt', [95]);\n * filtersPlugin.filter();\n *\n * // add filter \"By value\" to column at index 1\n * // in this case all value's that don't match will be filtered.\n * filtersPlugin.addCondition(1, 'by_value', [['ing', 'ed', 'as', 'on']]);\n * filtersPlugin.filter();\n *\n * // add filter \"Begins with\" with value \"de\" AND \"Not contains\" with value \"ing\"\n * filtersPlugin.addCondition(1, 'begins_with', ['de'], 'conjunction');\n * filtersPlugin.addCondition(1, 'not_contains', ['ing'], 'conjunction');\n * filtersPlugin.filter();\n *\n * // add filter \"Begins with\" with value \"de\" OR \"Not contains\" with value \"ing\"\n * filtersPlugin.addCondition(1, 'begins_with', ['de'], 'disjunction');\n * filtersPlugin.addCondition(1, 'not_contains', ['ing'], 'disjunction');\n * filtersPlugin.filter();\n * ```\n * :::\n *\n * ::: only-for react\n * ```jsx\n * const hotRef = useRef(null);\n *\n * ...\n *\n * \n *\n * // access to filters plugin instance\n * const hot = hotRef.current.hotInstance;\n * const filtersPlugin = hot.getPlugin('filters');\n *\n * // add filter \"Greater than\" 95 to column at index 1\n * filtersPlugin.addCondition(1, 'gt', [95]);\n * filtersPlugin.filter();\n *\n * // add filter \"By value\" to column at index 1\n * // in this case all value's that don't match will be filtered.\n * filtersPlugin.addCondition(1, 'by_value', [['ing', 'ed', 'as', 'on']]);\n * filtersPlugin.filter();\n *\n * // add filter \"Begins with\" with value \"de\" AND \"Not contains\" with value \"ing\"\n * filtersPlugin.addCondition(1, 'begins_with', ['de'], 'conjunction');\n * filtersPlugin.addCondition(1, 'not_contains', ['ing'], 'conjunction');\n * filtersPlugin.filter();\n *\n * // add filter \"Begins with\" with value \"de\" OR \"Not contains\" with value \"ing\"\n * filtersPlugin.addCondition(1, 'begins_with', ['de'], 'disjunction');\n * filtersPlugin.addCondition(1, 'not_contains', ['ing'], 'disjunction');\n * filtersPlugin.filter();\n * ```\n * :::\n *\n * @param {number} column Visual column index.\n * @param {string} name Condition short name.\n * @param {Array} args Condition arguments.\n * @param {string} [operationId=conjunction] `id` of operation which is performed on the column.\n */\n /* eslint-enable jsdoc/require-description-complete-sentence */\n addCondition(column, name, args) {\n let operationId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : OPERATION_AND;\n const physicalColumn = this.hot.toPhysicalColumn(column);\n this.conditionCollection.addCondition(physicalColumn, {\n command: {\n key: name\n },\n args\n }, operationId);\n }\n\n /**\n * Removes conditions at specified column index.\n *\n * @param {number} column Visual column index.\n */\n removeConditions(column) {\n const physicalColumn = this.hot.toPhysicalColumn(column);\n this.conditionCollection.removeConditions(physicalColumn);\n }\n\n /**\n * Clears all conditions previously added to the collection for the specified column index or, if the column index\n * was not passed, clear the conditions for all columns.\n *\n * @param {number} [column] Visual column index.\n */\n clearConditions(column) {\n if (column === undefined) {\n this.conditionCollection.clean();\n } else {\n const physicalColumn = this.hot.toPhysicalColumn(column);\n this.conditionCollection.removeConditions(physicalColumn);\n }\n }\n\n /**\n * Filters data based on added filter conditions.\n *\n * @fires Hooks#beforeFilter\n * @fires Hooks#afterFilter\n */\n filter() {\n const {\n navigableHeaders\n } = this.hot.getSettings();\n const dataFilter = this._createDataFilter();\n const needToFilter = !this.conditionCollection.isEmpty();\n let visibleVisualRows = [];\n const conditions = this.conditionCollection.exportAllConditions();\n const allowFiltering = this.hot.runHooks('beforeFilter', conditions, this.conditionCollection.previousConditionStack);\n if (allowFiltering !== false) {\n if (needToFilter) {\n const trimmedRows = [];\n this.hot.batchExecution(() => {\n this.filtersRowsMap.clear();\n visibleVisualRows = arrayMap(dataFilter.filter(), rowData => rowData.meta.visualRow);\n const visibleVisualRowsAssertion = createArrayAssertion(visibleVisualRows);\n rangeEach(this.hot.countSourceRows() - 1, row => {\n if (!visibleVisualRowsAssertion(row)) {\n trimmedRows.push(row);\n }\n });\n arrayEach(trimmedRows, physicalRow => {\n this.filtersRowsMap.setValueAtIndex(physicalRow, true);\n });\n }, true);\n if (!navigableHeaders && !visibleVisualRows.length) {\n this.hot.deselectCell();\n }\n } else {\n this.filtersRowsMap.clear();\n }\n }\n this.hot.runHooks('afterFilter', conditions);\n this.conditionCollection.setPreviousConditionStack(null);\n this.hot.view.adjustElementsSize();\n this.hot.render();\n if (this.hot.selection.isSelected()) {\n this.hot.selectCell(navigableHeaders ? -1 : 0, this.hot.getSelectedRangeLast().highlight.col);\n }\n }\n\n /**\n * Gets last selected column index.\n *\n * @returns {{visualIndex: number, physicalIndex: number} | null} Returns `null` when a column is\n * not selected. Otherwise, returns an object with `visualIndex` and `physicalIndex` properties containing\n * the index of the column.\n */\n getSelectedColumn() {\n var _this$hot$getSelected;\n const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;\n if (!highlight) {\n return null;\n }\n return {\n visualIndex: highlight.col,\n physicalIndex: this.hot.toPhysicalColumn(highlight.col)\n };\n }\n\n /**\n * Returns handsontable source data with cell meta based on current selection.\n *\n * @param {number} [column] The physical column index. By default column index accept the value of the selected column.\n * @returns {Array} Returns array of objects where keys as row index.\n */\n getDataMapAtColumn(column) {\n const visualColumn = this.hot.toVisualColumn(column);\n const data = [];\n arrayEach(this.hot.getSourceDataAtCol(visualColumn), (value, rowIndex) => {\n var _this$hot$getDataAtCe;\n const {\n row,\n col,\n visualCol,\n visualRow,\n type,\n instance,\n dateFormat,\n locale\n } = this.hot.getCellMeta(rowIndex, visualColumn);\n const dataValue = (_this$hot$getDataAtCe = this.hot.getDataAtCell(this.hot.toVisualRow(rowIndex), visualColumn)) !== null && _this$hot$getDataAtCe !== void 0 ? _this$hot$getDataAtCe : value;\n data.push({\n meta: {\n row,\n col,\n visualCol,\n visualRow,\n type,\n instance,\n dateFormat,\n locale\n },\n value: toEmptyString(dataValue)\n });\n });\n return data;\n }\n /**\n * Update the condition of ValueComponent, based on the handled changes.\n *\n * @private\n * @param {number} columnIndex Column index of handled ValueComponent condition.\n */\n updateValueComponentCondition(columnIndex) {\n const dataAtCol = this.hot.getDataAtCol(columnIndex);\n const selectedValues = unifyColumnValues(dataAtCol);\n this.conditionUpdateObserver.updateStatesAtColumn(columnIndex, selectedValues);\n }\n\n /**\n * Restores components to its saved state.\n *\n * @private\n * @param {Array} components List of components.\n */\n restoreComponents(components) {\n var _this$getSelectedColu;\n const physicalIndex = (_this$getSelectedColu = this.getSelectedColumn()) === null || _this$getSelectedColu === void 0 ? void 0 : _this$getSelectedColu.physicalIndex;\n components.forEach(component => {\n if (component.isHidden()) {\n return;\n }\n component.restoreState(physicalIndex);\n });\n this.updateDependentComponentsVisibility();\n }\n\n /**\n * After dropdown menu show listener.\n */\n\n /**\n * Get an operation, based on the number and types of arguments (where arguments are states of components).\n *\n * @param {string} suggestedOperation Operation which was chosen by user from UI.\n * @param {object} byConditionState1 State of first condition component.\n * @param {object} byConditionState2 State of second condition component.\n * @param {object} byValueState State of value component.\n * @private\n * @returns {string}\n */\n getOperationBasedOnArguments(suggestedOperation, byConditionState1, byConditionState2, byValueState) {\n let operation = suggestedOperation;\n if (operation === OPERATION_OR && byConditionState1.command.key !== CONDITION_NONE && byConditionState2.command.key !== CONDITION_NONE && byValueState.command.key !== CONDITION_NONE) {\n operation = OPERATION_OR_THEN_VARIABLE;\n } else if (byValueState.command.key !== CONDITION_NONE) {\n if (byConditionState1.command.key === CONDITION_NONE || byConditionState2.command.key === CONDITION_NONE) {\n operation = OPERATION_AND;\n }\n }\n return operation;\n }\n\n /**\n * On action bar submit listener.\n *\n * @private\n * @param {string} submitType The submit type.\n */\n\n /**\n * Listen to the keyboard input on document body and forward events to instance of Handsontable\n * created by DropdownMenu plugin.\n *\n * @private\n */\n setListeningDropdownMenu() {\n if (this.dropdownMenuPlugin) {\n this.dropdownMenuPlugin.setListening();\n }\n }\n\n /**\n * Updates visibility of some of the components, based on the state of the parent component.\n *\n * @private\n */\n updateDependentComponentsVisibility() {\n const component = this.components.get('filter_by_condition');\n const {\n command\n } = component.getState();\n const componentsToShow = [this.components.get('filter_by_condition2'), this.components.get('filter_operators')];\n if (command.showOperators) {\n this.showComponents(...componentsToShow);\n } else {\n this.hideComponents(...componentsToShow);\n }\n }\n\n /**\n * On after get column header listener.\n *\n * @param {number} col Visual column index.\n * @param {HTMLTableCellElement} TH Header's TH element.\n */\n\n /**\n * Creates DataFilter instance based on condition collection.\n *\n * @private\n * @param {ConditionCollection} conditionCollection Condition collection object.\n * @returns {DataFilter}\n */\n _createDataFilter() {\n let conditionCollection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.conditionCollection;\n return new DataFilter(conditionCollection, physicalColumn => this.getDataMapAtColumn(physicalColumn));\n }\n\n /**\n * It updates the components state. The state is triggered by ConditionUpdateObserver, which\n * reacts to any condition added to the condition collection. It may be added through the UI\n * components or by API call.\n *\n * @param {object} conditionsState An object with the state generated by UI components.\n */\n\n /**\n * Returns indexes of passed components inside list of `dropdownMenu` items.\n *\n * @private\n * @param {...BaseComponent} components List of components.\n * @returns {Array}\n */\n getIndexesOfComponents() {\n const indexes = [];\n if (!this.dropdownMenuPlugin) {\n return indexes;\n }\n const menu = this.dropdownMenuPlugin.menu;\n for (var _len = arguments.length, components = new Array(_len), _key = 0; _key < _len; _key++) {\n components[_key] = arguments[_key];\n }\n arrayEach(components, component => {\n arrayEach(menu.menuItems, (item, index) => {\n if (item.key === component.getMenuItemDescriptor().key) {\n indexes.push(index);\n }\n });\n });\n return indexes;\n }\n\n /**\n * Changes visibility of component.\n *\n * @private\n * @param {boolean} visible Determine if components should be visible.\n * @param {...BaseComponent} components List of components.\n */\n changeComponentsVisibility() {\n let visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n if (!this.dropdownMenuPlugin) {\n return;\n }\n const menu = this.dropdownMenuPlugin.menu;\n const hotMenu = menu.hotMenu;\n const hiddenRows = hotMenu.getPlugin('hiddenRows');\n for (var _len2 = arguments.length, components = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n components[_key2 - 1] = arguments[_key2];\n }\n const indexes = this.getIndexesOfComponents(...components);\n if (visible) {\n hiddenRows.showRows(indexes);\n } else {\n hiddenRows.hideRows(indexes);\n }\n hotMenu.render();\n }\n\n /**\n * Hides components of filters `dropdownMenu`.\n *\n * @private\n * @param {...BaseComponent} components List of components.\n */\n hideComponents() {\n for (var _len3 = arguments.length, components = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n components[_key3] = arguments[_key3];\n }\n this.changeComponentsVisibility(false, ...components);\n }\n\n /**\n * Shows components of filters `dropdownMenu`.\n *\n * @private\n * @param {...BaseComponent} components List of components.\n */\n showComponents() {\n for (var _len4 = arguments.length, components = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n components[_key4] = arguments[_key4];\n }\n this.changeComponentsVisibility(true, ...components);\n }\n\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n if (this.enabled) {\n this.components.forEach((component, key) => {\n if (component !== null) {\n component.destroy();\n this.components.set(key, null);\n }\n });\n this.conditionCollection.destroy();\n this.conditionUpdateObserver.destroy();\n this.hot.rowIndexMapper.unregisterMap(this.pluginName);\n }\n super.destroy();\n }\n}\nfunction _onAfterChange(changes) {\n if (changes) {\n arrayEach(changes, change => {\n const [, prop] = change;\n const columnIndex = this.hot.propToCol(prop);\n if (this.conditionCollection.hasConditions(columnIndex)) {\n this.updateValueComponentCondition(columnIndex);\n }\n });\n }\n}\nfunction _onAfterDropdownMenuShow() {\n const menu = this.dropdownMenuPlugin.menu;\n this.restoreComponents(Array.from(this.components.values()));\n menu.updateMenuDimensions();\n}\n/**\n * After dropdown menu hide listener.\n */\nfunction _onAfterDropdownMenuHide() {\n this.components.get('filter_by_condition').getSelectElement().closeOptions();\n this.components.get('filter_by_condition2').getSelectElement().closeOptions();\n}\n/**\n * After dropdown menu default options listener.\n *\n * @param {object} defaultOptions ContextMenu default item options.\n */\nfunction _onAfterDropdownMenuDefaultOptions(defaultOptions) {\n defaultOptions.items.push({\n name: SEPARATOR\n });\n this.components.forEach(component => {\n defaultOptions.items.push(component.getMenuItemDescriptor());\n });\n}\nfunction _onActionBarSubmit(submitType) {\n var _this$dropdownMenuPlu3;\n if (submitType === 'accept') {\n const selectedColumn = this.getSelectedColumn();\n if (selectedColumn === null) {\n var _this$dropdownMenuPlu2;\n (_this$dropdownMenuPlu2 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu2 === void 0 || _this$dropdownMenuPlu2.close();\n return;\n }\n const {\n physicalIndex\n } = selectedColumn;\n const byConditionState1 = this.components.get('filter_by_condition').getState();\n const byConditionState2 = this.components.get('filter_by_condition2').getState();\n const byValueState = this.components.get('filter_by_value').getState();\n const operation = this.getOperationBasedOnArguments(this.components.get('filter_operators').getActiveOperationId(), byConditionState1, byConditionState2, byValueState);\n this.conditionUpdateObserver.groupChanges();\n let columnStackPosition = this.conditionCollection.getColumnStackPosition(physicalIndex);\n if (columnStackPosition === -1) {\n columnStackPosition = undefined;\n }\n this.conditionCollection.removeConditions(physicalIndex);\n if (byConditionState1.command.key !== CONDITION_NONE) {\n this.conditionCollection.addCondition(physicalIndex, byConditionState1, operation, columnStackPosition);\n if (byConditionState2.command.key !== CONDITION_NONE) {\n this.conditionCollection.addCondition(physicalIndex, byConditionState2, operation, columnStackPosition);\n }\n }\n if (byValueState.command.key !== CONDITION_NONE) {\n this.conditionCollection.addCondition(physicalIndex, byValueState, operation, columnStackPosition);\n }\n this.conditionUpdateObserver.flush();\n this.components.forEach(component => component.saveState(physicalIndex));\n this.filtersRowsMap.clear();\n this.filter();\n }\n (_this$dropdownMenuPlu3 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu3 === void 0 || _this$dropdownMenuPlu3.close();\n}\n/**\n * On component change listener.\n *\n * @param {BaseComponent} component Component inheriting BaseComponent.\n * @param {object} command Menu item object (command).\n */\nfunction _onComponentChange(component, command) {\n this.updateDependentComponentsVisibility();\n if (component.constructor === ConditionComponent && !command.inputsCount) {\n this.setListeningDropdownMenu();\n }\n}\n/**\n * On component SelectUI closed listener.\n */\nfunction _onSelectUIClosed() {\n this.setListeningDropdownMenu();\n}\nfunction _onAfterGetColHeader(col, TH) {\n const physicalColumn = this.hot.toPhysicalColumn(col);\n if (this.enabled && this.conditionCollection.hasConditions(physicalColumn)) {\n addClass(TH, 'htFiltersActive');\n } else {\n removeClass(TH, 'htFiltersActive');\n }\n}\nfunction _updateComponents(conditionsState) {\n var _this$dropdownMenuPlu4;\n if (!((_this$dropdownMenuPlu4 = this.dropdownMenuPlugin) !== null && _this$dropdownMenuPlu4 !== void 0 && _this$dropdownMenuPlu4.enabled)) {\n return;\n }\n const {\n editedConditionStack: {\n conditions,\n column\n }\n } = conditionsState;\n const conditionsByValue = conditions.filter(condition => condition.name === CONDITION_BY_VALUE);\n const conditionsWithoutByValue = conditions.filter(condition => condition.name !== CONDITION_BY_VALUE);\n if (conditionsByValue.length >= 2 || conditionsWithoutByValue.length >= 3) {\n warn(toSingleLine`The filter conditions have been applied properly, but couldn\u2019t be displayed visually.\\x20\n The overall amount of conditions exceed the capability of the dropdown menu.\\x20\n For more details see the documentation.`);\n } else {\n const operationType = this.conditionCollection.getOperation(column);\n this.components.get('filter_by_condition').updateState(conditionsWithoutByValue[0], column);\n this.components.get('filter_by_condition2').updateState(conditionsWithoutByValue[1], column);\n this.components.get('filter_operators').updateState(operationType, column);\n this.components.get('filter_by_value').updateState(conditionsState);\n }\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, Filters } from \"./filters.mjs\";", "import { PLUGIN_KEY } from \"../formulas.mjs\";\nexport const DEFAULT_LICENSE_KEY = 'internal-use-in-handsontable';\nexport const DEFAULT_SETTINGS = {\n licenseKey: DEFAULT_LICENSE_KEY,\n useArrayArithmetic: true,\n useColumnIndex: false,\n useStats: false,\n evaluateNullToZero: true,\n precisionEpsilon: 1e-13,\n precisionRounding: 14,\n smartRounding: true,\n leapYear1900: false,\n nullDate: {\n year: 1899,\n month: 12,\n day: 30\n },\n nullYear: 30,\n dateFormats: ['DD/MM/YYYY', 'DD/MM/YY'],\n timeFormats: ['hh:mm', 'hh:mm:ss.sss'],\n matchWholeCell: true,\n useRegularExpressions: false,\n useWildcards: true,\n functionArgSeparator: ',',\n thousandSeparator: '',\n decimalSeparator: '.',\n language: 'enGB'\n};\n\n/**\n * Gets a set of engine settings to be applied on top of the provided settings, based on user's Handsontable settings.\n *\n * @param {object} hotSettings Handsontable settings object.\n * @returns {object} Object containing the overriding options.\n */\nexport function getEngineSettingsOverrides(hotSettings) {\n var _hotSettings$PLUGIN_K;\n return {\n maxColumns: hotSettings.maxColumns,\n maxRows: hotSettings.maxRows,\n language: (_hotSettings$PLUGIN_K = hotSettings[PLUGIN_KEY]) === null || _hotSettings$PLUGIN_K === void 0 || (_hotSettings$PLUGIN_K = _hotSettings$PLUGIN_K.language) === null || _hotSettings$PLUGIN_K === void 0 ? void 0 : _hotSettings$PLUGIN_K.langCode\n };\n}\n\n/**\n * Drop `hyperformula` key from object if it exists.\n *\n * @param {object} pluginSettings Formulas plugin settings.\n * @returns {object}\n */\nfunction cleanEngineSettings(pluginSettings) {\n return Object.keys(pluginSettings).reduce((obj, key) => {\n if (key !== 'hyperformula') {\n obj[key] = pluginSettings[key];\n }\n return obj;\n }, {});\n}\n\n/**\n * Takes the default, user and overriding settings and merges them into a single object to be passed to the engine.\n *\n * The final object gets its parameters in the following order,\n * with properties attached to objects listed in the lower levels of the list overriding the\n * ones above them:\n *\n * 1. Default settings\n * 2. User settings\n * 3. Overrides.\n *\n * Meant to be used during *initialization* of the engine.\n *\n * @param {object} hotSettings The Handsontable settings.\n * @returns {object} The final engine settings.\n */\nexport function getEngineSettingsWithDefaultsAndOverrides(hotSettings) {\n var _pluginSettings$engin;\n const pluginSettings = hotSettings[PLUGIN_KEY];\n const userSettings = cleanEngineSettings(pluginSettings !== null && pluginSettings !== void 0 && (_pluginSettings$engin = pluginSettings.engine) !== null && _pluginSettings$engin !== void 0 && _pluginSettings$engin.hyperformula ? pluginSettings.engine : {});\n const overrides = getEngineSettingsOverrides(hotSettings);\n return {\n ...DEFAULT_SETTINGS,\n ...userSettings,\n ...overrides\n };\n}\n\n/**\n * Get engine settings from a Handsontable settings object with overrides.\n *\n * @param {object} hotSettings Handsontable settings object.\n * @returns {object}\n */\nexport function getEngineSettingsWithOverrides(hotSettings) {\n var _pluginSettings$engin2;\n const pluginSettings = hotSettings[PLUGIN_KEY];\n const userSettings = cleanEngineSettings(pluginSettings !== null && pluginSettings !== void 0 && (_pluginSettings$engin2 = pluginSettings.engine) !== null && _pluginSettings$engin2 !== void 0 && _pluginSettings$engin2.hyperformula ? pluginSettings.engine : {});\n const overrides = getEngineSettingsOverrides(hotSettings);\n return {\n ...userSettings,\n ...overrides\n };\n}\n\n/**\n * Check if the new settings are defined and are different from the ones currently used by the engine.\n *\n * @param {object} currentEngineSettings Currently used engine settings.\n * @param {object} newEngineSettings New engine settings.\n * @returns {boolean}\n */\nexport function haveEngineSettingsChanged(currentEngineSettings, newEngineSettings) {\n return Object.keys(newEngineSettings).some(settingOption => {\n return newEngineSettings[settingOption] !== undefined && newEngineSettings[settingOption] !== currentEngineSettings[settingOption];\n });\n}", "import \"core-js/modules/es.array.push.js\";\nimport staticRegister from \"../../../utils/staticRegister.mjs\";\nimport { isUndefined } from \"../../../helpers/mixed.mjs\";\nimport { toSingleLine } from \"../../../helpers/templateLiteralTag.mjs\";\nimport { warn } from \"../../../helpers/console.mjs\";\nimport { isObjectEqual } from \"../../../helpers/object.mjs\";\nimport { PLUGIN_KEY } from \"../formulas.mjs\";\nimport { DEFAULT_LICENSE_KEY, DEFAULT_SETTINGS, getEngineSettingsWithDefaultsAndOverrides } from \"./settings.mjs\";\n/**\n * Prepares and returns the collection for the engine relationship with the HoT instances.\n *\n * @returns {Map}\n */\nfunction getEngineRelationshipRegistry() {\n const registryKey = 'engine_relationship';\n const pluginStaticRegistry = staticRegister(PLUGIN_KEY);\n if (!pluginStaticRegistry.hasItem(registryKey)) {\n pluginStaticRegistry.register(registryKey, new Map());\n }\n return pluginStaticRegistry.getItem(registryKey);\n}\n\n/**\n * Prepares and returns the collection for the engine shared usage.\n *\n * @returns {Map}\n */\nfunction getSharedEngineUsageRegistry() {\n const registryKey = 'shared_engine_usage';\n const pluginStaticRegistry = staticRegister(PLUGIN_KEY);\n if (!pluginStaticRegistry.hasItem(registryKey)) {\n pluginStaticRegistry.register(registryKey, new Map());\n }\n return pluginStaticRegistry.getItem(registryKey);\n}\n\n/**\n * Setups the engine instance. It either creates a new (possibly shared) engine instance, or attaches\n * the plugin to an already-existing instance.\n *\n * @param {Handsontable} hotInstance Handsontable instance.\n * @returns {null|object} Returns the engine instance if everything worked right and `null` otherwise.\n */\nexport function setupEngine(hotInstance) {\n const hotSettings = hotInstance.getSettings();\n const pluginSettings = hotSettings[PLUGIN_KEY];\n const engineConfigItem = pluginSettings === null || pluginSettings === void 0 ? void 0 : pluginSettings.engine;\n if (pluginSettings === true) {\n return null;\n }\n if (isUndefined(engineConfigItem)) {\n return null;\n }\n\n // `engine.hyperformula` or `engine` is the engine class\n if (typeof engineConfigItem.hyperformula === 'function' || typeof engineConfigItem === 'function') {\n var _engineConfigItem$hyp;\n return registerEngine((_engineConfigItem$hyp = engineConfigItem.hyperformula) !== null && _engineConfigItem$hyp !== void 0 ? _engineConfigItem$hyp : engineConfigItem, hotSettings, hotInstance);\n\n // `engine` is the engine instance\n } else if (typeof engineConfigItem === 'object' && isUndefined(engineConfigItem.hyperformula)) {\n const engineRelationship = getEngineRelationshipRegistry();\n const sharedEngineUsage = getSharedEngineUsageRegistry().get(engineConfigItem);\n if (!engineRelationship.has(engineConfigItem)) {\n engineRelationship.set(engineConfigItem, []);\n }\n engineRelationship.get(engineConfigItem).push(hotInstance);\n if (sharedEngineUsage) {\n sharedEngineUsage.push(hotInstance.guid);\n }\n if (!engineConfigItem.getConfig().licenseKey) {\n engineConfigItem.updateConfig({\n licenseKey: DEFAULT_LICENSE_KEY\n });\n }\n if (engineConfigItem.getConfig().leapYear1900 !== DEFAULT_SETTINGS.leapYear1900 || isObjectEqual(engineConfigItem.getConfig().nullDate, DEFAULT_SETTINGS.nullDate) === false) {\n warn(toSingleLine`If you use HyperFormula with Handsontable, keep the default \\`leapYear1900\\` and \\`nullDate\\` \n settings. Otherwise, HyperFormula's dates may not sync correctly with Handsontable's dates.`);\n }\n return engineConfigItem;\n }\n return null;\n}\n\n/**\n * Registers the engine in the global register and attaches the needed event listeners.\n *\n * @param {Function} engineClass The engine class.\n * @param {object} hotSettings The Handsontable settings.\n * @param {Handsontable} hotInstance Handsontable instance.\n * @returns {object} Returns the engine instance.\n */\nexport function registerEngine(engineClass, hotSettings, hotInstance) {\n const pluginSettings = hotSettings[PLUGIN_KEY];\n const engineSettings = getEngineSettingsWithDefaultsAndOverrides(hotSettings);\n const engineRegistry = getEngineRelationshipRegistry();\n const sharedEngineRegistry = getSharedEngineUsageRegistry();\n registerCustomFunctions(engineClass, pluginSettings.functions);\n registerLanguage(engineClass, pluginSettings.language);\n\n // Create instance\n const engineInstance = engineClass.buildEmpty(engineSettings);\n\n // Add it to global registry\n engineRegistry.set(engineInstance, [hotInstance]);\n sharedEngineRegistry.set(engineInstance, [hotInstance.guid]);\n registerNamedExpressions(engineInstance, pluginSettings.namedExpressions);\n\n // Add hooks needed for cross-referencing sheets\n engineInstance.on('sheetAdded', () => {\n engineInstance.rebuildAndRecalculate();\n });\n engineInstance.on('sheetRemoved', () => {\n engineInstance.rebuildAndRecalculate();\n });\n return engineInstance;\n}\n\n/**\n * Returns the list of the Handsontable instances linked to the specific engine instance.\n *\n * @param {object} engine The engine instance.\n * @returns {Map} Returns Map with Handsontable instances.\n */\nexport function getRegisteredHotInstances(engine) {\n var _engineRegistry$get;\n const engineRegistry = getEngineRelationshipRegistry();\n const hotInstances = engineRegistry.size === 0 ? [] : Array.from((_engineRegistry$get = engineRegistry.get(engine)) !== null && _engineRegistry$get !== void 0 ? _engineRegistry$get : []);\n return new Map(hotInstances.map(hot => [hot.getPlugin('formulas').sheetId, hot]));\n}\n\n/**\n * Removes the HOT instance from the global register's engine usage array, and if there are no HOT instances left,\n * unregisters the engine itself.\n *\n * @param {object} engine The engine instance.\n * @param {string} hotInstance The Handsontable instance.\n */\nexport function unregisterEngine(engine, hotInstance) {\n if (engine) {\n const engineRegistry = getEngineRelationshipRegistry();\n const engineHotRelationship = engineRegistry.get(engine);\n const sharedEngineRegistry = getSharedEngineUsageRegistry();\n const sharedEngineUsage = sharedEngineRegistry.get(engine);\n if (engineHotRelationship && engineHotRelationship.includes(hotInstance)) {\n engineHotRelationship.splice(engineHotRelationship.indexOf(hotInstance), 1);\n if (engineHotRelationship.length === 0) {\n engineRegistry.delete(engine);\n }\n }\n if (sharedEngineUsage && sharedEngineUsage.includes(hotInstance.guid)) {\n sharedEngineUsage.splice(sharedEngineUsage.indexOf(hotInstance.guid), 1);\n if (sharedEngineUsage.length === 0) {\n sharedEngineRegistry.delete(engine);\n engine.destroy();\n }\n }\n }\n}\n\n/**\n * Registers the custom functions for the engine.\n *\n * @param {Function} engineClass The engine class.\n * @param {Array} customFunctions The custom functions array.\n */\nexport function registerCustomFunctions(engineClass, customFunctions) {\n if (customFunctions) {\n customFunctions.forEach(func => {\n const {\n name,\n plugin,\n translations\n } = func;\n try {\n engineClass.registerFunction(name, plugin, translations);\n } catch (e) {\n warn(e.message);\n }\n });\n }\n}\n\n/**\n * Registers the provided language for the engine.\n *\n * @param {Function} engineClass The engine class.\n * @param {object} languageSetting The engine's language object.\n */\nexport function registerLanguage(engineClass, languageSetting) {\n if (languageSetting) {\n const {\n langCode\n } = languageSetting;\n try {\n engineClass.registerLanguage(langCode, languageSetting);\n } catch (e) {\n warn(e.message);\n }\n }\n}\n\n/**\n * Registers the provided named expressions in the engine instance.\n *\n * @param {object} engineInstance The engine instance.\n * @param {Array} namedExpressions Array of the named expressions to be registered.\n */\nexport function registerNamedExpressions(engineInstance, namedExpressions) {\n if (namedExpressions) {\n engineInstance.suspendEvaluation();\n namedExpressions.forEach(namedExp => {\n const {\n name,\n expression,\n scope,\n options\n } = namedExp;\n try {\n engineInstance.addNamedExpression(name, expression, scope, options);\n } catch (e) {\n warn(e.message);\n }\n });\n engineInstance.resumeEvaluation();\n }\n}\n\n/**\n * Sets up a new sheet.\n *\n * @param {object} engineInstance The engine instance.\n * @param {string} sheetName The new sheet name.\n * @returns {*}\n */\nexport function setupSheet(engineInstance, sheetName) {\n if (isUndefined(sheetName) || !engineInstance.doesSheetExist(sheetName)) {\n sheetName = engineInstance.addSheet(sheetName);\n }\n return sheetName;\n}", "import moment from 'moment';\nconst DEFAULT_DATE_FORMAT_HYPERFORMULA = 'DD/MM/YYYY';\n\n/**\n * Checks if provided formula expression is escaped.\n *\n * @param {*} expression Expression to check.\n * @returns {boolean}\n */\nexport function isEscapedFormulaExpression(expression) {\n return typeof expression === 'string' && expression.charAt(0) === '\\'' && expression.charAt(1) === '=';\n}\n\n/**\n * Replaces escaped formula expression into valid non-unescaped string.\n *\n * @param {string} expression Expression to process.\n * @returns {string}\n */\nexport function unescapeFormulaExpression(expression) {\n return isEscapedFormulaExpression(expression) ? expression.substr(1) : expression;\n}\n\n/**\n * Checks whether string looks like formula or not. Corresponds to {@link https://hyperformula.handsontable.com/api/globals.html#isformula|HyperFormula's implementation}.\n *\n * @param {string} value Checked value.\n * @returns {boolean}\n */\nexport function isFormula(value) {\n return typeof value === 'string' && value.startsWith('=');\n}\n\n/**\n * Checks if provided value is a date according to cell meta.\n *\n * @param {*} value Checked value.\n * @param {string} cellType Type of a cell.\n * @returns {boolean}\n */\nexport function isDate(value, cellType) {\n return typeof value === 'string' && cellType === 'date';\n}\n\n/**\n * Checks if provided date is a valid date according to cell date format.\n *\n * @param {*} date Checked date.\n * @param {object} dateFormat Handled format for a date.\n * @returns {boolean}\n */\nexport function isDateValid(date, dateFormat) {\n return moment(date, dateFormat, true).isValid();\n}\n\n/**\n * Returns date formatted in HF's default format.\n *\n * @param {string} date Date formatted according to Handsontable cell date format.\n * @param {string} dateFormat The format used for the date passed.\n * @returns {string}\n */\nexport function getDateInHfFormat(date, dateFormat) {\n return moment(date, dateFormat, true).format(DEFAULT_DATE_FORMAT_HYPERFORMULA);\n}\n\n/**\n * Returns date formatted in HF's default format.\n *\n * @param {string} date Date formatted according to Handsontable cell date format.\n * @param {string} dateFormat The format used for the date passed.\n * @returns {string}\n */\nexport function getDateInHotFormat(date, dateFormat) {\n return moment(date, DEFAULT_DATE_FORMAT_HYPERFORMULA, true).format(dateFormat);\n}\n\n/**\n * Converts Excel-like dates into strings and formats them based on the handled date format.\n *\n * @param {number} numericDate An integer representing numbers of days from January 1, 1900.\n * @param {string} dateFormat The format used for parsing an output.\n * @returns {string}\n */\nexport function getDateFromExcelDate(numericDate, dateFormat) {\n // To replicate the behavior from the HyperFormula. UTC starts from 31/12/1899, while HF from 30/12/1899.\n const dateOffset = -1;\n\n // Based on solution from: https://stackoverflow.com/a/67130235.\n const dateForFormatting = new Date(Date.UTC(0, 0, numericDate + dateOffset));\n return moment(dateForFormatting).format(dateFormat);\n}", "import \"core-js/modules/es.array.push.js\";\n/**\n * Gets first position where to move element (respecting the fact that some element will be sooner or later\n * taken out of the dataset in order to move them).\n *\n * @param {Array} movedIndexes Sequence of moved indexes for certain axis.\n * @param {number} finalIndex Final place where to move rows.\n * @param {number} numberOfIndexes Number of indexes in a dataset.\n * @returns {number} Index informing where to move the first element.\n */\nfunction getMoveLine(movedIndexes, finalIndex, numberOfIndexes) {\n const notMovedElements = Array.from(Array(numberOfIndexes).keys()).filter(index => movedIndexes.includes(index) === false);\n if (finalIndex === 0) {\n var _notMovedElements$fin;\n return (_notMovedElements$fin = notMovedElements[finalIndex]) !== null && _notMovedElements$fin !== void 0 ? _notMovedElements$fin : 0; // Moving before the first dataset's element.\n }\n return notMovedElements[finalIndex - 1] + 1; // Moving before another element.\n}\n\n/**\n * Gets initially calculated move positions.\n *\n * @param {Array} movedIndexes Sequence of moved indexes for certain axis.\n * @param {number} moveLine Final place where to move rows.\n * @returns {Array<{from: number, to: number}>} Initially calculated move positions.\n */\nfunction getInitiallyCalculatedMoves(movedIndexes, moveLine) {\n const moves = [];\n movedIndexes.forEach(movedIndex => {\n const move = {\n from: movedIndex,\n to: moveLine\n };\n moves.forEach(previouslyMovedIndex => {\n const isMovingFromEndToStart = previouslyMovedIndex.from > previouslyMovedIndex.to;\n const isMovingElementBefore = previouslyMovedIndex.to <= move.from;\n const isMovingAfterElement = previouslyMovedIndex.from > move.from;\n if (isMovingAfterElement && isMovingElementBefore && isMovingFromEndToStart) {\n move.from += 1;\n }\n });\n\n // Moved element from right to left (or bottom to top).\n if (move.from >= moveLine) {\n moveLine += 1;\n }\n moves.push(move);\n });\n return moves;\n}\n\n/**\n * Gets finally calculated move positions (after adjusting).\n *\n * @param {Array<{from: number, to: number}>} moves Initially calculated move positions.\n * @returns {Array<{from: number, to: number}>} Finally calculated move positions (after adjusting).\n */\nfunction adjustedCalculatedMoves(moves) {\n moves.forEach((move, index) => {\n const nextMoved = moves.slice(index + 1);\n nextMoved.forEach(nextMovedIndex => {\n const isMovingFromStartToEnd = nextMovedIndex.from < nextMovedIndex.to;\n if (nextMovedIndex.from > move.from && isMovingFromStartToEnd) {\n nextMovedIndex.from -= 1;\n }\n });\n });\n return moves;\n}\n\n/**\n * Get list of move positions.\n *\n * @param {Array} movedIndexes Sequence of moved indexes for certain axis.\n * @param {number} finalIndex Final place where to move rows.\n * @param {number} numberOfIndexes Number of indexes in a dataset.\n * @returns {Array<{from: number, to: number}>}\n */\nexport function getMoves(movedIndexes, finalIndex, numberOfIndexes) {\n const moves = getInitiallyCalculatedMoves(movedIndexes, getMoveLine(movedIndexes, finalIndex, numberOfIndexes));\n return adjustedCalculatedMoves(moves);\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { toUpperCaseFirst } from \"../../../helpers/string.mjs\";\nimport { getMoves } from \"../../../helpers/moves.mjs\";\n/**\n * @private\n * @class IndexSyncer\n * @description\n *\n * Indexes synchronizer responsible for providing logic for particular axis. It respects an idea to represent trimmed\n * elements in HF's engine to perform formulas calculations on them. It also provides method for translation from visual\n * row/column indexes to HF's row/column indexes.\n */\nvar _axis = /*#__PURE__*/new WeakMap();\nvar _indexMapper = /*#__PURE__*/new WeakMap();\nvar _indexSyncer = /*#__PURE__*/new WeakMap();\nvar _indexesSequence = /*#__PURE__*/new WeakMap();\nvar _movedIndexes = /*#__PURE__*/new WeakMap();\nvar _finalIndex = /*#__PURE__*/new WeakMap();\nvar _removedIndexes = /*#__PURE__*/new WeakMap();\nclass AxisSyncer {\n constructor(axis, indexMapper, indexSyncer) {\n /**\n * The axis for which the actions are performed.\n *\n * @private\n * @type {'row'|'column'}\n */\n _classPrivateFieldInitSpec(this, _axis, void 0);\n /**\n * Reference to index mapper.\n *\n * @private\n * @type {IndexMapper}\n */\n _classPrivateFieldInitSpec(this, _indexMapper, void 0);\n /**\n * The index synchronizer for both axis (is storing some more general information).\n *\n * @private\n * @type {IndexSyncer}\n */\n _classPrivateFieldInitSpec(this, _indexSyncer, void 0);\n /**\n * Sequence of physical indexes stored for watching changes and calculating some transformations.\n *\n * @private\n * @type {Array}\n */\n _classPrivateFieldInitSpec(this, _indexesSequence, []);\n /**\n * List of moved HF indexes, stored before performing move on HOT to calculate transformation needed on HF's engine.\n *\n * @private\n * @type {Array}\n */\n _classPrivateFieldInitSpec(this, _movedIndexes, []);\n /**\n * Final HF's place where to move indexes, stored before performing move on HOT to calculate transformation needed on HF's engine.\n *\n * @private\n * @type {number|undefined}\n */\n _classPrivateFieldInitSpec(this, _finalIndex, void 0);\n /**\n * List of removed HF indexes, stored before performing removal on HOT to calculate transformation needed on HF's engine.\n *\n * @private\n * @type {Array}\n */\n _classPrivateFieldInitSpec(this, _removedIndexes, []);\n _classPrivateFieldSet(_axis, this, axis);\n _classPrivateFieldSet(_indexMapper, this, indexMapper);\n _classPrivateFieldSet(_indexSyncer, this, indexSyncer);\n }\n\n /**\n * Sets removed HF indexes (it should be done right before performing move on HOT).\n *\n * @param {Array} removedIndexes List of removed physical indexes.\n * @returns {Array} List of removed visual indexes.\n */\n setRemovedHfIndexes(removedIndexes) {\n _classPrivateFieldSet(_removedIndexes, this, removedIndexes.map(physicalIndex => {\n const visualIndex = _classPrivateFieldGet(_indexMapper, this).getVisualFromPhysicalIndex(physicalIndex);\n return this.getHfIndexFromVisualIndex(visualIndex);\n }));\n return _classPrivateFieldGet(_removedIndexes, this);\n }\n\n /**\n * Gets removed HF indexes (right before performing removal on HOT).\n *\n * @returns {Array} List of removed HF indexes.\n */\n getRemovedHfIndexes() {\n return _classPrivateFieldGet(_removedIndexes, this);\n }\n\n /**\n * Gets corresponding HyperFormula index for particular visual index. It's respecting the idea that HF's engine\n * is fed also with trimmed indexes (business requirements for formula result calculation also for trimmed elements).\n *\n * @param {number} visualIndex Visual index.\n * @returns {number}\n */\n getHfIndexFromVisualIndex(visualIndex) {\n const indexesSequence = _classPrivateFieldGet(_indexMapper, this).getIndexesSequence();\n const notTrimmedIndexes = _classPrivateFieldGet(_indexMapper, this).getNotTrimmedIndexes();\n return indexesSequence.indexOf(notTrimmedIndexes[visualIndex]);\n }\n\n /**\n * Synchronizes moves done on HOT to HF engine (based on previously calculated positions).\n *\n * @private\n * @param {Array<{from: number, to: number}>} moves Calculated HF's move positions.\n */\n syncMoves(moves) {\n const NUMBER_OF_MOVED_INDEXES = 1;\n const SYNC_MOVE_METHOD_NAME = `move${toUpperCaseFirst(_classPrivateFieldGet(_axis, this))}s`;\n _classPrivateFieldGet(_indexSyncer, this).getEngine().batch(() => {\n moves.forEach(move => {\n const moveToTheSamePosition = move.from !== move.to;\n // Moving from left to right (or top to bottom) to a line (drop index) right after already moved element.\n const anotherMoveWithoutEffect = move.from + 1 !== move.to;\n if (moveToTheSamePosition && anotherMoveWithoutEffect) {\n _classPrivateFieldGet(_indexSyncer, this).getEngine()[SYNC_MOVE_METHOD_NAME](_classPrivateFieldGet(_indexSyncer, this).getSheetId(), move.from, NUMBER_OF_MOVED_INDEXES, move.to);\n }\n });\n });\n }\n\n /**\n * Stores information about performed HOT moves for purpose of calculating where to move HF elements.\n *\n * @param {Array} movedVisualIndexes Sequence of moved visual indexes for certain axis.\n * @param {number} visualFinalIndex Final visual place where to move HOT indexes.\n * @param {boolean} movePossible Indicates if it's possible to move HOT indexes to the desired position.\n */\n storeMovesInformation(movedVisualIndexes, visualFinalIndex, movePossible) {\n if (movePossible === false) {\n return;\n }\n _classPrivateFieldSet(_movedIndexes, this, movedVisualIndexes.map(index => this.getHfIndexFromVisualIndex(index)));\n _classPrivateFieldSet(_finalIndex, this, this.getHfIndexFromVisualIndex(visualFinalIndex));\n }\n\n /**\n * Calculating where to move HF elements and performing already calculated moves.\n *\n * @param {boolean} movePossible Indicates if it was possible to move HOT indexes to the desired position.\n * @param {boolean} orderChanged Indicates if order of HOT indexes was changed by move.\n */\n calculateAndSyncMoves(movePossible, orderChanged) {\n if (_classPrivateFieldGet(_indexSyncer, this).isPerformingUndoRedo()) {\n return;\n }\n if (movePossible === false || orderChanged === false) {\n return;\n }\n const calculatedMoves = getMoves(_classPrivateFieldGet(_movedIndexes, this), _classPrivateFieldGet(_finalIndex, this), _classPrivateFieldGet(_indexMapper, this).getNumberOfIndexes());\n if (_classPrivateFieldGet(_indexSyncer, this).getSheetId() === null) {\n _classPrivateFieldGet(_indexSyncer, this).getPostponeAction(() => this.syncMoves(calculatedMoves));\n } else {\n this.syncMoves(calculatedMoves);\n }\n }\n\n /**\n * Gets callback for hook triggered after performing change of indexes order.\n *\n * @returns {Function}\n */\n getIndexesChangeSyncMethod() {\n const SYNC_ORDER_CHANGE_METHOD_NAME = `set${toUpperCaseFirst(_classPrivateFieldGet(_axis, this))}Order`;\n return source => {\n if (_classPrivateFieldGet(_indexSyncer, this).isPerformingUndoRedo()) {\n return;\n }\n const newSequence = _classPrivateFieldGet(_indexMapper, this).getIndexesSequence();\n if (source === 'update' && newSequence.length > 0) {\n const relativeTransformation = _classPrivateFieldGet(_indexesSequence, this).map(index => newSequence.indexOf(index));\n const sheetDimensions = _classPrivateFieldGet(_indexSyncer, this).getEngine().getSheetDimensions(_classPrivateFieldGet(_indexSyncer, this).getSheetId());\n let sizeForAxis;\n if (_classPrivateFieldGet(_axis, this) === 'row') {\n sizeForAxis = sheetDimensions.height;\n } else {\n sizeForAxis = sheetDimensions.width;\n }\n const numberOfReorganisedIndexes = relativeTransformation.length;\n\n // Sheet dimension can be changed by HF's engine for purpose of calculating values. It extends dependency\n // graph to calculate values outside of a defined dataset. This part of code could be removed after resolving\n // feature request from HF issue board (handsontable/hyperformula#1179).\n for (let i = numberOfReorganisedIndexes; i < sizeForAxis; i += 1) {\n relativeTransformation.push(i);\n }\n _classPrivateFieldGet(_indexSyncer, this).getEngine()[SYNC_ORDER_CHANGE_METHOD_NAME](_classPrivateFieldGet(_indexSyncer, this).getSheetId(), relativeTransformation);\n }\n _classPrivateFieldSet(_indexesSequence, this, newSequence);\n };\n }\n\n /**\n * Initialize the AxisSyncer.\n */\n init() {\n _classPrivateFieldSet(_indexesSequence, this, _classPrivateFieldGet(_indexMapper, this).getIndexesSequence());\n }\n}\nexport default AxisSyncer;", "import \"core-js/modules/es.error.cause.js\";\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport AxisSyncer from \"./axisSyncer.mjs\";\n/**\n * @private\n * @class IndexSyncer\n * @description\n *\n * Indexes synchronizer responsible for providing logic for syncing actions done on indexes for HOT to actions performed\n * on HF's.\n *\n */\nvar _rowIndexSyncer = /*#__PURE__*/new WeakMap();\nvar _columnIndexSyncer = /*#__PURE__*/new WeakMap();\nvar _postponeAction = /*#__PURE__*/new WeakMap();\nvar _isPerformingUndo = /*#__PURE__*/new WeakMap();\nvar _isPerformingRedo = /*#__PURE__*/new WeakMap();\nvar _engine = /*#__PURE__*/new WeakMap();\nvar _sheetId = /*#__PURE__*/new WeakMap();\nclass IndexSyncer {\n constructor(rowIndexMapper, columnIndexMapper, postponeAction) {\n /**\n * Indexes synchronizer for the axis of the rows.\n *\n * @private\n * @type {AxisSyncer}\n */\n _classPrivateFieldInitSpec(this, _rowIndexSyncer, void 0);\n /**\n * Indexes synchronizer for the axis of the columns.\n *\n * @private\n * @type {AxisSyncer}\n */\n _classPrivateFieldInitSpec(this, _columnIndexSyncer, void 0);\n /**\n * Method which will postpone execution of some action (needed when synchronization endpoint isn't setup yet).\n *\n * @private\n * @type {Function}\n */\n _classPrivateFieldInitSpec(this, _postponeAction, void 0);\n /**\n * Flag informing whether undo is already performed (we don't perform synchronization in such case).\n *\n * @private\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _isPerformingUndo, false);\n /**\n * Flag informing whether redo is already performed (we don't perform synchronization in such case).\n *\n * @private\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _isPerformingRedo, false);\n /**\n * The HF's engine instance which will be synced.\n *\n * @private\n * @type {HyperFormula|null}\n */\n _classPrivateFieldInitSpec(this, _engine, null);\n /**\n * HyperFormula's sheet name.\n *\n * @private\n * @type {string|null}\n */\n _classPrivateFieldInitSpec(this, _sheetId, null);\n _classPrivateFieldSet(_rowIndexSyncer, this, new AxisSyncer('row', rowIndexMapper, this));\n _classPrivateFieldSet(_columnIndexSyncer, this, new AxisSyncer('column', columnIndexMapper, this));\n _classPrivateFieldSet(_postponeAction, this, postponeAction);\n }\n\n /**\n * Gets index synchronizer for a particular axis.\n *\n * @param {'row'|'column'} indexType Type of indexes.\n * @returns {AxisSyncer}\n */\n getForAxis(indexType) {\n if (indexType === 'row') {\n return _classPrivateFieldGet(_rowIndexSyncer, this);\n }\n return _classPrivateFieldGet(_columnIndexSyncer, this);\n }\n\n /**\n * Sets flag informing whether an undo action is already performed (we don't execute synchronization in such case).\n *\n * @param {boolean} flagValue Boolean value for the flag.\n */\n setPerformUndo(flagValue) {\n _classPrivateFieldSet(_isPerformingUndo, this, flagValue);\n }\n\n /**\n * Sets flag informing whether a redo action is already performed (we don't execute synchronization in such case).\n *\n * @param {boolean} flagValue Boolean value for the flag.\n */\n setPerformRedo(flagValue) {\n _classPrivateFieldSet(_isPerformingRedo, this, flagValue);\n }\n\n /**\n * Gets information whether redo or undo action is already performed (we don't execute synchronization in such case).\n *\n * @private\n * @returns {boolean}\n */\n isPerformingUndoRedo() {\n return _classPrivateFieldGet(_isPerformingUndo, this) || _classPrivateFieldGet(_isPerformingRedo, this);\n }\n\n /**\n * Gets HyperFormula's sheet id.\n *\n * @returns {string|null}\n */\n getSheetId() {\n return _classPrivateFieldGet(_sheetId, this);\n }\n\n /**\n * Gets engine instance that will be used for handled instance of Handsontable.\n *\n * @type {HyperFormula|null}\n */\n getEngine() {\n return _classPrivateFieldGet(_engine, this);\n }\n\n /**\n * Gets method which will postpone execution of some action (needed when synchronization endpoint isn't setup yet).\n *\n * @returns {Function}\n */\n getPostponeAction() {\n return _classPrivateFieldGet(_postponeAction, this);\n }\n\n /**\n * Setups a synchronization endpoint.\n *\n * @param {HyperFormula|null} engine The HF's engine instance which will be synced.\n * @param {string|null} sheetId HyperFormula's sheet name.\n */\n setupSyncEndpoint(engine, sheetId) {\n _classPrivateFieldSet(_engine, this, engine);\n _classPrivateFieldSet(_sheetId, this, sheetId);\n _classPrivateFieldGet(_rowIndexSyncer, this).init();\n _classPrivateFieldGet(_columnIndexSyncer, this).init();\n }\n}\nexport default IndexSyncer;", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/es.json.stringify.js\";\nimport \"core-js/modules/es.set.difference.v2.js\";\nimport \"core-js/modules/es.set.intersection.v2.js\";\nimport \"core-js/modules/es.set.is-disjoint-from.v2.js\";\nimport \"core-js/modules/es.set.is-subset-of.v2.js\";\nimport \"core-js/modules/es.set.is-superset-of.v2.js\";\nimport \"core-js/modules/es.set.symmetric-difference.v2.js\";\nimport \"core-js/modules/es.set.union.v2.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport staticRegister from \"../../utils/staticRegister.mjs\";\nimport { error, warn } from \"../../helpers/console.mjs\";\nimport { isNumeric } from \"../../helpers/number.mjs\";\nimport { isDefined, isUndefined } from \"../../helpers/mixed.mjs\";\nimport { setupEngine, setupSheet, unregisterEngine, getRegisteredHotInstances } from \"./engine/register.mjs\";\nimport { isEscapedFormulaExpression, unescapeFormulaExpression, isDate, isDateValid, getDateInHfFormat, getDateFromExcelDate, getDateInHotFormat, isFormula } from \"./utils.mjs\";\nimport { getEngineSettingsWithOverrides, haveEngineSettingsChanged } from \"./engine/settings.mjs\";\nimport { isArrayOfArrays } from \"../../helpers/data.mjs\";\nimport { toUpperCaseFirst } from \"../../helpers/string.mjs\";\nimport Hooks from \"../../pluginHooks.mjs\";\nimport IndexSyncer from \"./indexSyncer/index.mjs\";\nexport const PLUGIN_KEY = 'formulas';\nexport const SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];\nexport const PLUGIN_PRIORITY = 260;\nHooks.getSingleton().register('afterNamedExpressionAdded');\nHooks.getSingleton().register('afterNamedExpressionRemoved');\nHooks.getSingleton().register('afterSheetAdded');\nHooks.getSingleton().register('afterSheetRemoved');\nHooks.getSingleton().register('afterSheetRenamed');\nHooks.getSingleton().register('afterFormulasValuesUpdate');\n\n// This function will be used for detecting changes coming from the `UndoRedo` plugin. This kind of change won't be\n// handled by whole body of listeners and therefore won't change undo/redo stack inside engine provided by HyperFormula.\n// HyperFormula's `undo` and `redo` methods will do it instead. Please keep in mind that undo/redo stacks inside\n// instances of Handsontable and HyperFormula should be synced (number of actions should be the same).\nconst isBlockedSource = source => source === 'UndoRedo.undo' || source === 'UndoRedo.redo' || source === 'auto';\n\n/**\n * This plugin allows you to perform Excel-like calculations in your business applications. It does it by an\n * integration with our other product, [HyperFormula](https://github.com/handsontable/hyperformula/), which is a\n * powerful calculation engine with an extensive number of features.\n *\n * To test out HyperFormula, see [this guide](@/guides/formulas/formula-calculation/formula-calculation.md#available-functions).\n *\n * @plugin Formulas\n * @class Formulas\n */\nvar _internalOperationPending = /*#__PURE__*/new WeakMap();\nvar _hotWasInitializedWithEmptyData = /*#__PURE__*/new WeakMap();\nvar _engineListeners = /*#__PURE__*/new WeakMap();\nvar _Formulas_brand = /*#__PURE__*/new WeakSet();\nexport class Formulas extends BasePlugin {\n constructor() {\n var _this;\n super(...arguments);\n _this = this;\n /**\n * The hook allows to translate the formula value to calculated value before it goes to the\n * validator function.\n *\n * @param {*} value The cell value to validate.\n * @param {number} visualRow The visual row index.\n * @param {number|string} prop The visual column index or property name of the column.\n * @returns {*} Returns value to validate.\n */\n _classPrivateMethodInitSpec(this, _Formulas_brand);\n /**\n * Flag used to bypass hooks in internal operations.\n *\n * @private\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _internalOperationPending, false);\n /**\n * Flag needed to mark if Handsontable was initialized with no data.\n * (Required to work around the fact, that Handsontable auto-generates sample data, when no data is provided).\n *\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _hotWasInitializedWithEmptyData, false);\n /**\n * The list of the HyperFormula listeners.\n *\n * @type {Array}\n */\n _classPrivateFieldInitSpec(this, _engineListeners, [['valuesUpdated', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _assertClassBrand(_Formulas_brand, _this, _onEngineValuesUpdated).call(_this, ...args);\n }], ['namedExpressionAdded', function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _assertClassBrand(_Formulas_brand, _this, _onEngineNamedExpressionsAdded).call(_this, ...args);\n }], ['namedExpressionRemoved', function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n return _assertClassBrand(_Formulas_brand, _this, _onEngineNamedExpressionsRemoved).call(_this, ...args);\n }], ['sheetAdded', function () {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n return _assertClassBrand(_Formulas_brand, _this, _onEngineSheetAdded).call(_this, ...args);\n }], ['sheetRenamed', function () {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n return _assertClassBrand(_Formulas_brand, _this, _onEngineSheetRenamed).call(_this, ...args);\n }], ['sheetRemoved', function () {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n return _assertClassBrand(_Formulas_brand, _this, _onEngineSheetRemoved).call(_this, ...args);\n }]]);\n /**\n * Static register used to set up one global HyperFormula instance.\n * TODO: currently used in tests, might be removed later.\n *\n * @private\n * @type {object}\n */\n _defineProperty(this, \"staticRegister\", staticRegister('formulas'));\n /**\n * The engine instance that will be used for this instance of Handsontable.\n *\n * @type {HyperFormula|null}\n */\n _defineProperty(this, \"engine\", null);\n /**\n * HyperFormula's sheet name.\n *\n * @type {string|null}\n */\n _defineProperty(this, \"sheetName\", null);\n /**\n * Index synchronizer responsible for manipulating with some general options related to indexes synchronization.\n *\n * @type {IndexSyncer|null}\n */\n _defineProperty(this, \"indexSyncer\", null);\n /**\n * Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the rows.\n *\n * @type {AxisSyncer|null}\n */\n _defineProperty(this, \"rowAxisSyncer\", null);\n /**\n * Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the columns.\n *\n * @type {AxisSyncer|null}\n */\n _defineProperty(this, \"columnAxisSyncer\", null);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n static get SETTING_KEYS() {\n return [PLUGIN_KEY, ...SETTING_KEYS];\n }\n /**\n * HyperFormula's sheet id.\n *\n * @type {number|null}\n */\n get sheetId() {\n return this.sheetName === null ? null : this.engine.getSheetId(this.sheetName);\n }\n\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link Formulas#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n /* eslint-disable no-unneeded-ternary */\n return this.hot.getSettings()[PLUGIN_KEY] ? true : false;\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n var _setupEngine,\n _this2 = this;\n if (this.enabled) {\n return;\n }\n this.engine = (_setupEngine = setupEngine(this.hot)) !== null && _setupEngine !== void 0 ? _setupEngine : this.engine;\n if (!this.engine) {\n warn('Missing the required `engine` key in the Formulas settings. Please fill it with either an' + ' engine class or an engine instance.');\n return;\n }\n\n // Useful for disabling -> enabling the plugin using `updateSettings` or the API.\n if (this.sheetName !== null && !this.engine.doesSheetExist(this.sheetName)) {\n const newSheetName = this.addSheet(this.sheetName, this.hot.getSourceDataArray());\n if (newSheetName !== false) {\n this.sheetName = newSheetName;\n }\n }\n this.addHook('beforeLoadData', function () {\n for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {\n args[_key7] = arguments[_key7];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onBeforeLoadData).call(_this2, ...args);\n });\n this.addHook('afterLoadData', function () {\n for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {\n args[_key8] = arguments[_key8];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onAfterLoadData).call(_this2, ...args);\n });\n\n // The `updateData` hooks utilize the same logic as the `loadData` hooks.\n this.addHook('beforeUpdateData', function () {\n for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {\n args[_key9] = arguments[_key9];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onBeforeLoadData).call(_this2, ...args);\n });\n this.addHook('afterUpdateData', function () {\n for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {\n args[_key10] = arguments[_key10];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onAfterLoadData).call(_this2, ...args);\n });\n this.addHook('modifyData', function () {\n for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {\n args[_key11] = arguments[_key11];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onModifyData).call(_this2, ...args);\n });\n this.addHook('modifySourceData', function () {\n for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {\n args[_key12] = arguments[_key12];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onModifySourceData).call(_this2, ...args);\n });\n this.addHook('beforeValidate', function () {\n for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {\n args[_key13] = arguments[_key13];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onBeforeValidate).call(_this2, ...args);\n });\n this.addHook('afterSetSourceDataAtCell', function () {\n for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {\n args[_key14] = arguments[_key14];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onAfterSetSourceDataAtCell).call(_this2, ...args);\n });\n this.addHook('afterSetDataAtCell', function () {\n for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {\n args[_key15] = arguments[_key15];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onAfterSetDataAtCell).call(_this2, ...args);\n });\n this.addHook('afterSetDataAtRowProp', function () {\n for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {\n args[_key16] = arguments[_key16];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onAfterSetDataAtCell).call(_this2, ...args);\n });\n this.addHook('beforeCreateRow', function () {\n for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {\n args[_key17] = arguments[_key17];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onBeforeCreateRow).call(_this2, ...args);\n });\n this.addHook('beforeCreateCol', function () {\n for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {\n args[_key18] = arguments[_key18];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onBeforeCreateCol).call(_this2, ...args);\n });\n this.addHook('afterCreateRow', function () {\n for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {\n args[_key19] = arguments[_key19];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onAfterCreateRow).call(_this2, ...args);\n });\n this.addHook('afterCreateCol', function () {\n for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {\n args[_key20] = arguments[_key20];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onAfterCreateCol).call(_this2, ...args);\n });\n this.addHook('beforeRemoveRow', function () {\n for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {\n args[_key21] = arguments[_key21];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onBeforeRemoveRow).call(_this2, ...args);\n });\n this.addHook('beforeRemoveCol', function () {\n for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {\n args[_key22] = arguments[_key22];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onBeforeRemoveCol).call(_this2, ...args);\n });\n this.addHook('afterRemoveRow', function () {\n for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {\n args[_key23] = arguments[_key23];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onAfterRemoveRow).call(_this2, ...args);\n });\n this.addHook('afterRemoveCol', function () {\n for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {\n args[_key24] = arguments[_key24];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onAfterRemoveCol).call(_this2, ...args);\n });\n this.indexSyncer = new IndexSyncer(this.hot.rowIndexMapper, this.hot.columnIndexMapper, postponedAction => {\n this.hot.addHookOnce('init', () => {\n // Engine is initialized after executing callback to `afterLoadData` hook. Thus, some actions on indexes should\n // be postponed.\n postponedAction();\n });\n });\n this.rowAxisSyncer = this.indexSyncer.getForAxis('row');\n this.columnAxisSyncer = this.indexSyncer.getForAxis('column');\n this.hot.addHook('afterRowSequenceChange', this.rowAxisSyncer.getIndexesChangeSyncMethod());\n this.hot.addHook('afterColumnSequenceChange', this.columnAxisSyncer.getIndexesChangeSyncMethod());\n this.hot.addHook('beforeRowMove', (movedRows, finalIndex, _, movePossible) => {\n this.rowAxisSyncer.storeMovesInformation(movedRows, finalIndex, movePossible);\n });\n this.hot.addHook('beforeColumnMove', (movedColumns, finalIndex, _, movePossible) => {\n this.columnAxisSyncer.storeMovesInformation(movedColumns, finalIndex, movePossible);\n });\n this.hot.addHook('afterRowMove', (movedRows, finalIndex, dropIndex, movePossible, orderChanged) => {\n this.rowAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);\n });\n this.hot.addHook('afterColumnMove', (movedColumns, finalIndex, dropIndex, movePossible, orderChanged) => {\n this.columnAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);\n });\n this.hot.addHook('beforeColumnFreeze', (column, freezePerformed) => {\n this.columnAxisSyncer.storeMovesInformation([column], this.hot.getSettings().fixedColumnsStart, freezePerformed);\n });\n this.hot.addHook('afterColumnFreeze', (_, freezePerformed) => {\n this.columnAxisSyncer.calculateAndSyncMoves(freezePerformed, freezePerformed);\n });\n this.hot.addHook('beforeColumnUnfreeze', (column, unfreezePerformed) => {\n this.columnAxisSyncer.storeMovesInformation([column], this.hot.getSettings().fixedColumnsStart - 1, unfreezePerformed);\n });\n this.hot.addHook('afterColumnUnfreeze', (_, unfreezePerformed) => {\n this.columnAxisSyncer.calculateAndSyncMoves(unfreezePerformed, unfreezePerformed);\n });\n\n // TODO: Actions related to overwriting dates from HOT format to HF default format are done as callback to this\n // hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.\n // Another hooks are triggered to late for setting HF's engine data needed for some actions.\n this.addHook('afterCellMetaReset', function () {\n for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {\n args[_key25] = arguments[_key25];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onAfterCellMetaReset).call(_this2, ...args);\n });\n\n // Handling undo actions on data just using HyperFormula's UndoRedo mechanism\n this.addHook('beforeUndo', () => {\n this.indexSyncer.setPerformUndo(true);\n this.engine.undo();\n });\n\n // Handling redo actions on data just using HyperFormula's UndoRedo mechanism\n this.addHook('beforeRedo', () => {\n this.indexSyncer.setPerformRedo(true);\n this.engine.redo();\n });\n this.addHook('afterUndo', () => {\n this.indexSyncer.setPerformUndo(false);\n });\n this.addHook('afterUndo', () => {\n this.indexSyncer.setPerformRedo(false);\n });\n this.addHook('afterDetachChild', function () {\n for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {\n args[_key26] = arguments[_key26];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onAfterDetachChild).call(_this2, ...args);\n });\n this.addHook('beforeAutofill', function () {\n for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {\n args[_key27] = arguments[_key27];\n }\n return _assertClassBrand(_Formulas_brand, _this2, _onBeforeAutofill).call(_this2, ...args);\n });\n _classPrivateFieldGet(_engineListeners, this).forEach(_ref => {\n let [eventName, listener] = _ref;\n return this.engine.on(eventName, listener);\n });\n super.enablePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n _classPrivateFieldGet(_engineListeners, this).forEach(_ref2 => {\n let [eventName, listener] = _ref2;\n return this.engine.off(eventName, listener);\n });\n unregisterEngine(this.engine, this.hot);\n this.engine = null;\n super.disablePlugin();\n }\n\n /**\n * Triggered on `updateSettings`.\n *\n * @private\n * @param {object} newSettings New set of settings passed to the `updateSettings` method.\n */\n updatePlugin(newSettings) {\n const newEngineSettings = getEngineSettingsWithOverrides(this.hot.getSettings());\n if (haveEngineSettingsChanged(this.engine.getConfig(), newEngineSettings)) {\n this.engine.updateConfig(newEngineSettings);\n }\n const pluginSettings = this.hot.getSettings()[PLUGIN_KEY];\n if (isDefined(pluginSettings) && isDefined(pluginSettings.sheetName) && pluginSettings.sheetName !== this.sheetName) {\n this.switchSheet(pluginSettings.sheetName);\n }\n\n // If no data was passed to the `updateSettings` method and no sheet is connected to the instance -> create a\n // new sheet using the currently used data. Otherwise, it will be handled by the `afterLoadData` call.\n if (!newSettings.data && this.sheetName === null) {\n const sheetName = this.hot.getSettings()[PLUGIN_KEY].sheetName;\n if (sheetName && this.engine.doesSheetExist(sheetName)) {\n this.switchSheet(this.sheetName);\n } else {\n this.sheetName = this.addSheet(sheetName !== null && sheetName !== void 0 ? sheetName : undefined, this.hot.getSourceDataArray());\n }\n }\n super.updatePlugin(newSettings);\n }\n\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n _classPrivateFieldGet(_engineListeners, this).forEach(_ref3 => {\n var _this$engine;\n let [eventName, listener] = _ref3;\n return (_this$engine = this.engine) === null || _this$engine === void 0 ? void 0 : _this$engine.off(eventName, listener);\n });\n _classPrivateFieldSet(_engineListeners, this, null);\n unregisterEngine(this.engine, this.hot);\n this.engine = null;\n super.destroy();\n }\n\n /**\n * Add a sheet to the shared HyperFormula instance.\n *\n * @param {string|null} [sheetName] The new sheet name. If not provided (or a null is passed), will be\n * auto-generated by HyperFormula.\n * @param {Array} [sheetData] Data passed to the shared HyperFormula instance. Has to be declared as an array of\n * arrays - array of objects is not supported in this scenario.\n * @returns {boolean|string} `false` if the data format is unusable or it is impossible to add a new sheet to the\n * engine, the created sheet name otherwise.\n */\n addSheet(sheetName, sheetData) {\n if (isDefined(sheetData) && !isArrayOfArrays(sheetData)) {\n warn('The provided data should be an array of arrays.');\n return false;\n }\n if (sheetName !== undefined && sheetName !== null && this.engine.doesSheetExist(sheetName)) {\n warn('Sheet with the provided name already exists.');\n return false;\n }\n try {\n const actualSheetName = this.engine.addSheet(sheetName !== null && sheetName !== void 0 ? sheetName : undefined);\n if (sheetData) {\n this.engine.setSheetContent(this.engine.getSheetId(actualSheetName), sheetData);\n }\n return actualSheetName;\n } catch (e) {\n warn(e.message);\n return false;\n }\n }\n\n /**\n * Switch the sheet used as data in the Handsontable instance (it loads the data from the shared HyperFormula\n * instance).\n *\n * @param {string} sheetName Sheet name used in the shared HyperFormula instance.\n */\n switchSheet(sheetName) {\n if (!this.engine.doesSheetExist(sheetName)) {\n error(`The sheet named \\`${sheetName}\\` does not exist, switch aborted.`);\n return;\n }\n this.sheetName = sheetName;\n const serialized = this.engine.getSheetSerialized(this.sheetId);\n if (serialized.length > 0) {\n this.hot.loadData(serialized, `${toUpperCaseFirst(PLUGIN_KEY)}.switchSheet`);\n }\n }\n\n /**\n * Get the cell type under specified visual coordinates.\n *\n * @param {number} row Visual row index.\n * @param {number} column Visual column index.\n * @param {number} [sheet] The target sheet id, defaults to the current sheet.\n * @returns {string} Possible values: 'FORMULA' | 'VALUE' | 'ARRAYFORMULA' | 'EMPTY'.\n */\n getCellType(row, column) {\n let sheet = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.sheetId;\n const physicalRow = this.hot.toPhysicalRow(row);\n const physicalColumn = this.hot.toPhysicalColumn(column);\n if (physicalRow !== null && physicalColumn !== null) {\n return this.engine.getCellType({\n sheet,\n row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),\n col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)\n });\n } else {\n // Should return `EMPTY` when out of bounds (according to the test cases).\n return 'EMPTY';\n }\n }\n\n /**\n * Returns `true` if under specified visual coordinates is formula.\n *\n * @param {number} row Visual row index.\n * @param {number} column Visual column index.\n * @param {number} [sheet] The target sheet id, defaults to the current sheet.\n * @returns {boolean}\n */\n isFormulaCellType(row, column) {\n let sheet = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.sheetId;\n return this.engine.doesCellHaveFormula({\n sheet,\n row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),\n col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)\n });\n }\n\n /**\n * Renders dependent sheets (handsontable instances) based on the changes - list of the\n * recalculated dependent cells.\n *\n * @private\n * @param {object[]} dependentCells The values and location of applied changes within HF engine.\n * @param {boolean} [renderSelf] `true` if it's supposed to render itself, `false` otherwise.\n */\n renderDependentSheets(dependentCells) {\n let renderSelf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n const affectedSheetIds = new Set();\n dependentCells.forEach(change => {\n var _change$address;\n // For the Named expression the address is empty, hence the `sheetId` is undefined.\n const sheetId = change === null || change === void 0 || (_change$address = change.address) === null || _change$address === void 0 ? void 0 : _change$address.sheet;\n if (sheetId !== undefined) {\n if (!affectedSheetIds.has(sheetId)) {\n affectedSheetIds.add(sheetId);\n }\n }\n });\n getRegisteredHotInstances(this.engine).forEach((relatedHot, sheetId) => {\n if ((renderSelf || sheetId !== this.sheetId) && affectedSheetIds.has(sheetId)) {\n var _relatedHot$view;\n relatedHot.render();\n (_relatedHot$view = relatedHot.view) === null || _relatedHot$view === void 0 || _relatedHot$view.adjustElementsSize();\n }\n });\n }\n\n /**\n * Validates dependent cells based on the cells that are modified by the change.\n *\n * @private\n * @param {object[]} dependentCells The values and location of applied changes within HF engine.\n * @param {object[]} [changedCells] The values and location of applied changes by developer (through API or UI).\n */\n validateDependentCells(dependentCells) {\n let changedCells = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n const stringifyAddress = change => {\n var _change$address2;\n const {\n row,\n col,\n sheet\n } = (_change$address2 = change === null || change === void 0 ? void 0 : change.address) !== null && _change$address2 !== void 0 ? _change$address2 : {};\n return isDefined(sheet) ? `${sheet}:${row}x${col}` : '';\n };\n const changedCellsSet = new Set(changedCells.map(change => stringifyAddress(change)));\n dependentCells.forEach(change => {\n var _change$address3, _change$address4;\n const {\n row,\n col\n } = (_change$address3 = change.address) !== null && _change$address3 !== void 0 ? _change$address3 : {};\n\n // Don't try to validate cells outside of the visual part of the table.\n if (isDefined(row) === false || isDefined(col) === false || row >= this.hot.countRows() || col >= this.hot.countCols()) {\n return;\n }\n\n // For the Named expression the address is empty, hence the `sheetId` is undefined.\n const sheetId = change === null || change === void 0 || (_change$address4 = change.address) === null || _change$address4 === void 0 ? void 0 : _change$address4.sheet;\n const addressId = stringifyAddress(change);\n\n // Validate the cells that depend on the calculated formulas. Skip that cells\n // where the user directly changes the values - the Core triggers those validators.\n if (sheetId !== undefined && !changedCellsSet.has(addressId)) {\n const boundHot = getRegisteredHotInstances(this.engine).get(sheetId);\n\n // if `sheetId` is not bound to any Handsontable instance, skip the validation process\n if (!boundHot) {\n return;\n }\n\n // It will just re-render certain cell when necessary.\n boundHot.validateCell(boundHot.getDataAtCell(row, col), boundHot.getCellMeta(row, col), () => {});\n }\n });\n }\n\n /**\n * Sync a change from the change-related hooks with the engine.\n *\n * @private\n * @param {number} row Visual row index.\n * @param {number} column Visual column index.\n * @param {Handsontable.CellValue} newValue New value.\n * @returns {Array} Array of changes exported from the engine.\n */\n syncChangeWithEngine(row, column, newValue) {\n const address = {\n row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),\n col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column),\n sheet: this.sheetId\n };\n if (!this.engine.isItPossibleToSetCellContents(address)) {\n warn(`Not possible to set cell data at ${JSON.stringify(address)}`);\n return;\n }\n const cellMeta = this.hot.getCellMeta(row, column);\n if (isDate(newValue, cellMeta.type)) {\n if (isDateValid(newValue, cellMeta.dateFormat)) {\n // Rewriting date in HOT format to HF format.\n newValue = getDateInHfFormat(newValue, cellMeta.dateFormat);\n } else if (isFormula(newValue) === false) {\n // Escaping value from date parsing using \"'\" sign (HF feature).\n newValue = `'${newValue}`;\n }\n }\n return this.engine.setCellContents(address, newValue);\n }\n}\nfunction _onBeforeValidate(value, visualRow, prop) {\n const visualColumn = this.hot.propToCol(prop);\n if (this.isFormulaCellType(visualRow, visualColumn)) {\n const address = {\n row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),\n col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),\n sheet: this.sheetId\n };\n const cellMeta = this.hot.getCellMeta(visualRow, visualColumn);\n let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel-like date).\n\n if (cellMeta.type === 'date' && isNumeric(cellValue)) {\n cellValue = getDateFromExcelDate(cellValue, cellMeta.dateFormat);\n }\n\n // If `cellValue` is an object it is expected to be an error\n return typeof cellValue === 'object' && cellValue !== null ? cellValue.value : cellValue;\n }\n return value;\n}\n/**\n * `onBeforeAutofill` hook callback.\n *\n * @param {Array[]} fillData The data that was used to fill the `targetRange`. If `beforeAutofill` was used\n * and returned `[[]]`, this will be the same object that was returned from `beforeAutofill`.\n * @param {CellRange} sourceRange The range values will be filled from.\n * @param {CellRange} targetRange The range new values will be filled into.\n * @returns {boolean|*}\n */\nfunction _onBeforeAutofill(fillData, sourceRange, targetRange) {\n const {\n row: sourceTopStartRow,\n col: sourceTopStartColumn\n } = sourceRange.getTopStartCorner();\n const {\n row: sourceBottomEndRow,\n col: sourceBottomEndColumn\n } = sourceRange.getBottomEndCorner();\n const {\n row: targetTopStartRow,\n col: targetTopStartColumn\n } = targetRange.getTopStartCorner();\n const {\n row: targetBottomEndRow,\n col: targetBottomEndColumn\n } = targetRange.getBottomEndCorner();\n const engineSourceRange = {\n start: {\n row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartRow),\n col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartColumn),\n sheet: this.sheetId\n },\n end: {\n row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndRow),\n col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndColumn),\n sheet: this.sheetId\n }\n };\n const engineTargetRange = {\n start: {\n row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetTopStartRow),\n col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetTopStartColumn),\n sheet: this.sheetId\n },\n end: {\n row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndRow),\n col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndColumn),\n sheet: this.sheetId\n }\n };\n\n // Blocks the autofill operation if HyperFormula says that at least one of\n // the underlying cell's contents cannot be set.\n if (this.engine.isItPossibleToSetCellContents(engineTargetRange) === false) {\n return false;\n }\n const fillRangeData = this.engine.getFillRangeData(engineSourceRange, engineTargetRange);\n const {\n row: sourceStartRow,\n col: sourceStartColumn\n } = engineSourceRange.start;\n const {\n row: sourceEndRow,\n col: sourceEndColumn\n } = engineSourceRange.end;\n const populationRowLength = sourceEndRow - sourceStartRow + 1;\n const populationColumnLength = sourceEndColumn - sourceStartColumn + 1;\n for (let populatedRowIndex = 0; populatedRowIndex < fillRangeData.length; populatedRowIndex += 1) {\n for (let populatedColumnIndex = 0; populatedColumnIndex < fillRangeData[populatedRowIndex].length; populatedColumnIndex += 1) {\n const populatedValue = fillRangeData[populatedRowIndex][populatedColumnIndex];\n const sourceRow = sourceStartRow + populatedRowIndex % populationRowLength;\n const sourceColumn = sourceStartColumn + populatedColumnIndex % populationColumnLength;\n const sourceCellMeta = this.hot.getCellMeta(sourceRow, sourceColumn);\n if (isDate(populatedValue, sourceCellMeta.type)) {\n if (populatedValue.startsWith('\\'')) {\n // Populating values on HOT side without apostrophe.\n fillRangeData[populatedRowIndex][populatedColumnIndex] = populatedValue.slice(1);\n } else if (this.isFormulaCellType(sourceRow, sourceColumn, this.sheetId) === false) {\n // Populating date in proper format, coming from the source cell.\n fillRangeData[populatedRowIndex][populatedColumnIndex] = getDateInHotFormat(populatedValue, sourceCellMeta.dateFormat);\n }\n }\n }\n }\n return fillRangeData;\n}\n/**\n * `beforeLoadData` hook callback.\n *\n * @param {Array} sourceData Array of arrays or array of objects containing data.\n * @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.\n * @param {string} [source] Source of the call.\n */\nfunction _onBeforeLoadData(sourceData, initialLoad) {\n let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n if (source.includes(toUpperCaseFirst(PLUGIN_KEY))) {\n return;\n }\n\n // This flag needs to be defined, because not passing data to HOT results in HOT auto-generating a `null`-filled\n // initial dataset.\n _classPrivateFieldSet(_hotWasInitializedWithEmptyData, this, isUndefined(this.hot.getSettings().data));\n}\n/**\n * Callback to `afterCellMetaReset` hook which is triggered after setting cell meta.\n */\nfunction _onAfterCellMetaReset() {\n const sourceDataArray = this.hot.getSourceDataArray();\n let valueChanged = false;\n sourceDataArray.forEach((rowData, rowIndex) => {\n rowData.forEach((cellValue, columnIndex) => {\n const cellMeta = this.hot.getCellMeta(rowIndex, columnIndex);\n const dateFormat = cellMeta.dateFormat;\n if (isDate(cellValue, cellMeta.type)) {\n valueChanged = true;\n if (isDateValid(cellValue, dateFormat)) {\n // Rewriting date in HOT format to HF format.\n sourceDataArray[rowIndex][columnIndex] = getDateInHfFormat(cellValue, dateFormat);\n } else if (this.isFormulaCellType(rowIndex, columnIndex) === false) {\n // Escaping value from date parsing using \"'\" sign (HF feature).\n sourceDataArray[rowIndex][columnIndex] = `'${cellValue}`;\n }\n }\n });\n });\n if (valueChanged === true) {\n _classPrivateFieldSet(_internalOperationPending, this, true);\n this.engine.setSheetContent(this.sheetId, sourceDataArray);\n _classPrivateFieldSet(_internalOperationPending, this, false);\n }\n}\n/**\n * `afterLoadData` hook callback.\n *\n * @param {Array} sourceData Array of arrays or array of objects containing data.\n * @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.\n * @param {string} [source] Source of the call.\n */\nfunction _onAfterLoadData(sourceData, initialLoad) {\n let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n if (source.includes(toUpperCaseFirst(PLUGIN_KEY))) {\n return;\n }\n this.sheetName = setupSheet(this.engine, this.hot.getSettings()[PLUGIN_KEY].sheetName);\n if (!_classPrivateFieldGet(_hotWasInitializedWithEmptyData, this)) {\n const sourceDataArray = this.hot.getSourceDataArray();\n if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {\n _classPrivateFieldSet(_internalOperationPending, this, true);\n const dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);\n this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);\n this.renderDependentSheets(dependentCells);\n _classPrivateFieldSet(_internalOperationPending, this, false);\n }\n } else {\n this.switchSheet(this.sheetName);\n }\n}\n/**\n * `modifyData` hook callback.\n *\n * @param {number} physicalRow Physical row index.\n * @param {number} visualColumn Visual column index.\n * @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`\n * property.\n * @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).\n */\nfunction _onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {\n if (ioMode !== 'get' || _classPrivateFieldGet(_internalOperationPending, this) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {\n return;\n }\n const visualRow = this.hot.toVisualRow(physicalRow);\n if (visualRow === null || visualColumn === null) {\n return;\n }\n\n // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.\n const isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);\n if (!isFormulaCellType) {\n const cellType = this.getCellType(visualRow, visualColumn);\n if (cellType !== 'ARRAY') {\n if (isEscapedFormulaExpression(valueHolder.value)) {\n valueHolder.value = unescapeFormulaExpression(valueHolder.value);\n }\n return;\n }\n }\n const address = {\n row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),\n col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),\n sheet: this.sheetId\n };\n let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).\n\n // TODO: Workaround. We use HOT's `getCellsMeta` method instead of HOT's `getCellMeta` method. Getting cell meta\n // using the second method lead to execution of the `cells` method. Using the `getDataAtCell` (which may be useful)\n // in a callback to the `cells` method leads to triggering the `modifyData` hook. Thus, the `onModifyData` callback\n // is executed once again and it cause creation of an infinite loop.\n let cellMeta = this.hot.getCellsMeta().find(singleCellMeta => singleCellMeta.visualRow === visualRow && singleCellMeta.visualCol === visualColumn);\n if (cellMeta === undefined) {\n cellMeta = {};\n }\n if (cellMeta.type === 'date' && isNumeric(cellValue)) {\n cellValue = getDateFromExcelDate(cellValue, cellMeta.dateFormat);\n }\n\n // If `cellValue` is an object it is expected to be an error\n const value = typeof cellValue === 'object' && cellValue !== null ? cellValue.value : cellValue;\n valueHolder.value = value;\n}\n/**\n * `modifySourceData` hook callback.\n *\n * @param {number} row Physical row index.\n * @param {number|string} columnOrProp Physical column index or prop.\n * @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`\n * property.\n * @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).\n */\nfunction _onModifySourceData(row, columnOrProp, valueHolder, ioMode) {\n if (ioMode !== 'get' || _classPrivateFieldGet(_internalOperationPending, this) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {\n return;\n }\n const visualRow = this.hot.toVisualRow(row);\n const visualColumn = this.hot.propToCol(columnOrProp);\n if (visualRow === null || visualColumn === null) {\n return;\n }\n\n // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.\n const isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);\n if (!isFormulaCellType) {\n const cellType = this.getCellType(visualRow, visualColumn);\n if (cellType !== 'ARRAY') {\n return;\n }\n }\n const dimensions = this.engine.getSheetDimensions(this.engine.getSheetId(this.sheetName));\n\n // Don't actually change the source data if HyperFormula is not\n // initialized yet. This is done to allow the `afterLoadData` hook to\n // load the existing source data with `Handsontable#getSourceDataArray`\n // properly.\n if (dimensions.width === 0 && dimensions.height === 0) {\n return;\n }\n const address = {\n row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),\n col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),\n sheet: this.sheetId\n };\n valueHolder.value = this.engine.getCellSerialized(address);\n}\n/**\n * `onAfterSetDataAtCell` hook callback.\n *\n * @param {Array[]} changes An array of changes in format [[row, prop, oldValue, value], ...].\n * @param {string} [source] String that identifies source of hook call\n * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).\n */\nfunction _onAfterSetDataAtCell(changes, source) {\n if (isBlockedSource(source)) {\n return;\n }\n const outOfBoundsChanges = [];\n const changedCells = [];\n const dependentCells = this.engine.batch(() => {\n changes.forEach(_ref4 => {\n let [visualRow, prop,, newValue] = _ref4;\n const visualColumn = this.hot.propToCol(prop);\n const physicalRow = this.hot.toPhysicalRow(visualRow);\n const physicalColumn = this.hot.toPhysicalColumn(visualColumn);\n const address = {\n row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),\n col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),\n sheet: this.sheetId\n };\n if (physicalRow !== null && physicalColumn !== null) {\n this.syncChangeWithEngine(visualRow, visualColumn, newValue);\n } else {\n outOfBoundsChanges.push([visualRow, visualColumn, newValue]);\n }\n changedCells.push({\n address\n });\n });\n });\n if (outOfBoundsChanges.length) {\n // Workaround for rows/columns being created two times (by HOT and the engine).\n // (unfortunately, this requires an extra re-render)\n this.hot.addHookOnce('afterChange', () => {\n const outOfBoundsDependentCells = this.engine.batch(() => {\n outOfBoundsChanges.forEach(_ref5 => {\n let [row, column, newValue] = _ref5;\n this.syncChangeWithEngine(row, column, newValue);\n });\n });\n this.renderDependentSheets(outOfBoundsDependentCells, true);\n });\n }\n this.renderDependentSheets(dependentCells);\n this.validateDependentCells(dependentCells, changedCells);\n}\n/**\n * `onAfterSetSourceDataAtCell` hook callback.\n *\n * @param {Array[]} changes An array of changes in format [[row, column, oldValue, value], ...].\n * @param {string} [source] String that identifies source of hook call\n * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).\n */\nfunction _onAfterSetSourceDataAtCell(changes, source) {\n if (isBlockedSource(source)) {\n return;\n }\n const dependentCells = [];\n const changedCells = [];\n changes.forEach(_ref6 => {\n let [visualRow, prop,, newValue] = _ref6;\n const visualColumn = this.hot.propToCol(prop);\n if (!isNumeric(visualColumn)) {\n return;\n }\n const address = {\n row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),\n col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),\n sheet: this.sheetId\n };\n if (!this.engine.isItPossibleToSetCellContents(address)) {\n warn(`Not possible to set source cell data at ${JSON.stringify(address)}`);\n return;\n }\n changedCells.push({\n address\n });\n dependentCells.push(...this.engine.setCellContents(address, newValue));\n });\n this.renderDependentSheets(dependentCells);\n this.validateDependentCells(dependentCells, changedCells);\n}\n/**\n * `beforeCreateRow` hook callback.\n *\n * @param {number} visualRow Represents the visual index of first newly created row in the data source array.\n * @param {number} amount Number of newly created rows in the data source array.\n * @returns {*|boolean} If false is returned the action is canceled.\n */\nfunction _onBeforeCreateRow(visualRow, amount) {\n let hfRowIndex = this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow);\n if (visualRow >= this.hot.countRows()) {\n hfRowIndex = visualRow; // Row beyond the table boundaries.\n }\n if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {\n return false;\n }\n}\n/**\n * `beforeCreateCol` hook callback.\n *\n * @param {number} visualColumn Represents the visual index of first newly created column in the data source.\n * @param {number} amount Number of newly created columns in the data source.\n * @returns {*|boolean} If false is returned the action is canceled.\n */\nfunction _onBeforeCreateCol(visualColumn, amount) {\n let hfColumnIndex = this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn);\n if (visualColumn >= this.hot.countCols()) {\n hfColumnIndex = visualColumn; // Column beyond the table boundaries.\n }\n if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {\n return false;\n }\n}\n/**\n * `beforeRemoveRow` hook callback.\n *\n * @param {number} row Visual index of starter row.\n * @param {number} amount Amount of rows to be removed.\n * @param {number[]} physicalRows An array of physical rows removed from the data source.\n * @returns {*|boolean} If false is returned the action is canceled.\n */\nfunction _onBeforeRemoveRow(row, amount, physicalRows) {\n const hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);\n const possible = hfRows.every(hfRow => {\n return this.engine.isItPossibleToRemoveRows(this.sheetId, [hfRow, 1]);\n });\n return possible === false ? false : undefined;\n}\n/**\n * `beforeRemoveCol` hook callback.\n *\n * @param {number} col Visual index of starter column.\n * @param {number} amount Amount of columns to be removed.\n * @param {number[]} physicalColumns An array of physical columns removed from the data source.\n * @returns {*|boolean} If false is returned the action is canceled.\n */\nfunction _onBeforeRemoveCol(col, amount, physicalColumns) {\n const hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);\n const possible = hfColumns.every(hfColumn => {\n return this.engine.isItPossibleToRemoveColumns(this.sheetId, [hfColumn, 1]);\n });\n return possible === false ? false : undefined;\n}\n/**\n * `afterCreateRow` hook callback.\n *\n * @param {number} visualRow Represents the visual index of first newly created row in the data source array.\n * @param {number} amount Number of newly created rows in the data source array.\n * @param {string} [source] String that identifies source of hook call\n * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).\n */\nfunction _onAfterCreateRow(visualRow, amount, source) {\n if (isBlockedSource(source)) {\n return;\n }\n const changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);\n this.renderDependentSheets(changes);\n}\n/**\n * `afterCreateCol` hook callback.\n *\n * @param {number} visualColumn Represents the visual index of first newly created column in the data source.\n * @param {number} amount Number of newly created columns in the data source.\n * @param {string} [source] String that identifies source of hook call\n * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).\n */\nfunction _onAfterCreateCol(visualColumn, amount, source) {\n if (isBlockedSource(source)) {\n return;\n }\n const changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);\n this.renderDependentSheets(changes);\n}\n/**\n * `afterRemoveRow` hook callback.\n *\n * @param {number} row Visual index of starter row.\n * @param {number} amount An amount of removed rows.\n * @param {number[]} physicalRows An array of physical rows removed from the data source.\n * @param {string} [source] String that identifies source of hook call\n * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).\n */\nfunction _onAfterRemoveRow(row, amount, physicalRows, source) {\n if (isBlockedSource(source)) {\n return;\n }\n const descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort((a, b) => b - a); // sort numeric values descending\n\n const changes = this.engine.batch(() => {\n descendingHfRows.forEach(hfRow => {\n this.engine.removeRows(this.sheetId, [hfRow, 1]);\n });\n });\n this.renderDependentSheets(changes);\n}\n/**\n * `afterRemoveCol` hook callback.\n *\n * @param {number} col Visual index of starter column.\n * @param {number} amount An amount of removed columns.\n * @param {number[]} physicalColumns An array of physical columns removed from the data source.\n * @param {string} [source] String that identifies source of hook call\n * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).\n */\nfunction _onAfterRemoveCol(col, amount, physicalColumns, source) {\n if (isBlockedSource(source)) {\n return;\n }\n const descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort((a, b) => b - a); // sort numeric values descending\n\n const changes = this.engine.batch(() => {\n descendingHfColumns.forEach(hfColumn => {\n this.engine.removeColumns(this.sheetId, [hfColumn, 1]);\n });\n });\n this.renderDependentSheets(changes);\n}\n/**\n * `afterDetachChild` hook callback.\n * Used to sync the data of the rows detached in the Nested Rows plugin with the engine's dataset.\n *\n * @param {object} parent An object representing the parent from which the element was detached.\n * @param {object} element The detached element.\n * @param {number} finalElementRowIndex The final row index of the detached element.\n */\nfunction _onAfterDetachChild(parent, element, finalElementRowIndex) {\n var _element$__children;\n _classPrivateFieldSet(_internalOperationPending, this, true);\n const rowsData = this.hot.getSourceDataArray(finalElementRowIndex, 0, finalElementRowIndex + (((_element$__children = element.__children) === null || _element$__children === void 0 ? void 0 : _element$__children.length) || 0), this.hot.countSourceCols());\n _classPrivateFieldSet(_internalOperationPending, this, false);\n rowsData.forEach((row, relativeRowIndex) => {\n row.forEach((value, colIndex) => {\n this.engine.setCellContents({\n col: colIndex,\n row: finalElementRowIndex + relativeRowIndex,\n sheet: this.sheetId\n }, [[value]]);\n });\n });\n}\n/**\n * Called when a value is updated in the engine.\n *\n * @fires Hooks#afterFormulasValuesUpdate\n * @param {Array} changes The values and location of applied changes.\n */\nfunction _onEngineValuesUpdated(changes) {\n this.hot.runHooks('afterFormulasValuesUpdate', changes);\n}\n/**\n * Called when a named expression is added to the engine instance.\n *\n * @fires Hooks#afterNamedExpressionAdded\n * @param {string} namedExpressionName The name of the added expression.\n * @param {Array} changes The values and location of applied changes.\n */\nfunction _onEngineNamedExpressionsAdded(namedExpressionName, changes) {\n this.hot.runHooks('afterNamedExpressionAdded', namedExpressionName, changes);\n}\n/**\n * Called when a named expression is removed from the engine instance.\n *\n * @fires Hooks#afterNamedExpressionRemoved\n * @param {string} namedExpressionName The name of the removed expression.\n * @param {Array} changes The values and location of applied changes.\n */\nfunction _onEngineNamedExpressionsRemoved(namedExpressionName, changes) {\n this.hot.runHooks('afterNamedExpressionRemoved', namedExpressionName, changes);\n}\n/**\n * Called when a new sheet is added to the engine instance.\n *\n * @fires Hooks#afterSheetAdded\n * @param {string} addedSheetDisplayName The name of the added sheet.\n */\nfunction _onEngineSheetAdded(addedSheetDisplayName) {\n this.hot.runHooks('afterSheetAdded', addedSheetDisplayName);\n}\n/**\n * Called when a sheet in the engine instance is renamed.\n *\n * @fires Hooks#afterSheetRenamed\n * @param {string} oldDisplayName The old name of the sheet.\n * @param {string} newDisplayName The new name of the sheet.\n */\nfunction _onEngineSheetRenamed(oldDisplayName, newDisplayName) {\n this.sheetName = newDisplayName;\n this.hot.runHooks('afterSheetRenamed', oldDisplayName, newDisplayName);\n}\n/**\n * Called when a sheet is removed from the engine instance.\n *\n * @fires Hooks#afterSheetRemoved\n * @param {string} removedSheetDisplayName The removed sheet name.\n * @param {Array} changes The values and location of applied changes.\n */\nfunction _onEngineSheetRemoved(removedSheetDisplayName, changes) {\n this.hot.runHooks('afterSheetRemoved', removedSheetDisplayName, changes);\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, Formulas } from \"./formulas.mjs\";", "import \"core-js/modules/es.array.push.js\";\nimport * as C from \"../../../i18n/constants.mjs\";\n/**\n * @param {HiddenColumns} hiddenColumnsPlugin The plugin instance.\n * @returns {object}\n */\nexport default function hideColumnItem(hiddenColumnsPlugin) {\n return {\n key: 'hidden_columns_hide',\n name() {\n const selection = this.getSelectedLast();\n let pluralForm = 0;\n if (Array.isArray(selection)) {\n const [, fromColumn,, toColumn] = selection;\n if (fromColumn - toColumn !== 0) {\n pluralForm = 1;\n }\n }\n return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_HIDE_COLUMN, pluralForm);\n },\n callback() {\n const {\n from,\n to\n } = this.getSelectedRangeLast();\n const start = Math.max(Math.min(from.col, to.col), 0);\n const end = Math.max(from.col, to.col);\n const columnsToHide = [];\n for (let visualColumn = start; visualColumn <= end; visualColumn += 1) {\n columnsToHide.push(visualColumn);\n }\n hiddenColumnsPlugin.hideColumns(columnsToHide);\n const lastHiddenColumn = columnsToHide[columnsToHide.length - 1];\n const columnToSelect = this.columnIndexMapper.getNearestNotHiddenIndex(lastHiddenColumn, 1, true);\n if (Number.isInteger(columnToSelect) && columnToSelect >= 0) {\n this.selectColumns(columnToSelect);\n } else {\n this.deselectCell();\n }\n this.render();\n this.view.adjustElementsSize();\n },\n disabled: false,\n hidden() {\n return !(this.selection.isSelectedByColumnHeader() || this.selection.isSelectedByCorner());\n }\n };\n}", "import \"core-js/modules/es.array.push.js\";\nimport { arrayEach, arrayMap } from \"../../../helpers/array.mjs\";\nimport * as C from \"../../../i18n/constants.mjs\";\n/**\n * @param {HiddenColumns} hiddenColumnsPlugin The plugin instance.\n * @returns {object}\n */\nexport default function showColumnItem(hiddenColumnsPlugin) {\n const columns = [];\n return {\n key: 'hidden_columns_show',\n name() {\n const pluralForm = columns.length > 1 ? 1 : 0;\n return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_SHOW_COLUMN, pluralForm);\n },\n callback() {\n var _this$columnIndexMapp, _this$columnIndexMapp2;\n if (columns.length === 0) {\n return;\n }\n let startVisualColumn = columns[0];\n let endVisualColumn = columns[columns.length - 1];\n\n // Add to the selection one more visual column on the left.\n startVisualColumn = (_this$columnIndexMapp = this.columnIndexMapper.getNearestNotHiddenIndex(startVisualColumn - 1, -1)) !== null && _this$columnIndexMapp !== void 0 ? _this$columnIndexMapp : 0;\n // Add to the selection one more visual column on the right.\n endVisualColumn = (_this$columnIndexMapp2 = this.columnIndexMapper.getNearestNotHiddenIndex(endVisualColumn + 1, 1)) !== null && _this$columnIndexMapp2 !== void 0 ? _this$columnIndexMapp2 : this.countCols() - 1;\n hiddenColumnsPlugin.showColumns(columns);\n\n // We render columns at first. It was needed for getting fixed columns.\n // Please take a look at #6864 for broader description.\n this.render();\n this.view.adjustElementsSize();\n const allColumnsSelected = endVisualColumn - startVisualColumn + 1 === this.countCols();\n\n // When all headers needs to be selected then do nothing. The header selection is\n // automatically handled by corner click.\n if (!allColumnsSelected) {\n this.selectColumns(startVisualColumn, endVisualColumn);\n }\n },\n disabled: false,\n hidden() {\n const hiddenPhysicalColumns = arrayMap(hiddenColumnsPlugin.getHiddenColumns(), visualColumnIndex => {\n return this.toPhysicalColumn(visualColumnIndex);\n });\n if (!(this.selection.isSelectedByColumnHeader() || this.selection.isSelectedByCorner()) || hiddenPhysicalColumns.length < 1) {\n return true;\n }\n columns.length = 0;\n const selectedRangeLast = this.getSelectedRangeLast();\n const visualStartColumn = selectedRangeLast.getTopStartCorner().col;\n const visualEndColumn = selectedRangeLast.getBottomEndCorner().col;\n const columnIndexMapper = this.columnIndexMapper;\n const renderableStartColumn = columnIndexMapper.getRenderableFromVisualIndex(visualStartColumn);\n const renderableEndColumn = columnIndexMapper.getRenderableFromVisualIndex(visualEndColumn);\n const notTrimmedColumnIndexes = columnIndexMapper.getNotTrimmedIndexes();\n const physicalColumnIndexes = [];\n if (visualStartColumn !== visualEndColumn) {\n const visualColumnsInRange = visualEndColumn - visualStartColumn + 1;\n const renderedColumnsInRange = renderableEndColumn - renderableStartColumn + 1;\n\n // Collect not trimmed columns if there are some hidden columns in the selection range.\n if (visualColumnsInRange > renderedColumnsInRange) {\n const physicalIndexesInRange = notTrimmedColumnIndexes.slice(visualStartColumn, visualEndColumn + 1);\n physicalColumnIndexes.push(...physicalIndexesInRange.filter(physicalIndex => hiddenPhysicalColumns.includes(physicalIndex)));\n }\n\n // Handled column is the first rendered index and there are some visual indexes before it.\n } else if (renderableStartColumn === 0 && renderableStartColumn < visualStartColumn) {\n // not trimmed indexes -> array of mappings from visual (native array's index) to physical indexes (value).\n physicalColumnIndexes.push(...notTrimmedColumnIndexes.slice(0, visualStartColumn)); // physical indexes\n\n // When all columns are hidden and the context menu is triggered using top-left corner.\n } else if (renderableStartColumn === null) {\n // Show all hidden columns.\n physicalColumnIndexes.push(...notTrimmedColumnIndexes.slice(0, this.countCols()));\n } else {\n const lastVisualIndex = this.countCols() - 1;\n const lastRenderableIndex = columnIndexMapper.getRenderableFromVisualIndex(columnIndexMapper.getNearestNotHiddenIndex(lastVisualIndex, -1));\n\n // Handled column is the last rendered index and there are some visual indexes after it.\n if (renderableEndColumn === lastRenderableIndex && lastVisualIndex > visualEndColumn) {\n physicalColumnIndexes.push(...notTrimmedColumnIndexes.slice(visualEndColumn + 1));\n }\n }\n arrayEach(physicalColumnIndexes, physicalColumnIndex => {\n columns.push(this.toVisualColumn(physicalColumnIndex));\n });\n return columns.length === 0;\n }\n };\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/es.set.difference.v2.js\";\nimport \"core-js/modules/es.set.intersection.v2.js\";\nimport \"core-js/modules/es.set.is-disjoint-from.v2.js\";\nimport \"core-js/modules/es.set.is-subset-of.v2.js\";\nimport \"core-js/modules/es.set.is-superset-of.v2.js\";\nimport \"core-js/modules/es.set.symmetric-difference.v2.js\";\nimport \"core-js/modules/es.set.union.v2.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport { addClass } from \"../../helpers/dom/element.mjs\";\nimport { rangeEach } from \"../../helpers/number.mjs\";\nimport { arrayEach, arrayMap, arrayReduce } from \"../../helpers/array.mjs\";\nimport { isObject } from \"../../helpers/object.mjs\";\nimport { isUndefined } from \"../../helpers/mixed.mjs\";\nimport { SEPARATOR } from \"../contextMenu/predefinedItems/index.mjs\";\nimport Hooks from \"../../pluginHooks.mjs\";\nimport hideColumnItem from \"./contextMenuItem/hideColumn.mjs\";\nimport showColumnItem from \"./contextMenuItem/showColumn.mjs\";\nimport { HidingMap } from \"../../translations/index.mjs\";\nHooks.getSingleton().register('beforeHideColumns');\nHooks.getSingleton().register('afterHideColumns');\nHooks.getSingleton().register('beforeUnhideColumns');\nHooks.getSingleton().register('afterUnhideColumns');\nexport const PLUGIN_KEY = 'hiddenColumns';\nexport const PLUGIN_PRIORITY = 310;\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @plugin HiddenColumns\n * @class HiddenColumns\n *\n * @description\n * The `HiddenColumns` plugin lets you [hide specified columns](@/guides/columns/column-hiding/column-hiding.md).\n *\n * \"Hiding a column\" means that the hidden column doesn't get rendered as a DOM element.\n *\n * The `HiddenColumns` plugin doesn't modify the source data,\n * and doesn't participate in data transformation\n * (the shape of the data returned by the [`getData*()` methods](@/api/core.md#getdata) stays intact).\n *\n * You can set the following configuration options:\n *\n * | Option | Required | Type | Default | Description |\n * |---|---|---|---|---|\n * | `columns` | No | Array | - | [Hides specified columns by default](@/guides/columns/column-hiding/column-hiding.md#step-1-specify-columns-hidden-by-default) |\n * | `indicators` | No | Boolean | `false` | [Shows UI indicators](@/guides/columns/column-hiding/column-hiding.md#step-2-show-ui-indicators) |\n * | `copyPasteEnabled` | No | Boolean | `true` | [Sets up copy/paste behavior](@/guides/columns/column-hiding/column-hiding.md#step-4-set-up-copy-and-paste-behavior) |\n *\n * @example\n *\n * ::: only-for javascript\n * ```js\n * const container = document.getElementById('example');\n * const hot = new Handsontable(container, {\n * data: getData(),\n * hiddenColumns: {\n * copyPasteEnabled: true,\n * indicators: true,\n * columns: [1, 2, 5]\n * }\n * });\n *\n * // access the `HiddenColumns` plugin's instance\n * const hiddenColumnsPlugin = hot.getPlugin('hiddenColumns');\n *\n * // hide a single column\n * hiddenColumnsPlugin.hideColumn(1);\n *\n * // hide multiple columns\n * hiddenColumnsPlugin.hideColumn(1, 2, 9);\n *\n * // hide multiple columns as an array\n * hiddenColumnsPlugin.hideColumns([1, 2, 9]);\n *\n * // unhide a single column\n * hiddenColumnsPlugin.showColumn(1);\n *\n * // unhide multiple columns\n * hiddenColumnsPlugin.showColumn(1, 2, 9);\n *\n * // unhide multiple columns as an array\n * hiddenColumnsPlugin.showColumns([1, 2, 9]);\n *\n * // to see your changes, re-render your Handsontable instance\n * hot.render();\n * ```\n * :::\n *\n * ::: only-for react\n * ```jsx\n * const hotRef = useRef(null);\n *\n * ...\n *\n * \n *\n * // access the `HiddenColumns` plugin's instance\n * const hot = hotRef.current.hotInstance;\n * const hiddenColumnsPlugin = hot.getPlugin('hiddenColumns');\n *\n * // hide a single column\n * hiddenColumnsPlugin.hideColumn(1);\n *\n * // hide multiple columns\n * hiddenColumnsPlugin.hideColumn(1, 2, 9);\n *\n * // hide multiple columns as an array\n * hiddenColumnsPlugin.hideColumns([1, 2, 9]);\n *\n * // unhide a single column\n * hiddenColumnsPlugin.showColumn(1);\n *\n * // unhide multiple columns\n * hiddenColumnsPlugin.showColumn(1, 2, 9);\n *\n * // unhide multiple columns as an array\n * hiddenColumnsPlugin.showColumns([1, 2, 9]);\n *\n * // to see your changes, re-render your Handsontable instance\n * hot.render();\n * ```\n * :::\n */\nvar _settings = /*#__PURE__*/new WeakMap();\nvar _hiddenColumnsMap = /*#__PURE__*/new WeakMap();\nvar _HiddenColumns_brand = /*#__PURE__*/new WeakSet();\nexport class HiddenColumns extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * Adds the additional column width for the hidden column indicators.\n *\n * @param {number|undefined} width Column width.\n * @param {number} column Visual column index.\n * @returns {number}\n */\n _classPrivateMethodInitSpec(this, _HiddenColumns_brand);\n /**\n * Cached plugin settings.\n *\n * @private\n * @type {object}\n */\n _classPrivateFieldInitSpec(this, _settings, {});\n /**\n * Map of hidden columns by the plugin.\n *\n * @private\n * @type {null|HidingMap}\n */\n _classPrivateFieldInitSpec(this, _hiddenColumnsMap, null);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link HiddenColumns#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n var _this = this;\n if (this.enabled) {\n return;\n }\n const pluginSettings = this.hot.getSettings()[PLUGIN_KEY];\n if (isObject(pluginSettings)) {\n _classPrivateFieldSet(_settings, this, pluginSettings);\n if (isUndefined(pluginSettings.copyPasteEnabled)) {\n pluginSettings.copyPasteEnabled = true;\n }\n }\n _classPrivateFieldSet(_hiddenColumnsMap, this, new HidingMap());\n _classPrivateFieldGet(_hiddenColumnsMap, this).addLocalHook('init', () => _assertClassBrand(_HiddenColumns_brand, this, _onMapInit).call(this));\n this.hot.columnIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_hiddenColumnsMap, this));\n this.addHook('afterContextMenuDefaultOptions', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _assertClassBrand(_HiddenColumns_brand, _this, _onAfterContextMenuDefaultOptions).call(_this, ...args);\n });\n this.addHook('afterGetCellMeta', (row, col, cellProperties) => _assertClassBrand(_HiddenColumns_brand, this, _onAfterGetCellMeta).call(this, row, col, cellProperties));\n this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_HiddenColumns_brand, this, _onModifyColWidth).call(this, width, col), 2);\n this.addHook('afterGetColHeader', function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _assertClassBrand(_HiddenColumns_brand, _this, _onAfterGetColHeader).call(_this, ...args);\n });\n this.addHook('modifyCopyableRange', ranges => _assertClassBrand(_HiddenColumns_brand, this, _onModifyCopyableRange).call(this, ranges));\n super.enablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`hiddenColumns`](@/api/options.md#hiddencolumns)\n */\n updatePlugin() {\n this.disablePlugin();\n this.enablePlugin();\n super.updatePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n this.hot.columnIndexMapper.unregisterMap(this.pluginName);\n _classPrivateFieldSet(_settings, this, {});\n super.disablePlugin();\n this.resetCellsMeta();\n }\n\n /**\n * Shows the provided columns.\n *\n * @param {number[]} columns Array of visual column indexes.\n */\n showColumns(columns) {\n const currentHideConfig = this.getHiddenColumns();\n const isValidConfig = this.isValidConfig(columns);\n let destinationHideConfig = currentHideConfig;\n const hidingMapValues = _classPrivateFieldGet(_hiddenColumnsMap, this).getValues().slice();\n const isAnyColumnShowed = columns.length > 0;\n if (isValidConfig && isAnyColumnShowed) {\n const physicalColumns = columns.map(visualColumn => this.hot.toPhysicalColumn(visualColumn));\n\n // Preparing new values for hiding map.\n arrayEach(physicalColumns, physicalColumn => {\n hidingMapValues[physicalColumn] = false;\n });\n\n // Preparing new hiding config.\n destinationHideConfig = arrayReduce(hidingMapValues, (hiddenIndexes, isHidden, physicalIndex) => {\n if (isHidden) {\n hiddenIndexes.push(this.hot.toVisualColumn(physicalIndex));\n }\n return hiddenIndexes;\n }, []);\n }\n const continueHiding = this.hot.runHooks('beforeUnhideColumns', currentHideConfig, destinationHideConfig, isValidConfig && isAnyColumnShowed);\n if (continueHiding === false) {\n return;\n }\n if (isValidConfig && isAnyColumnShowed) {\n _classPrivateFieldGet(_hiddenColumnsMap, this).setValues(hidingMapValues);\n }\n\n // @TODO Should call once per render cycle, currently fired separately in different plugins\n this.hot.view.adjustElementsSize();\n this.hot.runHooks('afterUnhideColumns', currentHideConfig, destinationHideConfig, isValidConfig && isAnyColumnShowed, isValidConfig && destinationHideConfig.length < currentHideConfig.length);\n }\n\n /**\n * Shows a single column.\n *\n * @param {...number} column Visual column index.\n */\n showColumn() {\n for (var _len3 = arguments.length, column = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n column[_key3] = arguments[_key3];\n }\n this.showColumns(column);\n }\n\n /**\n * Hides the columns provided in the array.\n *\n * @param {number[]} columns Array of visual column indexes.\n */\n hideColumns(columns) {\n const currentHideConfig = this.getHiddenColumns();\n const isConfigValid = this.isValidConfig(columns);\n let destinationHideConfig = currentHideConfig;\n if (isConfigValid) {\n destinationHideConfig = Array.from(new Set(currentHideConfig.concat(columns)));\n }\n const continueHiding = this.hot.runHooks('beforeHideColumns', currentHideConfig, destinationHideConfig, isConfigValid);\n if (continueHiding === false) {\n return;\n }\n if (isConfigValid) {\n this.hot.batchExecution(() => {\n arrayEach(columns, visualColumn => {\n _classPrivateFieldGet(_hiddenColumnsMap, this).setValueAtIndex(this.hot.toPhysicalColumn(visualColumn), true);\n });\n }, true);\n }\n this.hot.runHooks('afterHideColumns', currentHideConfig, destinationHideConfig, isConfigValid, isConfigValid && destinationHideConfig.length > currentHideConfig.length);\n }\n\n /**\n * Hides a single column.\n *\n * @param {...number} column Visual column index.\n */\n hideColumn() {\n for (var _len4 = arguments.length, column = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n column[_key4] = arguments[_key4];\n }\n this.hideColumns(column);\n }\n\n /**\n * Returns an array of visual indexes of hidden columns.\n *\n * @returns {number[]}\n */\n getHiddenColumns() {\n return arrayMap(_classPrivateFieldGet(_hiddenColumnsMap, this).getHiddenIndexes(), physicalColumnIndex => {\n return this.hot.toVisualColumn(physicalColumnIndex);\n });\n }\n\n /**\n * Checks if the provided column is hidden.\n *\n * @param {number} column Visual column index.\n * @returns {boolean}\n */\n isHidden(column) {\n return _classPrivateFieldGet(_hiddenColumnsMap, this).getValueAtIndex(this.hot.toPhysicalColumn(column)) || false;\n }\n\n /**\n * Get if trim config is valid. Check whether all of the provided column indexes are within the bounds of the table.\n *\n * @param {Array} hiddenColumns List of hidden column indexes.\n * @returns {boolean}\n */\n isValidConfig(hiddenColumns) {\n const nrOfColumns = this.hot.countCols();\n if (Array.isArray(hiddenColumns) && hiddenColumns.length > 0) {\n return hiddenColumns.every(visualColumn => Number.isInteger(visualColumn) && visualColumn >= 0 && visualColumn < nrOfColumns);\n }\n return false;\n }\n\n /**\n * Reset all rendered cells meta.\n *\n * @private\n */\n resetCellsMeta() {\n arrayEach(this.hot.getCellsMeta(), meta => {\n if (meta) {\n meta.skipColumnOnPaste = false;\n }\n });\n }\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n _classPrivateFieldSet(_settings, this, null);\n _classPrivateFieldSet(_hiddenColumnsMap, this, null);\n super.destroy();\n }\n}\nfunction _onModifyColWidth(width, column) {\n // Hook is triggered internally only for the visible columns. Conditional will be handled for the API\n // calls of the `getColWidth` function on not visible indexes.\n if (this.isHidden(column)) {\n return 0;\n }\n if (_classPrivateFieldGet(_settings, this).indicators && (this.isHidden(column + 1) || this.isHidden(column - 1))) {\n // Add additional space for hidden column indicator.\n if (typeof width === 'number' && this.hot.hasColHeaders()) {\n return width + 15;\n }\n }\n}\n/**\n * Sets the copy-related cell meta.\n *\n * @param {number} row Visual row index.\n * @param {number} column Visual column index.\n * @param {object} cellProperties Object containing the cell properties.\n */\nfunction _onAfterGetCellMeta(row, column, cellProperties) {\n if (_classPrivateFieldGet(_settings, this).copyPasteEnabled === false && this.isHidden(column)) {\n // Cell property handled by the `Autofill` and the `CopyPaste` plugins.\n cellProperties.skipColumnOnPaste = true;\n }\n if (this.isHidden(column - 1)) {\n cellProperties.className = cellProperties.className || '';\n if (cellProperties.className.indexOf('afterHiddenColumn') === -1) {\n cellProperties.className += ' afterHiddenColumn';\n }\n } else if (cellProperties.className) {\n const classArr = cellProperties.className.split(' ');\n if (classArr.length > 0) {\n const containAfterHiddenColumn = classArr.indexOf('afterHiddenColumn');\n if (containAfterHiddenColumn > -1) {\n classArr.splice(containAfterHiddenColumn, 1);\n }\n cellProperties.className = classArr.join(' ');\n }\n }\n}\n/**\n * Modifies the copyable range, accordingly to the provided config.\n *\n * @param {Array} ranges An array of objects defining copyable cells.\n * @returns {Array}\n */\nfunction _onModifyCopyableRange(ranges) {\n // Ranges shouldn't be modified when `copyPasteEnabled` option is set to `true` (by default).\n if (_classPrivateFieldGet(_settings, this).copyPasteEnabled) {\n return ranges;\n }\n const newRanges = [];\n const pushRange = (startRow, endRow, startCol, endCol) => {\n newRanges.push({\n startRow,\n endRow,\n startCol,\n endCol\n });\n };\n arrayEach(ranges, range => {\n let isHidden = true;\n let rangeStart = 0;\n rangeEach(range.startCol, range.endCol, visualColumn => {\n if (this.isHidden(visualColumn)) {\n if (!isHidden) {\n pushRange(range.startRow, range.endRow, rangeStart, visualColumn - 1);\n }\n isHidden = true;\n } else {\n if (isHidden) {\n rangeStart = visualColumn;\n }\n if (visualColumn === range.endCol) {\n pushRange(range.startRow, range.endRow, rangeStart, visualColumn);\n }\n isHidden = false;\n }\n });\n });\n return newRanges;\n}\n/**\n * Adds the needed classes to the headers.\n *\n * @param {number} column Visual column index.\n * @param {HTMLElement} TH Header's TH element.\n */\nfunction _onAfterGetColHeader(column, TH) {\n if (!_classPrivateFieldGet(_settings, this).indicators || column < 0) {\n return;\n }\n const classList = [];\n if (column >= 1 && this.isHidden(column - 1)) {\n classList.push('afterHiddenColumn');\n }\n if (column < this.hot.countCols() - 1 && this.isHidden(column + 1)) {\n classList.push('beforeHiddenColumn');\n }\n addClass(TH, classList);\n}\n/**\n * Add Show-hide columns to context menu.\n *\n * @param {object} options An array of objects containing information about the pre-defined Context Menu items.\n */\nfunction _onAfterContextMenuDefaultOptions(options) {\n options.items.push({\n name: SEPARATOR\n }, hideColumnItem(this), showColumnItem(this));\n}\n/**\n * On map initialized hook callback.\n */\nfunction _onMapInit() {\n if (Array.isArray(_classPrivateFieldGet(_settings, this).columns)) {\n this.hideColumns(_classPrivateFieldGet(_settings, this).columns);\n }\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, HiddenColumns } from \"./hiddenColumns.mjs\";", "import \"core-js/modules/es.array.push.js\";\nimport * as C from \"../../../i18n/constants.mjs\";\n/**\n * @param {HiddenRows} hiddenRowsPlugin The plugin instance.\n * @returns {object}\n */\nexport default function hideRowItem(hiddenRowsPlugin) {\n return {\n key: 'hidden_rows_hide',\n name() {\n const selection = this.getSelectedLast();\n let pluralForm = 0;\n if (Array.isArray(selection)) {\n const [fromRow,, toRow] = selection;\n if (fromRow - toRow !== 0) {\n pluralForm = 1;\n }\n }\n return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_HIDE_ROW, pluralForm);\n },\n callback() {\n const {\n from,\n to\n } = this.getSelectedRangeLast();\n const start = Math.max(Math.min(from.row, to.row), 0);\n const end = Math.max(from.row, to.row);\n const rowsToHide = [];\n for (let visualRow = start; visualRow <= end; visualRow += 1) {\n rowsToHide.push(visualRow);\n }\n hiddenRowsPlugin.hideRows(rowsToHide);\n const lastHiddenRow = rowsToHide[rowsToHide.length - 1];\n const rowToSelect = this.rowIndexMapper.getNearestNotHiddenIndex(lastHiddenRow, 1, true);\n if (Number.isInteger(rowToSelect) && rowToSelect >= 0) {\n this.selectRows(rowToSelect);\n } else {\n this.deselectCell();\n }\n this.render();\n this.view.adjustElementsSize();\n },\n disabled: false,\n hidden() {\n return !(this.selection.isSelectedByRowHeader() || this.selection.isSelectedByCorner());\n }\n };\n}", "import \"core-js/modules/es.array.push.js\";\nimport { arrayEach, arrayMap } from \"../../../helpers/array.mjs\";\nimport * as C from \"../../../i18n/constants.mjs\";\n/**\n * @param {HiddenRows} hiddenRowsPlugin The plugin instance.\n * @returns {object}\n */\nexport default function showRowItem(hiddenRowsPlugin) {\n const rows = [];\n return {\n key: 'hidden_rows_show',\n name() {\n const pluralForm = rows.length > 1 ? 1 : 0;\n return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_SHOW_ROW, pluralForm);\n },\n callback() {\n var _this$rowIndexMapper$, _this$rowIndexMapper$2;\n if (rows.length === 0) {\n return;\n }\n let startVisualRow = rows[0];\n let endVisualRow = rows[rows.length - 1];\n\n // Add to the selection one more visual row on the top.\n startVisualRow = (_this$rowIndexMapper$ = this.rowIndexMapper.getNearestNotHiddenIndex(startVisualRow - 1, -1)) !== null && _this$rowIndexMapper$ !== void 0 ? _this$rowIndexMapper$ : 0;\n // Add to the selection one more visual row on the bottom.\n endVisualRow = (_this$rowIndexMapper$2 = this.rowIndexMapper.getNearestNotHiddenIndex(endVisualRow + 1, 1)) !== null && _this$rowIndexMapper$2 !== void 0 ? _this$rowIndexMapper$2 : this.countRows() - 1;\n hiddenRowsPlugin.showRows(rows);\n\n // We render rows at first. It was needed for getting fixed rows.\n // Please take a look at #6864 for broader description.\n this.render();\n this.view.adjustElementsSize();\n const allRowsSelected = endVisualRow - startVisualRow + 1 === this.countRows();\n\n // When all headers needs to be selected then do nothing. The header selection is\n // automatically handled by corner click.\n if (!allRowsSelected) {\n this.selectRows(startVisualRow, endVisualRow);\n }\n },\n disabled: false,\n hidden() {\n const hiddenPhysicalRows = arrayMap(hiddenRowsPlugin.getHiddenRows(), visualRowIndex => {\n return this.toPhysicalRow(visualRowIndex);\n });\n if (!(this.selection.isSelectedByRowHeader() || this.selection.isSelectedByCorner()) || hiddenPhysicalRows.length < 1) {\n return true;\n }\n rows.length = 0;\n const selectedRangeLast = this.getSelectedRangeLast();\n const visualStartRow = selectedRangeLast.getTopStartCorner().row;\n const visualEndRow = selectedRangeLast.getBottomEndCorner().row;\n const rowIndexMapper = this.rowIndexMapper;\n const renderableStartRow = rowIndexMapper.getRenderableFromVisualIndex(visualStartRow);\n const renderableEndRow = rowIndexMapper.getRenderableFromVisualIndex(visualEndRow);\n const notTrimmedRowIndexes = rowIndexMapper.getNotTrimmedIndexes();\n const physicalRowIndexes = [];\n if (visualStartRow !== visualEndRow) {\n const visualRowsInRange = visualEndRow - visualStartRow + 1;\n const renderedRowsInRange = renderableEndRow - renderableStartRow + 1;\n\n // Collect not trimmed rows if there are some hidden rows in the selection range.\n if (visualRowsInRange > renderedRowsInRange) {\n const physicalIndexesInRange = notTrimmedRowIndexes.slice(visualStartRow, visualEndRow + 1);\n physicalRowIndexes.push(...physicalIndexesInRange.filter(physicalIndex => hiddenPhysicalRows.includes(physicalIndex)));\n }\n\n // Handled row is the first rendered index and there are some visual indexes before it.\n } else if (renderableStartRow === 0 && renderableStartRow < visualStartRow) {\n // not trimmed indexes -> array of mappings from visual (native array's index) to physical indexes (value).\n physicalRowIndexes.push(...notTrimmedRowIndexes.slice(0, visualStartRow)); // physical indexes\n\n // When all rows are hidden and the context menu is triggered using top-left corner.\n } else if (renderableStartRow === null) {\n // Show all hidden rows.\n physicalRowIndexes.push(...notTrimmedRowIndexes.slice(0, this.countRows()));\n } else {\n const lastVisualIndex = this.countRows() - 1;\n const lastRenderableIndex = rowIndexMapper.getRenderableFromVisualIndex(rowIndexMapper.getNearestNotHiddenIndex(lastVisualIndex, -1));\n\n // Handled row is the last rendered index and there are some visual indexes after it.\n if (renderableEndRow === lastRenderableIndex && lastVisualIndex > visualEndRow) {\n physicalRowIndexes.push(...notTrimmedRowIndexes.slice(visualEndRow + 1));\n }\n }\n arrayEach(physicalRowIndexes, physicalRowIndex => {\n rows.push(this.toVisualRow(physicalRowIndex));\n });\n return rows.length === 0;\n }\n };\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/es.set.difference.v2.js\";\nimport \"core-js/modules/es.set.intersection.v2.js\";\nimport \"core-js/modules/es.set.is-disjoint-from.v2.js\";\nimport \"core-js/modules/es.set.is-subset-of.v2.js\";\nimport \"core-js/modules/es.set.is-superset-of.v2.js\";\nimport \"core-js/modules/es.set.symmetric-difference.v2.js\";\nimport \"core-js/modules/es.set.union.v2.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport { addClass } from \"../../helpers/dom/element.mjs\";\nimport { rangeEach } from \"../../helpers/number.mjs\";\nimport { arrayEach, arrayMap, arrayReduce } from \"../../helpers/array.mjs\";\nimport { isObject } from \"../../helpers/object.mjs\";\nimport { isUndefined } from \"../../helpers/mixed.mjs\";\nimport { SEPARATOR } from \"../contextMenu/predefinedItems/index.mjs\";\nimport Hooks from \"../../pluginHooks.mjs\";\nimport hideRowItem from \"./contextMenuItem/hideRow.mjs\";\nimport showRowItem from \"./contextMenuItem/showRow.mjs\";\nimport { HidingMap } from \"../../translations/index.mjs\";\nHooks.getSingleton().register('beforeHideRows');\nHooks.getSingleton().register('afterHideRows');\nHooks.getSingleton().register('beforeUnhideRows');\nHooks.getSingleton().register('afterUnhideRows');\nexport const PLUGIN_KEY = 'hiddenRows';\nexport const PLUGIN_PRIORITY = 320;\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @plugin HiddenRows\n * @class HiddenRows\n *\n * @description\n * The `HiddenRows` plugin lets you [hide specified rows](@/guides/rows/row-hiding/row-hiding.md).\n *\n * \"Hiding a row\" means that the hidden row doesn't get rendered as a DOM element.\n *\n * The `HiddenRows` plugin doesn't modify the source data,\n * and doesn't participate in data transformation\n * (the shape of the data returned by the [`getData*()` methods](@/api/core.md#getdata) stays intact).\n *\n * You can set the following configuration options:\n *\n * | Option | Required | Type | Default | Description |\n * |---|---|---|---|---|\n * | `rows` | No | Array | - | [Hides specified rows by default](@/guides/rows/row-hiding/row-hiding.md#step-1-specify-rows-hidden-by-default) |\n * | `indicators` | No | Boolean | `false` | [Shows UI indicators](@/guides/rows/row-hiding/row-hiding.md#step-2-show-ui-indicators) |\n * | `copyPasteEnabled` | No | Boolean | `true` | [Sets up copy/paste behavior](@/guides/rows/row-hiding/row-hiding.md#step-4-set-up-copy-and-paste-behavior) |\n *\n * @example\n *\n * ::: only-for javascript\n * ```js\n * const container = document.getElementById('example');\n * const hot = new Handsontable(container, {\n * data: getData(),\n * hiddenRows: {\n * copyPasteEnabled: true,\n * indicators: true,\n * rows: [1, 2, 5]\n * }\n * });\n *\n * // access the `HiddenRows` plugin's instance\n * const hiddenRowsPlugin = hot.getPlugin('hiddenRows');\n *\n * // hide a single row\n * hiddenRowsPlugin.hideRow(1);\n *\n * // hide multiple rows\n * hiddenRowsPlugin.hideRow(1, 2, 9);\n *\n * // hide multiple rows as an array\n * hiddenRowsPlugin.hideRows([1, 2, 9]);\n *\n * // unhide a single row\n * hiddenRowsPlugin.showRow(1);\n *\n * // unhide multiple rows\n * hiddenRowsPlugin.showRow(1, 2, 9);\n *\n * // unhide multiple rows as an array\n * hiddenRowsPlugin.showRows([1, 2, 9]);\n *\n * // to see your changes, re-render your Handsontable instance\n * hot.render();\n * ```\n * :::\n *\n * ::: only-for react\n * ```jsx\n * const hotRef = useRef(null);\n *\n * ...\n *\n * \n *\n * // access the `HiddenRows` plugin's instance\n * const hot = hotRef.current.hotInstance;\n * const hiddenRowsPlugin = hot.getPlugin('hiddenRows');\n *\n * // hide a single row\n * hiddenRowsPlugin.hideRow(1);\n *\n * // hide multiple rows\n * hiddenRowsPlugin.hideRow(1, 2, 9);\n *\n * // hide multiple rows as an array\n * hiddenRowsPlugin.hideRows([1, 2, 9]);\n *\n * // unhide a single row\n * hiddenRowsPlugin.showRow(1);\n *\n * // unhide multiple rows\n * hiddenRowsPlugin.showRow(1, 2, 9);\n *\n * // unhide multiple rows as an array\n * hiddenRowsPlugin.showRows([1, 2, 9]);\n *\n * // to see your changes, re-render your Handsontable instance\n * hot.render();\n * ```\n * :::\n */\nvar _settings = /*#__PURE__*/new WeakMap();\nvar _hiddenRowsMap = /*#__PURE__*/new WeakMap();\nvar _HiddenRows_brand = /*#__PURE__*/new WeakSet();\nexport class HiddenRows extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * Adds the additional row height for the hidden row indicators.\n *\n * @param {number|undefined} height Row height.\n * @param {number} row Visual row index.\n * @returns {number}\n */\n _classPrivateMethodInitSpec(this, _HiddenRows_brand);\n /**\n * Cached settings from Handsontable settings.\n *\n * @private\n * @type {object}\n */\n _classPrivateFieldInitSpec(this, _settings, {});\n /**\n * Map of hidden rows by the plugin.\n *\n * @private\n * @type {HidingMap|null}\n */\n _classPrivateFieldInitSpec(this, _hiddenRowsMap, null);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link HiddenRows#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n var _this = this;\n if (this.enabled) {\n return;\n }\n const pluginSettings = this.hot.getSettings()[PLUGIN_KEY];\n if (isObject(pluginSettings)) {\n _classPrivateFieldSet(_settings, this, pluginSettings);\n if (isUndefined(pluginSettings.copyPasteEnabled)) {\n pluginSettings.copyPasteEnabled = true;\n }\n }\n _classPrivateFieldSet(_hiddenRowsMap, this, new HidingMap());\n _classPrivateFieldGet(_hiddenRowsMap, this).addLocalHook('init', () => _assertClassBrand(_HiddenRows_brand, this, _onMapInit).call(this));\n this.hot.rowIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_hiddenRowsMap, this));\n this.addHook('afterContextMenuDefaultOptions', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _assertClassBrand(_HiddenRows_brand, _this, _onAfterContextMenuDefaultOptions).call(_this, ...args);\n });\n this.addHook('afterGetCellMeta', (row, col, cellProperties) => _assertClassBrand(_HiddenRows_brand, this, _onAfterGetCellMeta).call(this, row, col, cellProperties));\n this.addHook('modifyRowHeight', (height, row) => _assertClassBrand(_HiddenRows_brand, this, _onModifyRowHeight).call(this, height, row));\n this.addHook('afterGetRowHeader', function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _assertClassBrand(_HiddenRows_brand, _this, _onAfterGetRowHeader).call(_this, ...args);\n });\n this.addHook('modifyCopyableRange', ranges => _assertClassBrand(_HiddenRows_brand, this, _onModifyCopyableRange).call(this, ranges));\n super.enablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`hiddenRows`](@/api/options.md#hiddenrows)\n */\n updatePlugin() {\n this.disablePlugin();\n this.enablePlugin();\n super.updatePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n this.hot.rowIndexMapper.unregisterMap(this.pluginName);\n _classPrivateFieldSet(_settings, this, {});\n super.disablePlugin();\n this.resetCellsMeta();\n }\n\n /**\n * Shows the rows provided in the array.\n *\n * @param {number[]} rows Array of visual row indexes.\n */\n showRows(rows) {\n const currentHideConfig = this.getHiddenRows();\n const isValidConfig = this.isValidConfig(rows);\n let destinationHideConfig = currentHideConfig;\n const hidingMapValues = _classPrivateFieldGet(_hiddenRowsMap, this).getValues().slice();\n const isAnyRowShowed = rows.length > 0;\n if (isValidConfig && isAnyRowShowed) {\n const physicalRows = rows.map(visualRow => this.hot.toPhysicalRow(visualRow));\n\n // Preparing new values for hiding map.\n arrayEach(physicalRows, physicalRow => {\n hidingMapValues[physicalRow] = false;\n });\n\n // Preparing new hiding config.\n destinationHideConfig = arrayReduce(hidingMapValues, (hiddenIndexes, isHidden, physicalIndex) => {\n if (isHidden) {\n hiddenIndexes.push(this.hot.toVisualRow(physicalIndex));\n }\n return hiddenIndexes;\n }, []);\n }\n const continueHiding = this.hot.runHooks('beforeUnhideRows', currentHideConfig, destinationHideConfig, isValidConfig && isAnyRowShowed);\n if (continueHiding === false) {\n return;\n }\n if (isValidConfig && isAnyRowShowed) {\n _classPrivateFieldGet(_hiddenRowsMap, this).setValues(hidingMapValues);\n }\n this.hot.runHooks('afterUnhideRows', currentHideConfig, destinationHideConfig, isValidConfig && isAnyRowShowed, isValidConfig && destinationHideConfig.length < currentHideConfig.length);\n }\n\n /**\n * Shows the row provided as row index (counting from 0).\n *\n * @param {...number} row Visual row index.\n */\n showRow() {\n for (var _len3 = arguments.length, row = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n row[_key3] = arguments[_key3];\n }\n this.showRows(row);\n }\n\n /**\n * Hides the rows provided in the array.\n *\n * @param {number[]} rows Array of visual row indexes.\n */\n hideRows(rows) {\n const currentHideConfig = this.getHiddenRows();\n const isConfigValid = this.isValidConfig(rows);\n let destinationHideConfig = currentHideConfig;\n if (isConfigValid) {\n destinationHideConfig = Array.from(new Set(currentHideConfig.concat(rows)));\n }\n const continueHiding = this.hot.runHooks('beforeHideRows', currentHideConfig, destinationHideConfig, isConfigValid);\n if (continueHiding === false) {\n return;\n }\n if (isConfigValid) {\n this.hot.batchExecution(() => {\n arrayEach(rows, visualRow => {\n _classPrivateFieldGet(_hiddenRowsMap, this).setValueAtIndex(this.hot.toPhysicalRow(visualRow), true);\n });\n }, true);\n }\n this.hot.runHooks('afterHideRows', currentHideConfig, destinationHideConfig, isConfigValid, isConfigValid && destinationHideConfig.length > currentHideConfig.length);\n }\n\n /**\n * Hides the row provided as row index (counting from 0).\n *\n * @param {...number} row Visual row index.\n */\n hideRow() {\n for (var _len4 = arguments.length, row = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n row[_key4] = arguments[_key4];\n }\n this.hideRows(row);\n }\n\n /**\n * Returns an array of visual indexes of hidden rows.\n *\n * @returns {number[]}\n */\n getHiddenRows() {\n return arrayMap(_classPrivateFieldGet(_hiddenRowsMap, this).getHiddenIndexes(), physicalRowIndex => {\n return this.hot.toVisualRow(physicalRowIndex);\n });\n }\n\n /**\n * Checks if the provided row is hidden.\n *\n * @param {number} row Visual row index.\n * @returns {boolean}\n */\n isHidden(row) {\n return _classPrivateFieldGet(_hiddenRowsMap, this).getValueAtIndex(this.hot.toPhysicalRow(row)) || false;\n }\n\n /**\n * Checks whether all of the provided row indexes are within the bounds of the table.\n *\n * @param {Array} hiddenRows List of hidden visual row indexes.\n * @returns {boolean}\n */\n isValidConfig(hiddenRows) {\n const nrOfRows = this.hot.countRows();\n if (Array.isArray(hiddenRows) && hiddenRows.length > 0) {\n return hiddenRows.every(visualRow => Number.isInteger(visualRow) && visualRow >= 0 && visualRow < nrOfRows);\n }\n return false;\n }\n\n /**\n * Resets all rendered cells meta.\n *\n * @private\n */\n resetCellsMeta() {\n arrayEach(this.hot.getCellsMeta(), meta => {\n if (meta) {\n meta.skipRowOnPaste = false;\n }\n });\n }\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n _classPrivateFieldSet(_settings, this, null);\n _classPrivateFieldSet(_hiddenRowsMap, this, null);\n super.destroy();\n }\n}\nfunction _onModifyRowHeight(height, row) {\n // Hook is triggered internally only for the visible rows. Conditional will be handled for the API\n // calls of the `getRowHeight` function on not visible indexes.\n if (this.isHidden(row)) {\n return 0;\n }\n return height;\n}\n/**\n * Sets the copy-related cell meta.\n *\n * @param {number} row Visual row index.\n * @param {number} column Visual column index.\n * @param {object} cellProperties Object containing the cell properties.\n */\nfunction _onAfterGetCellMeta(row, column, cellProperties) {\n if (_classPrivateFieldGet(_settings, this).copyPasteEnabled === false && this.isHidden(row)) {\n // Cell property handled by the `Autofill` and the `CopyPaste` plugins.\n cellProperties.skipRowOnPaste = true;\n }\n if (this.isHidden(row - 1)) {\n cellProperties.className = cellProperties.className || '';\n if (cellProperties.className.indexOf('afterHiddenRow') === -1) {\n cellProperties.className += ' afterHiddenRow';\n }\n } else if (cellProperties.className) {\n const classArr = cellProperties.className.split(' ');\n if (classArr.length > 0) {\n const containAfterHiddenRow = classArr.indexOf('afterHiddenRow');\n if (containAfterHiddenRow > -1) {\n classArr.splice(containAfterHiddenRow, 1);\n }\n cellProperties.className = classArr.join(' ');\n }\n }\n}\n/**\n * Modifies the copyable range, accordingly to the provided config.\n *\n * @param {Array} ranges An array of objects defining copyable cells.\n * @returns {Array}\n */\nfunction _onModifyCopyableRange(ranges) {\n // Ranges shouldn't be modified when `copyPasteEnabled` option is set to `true` (by default).\n if (_classPrivateFieldGet(_settings, this).copyPasteEnabled) {\n return ranges;\n }\n const newRanges = [];\n const pushRange = (startRow, endRow, startCol, endCol) => {\n newRanges.push({\n startRow,\n endRow,\n startCol,\n endCol\n });\n };\n arrayEach(ranges, range => {\n let isHidden = true;\n let rangeStart = 0;\n rangeEach(range.startRow, range.endRow, visualRow => {\n if (this.isHidden(visualRow)) {\n if (!isHidden) {\n pushRange(rangeStart, visualRow - 1, range.startCol, range.endCol);\n }\n isHidden = true;\n } else {\n if (isHidden) {\n rangeStart = visualRow;\n }\n if (visualRow === range.endRow) {\n pushRange(rangeStart, visualRow, range.startCol, range.endCol);\n }\n isHidden = false;\n }\n });\n });\n return newRanges;\n}\n/**\n * Adds the needed classes to the headers.\n *\n * @param {number} row Visual row index.\n * @param {HTMLElement} TH Header's TH element.\n */\nfunction _onAfterGetRowHeader(row, TH) {\n if (!_classPrivateFieldGet(_settings, this).indicators || row < 0) {\n return;\n }\n const classList = [];\n if (row >= 1 && this.isHidden(row - 1)) {\n classList.push('afterHiddenRow');\n }\n if (row < this.hot.countRows() - 1 && this.isHidden(row + 1)) {\n classList.push('beforeHiddenRow');\n }\n addClass(TH, classList);\n}\n/**\n * Add Show-hide rows to context menu.\n *\n * @param {object} options An array of objects containing information about the pre-defined Context Menu items.\n */\nfunction _onAfterContextMenuDefaultOptions(options) {\n options.items.push({\n name: SEPARATOR\n }, hideRowItem(this), showRowItem(this));\n}\n/**\n * On map initialized hook callback.\n */\nfunction _onMapInit() {\n if (Array.isArray(_classPrivateFieldGet(_settings, this).rows)) {\n this.hideRows(_classPrivateFieldGet(_settings, this).rows);\n }\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, HiddenRows } from \"./hiddenRows.mjs\";", "import * as C from \"../../../i18n/constants.mjs\";\n/**\n * @param {ManualColumnFreeze} manualColumnFreezePlugin The plugin instance.\n * @returns {object}\n */\nexport default function freezeColumnItem(manualColumnFreezePlugin) {\n return {\n key: 'freeze_column',\n name() {\n return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_FREEZE_COLUMN);\n },\n callback(key, selected) {\n const [{\n start: {\n col: selectedColumn\n }\n }] = selected;\n manualColumnFreezePlugin.freezeColumn(selectedColumn);\n this.render();\n this.view.adjustElementsSize();\n },\n hidden() {\n const selection = this.getSelectedRange();\n let hide = false;\n if (selection === undefined) {\n hide = true;\n } else if (selection.length > 1) {\n hide = true;\n } else if (selection[0].from.col !== selection[0].to.col || selection[0].from.col <= this.getSettings().fixedColumnsStart - 1) {\n hide = true;\n }\n return hide;\n }\n };\n}", "import * as C from \"../../../i18n/constants.mjs\";\n/**\n * @param {ManualColumnFreeze} manualColumnFreezePlugin The plugin instance.\n * @returns {object}\n */\nexport default function unfreezeColumnItem(manualColumnFreezePlugin) {\n return {\n key: 'unfreeze_column',\n name() {\n return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_UNFREEZE_COLUMN);\n },\n callback(key, selected) {\n const [{\n start: {\n col: selectedColumn\n }\n }] = selected;\n manualColumnFreezePlugin.unfreezeColumn(selectedColumn);\n this.render();\n this.view.adjustElementsSize();\n },\n hidden() {\n const selection = this.getSelectedRange();\n let hide = false;\n if (selection === undefined) {\n hide = true;\n } else if (selection.length > 1) {\n hide = true;\n } else if (selection[0].from.col !== selection[0].to.col || selection[0].from.col >= this.getSettings().fixedColumnsStart) {\n hide = true;\n }\n return hide;\n }\n };\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport Hooks from \"../../pluginHooks.mjs\";\nimport freezeColumnItem from \"./contextMenuItem/freezeColumn.mjs\";\nimport unfreezeColumnItem from \"./contextMenuItem/unfreezeColumn.mjs\";\nHooks.getSingleton().register('beforeColumnFreeze');\nHooks.getSingleton().register('afterColumnFreeze');\nHooks.getSingleton().register('beforeColumnUnfreeze');\nHooks.getSingleton().register('afterColumnUnfreeze');\nexport const PLUGIN_KEY = 'manualColumnFreeze';\nexport const PLUGIN_PRIORITY = 110;\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @plugin ManualColumnFreeze\n * @class ManualColumnFreeze\n *\n * @description\n * This plugin allows to manually \"freeze\" and \"unfreeze\" a column using an entry in the Context Menu or using API.\n * You can turn it on by setting a {@link Options#manualColumnFreeze} property to `true`.\n *\n * @example\n * ```js\n * // Enables the plugin\n * manualColumnFreeze: true,\n * ```\n */\nvar _afterFirstUse = /*#__PURE__*/new WeakMap();\nvar _ManualColumnFreeze_brand = /*#__PURE__*/new WeakSet();\nexport class ManualColumnFreeze extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * Adds the manualColumnFreeze context menu entries.\n *\n * @private\n * @param {object} options Context menu options.\n */\n _classPrivateMethodInitSpec(this, _ManualColumnFreeze_brand);\n /**\n * Determines when the moving operation is allowed.\n *\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _afterFirstUse, false);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link ManualColumnFreeze#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n if (this.enabled) {\n return;\n }\n this.addHook('afterContextMenuDefaultOptions', options => _assertClassBrand(_ManualColumnFreeze_brand, this, _addContextMenuEntry).call(this, options));\n this.addHook('beforeColumnMove', (columns, finalIndex) => _assertClassBrand(_ManualColumnFreeze_brand, this, _onBeforeColumnMove).call(this, columns, finalIndex));\n super.enablePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n _classPrivateFieldSet(_afterFirstUse, this, false);\n super.disablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`manualColumnFreeze`](@/api/options.md#manualcolumnfreeze)\n */\n updatePlugin() {\n this.disablePlugin();\n this.enablePlugin();\n super.updatePlugin();\n }\n\n /**\n * Freezes the specified column (adds it to fixed columns).\n *\n * `freezeColumn()` doesn't re-render the table,\n * so you need to call the `render()` method afterward.\n *\n * @param {number} column Visual column index.\n */\n freezeColumn(column) {\n const settings = this.hot.getSettings();\n // columns are already fixed (frozen)\n const freezePerformed = settings.fixedColumnsStart < this.hot.countCols() && column > settings.fixedColumnsStart - 1;\n if (!_classPrivateFieldGet(_afterFirstUse, this)) {\n _classPrivateFieldSet(_afterFirstUse, this, true);\n }\n const beforeColumnFreezeHook = this.hot.runHooks('beforeColumnFreeze', column, freezePerformed);\n if (beforeColumnFreezeHook === false) {\n return;\n }\n if (freezePerformed) {\n this.hot.columnIndexMapper.moveIndexes(column, settings.fixedColumnsStart);\n\n // Since 12.0.0, the \"fixedColumnsLeft\" is replaced with the \"fixedColumnsStart\" option.\n // However, keeping the old name still in effect. When both option names are used together,\n // the error is thrown. To prevent that, the plugin needs to modify the original option key\n // to bypass the validation.\n settings._fixedColumnsStart += 1;\n }\n this.hot.runHooks('afterColumnFreeze', column, freezePerformed);\n }\n\n /**\n * Unfreezes the given column (remove it from fixed columns and bring to it's previous position).\n *\n * @param {number} column Visual column index.\n */\n unfreezeColumn(column) {\n const settings = this.hot.getSettings();\n // columns are not fixed (not frozen)\n const unfreezePerformed = settings.fixedColumnsStart > 0 && column <= settings.fixedColumnsStart - 1;\n if (!_classPrivateFieldGet(_afterFirstUse, this)) {\n _classPrivateFieldSet(_afterFirstUse, this, true);\n }\n const beforeColumnUnfreezeHook = this.hot.runHooks('beforeColumnUnfreeze', column, unfreezePerformed);\n if (beforeColumnUnfreezeHook === false) {\n return;\n }\n if (unfreezePerformed) {\n // Since 12.0.0, the \"fixedColumnsLeft\" is replaced with the \"fixedColumnsStart\" option.\n // However, keeping the old name still in effect. When both option names are used together,\n // the error is thrown. To prevent that, the plugin needs to modify the original option key\n // to bypass the validation.\n settings._fixedColumnsStart -= 1;\n this.hot.columnIndexMapper.moveIndexes(column, settings.fixedColumnsStart);\n }\n this.hot.runHooks('afterColumnUnfreeze', column, unfreezePerformed);\n }\n}\nfunction _addContextMenuEntry(options) {\n options.items.push({\n name: '---------'\n }, freezeColumnItem(this), unfreezeColumnItem(this));\n}\n/**\n * Prevents moving the columns from/to fixed area.\n *\n * @private\n * @param {Array} columns Array of visual column indexes to be moved.\n * @param {number} finalIndex Visual column index, being a start index for the moved columns. Points to where the elements will be placed after the moving action.\n * @returns {boolean|undefined}\n */\nfunction _onBeforeColumnMove(columns, finalIndex) {\n if (_classPrivateFieldGet(_afterFirstUse, this)) {\n const freezeLine = this.hot.getSettings().fixedColumnsStart;\n\n // Moving any column before the \"freeze line\" isn't possible.\n if (finalIndex < freezeLine) {\n return false;\n }\n\n // Moving frozen column isn't possible.\n if (columns.some(column => column < freezeLine)) {\n return false;\n }\n }\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, ManualColumnFreeze } from \"./manualColumnFreeze.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { isNumeric } from \"../../../helpers/number.mjs\";\nimport { toUpperCaseFirst } from \"../../../helpers/string.mjs\";\nconst STATE_INITIALIZED = 0;\nconst STATE_BUILT = 1;\nconst STATE_APPENDED = 2;\nconst UNIT = 'px';\n\n/**\n * @class\n * @private\n */\nclass BaseUI {\n constructor(hotInstance) {\n /**\n * Instance of Handsontable.\n *\n * @type {Core}\n */\n _defineProperty(this, \"hot\", void 0);\n /**\n * DOM element representing the ui element.\n *\n * @type {HTMLElement}\n * @private\n */\n _defineProperty(this, \"_element\", null);\n /**\n * Flag which determines build state of element.\n *\n * @type {number}\n */\n _defineProperty(this, \"state\", STATE_INITIALIZED);\n /**\n * Defines the \"start\" physical CSS property name used within the class depending on what document\n * layout direction the library runs.\n *\n * @type {string}\n */\n _defineProperty(this, \"inlineProperty\", void 0);\n this.hot = hotInstance;\n this.inlineProperty = hotInstance.isRtl() ? 'right' : 'left';\n }\n\n /**\n * Add created UI elements to table.\n *\n * @param {HTMLElement} wrapper Element which are parent for our UI element.\n */\n appendTo(wrapper) {\n wrapper.appendChild(this._element);\n this.state = STATE_APPENDED;\n }\n\n /**\n * Method for create UI element. Only create, without append to table.\n */\n build() {\n if (this.state !== STATE_INITIALIZED) {\n return;\n }\n this._element = this.hot.rootDocument.createElement('div');\n this.state = STATE_BUILT;\n }\n\n /**\n * Method for remove UI element.\n */\n destroy() {\n if (this.isAppended()) {\n this._element.parentElement.removeChild(this._element);\n }\n this._element = null;\n this.state = STATE_INITIALIZED;\n }\n\n /**\n * Check if UI element are appended.\n *\n * @returns {boolean}\n */\n isAppended() {\n return this.state === STATE_APPENDED;\n }\n\n /**\n * Check if UI element are built.\n *\n * @returns {boolean}\n */\n isBuilt() {\n return this.state >= STATE_BUILT;\n }\n\n /**\n * Setter for position.\n *\n * @param {number} top New top position of the element.\n * @param {number} inlinePosition New left/right (depends on LTR/RTL document mode) position of the element.\n */\n setPosition(top, inlinePosition) {\n if (isNumeric(top)) {\n this._element.style.top = top + UNIT;\n }\n if (isNumeric(inlinePosition)) {\n this._element.style[this.inlineProperty] = inlinePosition + UNIT;\n }\n }\n\n /**\n * Getter for the element position.\n *\n * @returns {object} Object contains left and top position of the element.\n */\n getPosition() {\n const style = this._element.style;\n return {\n top: style.top ? parseInt(style.top, 10) : 0,\n start: style[this.inlineProperty] ? parseInt(style[this.inlineProperty], 10) : 0\n };\n }\n\n /**\n * Setter for the element size.\n *\n * @param {number} width New width of the element.\n * @param {number} height New height of the element.\n */\n setSize(width, height) {\n if (isNumeric(width)) {\n this._element.style.width = width + UNIT;\n }\n if (isNumeric(height)) {\n this._element.style.height = height + UNIT;\n }\n }\n\n /**\n * Getter for the element position.\n *\n * @returns {object} Object contains height and width of the element.\n */\n getSize() {\n return {\n width: this._element.style.width ? parseInt(this._element.style.width, 10) : 0,\n height: this._element.style.height ? parseInt(this._element.style.height, 10) : 0\n };\n }\n\n /**\n * Setter for the element offset. Offset means marginTop and marginLeft of the element.\n *\n * @param {number} top New margin top of the element.\n * @param {number} inlineOffset New margin left/right (depends on LTR/RTL document mode) of the element.\n */\n setOffset(top, inlineOffset) {\n if (isNumeric(top)) {\n this._element.style.marginTop = top + UNIT;\n }\n if (isNumeric(inlineOffset)) {\n this._element.style[`margin${toUpperCaseFirst(this.inlineProperty)}`] = inlineOffset + UNIT;\n }\n }\n\n /**\n * Getter for the element offset.\n *\n * @returns {object} Object contains top and left offset of the element.\n */\n getOffset() {\n const style = this._element.style;\n const inlineProp = `margin${toUpperCaseFirst(this.inlineProperty)}`;\n return {\n top: style.marginTop ? parseInt(style.marginTop, 10) : 0,\n start: style[inlineProp] ? parseInt(style[inlineProp], 10) : 0\n };\n }\n}\nexport default BaseUI;", "import BaseUI from \"./_base.mjs\";\nimport { addClass } from \"../../../helpers/dom/element.mjs\";\nconst CSS_CLASSNAME = 'ht__manualColumnMove--backlight';\n\n/**\n * @class BacklightUI\n * @util\n */\nclass BacklightUI extends BaseUI {\n /**\n * Custom className on build process.\n */\n build() {\n super.build();\n addClass(this._element, CSS_CLASSNAME);\n }\n}\nexport default BacklightUI;", "import BaseUI from \"./_base.mjs\";\nimport { addClass } from \"../../../helpers/dom/element.mjs\";\nconst CSS_CLASSNAME = 'ht__manualColumnMove--guideline';\n\n/**\n * @class GuidelineUI\n * @util\n */\nclass GuidelineUI extends BaseUI {\n /**\n * Custom className on build process.\n */\n build() {\n super.build();\n addClass(this._element, CSS_CLASSNAME);\n }\n}\nexport default GuidelineUI;", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport Hooks from \"../../pluginHooks.mjs\";\nimport { arrayReduce } from \"../../helpers/array.mjs\";\nimport { addClass, removeClass, offset, hasClass, outerWidth } from \"../../helpers/dom/element.mjs\";\nimport { offsetRelativeTo } from \"../../helpers/dom/event.mjs\";\nimport { rangeEach } from \"../../helpers/number.mjs\";\nimport BacklightUI from \"./ui/backlight.mjs\";\nimport GuidelineUI from \"./ui/guideline.mjs\";\nHooks.getSingleton().register('beforeColumnMove');\nHooks.getSingleton().register('afterColumnMove');\nexport const PLUGIN_KEY = 'manualColumnMove';\nexport const PLUGIN_PRIORITY = 120;\nconst CSS_PLUGIN = 'ht__manualColumnMove';\nconst CSS_SHOW_UI = 'show-ui';\nconst CSS_ON_MOVING = 'on-moving--columns';\nconst CSS_AFTER_SELECTION = 'after-selection--columns';\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @plugin ManualColumnMove\n * @class ManualColumnMove\n *\n * @description\n * This plugin allows to change columns order. To make columns order persistent the {@link Options#persistentState}\n * plugin should be enabled.\n *\n * API:\n * - `moveColumn` - move single column to the new position.\n * - `moveColumns` - move many columns (as an array of indexes) to the new position.\n * - `dragColumn` - drag single column to the new position.\n * - `dragColumns` - drag many columns (as an array of indexes) to the new position.\n *\n * [Documentation](@/guides/columns/column-moving/column-moving.md) explain differences between drag and move actions.\n * Please keep in mind that if you want apply visual changes,\n * you have to call manually the `render` method on the instance of Handsontable.\n *\n * The plugin creates additional components to make moving possibly using user interface:\n * - backlight - highlight of selected columns.\n * - guideline - line which shows where columns has been moved.\n *\n * @class ManualColumnMove\n * @plugin ManualColumnMove\n */\nvar _backlight = /*#__PURE__*/new WeakMap();\nvar _guideline = /*#__PURE__*/new WeakMap();\nvar _columnsToMove = /*#__PURE__*/new WeakMap();\nvar _countCols = /*#__PURE__*/new WeakMap();\nvar _pressed = /*#__PURE__*/new WeakMap();\nvar _target = /*#__PURE__*/new WeakMap();\nvar _cachedDropIndex = /*#__PURE__*/new WeakMap();\nvar _hoveredColumn = /*#__PURE__*/new WeakMap();\nvar _rootElementOffset = /*#__PURE__*/new WeakMap();\nvar _hasRowHeaders = /*#__PURE__*/new WeakMap();\nvar _fixedColumnsStart = /*#__PURE__*/new WeakMap();\nvar _ManualColumnMove_brand = /*#__PURE__*/new WeakSet();\nexport class ManualColumnMove extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * Change the behavior of selection / dragging.\n *\n * @param {MouseEvent} event `mousedown` event properties.\n * @param {CellCoords} coords Visual cell coordinates where was fired event.\n * @param {HTMLElement} TD Cell represented as HTMLElement.\n * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains\n * a boolean value that allows or disallows changing the selection for that particular area.\n */\n _classPrivateMethodInitSpec(this, _ManualColumnMove_brand);\n /**\n * Backlight UI object.\n *\n * @type {object}\n */\n _classPrivateFieldInitSpec(this, _backlight, new BacklightUI(this.hot));\n /**\n * Guideline UI object.\n *\n * @type {object}\n */\n _classPrivateFieldInitSpec(this, _guideline, new GuidelineUI(this.hot));\n /**\n * @type {number[]}\n */\n _classPrivateFieldInitSpec(this, _columnsToMove, []);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _countCols, 0);\n /**\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _pressed, false);\n /**\n * @type {object}\n */\n _classPrivateFieldInitSpec(this, _target, {});\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _cachedDropIndex, void 0);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _hoveredColumn, void 0);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _rootElementOffset, void 0);\n /**\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _hasRowHeaders, void 0);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _fixedColumnsStart, void 0);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link ManualColumnMove#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n var _this = this;\n if (this.enabled) {\n return;\n }\n this.addHook('beforeOnCellMouseDown', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _assertClassBrand(_ManualColumnMove_brand, _this, _onBeforeOnCellMouseDown).call(_this, ...args);\n });\n this.addHook('beforeOnCellMouseOver', function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _assertClassBrand(_ManualColumnMove_brand, _this, _onBeforeOnCellMouseOver).call(_this, ...args);\n });\n this.addHook('afterScrollVertically', () => _assertClassBrand(_ManualColumnMove_brand, this, _onAfterScrollVertically).call(this));\n this.addHook('afterLoadData', function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n return _assertClassBrand(_ManualColumnMove_brand, _this, _onAfterLoadData).call(_this, ...args);\n });\n this.buildPluginUI();\n this.registerEvents();\n\n // TODO: move adding plugin classname to BasePlugin.\n addClass(this.hot.rootElement, CSS_PLUGIN);\n super.enablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`manualColumnMove`](@/api/options.md#manualcolumnmove)\n */\n updatePlugin() {\n this.disablePlugin();\n this.enablePlugin();\n this.moveBySettingsOrLoad();\n super.updatePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n removeClass(this.hot.rootElement, CSS_PLUGIN);\n this.unregisterEvents();\n _classPrivateFieldGet(_backlight, this).destroy();\n _classPrivateFieldGet(_guideline, this).destroy();\n super.disablePlugin();\n }\n\n /**\n * Moves a single column.\n *\n * @param {number} column Visual column index to be moved.\n * @param {number} finalIndex Visual column index, being a start index for the moved columns. Points to where the elements will be placed after the moving action.\n * To check the visualization of the final index, please take a look at [documentation](@/guides/columns/column-moving/column-moving.md#drag-and-move-actions-of-manualcolumnmove-plugin).\n * @fires Hooks#beforeColumnMove\n * @fires Hooks#afterColumnMove\n * @returns {boolean}\n */\n moveColumn(column, finalIndex) {\n return this.moveColumns([column], finalIndex);\n }\n\n /**\n * Moves a multiple columns.\n *\n * @param {Array} columns Array of visual column indexes to be moved.\n * @param {number} finalIndex Visual column index, being a start index for the moved columns. Points to where the elements will be placed after the moving action.\n * To check the visualization of the final index, please take a look at [documentation](@/guides/columns/column-moving/column-moving.md#drag-and-move-actions-of-manualcolumnmove-plugin).\n * @fires Hooks#beforeColumnMove\n * @fires Hooks#afterColumnMove\n * @returns {boolean}\n */\n moveColumns(columns, finalIndex) {\n const dropIndex = _classPrivateFieldGet(_cachedDropIndex, this);\n const movePossible = this.isMovePossible(columns, finalIndex);\n const beforeMoveHook = this.hot.runHooks('beforeColumnMove', columns, finalIndex, dropIndex, movePossible);\n _classPrivateFieldSet(_cachedDropIndex, this, undefined);\n if (beforeMoveHook === false) {\n return;\n }\n if (movePossible) {\n this.hot.columnIndexMapper.moveIndexes(columns, finalIndex);\n }\n const movePerformed = movePossible && this.isColumnOrderChanged(columns, finalIndex);\n this.hot.runHooks('afterColumnMove', columns, finalIndex, dropIndex, movePossible, movePerformed);\n return movePerformed;\n }\n\n /**\n * Drag a single column to drop index position.\n *\n * @param {number} column Visual column index to be dragged.\n * @param {number} dropIndex Visual column index, being a drop index for the moved columns. Points to where we are going to drop the moved elements.\n * To check visualization of drop index please take a look at [documentation](@/guides/columns/column-moving/column-moving.md#drag-and-move-actions-of-manualcolumnmove-plugin).\n * @fires Hooks#beforeColumnMove\n * @fires Hooks#afterColumnMove\n * @returns {boolean}\n */\n dragColumn(column, dropIndex) {\n return this.dragColumns([column], dropIndex);\n }\n\n /**\n * Drag multiple columns to drop index position.\n *\n * @param {Array} columns Array of visual column indexes to be dragged.\n * @param {number} dropIndex Visual column index, being a drop index for the moved columns. Points to where we are going to drop the moved elements.\n * To check visualization of drop index please take a look at [documentation](@/guides/columns/column-moving/column-moving.md#drag-and-move-actions-of-manualcolumnmove-plugin).\n * @fires Hooks#beforeColumnMove\n * @fires Hooks#afterColumnMove\n * @returns {boolean}\n */\n dragColumns(columns, dropIndex) {\n const finalIndex = this.countFinalIndex(columns, dropIndex);\n _classPrivateFieldSet(_cachedDropIndex, this, dropIndex);\n return this.moveColumns(columns, finalIndex);\n }\n\n /**\n * Indicates if it's possible to move columns to the desired position. Some of the actions aren't\n * possible, i.e. You can\u2019t move more than one element to the last position.\n *\n * @param {Array} movedColumns Array of visual column indexes to be moved.\n * @param {number} finalIndex Visual column index, being a start index for the moved columns. Points to where the elements will be placed after the moving action.\n * To check the visualization of the final index, please take a look at [documentation](@/guides/columns/column-moving/column-moving.md#drag-and-move-actions-of-manualcolumnmove-plugin).\n * @returns {boolean}\n */\n isMovePossible(movedColumns, finalIndex) {\n const length = this.hot.columnIndexMapper.getNotTrimmedIndexesLength();\n\n // An attempt to transfer more columns to start destination than is possible (only when moving from the top to the bottom).\n const tooHighDestinationIndex = movedColumns.length + finalIndex > length;\n const tooLowDestinationIndex = finalIndex < 0;\n const tooLowMovedColumnIndex = movedColumns.some(movedColumn => movedColumn < 0);\n const tooHighMovedColumnIndex = movedColumns.some(movedColumn => movedColumn >= length);\n if (tooHighDestinationIndex || tooLowDestinationIndex || tooLowMovedColumnIndex || tooHighMovedColumnIndex) {\n return false;\n }\n return true;\n }\n\n /**\n * Indicates if order of columns was changed.\n *\n * @private\n * @param {Array} movedColumns Array of visual column indexes to be moved.\n * @param {number} finalIndex Visual column index, being a start index for the moved columns. Points to where the elements will be placed after the moving action.\n * To check the visualization of the final index, please take a look at [documentation](@/guides/columns/column-moving/column-moving.md#drag-and-move-actions-of-manualcolumnmove-plugin).\n * @returns {boolean}\n */\n isColumnOrderChanged(movedColumns, finalIndex) {\n return movedColumns.some((column, nrOfMovedElement) => column - nrOfMovedElement !== finalIndex);\n }\n\n /**\n * Count the final column index from the drop index.\n *\n * @private\n * @param {Array} movedColumns Array of visual column indexes to be moved.\n * @param {number} dropIndex Visual column index, being a drop index for the moved columns.\n * @returns {number} Visual column index, being a start index for the moved columns.\n */\n countFinalIndex(movedColumns, dropIndex) {\n const numberOfColumnsLowerThanDropIndex = arrayReduce(movedColumns, (numberOfColumns, currentColumnIndex) => {\n if (currentColumnIndex < dropIndex) {\n numberOfColumns += 1;\n }\n return numberOfColumns;\n }, 0);\n return dropIndex - numberOfColumnsLowerThanDropIndex;\n }\n\n /**\n * Gets the sum of the widths of columns in the provided range.\n *\n * @private\n * @param {number} fromColumn Visual column index.\n * @param {number} toColumn Visual column index.\n * @returns {number}\n */\n getColumnsWidth(fromColumn, toColumn) {\n const columnMapper = this.hot.columnIndexMapper;\n let columnsWidth = 0;\n for (let visualColumnIndex = fromColumn; visualColumnIndex <= toColumn; visualColumnIndex += 1) {\n // We can't use just `getColWidth` (even without indexes translation) as it doesn't return proper values\n // when column is stretched.\n const renderableIndex = columnMapper.getRenderableFromVisualIndex(visualColumnIndex);\n if (visualColumnIndex < 0) {\n columnsWidth += this.hot.view._wt.wtViewport.getRowHeaderWidth() || 0;\n } else if (renderableIndex !== null) {\n columnsWidth += this.hot.view._wt.wtTable.getStretchedColumnWidth(renderableIndex) || 0;\n }\n }\n return columnsWidth;\n }\n\n /**\n * Loads initial settings when persistent state is saved or when plugin was initialized as an array.\n *\n * @private\n */\n moveBySettingsOrLoad() {\n const pluginSettings = this.hot.getSettings()[PLUGIN_KEY];\n if (Array.isArray(pluginSettings)) {\n this.moveColumns(pluginSettings, 0);\n } else if (pluginSettings !== undefined) {\n const persistentState = this.persistentStateLoad();\n if (persistentState.length) {\n this.moveColumns(persistentState, 0);\n }\n }\n }\n\n /**\n * Checks if the provided column is in the fixedColumnsTop section.\n *\n * @private\n * @param {number} column Visual column index to check.\n * @returns {boolean}\n */\n isFixedColumnsStart(column) {\n return column < this.hot.getSettings().fixedColumnsStart;\n }\n\n /**\n * Saves the manual column positions to the persistent state (the {@link Options#persistentState} option has to be enabled).\n *\n * @private\n * @fires Hooks#persistentStateSave\n */\n persistentStateSave() {\n this.hot.runHooks('persistentStateSave', 'manualColumnMove', this.hot.columnIndexMapper.getIndexesSequence()); // The `PersistentState` plugin should be refactored.\n }\n\n /**\n * Loads the manual column positions from the persistent state (the {@link Options#persistentState} option has to be enabled).\n *\n * @private\n * @fires Hooks#persistentStateLoad\n * @returns {Array} Stored state.\n */\n persistentStateLoad() {\n const storedState = {};\n this.hot.runHooks('persistentStateLoad', 'manualColumnMove', storedState);\n return storedState.value ? storedState.value : [];\n }\n\n /**\n * Prepares an array of indexes based on actual selection.\n *\n * @private\n * @param {number} start The start index.\n * @param {number} end The end index.\n * @returns {Array}\n */\n prepareColumnsToMoving(start, end) {\n const selectedColumns = [];\n rangeEach(start, end, i => {\n selectedColumns.push(i);\n });\n return selectedColumns;\n }\n\n /**\n * Update the UI visual position.\n *\n * @private\n */\n refreshPositions() {\n const firstVisible = this.hot.view.getFirstFullyVisibleColumn();\n if (this.isFixedColumnsStart(_classPrivateFieldGet(_hoveredColumn, this)) && firstVisible > 0) {\n this.hot.scrollViewportTo({\n col: this.hot.columnIndexMapper.getNearestNotHiddenIndex(firstVisible - 1, -1)\n });\n }\n const wtTable = this.hot.view._wt.wtTable;\n const scrollableElement = this.hot.view._wt.wtOverlays.scrollableElement;\n const scrollStart = typeof scrollableElement.scrollX === 'number' ? scrollableElement.scrollX : scrollableElement.scrollLeft;\n let tdOffsetStart = this.hot.view.THEAD.offsetLeft + this.getColumnsWidth(0, _classPrivateFieldGet(_hoveredColumn, this) - 1);\n const hiderWidth = wtTable.hider.offsetWidth;\n const tbodyOffsetLeft = wtTable.TBODY.offsetLeft;\n const backlightElemMarginStart = _classPrivateFieldGet(_backlight, this).getOffset().start;\n const backlightElemWidth = _classPrivateFieldGet(_backlight, this).getSize().width;\n let rowHeaderWidth = 0;\n let mouseOffsetStart = 0;\n if (this.hot.isRtl()) {\n const rootWindow = this.hot.rootWindow;\n const containerWidth = outerWidth(this.hot.rootElement);\n const gridMostRightPos = rootWindow.innerWidth - _classPrivateFieldGet(_rootElementOffset, this) - containerWidth;\n mouseOffsetStart = rootWindow.innerWidth - _classPrivateFieldGet(_target, this).eventPageX - gridMostRightPos - (scrollableElement.scrollX === undefined ? scrollStart : 0);\n } else {\n mouseOffsetStart = _classPrivateFieldGet(_target, this).eventPageX - (_classPrivateFieldGet(_rootElementOffset, this) - (scrollableElement.scrollX === undefined ? scrollStart : 0));\n }\n if (_classPrivateFieldGet(_hasRowHeaders, this)) {\n rowHeaderWidth = this.hot.view._wt.wtOverlays.inlineStartOverlay.clone.wtTable.getColumnHeader(-1).offsetWidth;\n }\n if (this.isFixedColumnsStart(_classPrivateFieldGet(_hoveredColumn, this))) {\n tdOffsetStart += scrollStart;\n }\n tdOffsetStart += rowHeaderWidth;\n if (_classPrivateFieldGet(_hoveredColumn, this) < 0) {\n // if hover on rowHeader\n if (_classPrivateFieldGet(_fixedColumnsStart, this) > 0) {\n _classPrivateFieldGet(_target, this).col = 0;\n } else {\n _classPrivateFieldGet(_target, this).col = firstVisible > 0 ? firstVisible - 1 : firstVisible;\n }\n } else if (_classPrivateFieldGet(_target, this).TD.offsetWidth / 2 + tdOffsetStart <= mouseOffsetStart) {\n const newCoordsCol = _classPrivateFieldGet(_hoveredColumn, this) >= _classPrivateFieldGet(_countCols, this) ? _classPrivateFieldGet(_countCols, this) - 1 : _classPrivateFieldGet(_hoveredColumn, this);\n\n // if hover on right part of TD\n _classPrivateFieldGet(_target, this).col = newCoordsCol + 1;\n // unfortunately first column is bigger than rest\n tdOffsetStart += _classPrivateFieldGet(_target, this).TD.offsetWidth;\n } else {\n // elsewhere on table\n _classPrivateFieldGet(_target, this).col = _classPrivateFieldGet(_hoveredColumn, this);\n }\n let backlightStart = mouseOffsetStart;\n let guidelineStart = tdOffsetStart;\n if (mouseOffsetStart + backlightElemWidth + backlightElemMarginStart >= hiderWidth) {\n // prevent display backlight on the right side of the table\n backlightStart = hiderWidth - backlightElemWidth - backlightElemMarginStart;\n } else if (mouseOffsetStart + backlightElemMarginStart < tbodyOffsetLeft + rowHeaderWidth) {\n // prevent display backlight on the left side of the table\n backlightStart = tbodyOffsetLeft + rowHeaderWidth + Math.abs(backlightElemMarginStart);\n }\n if (tdOffsetStart >= hiderWidth - 1) {\n // prevent display guideline outside the table\n guidelineStart = hiderWidth - 1;\n } else if (guidelineStart === 0) {\n // guideline has got `margin-left: -1px` as default\n guidelineStart = 1;\n } else if (scrollableElement.scrollX !== undefined && _classPrivateFieldGet(_hoveredColumn, this) < _classPrivateFieldGet(_fixedColumnsStart, this)) {\n guidelineStart -= _classPrivateFieldGet(_rootElementOffset, this) <= scrollableElement.scrollX ? _classPrivateFieldGet(_rootElementOffset, this) : 0;\n }\n _classPrivateFieldGet(_backlight, this).setPosition(null, backlightStart);\n _classPrivateFieldGet(_guideline, this).setPosition(null, guidelineStart);\n }\n\n /**\n * Binds the events used by the plugin.\n *\n * @private\n */\n registerEvents() {\n const {\n documentElement\n } = this.hot.rootDocument;\n this.eventManager.addEventListener(documentElement, 'mousemove', event => _assertClassBrand(_ManualColumnMove_brand, this, _onMouseMove).call(this, event));\n this.eventManager.addEventListener(documentElement, 'mouseup', () => _assertClassBrand(_ManualColumnMove_brand, this, _onMouseUp).call(this));\n }\n\n /**\n * Unbinds the events used by the plugin.\n *\n * @private\n */\n unregisterEvents() {\n this.eventManager.clear();\n }\n /**\n * Builds the plugin's UI.\n *\n * @private\n */\n buildPluginUI() {\n _classPrivateFieldGet(_backlight, this).build();\n _classPrivateFieldGet(_guideline, this).build();\n }\n\n /**\n * Callback for the `afterLoadData` hook.\n *\n * @private\n */\n\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n _classPrivateFieldGet(_backlight, this).destroy();\n _classPrivateFieldGet(_guideline, this).destroy();\n super.destroy();\n }\n}\nfunction _onBeforeOnCellMouseDown(event, coords, TD, controller) {\n const wtTable = this.hot.view._wt.wtTable;\n const isHeaderSelection = this.hot.selection.isSelectedByColumnHeader();\n const selection = this.hot.getSelectedRangeLast();\n // This block action shouldn't be handled below.\n const isSortingElement = hasClass(event.target, 'sortAction');\n if (!selection || !isHeaderSelection || _classPrivateFieldGet(_pressed, this) || event.button !== 0 || isSortingElement) {\n _classPrivateFieldSet(_pressed, this, false);\n _classPrivateFieldGet(_columnsToMove, this).length = 0;\n removeClass(this.hot.rootElement, [CSS_ON_MOVING, CSS_SHOW_UI]);\n return;\n }\n const guidelineIsNotReady = _classPrivateFieldGet(_guideline, this).isBuilt() && !_classPrivateFieldGet(_guideline, this).isAppended();\n const backlightIsNotReady = _classPrivateFieldGet(_backlight, this).isBuilt() && !_classPrivateFieldGet(_backlight, this).isAppended();\n if (guidelineIsNotReady && backlightIsNotReady) {\n _classPrivateFieldGet(_guideline, this).appendTo(wtTable.hider);\n _classPrivateFieldGet(_backlight, this).appendTo(wtTable.hider);\n }\n const {\n from,\n to\n } = selection;\n const start = Math.min(from.col, to.col);\n const end = Math.max(from.col, to.col);\n if (coords.row < 0 && coords.col >= start && coords.col <= end) {\n controller.column = true;\n _classPrivateFieldSet(_pressed, this, true);\n const eventOffsetX = TD.firstChild ? offsetRelativeTo(event, TD.firstChild).x : event.offsetX;\n _classPrivateFieldGet(_target, this).eventPageX = event.pageX;\n _classPrivateFieldSet(_hoveredColumn, this, coords.col);\n _classPrivateFieldGet(_target, this).TD = TD;\n _classPrivateFieldGet(_target, this).col = coords.col;\n _classPrivateFieldSet(_columnsToMove, this, this.prepareColumnsToMoving(start, end));\n _classPrivateFieldSet(_hasRowHeaders, this, !!this.hot.getSettings().rowHeaders);\n _classPrivateFieldSet(_countCols, this, this.hot.countCols());\n _classPrivateFieldSet(_fixedColumnsStart, this, this.hot.getSettings().fixedColumnsStart);\n _classPrivateFieldSet(_rootElementOffset, this, offset(this.hot.rootElement).left);\n const countColumnsFrom = _classPrivateFieldGet(_hasRowHeaders, this) ? -1 : 0;\n const topPos = wtTable.holder.scrollTop + wtTable.getColumnHeaderHeight(0) + 1;\n const fixedColumnsStart = coords.col < _classPrivateFieldGet(_fixedColumnsStart, this);\n const horizontalScrollPosition = this.hot.view._wt.wtOverlays.inlineStartOverlay.getOverlayOffset();\n const offsetX = Math.abs(eventOffsetX - (this.hot.isRtl() ? TD.offsetWidth : 0));\n const inlineOffset = this.getColumnsWidth(start, coords.col - 1) + offsetX;\n const inlinePos = this.getColumnsWidth(countColumnsFrom, start - 1) + (fixedColumnsStart ? horizontalScrollPosition : 0) + inlineOffset;\n _classPrivateFieldGet(_backlight, this).setPosition(topPos, inlinePos);\n _classPrivateFieldGet(_backlight, this).setSize(this.getColumnsWidth(start, end), wtTable.hider.offsetHeight - topPos);\n _classPrivateFieldGet(_backlight, this).setOffset(null, -inlineOffset);\n addClass(this.hot.rootElement, CSS_ON_MOVING);\n } else {\n removeClass(this.hot.rootElement, CSS_AFTER_SELECTION);\n _classPrivateFieldSet(_pressed, this, false);\n _classPrivateFieldGet(_columnsToMove, this).length = 0;\n }\n}\n/**\n * 'mouseMove' event callback. Fired when pointer move on document.documentElement.\n *\n * @param {MouseEvent} event `mousemove` event properties.\n */\nfunction _onMouseMove(event) {\n if (!_classPrivateFieldGet(_pressed, this)) {\n return;\n }\n _classPrivateFieldGet(_target, this).eventPageX = event.pageX;\n this.refreshPositions();\n}\n/**\n * 'beforeOnCellMouseOver' hook callback. Fired when pointer was over cell.\n *\n * @param {MouseEvent} event `mouseover` event properties.\n * @param {CellCoords} coords Visual cell coordinates where was fired event.\n * @param {HTMLElement} TD Cell represented as HTMLElement.\n * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains\n * a boolean value that allows or disallows changing the selection for that particular area.\n */\nfunction _onBeforeOnCellMouseOver(event, coords, TD, controller) {\n const selectedRange = this.hot.getSelectedRangeLast();\n if (!selectedRange || !_classPrivateFieldGet(_pressed, this)) {\n return;\n }\n if (_classPrivateFieldGet(_columnsToMove, this).indexOf(coords.col) > -1) {\n removeClass(this.hot.rootElement, CSS_SHOW_UI);\n } else {\n addClass(this.hot.rootElement, CSS_SHOW_UI);\n }\n controller.row = true;\n controller.column = true;\n controller.cell = true;\n _classPrivateFieldSet(_hoveredColumn, this, coords.col);\n _classPrivateFieldGet(_target, this).TD = TD;\n}\n/**\n * `onMouseUp` hook callback.\n */\nfunction _onMouseUp() {\n const target = _classPrivateFieldGet(_target, this).col;\n const columnsLen = _classPrivateFieldGet(_columnsToMove, this).length;\n _classPrivateFieldSet(_hoveredColumn, this, undefined);\n _classPrivateFieldSet(_pressed, this, false);\n removeClass(this.hot.rootElement, [CSS_ON_MOVING, CSS_SHOW_UI, CSS_AFTER_SELECTION]);\n if (this.hot.selection.isSelectedByColumnHeader()) {\n addClass(this.hot.rootElement, CSS_AFTER_SELECTION);\n }\n if (columnsLen < 1 || target === undefined) {\n return;\n }\n const firstMovedVisualColumn = _classPrivateFieldGet(_columnsToMove, this)[0];\n const firstMovedPhysicalColumn = this.hot.toPhysicalColumn(firstMovedVisualColumn);\n const movePerformed = this.dragColumns(_classPrivateFieldGet(_columnsToMove, this), target);\n _classPrivateFieldGet(_columnsToMove, this).length = 0;\n if (movePerformed === true) {\n this.persistentStateSave();\n this.hot.render();\n this.hot.view.adjustElementsSize();\n const selectionStart = this.hot.toVisualColumn(firstMovedPhysicalColumn);\n const selectionEnd = selectionStart + columnsLen - 1;\n this.hot.selectColumns(selectionStart, selectionEnd);\n }\n}\n/**\n * `afterScrollHorizontally` hook callback. Fired the table was scrolled horizontally.\n */\nfunction _onAfterScrollVertically() {\n const wtTable = this.hot.view._wt.wtTable;\n const headerHeight = wtTable.getColumnHeaderHeight(0) + 1;\n const scrollTop = wtTable.holder.scrollTop;\n const posTop = headerHeight + scrollTop;\n _classPrivateFieldGet(_backlight, this).setPosition(posTop);\n _classPrivateFieldGet(_backlight, this).setSize(null, wtTable.hider.offsetHeight - posTop);\n}\nfunction _onAfterLoadData() {\n this.moveBySettingsOrLoad();\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, ManualColumnMove } from \"./manualColumnMove.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport { addClass, closest, hasClass, removeClass, outerHeight, isDetached } from \"../../helpers/dom/element.mjs\";\nimport { arrayEach } from \"../../helpers/array.mjs\";\nimport { rangeEach } from \"../../helpers/number.mjs\";\nimport { PhysicalIndexToValueMap as IndexToValueMap } from \"../../translations/index.mjs\"; // Developer note! Whenever you make a change in this file, make an analogous change in manualRowResize.js\nexport const PLUGIN_KEY = 'manualColumnResize';\nexport const PLUGIN_PRIORITY = 130;\nconst PERSISTENT_STATE_KEY = 'manualColumnWidths';\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @plugin ManualColumnResize\n * @class ManualColumnResize\n *\n * @description\n * This plugin allows to change columns width. To make columns width persistent the {@link Options#persistentState}\n * plugin should be enabled.\n *\n * The plugin creates additional components to make resizing possibly using user interface:\n * - handle - the draggable element that sets the desired width of the column.\n * - guide - the helper guide that shows the desired width as a vertical guide.\n */\nvar _currentTH = /*#__PURE__*/new WeakMap();\nvar _currentCol = /*#__PURE__*/new WeakMap();\nvar _selectedCols = /*#__PURE__*/new WeakMap();\nvar _currentWidth = /*#__PURE__*/new WeakMap();\nvar _newSize = /*#__PURE__*/new WeakMap();\nvar _startY = /*#__PURE__*/new WeakMap();\nvar _startWidth = /*#__PURE__*/new WeakMap();\nvar _startOffset = /*#__PURE__*/new WeakMap();\nvar _handle = /*#__PURE__*/new WeakMap();\nvar _guide = /*#__PURE__*/new WeakMap();\nvar _pressed = /*#__PURE__*/new WeakMap();\nvar _isTriggeredByRMB = /*#__PURE__*/new WeakMap();\nvar _dblclick = /*#__PURE__*/new WeakMap();\nvar _autoresizeTimeout = /*#__PURE__*/new WeakMap();\nvar _columnWidthsMap = /*#__PURE__*/new WeakMap();\nvar _config = /*#__PURE__*/new WeakMap();\nvar _ManualColumnResize_brand = /*#__PURE__*/new WeakSet();\nexport class ManualColumnResize extends BasePlugin {\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n\n /**\n * @type {HTMLTableHeaderCellElement}\n */\n\n constructor(hotInstance) {\n super(hotInstance);\n /**\n * Callback to call on map's `init` local hook.\n *\n * @private\n */\n _classPrivateMethodInitSpec(this, _ManualColumnResize_brand);\n _classPrivateFieldInitSpec(this, _currentTH, null);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _currentCol, null);\n /**\n * @type {number[]}\n */\n _classPrivateFieldInitSpec(this, _selectedCols, []);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _currentWidth, null);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _newSize, null);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _startY, null);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _startWidth, null);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _startOffset, null);\n /**\n * @type {HTMLElement}\n */\n _classPrivateFieldInitSpec(this, _handle, this.hot.rootDocument.createElement('DIV'));\n /**\n * @type {HTMLElement}\n */\n _classPrivateFieldInitSpec(this, _guide, this.hot.rootDocument.createElement('DIV'));\n /**\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _pressed, null);\n /**\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _isTriggeredByRMB, false);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _dblclick, 0);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _autoresizeTimeout, null);\n /**\n * PhysicalIndexToValueMap to keep and track widths for physical column indexes.\n *\n * @type {PhysicalIndexToValueMap}\n */\n _classPrivateFieldInitSpec(this, _columnWidthsMap, void 0);\n /**\n * Private pool to save configuration from updateSettings.\n *\n * @type {object}\n */\n _classPrivateFieldInitSpec(this, _config, void 0);\n addClass(_classPrivateFieldGet(_handle, this), 'manualColumnResizer');\n addClass(_classPrivateFieldGet(_guide, this), 'manualColumnResizerGuide');\n }\n\n /**\n * @private\n * @returns {string}\n */\n get inlineDir() {\n return this.hot.isRtl() ? 'right' : 'left';\n }\n\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link ManualColumnResize#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n if (this.enabled) {\n return;\n }\n _classPrivateFieldSet(_columnWidthsMap, this, new IndexToValueMap());\n _classPrivateFieldGet(_columnWidthsMap, this).addLocalHook('init', () => _assertClassBrand(_ManualColumnResize_brand, this, _onMapInit).call(this));\n this.hot.columnIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_columnWidthsMap, this));\n this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_ManualColumnResize_brand, this, _onModifyColWidth).call(this, width, col), 1);\n this.addHook('beforeStretchingColumnWidth', (stretchedWidth, column) => _assertClassBrand(_ManualColumnResize_brand, this, _onBeforeStretchingColumnWidth).call(this, stretchedWidth, column));\n this.addHook('beforeColumnResize', (newSize, column, isDoubleClick) => _assertClassBrand(_ManualColumnResize_brand, this, _onBeforeColumnResize).call(this, newSize, column, isDoubleClick));\n this.bindEvents();\n super.enablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`manualColumnResize`](@/api/options.md#manualcolumnresize)\n */\n updatePlugin() {\n this.disablePlugin();\n this.enablePlugin();\n super.updatePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n _classPrivateFieldSet(_config, this, _classPrivateFieldGet(_columnWidthsMap, this).getValues());\n this.hot.columnIndexMapper.unregisterMap(this.pluginName);\n super.disablePlugin();\n }\n\n /**\n * Saves the current sizes using the persistentState plugin (the {@link Options#persistentState} option has to be enabled).\n *\n * @fires Hooks#persistentStateSave\n */\n saveManualColumnWidths() {\n this.hot.runHooks('persistentStateSave', PERSISTENT_STATE_KEY, _classPrivateFieldGet(_columnWidthsMap, this).getValues());\n }\n\n /**\n * Loads the previously saved sizes using the persistentState plugin (the {@link Options#persistentState} option has to be enabled).\n *\n * @returns {Array}\n * @fires Hooks#persistentStateLoad\n */\n loadManualColumnWidths() {\n const storedState = {};\n this.hot.runHooks('persistentStateLoad', PERSISTENT_STATE_KEY, storedState);\n return storedState.value;\n }\n\n /**\n * Sets the new width for specified column index.\n *\n * @param {number} column Visual column index.\n * @param {number} width Column width (no less than 20px).\n * @returns {number} Returns new width.\n */\n setManualSize(column, width) {\n const newWidth = Math.max(width, 20);\n const physicalColumn = this.hot.toPhysicalColumn(column);\n _classPrivateFieldGet(_columnWidthsMap, this).setValueAtIndex(physicalColumn, newWidth);\n return newWidth;\n }\n\n /**\n * Clears the cache for the specified column index.\n *\n * @param {number} column Visual column index.\n */\n clearManualSize(column) {\n const physicalColumn = this.hot.toPhysicalColumn(column);\n _classPrivateFieldGet(_columnWidthsMap, this).setValueAtIndex(physicalColumn, null);\n }\n /**\n * Set the resize handle position.\n *\n * @private\n * @param {HTMLCellElement} TH TH HTML element.\n */\n setupHandlePosition(TH) {\n if (!TH.parentNode) {\n return;\n }\n _classPrivateFieldSet(_currentTH, this, TH);\n const {\n _wt: wt\n } = this.hot.view;\n const cellCoords = wt.wtTable.getCoords(_classPrivateFieldGet(_currentTH, this));\n const col = cellCoords.col;\n\n // Ignore column headers.\n if (col < 0) {\n return;\n }\n const headerHeight = outerHeight(_classPrivateFieldGet(_currentTH, this));\n const box = _classPrivateFieldGet(_currentTH, this).getBoundingClientRect();\n // Read \"fixedColumnsStart\" through the Walkontable as in that context, the fixed columns\n // are modified (reduced by the number of hidden columns) by TableView module.\n const fixedColumn = col < wt.getSetting('fixedColumnsStart');\n let relativeHeaderPosition;\n if (fixedColumn) {\n relativeHeaderPosition = wt.wtOverlays.topInlineStartCornerOverlay.getRelativeCellPosition(_classPrivateFieldGet(_currentTH, this), cellCoords.row, cellCoords.col);\n }\n\n // If the TH is not a child of the top-left overlay, recalculate using\n // the top overlay - as this overlay contains the rest of the headers.\n if (!relativeHeaderPosition) {\n relativeHeaderPosition = wt.wtOverlays.topOverlay.getRelativeCellPosition(_classPrivateFieldGet(_currentTH, this), cellCoords.row, cellCoords.col);\n }\n _classPrivateFieldSet(_currentCol, this, this.hot.columnIndexMapper.getVisualFromRenderableIndex(col));\n _classPrivateFieldSet(_selectedCols, this, []);\n const isFullColumnSelected = this.hot.selection.isSelectedByCorner() || this.hot.selection.isSelectedByColumnHeader();\n if (this.hot.selection.isSelected() && isFullColumnSelected) {\n const selectionRanges = this.hot.getSelectedRange();\n arrayEach(selectionRanges, selectionRange => {\n const fromColumn = selectionRange.getTopStartCorner().col;\n const toColumn = selectionRange.getBottomEndCorner().col;\n\n // Add every selected column for resize action.\n rangeEach(fromColumn, toColumn, columnIndex => {\n if (!_classPrivateFieldGet(_selectedCols, this).includes(columnIndex)) {\n _classPrivateFieldGet(_selectedCols, this).push(columnIndex);\n }\n });\n });\n }\n\n // Resizing element beyond the current selection (also when there is no selection).\n if (!_classPrivateFieldGet(_selectedCols, this).includes(_classPrivateFieldGet(_currentCol, this))) {\n _classPrivateFieldSet(_selectedCols, this, [_classPrivateFieldGet(_currentCol, this)]);\n }\n _classPrivateFieldSet(_startOffset, this, relativeHeaderPosition.start - 6);\n _classPrivateFieldSet(_startWidth, this, parseInt(box.width, 10));\n _classPrivateFieldGet(_handle, this).style.top = `${relativeHeaderPosition.top}px`;\n _classPrivateFieldGet(_handle, this).style[this.inlineDir] = `${_classPrivateFieldGet(_startOffset, this) + _classPrivateFieldGet(_startWidth, this)}px`;\n _classPrivateFieldGet(_handle, this).style.height = `${headerHeight}px`;\n this.hot.rootElement.appendChild(_classPrivateFieldGet(_handle, this));\n }\n\n /**\n * Refresh the resize handle position.\n *\n * @private\n */\n refreshHandlePosition() {\n _classPrivateFieldGet(_handle, this).style[this.inlineDir] = `${_classPrivateFieldGet(_startOffset, this) + _classPrivateFieldGet(_currentWidth, this)}px`;\n }\n\n /**\n * Sets the resize guide position.\n *\n * @private\n */\n setupGuidePosition() {\n const handleHeight = parseInt(outerHeight(_classPrivateFieldGet(_handle, this)), 10);\n const handleBottomPosition = parseInt(_classPrivateFieldGet(_handle, this).style.top, 10) + handleHeight;\n const maximumVisibleElementHeight = parseInt(this.hot.view.maximumVisibleElementHeight(0), 10);\n addClass(_classPrivateFieldGet(_handle, this), 'active');\n addClass(_classPrivateFieldGet(_guide, this), 'active');\n _classPrivateFieldGet(_guide, this).style.top = `${handleBottomPosition}px`;\n this.refreshGuidePosition();\n _classPrivateFieldGet(_guide, this).style.height = `${maximumVisibleElementHeight - handleHeight}px`;\n this.hot.rootElement.appendChild(_classPrivateFieldGet(_guide, this));\n }\n\n /**\n * Refresh the resize guide position.\n *\n * @private\n */\n refreshGuidePosition() {\n _classPrivateFieldGet(_guide, this).style[this.inlineDir] = _classPrivateFieldGet(_handle, this).style[this.inlineDir];\n }\n\n /**\n * Hides both the resize handle and resize guide.\n *\n * @private\n */\n hideHandleAndGuide() {\n removeClass(_classPrivateFieldGet(_handle, this), 'active');\n removeClass(_classPrivateFieldGet(_guide, this), 'active');\n }\n\n /**\n * Checks if provided element is considered a column header.\n *\n * @private\n * @param {HTMLElement} element HTML element.\n * @returns {boolean}\n */\n checkIfColumnHeader(element) {\n const thead = closest(element, ['THEAD'], this.hot.rootElement);\n const {\n topOverlay,\n topInlineStartCornerOverlay\n } = this.hot.view._wt.wtOverlays;\n return [topOverlay.clone.wtTable.THEAD, topInlineStartCornerOverlay.clone.wtTable.THEAD].includes(thead);\n }\n\n /**\n * Gets the TH element from the provided element.\n *\n * @private\n * @param {HTMLElement} element HTML element.\n * @returns {HTMLElement}\n */\n getClosestTHParent(element) {\n if (element.tagName !== 'TABLE') {\n if (element.tagName === 'TH') {\n return element;\n }\n return this.getClosestTHParent(element.parentNode);\n }\n return null;\n }\n\n /**\n * 'mouseover' event callback - set the handle position.\n *\n * @param {MouseEvent} event The mouse event.\n */\n\n /**\n * Auto-size row after doubleclick - callback.\n *\n * @private\n * @fires Hooks#beforeColumnResize\n * @fires Hooks#afterColumnResize\n */\n afterMouseDownTimeout() {\n const render = () => {\n this.hot.forceFullRender = true;\n this.hot.view.render(); // updates all\n this.hot.view.adjustElementsSize();\n };\n const resize = (column, forceRender) => {\n const hookNewSize = this.hot.runHooks('beforeColumnResize', _classPrivateFieldGet(_newSize, this), column, true);\n if (hookNewSize !== undefined) {\n _classPrivateFieldSet(_newSize, this, hookNewSize);\n }\n if (this.hot.getSettings().stretchH === 'all') {\n this.clearManualSize(column);\n } else {\n this.setManualSize(column, _classPrivateFieldGet(_newSize, this)); // double click sets by auto row size plugin\n }\n this.saveManualColumnWidths();\n this.hot.runHooks('afterColumnResize', _classPrivateFieldGet(_newSize, this), column, true);\n if (forceRender) {\n render();\n }\n };\n if (_classPrivateFieldGet(_dblclick, this) >= 2) {\n const selectedColsLength = _classPrivateFieldGet(_selectedCols, this).length;\n if (selectedColsLength > 1) {\n arrayEach(_classPrivateFieldGet(_selectedCols, this), selectedCol => {\n resize(selectedCol);\n });\n render();\n } else {\n arrayEach(_classPrivateFieldGet(_selectedCols, this), selectedCol => {\n resize(selectedCol, true);\n });\n }\n }\n _classPrivateFieldSet(_dblclick, this, 0);\n _classPrivateFieldSet(_autoresizeTimeout, this, null);\n }\n\n /**\n * 'mousedown' event callback.\n *\n * @param {MouseEvent} event The mouse event.\n */\n\n /**\n * Binds the mouse events.\n *\n * @private\n */\n bindEvents() {\n const {\n rootWindow,\n rootElement\n } = this.hot;\n this.eventManager.addEventListener(rootElement, 'mouseover', e => _assertClassBrand(_ManualColumnResize_brand, this, _onMouseOver).call(this, e));\n this.eventManager.addEventListener(rootElement, 'mousedown', e => _assertClassBrand(_ManualColumnResize_brand, this, _onMouseDown).call(this, e));\n this.eventManager.addEventListener(rootWindow, 'mousemove', e => _assertClassBrand(_ManualColumnResize_brand, this, _onMouseMove).call(this, e));\n this.eventManager.addEventListener(rootWindow, 'mouseup', () => _assertClassBrand(_ManualColumnResize_brand, this, _onMouseUp).call(this));\n this.eventManager.addEventListener(_classPrivateFieldGet(_handle, this), 'contextmenu', () => _assertClassBrand(_ManualColumnResize_brand, this, _onContextMenu).call(this));\n }\n\n /**\n * Modifies the provided column width, based on the plugin settings.\n *\n * @param {number} width Column width.\n * @param {number} column Visual column index.\n * @returns {number}\n */\n\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n super.destroy();\n }\n}\nfunction _onMapInit() {\n const initialSetting = this.hot.getSettings()[PLUGIN_KEY];\n const loadedManualColumnWidths = this.loadManualColumnWidths();\n if (typeof loadedManualColumnWidths !== 'undefined') {\n this.hot.batchExecution(() => {\n loadedManualColumnWidths.forEach((width, physicalIndex) => {\n _classPrivateFieldGet(_columnWidthsMap, this).setValueAtIndex(physicalIndex, width);\n });\n }, true);\n } else if (Array.isArray(initialSetting)) {\n this.hot.batchExecution(() => {\n initialSetting.forEach((width, physicalIndex) => {\n _classPrivateFieldGet(_columnWidthsMap, this).setValueAtIndex(physicalIndex, width);\n });\n }, true);\n _classPrivateFieldSet(_config, this, initialSetting);\n } else if (initialSetting === true && Array.isArray(_classPrivateFieldGet(_config, this))) {\n this.hot.batchExecution(() => {\n _classPrivateFieldGet(_config, this).forEach((width, physicalIndex) => {\n _classPrivateFieldGet(_columnWidthsMap, this).setValueAtIndex(physicalIndex, width);\n });\n }, true);\n }\n}\nfunction _onMouseOver(event) {\n // Workaround for #6926 - if the `event.target` is temporarily detached, we can skip this callback and wait for\n // the next `onmouseover`.\n if (isDetached(event.target)) {\n return;\n }\n\n // A \"mouseover\" action is triggered right after executing \"contextmenu\" event. It should be ignored.\n if (_classPrivateFieldGet(_isTriggeredByRMB, this) === true) {\n return;\n }\n if (this.checkIfColumnHeader(event.target)) {\n const th = this.getClosestTHParent(event.target);\n if (!th) {\n return;\n }\n const colspan = th.getAttribute('colspan');\n if (th && (colspan === null || colspan === '1')) {\n if (!_classPrivateFieldGet(_pressed, this)) {\n this.setupHandlePosition(th);\n }\n }\n }\n}\nfunction _onMouseDown(event) {\n if (event.target.parentNode !== this.hot.rootElement) {\n return;\n }\n if (hasClass(event.target, 'manualColumnResizer')) {\n this.setupHandlePosition(_classPrivateFieldGet(_currentTH, this));\n this.setupGuidePosition();\n _classPrivateFieldSet(_pressed, this, true);\n if (_classPrivateFieldGet(_autoresizeTimeout, this) === null) {\n _classPrivateFieldSet(_autoresizeTimeout, this, setTimeout(() => this.afterMouseDownTimeout(), 500));\n this.hot._registerTimeout(_classPrivateFieldGet(_autoresizeTimeout, this));\n }\n _classPrivateFieldSet(_dblclick, this, _classPrivateFieldGet(_dblclick, this) + 1);\n this.startX = event.pageX;\n _classPrivateFieldSet(_newSize, this, _classPrivateFieldGet(_startWidth, this));\n }\n}\n/**\n * 'mousemove' event callback - refresh the handle and guide positions, cache the new column width.\n *\n * @param {MouseEvent} event The mouse event.\n */\nfunction _onMouseMove(event) {\n if (_classPrivateFieldGet(_pressed, this)) {\n const change = (event.pageX - this.startX) * this.hot.getDirectionFactor();\n _classPrivateFieldSet(_currentWidth, this, _classPrivateFieldGet(_startWidth, this) + change);\n arrayEach(_classPrivateFieldGet(_selectedCols, this), selectedCol => {\n _classPrivateFieldSet(_newSize, this, this.setManualSize(selectedCol, _classPrivateFieldGet(_currentWidth, this)));\n });\n this.refreshHandlePosition();\n this.refreshGuidePosition();\n }\n}\n/**\n * 'mouseup' event callback - apply the column resizing.\n *\n * @fires Hooks#beforeColumnResize\n * @fires Hooks#afterColumnResize\n */\nfunction _onMouseUp() {\n const render = () => {\n this.hot.forceFullRender = true;\n this.hot.view.render(); // updates all\n this.hot.view.adjustElementsSize();\n };\n const resize = (column, forceRender) => {\n this.hot.runHooks('beforeColumnResize', _classPrivateFieldGet(_newSize, this), column, false);\n if (forceRender) {\n render();\n }\n this.saveManualColumnWidths();\n this.hot.runHooks('afterColumnResize', _classPrivateFieldGet(_newSize, this), column, false);\n };\n if (_classPrivateFieldGet(_pressed, this)) {\n this.hideHandleAndGuide();\n _classPrivateFieldSet(_pressed, this, false);\n if (_classPrivateFieldGet(_newSize, this) !== _classPrivateFieldGet(_startWidth, this)) {\n const selectedColsLength = _classPrivateFieldGet(_selectedCols, this).length;\n if (selectedColsLength > 1) {\n arrayEach(_classPrivateFieldGet(_selectedCols, this), selectedCol => {\n resize(selectedCol);\n });\n render();\n } else {\n arrayEach(_classPrivateFieldGet(_selectedCols, this), selectedCol => {\n resize(selectedCol, true);\n });\n }\n }\n this.setupHandlePosition(_classPrivateFieldGet(_currentTH, this));\n }\n}\n/**\n * Callback for \"contextmenu\" event triggered on element showing move handle. It removes handle and guide elements.\n */\nfunction _onContextMenu() {\n this.hideHandleAndGuide();\n this.hot.rootElement.removeChild(_classPrivateFieldGet(_handle, this));\n this.hot.rootElement.removeChild(_classPrivateFieldGet(_guide, this));\n _classPrivateFieldSet(_pressed, this, false);\n _classPrivateFieldSet(_isTriggeredByRMB, this, true);\n\n // There is thrown \"mouseover\" event right after opening a context menu. This flag inform that handle\n // shouldn't be drawn just after removing it.\n this.hot._registerImmediate(() => {\n _classPrivateFieldSet(_isTriggeredByRMB, this, false);\n });\n}\nfunction _onModifyColWidth(width, column) {\n let newWidth = width;\n if (this.enabled) {\n const physicalColumn = this.hot.toPhysicalColumn(column);\n const columnWidth = _classPrivateFieldGet(_columnWidthsMap, this).getValueAtIndex(physicalColumn);\n if (this.hot.getSettings()[PLUGIN_KEY] && columnWidth) {\n newWidth = columnWidth;\n }\n }\n return newWidth;\n}\n/**\n * Modifies the provided column stretched width. This hook decides if specified column should be stretched or not.\n *\n * @param {number} stretchedWidth Stretched width.\n * @param {number} column Visual column index.\n * @returns {number}\n */\nfunction _onBeforeStretchingColumnWidth(stretchedWidth, column) {\n let width = _classPrivateFieldGet(_columnWidthsMap, this).getValueAtIndex(column);\n if (width === null) {\n width = stretchedWidth;\n }\n return width;\n}\n/**\n * `beforeColumnResize` hook callback.\n */\nfunction _onBeforeColumnResize() {\n // clear the header height cache information\n this.hot.view._wt.wtViewport.resetHasOversizedColumnHeadersMarked();\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, ManualColumnResize } from \"./manualColumnResize.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nconst STATE_INITIALIZED = 0;\nconst STATE_BUILT = 1;\nconst STATE_APPENDED = 2;\nconst UNIT = 'px';\n\n/**\n * @private\n */\nclass BaseUI {\n constructor(hotInstance) {\n /**\n * Instance of Handsontable.\n *\n * @type {Core}\n */\n _defineProperty(this, \"hot\", void 0);\n /**\n * DOM element representing the ui element.\n *\n * @type {HTMLElement}\n * @private\n */\n _defineProperty(this, \"_element\", null);\n /**\n * Flag which determines build state of element.\n *\n * @type {number}\n */\n _defineProperty(this, \"state\", STATE_INITIALIZED);\n this.hot = hotInstance;\n }\n\n /**\n * Add created UI elements to table.\n *\n * @param {HTMLElement} wrapper Element which are parent for our UI element.\n */\n appendTo(wrapper) {\n wrapper.appendChild(this._element);\n this.state = STATE_APPENDED;\n }\n\n /**\n * Method for create UI element. Only create, without append to table.\n */\n build() {\n if (this.state !== STATE_INITIALIZED) {\n return;\n }\n this._element = this.hot.rootDocument.createElement('div');\n this.state = STATE_BUILT;\n }\n\n /**\n * Method for remove UI element.\n */\n destroy() {\n if (this.isAppended()) {\n this._element.parentElement.removeChild(this._element);\n }\n this._element = null;\n this.state = STATE_INITIALIZED;\n }\n\n /**\n * Check if UI element are appended.\n *\n * @returns {boolean}\n */\n isAppended() {\n return this.state === STATE_APPENDED;\n }\n\n /**\n * Check if UI element are built.\n *\n * @returns {boolean}\n */\n isBuilt() {\n return this.state >= STATE_BUILT;\n }\n\n /**\n * Setter for position.\n *\n * @param {number} top New top position of the element.\n * @param {number} left New left position of the element.\n */\n setPosition(top, left) {\n if (top !== undefined) {\n this._element.style.top = top + UNIT;\n }\n if (left !== undefined) {\n this._element.style.left = left + UNIT;\n }\n }\n\n /**\n * Getter for the element position.\n *\n * @returns {object} Object contains left and top position of the element.\n */\n getPosition() {\n return {\n top: this._element.style.top ? parseInt(this._element.style.top, 10) : 0,\n left: this._element.style.left ? parseInt(this._element.style.left, 10) : 0\n };\n }\n\n /**\n * Setter for the element size.\n *\n * @param {number} width New width of the element.\n * @param {number} height New height of the element.\n */\n setSize(width, height) {\n if (width) {\n this._element.style.width = width + UNIT;\n }\n if (height) {\n this._element.style.height = height + UNIT;\n }\n }\n\n /**\n * Getter for the element position.\n *\n * @returns {object} Object contains height and width of the element.\n */\n getSize() {\n return {\n width: this._element.style.width ? parseInt(this._element.style.width, 10) : 0,\n height: this._element.style.height ? parseInt(this._element.style.height, 10) : 0\n };\n }\n\n /**\n * Setter for the element offset. Offset means marginTop and marginLeft of the element.\n *\n * @param {number} top New margin top of the element.\n * @param {number} left New margin left of the element.\n */\n setOffset(top, left) {\n if (top) {\n this._element.style.marginTop = top + UNIT;\n }\n if (left) {\n this._element.style.marginLeft = left + UNIT;\n }\n }\n\n /**\n * Getter for the element offset.\n *\n * @returns {object} Object contains top and left offset of the element.\n */\n getOffset() {\n return {\n top: this._element.style.marginTop ? parseInt(this._element.style.marginTop, 10) : 0,\n left: this._element.style.marginLeft ? parseInt(this._element.style.marginLeft, 10) : 0\n };\n }\n}\nexport default BaseUI;", "import BaseUI from \"./_base.mjs\";\nimport { addClass } from \"../../../helpers/dom/element.mjs\";\nconst CSS_CLASSNAME = 'ht__manualRowMove--backlight';\n\n/**\n * @private\n * @class BacklightUI\n */\nclass BacklightUI extends BaseUI {\n /**\n * Custom className on build process.\n */\n build() {\n super.build();\n addClass(this._element, CSS_CLASSNAME);\n }\n}\nexport default BacklightUI;", "import BaseUI from \"./_base.mjs\";\nimport { addClass } from \"../../../helpers/dom/element.mjs\";\nconst CSS_CLASSNAME = 'ht__manualRowMove--guideline';\n\n/**\n * @private\n * @class GuidelineUI\n */\nclass GuidelineUI extends BaseUI {\n /**\n * Custom className on build process.\n */\n build() {\n super.build();\n addClass(this._element, CSS_CLASSNAME);\n }\n}\nexport default GuidelineUI;", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport Hooks from \"../../pluginHooks.mjs\";\nimport { arrayReduce } from \"../../helpers/array.mjs\";\nimport { addClass, removeClass, offset, getTrimmingContainer } from \"../../helpers/dom/element.mjs\";\nimport { rangeEach } from \"../../helpers/number.mjs\";\nimport BacklightUI from \"./ui/backlight.mjs\";\nimport GuidelineUI from \"./ui/guideline.mjs\";\nHooks.getSingleton().register('beforeRowMove');\nHooks.getSingleton().register('afterRowMove');\nexport const PLUGIN_KEY = 'manualRowMove';\nexport const PLUGIN_PRIORITY = 140;\nconst CSS_PLUGIN = 'ht__manualRowMove';\nconst CSS_SHOW_UI = 'show-ui';\nconst CSS_ON_MOVING = 'on-moving--rows';\nconst CSS_AFTER_SELECTION = 'after-selection--rows';\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @plugin ManualRowMove\n * @class ManualRowMove\n *\n * @description\n * This plugin allows to change rows order. To make rows order persistent the {@link Options#persistentState}\n * plugin should be enabled.\n *\n * API:\n * - `moveRow` - move single row to the new position.\n * - `moveRows` - move many rows (as an array of indexes) to the new position.\n * - `dragRow` - drag single row to the new position.\n * - `dragRows` - drag many rows (as an array of indexes) to the new position.\n *\n * [Documentation](@/guides/rows/row-moving/row-moving.md) explain differences between drag and move actions. Please keep in mind that if you want apply visual changes,\n * you have to call manually the `render` method on the instance of Handsontable.\n *\n * The plugin creates additional components to make moving possibly using user interface:\n * - backlight - highlight of selected rows.\n * - guideline - line which shows where rows has been moved.\n *\n * @class ManualRowMove\n * @plugin ManualRowMove\n */\nvar _backlight = /*#__PURE__*/new WeakMap();\nvar _guideline = /*#__PURE__*/new WeakMap();\nvar _rowsToMove = /*#__PURE__*/new WeakMap();\nvar _pressed = /*#__PURE__*/new WeakMap();\nvar _target = /*#__PURE__*/new WeakMap();\nvar _cachedDropIndex = /*#__PURE__*/new WeakMap();\nvar _ManualRowMove_brand = /*#__PURE__*/new WeakSet();\nexport class ManualRowMove extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * Change the behavior of selection / dragging.\n *\n * @param {MouseEvent} event `mousedown` event properties.\n * @param {CellCoords} coords Visual cell coordinates where was fired event.\n * @param {HTMLElement} TD Cell represented as HTMLElement.\n * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains\n * a boolean value that allows or disallows changing the selection for that particular area.\n */\n _classPrivateMethodInitSpec(this, _ManualRowMove_brand);\n /**\n * Backlight UI object.\n *\n * @type {object}\n */\n _classPrivateFieldInitSpec(this, _backlight, new BacklightUI(this.hot));\n /**\n * Guideline UI object.\n *\n * @type {object}\n */\n _classPrivateFieldInitSpec(this, _guideline, new GuidelineUI(this.hot));\n /**\n * @type {number[]}\n */\n _classPrivateFieldInitSpec(this, _rowsToMove, []);\n /**\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _pressed, void 0);\n /**\n * @type {object}\n */\n _classPrivateFieldInitSpec(this, _target, {});\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _cachedDropIndex, void 0);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link ManualRowMove#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n var _this = this;\n if (this.enabled) {\n return;\n }\n this.addHook('beforeOnCellMouseDown', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _assertClassBrand(_ManualRowMove_brand, _this, _onBeforeOnCellMouseDown).call(_this, ...args);\n });\n this.addHook('beforeOnCellMouseOver', function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _assertClassBrand(_ManualRowMove_brand, _this, _onBeforeOnCellMouseOver).call(_this, ...args);\n });\n this.addHook('afterScrollHorizontally', () => _assertClassBrand(_ManualRowMove_brand, this, _onAfterScrollHorizontally).call(this));\n this.addHook('afterLoadData', function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n return _assertClassBrand(_ManualRowMove_brand, _this, _onAfterLoadData).call(_this, ...args);\n });\n this.buildPluginUI();\n this.registerEvents();\n\n // TODO: move adding plugin classname to BasePlugin.\n addClass(this.hot.rootElement, CSS_PLUGIN);\n super.enablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`manualRowMove`](@/api/options.md#manualrowmove)\n */\n updatePlugin() {\n this.disablePlugin();\n this.enablePlugin();\n this.moveBySettingsOrLoad();\n super.updatePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n removeClass(this.hot.rootElement, CSS_PLUGIN);\n this.unregisterEvents();\n _classPrivateFieldGet(_backlight, this).destroy();\n _classPrivateFieldGet(_guideline, this).destroy();\n super.disablePlugin();\n }\n\n /**\n * Moves a single row.\n *\n * To see the outcome, rerender your grid by calling [`render()`](@/api/core.md#render).\n *\n * @param {number} row Visual row index to be moved.\n * @param {number} finalIndex Visual row index, being a start index for the moved rows. Points to where the elements will be placed after the moving action.\n * To check the visualization of the final index, please take a look at [documentation](@/guides/rows/row-moving/row-moving.md#drag-and-move-actions-of-manualrowmove-plugin).\n * @fires Hooks#beforeRowMove\n * @fires Hooks#afterRowMove\n * @returns {boolean}\n */\n moveRow(row, finalIndex) {\n return this.moveRows([row], finalIndex);\n }\n\n /**\n * Moves multiple rows.\n *\n * To see the outcome, rerender your grid by calling [`render()`](@/api/core.md#render).\n *\n * @param {Array} rows Array of visual row indexes to be moved.\n * @param {number} finalIndex Visual row index, being a start index for the moved rows. Points to where the elements will be placed after the moving action.\n * To check the visualization of the final index, please take a look at [documentation](@/guides/rows/row-moving/row-moving.md#drag-and-move-actions-of-manualrowmove-plugin).\n * @fires Hooks#beforeRowMove\n * @fires Hooks#afterRowMove\n * @returns {boolean}\n */\n moveRows(rows, finalIndex) {\n const dropIndex = _classPrivateFieldGet(_cachedDropIndex, this);\n const movePossible = this.isMovePossible(rows, finalIndex);\n const beforeMoveHook = this.hot.runHooks('beforeRowMove', rows, finalIndex, dropIndex, movePossible);\n _classPrivateFieldSet(_cachedDropIndex, this, undefined);\n if (beforeMoveHook === false) {\n return;\n }\n if (movePossible) {\n this.hot.rowIndexMapper.moveIndexes(rows, finalIndex);\n }\n const movePerformed = movePossible && this.isRowOrderChanged(rows, finalIndex);\n this.hot.runHooks('afterRowMove', rows, finalIndex, dropIndex, movePossible, movePerformed);\n return movePerformed;\n }\n\n /**\n * Drag a single row to drop index position.\n *\n * @param {number} row Visual row index to be dragged.\n * @param {number} dropIndex Visual row index, being a drop index for the moved rows. Points to where we are going to drop the moved elements.\n * To check visualization of drop index please take a look at [documentation](@/guides/rows/row-moving/row-moving.md#drag-and-move-actions-of-manualrowmove-plugin).\n * @fires Hooks#beforeRowMove\n * @fires Hooks#afterRowMove\n * @returns {boolean}\n */\n dragRow(row, dropIndex) {\n return this.dragRows([row], dropIndex);\n }\n\n /**\n * Drag multiple rows to drop index position.\n *\n * @param {Array} rows Array of visual row indexes to be dragged.\n * @param {number} dropIndex Visual row index, being a drop index for the moved rows. Points to where we are going to drop the moved elements.\n * To check visualization of drop index please take a look at [documentation](@/guides/rows/row-moving/row-moving.md#drag-and-move-actions-of-manualrowmove-plugin).\n * @fires Hooks#beforeRowMove\n * @fires Hooks#afterRowMove\n * @returns {boolean}\n */\n dragRows(rows, dropIndex) {\n const finalIndex = this.countFinalIndex(rows, dropIndex);\n _classPrivateFieldSet(_cachedDropIndex, this, dropIndex);\n return this.moveRows(rows, finalIndex);\n }\n\n /**\n * Indicates if it's possible to move rows to the desired position. Some of the actions aren't possible, i.e. You can\u2019t move more than one element to the last position.\n *\n * @param {Array} movedRows Array of visual row indexes to be moved.\n * @param {number} finalIndex Visual row index, being a start index for the moved rows. Points to where the elements will be placed after the moving action.\n * To check the visualization of the final index, please take a look at [documentation](@/guides/rows/row-moving/row-moving.md#drag-and-move-actions-of-manualrowmove-plugin).\n * @returns {boolean}\n */\n isMovePossible(movedRows, finalIndex) {\n const length = this.hot.rowIndexMapper.getNotTrimmedIndexesLength();\n\n // An attempt to transfer more rows to start destination than is possible (only when moving from the top to the bottom).\n const tooHighDestinationIndex = movedRows.length + finalIndex > length;\n const tooLowDestinationIndex = finalIndex < 0;\n const tooLowMovedRowIndex = movedRows.some(movedRow => movedRow < 0);\n const tooHighMovedRowIndex = movedRows.some(movedRow => movedRow >= length);\n if (tooHighDestinationIndex || tooLowDestinationIndex || tooLowMovedRowIndex || tooHighMovedRowIndex) {\n return false;\n }\n return true;\n }\n\n /**\n * Indicates if order of rows was changed.\n *\n * @private\n * @param {Array} movedRows Array of visual row indexes to be moved.\n * @param {number} finalIndex Visual row index, being a start index for the moved rows. Points to where the elements will be placed after the moving action.\n * To check the visualization of the final index, please take a look at [documentation](@/guides/rows/row-moving/row-moving.md#drag-and-move-actions-of-manualrowmove-plugin).\n * @returns {boolean}\n */\n isRowOrderChanged(movedRows, finalIndex) {\n return movedRows.some((row, nrOfMovedElement) => row - nrOfMovedElement !== finalIndex);\n }\n\n /**\n * Count the final row index from the drop index.\n *\n * @private\n * @param {Array} movedRows Array of visual row indexes to be moved.\n * @param {number} dropIndex Visual row index, being a drop index for the moved rows.\n * @returns {number} Visual row index, being a start index for the moved rows.\n */\n countFinalIndex(movedRows, dropIndex) {\n const numberOfRowsLowerThanDropIndex = arrayReduce(movedRows, (numberOfRows, currentRowIndex) => {\n if (currentRowIndex < dropIndex) {\n numberOfRows += 1;\n }\n return numberOfRows;\n }, 0);\n return dropIndex - numberOfRowsLowerThanDropIndex;\n }\n\n /**\n * Gets the sum of the heights of rows in the provided range.\n *\n * @private\n * @param {number} fromRow Visual row index.\n * @param {number} toRow Visual row index.\n * @returns {number}\n */\n getRowsHeight(fromRow, toRow) {\n const rowMapper = this.hot.rowIndexMapper;\n let rowsHeight = 0;\n for (let visualRowIndex = fromRow; visualRowIndex <= toRow; visualRowIndex++) {\n const renderableIndex = rowMapper.getRenderableFromVisualIndex(visualRowIndex);\n if (renderableIndex !== null) {\n rowsHeight += this.hot.view._wt.wtTable.getRowHeight(renderableIndex) || 23;\n }\n }\n return rowsHeight;\n }\n\n /**\n * Loads initial settings when persistent state is saved or when plugin was initialized as an array.\n *\n * @private\n */\n moveBySettingsOrLoad() {\n const pluginSettings = this.hot.getSettings()[PLUGIN_KEY];\n if (Array.isArray(pluginSettings)) {\n this.moveRows(pluginSettings, 0);\n } else if (pluginSettings !== undefined) {\n const persistentState = this.persistentStateLoad();\n if (persistentState.length) {\n this.moveRows(persistentState, 0);\n }\n }\n }\n\n /**\n * Checks if the provided row is in the fixedRowsTop section.\n *\n * @private\n * @param {number} row Visual row index to check.\n * @returns {boolean}\n */\n isFixedRowTop(row) {\n return row < this.hot.getSettings().fixedRowsTop;\n }\n\n /**\n * Checks if the provided row is in the fixedRowsBottom section.\n *\n * @private\n * @param {number} row Visual row index to check.\n * @returns {boolean}\n */\n isFixedRowBottom(row) {\n return row > this.hot.countRows() - 1 - this.hot.getSettings().fixedRowsBottom;\n }\n\n /**\n * Saves the manual row positions to the persistent state (the {@link Options#persistentState} option has to be enabled).\n *\n * @private\n * @fires Hooks#persistentStateSave\n */\n persistentStateSave() {\n // The `PersistentState` plugin should be refactored.\n this.hot.runHooks('persistentStateSave', 'manualRowMove', this.hot.rowIndexMapper.getIndexesSequence());\n }\n\n /**\n * Loads the manual row positions from the persistent state (the {@link Options#persistentState} option has to be enabled).\n *\n * @private\n * @fires Hooks#persistentStateLoad\n * @returns {Array} Stored state.\n */\n persistentStateLoad() {\n const storedState = {};\n this.hot.runHooks('persistentStateLoad', 'manualRowMove', storedState);\n return storedState.value ? storedState.value : [];\n }\n\n /**\n * Prepares an array of indexes based on actual selection.\n *\n * @private\n * @returns {Array}\n */\n prepareRowsToMoving() {\n const selection = this.hot.getSelectedRangeLast();\n const selectedRows = [];\n if (!selection) {\n return selectedRows;\n }\n const {\n from,\n to\n } = selection;\n const start = Math.min(from.row, to.row);\n const end = Math.max(from.row, to.row);\n rangeEach(start, end, i => {\n selectedRows.push(i);\n });\n return selectedRows;\n }\n\n /**\n * Update the UI visual position.\n *\n * @private\n */\n refreshPositions() {\n const coords = _classPrivateFieldGet(_target, this).coords;\n const firstVisible = this.hot.view.getFirstFullyVisibleRow();\n const lastVisible = this.hot.view.getLastFullyVisibleRow();\n const countRows = this.hot.countRows();\n if (this.isFixedRowTop(coords.row) && firstVisible > 0) {\n this.hot.scrollViewportTo(this.hot.rowIndexMapper.getNearestNotHiddenIndex(firstVisible - 1, -1));\n }\n if (this.isFixedRowBottom(coords.row) && lastVisible < countRows) {\n this.hot.scrollViewportTo(this.hot.rowIndexMapper.getNearestNotHiddenIndex(lastVisible + 1, 1), undefined, true);\n }\n const wtTable = this.hot.view._wt.wtTable;\n const TD = _classPrivateFieldGet(_target, this).TD;\n const rootElement = this.hot.rootElement;\n const rootElementOffset = offset(rootElement);\n const trimmingContainer = getTrimmingContainer(rootElement);\n const tableScroll = wtTable.holder.scrollTop;\n const trimmingContainerScroll = this.hot.rootWindow !== trimmingContainer ? trimmingContainer.scrollTop : 0;\n const pixelsAbove = rootElementOffset.top - trimmingContainerScroll;\n const pixelsRelToTableStart = _classPrivateFieldGet(_target, this).eventPageY - pixelsAbove + tableScroll;\n const hiderHeight = wtTable.hider.offsetHeight;\n const tbodyOffsetTop = wtTable.TBODY.offsetTop;\n const backlightElemMarginTop = _classPrivateFieldGet(_backlight, this).getOffset().top;\n const backlightElemHeight = _classPrivateFieldGet(_backlight, this).getSize().height;\n const tdMiddle = TD.offsetHeight / 2;\n const tdHeight = TD.offsetHeight;\n let tdStartPixel = this.hot.view.THEAD.offsetHeight + this.getRowsHeight(0, coords.row - 1);\n const isBelowTable = pixelsRelToTableStart >= tdStartPixel + tdMiddle;\n if (this.isFixedRowTop(coords.row)) {\n tdStartPixel += this.hot.view._wt.wtOverlays.topOverlay.getOverlayOffset();\n }\n if (coords.row < 0) {\n // if hover on colHeader\n _classPrivateFieldGet(_target, this).row = firstVisible > 0 ? firstVisible - 1 : firstVisible;\n } else if (isBelowTable) {\n // if hover on lower part of TD\n _classPrivateFieldGet(_target, this).row = coords.row + 1;\n // unfortunately first row is bigger than rest\n tdStartPixel += coords.row === 0 ? tdHeight - 1 : tdHeight;\n } else {\n // elsewhere on table\n _classPrivateFieldGet(_target, this).row = coords.row;\n }\n let backlightTop = pixelsRelToTableStart;\n let guidelineTop = tdStartPixel;\n if (pixelsRelToTableStart + backlightElemHeight + backlightElemMarginTop >= hiderHeight) {\n // prevent display backlight below table\n backlightTop = hiderHeight - backlightElemHeight - backlightElemMarginTop;\n } else if (pixelsRelToTableStart + backlightElemMarginTop < tbodyOffsetTop) {\n // prevent display above below table\n backlightTop = tbodyOffsetTop + Math.abs(backlightElemMarginTop);\n }\n if (tdStartPixel >= hiderHeight - 1) {\n // prevent display guideline below table\n guidelineTop = hiderHeight - 1;\n }\n _classPrivateFieldGet(_backlight, this).setPosition(backlightTop);\n _classPrivateFieldGet(_guideline, this).setPosition(guidelineTop);\n }\n\n /**\n * Binds the events used by the plugin.\n *\n * @private\n */\n registerEvents() {\n const {\n documentElement\n } = this.hot.rootDocument;\n this.eventManager.addEventListener(documentElement, 'mousemove', event => _assertClassBrand(_ManualRowMove_brand, this, _onMouseMove).call(this, event));\n this.eventManager.addEventListener(documentElement, 'mouseup', () => _assertClassBrand(_ManualRowMove_brand, this, _onMouseUp).call(this));\n }\n\n /**\n * Unbinds the events used by the plugin.\n *\n * @private\n */\n unregisterEvents() {\n this.eventManager.clear();\n }\n /**\n * Builds the plugin's UI.\n *\n * @private\n */\n buildPluginUI() {\n _classPrivateFieldGet(_backlight, this).build();\n _classPrivateFieldGet(_guideline, this).build();\n }\n\n /**\n * Callback for the `afterLoadData` hook.\n */\n\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n _classPrivateFieldGet(_backlight, this).destroy();\n _classPrivateFieldGet(_guideline, this).destroy();\n super.destroy();\n }\n}\nfunction _onBeforeOnCellMouseDown(event, coords, TD, controller) {\n const {\n wtTable,\n wtViewport\n } = this.hot.view._wt;\n const isHeaderSelection = this.hot.selection.isSelectedByRowHeader();\n const selection = this.hot.getSelectedRangeLast();\n if (!selection || !isHeaderSelection || _classPrivateFieldGet(_pressed, this) || event.button !== 0) {\n _classPrivateFieldSet(_pressed, this, false);\n _classPrivateFieldGet(_rowsToMove, this).length = 0;\n removeClass(this.hot.rootElement, [CSS_ON_MOVING, CSS_SHOW_UI]);\n return;\n }\n const guidelineIsNotReady = _classPrivateFieldGet(_guideline, this).isBuilt() && !_classPrivateFieldGet(_guideline, this).isAppended();\n const backlightIsNotReady = _classPrivateFieldGet(_backlight, this).isBuilt() && !_classPrivateFieldGet(_backlight, this).isAppended();\n if (guidelineIsNotReady && backlightIsNotReady) {\n _classPrivateFieldGet(_guideline, this).appendTo(wtTable.hider);\n _classPrivateFieldGet(_backlight, this).appendTo(wtTable.hider);\n }\n const {\n from,\n to\n } = selection;\n const start = Math.min(from.row, to.row);\n const end = Math.max(from.row, to.row);\n if (coords.col < 0 && coords.row >= start && coords.row <= end) {\n controller.row = true;\n _classPrivateFieldSet(_pressed, this, true);\n _classPrivateFieldGet(_target, this).eventPageY = event.pageY;\n _classPrivateFieldGet(_target, this).coords = coords;\n _classPrivateFieldGet(_target, this).TD = TD;\n _classPrivateFieldSet(_rowsToMove, this, this.prepareRowsToMoving());\n const leftPos = wtTable.holder.scrollLeft + wtViewport.getRowHeaderWidth();\n const topOffset = this.getRowsHeight(start, coords.row - 1) + event.offsetY;\n _classPrivateFieldGet(_backlight, this).setPosition(null, leftPos);\n _classPrivateFieldGet(_backlight, this).setSize(wtTable.hider.offsetWidth - leftPos, this.getRowsHeight(start, end));\n _classPrivateFieldGet(_backlight, this).setOffset(-topOffset, null);\n addClass(this.hot.rootElement, CSS_ON_MOVING);\n this.refreshPositions();\n } else {\n removeClass(this.hot.rootElement, CSS_AFTER_SELECTION);\n _classPrivateFieldSet(_pressed, this, false);\n _classPrivateFieldGet(_rowsToMove, this).length = 0;\n }\n}\n/**\n * 'mouseMove' event callback. Fired when pointer move on document.documentElement.\n *\n * @param {MouseEvent} event `mousemove` event properties.\n */\nfunction _onMouseMove(event) {\n if (!_classPrivateFieldGet(_pressed, this)) {\n return;\n }\n _classPrivateFieldGet(_target, this).eventPageY = event.pageY;\n this.refreshPositions();\n}\n/**\n * 'beforeOnCellMouseOver' hook callback. Fired when pointer was over cell.\n *\n * @param {MouseEvent} event `mouseover` event properties.\n * @param {CellCoords} coords Visual cell coordinates where was fired event.\n * @param {HTMLElement} TD Cell represented as HTMLElement.\n * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains\n * a boolean value that allows or disallows changing the selection for that particular area.\n */\nfunction _onBeforeOnCellMouseOver(event, coords, TD, controller) {\n const selectedRange = this.hot.getSelectedRangeLast();\n if (!selectedRange || !_classPrivateFieldGet(_pressed, this)) {\n return;\n }\n if (_classPrivateFieldGet(_rowsToMove, this).indexOf(coords.row) > -1) {\n removeClass(this.hot.rootElement, CSS_SHOW_UI);\n } else {\n addClass(this.hot.rootElement, CSS_SHOW_UI);\n }\n controller.row = true;\n controller.column = true;\n controller.cell = true;\n _classPrivateFieldGet(_target, this).coords = coords;\n _classPrivateFieldGet(_target, this).TD = TD;\n}\n/**\n * `onMouseUp` hook callback.\n */\nfunction _onMouseUp() {\n const target = _classPrivateFieldGet(_target, this).row;\n const rowsLen = _classPrivateFieldGet(_rowsToMove, this).length;\n _classPrivateFieldSet(_pressed, this, false);\n removeClass(this.hot.rootElement, [CSS_ON_MOVING, CSS_SHOW_UI, CSS_AFTER_SELECTION]);\n if (this.hot.selection.isSelectedByRowHeader()) {\n addClass(this.hot.rootElement, CSS_AFTER_SELECTION);\n }\n if (rowsLen < 1 || target === undefined) {\n return;\n }\n const firstMovedVisualRow = _classPrivateFieldGet(_rowsToMove, this)[0];\n const firstMovedPhysicalRow = this.hot.toPhysicalRow(firstMovedVisualRow);\n const movePerformed = this.dragRows(_classPrivateFieldGet(_rowsToMove, this), target);\n _classPrivateFieldGet(_rowsToMove, this).length = 0;\n if (movePerformed === true) {\n this.persistentStateSave();\n this.hot.render();\n this.hot.view.adjustElementsSize();\n const selectionStart = this.hot.toVisualRow(firstMovedPhysicalRow);\n const selectionEnd = selectionStart + rowsLen - 1;\n this.hot.selectRows(selectionStart, selectionEnd);\n }\n}\n/**\n * `afterScrollHorizontally` hook callback. Fired the table was scrolled horizontally.\n */\nfunction _onAfterScrollHorizontally() {\n const wtTable = this.hot.view._wt.wtTable;\n const headerWidth = this.hot.view._wt.wtViewport.getRowHeaderWidth();\n const scrollLeft = wtTable.holder.scrollLeft;\n const posLeft = headerWidth + scrollLeft;\n _classPrivateFieldGet(_backlight, this).setPosition(null, posLeft);\n _classPrivateFieldGet(_backlight, this).setSize(wtTable.hider.offsetWidth - posLeft);\n}\nfunction _onAfterLoadData() {\n this.moveBySettingsOrLoad();\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, ManualRowMove } from \"./manualRowMove.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport { addClass, closest, hasClass, removeClass, outerWidth, isDetached } from \"../../helpers/dom/element.mjs\";\nimport { arrayEach } from \"../../helpers/array.mjs\";\nimport { rangeEach } from \"../../helpers/number.mjs\";\nimport { PhysicalIndexToValueMap as IndexToValueMap } from \"../../translations/index.mjs\";\nimport { DEFAULT_ROW_HEIGHT } from \"../../3rdparty/walkontable/src/index.mjs\"; // Developer note! Whenever you make a change in this file, make an analogous change in manualColumnResize.js\nexport const PLUGIN_KEY = 'manualRowResize';\nexport const PLUGIN_PRIORITY = 30;\nconst PERSISTENT_STATE_KEY = 'manualRowHeights';\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @plugin ManualRowResize\n * @class ManualRowResize\n *\n * @description\n * This plugin allows to change rows height. To make rows height persistent the {@link Options#persistentState}\n * plugin should be enabled.\n *\n * The plugin creates additional components to make resizing possibly using user interface:\n * - handle - the draggable element that sets the desired height of the row.\n * - guide - the helper guide that shows the desired height as a horizontal guide.\n */\nvar _currentTH = /*#__PURE__*/new WeakMap();\nvar _currentRow = /*#__PURE__*/new WeakMap();\nvar _selectedRows = /*#__PURE__*/new WeakMap();\nvar _currentHeight = /*#__PURE__*/new WeakMap();\nvar _newSize = /*#__PURE__*/new WeakMap();\nvar _startY = /*#__PURE__*/new WeakMap();\nvar _startHeight = /*#__PURE__*/new WeakMap();\nvar _startOffset = /*#__PURE__*/new WeakMap();\nvar _handle = /*#__PURE__*/new WeakMap();\nvar _guide = /*#__PURE__*/new WeakMap();\nvar _pressed = /*#__PURE__*/new WeakMap();\nvar _isTriggeredByRMB = /*#__PURE__*/new WeakMap();\nvar _dblclick = /*#__PURE__*/new WeakMap();\nvar _autoresizeTimeout = /*#__PURE__*/new WeakMap();\nvar _rowHeightsMap = /*#__PURE__*/new WeakMap();\nvar _config = /*#__PURE__*/new WeakMap();\nvar _ManualRowResize_brand = /*#__PURE__*/new WeakSet();\nexport class ManualRowResize extends BasePlugin {\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n\n /**\n * @type {HTMLTableCellElement}\n */\n\n constructor(hotInstance) {\n super(hotInstance);\n /**\n * 'mouseover' event callback - set the handle position.\n *\n * @param {MouseEvent} event The mouse event.\n */\n _classPrivateMethodInitSpec(this, _ManualRowResize_brand);\n _classPrivateFieldInitSpec(this, _currentTH, null);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _currentRow, null);\n /**\n * @type {number[]}\n */\n _classPrivateFieldInitSpec(this, _selectedRows, []);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _currentHeight, null);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _newSize, null);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _startY, null);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _startHeight, null);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _startOffset, null);\n /**\n * @type {HTMLElement}\n */\n _classPrivateFieldInitSpec(this, _handle, this.hot.rootDocument.createElement('DIV'));\n /**\n * @type {HTMLElement}\n */\n _classPrivateFieldInitSpec(this, _guide, this.hot.rootDocument.createElement('DIV'));\n /**\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _pressed, false);\n /**\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _isTriggeredByRMB, false);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _dblclick, 0);\n /**\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _autoresizeTimeout, null);\n /**\n * PhysicalIndexToValueMap to keep and track widths for physical row indexes.\n *\n * @type {PhysicalIndexToValueMap}\n */\n _classPrivateFieldInitSpec(this, _rowHeightsMap, void 0);\n /**\n * Private pool to save configuration from updateSettings.\n *\n * @type {object}\n */\n _classPrivateFieldInitSpec(this, _config, void 0);\n addClass(_classPrivateFieldGet(_handle, this), 'manualRowResizer');\n addClass(_classPrivateFieldGet(_guide, this), 'manualRowResizerGuide');\n }\n\n /**\n * @private\n * @returns {string}\n */\n get inlineDir() {\n return this.hot.isRtl() ? 'right' : 'left';\n }\n\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link ManualRowResize#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n if (this.enabled) {\n return;\n }\n _classPrivateFieldSet(_rowHeightsMap, this, new IndexToValueMap());\n _classPrivateFieldGet(_rowHeightsMap, this).addLocalHook('init', () => _assertClassBrand(_ManualRowResize_brand, this, _onMapInit).call(this));\n this.hot.rowIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_rowHeightsMap, this));\n this.addHook('modifyRowHeight', (height, row) => _assertClassBrand(_ManualRowResize_brand, this, _onModifyRowHeight).call(this, height, row));\n this.bindEvents();\n super.enablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`manualRowResize`](@/api/options.md#manualrowresize)\n */\n updatePlugin() {\n this.disablePlugin();\n this.enablePlugin();\n super.updatePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n _classPrivateFieldSet(_config, this, _classPrivateFieldGet(_rowHeightsMap, this).getValues());\n this.hot.rowIndexMapper.unregisterMap(this.pluginName);\n super.disablePlugin();\n }\n\n /**\n * Saves the current sizes using the persistentState plugin (the {@link Options#persistentState} option has to be\n * enabled).\n *\n * @fires Hooks#persistentStateSave\n */\n saveManualRowHeights() {\n this.hot.runHooks('persistentStateSave', PERSISTENT_STATE_KEY, _classPrivateFieldGet(_rowHeightsMap, this).getValues());\n }\n\n /**\n * Loads the previously saved sizes using the persistentState plugin (the {@link Options#persistentState} option\n * has be enabled).\n *\n * @returns {Array}\n * @fires Hooks#persistentStateLoad\n */\n loadManualRowHeights() {\n const storedState = {};\n this.hot.runHooks('persistentStateLoad', PERSISTENT_STATE_KEY, storedState);\n return storedState.value;\n }\n\n /**\n * Sets the new height for specified row index.\n *\n * @param {number} row Visual row index.\n * @param {number} height Row height.\n * @returns {number} Returns new height.\n */\n setManualSize(row, height) {\n const physicalRow = this.hot.toPhysicalRow(row);\n const newHeight = Math.max(height, DEFAULT_ROW_HEIGHT);\n _classPrivateFieldGet(_rowHeightsMap, this).setValueAtIndex(physicalRow, newHeight);\n return newHeight;\n }\n\n /**\n * Returns the last desired row height set manually with the resize handle.\n *\n * @returns {number} The last desired row height.\n */\n getLastDesiredRowHeight() {\n return _classPrivateFieldGet(_currentHeight, this);\n }\n\n /**\n * Sets the resize handle position.\n *\n * @private\n * @param {HTMLCellElement} TH TH HTML element.\n */\n setupHandlePosition(TH) {\n _classPrivateFieldSet(_currentTH, this, TH);\n const {\n view\n } = this.hot;\n const {\n _wt: wt\n } = view;\n const cellCoords = wt.wtTable.getCoords(_classPrivateFieldGet(_currentTH, this));\n const row = cellCoords.row;\n\n // Ignore row headers.\n if (row < 0) {\n return;\n }\n const headerWidth = outerWidth(_classPrivateFieldGet(_currentTH, this));\n const box = _classPrivateFieldGet(_currentTH, this).getBoundingClientRect();\n // Read \"fixedRowsTop\" and \"fixedRowsBottom\" through the Walkontable as in that context, the fixed\n // rows are modified (reduced by the number of hidden rows) by TableView module.\n const fixedRowTop = row < wt.getSetting('fixedRowsTop');\n const fixedRowBottom = row >= view.countNotHiddenRowIndexes(0, 1) - wt.getSetting('fixedRowsBottom');\n let relativeHeaderPosition;\n if (fixedRowTop) {\n relativeHeaderPosition = wt.wtOverlays.topInlineStartCornerOverlay.getRelativeCellPosition(_classPrivateFieldGet(_currentTH, this), cellCoords.row, cellCoords.col);\n } else if (fixedRowBottom) {\n relativeHeaderPosition = wt.wtOverlays.bottomInlineStartCornerOverlay.getRelativeCellPosition(_classPrivateFieldGet(_currentTH, this), cellCoords.row, cellCoords.col);\n }\n\n // If the TH is not a child of the top-left/bottom-left overlay, recalculate using\n // the left overlay - as this overlay contains the rest of the headers.\n if (!relativeHeaderPosition) {\n relativeHeaderPosition = wt.wtOverlays.inlineStartOverlay.getRelativeCellPosition(_classPrivateFieldGet(_currentTH, this), cellCoords.row, cellCoords.col);\n }\n _classPrivateFieldSet(_currentRow, this, this.hot.rowIndexMapper.getVisualFromRenderableIndex(row));\n _classPrivateFieldSet(_selectedRows, this, []);\n const isFullRowSelected = this.hot.selection.isSelectedByCorner() || this.hot.selection.isSelectedByRowHeader();\n if (this.hot.selection.isSelected() && isFullRowSelected) {\n const selectionRanges = this.hot.getSelectedRange();\n arrayEach(selectionRanges, selectionRange => {\n const fromRow = selectionRange.getTopStartCorner().row;\n const toRow = selectionRange.getBottomStartCorner().row;\n\n // Add every selected row for resize action.\n rangeEach(fromRow, toRow, rowIndex => {\n if (!_classPrivateFieldGet(_selectedRows, this).includes(rowIndex)) {\n _classPrivateFieldGet(_selectedRows, this).push(rowIndex);\n }\n });\n });\n }\n\n // Resizing element beyond the current selection (also when there is no selection).\n if (!_classPrivateFieldGet(_selectedRows, this).includes(_classPrivateFieldGet(_currentRow, this))) {\n _classPrivateFieldSet(_selectedRows, this, [_classPrivateFieldGet(_currentRow, this)]);\n }\n _classPrivateFieldSet(_startOffset, this, relativeHeaderPosition.top - 6);\n _classPrivateFieldSet(_startHeight, this, parseInt(box.height, 10));\n _classPrivateFieldGet(_handle, this).style.top = `${_classPrivateFieldGet(_startOffset, this) + _classPrivateFieldGet(_startHeight, this)}px`;\n _classPrivateFieldGet(_handle, this).style[this.inlineDir] = `${relativeHeaderPosition.start}px`;\n _classPrivateFieldGet(_handle, this).style.width = `${headerWidth}px`;\n this.hot.rootElement.appendChild(_classPrivateFieldGet(_handle, this));\n }\n\n /**\n * Refresh the resize handle position.\n *\n * @private\n */\n refreshHandlePosition() {\n _classPrivateFieldGet(_handle, this).style.top = `${_classPrivateFieldGet(_startOffset, this) + _classPrivateFieldGet(_currentHeight, this)}px`;\n }\n\n /**\n * Sets the resize guide position.\n *\n * @private\n */\n setupGuidePosition() {\n const handleWidth = parseInt(outerWidth(_classPrivateFieldGet(_handle, this)), 10);\n const handleEndPosition = parseInt(_classPrivateFieldGet(_handle, this).style[this.inlineDir], 10) + handleWidth;\n const maximumVisibleElementWidth = parseInt(this.hot.view.maximumVisibleElementWidth(0), 10);\n addClass(_classPrivateFieldGet(_handle, this), 'active');\n addClass(_classPrivateFieldGet(_guide, this), 'active');\n _classPrivateFieldGet(_guide, this).style.top = _classPrivateFieldGet(_handle, this).style.top;\n _classPrivateFieldGet(_guide, this).style[this.inlineDir] = `${handleEndPosition}px`;\n _classPrivateFieldGet(_guide, this).style.width = `${maximumVisibleElementWidth - handleWidth}px`;\n this.hot.rootElement.appendChild(_classPrivateFieldGet(_guide, this));\n }\n\n /**\n * Refresh the resize guide position.\n *\n * @private\n */\n refreshGuidePosition() {\n _classPrivateFieldGet(_guide, this).style.top = _classPrivateFieldGet(_handle, this).style.top;\n }\n\n /**\n * Hides both the resize handle and resize guide.\n *\n * @private\n */\n hideHandleAndGuide() {\n removeClass(_classPrivateFieldGet(_handle, this), 'active');\n removeClass(_classPrivateFieldGet(_guide, this), 'active');\n }\n\n /**\n * Checks if provided element is considered as a row header.\n *\n * @private\n * @param {HTMLElement} element HTML element.\n * @returns {boolean}\n */\n checkIfRowHeader(element) {\n const tbody = closest(element, ['TBODY'], this.hot.rootElement);\n const {\n inlineStartOverlay,\n topInlineStartCornerOverlay,\n bottomInlineStartCornerOverlay\n } = this.hot.view._wt.wtOverlays;\n return [inlineStartOverlay.clone.wtTable.TBODY, topInlineStartCornerOverlay.clone.wtTable.TBODY, bottomInlineStartCornerOverlay.clone.wtTable.TBODY].includes(tbody);\n }\n\n /**\n * Gets the TH element from the provided element.\n *\n * @private\n * @param {HTMLElement} element HTML element.\n * @returns {HTMLElement}\n */\n getClosestTHParent(element) {\n if (element.tagName !== 'TABLE') {\n if (element.tagName === 'TH') {\n return element;\n }\n return this.getClosestTHParent(element.parentNode);\n }\n return null;\n }\n\n /**\n * Returns the actual height for the provided row index.\n *\n * @private\n * @param {number} row Visual row index.\n * @returns {number} Actual row height.\n */\n getActualRowHeight(row) {\n // TODO: this should utilize `this.hot.getRowHeight` after it's fixed and working properly.\n const walkontableHeight = this.hot.view._wt.wtTable.getRowHeight(row);\n if (walkontableHeight !== undefined && _classPrivateFieldGet(_newSize, this) < walkontableHeight) {\n return walkontableHeight;\n }\n return _classPrivateFieldGet(_newSize, this);\n }\n /**\n * Auto-size row after doubleclick - callback.\n *\n * @private\n * @fires Hooks#beforeRowResize\n * @fires Hooks#afterRowResize\n */\n afterMouseDownTimeout() {\n const render = () => {\n this.hot.forceFullRender = true;\n this.hot.view.render(); // updates all\n this.hot.view.adjustElementsSize();\n };\n const resize = (row, forceRender) => {\n const hookNewSize = this.hot.runHooks('beforeRowResize', this.getActualRowHeight(row), row, true);\n if (hookNewSize !== undefined) {\n _classPrivateFieldSet(_newSize, this, hookNewSize);\n }\n this.setManualSize(row, _classPrivateFieldGet(_newSize, this)); // double click sets auto row size\n\n this.hot.runHooks('afterRowResize', this.getActualRowHeight(row), row, true);\n if (forceRender) {\n render();\n }\n };\n if (_classPrivateFieldGet(_dblclick, this) >= 2) {\n const selectedRowsLength = _classPrivateFieldGet(_selectedRows, this).length;\n if (selectedRowsLength > 1) {\n arrayEach(_classPrivateFieldGet(_selectedRows, this), selectedRow => {\n resize(selectedRow);\n });\n render();\n } else {\n arrayEach(_classPrivateFieldGet(_selectedRows, this), selectedRow => {\n resize(selectedRow, true);\n });\n }\n }\n _classPrivateFieldSet(_dblclick, this, 0);\n _classPrivateFieldSet(_autoresizeTimeout, this, null);\n }\n\n /**\n * 'mousedown' event callback.\n *\n * @param {MouseEvent} event The mouse event.\n */\n\n /**\n * Binds the mouse events.\n *\n * @private\n */\n bindEvents() {\n const {\n rootElement,\n rootWindow\n } = this.hot;\n this.eventManager.addEventListener(rootElement, 'mouseover', e => _assertClassBrand(_ManualRowResize_brand, this, _onMouseOver).call(this, e));\n this.eventManager.addEventListener(rootElement, 'mousedown', e => _assertClassBrand(_ManualRowResize_brand, this, _onMouseDown).call(this, e));\n this.eventManager.addEventListener(rootWindow, 'mousemove', e => _assertClassBrand(_ManualRowResize_brand, this, _onMouseMove).call(this, e));\n this.eventManager.addEventListener(rootWindow, 'mouseup', () => _assertClassBrand(_ManualRowResize_brand, this, _onMouseUp).call(this));\n this.eventManager.addEventListener(_classPrivateFieldGet(_handle, this), 'contextmenu', () => _assertClassBrand(_ManualRowResize_brand, this, _onContextMenu).call(this));\n }\n\n /**\n * Modifies the provided row height, based on the plugin settings.\n *\n * @param {number} height Row height.\n * @param {number} row Visual row index.\n * @returns {number}\n */\n\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n super.destroy();\n }\n}\nfunction _onMouseOver(event) {\n // Workaround for #6926 - if the `event.target` is temporarily detached, we can skip this callback and wait for\n // the next `onmouseover`.\n if (isDetached(event.target)) {\n return;\n }\n\n // A \"mouseover\" action is triggered right after executing \"contextmenu\" event. It should be ignored.\n if (_classPrivateFieldGet(_isTriggeredByRMB, this) === true) {\n return;\n }\n if (this.checkIfRowHeader(event.target)) {\n const th = this.getClosestTHParent(event.target);\n if (th) {\n if (!_classPrivateFieldGet(_pressed, this)) {\n this.setupHandlePosition(th);\n }\n }\n }\n}\nfunction _onMouseDown(event) {\n if (hasClass(event.target, 'manualRowResizer')) {\n this.setupHandlePosition(_classPrivateFieldGet(_currentTH, this));\n this.setupGuidePosition();\n _classPrivateFieldSet(_pressed, this, true);\n if (_classPrivateFieldGet(_autoresizeTimeout, this) === null) {\n _classPrivateFieldSet(_autoresizeTimeout, this, setTimeout(() => this.afterMouseDownTimeout(), 500));\n this.hot._registerTimeout(_classPrivateFieldGet(_autoresizeTimeout, this));\n }\n _classPrivateFieldSet(_dblclick, this, _classPrivateFieldGet(_dblclick, this) + 1);\n _classPrivateFieldSet(_startY, this, event.pageY);\n _classPrivateFieldSet(_newSize, this, _classPrivateFieldGet(_startHeight, this));\n }\n}\n/**\n * 'mousemove' event callback - refresh the handle and guide positions, cache the new row height.\n *\n * @param {MouseEvent} event The mouse event.\n */\nfunction _onMouseMove(event) {\n if (_classPrivateFieldGet(_pressed, this)) {\n _classPrivateFieldSet(_currentHeight, this, _classPrivateFieldGet(_startHeight, this) + (event.pageY - _classPrivateFieldGet(_startY, this)));\n arrayEach(_classPrivateFieldGet(_selectedRows, this), selectedRow => {\n _classPrivateFieldSet(_newSize, this, this.setManualSize(selectedRow, _classPrivateFieldGet(_currentHeight, this)));\n });\n this.refreshHandlePosition();\n this.refreshGuidePosition();\n }\n}\n/**\n * 'mouseup' event callback - apply the row resizing.\n *\n * @fires Hooks#beforeRowResize\n * @fires Hooks#afterRowResize\n */\nfunction _onMouseUp() {\n const render = () => {\n this.hot.forceFullRender = true;\n this.hot.view.render(); // updates all\n this.hot.view.adjustElementsSize();\n };\n const runHooks = (row, forceRender) => {\n this.hot.runHooks('beforeRowResize', this.getActualRowHeight(row), row, false);\n if (forceRender) {\n render();\n }\n this.saveManualRowHeights();\n this.hot.runHooks('afterRowResize', this.getActualRowHeight(row), row, false);\n };\n if (_classPrivateFieldGet(_pressed, this)) {\n this.hideHandleAndGuide();\n _classPrivateFieldSet(_pressed, this, false);\n if (_classPrivateFieldGet(_newSize, this) !== _classPrivateFieldGet(_startHeight, this)) {\n const selectedRowsLength = _classPrivateFieldGet(_selectedRows, this).length;\n if (selectedRowsLength > 1) {\n arrayEach(_classPrivateFieldGet(_selectedRows, this), selectedRow => {\n runHooks(selectedRow);\n });\n render();\n } else {\n arrayEach(_classPrivateFieldGet(_selectedRows, this), selectedRow => {\n runHooks(selectedRow, true);\n });\n }\n }\n this.setupHandlePosition(_classPrivateFieldGet(_currentTH, this));\n }\n}\n/**\n * Callback for \"contextmenu\" event triggered on element showing move handle. It removes handle and guide elements.\n */\nfunction _onContextMenu() {\n this.hideHandleAndGuide();\n this.hot.rootElement.removeChild(_classPrivateFieldGet(_handle, this));\n this.hot.rootElement.removeChild(_classPrivateFieldGet(_guide, this));\n _classPrivateFieldSet(_pressed, this, false);\n _classPrivateFieldSet(_isTriggeredByRMB, this, true);\n\n // There is thrown \"mouseover\" event right after opening a context menu. This flag inform that handle\n // shouldn't be drawn just after removing it.\n this.hot._registerImmediate(() => {\n _classPrivateFieldSet(_isTriggeredByRMB, this, false);\n });\n}\nfunction _onModifyRowHeight(height, row) {\n let newHeight = height;\n if (this.enabled) {\n const physicalRow = this.hot.toPhysicalRow(row);\n const rowHeight = _classPrivateFieldGet(_rowHeightsMap, this).getValueAtIndex(physicalRow);\n if (this.hot.getSettings()[PLUGIN_KEY] && rowHeight) {\n newHeight = rowHeight;\n }\n }\n return newHeight;\n}\n/**\n * Callback to call on map's `init` local hook.\n */\nfunction _onMapInit() {\n const initialSetting = this.hot.getSettings()[PLUGIN_KEY];\n const loadedManualRowHeights = this.loadManualRowHeights();\n this.hot.batchExecution(() => {\n if (typeof loadedManualRowHeights !== 'undefined') {\n loadedManualRowHeights.forEach((height, index) => {\n _classPrivateFieldGet(_rowHeightsMap, this).setValueAtIndex(index, height);\n });\n } else if (Array.isArray(initialSetting)) {\n initialSetting.forEach((height, index) => {\n _classPrivateFieldGet(_rowHeightsMap, this).setValueAtIndex(index, height);\n });\n _classPrivateFieldSet(_config, this, initialSetting);\n } else if (initialSetting === true && Array.isArray(_classPrivateFieldGet(_config, this))) {\n _classPrivateFieldGet(_config, this).forEach((height, index) => {\n _classPrivateFieldGet(_rowHeightsMap, this).setValueAtIndex(index, height);\n });\n }\n }, true);\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, ManualRowResize } from \"./manualRowResize.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { toSingleLine } from \"../../helpers/templateLiteralTag.mjs\";\n/**\n * The `MergedCellCoords` class represents a single merged cell.\n *\n * @private\n * @class MergedCellCoords\n */\nvar _cellRange = /*#__PURE__*/new WeakMap();\nclass MergedCellCoords {\n constructor(row, column, rowspan, colspan, cellCoordsFactory, cellRangeFactory) {\n /**\n * The index of the topmost merged cell row.\n *\n * @type {number}\n */\n _defineProperty(this, \"row\", void 0);\n /**\n * The index of the leftmost column.\n *\n * @type {number}\n */\n _defineProperty(this, \"col\", void 0);\n /**\n * The `rowspan` value of the merged cell.\n *\n * @type {number}\n */\n _defineProperty(this, \"rowspan\", void 0);\n /**\n * The `colspan` value of the merged cell.\n *\n * @type {number}\n */\n _defineProperty(this, \"colspan\", void 0);\n /**\n * `true` only if the merged cell is bound to be removed.\n *\n * @type {boolean}\n */\n _defineProperty(this, \"removed\", false);\n /**\n * The CellCoords function factory.\n *\n * @type {Function}\n */\n _defineProperty(this, \"cellCoordsFactory\", void 0);\n /**\n * The CellRange function factory.\n *\n * @type {Function}\n */\n _defineProperty(this, \"cellRangeFactory\", void 0);\n /**\n * The cached range coordinates of the merged cell.\n *\n * @type {CellRange}\n */\n _classPrivateFieldInitSpec(this, _cellRange, null);\n this.row = row;\n this.col = column;\n this.rowspan = rowspan;\n this.colspan = colspan;\n this.cellCoordsFactory = cellCoordsFactory;\n this.cellRangeFactory = cellRangeFactory;\n }\n\n /**\n * Get a warning message for when the declared merged cell data contains negative values.\n *\n * @param {{ row: number, col: number, rowspan: number, colspan: number }} mergedCell Object containing information\n * about the merged cells that was about to be added.\n * @returns {string}\n */\n static NEGATIVE_VALUES_WARNING(_ref) {\n let {\n row,\n col,\n rowspan,\n colspan\n } = _ref;\n return toSingleLine`The merged cell declared with {row: ${row}, col: ${col},\\x20\n rowspan: ${rowspan}, colspan: ${colspan}} contains negative values, which is\\x20\n not supported. It will not be added to the collection.`;\n }\n\n /**\n * Get a warning message for when the declared merged cell data contains values exceeding the table limits.\n *\n * @param {{ row: number, col: number, rowspan: number, colspan: number }} mergedCell Object containing information\n * about the merged cells that was about to be added.\n * @returns {string}\n */\n static IS_OUT_OF_BOUNDS_WARNING(_ref2) {\n let {\n row,\n col\n } = _ref2;\n return toSingleLine`The merged cell declared at [${row}, ${col}] is positioned\\x20\n (or positioned partially) outside of the table range. It was not added to the table, please fix your setup.`;\n }\n\n /**\n * Get a warning message for when the declared merged cell data represents a single cell.\n *\n * @param {{ row: number, col: number, rowspan: number, colspan: number }} mergedCell Object containing information\n * about the merged cells that was about to be added.\n * @returns {string}\n */\n static IS_SINGLE_CELL(_ref3) {\n let {\n row,\n col\n } = _ref3;\n return toSingleLine`The merged cell declared at [${row}, ${col}] has both \"rowspan\"\\x20\n and \"colspan\" declared as \"1\", which makes it a single cell. It cannot be added to the collection.`;\n }\n\n /**\n * Get a warning message for when the declared merged cell data contains \"colspan\" or \"rowspan\", that equals 0.\n *\n * @param {{ row: number, col: number, rowspan: number, colspan: number }} mergedCell Object containing information\n * about the merged cells that was about to be added.\n * @returns {string}\n */\n static ZERO_SPAN_WARNING(_ref4) {\n let {\n row,\n col\n } = _ref4;\n return toSingleLine`The merged cell declared at [${row}, ${col}] has \"rowspan\"\\x20\n or \"colspan\" declared as \"0\", which is not supported. It cannot be added to the collection.`;\n }\n\n /**\n * Check whether the values provided for a merged cell contain any negative values.\n *\n * @param {{ row: number, col: number, rowspan: number, colspan: number }} mergedCell Object containing information\n * about the merged cells that was about to be added.\n * @returns {boolean}\n */\n static containsNegativeValues(_ref5) {\n let {\n row,\n col,\n rowspan,\n colspan\n } = _ref5;\n return row < 0 || col < 0 || rowspan < 0 || colspan < 0;\n }\n\n /**\n * Check whether the provided merged cell information object represents a single cell.\n *\n * @private\n * @param {{ row: number, col: number, rowspan: number, colspan: number }} mergedCell Object containing information\n * about the merged cells that was about to be added.\n * @returns {boolean}\n */\n static isSingleCell(_ref6) {\n let {\n rowspan,\n colspan\n } = _ref6;\n return colspan === 1 && rowspan === 1;\n }\n\n /**\n * Check whether the provided merged cell information object contains a rowspan or colspan of 0.\n *\n * @private\n * @param {{ row: number, col: number, rowspan: number, colspan: number }} mergedCell Object containing information\n * about the merged cells that was about to be added.\n * @returns {boolean}\n */\n static containsZeroSpan(_ref7) {\n let {\n rowspan,\n colspan\n } = _ref7;\n return colspan === 0 || rowspan === 0;\n }\n\n /**\n * Check whether the provided merged cell object is to be declared out of bounds of the table.\n *\n * @param {object} mergeCell Object containing the `row`, `col`, `rowspan` and `colspan` properties.\n * @param {number} rowCount Number of rows in the table.\n * @param {number} columnCount Number of rows in the table.\n * @returns {boolean}\n */\n static isOutOfBounds(mergeCell, rowCount, columnCount) {\n return mergeCell.row < 0 || mergeCell.col < 0 || mergeCell.row >= rowCount || mergeCell.row + mergeCell.rowspan - 1 >= rowCount || mergeCell.col >= columnCount || mergeCell.col + mergeCell.colspan - 1 >= columnCount;\n }\n\n /**\n * Sanitize (prevent from going outside the boundaries) the merged cell.\n *\n * @param {Core} hotInstance The Handsontable instance.\n */\n normalize(hotInstance) {\n const totalRows = hotInstance.countRows();\n const totalColumns = hotInstance.countCols();\n if (this.row < 0) {\n this.row = 0;\n } else if (this.row > totalRows - 1) {\n this.row = totalRows - 1;\n }\n if (this.col < 0) {\n this.col = 0;\n } else if (this.col > totalColumns - 1) {\n this.col = totalColumns - 1;\n }\n if (this.row + this.rowspan > totalRows - 1) {\n this.rowspan = totalRows - this.row;\n }\n if (this.col + this.colspan > totalColumns - 1) {\n this.colspan = totalColumns - this.col;\n }\n _classPrivateFieldSet(_cellRange, this, null);\n }\n\n /**\n * Returns `true` if the provided coordinates are inside the merged cell.\n *\n * @param {number} row The row index.\n * @param {number} column The column index.\n * @returns {boolean}\n */\n includes(row, column) {\n return this.row <= row && this.col <= column && this.row + this.rowspan - 1 >= row && this.col + this.colspan - 1 >= column;\n }\n\n /**\n * Returns `true` if the provided `column` property is within the column span of the merged cell.\n *\n * @param {number} column The column index.\n * @returns {boolean}\n */\n includesHorizontally(column) {\n return this.col <= column && this.col + this.colspan - 1 >= column;\n }\n\n /**\n * Returns `true` if the provided `row` property is within the row span of the merged cell.\n *\n * @param {number} row Row index.\n * @returns {boolean}\n */\n includesVertically(row) {\n return this.row <= row && this.row + this.rowspan - 1 >= row;\n }\n\n /**\n * Shift (and possibly resize, if needed) the merged cell.\n *\n * @param {Array} shiftVector 2-element array containing the information on the shifting in the `x` and `y` axis.\n * @param {number} indexOfChange Index of the preceding change.\n * @returns {boolean} Returns `false` if the whole merged cell was removed.\n */\n shift(shiftVector, indexOfChange) {\n const shiftValue = shiftVector[0] || shiftVector[1];\n const shiftedIndex = indexOfChange + Math.abs(shiftVector[0] || shiftVector[1]) - 1;\n const span = shiftVector[0] ? 'colspan' : 'rowspan';\n const index = shiftVector[0] ? 'col' : 'row';\n const changeStart = Math.min(indexOfChange, shiftedIndex);\n const changeEnd = Math.max(indexOfChange, shiftedIndex);\n const mergeStart = this[index];\n const mergeEnd = this[index] + this[span] - 1;\n if (mergeStart >= indexOfChange) {\n this[index] += shiftValue;\n }\n\n // adding rows/columns\n if (shiftValue > 0) {\n if (indexOfChange <= mergeEnd && indexOfChange > mergeStart) {\n this[span] += shiftValue;\n }\n\n // removing rows/columns\n } else if (shiftValue < 0) {\n // removing the whole merge\n if (changeStart <= mergeStart && changeEnd >= mergeEnd) {\n this.removed = true;\n _classPrivateFieldSet(_cellRange, this, null);\n return false;\n\n // removing the merge partially, including the beginning\n } else if (mergeStart >= changeStart && mergeStart <= changeEnd) {\n const removedOffset = changeEnd - mergeStart + 1;\n const preRemovedOffset = Math.abs(shiftValue) - removedOffset;\n this[index] -= preRemovedOffset + shiftValue;\n this[span] -= removedOffset;\n\n // removing the middle part of the merge\n } else if (mergeStart <= changeStart && mergeEnd >= changeEnd) {\n this[span] += shiftValue;\n\n // removing the end part of the merge\n } else if (mergeStart <= changeStart && mergeEnd >= changeStart && mergeEnd < changeEnd) {\n const removedPart = mergeEnd - changeStart + 1;\n this[span] -= removedPart;\n }\n }\n _classPrivateFieldSet(_cellRange, this, null);\n return true;\n }\n\n /**\n * Check if the second provided merged cell is \"farther\" in the provided direction.\n *\n * @param {MergedCellCoords} mergedCell The merged cell to check.\n * @param {string} direction Drag direction.\n * @returns {boolean|null} `true` if the second provided merged cell is \"farther\".\n */\n isFarther(mergedCell, direction) {\n if (!mergedCell) {\n return true;\n }\n if (direction === 'down') {\n return mergedCell.row + mergedCell.rowspan - 1 < this.row + this.rowspan - 1;\n } else if (direction === 'up') {\n return mergedCell.row > this.row;\n } else if (direction === 'right') {\n return mergedCell.col + mergedCell.colspan - 1 < this.col + this.colspan - 1;\n } else if (direction === 'left') {\n return mergedCell.col > this.col;\n }\n return null;\n }\n\n /**\n * Get the bottom row index of the merged cell.\n *\n * @returns {number}\n */\n getLastRow() {\n return this.row + this.rowspan - 1;\n }\n\n /**\n * Get the rightmost column index of the merged cell.\n *\n * @returns {number}\n */\n getLastColumn() {\n return this.col + this.colspan - 1;\n }\n\n /**\n * Get the range coordinates of the merged cell.\n *\n * @returns {CellRange}\n */\n getRange() {\n if (!_classPrivateFieldGet(_cellRange, this)) {\n _classPrivateFieldSet(_cellRange, this, this.cellRangeFactory(this.cellCoordsFactory(this.row, this.col), this.cellCoordsFactory(this.row, this.col), this.cellCoordsFactory(this.getLastRow(), this.getLastColumn())));\n }\n return _classPrivateFieldGet(_cellRange, this);\n }\n}\nexport default MergedCellCoords;", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/es.array.unscopables.flat-map.js\";\nimport \"core-js/modules/es.set.difference.v2.js\";\nimport \"core-js/modules/es.set.intersection.v2.js\";\nimport \"core-js/modules/es.set.is-disjoint-from.v2.js\";\nimport \"core-js/modules/es.set.is-subset-of.v2.js\";\nimport \"core-js/modules/es.set.is-superset-of.v2.js\";\nimport \"core-js/modules/es.set.symmetric-difference.v2.js\";\nimport \"core-js/modules/es.set.union.v2.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport MergedCellCoords from \"./cellCoords.mjs\";\nimport { rangeEach } from \"../../helpers/number.mjs\";\nimport { warn } from \"../../helpers/console.mjs\";\nimport { arrayEach } from \"../../helpers/array.mjs\";\nimport { toSingleLine } from \"../../helpers/templateLiteralTag.mjs\";\n/**\n * Defines a container object for the merged cells.\n *\n * @private\n * @class MergedCellsCollection\n */\nvar _MergedCellsCollection_brand = /*#__PURE__*/new WeakSet();\nclass MergedCellsCollection {\n constructor(mergeCellsPlugin) {\n /**\n * Gets the list of the indexes that do not intersect with other merged cells within the provided range.\n *\n * @param {CellRange} range The range to search within.\n * @param {'row' | 'col'} axis The axis to search within.\n * @param {number} scanDirection The direction to scan the range. `1` for forward, `-1` for backward.\n * @returns {number[]}\n */\n _classPrivateMethodInitSpec(this, _MergedCellsCollection_brand);\n /**\n * Reference to the Merge Cells plugin.\n *\n * @type {MergeCells}\n */\n _defineProperty(this, \"plugin\", void 0);\n /**\n * Array of merged cells.\n *\n * @type {MergedCellCoords[]}\n */\n _defineProperty(this, \"mergedCells\", []);\n /**\n * Matrix of cells (row, col) that points to the instances of the MergedCellCoords objects.\n *\n * @type {Array}\n */\n _defineProperty(this, \"mergedCellsMatrix\", new Map());\n /**\n * The Handsontable instance.\n *\n * @type {Handsontable}\n */\n _defineProperty(this, \"hot\", void 0);\n this.plugin = mergeCellsPlugin;\n this.hot = mergeCellsPlugin.hot;\n }\n\n /**\n * Get a warning message for when the declared merged cell data overlaps already existing merged cells.\n *\n * @param {{ row: number, col: number, rowspan: number, colspan: number }} mergedCell Object containing information\n * about the merged cells that was about to be added.\n * @returns {string}\n */\n static IS_OVERLAPPING_WARNING(_ref) {\n let {\n row,\n col\n } = _ref;\n return toSingleLine`The merged cell declared at [${row}, ${col}], overlaps\\x20\n with the other declared merged cell. The overlapping merged cell was not added to the table, please\\x20\n fix your setup.`;\n }\n\n /**\n * Get a merged cell from the container, based on the provided arguments. You can provide either the \"starting coordinates\"\n * of a merged cell, or any coordinates from the body of the merged cell.\n *\n * @param {number} row Row index.\n * @param {number} column Column index.\n * @returns {MergedCellCoords|boolean} Returns a wanted merged cell on success and `false` on failure.\n */\n get(row, column) {\n var _this$mergedCellsMatr;\n if (!this.mergedCellsMatrix.has(row)) {\n return false;\n }\n return (_this$mergedCellsMatr = this.mergedCellsMatrix.get(row).get(column)) !== null && _this$mergedCellsMatr !== void 0 ? _this$mergedCellsMatr : false;\n }\n\n /**\n * Get the first-found merged cell containing the provided range.\n *\n * @param {CellRange|object} range The range to search merged cells for.\n * @returns {MergedCellCoords|boolean}\n */\n getByRange(range) {\n let result = false;\n arrayEach(this.mergedCells, mergedCell => {\n if (mergedCell.row <= range.from.row && mergedCell.row + mergedCell.rowspan - 1 >= range.to.row && mergedCell.col <= range.from.col && mergedCell.col + mergedCell.colspan - 1 >= range.to.col) {\n result = mergedCell;\n return result;\n }\n return true;\n });\n return result;\n }\n\n /**\n * Filters merge cells objects provided by users from overlapping cells.\n *\n * @param {{ row: number, col: number, rowspan: number, colspan: number }} mergedCellsInfo The merged cell information object.\n * Has to contain `row`, `col`, `colspan` and `rowspan` properties.\n * @returns {Array<{ row: number, col: number, rowspan: number, colspan: number }>}\n */\n filterOverlappingMergeCells(mergedCellsInfo) {\n const occupiedCells = new Set();\n this.mergedCells.forEach(mergedCell => {\n const {\n row,\n col,\n colspan,\n rowspan\n } = mergedCell;\n for (let r = row; r < row + rowspan; r++) {\n for (let c = col; c < col + colspan; c++) {\n occupiedCells.add(`r${r},c${c}`);\n }\n }\n });\n const filteredMergeCells = mergedCellsInfo.filter(mergedCell => {\n const {\n row,\n col,\n colspan,\n rowspan\n } = mergedCell;\n const localOccupiedCells = new Set();\n let isOverlapping = false;\n for (let r = row; r < row + rowspan; r++) {\n for (let c = col; c < col + colspan; c++) {\n const cellId = `r${r},c${c}`;\n if (occupiedCells.has(cellId)) {\n warn(MergedCellsCollection.IS_OVERLAPPING_WARNING(mergedCell));\n isOverlapping = true;\n break;\n }\n localOccupiedCells.add(cellId);\n }\n if (isOverlapping) {\n break;\n }\n }\n if (!isOverlapping) {\n occupiedCells.add(...localOccupiedCells);\n }\n return !isOverlapping;\n });\n return filteredMergeCells;\n }\n\n /**\n * Get a merged cell contained in the provided range.\n *\n * @param {CellRange} range The range to search merged cells in.\n * @param {boolean} [countPartials=false] If set to `true`, all the merged cells overlapping the range will be taken into calculation.\n * @returns {MergedCellCoords[]} Array of found merged cells.\n */\n getWithinRange(range) {\n let countPartials = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n const {\n row: rowStart,\n col: columnStart\n } = range.getTopStartCorner();\n const {\n row: rowEnd,\n col: columnEnd\n } = range.getBottomEndCorner();\n const result = [];\n for (let row = rowStart; row <= rowEnd; row++) {\n for (let column = columnStart; column <= columnEnd; column++) {\n const mergedCell = this.get(row, column);\n if (mergedCell && (countPartials || !countPartials && mergedCell.row === row && mergedCell.col === column)) {\n result.push(mergedCell);\n }\n }\n }\n return result;\n }\n\n /**\n * Add a merged cell to the container.\n *\n * @param {object} mergedCellInfo The merged cell information object. Has to contain `row`, `col`, `colspan` and `rowspan` properties.\n * @param {boolean} [auto=false] `true` if called internally by the plugin (usually in batch).\n * @returns {MergedCellCoords|boolean} Returns the new merged cell on success and `false` on failure.\n */\n add(mergedCellInfo) {\n let auto = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n const row = mergedCellInfo.row;\n const column = mergedCellInfo.col;\n const rowspan = mergedCellInfo.rowspan;\n const colspan = mergedCellInfo.colspan;\n const newMergedCell = new MergedCellCoords(row, column, rowspan, colspan, this.hot._createCellCoords, this.hot._createCellRange);\n const alreadyExists = this.get(row, column);\n const isOverlapping = auto ? false : this.isOverlapping(newMergedCell);\n if (!alreadyExists && !isOverlapping) {\n if (this.hot) {\n newMergedCell.normalize(this.hot);\n }\n this.mergedCells.push(newMergedCell);\n _assertClassBrand(_MergedCellsCollection_brand, this, _addMergedCellToMatrix).call(this, newMergedCell);\n return newMergedCell;\n }\n warn(MergedCellsCollection.IS_OVERLAPPING_WARNING(newMergedCell));\n return false;\n }\n\n /**\n * Remove a merged cell from the container. You can provide either the \"starting coordinates\"\n * of a merged cell, or any coordinates from the body of the merged cell.\n *\n * @param {number} row Row index.\n * @param {number} column Column index.\n * @returns {MergedCellCoords|boolean} Returns the removed merged cell on success and `false` on failure.\n */\n remove(row, column) {\n const mergedCell = this.get(row, column);\n const mergedCellIndex = mergedCell ? this.mergedCells.indexOf(mergedCell) : -1;\n if (mergedCell && mergedCellIndex !== -1) {\n this.mergedCells.splice(mergedCellIndex, 1);\n _assertClassBrand(_MergedCellsCollection_brand, this, _removeMergedCellFromMatrix).call(this, mergedCell);\n return mergedCell;\n }\n return false;\n }\n\n /**\n * Clear all the merged cells.\n */\n clear() {\n arrayEach(this.mergedCells, _ref2 => {\n let {\n row,\n col,\n rowspan,\n colspan\n } = _ref2;\n rangeEach(row, row + rowspan, r => {\n rangeEach(col, col + colspan, c => {\n const TD = this.hot.getCell(r, c);\n if (TD) {\n TD.removeAttribute('rowspan');\n TD.removeAttribute('colspan');\n TD.style.display = '';\n }\n });\n });\n });\n this.mergedCells.length = 0;\n this.mergedCellsMatrix = new Map();\n }\n\n /**\n * Check if the provided merged cell overlaps with the others already added.\n *\n * @param {MergedCellCoords} mergedCell The merged cell to check against all others in the container.\n * @returns {boolean} `true` if the provided merged cell overlaps with the others, `false` otherwise.\n */\n isOverlapping(mergedCell) {\n const mergedCellRange = mergedCell.getRange();\n for (let i = 0; i < this.mergedCells.length; i++) {\n const otherMergedCell = this.mergedCells[i];\n const otherMergedCellRange = otherMergedCell.getRange();\n if (otherMergedCellRange.overlaps(mergedCellRange)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Check whether the provided row/col coordinates direct to a first not hidden cell within merge area.\n *\n * @param {number} row Visual row index.\n * @param {number} column Visual column index.\n * @returns {boolean}\n */\n isFirstRenderableMergedCell(row, column) {\n const mergeParent = this.get(row, column);\n\n // Return if row and column indexes are within merge area and if they are first rendered indexes within the area.\n return mergeParent && this.hot.rowIndexMapper.getNearestNotHiddenIndex(mergeParent.row, 1) === row && this.hot.columnIndexMapper.getNearestNotHiddenIndex(mergeParent.col, 1) === column;\n }\n\n /**\n * Get the first renderable coords of the merged cell at the provided coordinates.\n *\n * @param {number} row Visual row index.\n * @param {number} column Visual column index.\n * @returns {CellCoords} A `CellCoords` object with the coordinates to the first renderable cell within the\n * merged cell.\n */\n getFirstRenderableCoords(row, column) {\n const mergeParent = this.get(row, column);\n if (!mergeParent || this.isFirstRenderableMergedCell(row, column)) {\n return this.hot._createCellCoords(row, column);\n }\n const firstRenderableRow = this.hot.rowIndexMapper.getNearestNotHiddenIndex(mergeParent.row, 1);\n const firstRenderableColumn = this.hot.columnIndexMapper.getNearestNotHiddenIndex(mergeParent.col, 1);\n return this.hot._createCellCoords(firstRenderableRow, firstRenderableColumn);\n }\n\n /**\n * Gets the start-most visual column index that do not intersect with other merged cells within the provided range.\n *\n * @param {CellRange} range The range to search within.\n * @param {number} visualColumnIndex The visual column index to start the search from.\n * @returns {number}\n */\n getStartMostColumnIndex(range, visualColumnIndex) {\n const indexes = _assertClassBrand(_MergedCellsCollection_brand, this, _getNonIntersectingIndexes).call(this, range, 'col', -1);\n let startMostIndex = visualColumnIndex;\n for (let i = 0; i < indexes.length; i++) {\n if (indexes[i] <= visualColumnIndex) {\n startMostIndex = indexes[i];\n break;\n }\n }\n return startMostIndex;\n }\n\n /**\n * Gets the end-most visual column index that do not intersect with other merged cells within the provided range.\n *\n * @param {CellRange} range The range to search within.\n * @param {number} visualColumnIndex The visual column index to start the search from.\n * @returns {number}\n */\n getEndMostColumnIndex(range, visualColumnIndex) {\n const indexes = _assertClassBrand(_MergedCellsCollection_brand, this, _getNonIntersectingIndexes).call(this, range, 'col', 1);\n let endMostIndex = visualColumnIndex;\n for (let i = 0; i < indexes.length; i++) {\n if (indexes[i] >= visualColumnIndex) {\n endMostIndex = indexes[i];\n break;\n }\n }\n return endMostIndex;\n }\n\n /**\n * Gets the top-most visual row index that do not intersect with other merged cells within the provided range.\n *\n * @param {CellRange} range The range to search within.\n * @param {number} visualRowIndex The visual row index to start the search from.\n * @returns {number}\n */\n getTopMostRowIndex(range, visualRowIndex) {\n const indexes = _assertClassBrand(_MergedCellsCollection_brand, this, _getNonIntersectingIndexes).call(this, range, 'row', -1);\n let topMostIndex = visualRowIndex;\n for (let i = 0; i < indexes.length; i++) {\n if (indexes[i] <= visualRowIndex) {\n topMostIndex = indexes[i];\n break;\n }\n }\n return topMostIndex;\n }\n\n /**\n * Gets the bottom-most visual row index that do not intersect with other merged cells within the provided range.\n *\n * @param {CellRange} range The range to search within.\n * @param {number} visualRowIndex The visual row index to start the search from.\n * @returns {number}\n */\n getBottomMostRowIndex(range, visualRowIndex) {\n const indexes = _assertClassBrand(_MergedCellsCollection_brand, this, _getNonIntersectingIndexes).call(this, range, 'row', 1);\n let bottomMostIndex = visualRowIndex;\n for (let i = 0; i < indexes.length; i++) {\n if (indexes[i] >= visualRowIndex) {\n bottomMostIndex = indexes[i];\n break;\n }\n }\n return bottomMostIndex;\n }\n /**\n * Shift the merged cell in the direction and by an offset defined in the arguments.\n *\n * @param {string} direction `right`, `left`, `up` or `down`.\n * @param {number} index Index where the change, which caused the shifting took place.\n * @param {number} count Number of rows/columns added/removed in the preceding action.\n */\n shiftCollections(direction, index, count) {\n const shiftVector = [0, 0];\n switch (direction) {\n case 'right':\n shiftVector[0] += count;\n break;\n case 'left':\n shiftVector[0] -= count;\n break;\n case 'down':\n shiftVector[1] += count;\n break;\n case 'up':\n shiftVector[1] -= count;\n break;\n default:\n }\n const removedMergedCells = [];\n this.mergedCells.forEach(currentMerge => {\n currentMerge.shift(shiftVector, index);\n if (currentMerge.removed) {\n removedMergedCells.push(currentMerge);\n }\n });\n removedMergedCells.forEach(removedMerge => {\n this.mergedCells.splice(this.mergedCells.indexOf(removedMerge), 1);\n });\n this.mergedCellsMatrix.clear();\n this.mergedCells.forEach(currentMerge => {\n _assertClassBrand(_MergedCellsCollection_brand, this, _addMergedCellToMatrix).call(this, currentMerge);\n });\n }\n\n /**\n * Adds a merged cell to the matrix.\n *\n * @param {MergedCellCoords} mergedCell The merged cell to add.\n */\n}\nfunction _getNonIntersectingIndexes(range, axis) {\n let scanDirection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n const indexes = new Map();\n const from = scanDirection === 1 ? range.getTopStartCorner() : range.getBottomEndCorner();\n const to = scanDirection === 1 ? range.getBottomEndCorner() : range.getTopStartCorner();\n for (let row = from.row; scanDirection === 1 ? row <= to.row : row >= to.row; row += scanDirection) {\n for (let column = from.col; scanDirection === 1 ? column <= to.col : column >= to.col; column += scanDirection) {\n const index = axis === 'row' ? row : column;\n const mergedCell = this.get(row, column);\n let lastIndex = index;\n if (mergedCell) {\n lastIndex = scanDirection === 1 ? mergedCell[axis] + mergedCell[`${axis}span`] - 1 : mergedCell[axis];\n }\n if (!indexes.has(index)) {\n indexes.set(index, new Set());\n }\n indexes.get(index).add(lastIndex);\n }\n }\n return Array.from(new Set(Array.from(indexes.entries()).filter(_ref3 => {\n let [, set] = _ref3;\n return set.size === 1;\n }).flatMap(_ref4 => {\n let [, set] = _ref4;\n return Array.from(set);\n })));\n}\nfunction _addMergedCellToMatrix(mergedCell) {\n for (let row = mergedCell.row; row < mergedCell.row + mergedCell.rowspan; row++) {\n for (let col = mergedCell.col; col < mergedCell.col + mergedCell.colspan; col++) {\n if (!this.mergedCellsMatrix.has(row)) {\n this.mergedCellsMatrix.set(row, new Map());\n }\n this.mergedCellsMatrix.get(row).set(col, mergedCell);\n }\n }\n}\n/**\n * Removes a merged cell from the matrix.\n *\n * @param {MergedCellCoords} mergedCell The merged cell to remove.\n */\nfunction _removeMergedCellFromMatrix(mergedCell) {\n for (let row = mergedCell.row; row < mergedCell.row + mergedCell.rowspan; row++) {\n for (let col = mergedCell.col; col < mergedCell.col + mergedCell.colspan; col++) {\n this.mergedCellsMatrix.get(row).delete(col);\n }\n }\n}\nexport default MergedCellsCollection;", "import \"core-js/modules/es.error.cause.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { extend } from \"../../../helpers/object.mjs\";\nimport { arrayEach } from \"../../../helpers/array.mjs\";\n/**\n * Class responsible for all of the Autofill-related operations on merged cells.\n *\n * @private\n * @class AutofillCalculations\n */\nclass AutofillCalculations {\n constructor(plugin) {\n /**\n * Reference to the Merge Cells plugin.\n *\n * @type {MergeCells}\n */\n _defineProperty(this, \"plugin\", void 0);\n /**\n * Reference to the MergedCellsCollection class instance.\n *\n * @type {MergedCellsCollection}\n */\n _defineProperty(this, \"mergedCellsCollection\", void 0);\n /**\n * Cache of the currently processed autofill data.\n *\n * @private\n * @type {object}\n */\n _defineProperty(this, \"currentFillData\", null);\n this.plugin = plugin;\n this.mergedCellsCollection = this.plugin.mergedCellsCollection;\n }\n\n /**\n * Correct the provided selection area, so it's not selecting only a part of a merged cell.\n *\n * @param {Array} selectionArea The selection to correct.\n */\n correctSelectionAreaSize(selectionArea) {\n if (selectionArea[0] === selectionArea[2] && selectionArea[1] === selectionArea[3]) {\n const mergedCell = this.mergedCellsCollection.get(selectionArea[0], selectionArea[1]);\n if (mergedCell) {\n selectionArea[2] = selectionArea[0] + mergedCell.rowspan - 1;\n selectionArea[3] = selectionArea[1] + mergedCell.colspan - 1;\n }\n }\n }\n\n /**\n * Get the direction of the autofill process.\n *\n * @param {Array} selectionArea The selection area.\n * @param {Array} finalArea The final area (base + drag).\n * @returns {string} `up`, `down`, `left` or `right`.\n */\n getDirection(selectionArea, finalArea) {\n let direction = null;\n if (finalArea[0] === selectionArea[0] && finalArea[1] === selectionArea[1] && finalArea[3] === selectionArea[3]) {\n direction = 'down';\n } else if (finalArea[2] === selectionArea[2] && finalArea[1] === selectionArea[1] && finalArea[3] === selectionArea[3]) {\n direction = 'up';\n } else if (finalArea[1] === selectionArea[1] && finalArea[2] === selectionArea[2]) {\n direction = 'right';\n } else {\n direction = 'left';\n }\n return direction;\n }\n\n /**\n * Snap the drag area to the farthest merged cell, so it won't clip any of the merged cells.\n *\n * @param {Array} baseArea The base selected area.\n * @param {Array} dragArea The drag area.\n * @param {string} dragDirection The autofill drag direction.\n * @param {Array} foundMergedCells MergeCellCoords found in the base selection area.\n * @returns {Array} The new drag area.\n */\n snapDragArea(baseArea, dragArea, dragDirection, foundMergedCells) {\n const newDragArea = dragArea.slice(0);\n const fillSize = this.getAutofillSize(baseArea, dragArea, dragDirection);\n const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;\n const verticalDirection = ['up', 'down'].indexOf(dragDirection) > -1;\n const fullCycle = verticalDirection ? baseAreaEndRow - baseAreaStartRow + 1 : baseAreaEndColumn - baseAreaStartColumn + 1;\n const fulls = Math.floor(fillSize / fullCycle) * fullCycle;\n const partials = fillSize - fulls;\n const farthestCollection = this.getFarthestCollection(baseArea, dragArea, dragDirection, foundMergedCells);\n if (farthestCollection) {\n if (dragDirection === 'down') {\n const fill = farthestCollection.row + farthestCollection.rowspan - baseAreaStartRow - partials;\n const newLimit = newDragArea[2] + fill;\n if (newLimit >= this.plugin.hot.countRows()) {\n newDragArea[2] -= partials;\n } else {\n newDragArea[2] += partials ? fill : 0;\n }\n } else if (dragDirection === 'right') {\n const fill = farthestCollection.col + farthestCollection.colspan - baseAreaStartColumn - partials;\n const newLimit = newDragArea[3] + fill;\n if (newLimit >= this.plugin.hot.countCols()) {\n newDragArea[3] -= partials;\n } else {\n newDragArea[3] += partials ? fill : 0;\n }\n } else if (dragDirection === 'up') {\n const fill = baseAreaEndRow - partials - farthestCollection.row + 1;\n const newLimit = newDragArea[0] + fill;\n if (newLimit < 0) {\n newDragArea[0] += partials;\n } else {\n newDragArea[0] -= partials ? fill : 0;\n }\n } else if (dragDirection === 'left') {\n const fill = baseAreaEndColumn - partials - farthestCollection.col + 1;\n const newLimit = newDragArea[1] + fill;\n if (newLimit < 0) {\n newDragArea[1] += partials;\n } else {\n newDragArea[1] -= partials ? fill : 0;\n }\n }\n }\n this.updateCurrentFillCache({\n baseArea,\n dragDirection,\n foundMergedCells,\n fillSize,\n dragArea: newDragArea,\n cycleLength: fullCycle\n });\n return newDragArea;\n }\n\n /**\n * Update the current fill cache with the provided object.\n *\n * @private\n * @param {object} updateObject The current filled object cache.\n */\n updateCurrentFillCache(updateObject) {\n if (!this.currentFillData) {\n this.currentFillData = {};\n }\n extend(this.currentFillData, updateObject);\n }\n\n /**\n * Get the \"length\" of the drag area.\n *\n * @private\n * @param {Array} baseArea The base selection area.\n * @param {Array} dragArea The drag area (containing the base area).\n * @param {string} direction The drag direction.\n * @returns {number|null} The \"length\" (height or width, depending on the direction) of the drag.\n */\n getAutofillSize(baseArea, dragArea, direction) {\n const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;\n const [dragAreaStartRow, dragAreaStartColumn, dragAreaEndRow, dragAreaEndColumn] = dragArea;\n switch (direction) {\n case 'up':\n return baseAreaStartRow - dragAreaStartRow;\n case 'down':\n return dragAreaEndRow - baseAreaEndRow;\n case 'left':\n return baseAreaStartColumn - dragAreaStartColumn;\n case 'right':\n return dragAreaEndColumn - baseAreaEndColumn;\n default:\n return null;\n }\n }\n\n /**\n * Trim the default drag area (containing the selection area) to the drag-only area.\n *\n * @private\n * @param {Array} baseArea The base selection area.\n * @param {Array} dragArea The base selection area extended by the drag area.\n * @param {string} direction Drag direction.\n * @returns {Array|null} Array representing the drag area coordinates.\n */\n getDragArea(baseArea, dragArea, direction) {\n const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;\n const [dragAreaStartRow, dragAreaStartColumn, dragAreaEndRow, dragAreaEndColumn] = dragArea;\n switch (direction) {\n case 'up':\n return [dragAreaStartRow, dragAreaStartColumn, baseAreaStartRow - 1, baseAreaEndColumn];\n case 'down':\n return [baseAreaEndRow + 1, baseAreaStartColumn, dragAreaEndRow, baseAreaEndColumn];\n case 'left':\n return [dragAreaStartRow, dragAreaStartColumn, baseAreaEndRow, baseAreaStartColumn - 1];\n case 'right':\n return [baseAreaStartRow, baseAreaEndColumn + 1, dragAreaEndRow, dragAreaEndColumn];\n default:\n return null;\n }\n }\n\n /**\n * Get the to-be-farthest merged cell in the newly filled area.\n *\n * @private\n * @param {Array} baseArea The base selection area.\n * @param {Array} dragArea The drag area (containing the base area).\n * @param {string} direction The drag direction.\n * @param {Array} mergedCellArray Array of the merged cells found in the base area.\n * @returns {MergedCellCoords|null}\n */\n getFarthestCollection(baseArea, dragArea, direction, mergedCellArray) {\n const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;\n const verticalDirection = ['up', 'down'].indexOf(direction) > -1;\n const baseEnd = verticalDirection ? baseAreaEndRow : baseAreaEndColumn;\n const baseStart = verticalDirection ? baseAreaStartRow : baseAreaStartColumn;\n const fillSize = this.getAutofillSize(baseArea, dragArea, direction);\n const fullCycle = verticalDirection ? baseAreaEndRow - baseAreaStartRow + 1 : baseAreaEndColumn - baseAreaStartColumn + 1;\n const fulls = Math.floor(fillSize / fullCycle) * fullCycle;\n const partials = fillSize - fulls;\n let inclusionFunctionName = null;\n let farthestCollection = null;\n let endOfDragRecreationIndex = null;\n switch (direction) {\n case 'up':\n inclusionFunctionName = 'includesVertically';\n endOfDragRecreationIndex = baseEnd - partials + 1;\n break;\n case 'left':\n inclusionFunctionName = 'includesHorizontally';\n endOfDragRecreationIndex = baseEnd - partials + 1;\n break;\n case 'down':\n inclusionFunctionName = 'includesVertically';\n endOfDragRecreationIndex = baseStart + partials - 1;\n break;\n case 'right':\n inclusionFunctionName = 'includesHorizontally';\n endOfDragRecreationIndex = baseStart + partials - 1;\n break;\n default:\n }\n arrayEach(mergedCellArray, currentCollection => {\n if (currentCollection[inclusionFunctionName](endOfDragRecreationIndex) && currentCollection.isFarther(farthestCollection, direction)) {\n farthestCollection = currentCollection;\n }\n });\n return farthestCollection;\n }\n\n /**\n * Recreate the merged cells after the autofill process.\n *\n * @param {Array} changes Changes made.\n */\n recreateAfterDataPopulation(changes) {\n if (!this.currentFillData) {\n return;\n }\n const fillRange = this.getRangeFromChanges(changes);\n const foundMergedCells = this.currentFillData.foundMergedCells;\n const dragDirection = this.currentFillData.dragDirection;\n const inBounds = (current, offset) => {\n switch (dragDirection) {\n case 'up':\n return current.row - offset >= fillRange.from.row;\n case 'down':\n return current.row + current.rowspan - 1 + offset <= fillRange.to.row;\n case 'left':\n return current.col - offset >= fillRange.from.column;\n case 'right':\n return current.col + current.colspan - 1 + offset <= fillRange.to.column;\n default:\n return null;\n }\n };\n let fillOffset = 0;\n let current = null;\n let multiplier = 1;\n do {\n for (let j = 0; j < foundMergedCells.length; j += 1) {\n current = foundMergedCells[j];\n fillOffset = multiplier * this.currentFillData.cycleLength;\n if (inBounds(current, fillOffset)) {\n switch (dragDirection) {\n case 'up':\n this.plugin.mergedCellsCollection.add({\n row: current.row - fillOffset,\n rowspan: current.rowspan,\n col: current.col,\n colspan: current.colspan\n });\n break;\n case 'down':\n this.plugin.mergedCellsCollection.add({\n row: current.row + fillOffset,\n rowspan: current.rowspan,\n col: current.col,\n colspan: current.colspan\n });\n break;\n case 'left':\n this.plugin.mergedCellsCollection.add({\n row: current.row,\n rowspan: current.rowspan,\n col: current.col - fillOffset,\n colspan: current.colspan\n });\n break;\n case 'right':\n this.plugin.mergedCellsCollection.add({\n row: current.row,\n rowspan: current.rowspan,\n col: current.col + fillOffset,\n colspan: current.colspan\n });\n break;\n default:\n }\n }\n if (j === foundMergedCells.length - 1) {\n multiplier += 1;\n }\n }\n } while (inBounds(current, fillOffset));\n this.currentFillData = null;\n this.plugin.hot.render();\n if (foundMergedCells.length > 0) {\n this.plugin.ifChromeForceRepaint();\n }\n }\n\n /**\n * Get the drag range from the changes made.\n *\n * @private\n * @param {Array} changes The changes made.\n * @returns {object} Object with `from` and `to` properties, both containing `row` and `column` keys.\n */\n getRangeFromChanges(changes) {\n const rows = {\n min: null,\n max: null\n };\n const columns = {\n min: null,\n max: null\n };\n arrayEach(changes, change => {\n const rowIndex = change[0];\n const columnIndex = this.plugin.hot.propToCol(change[1]);\n if (rows.min === null || rowIndex < rows.min) {\n rows.min = rowIndex;\n }\n if (rows.max === null || rowIndex > rows.max) {\n rows.max = rowIndex;\n }\n if (columns.min === null || columnIndex < columns.min) {\n columns.min = columnIndex;\n }\n if (columns.max === null || columnIndex > columns.max) {\n columns.max = columnIndex;\n }\n });\n return {\n from: {\n row: rows.min,\n column: columns.min\n },\n to: {\n row: rows.max,\n column: columns.max\n }\n };\n }\n\n /**\n * Check if the drag area contains any merged cells.\n *\n * @param {Array} baseArea The base selection area.\n * @param {Array} fullArea The base area extended by the drag area.\n * @param {string} direction Drag direction.\n * @returns {boolean}\n */\n dragAreaOverlapsCollections(baseArea, fullArea, direction) {\n const dragArea = this.getDragArea(baseArea, fullArea, direction);\n const [dragAreaStartRow, dragAreaStartColumn, dragAreaEndRow, dragAreaEndColumn] = dragArea;\n const topLeft = this.plugin.hot._createCellCoords(dragAreaStartRow, dragAreaStartColumn);\n const bottomRight = this.plugin.hot._createCellCoords(dragAreaEndRow, dragAreaEndColumn);\n const dragRange = this.plugin.hot._createCellRange(topLeft, topLeft, bottomRight);\n return this.mergedCellsCollection.getWithinRange(dragRange, true).length > 0;\n }\n}\nexport default AutofillCalculations;", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * Class responsible for all of the Selection-related operations on merged cells.\n *\n * @private\n * @class SelectionCalculations\n */\nclass SelectionCalculations {\n constructor(plugin) {\n /**\n * Reference to the Merge Cells plugin.\n *\n * @type {MergeCells}\n */\n _defineProperty(this, \"plugin\", void 0);\n /**\n * Reference to the Handsontable instance.\n *\n * @type {Handsontable}\n */\n _defineProperty(this, \"hot\", void 0);\n /**\n * Class name used for fully selected merged cells.\n *\n * @type {string}\n */\n _defineProperty(this, \"fullySelectedMergedCellClassName\", 'fullySelectedMergedCell');\n this.plugin = plugin;\n this.hot = plugin.hot;\n }\n\n /**\n * Generate an additional class name for the entirely-selected merged cells.\n *\n * @param {number} currentRow Visual row index of the currently processed cell.\n * @param {number} currentColumn Visual column index of the currently cell.\n * @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow, endColumn]`.\n * @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.\n * @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently processed cell.\n */\n getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel) {\n const startRow = Math.min(cornersOfSelection[0], cornersOfSelection[2]);\n const startColumn = Math.min(cornersOfSelection[1], cornersOfSelection[3]);\n const endRow = Math.max(cornersOfSelection[0], cornersOfSelection[2]);\n const endColumn = Math.max(cornersOfSelection[1], cornersOfSelection[3]);\n if (layerLevel === undefined) {\n return;\n }\n const isFirstRenderableMergedCell = this.plugin.mergedCellsCollection.isFirstRenderableMergedCell(currentRow, currentColumn);\n\n // We add extra classes just to the first renderable merged cell.\n if (!isFirstRenderableMergedCell) {\n return;\n }\n const mergedCell = this.plugin.mergedCellsCollection.get(currentRow, currentColumn);\n if (!mergedCell) {\n return;\n }\n const mergeRowEnd = mergedCell.getLastRow();\n const mergeColumnEnd = mergedCell.getLastColumn();\n const fullMergeAreaWithinSelection = startRow <= mergedCell.row && startColumn <= mergedCell.col && endRow >= mergeRowEnd && endColumn >= mergeColumnEnd;\n if (fullMergeAreaWithinSelection) {\n return `${this.fullySelectedMergedCellClassName}-${layerLevel}`;\n } else if (this.isMergeCellFullySelected(mergedCell, this.plugin.hot.getSelectedRange())) {\n return `${this.fullySelectedMergedCellClassName}-multiple`;\n }\n }\n\n /**\n * Check if the provided merged cell is fully selected (by one or many layers of selection).\n *\n * @param {MergedCellCoords} mergedCell The merged cell to be processed.\n * @param {CellRange[]} selectionRangesArray Array of selection ranges.\n * @returns {boolean}\n */\n isMergeCellFullySelected(mergedCell, selectionRangesArray) {\n const mergedCellIndividualCoords = [];\n if (!selectionRangesArray || !mergedCell) {\n return false;\n }\n for (let r = 0; r < mergedCell.rowspan; r += 1) {\n for (let c = 0; c < mergedCell.colspan; c += 1) {\n mergedCellIndividualCoords.push(this.hot._createCellCoords(mergedCell.row + r, mergedCell.col + c));\n }\n }\n for (let i = 0; i < mergedCellIndividualCoords.length; i += 1) {\n const insideSelections = [];\n for (let s = 0; s < selectionRangesArray.length; s += 1) {\n insideSelections[s] = selectionRangesArray[s].includes(mergedCellIndividualCoords[i]);\n }\n if (!insideSelections.includes(true)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Generate an array of the entirely-selected merged cells' class names.\n *\n * @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from all the cells in the table.\n */\n getSelectedMergedCellClassNameToRemove() {\n const classNames = [];\n for (let i = 0; i <= 7; i += 1) {\n classNames.push(`${this.fullySelectedMergedCellClassName}-${i}`);\n }\n classNames.push(`${this.fullySelectedMergedCellClassName}-multiple`);\n return classNames;\n }\n}\nexport default SelectionCalculations;", "import * as C from \"../../../i18n/constants.mjs\";\nimport MergedCellCoords from \"../cellCoords.mjs\";\n/**\n * @param {*} plugin The plugin instance.\n * @returns {object}\n */\nexport default function toggleMergeItem(plugin) {\n return {\n key: 'mergeCells',\n name() {\n const sel = this.getSelectedLast();\n if (sel) {\n const info = plugin.mergedCellsCollection.get(sel[0], sel[1]);\n if (info.row === sel[0] && info.col === sel[1] && info.row + info.rowspan - 1 === sel[2] && info.col + info.colspan - 1 === sel[3]) {\n return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_UNMERGE_CELLS);\n }\n }\n return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_MERGE_CELLS);\n },\n callback() {\n const currentRange = this.getSelectedRangeLast();\n if (!currentRange) {\n return;\n }\n currentRange.setDirection(this.isRtl() ? 'NE-SW' : 'NW-SE');\n const {\n from,\n to\n } = currentRange;\n plugin.toggleMerge(currentRange);\n this.selectCell(from.row, from.col, to.row, to.col, false);\n },\n disabled() {\n const sel = this.getSelectedLast();\n if (!sel) {\n return true;\n }\n const isSingleCell = MergedCellCoords.isSingleCell({\n row: sel[0],\n col: sel[1],\n rowspan: sel[2] - sel[0] + 1,\n colspan: sel[3] - sel[1] + 1\n });\n return isSingleCell || this.selection.isSelectedByCorner();\n },\n hidden: false\n };\n}", "import \"core-js/modules/es.error.cause.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * Refactored implementation of LinkedList (part of javascript-algorithms project) by Github users:\n * mgechev, AndriiHeonia, Microfed and Jakeh (part of javascript-algorithms project - all project contributors\n * at repository website).\n *\n * Link to repository: https://github.com/mgechev/javascript-algorithms.\n */\n\n/**\n * Linked list node.\n *\n * @class NodeStructure\n * @util\n */\nclass NodeStructure {\n constructor(data) {\n /**\n * Data of the node.\n *\n * @member {object}\n */\n _defineProperty(this, \"data\", void 0);\n /**\n * Next node.\n *\n * @member {NodeStructure}\n */\n _defineProperty(this, \"next\", null);\n /**\n * Previous node.\n *\n * @member {NodeStructure}\n */\n _defineProperty(this, \"prev\", null);\n this.data = data;\n }\n}\n\n/**\n * Linked list.\n *\n * @class LinkedList\n * @util\n */\nclass LinkedList {\n constructor() {\n _defineProperty(this, \"first\", null);\n _defineProperty(this, \"last\", null);\n }\n /**\n * Add data to the end of linked list.\n *\n * @param {object} data Data which should be added.\n * @returns {NodeStructure} Returns the node which has been added.\n */\n push(data) {\n const node = new NodeStructure(data);\n if (this.first === null) {\n this.first = node;\n this.last = node;\n } else {\n const temp = this.last;\n this.last = node;\n node.prev = temp;\n temp.next = node;\n }\n return node;\n }\n\n /**\n * Add data to the beginning of linked list.\n *\n * @param {object} data Data which should be added.\n */\n unshift(data) {\n const node = new NodeStructure(data);\n if (this.first === null) {\n this.first = node;\n this.last = node;\n } else {\n const temp = this.first;\n this.first = node;\n node.next = temp;\n temp.prev = node;\n }\n }\n\n /**\n * In order traversal of the linked list.\n *\n * @param {Function} callback Callback which should be executed on each node.\n */\n inorder(callback) {\n let temp = this.first;\n while (temp) {\n const interrupt = callback(temp);\n if (temp === this.last || interrupt === true) {\n break;\n }\n temp = temp.next;\n }\n }\n\n /**\n * Remove data from the linked list.\n *\n * @param {object} data Data which should be removed.\n * @returns {boolean} Returns true if data has been removed.\n */\n remove(data) {\n if (this.first === null) {\n return false;\n }\n let temp = this.first;\n let next;\n let prev;\n while (temp) {\n if (temp.data === data) {\n next = temp.next;\n prev = temp.prev;\n if (next) {\n next.prev = prev;\n }\n if (prev) {\n prev.next = next;\n }\n if (temp === this.first) {\n this.first = next;\n }\n if (temp === this.last) {\n this.last = prev;\n }\n return true;\n }\n temp = temp.next;\n }\n return false;\n }\n\n /**\n * Check if linked list contains cycle.\n *\n * @returns {boolean} Returns true if linked list contains cycle.\n */\n hasCycle() {\n let fast = this.first;\n let slow = this.first;\n while (true) {\n if (fast === null) {\n return false;\n }\n fast = fast.next;\n if (fast === null) {\n return false;\n }\n fast = fast.next;\n slow = slow.next;\n if (fast === slow) {\n return true;\n }\n }\n }\n\n /**\n * Return last node from the linked list.\n *\n * @returns {NodeStructure} Last node.\n */\n pop() {\n if (this.last === null) {\n return null;\n }\n const temp = this.last;\n this.last = this.last.prev;\n return temp;\n }\n\n /**\n * Return first node from the linked list.\n *\n * @returns {NodeStructure} First node.\n */\n shift() {\n if (this.first === null) {\n return null;\n }\n const temp = this.first;\n this.first = this.first.next;\n return temp;\n }\n\n /**\n * Reverses the linked list recursively.\n */\n recursiveReverse() {\n /**\n * @param {*} current The current value.\n * @param {*} next The next value.\n */\n function inverse(current, next) {\n if (!next) {\n return;\n }\n inverse(next, next.next);\n next.next = current;\n }\n if (!this.first) {\n return;\n }\n inverse(this.first, this.first.next);\n this.first.next = null;\n const temp = this.first;\n this.first = this.last;\n this.last = temp;\n }\n\n /**\n * Reverses the linked list iteratively.\n */\n reverse() {\n if (!this.first || !this.first.next) {\n return;\n }\n let current = this.first.next;\n let prev = this.first;\n let temp;\n while (current) {\n temp = current.next;\n current.next = prev;\n prev.prev = current;\n prev = current;\n current = temp;\n }\n this.first.next = null;\n this.last.prev = null;\n temp = this.first;\n this.first = prev;\n this.last = temp;\n }\n}\nexport { NodeStructure };\nexport default LinkedList;", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport LinkedList from \"../../utils/dataStructures/linkedList.mjs\";\n/**\n * Class responsible for providing the correct focus order (vertical and horizontal) within a selection that\n * contains merged cells.\n *\n * @private\n */\nvar _cellsHorizontalOrder = /*#__PURE__*/new WeakMap();\nvar _cellsVerticalOrder = /*#__PURE__*/new WeakMap();\nvar _currentHorizontalLinkedNode = /*#__PURE__*/new WeakMap();\nvar _currentVerticalLinkedNode = /*#__PURE__*/new WeakMap();\nvar _mergedCellsGetter = /*#__PURE__*/new WeakMap();\nvar _rowIndexMapper = /*#__PURE__*/new WeakMap();\nvar _columnIndexMapper = /*#__PURE__*/new WeakMap();\nvar _FocusOrder_brand = /*#__PURE__*/new WeakSet();\nexport class FocusOrder {\n constructor(_ref) {\n let {\n mergedCellsGetter,\n rowIndexMapper,\n columnIndexMapper\n } = _ref;\n /**\n * Pushes a new node to the provided list order.\n *\n * @param {CellRange} selectedRange The selected range to build the focus order for.\n * @param {LinkedList} listOrder The list order to push the node to.\n * @param {WeakSet} mergeCellsVisitor The set of visited cells.\n * @param {number} row The visual row index.\n * @param {number} column The visual column index.\n * @returns {NodeStructure | null}\n */\n _classPrivateMethodInitSpec(this, _FocusOrder_brand);\n /**\n * The linked list of the all cells within the current selection in horizontal order. The list is\n * recreated every time the selection is changed.\n *\n * @type {LinkedList}\n */\n _classPrivateFieldInitSpec(this, _cellsHorizontalOrder, new LinkedList());\n /**\n * The linked list of the all cells within the current selection in horizontal order. The list is\n * recreated every time the selection is changed.\n *\n * @type {LinkedList}\n */\n _classPrivateFieldInitSpec(this, _cellsVerticalOrder, new LinkedList());\n /**\n * The currently highlighted cell within the horizontal linked list.\n *\n * @type {NodeStructure | null}\n */\n _classPrivateFieldInitSpec(this, _currentHorizontalLinkedNode, null);\n /**\n * The currently highlighted cell within the vertical linked list.\n *\n * @type {NodeStructure | null}\n */\n _classPrivateFieldInitSpec(this, _currentVerticalLinkedNode, null);\n /**\n * The merged cells getter function.\n *\n * @type {function(): {row: number, col: number, rowspan: number, colspan: number} | null}}\n */\n _classPrivateFieldInitSpec(this, _mergedCellsGetter, null);\n /**\n * The row index mapper.\n *\n * @type {IndexMapper}\n */\n _classPrivateFieldInitSpec(this, _rowIndexMapper, null);\n /**\n * The column index mapper.\n *\n * @type {IndexMapper}\n */\n _classPrivateFieldInitSpec(this, _columnIndexMapper, null);\n _classPrivateFieldSet(_mergedCellsGetter, this, mergedCellsGetter);\n _classPrivateFieldSet(_rowIndexMapper, this, rowIndexMapper);\n _classPrivateFieldSet(_columnIndexMapper, this, columnIndexMapper);\n }\n\n /**\n * Gets the currently selected node data from the vertical focus order list.\n *\n * @returns {NodeStructure}\n */\n getCurrentVerticalNode() {\n return _classPrivateFieldGet(_currentVerticalLinkedNode, this).data;\n }\n\n /**\n * Gets the first node data from the vertical focus order list.\n *\n * @returns {NodeStructure}\n */\n getFirstVerticalNode() {\n return _classPrivateFieldGet(_cellsVerticalOrder, this).first.data;\n }\n\n /**\n * Gets the next selected node data from the vertical focus order list.\n *\n * @returns {NodeStructure}\n */\n getNextVerticalNode() {\n return _classPrivateFieldGet(_currentVerticalLinkedNode, this).next.data;\n }\n\n /**\n * Gets the previous selected node data from the vertical focus order list.\n *\n * @returns {NodeStructure}\n */\n getPrevVerticalNode() {\n return _classPrivateFieldGet(_currentVerticalLinkedNode, this).prev.data;\n }\n\n /**\n * Gets the currently selected node data from the horizontal focus order list.\n *\n * @returns {NodeStructure}\n */\n getCurrentHorizontalNode() {\n return _classPrivateFieldGet(_currentHorizontalLinkedNode, this).data;\n }\n\n /**\n * Gets the first node data from the horizontal focus order list.\n *\n * @returns {NodeStructure}\n */\n getFirstHorizontalNode() {\n return _classPrivateFieldGet(_cellsHorizontalOrder, this).first.data;\n }\n\n /**\n * Gets the next selected node data from the horizontal focus order list.\n *\n * @returns {NodeStructure}\n */\n getNextHorizontalNode() {\n return _classPrivateFieldGet(_currentHorizontalLinkedNode, this).next.data;\n }\n\n /**\n * Gets the previous selected node data from the horizontal focus order list.\n *\n * @returns {NodeStructure}\n */\n getPrevHorizontalNode() {\n return _classPrivateFieldGet(_currentHorizontalLinkedNode, this).prev.data;\n }\n\n /**\n * Sets the previous node from the vertical focus order list as active.\n */\n setPrevNodeAsActive() {\n _classPrivateFieldSet(_currentVerticalLinkedNode, this, _classPrivateFieldGet(_currentVerticalLinkedNode, this).prev);\n _classPrivateFieldSet(_currentHorizontalLinkedNode, this, _classPrivateFieldGet(_currentHorizontalLinkedNode, this).prev);\n }\n\n /**\n * Sets the previous node from the horizontal focus order list as active.\n */\n setNextNodeAsActive() {\n _classPrivateFieldSet(_currentVerticalLinkedNode, this, _classPrivateFieldGet(_currentVerticalLinkedNode, this).next);\n _classPrivateFieldSet(_currentHorizontalLinkedNode, this, _classPrivateFieldGet(_currentHorizontalLinkedNode, this).next);\n }\n\n /**\n * Rebuilds the focus order list based on the provided selection.\n *\n * @param {CellRange} selectedRange The selected range to build the focus order for.\n */\n buildFocusOrder(selectedRange) {\n const topStart = selectedRange.getTopStartCorner();\n const bottomEnd = selectedRange.getBottomEndCorner();\n const visitedHorizontalCells = new WeakSet();\n _classPrivateFieldSet(_cellsHorizontalOrder, this, new LinkedList());\n for (let r = topStart.row; r <= bottomEnd.row; r++) {\n if (_classPrivateFieldGet(_rowIndexMapper, this).isHidden(r)) {\n // eslint-disable-next-line no-continue\n continue;\n }\n for (let c = topStart.col; c <= bottomEnd.col; c++) {\n if (_classPrivateFieldGet(_columnIndexMapper, this).isHidden(c)) {\n // eslint-disable-next-line no-continue\n continue;\n }\n const node = _assertClassBrand(_FocusOrder_brand, this, _pushOrderNode).call(this, selectedRange, _classPrivateFieldGet(_cellsHorizontalOrder, this), visitedHorizontalCells, r, c);\n if (node) {\n _classPrivateFieldSet(_currentHorizontalLinkedNode, this, node);\n }\n }\n }\n\n // create circular linked list\n if (_classPrivateFieldGet(_cellsHorizontalOrder, this).first) {\n _classPrivateFieldGet(_cellsHorizontalOrder, this).first.prev = _classPrivateFieldGet(_cellsHorizontalOrder, this).last;\n _classPrivateFieldGet(_cellsHorizontalOrder, this).last.next = _classPrivateFieldGet(_cellsHorizontalOrder, this).first;\n }\n const visitedVerticalCells = new WeakSet();\n _classPrivateFieldSet(_cellsVerticalOrder, this, new LinkedList());\n for (let c = topStart.col; c <= bottomEnd.col; c++) {\n if (_classPrivateFieldGet(_columnIndexMapper, this).isHidden(c)) {\n // eslint-disable-next-line no-continue\n continue;\n }\n for (let r = topStart.row; r <= bottomEnd.row; r++) {\n if (_classPrivateFieldGet(_rowIndexMapper, this).isHidden(r)) {\n // eslint-disable-next-line no-continue\n continue;\n }\n const node = _assertClassBrand(_FocusOrder_brand, this, _pushOrderNode).call(this, selectedRange, _classPrivateFieldGet(_cellsVerticalOrder, this), visitedVerticalCells, r, c);\n if (node) {\n _classPrivateFieldSet(_currentVerticalLinkedNode, this, node);\n }\n }\n }\n\n // create circular linked list\n if (_classPrivateFieldGet(_cellsVerticalOrder, this).first) {\n _classPrivateFieldGet(_cellsVerticalOrder, this).first.prev = _classPrivateFieldGet(_cellsVerticalOrder, this).last;\n _classPrivateFieldGet(_cellsVerticalOrder, this).last.next = _classPrivateFieldGet(_cellsVerticalOrder, this).first;\n }\n }\n /**\n * Sets the active node based on the provided row and column.\n *\n * @param {number} row The visual row index.\n * @param {number} column The visual column index.\n * @returns {FocusOrder}\n */\n setActiveNode(row, column) {\n _classPrivateFieldGet(_cellsHorizontalOrder, this).inorder(node => {\n const {\n rowStart,\n rowEnd,\n colStart,\n colEnd\n } = node.data;\n if (row >= rowStart && row <= rowEnd && column >= colStart && column <= colEnd) {\n _classPrivateFieldSet(_currentHorizontalLinkedNode, this, node);\n return false;\n }\n });\n _classPrivateFieldGet(_cellsVerticalOrder, this).inorder(node => {\n const {\n rowStart,\n rowEnd,\n colStart,\n colEnd\n } = node.data;\n if (row >= rowStart && row <= rowEnd && column >= colStart && column <= colEnd) {\n _classPrivateFieldSet(_currentVerticalLinkedNode, this, node);\n return false;\n }\n });\n return this;\n }\n}\nfunction _pushOrderNode(selectedRange, listOrder, mergeCellsVisitor, row, column) {\n const topStart = selectedRange.getTopStartCorner();\n const bottomEnd = selectedRange.getBottomEndCorner();\n const highlight = selectedRange.highlight.clone().normalize();\n const mergeParent = _classPrivateFieldGet(_mergedCellsGetter, this).call(this, row, column);\n if (mergeParent && mergeCellsVisitor.has(mergeParent)) {\n return null;\n }\n const node = {\n colStart: column,\n colEnd: column,\n rowStart: row,\n rowEnd: row\n };\n if (mergeParent) {\n mergeCellsVisitor.add(mergeParent);\n if (mergeParent.row < topStart.row || mergeParent.row + mergeParent.rowspan - 1 > bottomEnd.row || mergeParent.col < topStart.col || mergeParent.col + mergeParent.colspan - 1 > bottomEnd.col) {\n return null;\n }\n node.colStart = mergeParent.col;\n node.colEnd = mergeParent.col + mergeParent.colspan - 1;\n node.rowStart = mergeParent.row;\n node.rowEnd = mergeParent.row + mergeParent.rowspan - 1;\n }\n const linkedNode = listOrder.push(node);\n if (row === highlight.row && column === highlight.col || mergeParent && highlight.row >= mergeParent.row && highlight.row <= mergeParent.row + mergeParent.rowspan - 1 && highlight.col >= mergeParent.col && highlight.col <= mergeParent.col + mergeParent.colspan - 1) {\n return linkedNode;\n }\n return null;\n}", "import { isObject } from \"../../helpers/object.mjs\";\n/**\n * Creates a renderer object for the `MergeCells` plugin.\n *\n * @private\n * @param {MergeCells} plugin The `MergeCells` plugin instance.\n * @returns {{before: Function, after: Function}}\n */\nexport function createMergeCellRenderer(plugin) {\n const {\n hot\n } = plugin;\n const {\n rowIndexMapper: rowMapper,\n columnIndexMapper: columnMapper\n } = hot;\n\n /**\n * Runs before the cell is rendered.\n *\n * @private\n */\n function before() {}\n\n /**\n * Runs after the cell is rendered.\n *\n * @private\n * @param {HTMLElement} TD The cell to be modified.\n * @param {number} row Row index.\n * @param {number} col Visual column index.\n */\n function after(TD, row, col) {\n const mergedCell = plugin.mergedCellsCollection.get(row, col);\n if (!isObject(mergedCell)) {\n TD.removeAttribute('rowspan');\n TD.removeAttribute('colspan');\n TD.style.display = '';\n return;\n }\n const {\n row: origRow,\n col: origColumn,\n colspan: origColspan,\n rowspan: origRowspan\n } = mergedCell;\n const [lastMergedRowIndex, lastMergedColumnIndex] = plugin.translateMergedCellToRenderable(origRow, origRowspan, origColumn, origColspan);\n const renderedRowIndex = rowMapper.getRenderableFromVisualIndex(row);\n const renderedColumnIndex = columnMapper.getRenderableFromVisualIndex(col);\n const maxRowSpan = lastMergedRowIndex - renderedRowIndex + 1; // Number of rendered columns.\n const maxColSpan = lastMergedColumnIndex - renderedColumnIndex + 1; // Number of rendered columns.\n\n const notHiddenRow = rowMapper.getNearestNotHiddenIndex(origRow, 1);\n const notHiddenColumn = columnMapper.getNearestNotHiddenIndex(origColumn, 1);\n const notHiddenRowspan = Math.min(origRowspan, maxRowSpan);\n const notHiddenColspan = Math.min(origColspan, maxColSpan);\n if (notHiddenRow === row && notHiddenColumn === col) {\n TD.setAttribute('rowspan', notHiddenRowspan);\n TD.setAttribute('colspan', notHiddenColspan);\n } else {\n TD.removeAttribute('rowspan');\n TD.removeAttribute('colspan');\n TD.style.display = 'none';\n }\n }\n return {\n before,\n after\n };\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/es.set.difference.v2.js\";\nimport \"core-js/modules/es.set.intersection.v2.js\";\nimport \"core-js/modules/es.set.is-disjoint-from.v2.js\";\nimport \"core-js/modules/es.set.is-subset-of.v2.js\";\nimport \"core-js/modules/es.set.is-superset-of.v2.js\";\nimport \"core-js/modules/es.set.symmetric-difference.v2.js\";\nimport \"core-js/modules/es.set.union.v2.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport Hooks from \"../../pluginHooks.mjs\";\nimport MergedCellsCollection from \"./cellsCollection.mjs\";\nimport MergedCellCoords from \"./cellCoords.mjs\";\nimport AutofillCalculations from \"./calculations/autofill.mjs\";\nimport SelectionCalculations from \"./calculations/selection.mjs\";\nimport toggleMergeItem from \"./contextMenuItem/toggleMerge.mjs\";\nimport { arrayEach } from \"../../helpers/array.mjs\";\nimport { isObject } from \"../../helpers/object.mjs\";\nimport { warn } from \"../../helpers/console.mjs\";\nimport { rangeEach } from \"../../helpers/number.mjs\";\nimport { getStyle } from \"../../helpers/dom/element.mjs\";\nimport { isChrome } from \"../../helpers/browser.mjs\";\nimport { FocusOrder } from \"./focusOrder.mjs\";\nimport { createMergeCellRenderer } from \"./renderer.mjs\";\nHooks.getSingleton().register('beforeMergeCells');\nHooks.getSingleton().register('afterMergeCells');\nHooks.getSingleton().register('beforeUnmergeCells');\nHooks.getSingleton().register('afterUnmergeCells');\nexport const PLUGIN_KEY = 'mergeCells';\nexport const PLUGIN_PRIORITY = 150;\nconst SHORTCUTS_GROUP = PLUGIN_KEY;\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @plugin MergeCells\n * @class MergeCells\n *\n * @description\n * Plugin, which allows merging cells in the table (using the initial configuration, API or context menu).\n *\n * @example\n *\n * ::: only-for javascript\n * ```js\n * const hot = new Handsontable(document.getElementById('example'), {\n * data: getData(),\n * mergeCells: [\n * {row: 0, col: 3, rowspan: 3, colspan: 3},\n * {row: 2, col: 6, rowspan: 2, colspan: 2},\n * {row: 4, col: 8, rowspan: 3, colspan: 3}\n * ],\n * ```\n * :::\n *\n * ::: only-for react\n * ```jsx\n * \n * ```\n * :::\n */\nvar _lastSelectedFocus = /*#__PURE__*/new WeakMap();\nvar _lastFocusDelta = /*#__PURE__*/new WeakMap();\nvar _focusOrder = /*#__PURE__*/new WeakMap();\nvar _cellRenderer = /*#__PURE__*/new WeakMap();\nvar _MergeCells_brand = /*#__PURE__*/new WeakSet();\nexport class MergeCells extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * `afterInit` hook callback.\n */\n _classPrivateMethodInitSpec(this, _MergeCells_brand);\n /**\n * A container for all the merged cells.\n *\n * @private\n * @type {MergedCellsCollection}\n */\n _defineProperty(this, \"mergedCellsCollection\", null);\n /**\n * Instance of the class responsible for all the autofill-related calculations.\n *\n * @private\n * @type {AutofillCalculations}\n */\n _defineProperty(this, \"autofillCalculations\", null);\n /**\n * Instance of the class responsible for the selection-related calculations.\n *\n * @private\n * @type {SelectionCalculations}\n */\n _defineProperty(this, \"selectionCalculations\", null);\n /**\n * The holder for the last selected focus coordinates. This allows keeping the correct coordinates in cases after the\n * focus is moved out of the merged cell.\n *\n * @type {CellCoords}\n */\n _classPrivateFieldInitSpec(this, _lastSelectedFocus, null);\n /**\n * The last used transformation delta.\n *\n * @type {{ row: number, col: number }}\n */\n _classPrivateFieldInitSpec(this, _lastFocusDelta, {\n row: 0,\n col: 0\n });\n /**\n * The module responsible for providing the correct focus order (vertical and horizontal) within a selection that\n * contains merged cells.\n *\n * @type {FocusOrder}\n */\n _classPrivateFieldInitSpec(this, _focusOrder, new FocusOrder({\n mergedCellsGetter: (row, column) => this.mergedCellsCollection.get(row, column),\n rowIndexMapper: this.hot.rowIndexMapper,\n columnIndexMapper: this.hot.columnIndexMapper\n }));\n /**\n * The cell renderer responsible for rendering the merged cells.\n *\n * @type {{before: Function, after: Function}}\n */\n _classPrivateFieldInitSpec(this, _cellRenderer, createMergeCellRenderer(this));\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link MergeCells#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n var _this = this;\n if (this.enabled) {\n return;\n }\n this.mergedCellsCollection = new MergedCellsCollection(this);\n this.autofillCalculations = new AutofillCalculations(this);\n this.selectionCalculations = new SelectionCalculations(this);\n this.addHook('afterInit', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onAfterInit).call(_this, ...args);\n });\n this.addHook('modifyTransformFocus', function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformFocus).call(_this, ...args);\n });\n this.addHook('modifyTransformStart', function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformStart).call(_this, ...args);\n });\n this.addHook('modifyTransformEnd', function () {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformEnd).call(_this, ...args);\n });\n this.addHook('beforeSelectionHighlightSet', function () {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSelectionHighlightSet).call(_this, ...args);\n });\n this.addHook('beforeSetRangeStart', function () {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);\n });\n this.addHook('beforeSetRangeStartOnly', function () {\n for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {\n args[_key7] = arguments[_key7];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);\n });\n this.addHook('beforeSelectionFocusSet', function () {\n for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {\n args[_key8] = arguments[_key8];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSelectionFocusSet).call(_this, ...args);\n });\n this.addHook('afterSelectionFocusSet', function () {\n for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {\n args[_key9] = arguments[_key9];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onAfterSelectionFocusSet).call(_this, ...args);\n });\n this.addHook('afterSelectionEnd', function () {\n for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {\n args[_key10] = arguments[_key10];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onAfterSelectionEnd).call(_this, ...args);\n });\n this.addHook('modifyGetCellCoords', function () {\n for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {\n args[_key11] = arguments[_key11];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onModifyGetCellCoords).call(_this, ...args);\n });\n this.addHook('afterIsMultipleSelection', function () {\n for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {\n args[_key12] = arguments[_key12];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onAfterIsMultipleSelection).call(_this, ...args);\n });\n this.addHook('afterRenderer', function () {\n return _classPrivateFieldGet(_cellRenderer, _this).after(...arguments);\n });\n this.addHook('afterContextMenuDefaultOptions', function () {\n for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {\n args[_key13] = arguments[_key13];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _addMergeActionsToContextMenu).call(_this, ...args);\n });\n this.addHook('afterGetCellMeta', function () {\n for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {\n args[_key14] = arguments[_key14];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onAfterGetCellMeta).call(_this, ...args);\n });\n this.addHook('afterViewportRowCalculatorOverride', function () {\n for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {\n args[_key15] = arguments[_key15];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportRowCalculatorOverride).call(_this, ...args);\n });\n this.addHook('afterViewportColumnCalculatorOverride', function () {\n for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {\n args[_key16] = arguments[_key16];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportColumnCalculatorOverride).call(_this, ...args);\n });\n this.addHook('modifyAutofillRange', function () {\n for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {\n args[_key17] = arguments[_key17];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onModifyAutofillRange).call(_this, ...args);\n });\n this.addHook('afterCreateCol', function () {\n for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {\n args[_key18] = arguments[_key18];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateCol).call(_this, ...args);\n });\n this.addHook('afterRemoveCol', function () {\n for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {\n args[_key19] = arguments[_key19];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveCol).call(_this, ...args);\n });\n this.addHook('afterCreateRow', function () {\n for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {\n args[_key20] = arguments[_key20];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateRow).call(_this, ...args);\n });\n this.addHook('afterRemoveRow', function () {\n for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {\n args[_key21] = arguments[_key21];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveRow).call(_this, ...args);\n });\n this.addHook('afterChange', function () {\n for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {\n args[_key22] = arguments[_key22];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onAfterChange).call(_this, ...args);\n });\n this.addHook('beforeDrawBorders', function () {\n for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {\n args[_key23] = arguments[_key23];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onBeforeDrawAreaBorders).call(_this, ...args);\n });\n this.addHook('afterDrawSelection', function () {\n for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {\n args[_key24] = arguments[_key24];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onAfterDrawSelection).call(_this, ...args);\n });\n this.addHook('beforeRemoveCellClassNames', function () {\n for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {\n args[_key25] = arguments[_key25];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onBeforeRemoveCellClassNames).call(_this, ...args);\n });\n this.addHook('beforeBeginEditing', function () {\n for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {\n args[_key26] = arguments[_key26];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onBeforeBeginEditing).call(_this, ...args);\n });\n this.addHook('modifyRowHeightByOverlayName', function () {\n for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {\n args[_key27] = arguments[_key27];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _onModifyRowHeightByOverlayName).call(_this, ...args);\n });\n this.addHook('beforeUndoStackChange', (action, source) => {\n if (source === 'MergeCells') {\n return false;\n }\n });\n this.registerShortcuts();\n super.enablePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n this.clearCollections();\n this.unregisterShortcuts();\n this.hot.render();\n super.disablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the\n * following configuration options:\n * - [`mergeCells`](@/api/options.md#mergecells)\n */\n updatePlugin() {\n const settings = this.hot.getSettings()[PLUGIN_KEY];\n this.disablePlugin();\n this.enablePlugin();\n this.generateFromSettings(settings);\n super.updatePlugin();\n }\n\n /**\n * If the browser is recognized as Chrome, force an additional repaint to prevent showing the effects of a Chrome bug.\n *\n * Issue described in https://github.com/handsontable/dev-handsontable/issues/521.\n *\n * @private\n */\n ifChromeForceRepaint() {\n if (!isChrome()) {\n return;\n }\n const rowsToRefresh = [];\n let rowIndexesToRefresh = [];\n this.mergedCellsCollection.mergedCells.forEach(mergedCell => {\n const {\n row,\n rowspan\n } = mergedCell;\n for (let r = row + 1; r < row + rowspan; r++) {\n rowIndexesToRefresh.push(r);\n }\n });\n\n // Remove duplicates\n rowIndexesToRefresh = [...new Set(rowIndexesToRefresh)];\n rowIndexesToRefresh.forEach(rowIndex => {\n const renderableRowIndex = this.hot.rowIndexMapper.getRenderableFromVisualIndex(rowIndex);\n this.hot.view._wt.wtOverlays.getOverlays(true).map(overlay => (overlay === null || overlay === void 0 ? void 0 : overlay.name) === 'master' ? overlay : overlay.clone.wtTable).forEach(wtTableRef => {\n const rowToRefresh = wtTableRef.getRow(renderableRowIndex);\n if (rowToRefresh) {\n // Modify the TR's `background` property to later modify it asynchronously.\n // The background color is getting modified only with the alpha, so the change should not be visible (and is\n // covered by the TDs' background color).\n rowToRefresh.style.background = getStyle(rowToRefresh, 'backgroundColor').replace(')', ', 0.99)');\n rowsToRefresh.push(rowToRefresh);\n }\n });\n });\n\n // Asynchronously revert the TRs' `background` property to force a fresh repaint.\n this.hot._registerTimeout(() => {\n rowsToRefresh.forEach(rowElement => {\n rowElement.style.background = getStyle(rowElement, 'backgroundColor').replace(', 0.99)', ')');\n });\n }, 1);\n }\n\n /**\n * Validates a single setting object, represented by a single merged cell information object.\n *\n * @private\n * @param {object} setting An object with `row`, `col`, `rowspan` and `colspan` properties.\n * @returns {boolean}\n */\n validateSetting(setting) {\n if (!setting) {\n return false;\n }\n if (MergedCellCoords.containsNegativeValues(setting)) {\n warn(MergedCellCoords.NEGATIVE_VALUES_WARNING(setting));\n return false;\n }\n if (MergedCellCoords.isOutOfBounds(setting, this.hot.countRows(), this.hot.countCols())) {\n warn(MergedCellCoords.IS_OUT_OF_BOUNDS_WARNING(setting));\n return false;\n }\n if (MergedCellCoords.isSingleCell(setting)) {\n warn(MergedCellCoords.IS_SINGLE_CELL(setting));\n return false;\n }\n if (MergedCellCoords.containsZeroSpan(setting)) {\n warn(MergedCellCoords.ZERO_SPAN_WARNING(setting));\n return false;\n }\n return true;\n }\n\n /**\n * Generates the merged cells from the settings provided to the plugin.\n *\n * @private\n * @param {Array|boolean} settings The settings provided to the plugin.\n */\n generateFromSettings(settings) {\n if (!Array.isArray(settings)) {\n return;\n }\n const validSettings = settings.filter(mergeCellInfo => this.validateSetting(mergeCellInfo));\n const nonOverlappingSettings = this.mergedCellsCollection.filterOverlappingMergeCells(validSettings);\n const populatedNulls = [];\n nonOverlappingSettings.forEach(mergeCellInfo => {\n const {\n row,\n col,\n rowspan,\n colspan\n } = mergeCellInfo;\n const from = this.hot._createCellCoords(row, col);\n const to = this.hot._createCellCoords(row + rowspan - 1, col + colspan - 1);\n const mergeRange = this.hot._createCellRange(from, from, to);\n\n // Merging without data population.\n this.mergeRange(mergeRange, true, true);\n for (let r = row; r < row + rowspan; r++) {\n for (let c = col; c < col + colspan; c++) {\n // Not resetting a cell representing a merge area's value.\n if (r !== row || c !== col) {\n populatedNulls.push([r, c, null]);\n }\n }\n }\n });\n\n // There are no merged cells. Thus, no data population is needed.\n if (populatedNulls.length === 0) {\n return;\n }\n\n // TODO: Change the `source` argument to a more meaningful value, e.g. `${this.pluginName}.clearCells`.\n this.hot.setDataAtCell(populatedNulls, undefined, undefined, this.pluginName);\n }\n\n /**\n * Clears the merged cells from the merged cell container.\n */\n clearCollections() {\n this.mergedCellsCollection.clear();\n }\n\n /**\n * Returns `true` if a range is mergeable.\n *\n * @private\n * @param {object} newMergedCellInfo Merged cell information object to test.\n * @param {boolean} [auto=false] `true` if triggered at initialization.\n * @returns {boolean}\n */\n canMergeRange(newMergedCellInfo) {\n let auto = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n return auto ? true : this.validateSetting(newMergedCellInfo);\n }\n\n /**\n * Merges the selection provided as a cell range.\n *\n * @param {CellRange} [cellRange] Selection cell range.\n */\n mergeSelection() {\n let cellRange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.hot.getSelectedRangeLast();\n if (!cellRange) {\n return;\n }\n cellRange.setDirection(this.hot.isRtl() ? 'NE-SW' : 'NW-SE');\n const {\n from,\n to\n } = cellRange;\n this.unmergeRange(cellRange, true);\n this.mergeRange(cellRange);\n this.hot.selectCell(from.row, from.col, to.row, to.col, false);\n }\n\n /**\n * Unmerges the selection provided as a cell range.\n *\n * @param {CellRange} [cellRange] Selection cell range.\n */\n unmergeSelection() {\n let cellRange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.hot.getSelectedRangeLast();\n if (!cellRange) {\n return;\n }\n const {\n from,\n to\n } = cellRange;\n this.unmergeRange(cellRange, true);\n this.hot.selectCell(from.row, from.col, to.row, to.col, false);\n }\n\n /**\n * Merges cells in the provided cell range.\n *\n * @private\n * @param {CellRange} cellRange Cell range to merge.\n * @param {boolean} [auto=false] `true` if is called automatically, e.g. At initialization.\n * @param {boolean} [preventPopulation=false] `true`, if the method should not run `populateFromArray` at the end,\n * but rather return its arguments.\n * @returns {Array|boolean} Returns an array of [row, column, dataUnderCollection] if preventPopulation is set to\n * true. If the the merging process went successful, it returns `true`, otherwise - `false`.\n * @fires Hooks#beforeMergeCells\n * @fires Hooks#afterMergeCells\n */\n mergeRange(cellRange) {\n let auto = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let preventPopulation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n const topStart = cellRange.getTopStartCorner();\n const bottomEnd = cellRange.getBottomEndCorner();\n const mergeParent = {\n row: topStart.row,\n col: topStart.col,\n rowspan: bottomEnd.row - topStart.row + 1,\n colspan: bottomEnd.col - topStart.col + 1\n };\n const clearedData = [];\n let populationInfo = null;\n if (!this.canMergeRange(mergeParent, auto)) {\n return false;\n }\n this.hot.runHooks('beforeMergeCells', cellRange, auto);\n rangeEach(0, mergeParent.rowspan - 1, i => {\n rangeEach(0, mergeParent.colspan - 1, j => {\n let clearedValue = null;\n if (!clearedData[i]) {\n clearedData[i] = [];\n }\n if (i === 0 && j === 0) {\n clearedValue = this.hot.getSourceDataAtCell(this.hot.toPhysicalRow(mergeParent.row), this.hot.toPhysicalColumn(mergeParent.col));\n } else {\n this.hot.setCellMeta(mergeParent.row + i, mergeParent.col + j, 'hidden', true);\n }\n clearedData[i][j] = clearedValue;\n });\n });\n this.hot.setCellMeta(mergeParent.row, mergeParent.col, 'spanned', true);\n const mergedCellAdded = this.mergedCellsCollection.add(mergeParent, auto);\n if (mergedCellAdded) {\n if (preventPopulation) {\n populationInfo = [mergeParent.row, mergeParent.col, clearedData];\n } else {\n // TODO: Change the `source` argument to a more meaningful value, e.g. `${this.pluginName}.clearCells`.\n this.hot.populateFromArray(mergeParent.row, mergeParent.col, clearedData, undefined, undefined, this.pluginName);\n }\n if (!auto) {\n this.ifChromeForceRepaint();\n }\n this.hot.runHooks('afterMergeCells', cellRange, mergeParent, auto);\n return populationInfo;\n }\n return true;\n }\n\n /**\n * Unmerges the selection provided as a cell range. If no cell range is provided, it uses the current selection.\n *\n * @private\n * @param {CellRange} cellRange Selection cell range.\n * @param {boolean} [auto=false] `true` if called automatically by the plugin.\n *\n * @fires Hooks#beforeUnmergeCells\n * @fires Hooks#afterUnmergeCells\n */\n unmergeRange(cellRange) {\n let auto = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n const mergedCells = this.mergedCellsCollection.getWithinRange(cellRange);\n if (mergedCells.length === 0) {\n return;\n }\n this.hot.runHooks('beforeUnmergeCells', cellRange, auto);\n arrayEach(mergedCells, currentCollection => {\n this.mergedCellsCollection.remove(currentCollection.row, currentCollection.col);\n rangeEach(0, currentCollection.rowspan - 1, i => {\n rangeEach(0, currentCollection.colspan - 1, j => {\n this.hot.removeCellMeta(currentCollection.row + i, currentCollection.col + j, 'hidden');\n this.hot.removeCellMeta(currentCollection.row + i, currentCollection.col + j, 'copyable');\n });\n });\n this.hot.removeCellMeta(currentCollection.row, currentCollection.col, 'spanned');\n });\n this.hot.runHooks('afterUnmergeCells', cellRange, auto);\n this.hot.render();\n }\n\n /**\n * Merges or unmerges, based on the cell range provided as `cellRange`.\n *\n * @private\n * @param {CellRange} cellRange The cell range to merge or unmerged.\n */\n toggleMerge(cellRange) {\n const mergedCell = this.mergedCellsCollection.get(cellRange.from.row, cellRange.from.col);\n const mergedCellCoversWholeRange = mergedCell.row === cellRange.from.row && mergedCell.col === cellRange.from.col && mergedCell.row + mergedCell.rowspan - 1 === cellRange.to.row && mergedCell.col + mergedCell.colspan - 1 === cellRange.to.col;\n if (mergedCellCoversWholeRange) {\n this.unmergeRange(cellRange);\n } else {\n this.mergeSelection(cellRange);\n }\n }\n\n /**\n * Merges the specified range.\n *\n * @param {number} startRow Start row of the merged cell.\n * @param {number} startColumn Start column of the merged cell.\n * @param {number} endRow End row of the merged cell.\n * @param {number} endColumn End column of the merged cell.\n * @fires Hooks#beforeMergeCells\n * @fires Hooks#afterMergeCells\n */\n merge(startRow, startColumn, endRow, endColumn) {\n const start = this.hot._createCellCoords(startRow, startColumn);\n const end = this.hot._createCellCoords(endRow, endColumn);\n this.mergeRange(this.hot._createCellRange(start, start, end));\n }\n\n /**\n * Unmerges the merged cell in the provided range.\n *\n * @param {number} startRow Start row of the merged cell.\n * @param {number} startColumn Start column of the merged cell.\n * @param {number} endRow End row of the merged cell.\n * @param {number} endColumn End column of the merged cell.\n * @fires Hooks#beforeUnmergeCells\n * @fires Hooks#afterUnmergeCells\n */\n unmerge(startRow, startColumn, endRow, endColumn) {\n const start = this.hot._createCellCoords(startRow, startColumn);\n const end = this.hot._createCellCoords(endRow, endColumn);\n this.unmergeRange(this.hot._createCellRange(start, start, end));\n }\n /**\n * Register shortcuts responsible for toggling a merge.\n *\n * @private\n */\n registerShortcuts() {\n const shortcutManager = this.hot.getShortcutManager();\n const gridContext = shortcutManager.getContext('grid');\n gridContext.addShortcut({\n keys: [['Control', 'm']],\n callback: () => {\n const range = this.hot.getSelectedRangeLast();\n if (range && !range.isSingleHeader()) {\n this.toggleMerge(range);\n this.hot.render();\n }\n },\n runOnlyIf: event => !event.altKey,\n // right ALT in some systems triggers ALT+CTRL\n group: SHORTCUTS_GROUP\n });\n }\n\n /**\n * Unregister shortcuts responsible for toggling a merge.\n *\n * @private\n */\n unregisterShortcuts() {\n const shortcutManager = this.hot.getShortcutManager();\n const gridContext = shortcutManager.getContext('grid');\n gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);\n }\n\n /**\n * Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`\n * hook callback.\n *\n * @param {boolean} isMultiple Determines whether the current selection contains multiple cells.\n * @returns {boolean}\n */\n\n /**\n * Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.\n *\n * @private\n * @param {object} calc The row calculator object.\n * @param {number} nrOfColumns Number of visual columns.\n */\n modifyViewportRowStart(calc, nrOfColumns) {\n const rowMapper = this.hot.rowIndexMapper;\n const visualStartRow = rowMapper.getVisualFromRenderableIndex(calc.startRow);\n for (let visualColumnIndex = 0; visualColumnIndex < nrOfColumns; visualColumnIndex += 1) {\n const mergeParentForViewportStart = this.mergedCellsCollection.get(visualStartRow, visualColumnIndex);\n if (isObject(mergeParentForViewportStart)) {\n const renderableIndexAtMergeStart = rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(mergeParentForViewportStart.row, 1));\n\n // Merge start is out of the viewport (i.e. when we scrolled to the bottom and we can see just part of a merge).\n if (renderableIndexAtMergeStart < calc.startRow) {\n // We extend viewport when some rows have been merged.\n calc.startRow = renderableIndexAtMergeStart;\n // We are looking for next merges inside already extended viewport (starting again from row equal to 0).\n this.modifyViewportRowStart(calc, nrOfColumns); // recursively search upwards\n\n return; // Finish the current loop. Everything will be checked from the beginning by above recursion.\n }\n }\n }\n }\n\n /**\n * Modify viewport end when needed. We extend viewport when merged cells aren't fully visible.\n *\n * @private\n * @param {object} calc The row calculator object.\n * @param {number} nrOfColumns Number of visual columns.\n */\n modifyViewportRowEnd(calc, nrOfColumns) {\n const rowMapper = this.hot.rowIndexMapper;\n const visualEndRow = rowMapper.getVisualFromRenderableIndex(calc.endRow);\n for (let visualColumnIndex = 0; visualColumnIndex < nrOfColumns; visualColumnIndex += 1) {\n const mergeParentForViewportEnd = this.mergedCellsCollection.get(visualEndRow, visualColumnIndex);\n if (isObject(mergeParentForViewportEnd)) {\n const mergeEnd = mergeParentForViewportEnd.row + mergeParentForViewportEnd.rowspan - 1;\n const renderableIndexAtMergeEnd = rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(mergeEnd, -1));\n\n // Merge end is out of the viewport.\n if (renderableIndexAtMergeEnd > calc.endRow) {\n // We extend the viewport when some rows have been merged.\n calc.endRow = renderableIndexAtMergeEnd;\n // We are looking for next merges inside already extended viewport (starting again from row equal to 0).\n this.modifyViewportRowEnd(calc, nrOfColumns); // recursively search upwards\n\n return; // Finish the current loop. Everything will be checked from the beginning by above recursion.\n }\n }\n }\n }\n\n /**\n * `afterViewportColumnCalculatorOverride` hook callback.\n *\n * @param {object} calc The column calculator object.\n */\n\n /**\n * Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.\n *\n * @private\n * @param {object} calc The column calculator object.\n * @param {number} nrOfRows Number of visual rows.\n */\n modifyViewportColumnStart(calc, nrOfRows) {\n const columnMapper = this.hot.columnIndexMapper;\n const visualStartCol = columnMapper.getVisualFromRenderableIndex(calc.startColumn);\n for (let visualRowIndex = 0; visualRowIndex < nrOfRows; visualRowIndex += 1) {\n const mergeParentForViewportStart = this.mergedCellsCollection.get(visualRowIndex, visualStartCol);\n if (isObject(mergeParentForViewportStart)) {\n const renderableIndexAtMergeStart = columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(mergeParentForViewportStart.col, 1));\n\n // Merge start is out of the viewport (i.e. when we scrolled to the right and we can see just part of a merge).\n if (renderableIndexAtMergeStart < calc.startColumn) {\n // We extend viewport when some columns have been merged.\n calc.startColumn = renderableIndexAtMergeStart;\n // We are looking for next merges inside already extended viewport (starting again from column equal to 0).\n this.modifyViewportColumnStart(calc, nrOfRows); // recursively search upwards\n\n return; // Finish the current loop. Everything will be checked from the beginning by above recursion.\n }\n }\n }\n }\n\n /**\n * Modify viewport end when needed. We extend viewport when merged cells aren't fully visible.\n *\n * @private\n * @param {object} calc The column calculator object.\n * @param {number} nrOfRows Number of visual rows.\n */\n modifyViewportColumnEnd(calc, nrOfRows) {\n const columnMapper = this.hot.columnIndexMapper;\n const visualEndCol = columnMapper.getVisualFromRenderableIndex(calc.endColumn);\n for (let visualRowIndex = 0; visualRowIndex < nrOfRows; visualRowIndex += 1) {\n const mergeParentForViewportEnd = this.mergedCellsCollection.get(visualRowIndex, visualEndCol);\n if (isObject(mergeParentForViewportEnd)) {\n const mergeEnd = mergeParentForViewportEnd.col + mergeParentForViewportEnd.colspan - 1;\n const renderableIndexAtMergeEnd = columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(mergeEnd, -1));\n\n // Merge end is out of the viewport.\n if (renderableIndexAtMergeEnd > calc.endColumn) {\n // We extend the viewport when some columns have been merged.\n calc.endColumn = renderableIndexAtMergeEnd;\n // We are looking for next merges inside already extended viewport (starting again from column equal to 0).\n this.modifyViewportColumnEnd(calc, nrOfRows); // recursively search upwards\n\n return; // Finish the current loop. Everything will be checked from the beginning by above recursion.\n }\n }\n }\n }\n\n /**\n * Translates merged cell coordinates to renderable indexes.\n *\n * @private\n * @param {number} parentRow Visual row index.\n * @param {number} rowspan Rowspan which describes shift which will be applied to parent row\n * to calculate renderable index which points to the most bottom\n * index position. Pass rowspan as `0` to calculate the most top\n * index position.\n * @param {number} parentColumn Visual column index.\n * @param {number} colspan Colspan which describes shift which will be applied to parent column\n * to calculate renderable index which points to the most right\n * index position. Pass colspan as `0` to calculate the most left\n * index position.\n * @returns {number[]}\n */\n translateMergedCellToRenderable(parentRow, rowspan, parentColumn, colspan) {\n const {\n rowIndexMapper: rowMapper,\n columnIndexMapper: columnMapper\n } = this.hot;\n let firstNonHiddenRow;\n let firstNonHiddenColumn;\n if (rowspan === 0) {\n firstNonHiddenRow = rowMapper.getNearestNotHiddenIndex(parentRow, 1);\n } else {\n firstNonHiddenRow = rowMapper.getNearestNotHiddenIndex(parentRow + rowspan - 1, -1);\n }\n if (colspan === 0) {\n firstNonHiddenColumn = columnMapper.getNearestNotHiddenIndex(parentColumn, 1);\n } else {\n firstNonHiddenColumn = columnMapper.getNearestNotHiddenIndex(parentColumn + colspan - 1, -1);\n }\n const renderableRow = parentRow >= 0 ? rowMapper.getRenderableFromVisualIndex(firstNonHiddenRow) : parentRow;\n const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;\n return [renderableRow, renderableColumn];\n }\n\n /**\n * The `modifyAutofillRange` hook callback.\n *\n * @param {Array} drag The drag area coordinates.\n * @param {Array} select The selection information.\n * @returns {Array} The new drag area.\n */\n}\nfunction _onAfterInit() {\n this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);\n this.hot.render();\n}\nfunction _onAfterIsMultipleSelection(isMultiple) {\n if (isMultiple) {\n const mergedCells = this.mergedCellsCollection.mergedCells;\n const selectionRange = this.hot.getSelectedRangeLast();\n const topStartCoords = selectionRange.getTopStartCorner();\n const bottomEndCoords = selectionRange.getBottomEndCorner();\n for (let group = 0; group < mergedCells.length; group += 1) {\n if (topStartCoords.row === mergedCells[group].row && topStartCoords.col === mergedCells[group].col && bottomEndCoords.row === mergedCells[group].row + mergedCells[group].rowspan - 1 && bottomEndCoords.col === mergedCells[group].col + mergedCells[group].colspan - 1) {\n return false;\n }\n }\n }\n return isMultiple;\n}\n/**\n * `modifyTransformFocus` hook callback.\n *\n * @param {object} delta The transformation delta.\n */\nfunction _onModifyTransformFocus(delta) {\n _classPrivateFieldGet(_lastFocusDelta, this).row = delta.row;\n _classPrivateFieldGet(_lastFocusDelta, this).col = delta.col;\n}\n/**\n * `modifyTransformStart` hook callback.\n *\n * @param {object} delta The transformation delta.\n */\nfunction _onModifyTransformStart(delta) {\n const selectedRange = this.hot.getSelectedRangeLast();\n const {\n highlight\n } = selectedRange;\n const {\n columnIndexMapper,\n rowIndexMapper\n } = this.hot;\n if (_classPrivateFieldGet(_lastSelectedFocus, this)) {\n if (rowIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).row) !== null) {\n highlight.row = _classPrivateFieldGet(_lastSelectedFocus, this).row;\n }\n if (columnIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).col) !== null) {\n highlight.col = _classPrivateFieldGet(_lastSelectedFocus, this).col;\n }\n _classPrivateFieldSet(_lastSelectedFocus, this, null);\n }\n const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);\n if (!mergedParent) {\n return;\n }\n const visualColumnIndexStart = mergedParent.col;\n const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;\n if (delta.col < 0) {\n const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;\n const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);\n if (notHiddenColumnIndex === null) {\n // There are no visible columns anymore, so move the selection out of the table edge. This will\n // be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).\n delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);\n } else {\n delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);\n }\n } else if (delta.col > 0) {\n const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;\n const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);\n if (notHiddenColumnIndex === null) {\n // There are no visible columns anymore, so move the selection out of the table edge. This will\n // be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).\n delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());\n } else {\n delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);\n }\n }\n const visualRowIndexStart = mergedParent.row;\n const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;\n if (delta.row < 0) {\n const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;\n const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);\n if (notHiddenRowIndex === null) {\n // There are no visible rows anymore, so move the selection out of the table edge. This will\n // be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).\n delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);\n } else {\n delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);\n }\n } else if (delta.row > 0) {\n const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;\n const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);\n if (notHiddenRowIndex === null) {\n // There are no visible rows anymore, so move the selection out of the table edge. This will\n // be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).\n delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());\n } else {\n delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);\n }\n }\n}\n/**\n * The hook allows to modify the delta transformation object necessary for correct selection end transformations.\n * The logic here handles \"jumping over\" merged merged cells, while selecting.\n *\n * @param {{ row: number, col: number }} delta The transformation delta.\n */\nfunction _onModifyTransformEnd(delta) {\n const selectedRange = this.hot.getSelectedRangeLast();\n const cloneRange = selectedRange.clone();\n const {\n to\n } = selectedRange;\n const {\n columnIndexMapper,\n rowIndexMapper\n } = this.hot;\n const expandCloneRange = (row, col) => {\n cloneRange.expand(this.hot._createCellCoords(row, col));\n for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {\n cloneRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange());\n }\n };\n if (delta.col < 0) {\n let nextColumn = this.mergedCellsCollection.getStartMostColumnIndex(selectedRange, to.col) + delta.col;\n expandCloneRange(to.row, nextColumn);\n if (selectedRange.getHorizontalDirection() === 'E-W' && cloneRange.getHorizontalDirection() === 'E-W') {\n nextColumn = cloneRange.getTopStartCorner().col;\n }\n const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);\n if (notHiddenColumnIndex !== null) {\n delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);\n }\n } else if (delta.col > 0) {\n let nextColumn = this.mergedCellsCollection.getEndMostColumnIndex(selectedRange, to.col) + delta.col;\n expandCloneRange(to.row, nextColumn);\n if (selectedRange.getHorizontalDirection() === 'W-E' && cloneRange.getHorizontalDirection() === 'W-E') {\n nextColumn = cloneRange.getBottomEndCorner().col;\n }\n const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);\n if (notHiddenColumnIndex !== null) {\n delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);\n }\n }\n if (delta.row < 0) {\n let nextRow = this.mergedCellsCollection.getTopMostRowIndex(selectedRange, to.row) + delta.row;\n expandCloneRange(nextRow, to.col);\n if (selectedRange.getVerticalDirection() === 'S-N' && cloneRange.getVerticalDirection() === 'S-N') {\n nextRow = cloneRange.getTopStartCorner().row;\n }\n const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);\n if (notHiddenRowIndex !== null) {\n delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, to.row) - 1, 1);\n }\n } else if (delta.row > 0) {\n let nextRow = this.mergedCellsCollection.getBottomMostRowIndex(selectedRange, to.row) + delta.row;\n expandCloneRange(nextRow, to.col);\n if (selectedRange.getVerticalDirection() === 'N-S' && cloneRange.getVerticalDirection() === 'N-S') {\n nextRow = cloneRange.getBottomStartCorner().row;\n }\n const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);\n if (notHiddenRowIndex !== null) {\n delta.row = Math.max(this.hot.view.countRenderableRowsInRange(to.row, notHiddenRowIndex) - 1, 1);\n }\n }\n}\n/**\n * The hook corrects the range (before drawing it) after the selection was made on the merged cells.\n * It expands the range to cover the entire area of the selected merged cells.\n */\nfunction _onBeforeSelectionHighlightSet() {\n const selectedRange = this.hot.getSelectedRangeLast();\n const {\n highlight\n } = selectedRange;\n if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {\n _classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());\n return;\n }\n for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {\n selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);\n }\n // TODO: This is a workaround for an issue with the selection not being extended properly.\n // In some cases when the merge cells are defined in random order the selection is not\n // extended in that way that it covers all overlapped merge cells.\n for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {\n selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);\n }\n const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);\n _classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());\n if (mergedParent) {\n highlight.assign(mergedParent);\n }\n}\n/**\n * `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.\n *\n * @param {number} row Row index.\n * @param {number} column Visual column index.\n * @returns {Array|undefined} Visual coordinates of the merge.\n */\nfunction _onModifyGetCellCoords(row, column) {\n if (row < 0 || column < 0) {\n return;\n }\n const mergeParent = this.mergedCellsCollection.get(row, column);\n if (!mergeParent) {\n return;\n }\n const {\n row: mergeRow,\n col: mergeColumn,\n colspan,\n rowspan\n } = mergeParent;\n return [\n // Most top-left merged cell coords.\n mergeRow, mergeColumn,\n // Most bottom-right merged cell coords.\n mergeRow + rowspan - 1, mergeColumn + colspan - 1];\n}\n/**\n * `afterContextMenuDefaultOptions` hook callback.\n *\n * @param {object} defaultOptions The default context menu options.\n */\nfunction _addMergeActionsToContextMenu(defaultOptions) {\n defaultOptions.items.push({\n name: '---------'\n }, toggleMergeItem(this));\n}\n/**\n * Clears the last selected coordinates before setting a new selection range.\n */\nfunction _onBeforeSetRangeStart() {\n _classPrivateFieldSet(_lastSelectedFocus, this, null);\n}\n/**\n * Detects if the last selected cell was a header cell if so update the order list active node for further\n * computations.\n */\nfunction _onBeforeSelectionFocusSet() {\n if (_classPrivateFieldGet(_lastSelectedFocus, this).isCell()) {\n return;\n }\n const selectedRange = this.hot.getSelectedRangeLast();\n const verticalDir = selectedRange.getVerticalDirection();\n const horizontalDir = selectedRange.getHorizontalDirection();\n const focusCoords = _classPrivateFieldGet(_lastSelectedFocus, this).clone().normalize();\n _classPrivateFieldGet(_focusOrder, this).setActiveNode(focusCoords.row, focusCoords.col);\n if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0 || _classPrivateFieldGet(_lastFocusDelta, this).col > 0) {\n _classPrivateFieldGet(_focusOrder, this).setPrevNodeAsActive();\n } else if (horizontalDir === 'E-W' && _classPrivateFieldGet(_lastFocusDelta, this).col < 0 || verticalDir === 'S-N' && _classPrivateFieldGet(_lastFocusDelta, this).row < 0) {\n _classPrivateFieldGet(_focusOrder, this).setNextNodeAsActive();\n }\n}\n/**\n * Changes the focus selection to the next or previous cell or merged cell position.\n *\n * @param {number} row The visual row index.\n * @param {number} column The visual column index.\n */\nfunction _onAfterSelectionFocusSet(row, column) {\n const selectedRange = this.hot.getSelectedRangeLast();\n const {\n columnIndexMapper,\n rowIndexMapper\n } = this.hot;\n let notHiddenRowIndex = null;\n let notHiddenColumnIndex = null;\n if (_classPrivateFieldGet(_lastFocusDelta, this).col < 0) {\n const {\n rowEnd,\n colEnd\n } = _classPrivateFieldGet(_focusOrder, this).getPrevHorizontalNode();\n notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);\n notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);\n } else if (_classPrivateFieldGet(_lastFocusDelta, this).col > 0) {\n const {\n rowStart,\n colStart\n } = _classPrivateFieldGet(_focusOrder, this).getNextHorizontalNode();\n notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);\n notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);\n } else if (_classPrivateFieldGet(_lastFocusDelta, this).row < 0) {\n const {\n rowEnd,\n colEnd\n } = _classPrivateFieldGet(_focusOrder, this).getPrevVerticalNode();\n notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);\n notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);\n } else if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0) {\n const {\n rowStart,\n colStart\n } = _classPrivateFieldGet(_focusOrder, this).getNextVerticalNode();\n notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);\n notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);\n }\n if (notHiddenRowIndex !== null || notHiddenColumnIndex !== null) {\n const coords = this.hot._createCellCoords(notHiddenRowIndex, notHiddenColumnIndex);\n const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);\n const focusHighlight = this.hot.selection.highlight.getFocus();\n row = coords.row;\n column = coords.col;\n if (mergeParent) {\n selectedRange.highlight.assign({\n row: this.hot.rowIndexMapper.getNearestNotHiddenIndex(mergeParent.row, 1),\n col: this.hot.columnIndexMapper.getNearestNotHiddenIndex(mergeParent.col, 1)\n });\n } else {\n selectedRange.highlight.assign(coords);\n }\n focusHighlight.clear();\n focusHighlight.add(coords).commit();\n }\n _classPrivateFieldGet(_focusOrder, this).setActiveNode(row, column);\n _classPrivateFieldSet(_lastFocusDelta, this, {\n row: 0,\n col: 0\n });\n}\n/**\n * Creates the horizontal and vertical cells order matrix (linked lists) for focused cell.\n */\nfunction _onAfterSelectionEnd() {\n const selection = this.hot.getSelectedRangeLast();\n if (!selection.isHeader()) {\n _classPrivateFieldGet(_focusOrder, this).buildFocusOrder(this.hot.getSelectedRangeLast());\n }\n}\n/**\n * The `afterGetCellMeta` hook callback.\n *\n * @param {number} row Row index.\n * @param {number} col Column index.\n * @param {object} cellProperties The cell properties object.\n */\nfunction _onAfterGetCellMeta(row, col, cellProperties) {\n const mergeParent = this.mergedCellsCollection.get(row, col);\n if (mergeParent) {\n if (mergeParent.row !== row || mergeParent.col !== col) {\n cellProperties.copyable = false;\n } else {\n cellProperties.rowspan = mergeParent.rowspan;\n cellProperties.colspan = mergeParent.colspan;\n }\n }\n}\n/**\n * `afterViewportRowCalculatorOverride` hook callback.\n *\n * @param {object} calc The row calculator object.\n */\nfunction _onAfterViewportRowCalculatorOverride(calc) {\n const nrOfColumns = this.hot.countCols();\n this.modifyViewportRowStart(calc, nrOfColumns);\n this.modifyViewportRowEnd(calc, nrOfColumns);\n}\nfunction _onAfterViewportColumnCalculatorOverride(calc) {\n const nrOfRows = this.hot.countRows();\n this.modifyViewportColumnStart(calc, nrOfRows);\n this.modifyViewportColumnEnd(calc, nrOfRows);\n}\nfunction _onModifyAutofillRange(drag, select) {\n this.autofillCalculations.correctSelectionAreaSize(select);\n const dragDirection = this.autofillCalculations.getDirection(select, drag);\n let dragArea = drag;\n if (this.autofillCalculations.dragAreaOverlapsCollections(select, dragArea, dragDirection)) {\n dragArea = select;\n return dragArea;\n }\n const from = this.hot._createCellCoords(select[0], select[1]);\n const to = this.hot._createCellCoords(select[2], select[3]);\n const range = this.hot._createCellRange(from, from, to);\n const mergedCellsWithinSelectionArea = this.mergedCellsCollection.getWithinRange(range);\n if (mergedCellsWithinSelectionArea.length === 0) {\n return dragArea;\n }\n dragArea = this.autofillCalculations.snapDragArea(select, dragArea, dragDirection, mergedCellsWithinSelectionArea);\n return dragArea;\n}\n/**\n * `afterCreateCol` hook callback.\n *\n * @param {number} column Column index.\n * @param {number} count Number of created columns.\n */\nfunction _onAfterCreateCol(column, count) {\n this.mergedCellsCollection.shiftCollections('right', column, count);\n}\n/**\n * `afterRemoveCol` hook callback.\n *\n * @param {number} column Column index.\n * @param {number} count Number of removed columns.\n */\nfunction _onAfterRemoveCol(column, count) {\n this.mergedCellsCollection.shiftCollections('left', column, count);\n}\n/**\n * `afterCreateRow` hook callback.\n *\n * @param {number} row Row index.\n * @param {number} count Number of created rows.\n * @param {string} source Source of change.\n */\nfunction _onAfterCreateRow(row, count, source) {\n if (source === 'auto') {\n return;\n }\n this.mergedCellsCollection.shiftCollections('down', row, count);\n}\n/**\n * `afterRemoveRow` hook callback.\n *\n * @param {number} row Row index.\n * @param {number} count Number of removed rows.\n */\nfunction _onAfterRemoveRow(row, count) {\n this.mergedCellsCollection.shiftCollections('up', row, count);\n}\n/**\n * `afterChange` hook callback. Used to propagate merged cells after using Autofill.\n *\n * @param {Array} changes The changes array.\n * @param {string} source Determines the source of the change.\n */\nfunction _onAfterChange(changes, source) {\n if (source !== 'Autofill.fill') {\n return;\n }\n this.autofillCalculations.recreateAfterDataPopulation(changes);\n}\n/**\n * `beforeDrawAreaBorders` hook callback.\n *\n * @param {Array} corners Visual coordinates of the area corners.\n * @param {string} className Class name for the area.\n */\nfunction _onBeforeDrawAreaBorders(corners, className) {\n if (className && className === 'area') {\n const selectedRange = this.hot.getSelectedRangeLast();\n const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(selectedRange);\n arrayEach(mergedCellsWithinRange, mergedCell => {\n if (selectedRange.getBottomEndCorner().row === mergedCell.getLastRow() && selectedRange.getBottomEndCorner().col === mergedCell.getLastColumn()) {\n corners[2] = mergedCell.row;\n corners[3] = mergedCell.col;\n }\n });\n }\n}\n/**\n * `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.\n *\n * @param {number} currentRow Visual row index of the currently processed cell.\n * @param {number} currentColumn Visual column index of the currently cell.\n * @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,\n * endColumn]`.\n * @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.\n * @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently\n * processed cell.\n */\nfunction _onAfterDrawSelection(currentRow, currentColumn, cornersOfSelection, layerLevel) {\n // Nothing's selected (hook might be triggered by the custom borders)\n if (!cornersOfSelection) {\n return;\n }\n return this.selectionCalculations.getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel);\n}\n/**\n * `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.\n *\n * @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from\n * all the cells in the table.\n */\nfunction _onBeforeRemoveCellClassNames() {\n return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();\n}\n/**\n * Allows to prevent opening the editor while more than one merged cell is selected.\n *\n * @param {number} row Visual row index of the edited cell.\n * @param {number} column Visual column index of the edited cell.\n * @param {string | null} initialValue The initial editor value.\n * @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.\n * @returns {boolean | undefined}\n */\nfunction _onBeforeBeginEditing(row, column, initialValue, event) {\n if (!(event instanceof MouseEvent)) {\n return;\n }\n const selection = this.hot.getSelectedRangeLast();\n const mergeCell = this.mergedCellsCollection.getByRange(selection);\n if (!mergeCell) {\n return;\n }\n const from = this.hot._createCellCoords(mergeCell.row, mergeCell.col);\n const to = this.hot._createCellCoords(mergeCell.row + mergeCell.rowspan - 1, mergeCell.col + mergeCell.colspan - 1);\n return this.hot.selection.getLayerLevel() === 0 && selection.isEqual(this.hot._createCellRange(from, from, to));\n}\n/**\n * Hook used to modify the row height depends on the merged cells in the row.\n *\n * @param {number} height The row height value provided by the Core.\n * @param {number} row The visual row index.\n * @param {string} overlayType The overlay type that is currently rendered.\n * @returns {number}\n */\nfunction _onModifyRowHeightByOverlayName(height, row, overlayType) {\n if (this.hot.getSettings().rowHeaders ||\n // merged cells do not work with the bottom overlays\n overlayType === 'bottom' || overlayType === 'bottom_inline_start_corner') {\n return height;\n }\n let firstColumn;\n let lastColumn;\n if (overlayType === 'master') {\n firstColumn = this.hot.view.getFirstRenderedVisibleColumn();\n lastColumn = this.hot.view.getLastRenderedVisibleColumn();\n } else {\n const activeOverlay = this.hot.view.getOverlayByName(overlayType);\n firstColumn = this.hot.columnIndexMapper.getVisualFromRenderableIndex(activeOverlay.clone.wtTable.getFirstRenderedColumn());\n lastColumn = this.hot.columnIndexMapper.getVisualFromRenderableIndex(activeOverlay.clone.wtTable.getLastRenderedColumn());\n }\n const firstMergedCellInRow = this.mergedCellsCollection.get(row, firstColumn);\n if (!firstMergedCellInRow) {\n return height;\n }\n const from = this.hot._createCellCoords(row, firstColumn);\n const to = this.hot._createCellCoords(row, lastColumn);\n const viewportRange = this.hot._createCellRange(from, from, to);\n const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(viewportRange);\n const maxRowspan = mergedCellsWithinRange.reduce((acc, _ref) => {\n let {\n rowspan\n } = _ref;\n return Math.max(acc, rowspan);\n }, 1);\n let rowspanCorrection = 0;\n if (mergedCellsWithinRange.length > 1 && mergedCellsWithinRange[0].rowspan < maxRowspan) {\n rowspanCorrection = maxRowspan - mergedCellsWithinRange[0].rowspan;\n }\n mergedCellsWithinRange.forEach(_ref2 => {\n var _height;\n let {\n rowspan\n } = _ref2;\n let rowspanAfterCorrection = 0;\n if (overlayType === 'top' || overlayType === 'top_inline_start_corner') {\n rowspanAfterCorrection = Math.min(maxRowspan, this.hot.view.countNotHiddenFixedRowsTop() - row);\n } else {\n rowspanAfterCorrection = rowspan - rowspanCorrection;\n }\n height = Math.max((_height = height) !== null && _height !== void 0 ? _height : 0, _assertClassBrand(_MergeCells_brand, this, _sumCellsHeights).call(this, row, rowspanAfterCorrection));\n });\n return height;\n}\n/**\n * Sums the heights of the all cells that the merge cell consists of.\n *\n * @param {number} row The visual row index of the merged cell.\n * @param {number} rowspan The rowspan value of the merged cell.\n * @returns {number}\n */\nfunction _sumCellsHeights(row, rowspan) {\n const defaultHeight = this.hot.view._wt.wtSettings.getSettingPure('defaultRowHeight');\n const autoRowSizePlugin = this.hot.getPlugin('autoRowSize');\n let height = 0;\n for (let i = row; i < row + rowspan; i++) {\n if (!this.hot.rowIndexMapper.isHidden(i)) {\n var _autoRowSizePlugin$ge;\n height += (_autoRowSizePlugin$ge = autoRowSizePlugin === null || autoRowSizePlugin === void 0 ? void 0 : autoRowSizePlugin.getRowHeight(i)) !== null && _autoRowSizePlugin$ge !== void 0 ? _autoRowSizePlugin$ge : defaultHeight;\n }\n }\n return height;\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, MergeCells } from \"./mergeCells.mjs\";", "import { getCompareFunctionFactory, DO_NOT_SWAP } from \"../columnSorting/sortService/index.mjs\";\n/**\n * Sort comparator handled by conventional sort algorithm.\n *\n * @param {Array} sortingOrders Sort orders (`asc` for ascending, `desc` for descending).\n * @param {Array} columnMetas Column meta objects.\n * @returns {Function}\n */\nexport function rootComparator(sortingOrders, columnMetas) {\n return function (rowIndexWithValues, nextRowIndexWithValues) {\n // We sort array of arrays. Single array is in form [rowIndex, ...values].\n // We compare just values, stored at second index of array.\n const [, ...values] = rowIndexWithValues;\n const [, ...nextValues] = nextRowIndexWithValues;\n return function getCompareResult(column) {\n const sortingOrder = sortingOrders[column];\n const columnMeta = columnMetas[column];\n const value = values[column];\n const nextValue = nextValues[column];\n const pluginSettings = columnMeta.multiColumnSorting;\n const compareFunctionFactory = pluginSettings.compareFunctionFactory ? pluginSettings.compareFunctionFactory : getCompareFunctionFactory(columnMeta.type);\n const compareResult = compareFunctionFactory(sortingOrder, columnMeta, pluginSettings)(value, nextValue);\n if (compareResult === DO_NOT_SWAP) {\n const nextSortedColumn = column + 1;\n if (typeof columnMetas[nextSortedColumn] !== 'undefined') {\n return getCompareResult(nextSortedColumn);\n }\n }\n return compareResult;\n }(0);\n };\n}", "import { warn } from \"../../helpers/console.mjs\";\nimport { toSingleLine } from \"../../helpers/templateLiteralTag.mjs\";\n/**\n * Warn users about problems when using `columnSorting` and `multiColumnSorting` plugins simultaneously.\n */\nexport function warnAboutPluginsConflict() {\n warn(toSingleLine`Plugins \\`columnSorting\\` and \\`multiColumnSorting\\` should not be enabled simultaneously. \n Only \\`multiColumnSorting\\` will work. The \\`columnSorting\\` plugin will be disabled.`);\n}", "import \"core-js/modules/es.array.push.js\";\nconst COLUMN_ORDER_PREFIX = 'sort';\n\n/**\n * Get CSS classes which should be added to particular column header.\n *\n * @param {object} columnStatesManager Instance of column state manager.\n * @param {number} column Visual column index.\n * @param {boolean} showSortIndicator Indicates if indicator should be shown for the particular column.\n * @returns {Array} Array of CSS classes.\n */\nexport function getClassesToAdd(columnStatesManager, column, showSortIndicator) {\n const cssClasses = [];\n if (showSortIndicator === false) {\n return cssClasses;\n }\n if (columnStatesManager.isColumnSorted(column) && columnStatesManager.getNumberOfSortedColumns() > 1) {\n cssClasses.push(`${COLUMN_ORDER_PREFIX}-${columnStatesManager.getIndexOfColumnInSortQueue(column) + 1}`);\n }\n return cssClasses;\n}\n\n/**\n * Get CSS classes which should be removed from column header.\n *\n * @param {HTMLElement} htmlElement An element to process.\n * @returns {Array} Array of CSS classes.\n */\nexport function getClassesToRemove(htmlElement) {\n const cssClasses = htmlElement.className.split(' ');\n const sortSequenceRegExp = new RegExp(`^${COLUMN_ORDER_PREFIX}-[0-9]{1,2}$`);\n return cssClasses.filter(cssClass => sortSequenceRegExp.test(cssClass));\n}", "import \"core-js/modules/es.error.cause.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { APPEND_COLUMN_CONFIG_STRATEGY, ColumnSorting } from \"../columnSorting/index.mjs\";\nimport { registerRootComparator } from \"../columnSorting/sortService/index.mjs\";\nimport { wasHeaderClickedProperly } from \"../columnSorting/utils.mjs\";\nimport { addClass, removeClass } from \"../../helpers/dom/element.mjs\";\nimport { rootComparator } from \"./rootComparator.mjs\";\nimport { warnAboutPluginsConflict } from \"./utils.mjs\";\nimport { getClassesToAdd, getClassesToRemove } from \"./domHelpers.mjs\";\nimport { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from \"../../shortcutContexts/index.mjs\";\nexport const PLUGIN_KEY = 'multiColumnSorting';\nexport const PLUGIN_PRIORITY = 170;\nconst CONFLICTED_PLUGIN_KEY = 'columnSorting';\nconst SHORTCUTS_GROUP = PLUGIN_KEY;\nregisterRootComparator(PLUGIN_KEY, rootComparator);\n\n/**\n * @plugin MultiColumnSorting\n * @class MultiColumnSorting\n *\n * @description\n * This plugin sorts the view by columns (but does not sort the data source!). To enable the plugin, set the\n * {@link Options#multiColumnSorting} property to the correct value (see the examples below).\n *\n * @example\n * ```js\n * // as boolean\n * multiColumnSorting: true\n *\n * // as an object with initial sort config (sort ascending for column at index 1 and then sort descending for column at index 0)\n * multiColumnSorting: {\n * initialConfig: [{\n * column: 1,\n * sortOrder: 'asc'\n * }, {\n * column: 0,\n * sortOrder: 'desc'\n * }]\n * }\n *\n * // as an object which define specific sorting options for all columns\n * multiColumnSorting: {\n * sortEmptyCells: true, // true = the table sorts empty cells, false = the table moves all empty cells to the end of the table (by default)\n * indicator: true, // true = shows indicator for all columns (by default), false = don't show indicator for columns\n * headerAction: true, // true = allow to click on the headers to sort (by default), false = turn off possibility to click on the headers to sort\n * compareFunctionFactory: function(sortOrder, columnMeta) {\n * return function(value, nextValue) {\n * // Some value comparisons which will return -1, 0 or 1...\n * }\n * }\n * }\n *\n * // as an object passed to the `column` property, allows specifying a custom options for the desired column.\n * // please take a look at documentation of `column` property: {@link Options#columns}\n * columns: [{\n * multiColumnSorting: {\n * indicator: false, // disable indicator for the first column,\n * sortEmptyCells: true,\n * headerAction: false, // clicks on the first column won't sort\n * compareFunctionFactory: function(sortOrder, columnMeta) {\n * return function(value, nextValue) {\n * return 0; // Custom compare function for the first column (don't sort)\n * }\n * }\n * }\n * }]\n * ```\n */\nexport class MultiColumnSorting extends ColumnSorting {\n constructor() {\n super(...arguments);\n /**\n * Main settings key designed for the plugin.\n *\n * @private\n * @type {string}\n */\n _defineProperty(this, \"pluginKey\", PLUGIN_KEY);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the plugin is enabled in the Handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link MultiColumnSorting#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return super.isEnabled();\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n if (!this.enabled && this.hot.getSettings()[this.pluginKey] && this.hot.getSettings()[CONFLICTED_PLUGIN_KEY]) {\n warnAboutPluginsConflict();\n this.hot.getPlugin(CONFLICTED_PLUGIN_KEY).disablePlugin();\n }\n super.enablePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n super.disablePlugin();\n }\n\n /**\n * Register shortcuts responsible for toggling column sorting functionality.\n *\n * @private\n */\n registerShortcuts() {\n super.registerShortcuts();\n this.hot.getShortcutManager().getContext('grid').addShortcut({\n keys: [['Shift', 'Enter']],\n callback: () => {\n const {\n highlight\n } = this.hot.getSelectedRangeLast();\n if (highlight.row === -1 && highlight.col >= 0) {\n this.sort(this.getNextSortConfig(highlight.col, APPEND_COLUMN_CONFIG_STRATEGY));\n }\n\n // prevent default Enter behavior (move to the next row within a selection range)\n return false;\n },\n runOnlyIf: () => {\n var _this$hot$getSelected, _this$hot$getSelected2;\n const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;\n return highlight && ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.isSingle()) && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();\n },\n relativeToGroup: SHORTCUTS_GROUP_EDITOR,\n position: 'before',\n group: SHORTCUTS_GROUP\n });\n }\n\n /**\n * Unregister shortcuts responsible for toggling column sorting functionality.\n *\n * @private\n */\n unregisterShortcuts() {\n super.unregisterShortcuts();\n this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);\n }\n\n /**\n * Sorts the table by chosen columns and orders.\n *\n * @param {undefined|object|Array} sortConfig Single column sort configuration or full sort configuration (for all sorted columns).\n * The configuration object contains `column` and `sortOrder` properties. First of them contains visual column index, the second one contains\n * sort order (`asc` for ascending, `desc` for descending).\n *\n * **Note**: Please keep in mind that every call of `sort` function set an entirely new sort order. Previous sort configs aren't preserved.\n *\n * @example\n * ```js\n * // sort ascending first visual column\n * hot.getPlugin('multiColumnSorting').sort({ column: 0, sortOrder: 'asc' });\n *\n * // sort first two visual column in the defined sequence\n * hot.getPlugin('multiColumnSorting').sort([{\n * column: 1, sortOrder: 'asc'\n * }, {\n * column: 0, sortOrder: 'desc'\n * }]);\n * ```\n *\n * @fires Hooks#beforeColumnSort\n * @fires Hooks#afterColumnSort\n */\n sort(sortConfig) {\n super.sort(sortConfig);\n }\n\n /**\n * Clear the sort performed on the table.\n */\n clearSort() {\n super.clearSort();\n }\n\n /**\n * Checks if the table is sorted (any column have to be sorted).\n *\n * @returns {boolean}\n */\n isSorted() {\n return super.isSorted();\n }\n\n /**\n * Get sort configuration for particular column or for all sorted columns. Objects contain `column` and `sortOrder` properties.\n *\n * **Note**: Please keep in mind that returned objects expose **visual** column index under the `column` key. They are handled by the `sort` function.\n *\n * @param {number} [column] Visual column index.\n * @returns {undefined|object|Array}\n */\n getSortConfig(column) {\n return super.getSortConfig(column);\n }\n\n /**\n * @description\n * Warn: Useful mainly for providing server side sort implementation (see in the example below). It doesn't sort the data set. It just sets sort configuration for all sorted columns.\n * Note: Please keep in mind that this method doesn't re-render the table.\n *\n * @example\n * ```js\n * beforeColumnSort: function(currentSortConfig, destinationSortConfigs) {\n * const columnSortPlugin = this.getPlugin('multiColumnSorting');\n *\n * columnSortPlugin.setSortConfig(destinationSortConfigs);\n *\n * // const newData = ... // Calculated data set, ie. from an AJAX call.\n *\n * this.loadData(newData); // Load new data set and re-render the table.\n *\n * return false; // The blockade for the default sort action.\n * }\n * ```\n *\n * @param {undefined|object|Array} sortConfig Single column sort configuration or full sort configuration (for all sorted columns).\n * The configuration object contains `column` and `sortOrder` properties. First of them contains visual column index, the second one contains\n * sort order (`asc` for ascending, `desc` for descending).\n */\n setSortConfig(sortConfig) {\n super.setSortConfig(sortConfig);\n }\n\n /**\n * Get normalized sort configs.\n *\n * @private\n * @param {object|Array} [sortConfig=[]] Single column sort configuration or full sort configuration (for all sorted columns).\n * The configuration object contains `column` and `sortOrder` properties. First of them contains visual column index, the second one contains\n * sort order (`asc` for ascending, `desc` for descending).\n * @returns {Array}\n */\n getNormalizedSortConfigs() {\n let sortConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n if (Array.isArray(sortConfig)) {\n return sortConfig;\n }\n return [sortConfig];\n }\n\n /**\n * Update header classes.\n *\n * @private\n * @param {HTMLElement} headerSpanElement Header span element.\n * @param {...*} args Extra arguments for helpers.\n */\n updateHeaderClasses(headerSpanElement) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n super.updateHeaderClasses(headerSpanElement, ...args);\n removeClass(headerSpanElement, getClassesToRemove(headerSpanElement));\n if (this.enabled !== false) {\n addClass(headerSpanElement, getClassesToAdd(...args));\n }\n }\n\n /**\n * Overwriting base plugin's `onUpdateSettings` method. Please keep in mind that `onAfterUpdateSettings` isn't called\n * for `updateSettings` in specific situations.\n *\n * @private\n * @param {object} newSettings New settings object.\n */\n onUpdateSettings(newSettings) {\n if (this.hot.getSettings()[this.pluginKey] && this.hot.getSettings()[CONFLICTED_PLUGIN_KEY]) {\n warnAboutPluginsConflict();\n }\n super.onUpdateSettings(newSettings);\n }\n\n /**\n * Callback for the `onAfterOnCellMouseDown` hook.\n *\n * @private\n * @param {Event} event Event which are provided by hook.\n * @param {CellCoords} coords Visual coords of the selected cell.\n */\n onAfterOnCellMouseDown(event, coords) {\n if (wasHeaderClickedProperly(coords.row, coords.col, event) === false) {\n return;\n }\n if (this.wasClickableHeaderClicked(event, coords.col)) {\n if (this.hot.getShortcutManager().isCtrlPressed()) {\n this.hot.deselectCell();\n this.hot.selectColumns(coords.col);\n this.sort(this.getNextSortConfig(coords.col, APPEND_COLUMN_CONFIG_STRATEGY));\n } else {\n this.sort(this.getColumnNextConfig(coords.col));\n }\n }\n }\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, MultiColumnSorting } from \"./multiColumnSorting.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { hasClass } from \"../../helpers/dom/element.mjs\";\nimport { isMobileBrowser } from \"../../helpers/browser.mjs\";\nimport { BasePlugin } from \"../base/index.mjs\";\nexport const PLUGIN_KEY = 'multipleSelectionHandles';\nexport const PLUGIN_PRIORITY = 160;\n\n/**\n * @private\n * @plugin MultipleSelectionHandles\n * @class MultipleSelectionHandles\n */\nexport class MultipleSelectionHandles extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * @type {Array}\n */\n _defineProperty(this, \"dragged\", []);\n /**\n * @type {null}\n */\n _defineProperty(this, \"lastSetCell\", null);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Check if the plugin is enabled in the handsontable settings.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return isMobileBrowser();\n }\n\n /**\n * Enable plugin for this Handsontable instance.\n */\n enablePlugin() {\n if (this.enabled) {\n return;\n }\n this.registerListeners();\n super.enablePlugin();\n }\n\n /**\n * Bind the touch events.\n *\n * @private\n */\n registerListeners() {\n const _this = this;\n const {\n rootElement\n } = this.hot;\n\n /**\n * @private\n * @param {string} query Query for the position.\n * @returns {boolean}\n */\n function removeFromDragged(query) {\n if (_this.dragged.length === 1) {\n // clear array\n _this.dragged.splice(0, _this.dragged.length);\n return true;\n }\n const entryPosition = _this.dragged.indexOf(query);\n if (entryPosition === -1) {\n return false;\n } else if (entryPosition === 0) {\n _this.dragged = _this.dragged.slice(0, 1);\n } else if (entryPosition === 1) {\n _this.dragged = _this.dragged.slice(-1);\n }\n }\n this.eventManager.addEventListener(rootElement, 'touchstart', event => {\n let selectedRange;\n if (hasClass(event.target, 'topSelectionHandle-HitArea')) {\n selectedRange = _this.hot.getSelectedRangeLast();\n _this.dragged.push('top');\n _this.touchStartRange = {\n width: selectedRange.getWidth(),\n height: selectedRange.getHeight(),\n direction: selectedRange.getDirection()\n };\n event.preventDefault();\n return false;\n } else if (hasClass(event.target, 'bottomSelectionHandle-HitArea')) {\n selectedRange = _this.hot.getSelectedRangeLast();\n _this.dragged.push('bottom');\n _this.touchStartRange = {\n width: selectedRange.getWidth(),\n height: selectedRange.getHeight(),\n direction: selectedRange.getDirection()\n };\n event.preventDefault();\n return false;\n }\n });\n this.eventManager.addEventListener(rootElement, 'touchend', event => {\n if (hasClass(event.target, 'topSelectionHandle-HitArea')) {\n removeFromDragged.call(_this, 'top');\n _this.touchStartRange = undefined;\n event.preventDefault();\n return false;\n } else if (hasClass(event.target, 'bottomSelectionHandle-HitArea')) {\n removeFromDragged.call(_this, 'bottom');\n _this.touchStartRange = undefined;\n event.preventDefault();\n return false;\n }\n });\n this.eventManager.addEventListener(rootElement, 'touchmove', event => {\n const {\n rootDocument\n } = this.hot;\n let targetCoords;\n let selectedRange;\n let rangeWidth;\n let rangeHeight;\n let rangeDirection;\n let newRangeCoords;\n if (_this.dragged.length === 0) {\n return;\n }\n const endTarget = rootDocument.elementFromPoint(event.touches[0].clientX, event.touches[0].clientY);\n if (!endTarget || endTarget === _this.lastSetCell) {\n return;\n }\n if (endTarget.nodeName === 'TD' || endTarget.nodeName === 'TH') {\n targetCoords = _this.hot.getCoords(endTarget);\n if (targetCoords.col === -1) {\n targetCoords.col = 0;\n }\n selectedRange = _this.hot.getSelectedRangeLast();\n rangeWidth = selectedRange.getWidth();\n rangeHeight = selectedRange.getHeight();\n rangeDirection = selectedRange.getDirection();\n if (rangeWidth === 1 && rangeHeight === 1) {\n _this.hot.selection.setRangeEnd(targetCoords);\n }\n newRangeCoords = _this.getCurrentRangeCoords(selectedRange, targetCoords, _this.touchStartRange.direction, rangeDirection, _this.dragged[0]);\n if (newRangeCoords.start !== null) {\n _this.hot.selection.setRangeStart(newRangeCoords.start);\n }\n _this.hot.selection.setRangeEnd(newRangeCoords.end);\n _this.lastSetCell = endTarget;\n }\n event.preventDefault();\n });\n }\n getCurrentRangeCoords(selectedRange, currentTouch, touchStartDirection, currentDirection, draggedHandle) {\n const topStartCorner = selectedRange.getTopStartCorner();\n const bottomEndCorner = selectedRange.getBottomEndCorner();\n const bottomStartCorner = selectedRange.getBottomStartCorner();\n const topEndCorner = selectedRange.getTopEndCorner();\n let newCoords = {\n start: null,\n end: null\n };\n switch (touchStartDirection) {\n case 'NE-SW':\n switch (currentDirection) {\n case 'NE-SW':\n case 'NW-SE':\n if (draggedHandle === 'top') {\n newCoords = {\n start: this.hot._createCellCoords(currentTouch.row, selectedRange.highlight.col),\n end: this.hot._createCellCoords(bottomStartCorner.row, currentTouch.col)\n };\n } else {\n newCoords = {\n start: this.hot._createCellCoords(selectedRange.highlight.row, currentTouch.col),\n end: this.hot._createCellCoords(currentTouch.row, topStartCorner.col)\n };\n }\n break;\n case 'SE-NW':\n if (draggedHandle === 'bottom') {\n newCoords = {\n start: this.hot._createCellCoords(bottomEndCorner.row, currentTouch.col),\n end: this.hot._createCellCoords(currentTouch.row, topStartCorner.col)\n };\n }\n break;\n default:\n break;\n }\n break;\n case 'NW-SE':\n switch (currentDirection) {\n case 'NE-SW':\n if (draggedHandle === 'top') {\n newCoords = {\n start: currentTouch,\n end: bottomStartCorner\n };\n } else {\n newCoords.end = currentTouch;\n }\n break;\n case 'NW-SE':\n if (draggedHandle === 'top') {\n newCoords = {\n start: currentTouch,\n end: bottomEndCorner\n };\n } else {\n newCoords.end = currentTouch;\n }\n break;\n case 'SE-NW':\n if (draggedHandle === 'top') {\n newCoords = {\n start: currentTouch,\n end: topStartCorner\n };\n } else {\n newCoords.end = currentTouch;\n }\n break;\n case 'SW-NE':\n if (draggedHandle === 'top') {\n newCoords = {\n start: currentTouch,\n end: topEndCorner\n };\n } else {\n newCoords.end = currentTouch;\n }\n break;\n default:\n break;\n }\n break;\n case 'SW-NE':\n switch (currentDirection) {\n case 'NW-SE':\n if (draggedHandle === 'bottom') {\n newCoords = {\n start: this.hot._createCellCoords(currentTouch.row, topStartCorner.col),\n end: this.hot._createCellCoords(bottomStartCorner.row, currentTouch.col)\n };\n } else {\n newCoords = {\n start: this.hot._createCellCoords(topStartCorner.row, currentTouch.col),\n end: this.hot._createCellCoords(currentTouch.row, bottomEndCorner.col)\n };\n }\n break;\n // case 'NE-SW':\n //\n // break;\n case 'SW-NE':\n if (draggedHandle === 'top') {\n newCoords = {\n start: this.hot._createCellCoords(selectedRange.highlight.row, currentTouch.col),\n end: this.hot._createCellCoords(currentTouch.row, bottomEndCorner.col)\n };\n } else {\n newCoords = {\n start: this.hot._createCellCoords(currentTouch.row, topStartCorner.col),\n end: this.hot._createCellCoords(topStartCorner.row, currentTouch.col)\n };\n }\n break;\n case 'SE-NW':\n if (draggedHandle === 'bottom') {\n newCoords = {\n start: this.hot._createCellCoords(currentTouch.row, topEndCorner.col),\n end: this.hot._createCellCoords(topStartCorner.row, currentTouch.col)\n };\n } else if (draggedHandle === 'top') {\n newCoords = {\n start: bottomStartCorner,\n end: currentTouch\n };\n }\n break;\n default:\n break;\n }\n break;\n case 'SE-NW':\n switch (currentDirection) {\n case 'NW-SE':\n case 'NE-SW':\n case 'SW-NE':\n if (draggedHandle === 'top') {\n newCoords.end = currentTouch;\n }\n break;\n case 'SE-NW':\n if (draggedHandle === 'top') {\n newCoords.end = currentTouch;\n } else {\n newCoords = {\n start: currentTouch,\n end: topStartCorner\n };\n }\n break;\n default:\n break;\n }\n break;\n default:\n break;\n }\n return newCoords;\n }\n\n /**\n * Check if user is currently dragging the handle.\n *\n * @returns {boolean} Dragging state.\n */\n isDragged() {\n return this.dragged.length > 0;\n }\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, MultipleSelectionHandles } from \"./multipleSelectionHandles.mjs\";", "/**\n * @typedef {object} DefaultHeaderSettings\n * @property {string} label The name/label of the column header.\n * @property {number} colspan Current calculated colspan value of the rendered column header element.\n * @property {number} origColspan Original colspan value, set once while parsing user-defined nested header settings.\n * @property {boolean} collapsible The flag determines whether the node is collapsible (can be collapsed/expanded).\n * @property {number[]} crossHiddenColumns The list of visual column indexes which indicates that the specified columns within\n * the header settings are hidden.\n * @property {boolean} isCollapsed The flag determines whether the node is collapsed.\n * @property {boolean} isHidden The flag determines whether the column header at specified index is hidden. If true\n * the TH element will be rendered as hidden (display: none).\n * @property {boolean} isRoot The flag which determines whether the column header settings is actually not renderable. That kind\n * of objects are generated after colspaned header to fill an array to correct size.\n * For example for header with colspan = 8 the 7 blank objects are generated to fill the array settings\n * to length = 8.\n * @property {boolean} isPlaceholder The flag determines whether the column header at the specified index is non-renderable.\n * @property {string[]} headerClassNames The list of CSS classes that will be added to the `div` element inside the\n * header Acts as a replacement for the analogous property from the Handsontable settings.\n */\n\n/**\n * Creates the header settings object with default values.\n *\n * @param {DefaultHeaderSettings} initialValues The initial values for the header settings object.\n * @returns {DefaultHeaderSettings}\n */\nexport function createDefaultHeaderSettings() {\n let {\n label = '',\n colspan = 1,\n origColspan = 1,\n collapsible = false,\n crossHiddenColumns = [],\n isCollapsed = false,\n isHidden = false,\n isRoot = false,\n isPlaceholder = false,\n headerClassNames = []\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return {\n label,\n colspan,\n origColspan,\n collapsible,\n isCollapsed,\n crossHiddenColumns,\n isHidden,\n isRoot,\n isPlaceholder,\n headerClassNames\n };\n}\n\n/**\n * Creates the placeholder header settings object. Those settings tell the header renderers\n * that this TH element should not be rendered (the node will be overlapped by the previously\n * created node with colspan bigger than 1).\n *\n * @returns {object}\n */\nexport function createPlaceholderHeaderSettings() {\n return {\n label: '',\n isPlaceholder: true\n };\n}", "import \"core-js/modules/es.array.push.js\";\n/* eslint-disable jsdoc/require-description-complete-sentence */\nimport { arrayEach, arrayMap } from \"../../../helpers/array.mjs\";\nimport { isObject } from \"../../../helpers/object.mjs\";\nimport { stringify } from \"../../../helpers/mixed.mjs\";\nimport { createDefaultHeaderSettings, createPlaceholderHeaderSettings } from \"./utils.mjs\";\n/**\n * A function that normalizes user-defined settings into one predictable\n * structure. Currently, the developer can declare nested headers by passing\n * the following unstructured (and sometimes uncompleted) array.\n * [\n * [{ label: 'A1', colspan: 2 }],\n * [{ label: true }, 'B2', 4],\n * [],\n * ]\n *\n * The normalization process equalizes the length of columns to each header\n * layers to the same length and generates object settings with a common shape.\n * So the above mentioned example will be normalized into this:\n * [\n * [\n * { label: 'A1', colspan: 2, isHidden: false, ... },\n * { label: '', colspan: 1, isHidden: true, ... },\n * { label: '', colspan: 1, isHidden: false, ... },\n * ],\n * [\n * { label: 'true', colspan: 1, isHidden: false, ... },\n * { label: 'B2', colspan: 1, isHidden: false, ... },\n * { label: '4', colspan: 1, isHidden: false, ... },\n * ],\n * [\n * { label: '', colspan: 1, isHidden: false, ... },\n * { label: '', colspan: 1, isHidden: false, ... },\n * { label: '', colspan: 1, isHidden: false, ... },\n * ],\n * ]\n *\n * @param {Array[]} sourceSettings An array with defined nested headers settings.\n * @param {number} [columnsLimit=Infinity] A number of columns to which the structure\n * will be trimmed. While trimming the colspan\n * values are adjusted to preserve the original\n * structure.\n * @returns {Array[]}\n */\nexport function normalizeSettings(sourceSettings) {\n let columnsLimit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;\n const normalizedSettings = [];\n if (columnsLimit === 0) {\n return normalizedSettings;\n }\n\n // Normalize array items (header settings) into one shape - literal object with default props.\n arrayEach(sourceSettings, headersSettings => {\n const columns = [];\n let columnIndex = 0;\n normalizedSettings.push(columns);\n arrayEach(headersSettings, sourceHeaderSettings => {\n const headerSettings = createDefaultHeaderSettings();\n if (isObject(sourceHeaderSettings)) {\n const {\n label,\n colspan,\n headerClassName\n } = sourceHeaderSettings;\n headerSettings.label = stringify(label);\n if (typeof colspan === 'number' && colspan > 1) {\n headerSettings.colspan = colspan;\n headerSettings.origColspan = colspan;\n }\n if (typeof headerClassName === 'string') {\n headerSettings.headerClassNames = [...headerClassName.split(' ')];\n }\n } else {\n headerSettings.label = stringify(sourceHeaderSettings);\n }\n columnIndex += headerSettings.origColspan;\n let cancelProcessing = false;\n if (columnIndex >= columnsLimit) {\n // Adjust the colspan value to not overlap the columns limit.\n headerSettings.colspan = headerSettings.origColspan - (columnIndex - columnsLimit);\n headerSettings.origColspan = headerSettings.colspan;\n cancelProcessing = true;\n }\n columns.push(headerSettings);\n if (headerSettings.colspan > 1) {\n for (let i = 0; i < headerSettings.colspan - 1; i++) {\n columns.push(createPlaceholderHeaderSettings());\n }\n }\n return !cancelProcessing;\n });\n });\n const columnsLength = Math.max(...arrayMap(normalizedSettings, headersSettings => headersSettings.length));\n\n // Normalize the length of each header layer to the same columns length.\n arrayEach(normalizedSettings, headersSettings => {\n if (headersSettings.length < columnsLength) {\n const defaultSettings = arrayMap(new Array(columnsLength - headersSettings.length), () => createDefaultHeaderSettings());\n headersSettings.splice(headersSettings.length, 0, ...defaultSettings);\n }\n });\n return normalizedSettings;\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { extend, isObject } from \"../../../helpers/object.mjs\";\nimport { arrayEach } from \"../../../helpers/array.mjs\";\nimport { normalizeSettings } from \"./settingsNormalizer.mjs\";\n/**\n * List of properties which are configurable. That properties can be changed using public API.\n *\n * @type {string[]}\n */\nexport const HEADER_CONFIGURABLE_PROPS = ['label', 'collapsible'];\n\n/**\n * The class manages and normalizes settings passed by the developer\n * into the nested headers plugin. The SourceSettings class is a\n * source of truth for tree builder (HeaderTree) module.\n *\n * @private\n * @class SourceSettings\n */\nvar _data = /*#__PURE__*/new WeakMap();\nvar _dataLength = /*#__PURE__*/new WeakMap();\nvar _columnsLimit = /*#__PURE__*/new WeakMap();\nexport default class SourceSettings {\n constructor() {\n /**\n * The normalized source data (normalized user-defined settings for nested headers).\n *\n * @private\n * @type {Array[]}\n */\n _classPrivateFieldInitSpec(this, _data, []);\n /**\n * The total length of the nested header layers.\n *\n * @private\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _dataLength, 0);\n /**\n * Columns count limit value trims source settings to that value. If columns\n * count limit intersects nested header, the header's colspan value is reduced\n * to keep the whole structure stable (trimmed precisely where the limit is set).\n *\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _columnsLimit, Infinity);\n }\n /**\n * Sets columns limit to the source settings will be trimmed. All headers which\n * overlap the column limit will be reduced to keep the structure solid.\n *\n * @param {number} columnsCount The number of columns to limit to.\n */\n setColumnsLimit(columnsCount) {\n _classPrivateFieldSet(_columnsLimit, this, columnsCount);\n }\n\n /**\n * Sets a new nested header configuration.\n *\n * @param {Array[]} [nestedHeadersSettings=[]] The user-defined nested headers settings.\n */\n setData() {\n let nestedHeadersSettings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n _classPrivateFieldSet(_data, this, normalizeSettings(nestedHeadersSettings, _classPrivateFieldGet(_columnsLimit, this)));\n _classPrivateFieldSet(_dataLength, this, _classPrivateFieldGet(_data, this).length);\n }\n\n /**\n * Gets normalized source settings.\n *\n * @returns {Array[]}\n */\n getData() {\n return _classPrivateFieldGet(_data, this);\n }\n\n /**\n * Merges settings with current source settings.\n *\n * @param {object[]} additionalSettings An array of objects with `row`, `col` and additional\n * properties to merge with current source settings.\n */\n mergeWith(additionalSettings) {\n arrayEach(additionalSettings, _ref => {\n let {\n row,\n col,\n ...rest\n } = _ref;\n const headerSettings = this.getHeaderSettings(row, col);\n if (headerSettings !== null) {\n extend(headerSettings, rest, HEADER_CONFIGURABLE_PROPS);\n }\n });\n }\n\n /**\n * Maps the current state with a callback. For each source settings the callback function\n * is called. If the function returns value that value is merged with the source settings.\n *\n * @param {Function} callback A function that is called for every header settings.\n * Each time the callback is called, the returned value extends\n * header settings.\n */\n map(callback) {\n arrayEach(_classPrivateFieldGet(_data, this), header => {\n arrayEach(header, headerSettings => {\n const propsToExtend = callback({\n ...headerSettings\n });\n if (isObject(propsToExtend)) {\n extend(headerSettings, propsToExtend, HEADER_CONFIGURABLE_PROPS);\n }\n });\n });\n }\n\n /**\n * Gets source column header settings for a specified header. The returned\n * object contains information about the header label, its colspan length,\n * or if it is hidden in the header renderers.\n *\n * @param {number} headerLevel Header level (0 = most distant to the table).\n * @param {number} columnIndex A visual column index.\n * @returns {object|null}\n */\n getHeaderSettings(headerLevel, columnIndex) {\n var _headersSettings$colu;\n if (headerLevel >= _classPrivateFieldGet(_dataLength, this) || headerLevel < 0) {\n return null;\n }\n const headersSettings = _classPrivateFieldGet(_data, this)[headerLevel];\n if (Array.isArray(headersSettings) === false || columnIndex >= headersSettings.length) {\n return null;\n }\n return (_headersSettings$colu = headersSettings[columnIndex]) !== null && _headersSettings$colu !== void 0 ? _headersSettings$colu : null;\n }\n\n /**\n * Gets source of column headers settings for specified headers. If the retrieved column\n * settings overlap the range \"box\" determined by \"columnIndex\" and \"columnsLength\"\n * the exception will be thrown.\n *\n * @param {number} headerLevel Header level (0 = most distant to the table).\n * @param {number} columnIndex A visual column index from which the settings will be extracted.\n * @param {number} [columnsLength=1] The number of columns involved in the extraction of settings.\n * @returns {object}\n */\n getHeadersSettings(headerLevel, columnIndex) {\n let columnsLength = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n const headersSettingsChunks = [];\n if (headerLevel >= _classPrivateFieldGet(_dataLength, this) || headerLevel < 0) {\n return headersSettingsChunks;\n }\n const headersSettings = _classPrivateFieldGet(_data, this)[headerLevel];\n let currentLength = 0;\n for (let i = columnIndex; i < headersSettings.length; i++) {\n const headerSettings = headersSettings[i];\n if (headerSettings.isPlaceholder) {\n throw new Error('The first column settings cannot overlap the other header layers');\n }\n currentLength += headerSettings.colspan;\n headersSettingsChunks.push(headerSettings);\n if (headerSettings.colspan > 1) {\n i += headerSettings.colspan - 1;\n }\n\n // We met the current sum of the child colspans\n if (currentLength === columnsLength) {\n break;\n }\n // We exceeds the current sum of the child colspans, the last columns colspan overlaps the \"columnsLength\" length.\n if (currentLength > columnsLength) {\n throw new Error('The last column settings cannot overlap the other header layers');\n }\n }\n return headersSettingsChunks;\n }\n\n /**\n * Gets a total number of headers levels.\n *\n * @returns {number}\n */\n getLayersCount() {\n return _classPrivateFieldGet(_dataLength, this);\n }\n\n /**\n * Gets a total number of columns count.\n *\n * @returns {number}\n */\n getColumnsCount() {\n return _classPrivateFieldGet(_dataLength, this) > 0 ? _classPrivateFieldGet(_data, this)[0].length : 0;\n }\n\n /**\n * Clears the data.\n */\n clear() {\n _classPrivateFieldSet(_data, this, []);\n _classPrivateFieldSet(_dataLength, this, 0);\n }\n}", "function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\n/**\n * Depth-first pre-order strategy (https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR)).\n *\n * @type {string}\n */\nexport const TRAVERSAL_DF_PRE = 'DF-pre-order';\n/**\n * @param {Function} callback A callback which will be called on each visited node.\n * @param {*} context A context to pass through.\n * @returns {boolean}\n */\nexport function depthFirstPreOrder(callback, context) {\n let continueTraverse = callback.call(context, this);\n for (let i = 0; i < this.childs.length; i++) {\n if (continueTraverse === false) {\n return false;\n }\n continueTraverse = depthFirstPreOrder.call(this.childs[i], callback, context);\n }\n return continueTraverse;\n}\n\n/**\n * Depth-first post-order strategy (https://en.wikipedia.org/wiki/Tree_traversal#Post-order_(NLR)).\n *\n * @type {string}\n */\nexport const TRAVERSAL_DF_POST = 'DF-post-order';\n/**\n * @param {Function} callback A callback which will be called on each visited node.\n * @param {*} context A context to pass through.\n * @returns {boolean}\n */\nfunction depthFirstPostOrder(callback, context) {\n for (let i = 0; i < this.childs.length; i++) {\n const continueTraverse = depthFirstPostOrder.call(this.childs[i], callback, context);\n if (continueTraverse === false) {\n return false;\n }\n }\n return callback.call(context, this);\n}\n\n/**\n * Breadth-first traversal strategy (https://en.wikipedia.org/wiki/Tree_traversal#Breadth-first_search_/_level_order).\n *\n * @type {string}\n */\nexport const TRAVERSAL_BF = 'BF';\n/**\n * @param {Function} callback A callback which will be called on each visited node.\n * @param {*} context A context to pass through.\n */\nfunction breadthFirst(callback, context) {\n const queue = [this];\n\n /**\n * Internal processor.\n */\n function process() {\n if (queue.length === 0) {\n return;\n }\n const node = queue.shift();\n queue.push(...node.childs);\n if (callback.call(context, node) !== false) {\n process();\n }\n }\n process();\n}\n\n/**\n * Default strategy for tree traversal.\n *\n * @type {string}\n */\nconst DEFAULT_TRAVERSAL_STRATEGY = TRAVERSAL_BF;\n/**\n * Collection of all available tree traversal strategies.\n *\n * @type {Map}\n */\nconst TRAVERSAL_STRATEGIES = new Map([[TRAVERSAL_DF_PRE, depthFirstPreOrder], [TRAVERSAL_DF_POST, depthFirstPostOrder], [TRAVERSAL_BF, breadthFirst]]);\n\n/**\n *\n */\nexport default class TreeNode {\n constructor(data) {\n /**\n * A tree data.\n *\n * @type {object}\n */\n _defineProperty(this, \"data\", {});\n /**\n * A parent node.\n *\n * @type {TreeNode}\n */\n _defineProperty(this, \"parent\", null);\n /**\n * A tree leaves.\n *\n * @type {TreeNode[]}\n */\n _defineProperty(this, \"childs\", []);\n this.data = data;\n }\n\n /**\n * Adds a node to tree leaves. Added node is linked with the parent node through \"parent\" property.\n *\n * @param {TreeNode} node A TreeNode to add.\n */\n addChild(node) {\n node.parent = this;\n this.childs.push(node);\n }\n\n /* eslint-disable jsdoc/require-description-complete-sentence */\n /**\n * @memberof TreeNode#\n * @function cloneTree\n *\n * Clones a tree structure deeply.\n *\n * For example, for giving a tree structure:\n * .--(B1)--.\n * .-(C1) .-(C2)-.----.\n * (D1) (D2) (D3) (D4)\n *\n * Cloning a tree starting from C2 node creates a mirrored tree structure.\n * .-(C2')-.-----.\n * (D2') (D3') (D4')\n *\n * The cloned tree can be safely modified without affecting the original structure.\n * After modification, the clone can be merged with a tree using the \"replaceTreeWith\" method.\n *\n * @param {TreeNode} [nodeTree=this] A TreeNode to clone.\n * @returns {TreeNode}\n */\n /* eslint-enable jsdoc/require-description-complete-sentence */\n cloneTree() {\n let nodeTree = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this;\n const clonedNode = new TreeNode({\n ...nodeTree.data\n });\n for (let i = 0; i < nodeTree.childs.length; i++) {\n clonedNode.addChild(this.cloneTree(nodeTree.childs[i]));\n }\n return clonedNode;\n }\n\n /**\n * Replaces the current node with a passed tree structure.\n *\n * @param {TreeNode} nodeTree A TreeNode to replace with.\n */\n replaceTreeWith(nodeTree) {\n this.data = {\n ...nodeTree.data\n };\n this.childs = [];\n for (let i = 0; i < nodeTree.childs.length; i++) {\n this.addChild(nodeTree.childs[i]);\n }\n }\n\n /**\n * Traverses the tree structure through node childs. The walk down traversing supports\n * a three different strategies.\n * - Depth-first pre-order strategy (https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR));\n * - Depth-first post-order strategy (https://en.wikipedia.org/wiki/Tree_traversal#Post-order_(NLR));\n * - Breadth-first traversal strategy (https://en.wikipedia.org/wiki/Tree_traversal#Breadth-first_search_/_level_order).\n *\n * @param {Function} callback The callback function which will be called for each node.\n * @param {string} [traversalStrategy=DEFAULT_TRAVERSAL_STRATEGY] Traversing strategy.\n */\n walkDown(callback) {\n let traversalStrategy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_TRAVERSAL_STRATEGY;\n if (!TRAVERSAL_STRATEGIES.has(traversalStrategy)) {\n throw new Error(`Traversal strategy \"${traversalStrategy}\" does not exist`);\n }\n TRAVERSAL_STRATEGIES.get(traversalStrategy).call(this, callback, this);\n }\n\n /**\n * Traverses the tree structure through node parents.\n *\n * @param {Function} callback The callback function which will be called for each node.\n */\n walkUp(callback) {\n const context = this;\n const process = node => {\n const continueTraverse = callback.call(context, node);\n if (continueTraverse !== false && node.parent !== null) {\n process(node.parent);\n }\n };\n process(this);\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { arrayEach } from \"../../../helpers/array.mjs\";\nimport TreeNode from \"../../../utils/dataStructures/tree.mjs\";\n/* eslint-disable jsdoc/require-description-complete-sentence */\n/**\n * @private\n * @class HeadersTree\n *\n * The header tree class keeps nested header settings in the tree\n * structure for easier node manipulation (e.q collapse or expand column).\n * That trees represent the current state of the nested headers. From the\n * trees, the matrix is generated for nested header renderers.\n *\n * The second role of the module is validation. While building the tree,\n * there is check whether the configuration contains overlapping\n * headers. If true, then the exception is thrown.\n *\n * The tree is static; it means that its column indexing never changes\n * even when a collapsing header is performed. The structure is based\n * on visual column indexes.\n *\n * For example, for that header configuration:\n * +----+----+----+----+----+\n * \u2502 A1 \u2502 A2 \u2502\n * +----+----+----+----+----+\n * \u2502 B1 \u2502 B2 \u2502 B3 \u2502\n * +----+----+----+----+----+\n * \u2502 C1 \u2502 C2 \u2502 C3 \u2502 C4 \u2502\n * +----+----+----+----+----+\n *\n * The tree structures look like:\n * (0) (4) // a visual column index\n * \u2502 \u2502\n * .------(A1)------. (A2)--.\n * .--(B1)--. (B2)--. (B3)--.\n * (C1) (C2) (C3) (C4)\n *\n */\n/* eslint-enable jsdoc/require-description-complete-sentence */\nvar _rootNodes = /*#__PURE__*/new WeakMap();\nvar _rootsIndex = /*#__PURE__*/new WeakMap();\nvar _sourceSettings = /*#__PURE__*/new WeakMap();\nexport default class HeadersTree {\n constructor(sourceSettings) {\n /**\n * The collection of nested headers settings structured into trees. The root trees are stored\n * under the visual column index.\n *\n * @private\n * @type {Map}\n */\n _classPrivateFieldInitSpec(this, _rootNodes, new Map());\n /**\n * A map that translates the visual column indexes that intersect the range\n * defined by the header colspan width to the root index.\n *\n * @private\n * @type {Map}\n */\n _classPrivateFieldInitSpec(this, _rootsIndex, new Map());\n /**\n * The instance of the SourceSettings class.\n *\n * @private\n * @type {SourceSettings}\n */\n _classPrivateFieldInitSpec(this, _sourceSettings, null);\n _classPrivateFieldSet(_sourceSettings, this, sourceSettings);\n }\n\n /**\n * Gets an array of the all root nodes.\n *\n * @returns {TreeNode[]}\n */\n getRoots() {\n return Array.from(_classPrivateFieldGet(_rootNodes, this).values());\n }\n\n /**\n * Gets a root node by specified visual column index.\n *\n * @param {number} columnIndex A visual column index.\n * @returns {TreeNode|undefined}\n */\n getRootByColumn(columnIndex) {\n let node;\n if (_classPrivateFieldGet(_rootsIndex, this).has(columnIndex)) {\n node = _classPrivateFieldGet(_rootNodes, this).get(_classPrivateFieldGet(_rootsIndex, this).get(columnIndex));\n }\n return node;\n }\n\n /**\n * Gets a tree node by its position in the grid settings.\n *\n * @param {number} headerLevel Header level index (there is support only for positive values).\n * @param {number} columnIndex A visual column index.\n * @returns {TreeNode|undefined}\n */\n getNode(headerLevel, columnIndex) {\n const rootNode = this.getRootByColumn(columnIndex);\n if (!rootNode) {\n return;\n }\n\n // Normalize the visual column index to a 0-based system for a specific \"box\" defined\n // by root node colspan width.\n const normColumnIndex = columnIndex - _classPrivateFieldGet(_rootsIndex, this).get(columnIndex);\n let columnCursor = 0;\n let treeNode;\n\n // Collect all parent nodes that depend on the collapsed node.\n rootNode.walkDown(node => {\n const {\n data: {\n origColspan,\n headerLevel: nodeHeaderLevel\n }\n } = node;\n if (headerLevel === nodeHeaderLevel) {\n if (normColumnIndex >= columnCursor && normColumnIndex <= columnCursor + origColspan - 1) {\n treeNode = node;\n treeNode.data.isRoot = columnIndex === treeNode.data.columnIndex;\n return false; // Cancel tree traversing.\n }\n columnCursor += origColspan;\n }\n });\n return treeNode;\n }\n\n /**\n * Builds (or rebuilds if called again) root nodes indexes.\n */\n rebuildTreeIndex() {\n let columnIndex = 0;\n _classPrivateFieldGet(_rootsIndex, this).clear();\n arrayEach(_classPrivateFieldGet(_rootNodes, this), _ref => {\n let [, {\n data: {\n colspan\n }\n }] = _ref;\n // Map tree range (colspan range/width) into visual column index of the root node.\n for (let i = columnIndex; i < columnIndex + colspan; i++) {\n _classPrivateFieldGet(_rootsIndex, this).set(i, columnIndex);\n }\n columnIndex += colspan;\n });\n }\n\n /**\n * Builds trees based on SourceSettings class. Calling a method causes clearing the tree state built\n * from the previous call.\n */\n buildTree() {\n this.clear();\n const columnsCount = _classPrivateFieldGet(_sourceSettings, this).getColumnsCount();\n let columnIndex = 0;\n while (columnIndex < columnsCount) {\n const columnSettings = _classPrivateFieldGet(_sourceSettings, this).getHeaderSettings(0, columnIndex);\n const rootNode = new TreeNode();\n _classPrivateFieldGet(_rootNodes, this).set(columnIndex, rootNode);\n this.buildLeaves(rootNode, columnIndex, 0, columnSettings.origColspan);\n columnIndex += columnSettings.origColspan;\n }\n this.rebuildTreeIndex();\n }\n\n /**\n * Builds leaves for specified tree node.\n *\n * @param {TreeNode} parentNode A node to which the leaves applies.\n * @param {number} columnIndex A visual column index.\n * @param {number} headerLevel Currently processed header level.\n * @param {number} [extractionLength=1] Determines column extraction length for node children.\n */\n buildLeaves(parentNode, columnIndex, headerLevel) {\n let extractionLength = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n const columnsSettings = _classPrivateFieldGet(_sourceSettings, this).getHeadersSettings(headerLevel, columnIndex, extractionLength);\n headerLevel += 1;\n arrayEach(columnsSettings, columnSettings => {\n const nodeData = {\n ...columnSettings,\n /**\n * The header level (tree node depth level).\n *\n * @type {number}\n */\n headerLevel: headerLevel - 1,\n /**\n * A visual column index.\n *\n * @type {number}\n */\n columnIndex\n };\n let node;\n if (headerLevel === 1) {\n // fill the root node\n parentNode.data = nodeData;\n node = parentNode;\n } else {\n node = new TreeNode(nodeData);\n parentNode.addChild(node);\n }\n if (headerLevel < _classPrivateFieldGet(_sourceSettings, this).getLayersCount()) {\n this.buildLeaves(node, columnIndex, headerLevel, columnSettings.origColspan);\n }\n columnIndex += columnSettings.origColspan;\n });\n }\n\n /**\n * Clears the tree to the initial state.\n */\n clear() {\n _classPrivateFieldGet(_rootNodes, this).clear();\n _classPrivateFieldGet(_rootsIndex, this).clear();\n }\n}", "/**\n * Traverses the tree nodes and calls a callback when no hidden node is found. The callback\n * is called with visual column index then.\n *\n * @param {TreeNode} node A tree node to traverse.\n * @param {Function} callback The callback function which will be called for each node.\n */\nexport function traverseHiddenNodeColumnIndexes(node, callback) {\n node.walkDown(_ref => {\n let {\n data,\n childs\n } = _ref;\n if (!data.isHidden) {\n callback(data.columnIndex);\n if (childs.length === 0) {\n for (let i = 1; i < data.colspan; i++) {\n callback(data.columnIndex + i);\n }\n }\n }\n });\n}\n\n/**\n * A tree helper for retrieving a data from the first child.\n *\n * @param {TreeNode} node A tree node to check.\n * @param {string} propertyName A name of the property whose value you want to get.\n * @returns {*}\n */\nexport function getFirstChildProperty(_ref2, propertyName) {\n let {\n childs\n } = _ref2;\n if (childs.length === 0) {\n return;\n }\n return childs[0].data[propertyName];\n}\n\n/**\n * A tree helper which checks if passed node has the same original colspan as its\n * first child. In that case the node is treated as \"mirrored\" or \"reflected\" every\n * action performed on one of that nodes should be reflected to other \"mirrored\" node.\n *\n * In that case nodes A1 and A2 are \"reflected\"\n * +----+----+----+----+\n * | A1 | B1 |\n * +----+----+----+----+\n * | A2 | B2 | B3 |\n * +----+----+----+----+.\n *\n * @param {TreeNode} node A tree node to check.\n * @returns {boolean}\n */\nexport function isNodeReflectsFirstChildColspan(node) {\n return getFirstChildProperty(node, 'origColspan') === node.data.origColspan;\n}", "import \"core-js/modules/es.set.difference.v2.js\";\nimport \"core-js/modules/es.set.intersection.v2.js\";\nimport \"core-js/modules/es.set.is-disjoint-from.v2.js\";\nimport \"core-js/modules/es.set.is-subset-of.v2.js\";\nimport \"core-js/modules/es.set.is-superset-of.v2.js\";\nimport \"core-js/modules/es.set.symmetric-difference.v2.js\";\nimport \"core-js/modules/es.set.union.v2.js\";\nimport { arrayEach } from \"../../../../helpers/array.mjs\";\nimport { collapseNode } from \"./collapse.mjs\";\nimport { getFirstChildProperty, isNodeReflectsFirstChildColspan, traverseHiddenNodeColumnIndexes } from \"./utils/tree.mjs\";\n/**\n * Expanding a node is a process where the processing node is expanded to\n * its original colspan width. To restore an original state of all node\n * children on the right, the modified nodes are replaced with the cloned\n * nodes (they were cloned while collapsing).\n *\n * @param {TreeNode} nodeToProcess A tree node to process.\n * @returns {object} Returns an object with properties:\n * - rollbackModification: The function that rollbacks\n * the tree to the previous state.\n * - affectedColumns: The list of the visual column\n * indexes which are affected. That list is passed\n * to the hiddens column logic.\n * - colspanCompensation: The number of colspan by\n * which the processed node colspan was increased.\n */\nexport function expandNode(nodeToProcess) {\n const {\n data: nodeData,\n childs: nodeChilds\n } = nodeToProcess;\n if (!nodeData.isCollapsed || nodeData.isHidden || nodeData.origColspan <= 1) {\n return {\n rollbackModification: () => {},\n affectedColumns: [],\n colspanCompensation: 0\n };\n }\n const isNodeReflected = isNodeReflectsFirstChildColspan(nodeToProcess);\n if (isNodeReflected) {\n return expandNode(nodeChilds[0]);\n }\n nodeData.isCollapsed = false;\n const allLeavesExceptMostLeft = nodeChilds.slice(1);\n const affectedColumns = new Set();\n let colspanCompensation = 0;\n if (allLeavesExceptMostLeft.length > 0) {\n arrayEach(allLeavesExceptMostLeft, node => {\n // Restore original state of the collapsed headers.\n node.replaceTreeWith(node.data.clonedTree);\n node.data.clonedTree = null;\n const leafData = node.data;\n\n // Calculate by how many colspan it needs to increase the headings to match them to\n // the colspan width of all its children.\n colspanCompensation += leafData.colspan;\n traverseHiddenNodeColumnIndexes(node, gridColumnIndex => {\n affectedColumns.add(gridColumnIndex);\n });\n });\n } else {\n const {\n colspan,\n origColspan,\n columnIndex\n } = nodeData;\n\n // In a case when the node doesn't have any children restore the colspan width to\n // its original state.\n colspanCompensation = origColspan - colspan;\n\n // Add column to \"affected\" started from 1. The header without children can not be\n // collapsed so the first column is already visible and we shouldn't touch it.\n for (let i = 1; i < origColspan; i++) {\n affectedColumns.add(columnIndex + i);\n }\n }\n nodeToProcess.walkUp(node => {\n const {\n data\n } = node;\n data.colspan += colspanCompensation;\n if (data.colspan >= data.origColspan) {\n data.colspan = data.origColspan;\n data.isCollapsed = false;\n } else if (isNodeReflectsFirstChildColspan(node)) {\n data.isCollapsed = getFirstChildProperty(node, 'isCollapsed');\n }\n });\n return {\n rollbackModification: () => collapseNode(nodeToProcess),\n affectedColumns: Array.from(affectedColumns),\n colspanCompensation\n };\n}", "import \"core-js/modules/es.set.difference.v2.js\";\nimport \"core-js/modules/es.set.intersection.v2.js\";\nimport \"core-js/modules/es.set.is-disjoint-from.v2.js\";\nimport \"core-js/modules/es.set.is-subset-of.v2.js\";\nimport \"core-js/modules/es.set.is-superset-of.v2.js\";\nimport \"core-js/modules/es.set.symmetric-difference.v2.js\";\nimport \"core-js/modules/es.set.union.v2.js\";\nimport { arrayEach } from \"../../../../helpers/array.mjs\";\nimport { expandNode } from \"./expand.mjs\";\nimport { getFirstChildProperty, isNodeReflectsFirstChildColspan, traverseHiddenNodeColumnIndexes } from \"./utils/tree.mjs\";\n/**\n * Collapsing a node is a process where the processing node is collapsed\n * to the colspan width of the first child. All node children, except the\n * first one, are hidden. To prevent losing a current state of node children\n * on the right, all nodes are cloned (and restored while expanding), and\n * only then original nodes are modified (hidden in this case).\n *\n * @param {TreeNode} nodeToProcess A tree node to process.\n * @returns {object} Returns an object with properties:\n * - rollbackModification: The function that rollbacks\n * the tree to the previous state.\n * - affectedColumns: The list of the visual column\n * indexes which are affected. That list is passed\n * to the hiddens column logic.\n * - colspanCompensation: The number of colspan by\n * which the processed node colspan was reduced.\n */\nexport function collapseNode(nodeToProcess) {\n var _getFirstChildPropert;\n const {\n data: nodeData,\n childs: nodeChilds\n } = nodeToProcess;\n if (nodeData.isCollapsed || nodeData.isHidden || nodeData.origColspan <= 1) {\n return {\n rollbackModification: () => {},\n affectedColumns: [],\n colspanCompensation: 0\n };\n }\n const isNodeReflected = isNodeReflectsFirstChildColspan(nodeToProcess);\n if (isNodeReflected) {\n return collapseNode(nodeChilds[0]);\n }\n nodeData.isCollapsed = true;\n const allLeavesExceptMostLeft = nodeChilds.slice(1);\n const affectedColumns = new Set();\n if (allLeavesExceptMostLeft.length > 0) {\n arrayEach(allLeavesExceptMostLeft, node => {\n traverseHiddenNodeColumnIndexes(node, gridColumnIndex => {\n affectedColumns.add(gridColumnIndex);\n });\n\n // Clone the tree to preserve original tree state after header expanding.\n node.data.clonedTree = node.cloneTree();\n\n // Hide all leaves except the first leaf on the left (on headers context hide all\n // headers on the right).\n node.walkDown(_ref => {\n let {\n data\n } = _ref;\n data.isHidden = true;\n });\n });\n } else {\n const {\n origColspan,\n columnIndex\n } = nodeData;\n\n // Add column to \"affected\" started from 1. The header without children can not be\n // collapsed so the first have to be visible (untouched).\n for (let i = 1; i < origColspan; i++) {\n const gridColumnIndex = columnIndex + i;\n affectedColumns.add(gridColumnIndex);\n }\n }\n\n // Calculate by how many colspan it needs to reduce the headings to match them to\n // the first child colspan width.\n const colspanCompensation = nodeData.colspan - ((_getFirstChildPropert = getFirstChildProperty(nodeToProcess, 'colspan')) !== null && _getFirstChildPropert !== void 0 ? _getFirstChildPropert : 1);\n nodeToProcess.walkUp(node => {\n const {\n data\n } = node;\n data.colspan -= colspanCompensation;\n if (data.colspan <= 1) {\n data.colspan = 1;\n data.isCollapsed = true;\n } else if (isNodeReflectsFirstChildColspan(node)) {\n data.isCollapsed = getFirstChildProperty(node, 'isCollapsed');\n }\n });\n return {\n rollbackModification: () => expandNode(nodeToProcess),\n affectedColumns: Array.from(affectedColumns),\n colspanCompensation\n };\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nimport { toSingleLine } from \"../../../../helpers/templateLiteralTag.mjs\";\n/**\n * @param {TreeNode} nodeToProcess A tree node to process.\n * @param {number} gridColumnIndex The visual column index that triggers the node modification.\n * The index can be between the root node column index and\n * column index plus node colspan length.\n */\nexport function hideColumn(nodeToProcess, gridColumnIndex) {\n if (!Number.isInteger(gridColumnIndex)) {\n throw new Error('The passed gridColumnIndex argument has invalid type.');\n }\n if (nodeToProcess.childs.length > 0) {\n throw new Error(toSingleLine`The passed node is not the last node on the tree. Only for\\x20\nthe last node, the hide column modification can be applied.`);\n }\n const {\n crossHiddenColumns\n } = nodeToProcess.data;\n if (crossHiddenColumns.includes(gridColumnIndex)) {\n return;\n }\n let isCollapsibleNode = false;\n nodeToProcess.walkUp(node => {\n const {\n data: {\n collapsible\n }\n } = node;\n if (collapsible) {\n isCollapsibleNode = true;\n return false; // Cancel tree traversing\n }\n });\n\n // TODO: When the node is collapsible do not hide the column. Currently collapsible headers\n // does not work with hidden columns (hidden index map types).\n if (isCollapsibleNode) {\n return;\n }\n nodeToProcess.walkUp(node => {\n const {\n data\n } = node;\n data.crossHiddenColumns.push(gridColumnIndex);\n if (data.colspan > 1) {\n data.colspan -= 1;\n } else {\n data.isHidden = true;\n }\n });\n}", "import \"core-js/modules/es.error.cause.js\";\nimport { toSingleLine } from \"../../../../helpers/templateLiteralTag.mjs\";\n/**\n * @param {TreeNode} nodeToProcess A tree node to process.\n * @param {number} gridColumnIndex The visual column index that triggers the node modification.\n * The index can be between the root node column index and\n * column index plus node colspan length.\n */\nexport function showColumn(nodeToProcess, gridColumnIndex) {\n if (!Number.isInteger(gridColumnIndex)) {\n throw new Error('The passed gridColumnIndex argument has invalid type.');\n }\n if (nodeToProcess.childs.length > 0) {\n throw new Error(toSingleLine`The passed node is not the last node on the tree. Only for\\x20\nthe last node, the show column modification can be applied.`);\n }\n const {\n crossHiddenColumns\n } = nodeToProcess.data;\n if (!crossHiddenColumns.includes(gridColumnIndex)) {\n return;\n }\n let isCollapsibleNode = false;\n nodeToProcess.walkUp(node => {\n const {\n data: {\n collapsible\n }\n } = node;\n if (collapsible) {\n isCollapsibleNode = true;\n return false; // Cancel tree traversing\n }\n });\n\n // TODO: When the node is collapsible do not show the column. Currently collapsible headers\n // does not work with hidden columns (hidden index map types).\n if (isCollapsibleNode) {\n return;\n }\n nodeToProcess.walkUp(node => {\n const {\n data\n } = node;\n data.crossHiddenColumns.splice(data.crossHiddenColumns.indexOf(gridColumnIndex), 1);\n if (!data.isHidden && data.colspan < data.origColspan) {\n data.colspan += 1;\n }\n data.isHidden = false;\n });\n}", "import \"core-js/modules/es.error.cause.js\";\n/**\n * The NodeModifiers module is responsible for the modification of a tree structure\n * in a way to achieve new column headers state.\n */\nimport { collapseNode } from \"./collapse.mjs\";\nimport { expandNode } from \"./expand.mjs\";\nimport { hideColumn } from \"./hideColumn.mjs\";\nimport { showColumn } from \"./showColumn.mjs\";\nconst availableModifiers = new Map([['collapse', collapseNode], ['expand', expandNode], ['hide-column', hideColumn], ['show-column', showColumn]]);\n\n/**\n * An entry point for triggering a node modifiers. If the triggered action\n * does not exist the exception is thrown.\n *\n * @param {string} actionName An action name to trigger.\n * @param {TreeNode} nodeToProcess A tree node to process.\n * @param {number} gridColumnIndex The visual column index that comes from the nested headers grid.\n * The index, as opposed to the `columnIndex` in the tree node\n * (which describes the column index of the root node of the header\n * element), describes the index passed from the grid. Hence, the\n * index can be between the column index of the node and its colspan\n * width.\n * @returns {object}\n */\nexport function triggerNodeModification(actionName, nodeToProcess, gridColumnIndex) {\n if (!availableModifiers.has(actionName)) {\n throw new Error(`The node modifier action (\"${actionName}\") does not exist.`);\n }\n return availableModifiers.get(actionName)(nodeToProcess, gridColumnIndex);\n}", "import \"core-js/modules/es.array.push.js\";\n/* eslint-disable jsdoc/require-description-complete-sentence */\nimport { arrayEach } from \"../../../helpers/array.mjs\";\nimport { createDefaultHeaderSettings, createPlaceholderHeaderSettings } from \"./utils.mjs\";\n/**\n * A function that dump a tree structure into multidimensional array. That structure is\n * later processed by header renderers to modify TH elements to achieve a proper\n * DOM structure.\n *\n * That structure contains settings object for every TH element generated by Walkontable.\n * The matrix operates on visual column index.\n *\n * Output example:\n * [\n * [\n * { label: 'A1', colspan: 2, origColspan: 2, isHidden: false, ... },\n * { label: '', colspan: 1, origColspan: 1, isHidden: true, ... },\n * { label: '', colspan: 1, origColspan: 1, isHidden: false, ... },\n * ],\n * [\n * { label: 'true', colspan: 1, origColspan: 1, isHidden: false, ... },\n * { label: 'B2', colspan: 1, origColspan: 1, isHidden: false, ... },\n * { label: '4', colspan: 1, origColspan: 1, isHidden: false, ... },\n * ],\n * [\n * { label: '', colspan: 1, origColspan: 1, isHidden: false, ... },\n * { label: '', colspan: 1, origColspan: 1, isHidden: false, ... },\n * { label: '', colspan: 1, origColspan: 1, isHidden: false, ... },\n * ],\n * ]\n *\n * @param {TreeNode[]} headerRoots An array of root nodes.\n * @returns {Array[]}\n */\nexport function generateMatrix(headerRoots) {\n const matrix = [];\n arrayEach(headerRoots, rootNode => {\n rootNode.walkDown(node => {\n const nodeData = node.data;\n const {\n origColspan,\n columnIndex,\n headerLevel,\n crossHiddenColumns\n } = nodeData;\n const colspanHeaderLayer = createNestedArrayIfNecessary(matrix, headerLevel);\n let isRootSettingsFound = false;\n for (let i = columnIndex; i < columnIndex + origColspan; i++) {\n const isColumnHidden = crossHiddenColumns.includes(i);\n if (isColumnHidden || isRootSettingsFound) {\n colspanHeaderLayer.push(createPlaceholderHeaderSettings(nodeData));\n } else {\n const headerRootSettings = createHeaderSettings(nodeData);\n headerRootSettings.isRoot = true;\n colspanHeaderLayer.push(headerRootSettings);\n isRootSettingsFound = true;\n }\n }\n });\n });\n return matrix;\n}\n\n/**\n * Creates header settings object.\n *\n * @param {object} nodeData The tree data object.\n * @returns {object}\n */\nfunction createHeaderSettings(nodeData) {\n // For the matrix module we do not need to export \"crossHiddenColumns\" key. It's redundant here.\n const {\n crossHiddenColumns,\n ...headerRootSettings\n } = createDefaultHeaderSettings(nodeData);\n return headerRootSettings;\n}\n\n/**\n * Internal helper which ensures that subarray exists under specified index.\n *\n * @param {Array[]} array An array to check.\n * @param {number} index An array index under the subarray should be checked.\n * @returns {Array}\n */\nfunction createNestedArrayIfNecessary(array, index) {\n let subArray;\n if (Array.isArray(array[index])) {\n subArray = array[index];\n } else {\n subArray = [];\n array[index] = subArray;\n }\n return subArray;\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { arrayMap, arrayReduce } from \"../../../helpers/array.mjs\";\nimport SourceSettings from \"./sourceSettings.mjs\";\nimport HeadersTree from \"./headersTree.mjs\";\nimport { triggerNodeModification } from \"./nodeModifiers/index.mjs\";\nimport { generateMatrix } from \"./matrixGenerator.mjs\";\nimport { TRAVERSAL_DF_PRE } from \"../../../utils/dataStructures/tree.mjs\";\n/**\n * The state manager is a source of truth for nested headers configuration.\n * The state generation process is divided into three stages.\n *\n * +---------------------+ 1. User-defined configuration normalization;\n * \u2502 \u2502 The source settings class normalizes and shares API for\n * \u2502 SourceSettings \u2502 raw settings passed by the developer. It is only consumed by\n * \u2502 \u2502 the header tree module.\n * +---------------------+\n * \u2502\n * \\\u2502/\n * +---------------------+ 2. Building a tree structure for validation and easier node manipulation;\n * \u2502 \u2502 The header tree generates a tree based on source settings for future\n * \u2502 HeadersTree \u2502 node manipulation (such as collapsible columns feature). While generating a tree\n * \u2502 \u2502 the source settings is checked to see if the configuration has overlapping headers.\n * +---------------------+ If `true` the colspan matrix generation is skipped, overlapped headers are not supported.\n * \u2502\n * \\\u2502/\n * +---------------------+ 3. Matrix generation;\n * \u2502 \u2502 Based on built trees the matrix generation is performed. That part of code\n * \u2502 matrix generation \u2502 generates an array structure similar to normalized data from the SourceSettings\n * \u2502 \u2502 but with the difference that this structure contains column settings which changed\n * +---------------------+ during runtime (after the tree manipulation) e.q after collapse or expand column.\n * That settings describes how the TH element should be modified (colspan attribute,\n * CSS classes, etc) for a specific column and layer level.\n *\n * @class StateManager\n */\nvar _sourceSettings = /*#__PURE__*/new WeakMap();\nvar _headersTree = /*#__PURE__*/new WeakMap();\nvar _stateMatrix = /*#__PURE__*/new WeakMap();\nexport default class StateManager {\n constructor() {\n /**\n * The instance of the source settings class.\n *\n * @private\n * @type {SourceSettings}\n */\n _classPrivateFieldInitSpec(this, _sourceSettings, new SourceSettings());\n /**\n * The instance of the headers tree. The tree is generated after setting new configuration data.\n *\n * @private\n * @type {HeadersTree}\n */\n _classPrivateFieldInitSpec(this, _headersTree, new HeadersTree(_classPrivateFieldGet(_sourceSettings, this)));\n /**\n * Cached matrix which is generated from the tree structure.\n *\n * @private\n * @type {Array[]}\n */\n _classPrivateFieldInitSpec(this, _stateMatrix, [[]]);\n }\n /**\n * Sets a new state for the nested headers plugin based on settings passed\n * directly to the plugin.\n *\n * @param {Array[]} nestedHeadersSettings The user-defined settings.\n * @returns {boolean} Returns `true` if the settings are processed correctly, `false` otherwise.\n */\n setState(nestedHeadersSettings) {\n _classPrivateFieldGet(_sourceSettings, this).setData(nestedHeadersSettings);\n let hasError = false;\n try {\n _classPrivateFieldGet(_headersTree, this).buildTree();\n } catch (ex) {\n _classPrivateFieldGet(_headersTree, this).clear();\n _classPrivateFieldGet(_sourceSettings, this).clear();\n hasError = true;\n }\n _classPrivateFieldSet(_stateMatrix, this, generateMatrix(_classPrivateFieldGet(_headersTree, this).getRoots()));\n return hasError;\n }\n\n /**\n * Sets columns limit to the state will be trimmed. All headers (colspans) which\n * overlap the column limit will be reduced to keep the structure solid.\n *\n * @param {number} columnsCount The number of columns to limit to.\n */\n setColumnsLimit(columnsCount) {\n _classPrivateFieldGet(_sourceSettings, this).setColumnsLimit(columnsCount);\n }\n\n /**\n * Merges settings with current plugin state.\n *\n * By default only foreign keys are merged with source state and passed to the tree. But only\n * known keys are exported to matrix.\n *\n * @param {object[]} settings An array of objects to merge with the current source settings.\n * It is a requirement that every object has `row` and `col` properties\n * which points to the specific header settings object.\n */\n mergeStateWith(settings) {\n const transformedSettings = arrayMap(settings, _ref => {\n let {\n row,\n ...rest\n } = _ref;\n return {\n row: row < 0 ? this.rowCoordsToLevel(row) : row,\n ...rest\n };\n });\n _classPrivateFieldGet(_sourceSettings, this).mergeWith(transformedSettings);\n _classPrivateFieldGet(_headersTree, this).buildTree();\n _classPrivateFieldSet(_stateMatrix, this, generateMatrix(_classPrivateFieldGet(_headersTree, this).getRoots()));\n }\n\n /**\n * Maps the current state with a callback. For each header settings the callback function\n * is called. If the function returns value that value is merged with the state.\n *\n * By default only foreign keys are merged with source state and passed to the tree. But only\n * known keys are exported to matrix.\n *\n * @param {Function} callback A function that is called for every header source settings.\n * Each time the callback is called, the returned value extends\n * header settings.\n */\n mapState(callback) {\n _classPrivateFieldGet(_sourceSettings, this).map(callback);\n _classPrivateFieldGet(_headersTree, this).buildTree();\n _classPrivateFieldSet(_stateMatrix, this, generateMatrix(_classPrivateFieldGet(_headersTree, this).getRoots()));\n }\n\n /**\n * Maps the current tree nodes with a callback. For each node the callback function\n * is called. If the function returns value that value is added to returned array.\n *\n * @param {Function} callback A function that is called for every tree node.\n * Each time the callback is called, the returned value is\n * added to returned array.\n * @returns {Array}\n */\n mapNodes(callback) {\n return arrayReduce(_classPrivateFieldGet(_headersTree, this).getRoots(), (acc, rootNode) => {\n rootNode.walkDown(node => {\n const result = callback(node.data);\n if (result !== undefined) {\n acc.push(result);\n }\n });\n return acc;\n }, []);\n }\n\n /**\n * Triggers an action (e.g. \"collapse\") from the NodeModifiers module. The module\n * modifies a tree structure in such a way as to obtain the correct structure consistent with the\n * called action.\n *\n * @param {string} action An action name to trigger.\n * @param {number} headerLevel Header level index (there is support for negative and positive values).\n * @param {number} columnIndex A visual column index.\n * @returns {object|undefined}\n */\n triggerNodeModification(action, headerLevel, columnIndex) {\n if (headerLevel < 0) {\n headerLevel = this.rowCoordsToLevel(headerLevel);\n }\n const nodeToProcess = _classPrivateFieldGet(_headersTree, this).getNode(headerLevel, columnIndex);\n let actionResult;\n if (nodeToProcess) {\n actionResult = triggerNodeModification(action, nodeToProcess, columnIndex);\n\n // TODO (perf-tip): Trigger matrix generation once after multiple node modifications.\n _classPrivateFieldSet(_stateMatrix, this, generateMatrix(_classPrivateFieldGet(_headersTree, this).getRoots()));\n }\n return actionResult;\n }\n\n /**\n * Triggers an action (e.g. \"hide-column\") from the NodeModifiers module. The action is\n * triggered starting from the lowest header. The module modifies a tree structure in\n * such a way as to obtain the correct structure consistent with the called action.\n *\n * @param {string} action An action name to trigger.\n * @param {number} columnIndex A visual column index.\n * @returns {object|undefined}\n */\n triggerColumnModification(action, columnIndex) {\n return this.triggerNodeModification(action, -1, columnIndex);\n }\n\n /* eslint-disable jsdoc/require-description-complete-sentence */\n /**\n * @memberof StateManager#\n * @function rowCoordsToLevel\n *\n * Translates row coordinates into header level. The row coordinates counts from -1 to -N\n * and describes headers counting from most closest to most distant from the table.\n * The header levels are counted from 0 to N where 0 describes most distant header\n * from the table.\n *\n * Row coords Header level\n * +--------------+\n * -3 \u2502 A1 \u2502 A1 \u2502 0\n * +--------------+\n * -2 \u2502 B1 \u2502 B2 \u2502 B3 \u2502 1\n * +--------------+\n * -1 \u2502 C1 \u2502 C2 \u2502 C3 \u2502 2\n * +==============+\n * \u2502 \u2502 \u2502 \u2502\n * +--------------+\n * \u2502 \u2502 \u2502 \u2502\n *\n * @param {number} rowIndex A visual row index.\n * @returns {number|null} Returns unsigned number.\n */\n /* eslint-enable jsdoc/require-description-complete-sentence */\n rowCoordsToLevel(rowIndex) {\n if (rowIndex >= 0) {\n return null;\n }\n const headerLevel = rowIndex + Math.max(this.getLayersCount(), 1);\n if (headerLevel < 0) {\n return null;\n }\n return headerLevel;\n }\n\n /* eslint-disable jsdoc/require-description-complete-sentence */\n /**\n * @memberof StateManager#\n * @function levelToRowCoords\n *\n * Translates header level into row coordinates. The row coordinates counts from -1 to -N\n * and describes headers counting from most closest to most distant from the table.\n * The header levels are counted from 0 to N where 0 describes most distant header\n * from the table.\n *\n * Header level Row coords\n * +--------------+\n * 0 \u2502 A1 \u2502 A1 \u2502 -3\n * +--------------+\n * 1 \u2502 B1 \u2502 B2 \u2502 B3 \u2502 -2\n * +--------------+\n * 2 \u2502 C1 \u2502 C2 \u2502 C3 \u2502 -1\n * +==============+\n * \u2502 \u2502 \u2502 \u2502\n * +--------------+\n * \u2502 \u2502 \u2502 \u2502\n *\n * @param {number} headerLevel Header level index.\n * @returns {number} Returns negative number.\n */\n /* eslint-enable jsdoc/require-description-complete-sentence */\n levelToRowCoords(headerLevel) {\n if (headerLevel < 0) {\n return null;\n }\n const rowIndex = headerLevel - Math.max(this.getLayersCount(), 1);\n if (rowIndex >= 0) {\n return null;\n }\n return rowIndex;\n }\n\n /**\n * Gets column header settings for a specified column and header index. The returned object contains\n * all information necessary for header renderers. It contains header label, colspan length, or hidden\n * flag.\n *\n * @param {number} headerLevel Header level (there is support for negative and positive values).\n * @param {number} columnIndex A visual column index.\n * @returns {object|null}\n */\n getHeaderSettings(headerLevel, columnIndex) {\n var _classPrivateFieldGet2, _classPrivateFieldGet3;\n if (headerLevel < 0) {\n headerLevel = this.rowCoordsToLevel(headerLevel);\n }\n if (headerLevel === null || headerLevel >= this.getLayersCount()) {\n return null;\n }\n return (_classPrivateFieldGet2 = (_classPrivateFieldGet3 = _classPrivateFieldGet(_stateMatrix, this)[headerLevel]) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3[columnIndex]) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : null;\n }\n\n /**\n * Gets tree data that is connected to the column header. The returned object contains all information\n * necessary for modifying tree structure (column collapsing, hiding, etc.). It contains a header\n * label, colspan length, or visual column index that indicates which column index the node is rendered from.\n *\n * @param {number} headerLevel Header level (there is support for negative and positive values).\n * @param {number} columnIndex A visual column index.\n * @returns {object|null}\n */\n getHeaderTreeNodeData(headerLevel, columnIndex) {\n const node = this.getHeaderTreeNode(headerLevel, columnIndex);\n if (!node) {\n return null;\n }\n return {\n ...node.data\n };\n }\n\n /**\n * Gets tree node that is connected to the column header.\n *\n * @param {number} headerLevel Header level (there is support for negative and positive values).\n * @param {number} columnIndex A visual column index.\n * @returns {TreeNode|null}\n */\n getHeaderTreeNode(headerLevel, columnIndex) {\n if (headerLevel < 0) {\n headerLevel = this.rowCoordsToLevel(headerLevel);\n }\n if (headerLevel === null || headerLevel >= this.getLayersCount()) {\n return null;\n }\n const node = _classPrivateFieldGet(_headersTree, this).getNode(headerLevel, columnIndex);\n if (!node) {\n return null;\n }\n return node;\n }\n\n /**\n * Finds the most top header level of the column header that is rendered entirely within\n * the passed visual columns range. If multiple columns headers are found within the range the\n * most top header level value will be returned.\n *\n * @param {number} columnIndexFrom A visual column index.\n * @param {number} [columnIndexTo] A visual column index.\n * @returns {number} Returns a header level in format -1 to -N.\n */\n findTopMostEntireHeaderLevel(columnIndexFrom) {\n var _headerLevel;\n let columnIndexTo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : columnIndexFrom;\n const columnsWidth = columnIndexTo - columnIndexFrom + 1;\n let atLeastOneRootFound = false;\n let headerLevel = null;\n for (let columnIndex = columnIndexFrom; columnIndex <= columnIndexTo; columnIndex++) {\n const rootNode = _classPrivateFieldGet(_headersTree, this).getRootByColumn(columnIndex);\n if (!rootNode) {\n break;\n }\n atLeastOneRootFound = true;\n\n // eslint-disable-next-line\n rootNode.walkDown(node => {\n const {\n columnIndex: nodeColumnIndex,\n headerLevel: nodeHeaderLevel,\n origColspan,\n isHidden\n } = node.data;\n if (isHidden) {\n return;\n }\n\n // if the header fits entirely within the columns range get and save the node header level\n if (origColspan <= columnsWidth && nodeColumnIndex >= columnIndexFrom && nodeColumnIndex + origColspan - 1 <= columnIndexTo && (headerLevel === null || nodeHeaderLevel < headerLevel)) {\n headerLevel = nodeHeaderLevel;\n }\n }, TRAVERSAL_DF_PRE);\n }\n if (atLeastOneRootFound && headerLevel === null) {\n return -1;\n }\n return this.levelToRowCoords((_headerLevel = headerLevel) !== null && _headerLevel !== void 0 ? _headerLevel : 0);\n }\n\n /**\n * The method is helpful in cases where the column index targets in-between currently\n * collapsed column. In that case, the method returns the left-most column index\n * where the nested header begins.\n *\n * @param {number} headerLevel Header level (there is support for negative and positive values).\n * @param {number} columnIndex A visual column index.\n * @returns {number}\n */\n findLeftMostColumnIndex(headerLevel, columnIndex) {\n var _this$getHeaderSettin;\n const {\n isRoot\n } = (_this$getHeaderSettin = this.getHeaderSettings(headerLevel, columnIndex)) !== null && _this$getHeaderSettin !== void 0 ? _this$getHeaderSettin : {\n isRoot: true\n };\n if (isRoot) {\n return columnIndex;\n }\n let stepBackColumn = columnIndex - 1;\n while (stepBackColumn >= 0) {\n var _this$getHeaderSettin2;\n const {\n isRoot: isRootNode\n } = (_this$getHeaderSettin2 = this.getHeaderSettings(headerLevel, stepBackColumn)) !== null && _this$getHeaderSettin2 !== void 0 ? _this$getHeaderSettin2 : {\n isRoot: true\n };\n if (isRootNode) {\n break;\n }\n stepBackColumn -= 1;\n }\n return stepBackColumn;\n }\n\n /**\n * The method is helpful in cases where the column index targets in-between currently\n * collapsed column. In that case, the method returns the right-most column index\n * where the nested header ends.\n *\n * @param {number} headerLevel Header level (there is support for negative and positive values).\n * @param {number} columnIndex A visual column index.\n * @returns {number}\n */\n findRightMostColumnIndex(headerLevel, columnIndex) {\n var _this$getHeaderSettin3;\n const {\n isRoot,\n origColspan\n } = (_this$getHeaderSettin3 = this.getHeaderSettings(headerLevel, columnIndex)) !== null && _this$getHeaderSettin3 !== void 0 ? _this$getHeaderSettin3 : {\n isRoot: true,\n origColspan: 1\n };\n if (isRoot) {\n return columnIndex + origColspan - 1;\n }\n let stepForthColumn = columnIndex + 1;\n while (stepForthColumn < this.getColumnsCount()) {\n var _this$getHeaderSettin4;\n const {\n isRoot: isRootNode\n } = (_this$getHeaderSettin4 = this.getHeaderSettings(headerLevel, stepForthColumn)) !== null && _this$getHeaderSettin4 !== void 0 ? _this$getHeaderSettin4 : {\n isRoot: true\n };\n if (isRootNode) {\n break;\n }\n stepForthColumn += 1;\n }\n return stepForthColumn - 1;\n }\n\n /**\n * Gets a total number of headers levels.\n *\n * @returns {number}\n */\n getLayersCount() {\n return _classPrivateFieldGet(_sourceSettings, this).getLayersCount();\n }\n\n /**\n * Gets a total number of columns count.\n *\n * @returns {number}\n */\n getColumnsCount() {\n return _classPrivateFieldGet(_sourceSettings, this).getColumnsCount();\n }\n\n /**\n * Clears the column state manager to the initial state.\n */\n clear() {\n _classPrivateFieldSet(_stateMatrix, this, []);\n _classPrivateFieldGet(_sourceSettings, this).clear();\n _classPrivateFieldGet(_headersTree, this).clear();\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { fastInnerHTML } from \"../../../helpers/dom/element.mjs\";\n/**\n * The class generates the nested headers structure in the DOM and reads the column width for\n * each column. The hierarchy is built only for visible, non-hidden columns. Each time the\n * column is shown or hidden, the structure is rebuilt, and the width of the columns in the\n * map updated.\n *\n * @private\n */\nclass GhostTable {\n constructor(hot, nestedHeaderSettingsGetter) {\n /**\n * Reference to the Handsontable instance.\n *\n * @private\n * @type {Handsontable}\n */\n _defineProperty(this, \"hot\", void 0);\n /**\n * The function for retrieving the nested headers settings.\n *\n * @private\n * @type {Function}\n */\n _defineProperty(this, \"nestedHeaderSettingsGetter\", void 0);\n /**\n * The value that holds information about the number of the nested header layers (header rows).\n *\n * @private\n * @type {number}\n */\n _defineProperty(this, \"layersCount\", 0);\n /**\n * Temporary element created to get minimal headers widths.\n *\n * @private\n * @type {*}\n */\n _defineProperty(this, \"container\", void 0);\n /**\n * PhysicalIndexToValueMap to keep and track of the columns' widths.\n *\n * @private\n * @type {PhysicalIndexToValueMap}\n */\n _defineProperty(this, \"widthsMap\", void 0);\n this.hot = hot;\n this.nestedHeaderSettingsGetter = nestedHeaderSettingsGetter;\n this.widthsMap = this.hot.columnIndexMapper.createAndRegisterIndexMap('nestedHeaders.widthsMap', 'physicalIndexToValue');\n }\n\n /**\n * Sets the number of nested headers layers count.\n *\n * @param {number} layersCount Total number of headers levels.\n * @returns {GhostTable}\n */\n setLayersCount(layersCount) {\n this.layersCount = layersCount;\n return this;\n }\n\n /**\n * Gets the column width based on the visual column index.\n *\n * @param {number} visualColumn Visual column index.\n * @returns {number|null}\n */\n getWidth(visualColumn) {\n return this.widthsMap.getValueAtIndex(this.hot.toPhysicalColumn(visualColumn));\n }\n\n /**\n * Build cache of the headers widths.\n */\n buildWidthsMap() {\n this.container = this.hot.rootDocument.createElement('div');\n this.container.classList.add('handsontable', 'htGhostTable', 'htAutoSize');\n this._buildGhostTable(this.container);\n this.hot.rootDocument.body.appendChild(this.container);\n const columns = this.container.querySelectorAll('tr:last-of-type th');\n const maxColumns = columns.length;\n this.widthsMap.clear();\n for (let column = 0; column < maxColumns; column++) {\n const visualColumnsIndex = this.hot.columnIndexMapper.getVisualFromRenderableIndex(column);\n const physicalColumnIndex = this.hot.toPhysicalColumn(visualColumnsIndex);\n this.widthsMap.setValueAtIndex(physicalColumnIndex, columns[column].offsetWidth);\n }\n this.container.parentNode.removeChild(this.container);\n this.container = null;\n }\n\n /**\n * Build temporary table for getting minimal columns widths.\n *\n * @private\n * @param {HTMLElement} container The element where the DOM nodes are injected.\n */\n _buildGhostTable(container) {\n const {\n rootDocument,\n columnIndexMapper\n } = this.hot;\n const fragment = rootDocument.createDocumentFragment();\n const table = rootDocument.createElement('table');\n const isDropdownEnabled = !!this.hot.getSettings().dropdownMenu;\n const maxRenderedCols = columnIndexMapper.getRenderableIndexesLength();\n for (let row = 0; row < this.layersCount; row++) {\n const tr = rootDocument.createElement('tr');\n for (let col = 0; col < maxRenderedCols; col++) {\n let visualColumnsIndex = columnIndexMapper.getVisualFromRenderableIndex(col);\n if (visualColumnsIndex === null) {\n visualColumnsIndex = col;\n }\n const th = rootDocument.createElement('th');\n const headerSettings = this.nestedHeaderSettingsGetter(row, visualColumnsIndex);\n if (headerSettings && (!headerSettings.isPlaceholder || headerSettings.isHidden)) {\n let label = headerSettings.label;\n if (isDropdownEnabled) {\n label += '';\n }\n fastInnerHTML(th, label);\n th.colSpan = headerSettings.colspan;\n tr.appendChild(th);\n }\n }\n table.appendChild(tr);\n }\n fragment.appendChild(table);\n container.appendChild(fragment);\n }\n\n /**\n * Clear the widths cache.\n */\n clear() {\n this.widthsMap.clear();\n this.container = null;\n }\n}\nexport default GhostTable;", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { addClass, removeClass } from \"../../helpers/dom/element.mjs\";\nimport { isNumeric, clamp } from \"../../helpers/number.mjs\";\nimport { toSingleLine } from \"../../helpers/templateLiteralTag.mjs\";\nimport { isLeftClick, isRightClick, isTouchEvent } from \"../../helpers/dom/event.mjs\";\nimport { warn } from \"../../helpers/console.mjs\";\nimport { ACTIVE_HEADER_TYPE, HEADER_TYPE } from \"../../selection/index.mjs\";\nimport { BasePlugin } from \"../base/index.mjs\";\nimport StateManager from \"./stateManager/index.mjs\";\nimport GhostTable from \"./utils/ghostTable.mjs\";\nexport const PLUGIN_KEY = 'nestedHeaders';\nexport const PLUGIN_PRIORITY = 280;\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @plugin NestedHeaders\n * @class NestedHeaders\n *\n * @description\n * The plugin allows to create a nested header structure, using the HTML's colspan attribute.\n *\n * To make any header wider (covering multiple table columns), it's corresponding configuration array element should be\n * provided as an object with `label` and `colspan` properties. The `label` property defines the header's label,\n * while the `colspan` property defines a number of columns that the header should cover.\n * You can also set custom class names to any of the headers by providing the `headerClassName` property.\n *\n * __Note__ that the plugin supports a *nested* structure, which means, any header cannot be wider than it's \"parent\". In\n * other words, headers cannot overlap each other.\n * @example\n *\n * ::: only-for javascript\n * ```js\n * const container = document.getElementById('example');\n * const hot = new Handsontable(container, {\n * data: getData(),\n * nestedHeaders: [\n * ['A', {label: 'B', colspan: 8, headerClassName: 'htRight'}, 'C'],\n * ['D', {label: 'E', colspan: 4}, {label: 'F', colspan: 4}, 'G'],\n * ['H', {label: 'I', colspan: 2}, {label: 'J', colspan: 2}, {label: 'K', colspan: 2}, {label: 'L', colspan: 2}, 'M'],\n * ['N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W']\n * ],\n * ```\n * :::\n *\n * ::: only-for react\n * ```jsx\n * \n * ```\n * :::\n */\nvar _stateManager = /*#__PURE__*/new WeakMap();\nvar _hidingIndexMapObserver = /*#__PURE__*/new WeakMap();\nvar _focusInitialCoords = /*#__PURE__*/new WeakMap();\nvar _isColumnsSelectionInProgress = /*#__PURE__*/new WeakMap();\nvar _NestedHeaders_brand = /*#__PURE__*/new WeakSet();\nexport class NestedHeaders extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * Updates the selection focus highlight position to point to the nested header root element (TH)\n * even when the logical coordinates point in-between the header.\n */\n _classPrivateMethodInitSpec(this, _NestedHeaders_brand);\n /**\n * The state manager for the nested headers.\n *\n * @type {StateManager}\n */\n _classPrivateFieldInitSpec(this, _stateManager, new StateManager());\n /**\n * The instance of the ChangesObservable class that allows track the changes that happens in the\n * column indexes.\n *\n * @type {ChangesObservable}\n */\n _classPrivateFieldInitSpec(this, _hidingIndexMapObserver, null);\n /**\n * Holds the coords that points to the place where the column selection starts.\n *\n * @type {number|null}\n */\n _classPrivateFieldInitSpec(this, _focusInitialCoords, null);\n /**\n * Determines if there is performed the column selection.\n *\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _isColumnsSelectionInProgress, false);\n /**\n * Custom helper for getting widths of the nested headers.\n *\n * @private\n * @type {GhostTable}\n */\n // @TODO This should be changed after refactor handsontable/utils/ghostTable.\n _defineProperty(this, \"ghostTable\", new GhostTable(this.hot, (row, column) => this.getHeaderSettings(row, column)));\n /**\n * The flag which determines that the nested header settings contains overlapping headers\n * configuration.\n *\n * @type {boolean}\n */\n _defineProperty(this, \"detectedOverlappedHeaders\", false);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Check if plugin is enabled.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n var _this = this;\n if (this.enabled) {\n return;\n }\n const {\n nestedHeaders\n } = this.hot.getSettings();\n if (!Array.isArray(nestedHeaders) || !Array.isArray(nestedHeaders[0])) {\n warn(toSingleLine`Your Nested Headers plugin configuration is invalid. The settings has to be\\x20\n passed as an array of arrays e.q. [['A1', { label: 'A2', colspan: 2 }]]`);\n }\n this.addHook('init', () => _assertClassBrand(_NestedHeaders_brand, this, _onInit).call(this));\n this.addHook('afterLoadData', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onAfterLoadData).call(_this, ...args);\n });\n this.addHook('beforeOnCellMouseDown', function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onBeforeOnCellMouseDown).call(_this, ...args);\n });\n this.addHook('afterOnCellMouseDown', function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onAfterOnCellMouseDown).call(_this, ...args);\n });\n this.addHook('beforeOnCellMouseOver', function () {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onBeforeOnCellMouseOver).call(_this, ...args);\n });\n this.addHook('beforeOnCellMouseUp', function () {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onBeforeOnCellMouseUp).call(_this, ...args);\n });\n this.addHook('beforeSelectionHighlightSet', function () {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onBeforeSelectionHighlightSet).call(_this, ...args);\n });\n this.addHook('modifyTransformStart', function () {\n for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {\n args[_key7] = arguments[_key7];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onModifyTransformStart).call(_this, ...args);\n });\n this.addHook('afterSelection', () => _assertClassBrand(_NestedHeaders_brand, this, _updateFocusHighlightPosition).call(this));\n this.addHook('afterSelectionFocusSet', () => _assertClassBrand(_NestedHeaders_brand, this, _updateFocusHighlightPosition).call(this));\n this.addHook('beforeViewportScrollHorizontally', function () {\n for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {\n args[_key8] = arguments[_key8];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onBeforeViewportScrollHorizontally).call(_this, ...args);\n });\n this.addHook('afterGetColumnHeaderRenderers', array => _assertClassBrand(_NestedHeaders_brand, this, _onAfterGetColumnHeaderRenderers).call(this, array));\n this.addHook('modifyColWidth', function () {\n for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {\n args[_key9] = arguments[_key9];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onModifyColWidth).call(_this, ...args);\n });\n this.addHook('modifyColumnHeaderValue', function () {\n for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {\n args[_key10] = arguments[_key10];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onModifyColumnHeaderValue).call(_this, ...args);\n });\n this.addHook('beforeHighlightingColumnHeader', function () {\n for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {\n args[_key11] = arguments[_key11];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onBeforeHighlightingColumnHeader).call(_this, ...args);\n });\n this.addHook('beforeCopy', function () {\n for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {\n args[_key12] = arguments[_key12];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onBeforeCopy).call(_this, ...args);\n });\n this.addHook('beforeSelectColumns', function () {\n for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {\n args[_key13] = arguments[_key13];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onBeforeSelectColumns).call(_this, ...args);\n });\n this.addHook('afterViewportColumnCalculatorOverride', function () {\n for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {\n args[_key14] = arguments[_key14];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onAfterViewportColumnCalculatorOverride).call(_this, ...args);\n });\n this.addHook('modifyFocusedElement', function () {\n for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {\n args[_key15] = arguments[_key15];\n }\n return _assertClassBrand(_NestedHeaders_brand, _this, _onModifyFocusedElement).call(_this, ...args);\n });\n this.hot.columnIndexMapper.addLocalHook('cacheUpdated', () => _assertClassBrand(_NestedHeaders_brand, this, _updateFocusHighlightPosition).call(this));\n this.hot.rowIndexMapper.addLocalHook('cacheUpdated', () => _assertClassBrand(_NestedHeaders_brand, this, _updateFocusHighlightPosition).call(this));\n super.enablePlugin();\n this.updatePlugin(); // @TODO: Workaround for broken plugin initialization abstraction.\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`nestedHeaders`](@/api/options.md#nestedheaders)\n */\n updatePlugin() {\n if (!this.hot.view) {\n // @TODO: Workaround for broken plugin initialization abstraction.\n return;\n }\n const {\n nestedHeaders\n } = this.hot.getSettings();\n _classPrivateFieldGet(_stateManager, this).setColumnsLimit(this.hot.countCols());\n if (Array.isArray(nestedHeaders)) {\n this.detectedOverlappedHeaders = _classPrivateFieldGet(_stateManager, this).setState(nestedHeaders);\n }\n if (this.detectedOverlappedHeaders) {\n warn(toSingleLine`Your Nested Headers plugin setup contains overlapping headers. This kind of configuration\\x20\n is currently not supported.`);\n }\n if (this.enabled) {\n // This line covers the case when a developer uses the external hiding maps to manipulate\n // the columns' visibility. The tree state built from the settings - which is always built\n // as if all the columns are visible, needs to be modified to be in sync with a dataset.\n this.hot.columnIndexMapper.hidingMapsCollection.getMergedValues().forEach((isColumnHidden, physicalColumnIndex) => {\n const actionName = isColumnHidden === true ? 'hide-column' : 'show-column';\n _classPrivateFieldGet(_stateManager, this).triggerColumnModification(actionName, physicalColumnIndex);\n });\n }\n if (!_classPrivateFieldGet(_hidingIndexMapObserver, this) && this.enabled) {\n _classPrivateFieldSet(_hidingIndexMapObserver, this, this.hot.columnIndexMapper.createChangesObserver('hiding').subscribe(changes => {\n changes.forEach(_ref => {\n let {\n op,\n index: columnIndex,\n newValue\n } = _ref;\n if (op === 'replace') {\n const actionName = newValue === true ? 'hide-column' : 'show-column';\n _classPrivateFieldGet(_stateManager, this).triggerColumnModification(actionName, columnIndex);\n }\n });\n this.ghostTable.buildWidthsMap();\n }));\n }\n this.ghostTable.setLayersCount(this.getLayersCount()).buildWidthsMap();\n super.updatePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n this.clearColspans();\n _classPrivateFieldGet(_stateManager, this).clear();\n _classPrivateFieldGet(_hidingIndexMapObserver, this).unsubscribe();\n _classPrivateFieldSet(_hidingIndexMapObserver, this, null);\n this.ghostTable.clear();\n super.disablePlugin();\n }\n\n /**\n * Returns an instance of the internal state manager of the plugin.\n *\n * @private\n * @returns {StateManager}\n */\n getStateManager() {\n return _classPrivateFieldGet(_stateManager, this);\n }\n\n /**\n * Gets a total number of headers levels.\n *\n * @private\n * @returns {number}\n */\n getLayersCount() {\n return _classPrivateFieldGet(_stateManager, this).getLayersCount();\n }\n\n /**\n * Gets column settings for a specified header. The returned object contains\n * information about the header label, its colspan length, or if it is hidden\n * in the header renderers.\n *\n * @private\n * @param {number} headerLevel Header level (0 = most distant to the table).\n * @param {number} columnIndex A visual column index.\n * @returns {object}\n */\n getHeaderSettings(headerLevel, columnIndex) {\n return _classPrivateFieldGet(_stateManager, this).getHeaderSettings(headerLevel, columnIndex);\n }\n\n /**\n * Clear the colspans remaining after plugin usage.\n *\n * @private\n */\n clearColspans() {\n if (!this.hot.view) {\n return;\n }\n const {\n _wt: wt\n } = this.hot.view;\n const headerLevels = wt.getSetting('columnHeaders').length;\n const mainHeaders = wt.wtTable.THEAD;\n const topHeaders = wt.wtOverlays.topOverlay.clone.wtTable.THEAD;\n const topLeftCornerHeaders = wt.wtOverlays.topInlineStartCornerOverlay ? wt.wtOverlays.topInlineStartCornerOverlay.clone.wtTable.THEAD : null;\n for (let i = 0; i < headerLevels; i++) {\n const masterLevel = mainHeaders.childNodes[i];\n if (!masterLevel) {\n break;\n }\n const topLevel = topHeaders.childNodes[i];\n const topLeftCornerLevel = topLeftCornerHeaders ? topLeftCornerHeaders.childNodes[i] : null;\n for (let j = 0, masterNodes = masterLevel.childNodes.length; j < masterNodes; j++) {\n masterLevel.childNodes[j].removeAttribute('colspan');\n removeClass(masterLevel.childNodes[j], 'hiddenHeader');\n if (topLevel && topLevel.childNodes[j]) {\n topLevel.childNodes[j].removeAttribute('colspan');\n removeClass(topLevel.childNodes[j], 'hiddenHeader');\n }\n if (topLeftCornerHeaders && topLeftCornerLevel && topLeftCornerLevel.childNodes[j]) {\n topLeftCornerLevel.childNodes[j].removeAttribute('colspan');\n removeClass(topLeftCornerLevel.childNodes[j], 'hiddenHeader');\n }\n }\n }\n }\n\n /**\n * Generates the appropriate header renderer for a header row.\n *\n * @private\n * @param {number} headerLevel The index of header level counting from the top (positive\n * values counting from 0 to N).\n * @returns {Function}\n * @fires Hooks#afterGetColHeader\n */\n headerRendererFactory(headerLevel) {\n var _this2 = this;\n const fixedColumnsStart = this.hot.view._wt.getSetting('fixedColumnsStart');\n return (renderedColumnIndex, TH) => {\n var _classPrivateFieldGet2;\n const {\n columnIndexMapper,\n view\n } = this.hot;\n let visualColumnIndex = columnIndexMapper.getVisualFromRenderableIndex(renderedColumnIndex);\n if (visualColumnIndex === null) {\n visualColumnIndex = renderedColumnIndex;\n }\n TH.removeAttribute('colspan');\n removeClass(TH, 'hiddenHeader');\n const {\n colspan,\n isHidden,\n isPlaceholder,\n headerClassNames\n } = (_classPrivateFieldGet2 = _classPrivateFieldGet(_stateManager, this).getHeaderSettings(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : {\n label: ''\n };\n if (isPlaceholder || isHidden) {\n addClass(TH, 'hiddenHeader');\n } else if (colspan > 1) {\n var _wtOverlays$topInline, _wtOverlays$inlineSta;\n const {\n wtOverlays\n } = view._wt;\n const isTopInlineStartOverlay = (_wtOverlays$topInline = wtOverlays.topInlineStartCornerOverlay) === null || _wtOverlays$topInline === void 0 ? void 0 : _wtOverlays$topInline.clone.wtTable.THEAD.contains(TH);\n const isInlineStartOverlay = (_wtOverlays$inlineSta = wtOverlays.inlineStartOverlay) === null || _wtOverlays$inlineSta === void 0 ? void 0 : _wtOverlays$inlineSta.clone.wtTable.THEAD.contains(TH);\n\n // Check if there is a fixed column enabled, if so then reduce colspan to fixed column width.\n const correctedColspan = isTopInlineStartOverlay || isInlineStartOverlay ? Math.min(colspan, fixedColumnsStart - renderedColumnIndex) : colspan;\n if (correctedColspan > 1) {\n TH.setAttribute('colspan', correctedColspan);\n }\n }\n this.hot.view.appendColHeader(visualColumnIndex, TH, function () {\n return _this2.getColumnHeaderValue(...arguments);\n }, headerLevel);\n\n // Replace the higher-order `headerClassName`s with the one provided in the plugin config, if it was provided.\n if (!isPlaceholder && !isHidden) {\n const innerHeaderDiv = TH.querySelector('div.relative');\n if (innerHeaderDiv && headerClassNames && headerClassNames.length > 0) {\n removeClass(innerHeaderDiv, this.hot.getColumnMeta(visualColumnIndex).headerClassName);\n addClass(innerHeaderDiv, headerClassNames);\n }\n }\n };\n }\n\n /**\n * Returns the column header value for specified column and header level index.\n *\n * @private\n * @param {number} visualColumnIndex Visual column index.\n * @param {number} headerLevel The index of header level. The header level accepts positive (0 to N)\n * and negative (-1 to -N) values. For positive values, 0 points to the\n * top most header, and for negative direction, -1 points to the most bottom\n * header (the header closest to the cells).\n * @returns {string} Returns the column header value to update.\n */\n getColumnHeaderValue(visualColumnIndex, headerLevel) {\n var _classPrivateFieldGet3;\n const {\n isHidden,\n isPlaceholder\n } = (_classPrivateFieldGet3 = _classPrivateFieldGet(_stateManager, this).getHeaderSettings(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : {};\n if (isPlaceholder || isHidden) {\n return '';\n }\n return this.hot.getColHeader(visualColumnIndex, headerLevel);\n }\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n _classPrivateFieldSet(_stateManager, this, null);\n if (_classPrivateFieldGet(_hidingIndexMapObserver, this) !== null) {\n _classPrivateFieldGet(_hidingIndexMapObserver, this).unsubscribe();\n _classPrivateFieldSet(_hidingIndexMapObserver, this, null);\n }\n super.destroy();\n }\n\n /**\n * Gets the tree data that belongs to the column headers pointed by the passed coordinates.\n *\n * @private\n * @param {CellCoords} coords The CellCoords instance.\n * @returns {object|undefined}\n */\n _getHeaderTreeNodeDataByCoords(coords) {\n if (coords.row >= 0 || coords.col < 0) {\n return;\n }\n return _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(coords.row, coords.col);\n }\n}\nfunction _updateFocusHighlightPosition() {\n var _this$hot;\n const selection = (_this$hot = this.hot) === null || _this$hot === void 0 ? void 0 : _this$hot.getSelectedRangeLast();\n if (!selection) {\n return;\n }\n const {\n highlight\n } = selection;\n const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;\n if (isNestedHeadersRange) {\n const columnIndex = _classPrivateFieldGet(_stateManager, this).findLeftMostColumnIndex(highlight.row, highlight.col);\n const focusHighlight = this.hot.selection.highlight.getFocus();\n\n // Correct the highlight/focus selection to highlight the correct TH element\n focusHighlight.visualCellRange.highlight.col = columnIndex;\n focusHighlight.visualCellRange.from.col = columnIndex;\n focusHighlight.visualCellRange.to.col = columnIndex;\n focusHighlight.commit();\n }\n}\n/**\n * Allows to control to which column index the viewport will be scrolled. To ensure that the viewport\n * is scrolled to the correct column for the nested header the most left and the most right visual column\n * indexes are used.\n *\n * @param {number} visualColumn A visual column index to which the viewport will be scrolled.\n * @returns {number}\n */\nfunction _onBeforeViewportScrollHorizontally(visualColumn) {\n const selection = this.hot.getSelectedRangeLast();\n if (!selection) {\n return visualColumn;\n }\n const {\n highlight\n } = selection;\n const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;\n if (!isNestedHeadersRange) {\n return visualColumn;\n }\n const firstColumn = this.hot.view.getFirstFullyVisibleColumn();\n const lastColumn = this.hot.view.getLastFullyVisibleColumn();\n const mostLeftColumnIndex = _classPrivateFieldGet(_stateManager, this).findLeftMostColumnIndex(highlight.row, highlight.col);\n const mostRightColumnIndex = _classPrivateFieldGet(_stateManager, this).findRightMostColumnIndex(highlight.row, highlight.col);\n\n // do not scroll the viewport when the header is wider than the viewport\n if (mostLeftColumnIndex < firstColumn && mostRightColumnIndex > lastColumn) {\n return visualColumn;\n }\n return mostLeftColumnIndex < firstColumn ? mostLeftColumnIndex : mostRightColumnIndex;\n}\n/**\n * Allows to control which header DOM element will be used to highlight.\n *\n * @param {number} visualColumn A visual column index of the highlighted row header.\n * @param {number} headerLevel A row header level that is currently highlighted.\n * @param {object} highlightMeta An object with meta data that describes the highlight state.\n * @returns {number}\n */\nfunction _onBeforeHighlightingColumnHeader(visualColumn, headerLevel, highlightMeta) {\n const headerNodeData = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(headerLevel, visualColumn);\n if (!headerNodeData) {\n return visualColumn;\n }\n const {\n columnCursor,\n selectionType,\n selectionWidth\n } = highlightMeta;\n const {\n isRoot,\n colspan\n } = _classPrivateFieldGet(_stateManager, this).getHeaderSettings(headerLevel, visualColumn);\n if (selectionType === HEADER_TYPE) {\n if (!isRoot) {\n return headerNodeData.columnIndex;\n }\n } else if (selectionType === ACTIVE_HEADER_TYPE) {\n if (colspan > selectionWidth - columnCursor || !isRoot) {\n // Prevents adding any CSS class names to the TH element\n return null;\n }\n }\n return visualColumn;\n}\n/**\n * Listens the `beforeCopy` hook that allows processing the copied column headers so that the\n * merged column headers do not propagate the value for each column but only once at the beginning\n * of the column.\n *\n * @private\n * @param {Array[]} data An array of arrays which contains data to copied.\n * @param {object[]} copyableRanges An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)\n * which will copied.\n * @param {{ columnHeadersCount: number }} copiedHeadersCount An object with keys that holds information with\n * the number of copied headers.\n */\nfunction _onBeforeCopy(data, copyableRanges, _ref2) {\n let {\n columnHeadersCount\n } = _ref2;\n if (columnHeadersCount === 0) {\n return;\n }\n for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex++) {\n const {\n startRow,\n startCol,\n endRow,\n endCol\n } = copyableRanges[rangeIndex];\n const rowsCount = endRow - startRow + 1;\n const columnsCount = startCol - endCol + 1;\n\n // do not process dataset ranges and column headers where only one column is copied\n if (startRow >= 0 || columnsCount === 1) {\n break;\n }\n for (let column = startCol; column <= endCol; column++) {\n for (let row = startRow; row <= endRow; row++) {\n var _classPrivateFieldGet4;\n const zeroBasedColumnHeaderLevel = rowsCount + row;\n const zeroBasedColumnIndex = column - startCol;\n if (zeroBasedColumnIndex === 0) {\n continue; // eslint-disable-line no-continue\n }\n const isRoot = (_classPrivateFieldGet4 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.isRoot;\n if (isRoot === false) {\n data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';\n }\n }\n }\n }\n}\n/**\n * Allows blocking the column selection that is controlled by the core Selection module.\n *\n * @param {MouseEvent} event Mouse event.\n * @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.\n * @param {CellCoords} TD The table cell or header element.\n * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains\n * a boolean value that allows or disallows changing the selection for that particular area.\n */\nfunction _onBeforeOnCellMouseDown(event, coords, TD, controller) {\n const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);\n if (headerNodeData) {\n // Block the Selection module in controlling how the columns are selected. Pass the\n // responsibility of the column selection to this plugin (see \"onAfterOnCellMouseDown\" hook).\n controller.column = true;\n }\n}\n/**\n * Allows to control how the column selection based on the coordinates and the nested headers is made.\n *\n * @param {MouseEvent} event Mouse event.\n * @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.\n */\nfunction _onAfterOnCellMouseDown(event, coords) {\n const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);\n if (!headerNodeData) {\n return;\n }\n _classPrivateFieldSet(_focusInitialCoords, this, coords.clone());\n _classPrivateFieldSet(_isColumnsSelectionInProgress, this, true);\n const {\n selection\n } = this.hot;\n const currentSelection = selection.isSelected() ? selection.getSelectedRange().current() : null;\n const columnsToSelect = [];\n const {\n columnIndex,\n origColspan\n } = headerNodeData;\n\n // The Selection module doesn't allow it to extend its behavior easily. That's why here we need\n // to re-implement the \"click\" and \"shift\" behavior. As a workaround, the logic for the nested\n // headers must implement a similar logic as in the original Selection handler\n // (see src/selection/mouseEventHandler.js).\n const allowRightClickSelection = !selection.inInSelection(coords);\n if (event.shiftKey && currentSelection) {\n if (coords.col < currentSelection.from.col) {\n columnsToSelect.push(currentSelection.getTopEndCorner().col, columnIndex, coords.row);\n } else if (coords.col > currentSelection.from.col) {\n columnsToSelect.push(currentSelection.getTopStartCorner().col, columnIndex + origColspan - 1, coords.row);\n } else {\n columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, coords.row);\n }\n } else if (isLeftClick(event) || isRightClick(event) && allowRightClickSelection || isTouchEvent(event)) {\n columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, coords.row);\n }\n\n // The plugin takes control of how the columns are selected.\n selection.selectColumns(...columnsToSelect);\n}\n/**\n * Makes the header-selection properly select the nested headers.\n *\n * @param {MouseEvent} event Mouse event.\n * @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.\n * @param {HTMLElement} TD The cell element.\n * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains\n * a boolean value that allows or disallows changing the selection for that particular area.\n */\nfunction _onBeforeOnCellMouseOver(event, coords, TD, controller) {\n if (!this.hot.view.isMouseDown()) {\n return;\n }\n const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);\n if (!headerNodeData) {\n return;\n }\n const {\n columnIndex,\n origColspan\n } = headerNodeData;\n const selectedRange = this.hot.getSelectedRangeLast();\n const topStartCoords = selectedRange.getTopStartCorner();\n const bottomEndCoords = selectedRange.getBottomEndCorner();\n const {\n from\n } = selectedRange;\n\n // Block the Selection module in controlling how the columns and cells are selected.\n // From now on, the plugin is responsible for the selection.\n controller.column = true;\n controller.cell = true;\n const columnsToSelect = [];\n const headerLevel = clamp(coords.row, -Infinity, -1);\n if (coords.col < from.col) {\n columnsToSelect.push(bottomEndCoords.col, columnIndex, headerLevel);\n } else if (coords.col > from.col) {\n columnsToSelect.push(topStartCoords.col, columnIndex + origColspan - 1, headerLevel);\n } else {\n columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, headerLevel);\n }\n this.hot.selection.selectColumns(...columnsToSelect);\n}\n/**\n * Switches internal flag about selection progress to `false`.\n */\nfunction _onBeforeOnCellMouseUp() {\n _classPrivateFieldSet(_isColumnsSelectionInProgress, this, false);\n}\n/**\n * The hook checks and ensures that the focus position that depends on the selected columns\n * range is always positioned within the range.\n */\nfunction _onBeforeSelectionHighlightSet() {\n const {\n navigableHeaders\n } = this.hot.getSettings();\n if (!this.hot.view.isMouseDown() || !_classPrivateFieldGet(_isColumnsSelectionInProgress, this) || !navigableHeaders) {\n return;\n }\n const selectedRange = this.hot.getSelectedRangeLast();\n const columnStart = selectedRange.getTopStartCorner().col;\n const columnEnd = selectedRange.getBottomEndCorner().col;\n const {\n columnIndex,\n origColspan\n } = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(_classPrivateFieldGet(_focusInitialCoords, this).row, _classPrivateFieldGet(_focusInitialCoords, this).col);\n selectedRange.setHighlight(_classPrivateFieldGet(_focusInitialCoords, this));\n if (origColspan > selectedRange.getWidth() || columnIndex < columnStart || columnIndex + origColspan - 1 > columnEnd) {\n const headerLevel = _classPrivateFieldGet(_stateManager, this).findTopMostEntireHeaderLevel(clamp(columnStart, columnIndex, columnIndex + origColspan - 1), clamp(columnEnd, columnIndex, columnIndex + origColspan - 1));\n selectedRange.highlight.row = headerLevel;\n selectedRange.highlight.col = selectedRange.from.col;\n }\n}\n/**\n * `modifyTransformStart` hook is called every time the keyboard navigation is used.\n *\n * @param {object} delta The transformation delta.\n */\nfunction _onModifyTransformStart(delta) {\n const {\n highlight\n } = this.hot.getSelectedRangeLast();\n const nextCoords = this.hot._createCellCoords(highlight.row + delta.row, highlight.col + delta.col);\n const isNestedHeadersRange = nextCoords.isHeader() && nextCoords.col >= 0;\n if (!isNestedHeadersRange) {\n return;\n }\n const visualColumnIndexStart = _classPrivateFieldGet(_stateManager, this).findLeftMostColumnIndex(nextCoords.row, nextCoords.col);\n const visualColumnIndexEnd = _classPrivateFieldGet(_stateManager, this).findRightMostColumnIndex(nextCoords.row, nextCoords.col);\n if (delta.col < 0) {\n const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;\n const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);\n if (notHiddenColumnIndex === null) {\n // There are no visible columns anymore, so move the selection out of the table edge. This will\n // be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).\n delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);\n } else {\n delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);\n }\n } else if (delta.col > 0) {\n const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;\n const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);\n if (notHiddenColumnIndex === null) {\n // There are no visible columns anymore, so move the selection out of the table edge. This will\n // be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).\n delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());\n } else {\n delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);\n }\n }\n}\n/**\n * The hook observes the column selection from the Selection API and modifies the column range to\n * ensure that the whole nested column will be covered.\n *\n * @param {CellCoords} from The coords object where the selection starts.\n * @param {CellCoords} to The coords object where the selection ends.\n */\nfunction _onBeforeSelectColumns(from, to) {\n const headerLevel = from.row;\n const startNodeData = this._getHeaderTreeNodeDataByCoords({\n row: headerLevel,\n col: from.col\n });\n const endNodeData = this._getHeaderTreeNodeDataByCoords({\n row: headerLevel,\n col: to.col\n });\n if (to.col < from.col) {\n // Column selection from right to left\n if (startNodeData) {\n from.col = startNodeData.columnIndex + startNodeData.origColspan - 1;\n }\n if (endNodeData) {\n to.col = endNodeData.columnIndex;\n }\n } else if (to.col >= from.col) {\n // Column selection from left to right or a single column selection\n if (startNodeData) {\n from.col = startNodeData.columnIndex;\n }\n if (endNodeData) {\n to.col = endNodeData.columnIndex + endNodeData.origColspan - 1;\n }\n }\n}\n/**\n * `afterGetColumnHeader` hook callback - prepares the header structure.\n *\n * @param {Array} renderersArray Array of renderers.\n */\nfunction _onAfterGetColumnHeaderRenderers(renderersArray) {\n renderersArray.length = 0;\n for (let headerLayer = 0; headerLayer < _classPrivateFieldGet(_stateManager, this).getLayersCount(); headerLayer++) {\n renderersArray.push(this.headerRendererFactory(headerLayer));\n }\n}\n/**\n * Make the renderer render the first nested column in its entirety.\n *\n * @param {object} calc Viewport column calculator.\n */\nfunction _onAfterViewportColumnCalculatorOverride(calc) {\n const headerLayersCount = _classPrivateFieldGet(_stateManager, this).getLayersCount();\n let newStartColumn = calc.startColumn;\n let nonRenderable = !!headerLayersCount;\n for (let headerLayer = 0; headerLayer < headerLayersCount; headerLayer++) {\n const startColumn = _classPrivateFieldGet(_stateManager, this).findLeftMostColumnIndex(headerLayer, calc.startColumn);\n const renderedStartColumn = this.hot.columnIndexMapper.getRenderableFromVisualIndex(startColumn);\n\n // If any of the headers for that column index is rendered, all of them should be rendered properly, see\n // comment below.\n if (startColumn >= 0) {\n nonRenderable = false;\n }\n\n // `renderedStartColumn` can be `null` if the leftmost columns are hidden. In that case -> ignore that header\n // level, as it should be handled by the \"parent\" header\n if (isNumeric(renderedStartColumn) && renderedStartColumn < calc.startColumn) {\n newStartColumn = renderedStartColumn;\n break;\n }\n }\n\n // If no headers for the provided column index are renderable, start rendering from the beginning of the upmost\n // header for that position.\n calc.startColumn = nonRenderable ? _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(0, newStartColumn).columnIndex : newStartColumn;\n}\n/**\n * `modifyColWidth` hook callback - returns width from cache, when is greater than incoming from hook.\n *\n * @param {number} width Width from hook.\n * @param {number} column Visual index of an column.\n * @returns {number}\n */\nfunction _onModifyColWidth(width, column) {\n const cachedWidth = this.ghostTable.getWidth(column);\n return width > cachedWidth ? width : cachedWidth;\n}\n/**\n * Listens the `modifyColumnHeaderValue` hook that overwrites the column headers values based on\n * the internal state and settings of the plugin.\n *\n * @param {string} value The column header value.\n * @param {number} visualColumnIndex The visual column index.\n * @param {number} headerLevel The index of header level. The header level accepts positive (0 to N)\n * and negative (-1 to -N) values. For positive values, 0 points to the\n * top most header, and for negative direction, -1 points to the most bottom\n * header (the header closest to the cells).\n * @returns {string} Returns the column header value to update.\n */\nfunction _onModifyColumnHeaderValue(value, visualColumnIndex, headerLevel) {\n var _classPrivateFieldGet5;\n const {\n label\n } = (_classPrivateFieldGet5 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet5 !== void 0 ? _classPrivateFieldGet5 : {\n label: ''\n };\n return label;\n}\n/**\n * `modifyFocusedElement` hook callback.\n *\n * @param {number} row Row index.\n * @param {number} column Column index.\n * @returns {HTMLTableCellElement} The `TH` element to be focused.\n */\nfunction _onModifyFocusedElement(row, column) {\n if (row < 0) {\n return this.hot.getCell(row, _classPrivateFieldGet(_stateManager, this).findLeftMostColumnIndex(row, column), true);\n }\n}\n/**\n * Updates the plugin state after HoT initialization.\n */\nfunction _onInit() {\n // @TODO: Workaround for broken plugin initialization abstraction.\n this.updatePlugin();\n}\n/**\n * Updates the plugin state after new dataset load.\n *\n * @param {Array[]} sourceData Array of arrays or array of objects containing data.\n * @param {boolean} initialLoad Flag that determines whether the data has been loaded\n * during the initialization.\n */\nfunction _onAfterLoadData(sourceData, initialLoad) {\n if (!initialLoad) {\n this.updatePlugin();\n }\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, NestedHeaders } from \"./nestedHeaders.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { rangeEach } from \"../../../helpers/number.mjs\";\nimport { objectEach } from \"../../../helpers/object.mjs\";\nimport { arrayEach } from \"../../../helpers/array.mjs\";\n/**\n * Class responsible for making data operations.\n *\n * @private\n */\nclass DataManager {\n constructor(nestedRowsPlugin, hotInstance) {\n /**\n * Main Handsontable instance reference.\n *\n * @type {object}\n */\n _defineProperty(this, \"hot\", void 0);\n /**\n * Reference to the source data object.\n *\n * @type {Handsontable.CellValue[][]|Handsontable.RowObject[]}\n */\n _defineProperty(this, \"data\", null);\n /**\n * Reference to the NestedRows plugin.\n *\n * @type {object}\n */\n _defineProperty(this, \"plugin\", void 0);\n /**\n * Map of row object parents.\n *\n * @type {WeakMap}\n */\n _defineProperty(this, \"parentReference\", new WeakMap());\n /**\n * Nested structure cache.\n *\n * @type {object}\n */\n _defineProperty(this, \"cache\", {\n levels: [],\n levelCount: 0,\n rows: [],\n nodeInfo: new WeakMap()\n });\n this.hot = hotInstance;\n this.plugin = nestedRowsPlugin;\n }\n\n /**\n * Set the data for the manager.\n *\n * @param {Handsontable.CellValue[][]|Handsontable.RowObject[]} data Data for the manager.\n */\n setData(data) {\n this.data = data;\n }\n\n /**\n * Get the data cached in the manager.\n *\n * @returns {Handsontable.CellValue[][]|Handsontable.RowObject[]}\n */\n getData() {\n return this.data;\n }\n\n /**\n * Load the \"raw\" source data, without NestedRows' modifications.\n *\n * @returns {Handsontable.CellValue[][]|Handsontable.RowObject[]}\n */\n getRawSourceData() {\n let rawSourceData = null;\n this.plugin.disableCoreAPIModifiers();\n rawSourceData = this.hot.getSourceData();\n this.plugin.enableCoreAPIModifiers();\n return rawSourceData;\n }\n\n /**\n * Update the Data Manager with new data and refresh cache.\n *\n * @param {Handsontable.CellValue[][]|Handsontable.RowObject[]} data Data for the manager.\n */\n updateWithData(data) {\n this.setData(data);\n this.rewriteCache();\n }\n\n /**\n * Rewrite the nested structure cache.\n *\n * @private\n */\n rewriteCache() {\n this.cache = {\n levels: [],\n levelCount: 0,\n rows: [],\n nodeInfo: new WeakMap()\n };\n rangeEach(0, this.data.length - 1, i => {\n this.cacheNode(this.data[i], 0, null);\n });\n }\n\n /**\n * Cache a data node.\n *\n * @private\n * @param {object} node Node to cache.\n * @param {number} level Level of the node.\n * @param {object} parent Parent of the node.\n */\n cacheNode(node, level, parent) {\n if (!this.cache.levels[level]) {\n this.cache.levels[level] = [];\n this.cache.levelCount += 1;\n }\n this.cache.levels[level].push(node);\n this.cache.rows.push(node);\n this.cache.nodeInfo.set(node, {\n parent,\n row: this.cache.rows.length - 1,\n level\n });\n if (this.hasChildren(node)) {\n arrayEach(node.__children, elem => {\n this.cacheNode(elem, level + 1, node);\n });\n }\n }\n\n /**\n * Get the date for the provided visual row number.\n *\n * @param {number} row Row index.\n * @returns {object}\n */\n getDataObject(row) {\n return row === null || row === undefined ? null : this.cache.rows[row];\n }\n\n /**\n * Read the row tree in search for a specific row index or row object.\n *\n * @private\n * @param {object} parent The initial parent object.\n * @param {number} readCount Number of read nodes.\n * @param {number} neededIndex The row index we search for.\n * @param {object} neededObject The row object we search for.\n * @returns {number|object}\n */\n readTreeNodes(parent, readCount, neededIndex, neededObject) {\n let rootLevel = false;\n let readNodesCount = readCount;\n if (isNaN(readNodesCount) && readNodesCount.end) {\n return readNodesCount;\n }\n let parentObj = parent;\n if (!parentObj) {\n parentObj = {\n __children: this.data\n };\n rootLevel = true;\n readNodesCount -= 1;\n }\n if (neededIndex !== null && neededIndex !== undefined && readNodesCount === neededIndex) {\n return {\n result: parentObj,\n end: true\n };\n }\n if (neededObject !== null && neededObject !== undefined && parentObj === neededObject) {\n return {\n result: readNodesCount,\n end: true\n };\n }\n readNodesCount += 1;\n if (parentObj.__children) {\n arrayEach(parentObj.__children, val => {\n this.parentReference.set(val, rootLevel ? null : parentObj);\n readNodesCount = this.readTreeNodes(val, readNodesCount, neededIndex, neededObject);\n if (isNaN(readNodesCount) && readNodesCount.end) {\n return false;\n }\n });\n }\n return readNodesCount;\n }\n\n /**\n * Mock a parent node.\n *\n * @private\n * @returns {*}\n */\n mockParent() {\n const fakeParent = this.mockNode();\n fakeParent.__children = this.data;\n return fakeParent;\n }\n\n /**\n * Mock a data node.\n *\n * @private\n * @returns {{}}\n */\n mockNode() {\n const fakeNode = {};\n objectEach(this.data[0], (val, key) => {\n fakeNode[key] = null;\n });\n return fakeNode;\n }\n\n /**\n * Get the row index for the provided row object.\n *\n * @param {object} rowObj The row object.\n * @returns {number} Row index.\n */\n getRowIndex(rowObj) {\n return rowObj === null || rowObj === undefined ? null : this.cache.nodeInfo.get(rowObj).row;\n }\n\n /**\n * Get the index of the provided row index/row object within its parent.\n *\n * @param {number|object} row Row index / row object.\n * @returns {number}\n */\n getRowIndexWithinParent(row) {\n let rowObj = null;\n if (isNaN(row)) {\n rowObj = row;\n } else {\n rowObj = this.getDataObject(row);\n }\n const parent = this.getRowParent(row);\n if (parent === null || parent === undefined) {\n return this.data.indexOf(rowObj);\n }\n return parent.__children.indexOf(rowObj);\n }\n\n /**\n * Count all rows (including all parents and children).\n *\n * @returns {number}\n */\n countAllRows() {\n const rootNodeMock = {\n __children: this.data\n };\n return this.countChildren(rootNodeMock);\n }\n\n /**\n * Count children of the provided parent.\n *\n * @param {object|number} parent Parent node.\n * @returns {number} Children count.\n */\n countChildren(parent) {\n let rowCount = 0;\n let parentNode = parent;\n if (!isNaN(parentNode)) {\n parentNode = this.getDataObject(parentNode);\n }\n if (!parentNode || !parentNode.__children) {\n return 0;\n }\n arrayEach(parentNode.__children, elem => {\n rowCount += 1;\n if (elem.__children) {\n rowCount += this.countChildren(elem);\n }\n });\n return rowCount;\n }\n\n /**\n * Get the parent of the row at the provided index.\n *\n * @param {number|object} row Physical row index.\n * @returns {object}\n */\n getRowParent(row) {\n let rowObject;\n if (isNaN(row)) {\n rowObject = row;\n } else {\n rowObject = this.getDataObject(row);\n }\n return this.getRowObjectParent(rowObject);\n }\n\n /**\n * Get the parent of the provided row object.\n *\n * @private\n * @param {object} rowObject The row object (tree node).\n * @returns {object|null}\n */\n getRowObjectParent(rowObject) {\n if (!rowObject || typeof rowObject !== 'object') {\n return null;\n }\n return this.cache.nodeInfo.get(rowObject).parent;\n }\n\n /**\n * Get the nesting level for the row with the provided row index.\n *\n * @param {number} row Row index.\n * @returns {number|null} Row level or null, when row doesn't exist.\n */\n getRowLevel(row) {\n let rowObject = null;\n if (isNaN(row)) {\n rowObject = row;\n } else {\n rowObject = this.getDataObject(row);\n }\n return rowObject ? this.getRowObjectLevel(rowObject) : null;\n }\n\n /**\n * Get the nesting level for the row with the provided row index.\n *\n * @private\n * @param {object} rowObject Row object.\n * @returns {number} Row level.\n */\n getRowObjectLevel(rowObject) {\n return rowObject === null || rowObject === undefined ? null : this.cache.nodeInfo.get(rowObject).level;\n }\n\n /**\n * Check if the provided row/row element has children.\n *\n * @param {number|object} row Row number or row element.\n * @returns {boolean}\n */\n hasChildren(row) {\n let rowObj = row;\n if (!isNaN(rowObj)) {\n rowObj = this.getDataObject(rowObj);\n }\n return !!(rowObj.__children && rowObj.__children.length);\n }\n\n /**\n * Returns `true` if the row at the provided index has a parent.\n *\n * @param {number} index Row index.\n * @returns {boolean} `true` if the row at the provided index has a parent, `false` otherwise.\n */\n isChild(index) {\n return this.getRowParent(index) !== null;\n }\n\n /**\n * Get child at a provided index from the parent element.\n *\n * @param {object} parent The parent row object.\n * @param {number} index Index of the child element to be retrieved.\n * @returns {object|null} The child element or `null` if the child doesn't exist.\n */\n getChild(parent, index) {\n var _parent$__children;\n return ((_parent$__children = parent.__children) === null || _parent$__children === void 0 ? void 0 : _parent$__children[index]) || null;\n }\n\n /**\n * Return `true` of the row at the provided index is located at the topmost level.\n *\n * @param {number} index Row index.\n * @returns {boolean} `true` of the row at the provided index is located at the topmost level, `false` otherwise.\n */\n isRowHighestLevel(index) {\n return !this.isChild(index);\n }\n\n /**\n * Return `true` if the provided row index / row object represents a parent in the nested structure.\n *\n * @param {number|object} row Row index / row object.\n * @returns {boolean} `true` if the row is a parent, `false` otherwise.\n */\n isParent(row) {\n var _rowObj$__children;\n let rowObj = row;\n if (!isNaN(rowObj)) {\n rowObj = this.getDataObject(rowObj);\n }\n return rowObj && !!rowObj.__children && ((_rowObj$__children = rowObj.__children) === null || _rowObj$__children === void 0 ? void 0 : _rowObj$__children.length) !== 0;\n }\n\n /**\n * Add a child to the provided parent. It's optional to add a row object as the \"element\".\n *\n * @param {object} parent The parent row object.\n * @param {object} [element] The element to add as a child.\n */\n addChild(parent, element) {\n let childElement = element;\n this.hot.runHooks('beforeAddChild', parent, childElement);\n let parentIndex = null;\n if (parent) {\n parentIndex = this.getRowIndex(parent);\n }\n this.hot.runHooks('beforeCreateRow', parentIndex + this.countChildren(parent) + 1, 1);\n let functionalParent = parent;\n if (!parent) {\n functionalParent = this.mockParent();\n }\n if (!functionalParent.__children) {\n functionalParent.__children = [];\n }\n if (!childElement) {\n childElement = this.mockNode();\n }\n functionalParent.__children.push(childElement);\n this.rewriteCache();\n const newRowIndex = this.getRowIndex(childElement);\n this.hot.rowIndexMapper.insertIndexes(newRowIndex, 1);\n this.hot.runHooks('afterCreateRow', newRowIndex, 1);\n this.hot.runHooks('afterAddChild', parent, childElement);\n }\n\n /**\n * Add a child node to the provided parent at a specified index.\n *\n * @param {object} parent Parent node.\n * @param {number} index Index to insert the child element at.\n * @param {object} [element] Element (node) to insert.\n */\n addChildAtIndex(parent, index, element) {\n let childElement = element;\n let flattenedIndex;\n if (!childElement) {\n childElement = this.mockNode();\n }\n this.hot.runHooks('beforeAddChild', parent, childElement, index);\n if (parent) {\n const parentIndex = this.getRowIndex(parent);\n const finalChildIndex = parentIndex + index + 1;\n this.hot.runHooks('beforeCreateRow', finalChildIndex, 1);\n parent.__children.splice(index, null, childElement);\n this.rewriteCache();\n this.plugin.disableCoreAPIModifiers();\n this.hot.setSourceDataAtCell(this.getRowIndexWithinParent(parent), '__children', parent.__children, 'NestedRows.addChildAtIndex');\n this.hot.rowIndexMapper.insertIndexes(finalChildIndex, 1);\n this.plugin.enableCoreAPIModifiers();\n this.hot.runHooks('afterCreateRow', finalChildIndex, 1);\n flattenedIndex = finalChildIndex;\n } else {\n this.plugin.disableCoreAPIModifiers();\n this.hot.alter('insert_row_above', index, 1, 'NestedRows.addChildAtIndex');\n this.plugin.enableCoreAPIModifiers();\n flattenedIndex = this.getRowIndex(this.data[index]);\n }\n\n // Workaround for refreshing cache losing the reference to the mocked row.\n childElement = this.getDataObject(flattenedIndex);\n this.hot.runHooks('afterAddChild', parent, childElement, index);\n }\n\n /**\n * Add a sibling element at the specified index.\n *\n * @param {number} index New element sibling's index.\n * @param {('above'|'below')} where Direction in which the sibling is to be created.\n */\n addSibling(index) {\n let where = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'below';\n const translatedIndex = this.translateTrimmedRow(index);\n const parent = this.getRowParent(translatedIndex);\n const indexWithinParent = this.getRowIndexWithinParent(translatedIndex);\n switch (where) {\n case 'below':\n this.addChildAtIndex(parent, indexWithinParent + 1, null);\n break;\n case 'above':\n this.addChildAtIndex(parent, indexWithinParent, null);\n break;\n default:\n break;\n }\n }\n\n /**\n * Detach the provided element from its parent and add it right after it.\n *\n * @param {object|Array} elements Row object or an array of selected coordinates.\n * @param {boolean} [forceRender=true] If true (default), it triggers render after finished.\n */\n detachFromParent(elements) {\n let forceRender = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n let element = null;\n const rowObjects = [];\n if (Array.isArray(elements)) {\n rangeEach(elements[0], elements[2], i => {\n const translatedIndex = this.translateTrimmedRow(i);\n rowObjects.push(this.getDataObject(translatedIndex));\n });\n rangeEach(0, rowObjects.length - 2, i => {\n this.detachFromParent(rowObjects[i], false);\n });\n element = rowObjects[rowObjects.length - 1];\n } else {\n element = elements;\n }\n const childRowIndex = this.getRowIndex(element);\n const childCount = this.countChildren(element);\n const indexWithinParent = this.getRowIndexWithinParent(element);\n const parent = this.getRowParent(element);\n const grandparent = this.getRowParent(parent);\n const grandparentRowIndex = this.getRowIndex(grandparent);\n let movedElementRowIndex = null;\n this.hot.runHooks('beforeDetachChild', parent, element);\n if (indexWithinParent !== null && indexWithinParent !== undefined) {\n const removedRowIndexes = Array.from(new Array(childRowIndex + childCount + 1).keys()).splice(-1 * (childCount + 1));\n this.hot.runHooks('beforeRemoveRow', childRowIndex, childCount + 1, removedRowIndexes, this.plugin.pluginName);\n parent.__children.splice(indexWithinParent, 1);\n this.rewriteCache();\n this.hot.runHooks('afterRemoveRow', childRowIndex, childCount + 1, removedRowIndexes, this.plugin.pluginName);\n if (grandparent) {\n movedElementRowIndex = grandparentRowIndex + this.countChildren(grandparent);\n const lastGrandparentChild = this.getChild(grandparent, this.countChildren(grandparent) - 1);\n const lastGrandparentChildIndex = this.getRowIndex(lastGrandparentChild);\n this.hot.runHooks('beforeCreateRow', lastGrandparentChildIndex + 1, childCount + 1, this.plugin.pluginName);\n grandparent.__children.push(element);\n } else {\n movedElementRowIndex = this.hot.countRows() + 1;\n this.hot.runHooks('beforeCreateRow', movedElementRowIndex - 2, childCount + 1, this.plugin.pluginName);\n this.data.push(element);\n }\n }\n this.rewriteCache();\n this.hot.runHooks('afterCreateRow', movedElementRowIndex - 2, childCount + 1, this.plugin.pluginName);\n this.hot.runHooks('afterDetachChild', parent, element, this.getRowIndex(element));\n if (forceRender) {\n this.hot.render();\n }\n }\n\n /**\n * Filter the data by the `logicRows` array.\n *\n * @private\n * @param {number} index Index of the first row to remove.\n * @param {number} amount Number of elements to remove.\n * @param {Array} logicRows Array of indexes to remove.\n */\n filterData(index, amount, logicRows) {\n // TODO: why are the first 2 arguments not used?\n\n const elementsToRemove = [];\n arrayEach(logicRows, elem => {\n elementsToRemove.push(this.getDataObject(elem));\n });\n arrayEach(elementsToRemove, elem => {\n const indexWithinParent = this.getRowIndexWithinParent(elem);\n const tempParent = this.getRowParent(elem);\n if (tempParent === null) {\n this.data.splice(indexWithinParent, 1);\n } else {\n tempParent.__children.splice(indexWithinParent, 1);\n }\n });\n this.rewriteCache();\n }\n\n /**\n * Used to splice the source data. Needed to properly modify the nested structure, which wouldn't work with the\n * default script.\n *\n * @private\n * @param {number} index Physical index of the element at the splice beginning.\n * @param {number} amount Number of elements to be removed.\n * @param {object[]} elements Array of row objects to add.\n */\n spliceData(index, amount, elements) {\n const previousElement = this.getDataObject(index - 1);\n let newRowParent = null;\n let indexWithinParent = index;\n if (previousElement && previousElement.__children && previousElement.__children.length === 0) {\n newRowParent = previousElement;\n indexWithinParent = 0;\n } else if (index < this.countAllRows()) {\n newRowParent = this.getRowParent(index);\n indexWithinParent = this.getRowIndexWithinParent(index);\n }\n if (newRowParent) {\n if (elements) {\n newRowParent.__children.splice(indexWithinParent, amount, ...elements);\n } else {\n newRowParent.__children.splice(indexWithinParent, amount);\n }\n } else if (elements) {\n this.data.splice(indexWithinParent, amount, ...elements);\n } else {\n this.data.splice(indexWithinParent, amount);\n }\n this.rewriteCache();\n }\n\n /**\n * Update the `__children` key of the upmost parent of the provided row object.\n *\n * @private\n * @param {object} rowElement Row object.\n */\n syncRowWithRawSource(rowElement) {\n let upmostParent = rowElement;\n let tempParent = null;\n do {\n tempParent = this.getRowParent(tempParent);\n if (tempParent !== null) {\n upmostParent = tempParent;\n }\n } while (tempParent !== null);\n this.plugin.disableCoreAPIModifiers();\n this.hot.setSourceDataAtCell(this.getRowIndex(upmostParent), '__children', upmostParent.__children, 'NestedRows.syncRowWithRawSource');\n this.plugin.enableCoreAPIModifiers();\n }\n\n /* eslint-disable jsdoc/require-param */\n /**\n * Move a single row.\n *\n * @param {number} fromIndex Index of the row to be moved.\n * @param {number} toIndex Index of the destination.\n * @param {boolean} moveToCollapsed `true` if moving a row to a collapsed parent.\n * @param {boolean} moveToLastChild `true` if moving a row to be a last child of the new parent.\n */\n\n /* eslint-enable jsdoc/require-param */\n moveRow(fromIndex, toIndex, moveToCollapsed, moveToLastChild) {\n const moveToLastRow = toIndex === this.hot.countRows();\n const fromParent = this.getRowParent(fromIndex);\n const indexInFromParent = this.getRowIndexWithinParent(fromIndex);\n const elemToMove = fromParent.__children.slice(indexInFromParent, indexInFromParent + 1);\n const movingUp = fromIndex > toIndex;\n let toParent = moveToLastRow ? this.getRowParent(toIndex - 1) : this.getRowParent(toIndex);\n if (toParent === null || toParent === undefined) {\n toParent = this.getRowParent(toIndex - 1);\n }\n if (toParent === null || toParent === undefined) {\n toParent = this.getDataObject(toIndex - 1);\n }\n if (!toParent) {\n toParent = this.getDataObject(toIndex);\n toParent.__children = [];\n } else if (!toParent.__children) {\n toParent.__children = [];\n }\n const indexInTargetParent = moveToLastRow || moveToCollapsed || moveToLastChild ? toParent.__children.length : this.getRowIndexWithinParent(toIndex);\n const sameParent = fromParent === toParent;\n toParent.__children.splice(indexInTargetParent, 0, elemToMove[0]);\n fromParent.__children.splice(indexInFromParent + (movingUp && sameParent ? 1 : 0), 1);\n\n // Sync the changes in the cached data with the actual data stored in HOT.\n this.syncRowWithRawSource(fromParent);\n if (!sameParent) {\n this.syncRowWithRawSource(toParent);\n }\n }\n\n /**\n * Translate the visual row index to the physical index, taking into consideration the state of collapsed rows.\n *\n * @private\n * @param {number} row Row index.\n * @returns {number}\n */\n translateTrimmedRow(row) {\n if (this.plugin.collapsingUI) {\n return this.plugin.collapsingUI.translateTrimmedRow(row);\n }\n return row;\n }\n\n /**\n * Translate the physical row index to the visual index, taking into consideration the state of collapsed rows.\n *\n * @private\n * @param {number} row Row index.\n * @returns {number}\n */\n untranslateTrimmedRow(row) {\n if (this.plugin.collapsingUI) {\n return this.plugin.collapsingUI.untranslateTrimmedRow(row);\n }\n return row;\n }\n}\nexport default DataManager;", "import \"core-js/modules/es.error.cause.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * Base class for the Nested Rows' UI sub-classes.\n *\n * @private\n * @class\n */\nclass BaseUI {\n constructor(pluginInstance, hotInstance) {\n /**\n * Instance of Handsontable.\n *\n * @type {Core}\n */\n _defineProperty(this, \"hot\", void 0);\n /**\n * Reference to the main plugin instance.\n */\n _defineProperty(this, \"plugin\", void 0);\n this.hot = hotInstance;\n this.plugin = pluginInstance;\n }\n}\nexport default BaseUI;", "import { arrayEach } from \"../../../helpers/array.mjs\";\nimport { rangeEach } from \"../../../helpers/number.mjs\";\nimport { addClass, setAttribute } from \"../../../helpers/dom/element.mjs\";\nimport BaseUI from \"./_base.mjs\";\nimport { A11Y_EXPANDED, A11Y_HIDDEN } from \"../../../helpers/a11y.mjs\";\n/**\n * Class responsible for the UI in the Nested Rows' row headers.\n *\n * @private\n * @class HeadersUI\n * @augments BaseUI\n */\nclass HeadersUI extends BaseUI {\n /**\n * CSS classes used in the row headers.\n *\n * @type {object}\n */\n static get CSS_CLASSES() {\n return {\n indicatorContainer: 'ht_nestingLevels',\n parent: 'ht_nestingParent',\n indicator: 'ht_nestingLevel',\n emptyIndicator: 'ht_nestingLevel_empty',\n button: 'ht_nestingButton',\n expandButton: 'ht_nestingExpand',\n collapseButton: 'ht_nestingCollapse'\n };\n }\n constructor(nestedRowsPlugin, hotInstance) {\n super(nestedRowsPlugin, hotInstance);\n /**\n * Reference to the DataManager instance connected with the Nested Rows plugin.\n *\n * @type {DataManager}\n */\n this.dataManager = this.plugin.dataManager;\n // /**\n // * Level cache array.\n // *\n // * @type {Array}\n // */\n // this.levelCache = this.dataManager.cache.levels;\n /**\n * Reference to the CollapsingUI instance connected with the Nested Rows plugin.\n *\n * @type {CollapsingUI}\n */\n this.collapsingUI = this.plugin.collapsingUI;\n /**\n * Cache for the row headers width.\n *\n * @type {null|number}\n */\n this.rowHeaderWidthCache = null;\n }\n\n /**\n * Append nesting indicators and buttons to the row headers.\n *\n * @private\n * @param {number} row Row index.\n * @param {HTMLElement} TH TH 3element.\n */\n appendLevelIndicators(row, TH) {\n const rowIndex = this.hot.toPhysicalRow(row);\n const rowLevel = this.dataManager.getRowLevel(rowIndex);\n const rowObject = this.dataManager.getDataObject(rowIndex);\n const innerDiv = TH.getElementsByTagName('DIV')[0];\n const innerSpan = innerDiv.querySelector('span.rowHeader');\n const previousIndicators = innerDiv.querySelectorAll('[class^=\"ht_nesting\"]');\n const ariaEnabled = this.hot.getSettings().ariaTags;\n arrayEach(previousIndicators, elem => {\n if (elem) {\n innerDiv.removeChild(elem);\n }\n });\n addClass(TH, HeadersUI.CSS_CLASSES.indicatorContainer);\n if (rowLevel) {\n const {\n rootDocument\n } = this.hot;\n const initialContent = innerSpan.cloneNode(true);\n innerDiv.innerHTML = '';\n rangeEach(0, rowLevel - 1, () => {\n const levelIndicator = rootDocument.createElement('SPAN');\n addClass(levelIndicator, HeadersUI.CSS_CLASSES.emptyIndicator);\n innerDiv.appendChild(levelIndicator);\n });\n innerDiv.appendChild(initialContent);\n }\n if (this.dataManager.hasChildren(rowObject)) {\n const buttonsContainer = this.hot.rootDocument.createElement('DIV');\n if (ariaEnabled) {\n setAttribute(buttonsContainer, [A11Y_HIDDEN()]);\n }\n addClass(TH, HeadersUI.CSS_CLASSES.parent);\n if (this.collapsingUI.areChildrenCollapsed(rowIndex)) {\n addClass(buttonsContainer, `${HeadersUI.CSS_CLASSES.button} ${HeadersUI.CSS_CLASSES.expandButton}`);\n if (ariaEnabled) {\n setAttribute(TH, [A11Y_EXPANDED(false)]);\n }\n } else {\n addClass(buttonsContainer, `${HeadersUI.CSS_CLASSES.button} ${HeadersUI.CSS_CLASSES.collapseButton}`);\n if (ariaEnabled) {\n setAttribute(TH, [A11Y_EXPANDED(true)]);\n }\n }\n innerDiv.appendChild(buttonsContainer);\n }\n }\n\n /**\n * Update the row header width according to number of levels in the dataset.\n *\n * @private\n * @param {number} deepestLevel Cached deepest level of nesting.\n */\n updateRowHeaderWidth(deepestLevel) {\n let deepestLevelIndex = deepestLevel;\n if (!deepestLevelIndex) {\n deepestLevelIndex = this.dataManager.cache.levelCount;\n }\n this.rowHeaderWidthCache = Math.max(50, 11 + 10 * deepestLevelIndex + 25);\n this.hot.render();\n }\n}\nexport default HeadersUI;", "import \"core-js/modules/es.array.push.js\";\nimport { stopImmediatePropagation } from \"../../../helpers/dom/event.mjs\";\nimport { arrayEach } from \"../../../helpers/array.mjs\";\nimport { rangeEach } from \"../../../helpers/number.mjs\";\nimport { hasClass } from \"../../../helpers/dom/element.mjs\";\nimport BaseUI from \"./_base.mjs\";\nimport HeadersUI from \"./headers.mjs\";\n/**\n * Class responsible for the UI for collapsing and expanding groups.\n *\n * @private\n * @class\n * @augments BaseUI\n */\nclass CollapsingUI extends BaseUI {\n constructor(nestedRowsPlugin, hotInstance) {\n var _this;\n /**\n * Reference to the TrimRows plugin.\n */\n super(nestedRowsPlugin, hotInstance);\n _this = this;\n this.dataManager = this.plugin.dataManager;\n this.collapsedRows = [];\n this.collapsedRowsStash = {\n stash: function () {\n let forceRender = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n _this.lastCollapsedRows = _this.collapsedRows.slice(0);\n\n // Workaround for wrong indexes being set in the trimRows plugin\n _this.expandMultipleChildren(_this.lastCollapsedRows, forceRender);\n },\n shiftStash: function (baseIndex, targetIndex) {\n let delta = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n if (targetIndex === null || targetIndex === undefined) {\n targetIndex = Infinity;\n }\n arrayEach(_this.lastCollapsedRows, (elem, i) => {\n if (elem >= baseIndex && elem < targetIndex) {\n _this.lastCollapsedRows[i] = elem + delta;\n }\n });\n },\n applyStash: function () {\n let forceRender = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n _this.collapseMultipleChildren(_this.lastCollapsedRows, forceRender);\n _this.lastCollapsedRows = undefined;\n },\n trimStash: (realElementIndex, amount) => {\n rangeEach(realElementIndex, realElementIndex + amount - 1, i => {\n const indexOfElement = this.lastCollapsedRows.indexOf(i);\n if (indexOfElement > -1) {\n this.lastCollapsedRows.splice(indexOfElement, 1);\n }\n });\n }\n };\n }\n\n /**\n * Collapse the children of the row passed as an argument.\n *\n * @param {number|object} row The parent row.\n * @param {boolean} [forceRender=true] Whether to render the table after the function ends.\n * @param {boolean} [doTrimming=true] I determine whether collapsing should envolve trimming rows.\n * @returns {Array}\n */\n collapseChildren(row) {\n let forceRender = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n let doTrimming = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n const rowsToCollapse = [];\n let rowObject = null;\n let rowIndex = null;\n let rowsToTrim = null;\n if (isNaN(row)) {\n rowObject = row;\n rowIndex = this.dataManager.getRowIndex(rowObject);\n } else {\n rowObject = this.dataManager.getDataObject(row);\n rowIndex = row;\n }\n if (this.dataManager.hasChildren(rowObject)) {\n arrayEach(rowObject.__children, elem => {\n rowsToCollapse.push(this.dataManager.getRowIndex(elem));\n });\n }\n rowsToTrim = this.collapseRows(rowsToCollapse, true, false);\n if (doTrimming) {\n this.trimRows(rowsToTrim);\n }\n if (forceRender) {\n this.renderAndAdjust();\n }\n if (this.collapsedRows.indexOf(rowIndex) === -1) {\n this.collapsedRows.push(rowIndex);\n }\n return rowsToTrim;\n }\n\n /**\n * Collapse multiple children.\n *\n * @param {Array} rows Rows to collapse (including their children).\n * @param {boolean} [forceRender=true] `true` if the table should be rendered after finishing the function.\n * @param {boolean} [doTrimming=true] I determine whether collapsing should envolve trimming rows.\n */\n collapseMultipleChildren(rows) {\n let forceRender = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n let doTrimming = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n const rowsToTrim = [];\n arrayEach(rows, elem => {\n rowsToTrim.push(...this.collapseChildren(elem, false, false));\n });\n if (doTrimming) {\n this.trimRows(rowsToTrim);\n }\n if (forceRender) {\n this.renderAndAdjust();\n }\n }\n\n /**\n * Collapse a single row.\n *\n * @param {number} rowIndex Index of the row to collapse.\n * @param {boolean} [recursive=true] `true` if it should collapse the row's children.\n */\n collapseRow(rowIndex) {\n let recursive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n this.collapseRows([rowIndex], recursive);\n }\n\n /**\n * Collapse multiple rows.\n *\n * @param {Array} rowIndexes Array of row indexes to collapse.\n * @param {boolean} [recursive=true] `true` if it should collapse the rows' children.\n * @param {boolean} [doTrimming=true] I determine whether collapsing should envolve trimming rows.\n * @returns {Array} Rows prepared for trimming (or trimmed, if doTrimming == true).\n */\n collapseRows(rowIndexes) {\n let recursive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n let doTrimming = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n const rowsToTrim = [];\n arrayEach(rowIndexes, elem => {\n rowsToTrim.push(elem);\n if (recursive) {\n this.collapseChildRows(elem, rowsToTrim);\n }\n });\n if (doTrimming) {\n this.trimRows(rowsToTrim);\n }\n return rowsToTrim;\n }\n\n /**\n * Collapse child rows of the row at the provided index.\n *\n * @param {number} parentIndex Index of the parent node.\n * @param {Array} [rowsToTrim=[]] Array of rows to trim. Defaults to an empty array.\n * @param {boolean} [recursive] `true` if the collapsing process should be recursive.\n * @param {boolean} [doTrimming=true] I determine whether collapsing should envolve trimming rows.\n */\n collapseChildRows(parentIndex) {\n let rowsToTrim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n let recursive = arguments.length > 2 ? arguments[2] : undefined;\n let doTrimming = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n if (this.dataManager.hasChildren(parentIndex)) {\n const parentObject = this.dataManager.getDataObject(parentIndex);\n arrayEach(parentObject.__children, elem => {\n const elemIndex = this.dataManager.getRowIndex(elem);\n rowsToTrim.push(elemIndex);\n this.collapseChildRows(elemIndex, rowsToTrim);\n });\n }\n if (doTrimming) {\n this.trimRows(rowsToTrim);\n }\n }\n\n /**\n * Expand a single row.\n *\n * @param {number} rowIndex Index of the row to expand.\n * @param {boolean} [recursive=true] `true` if it should expand the row's children recursively.\n */\n expandRow(rowIndex) {\n let recursive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n this.expandRows([rowIndex], recursive);\n }\n\n /**\n * Expand multiple rows.\n *\n * @param {Array} rowIndexes Array of indexes of the rows to expand.\n * @param {boolean} [recursive=true] `true` if it should expand the rows' children recursively.\n * @param {boolean} [doTrimming=true] I determine whether collapsing should envolve trimming rows.\n * @returns {Array} Array of row indexes to be untrimmed.\n */\n expandRows(rowIndexes) {\n let recursive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n let doTrimming = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n const rowsToUntrim = [];\n arrayEach(rowIndexes, elem => {\n rowsToUntrim.push(elem);\n if (recursive) {\n this.expandChildRows(elem, rowsToUntrim);\n }\n });\n if (doTrimming) {\n this.untrimRows(rowsToUntrim);\n }\n return rowsToUntrim;\n }\n\n /**\n * Expand child rows of the provided index.\n *\n * @param {number} parentIndex Index of the parent row.\n * @param {Array} [rowsToUntrim=[]] Array of the rows to be untrimmed.\n * @param {boolean} [recursive] `true` if it should expand the rows' children recursively.\n * @param {boolean} [doTrimming=false] I determine whether collapsing should envolve trimming rows.\n */\n expandChildRows(parentIndex) {\n let rowsToUntrim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n let recursive = arguments.length > 2 ? arguments[2] : undefined;\n let doTrimming = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n if (this.dataManager.hasChildren(parentIndex)) {\n const parentObject = this.dataManager.getDataObject(parentIndex);\n arrayEach(parentObject.__children, elem => {\n if (!this.isAnyParentCollapsed(elem)) {\n const elemIndex = this.dataManager.getRowIndex(elem);\n rowsToUntrim.push(elemIndex);\n this.expandChildRows(elemIndex, rowsToUntrim);\n }\n });\n }\n if (doTrimming) {\n this.untrimRows(rowsToUntrim);\n }\n }\n\n /**\n * Expand the children of the row passed as an argument.\n *\n * @param {number|object} row Parent row.\n * @param {boolean} [forceRender=true] Whether to render the table after the function ends.\n * @param {boolean} [doTrimming=true] If set to `true`, the trimming will be applied when the function finishes.\n * @returns {number[]}\n */\n expandChildren(row) {\n let forceRender = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n let doTrimming = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n const rowsToExpand = [];\n let rowObject = null;\n let rowIndex = null;\n let rowsToUntrim = null;\n if (isNaN(row)) {\n rowObject = row;\n rowIndex = this.dataManager.getRowIndex(row);\n } else {\n rowObject = this.dataManager.getDataObject(row);\n rowIndex = row;\n }\n this.collapsedRows.splice(this.collapsedRows.indexOf(rowIndex), 1);\n if (this.dataManager.hasChildren(rowObject)) {\n arrayEach(rowObject.__children, elem => {\n const childIndex = this.dataManager.getRowIndex(elem);\n rowsToExpand.push(childIndex);\n });\n }\n rowsToUntrim = this.expandRows(rowsToExpand, true, false);\n if (doTrimming) {\n this.untrimRows(rowsToUntrim);\n }\n if (forceRender) {\n this.renderAndAdjust();\n }\n return rowsToUntrim;\n }\n\n /**\n * Expand multiple rows' children.\n *\n * @param {Array} rows Array of rows which children are about to be expanded.\n * @param {boolean} [forceRender=true] `true` if the table should render after finishing the function.\n * @param {boolean} [doTrimming=true] `true` if the rows should be untrimmed after finishing the function.\n */\n expandMultipleChildren(rows) {\n let forceRender = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n let doTrimming = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n const rowsToUntrim = [];\n arrayEach(rows, elem => {\n rowsToUntrim.push(...this.expandChildren(elem, false, false));\n });\n if (doTrimming) {\n this.untrimRows(rowsToUntrim);\n }\n if (forceRender) {\n this.renderAndAdjust();\n }\n }\n\n /**\n * Collapse all collapsable rows.\n */\n collapseAll() {\n const data = this.dataManager.getData();\n const parentsToCollapse = [];\n arrayEach(data, elem => {\n if (this.dataManager.hasChildren(elem)) {\n parentsToCollapse.push(elem);\n }\n });\n this.collapseMultipleChildren(parentsToCollapse);\n this.renderAndAdjust();\n }\n\n /**\n * Expand all collapsable rows.\n */\n expandAll() {\n const data = this.dataManager.getData();\n const parentsToExpand = [];\n arrayEach(data, elem => {\n if (this.dataManager.hasChildren(elem)) {\n parentsToExpand.push(elem);\n }\n });\n this.expandMultipleChildren(parentsToExpand);\n this.renderAndAdjust();\n }\n\n /**\n * Trim rows.\n *\n * @param {Array} rows Physical row indexes.\n */\n trimRows(rows) {\n this.hot.batchExecution(() => {\n arrayEach(rows, physicalRow => {\n this.plugin.collapsedRowsMap.setValueAtIndex(physicalRow, true);\n });\n }, true);\n }\n\n /**\n * Untrim rows.\n *\n * @param {Array} rows Physical row indexes.\n */\n untrimRows(rows) {\n this.hot.batchExecution(() => {\n arrayEach(rows, physicalRow => {\n this.plugin.collapsedRowsMap.setValueAtIndex(physicalRow, false);\n });\n }, true);\n }\n\n /**\n * Check if all child rows are collapsed.\n *\n * @private\n * @param {number|object|null} row The parent row. `null` for the top level.\n * @returns {boolean}\n */\n areChildrenCollapsed(row) {\n let rowObj = isNaN(row) ? row : this.dataManager.getDataObject(row);\n let allCollapsed = true;\n\n // Checking the children of the top-level \"parent\"\n if (rowObj === null) {\n rowObj = {\n __children: this.dataManager.data\n };\n }\n if (this.dataManager.hasChildren(rowObj)) {\n arrayEach(rowObj.__children, elem => {\n const rowIndex = this.dataManager.getRowIndex(elem);\n if (!this.plugin.collapsedRowsMap.getValueAtIndex(rowIndex)) {\n allCollapsed = false;\n return false;\n }\n });\n }\n return allCollapsed;\n }\n\n /**\n * Check if any of the row object parents are collapsed.\n *\n * @private\n * @param {object} rowObj Row object.\n * @returns {boolean}\n */\n isAnyParentCollapsed(rowObj) {\n let parent = rowObj;\n while (parent !== null) {\n parent = this.dataManager.getRowParent(parent);\n const parentIndex = this.dataManager.getRowIndex(parent);\n if (this.collapsedRows.indexOf(parentIndex) > -1) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Toggle collapsed state. Callback for the `beforeOnCellMousedown` hook.\n *\n * @private\n * @param {MouseEvent} event `mousedown` event.\n * @param {object} coords Coordinates of the clicked cell/header.\n */\n toggleState(event, coords) {\n if (coords.col >= 0) {\n return;\n }\n const row = this.translateTrimmedRow(coords.row);\n if (hasClass(event.target, HeadersUI.CSS_CLASSES.button)) {\n if (this.areChildrenCollapsed(row)) {\n this.expandChildren(row);\n } else {\n this.collapseChildren(row);\n }\n stopImmediatePropagation(event);\n }\n }\n\n /**\n * Translate visual row after trimming to physical base row index.\n *\n * @private\n * @param {number} row Row index.\n * @returns {number} Base row index.\n */\n translateTrimmedRow(row) {\n return this.hot.toPhysicalRow(row);\n }\n\n /**\n * Translate physical row after trimming to visual base row index.\n *\n * @private\n * @param {number} row Row index.\n * @returns {number} Base row index.\n */\n untranslateTrimmedRow(row) {\n return this.hot.toVisualRow(row);\n }\n\n /**\n * Helper function to render the table and call the `adjustElementsSize` method.\n *\n * @private\n */\n renderAndAdjust() {\n this.hot.render();\n\n // Dirty workaround to prevent scroll height not adjusting to the table height. Needs refactoring in the future.\n this.hot.view.adjustElementsSize();\n }\n}\nexport default CollapsingUI;", "import \"core-js/modules/es.error.cause.js\";\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { rangeEach } from \"../../../helpers/number.mjs\";\nimport { arrayEach } from \"../../../helpers/array.mjs\";\nimport * as C from \"../../../i18n/constants.mjs\";\nimport BaseUI from \"./_base.mjs\";\n/**\n * Class responsible for the Context Menu entries for the Nested Rows plugin.\n *\n * @private\n * @class ContextMenuUI\n * @augments BaseUI\n */\nvar _menuEntries = /*#__PURE__*/new WeakMap();\nclass ContextMenuUI extends BaseUI {\n constructor() {\n super(...arguments);\n /**\n * Reference to the DataManager instance connected with the Nested Rows plugin.\n *\n * @type {DataManager}\n */\n _defineProperty(this, \"dataManager\", this.plugin.dataManager);\n _classPrivateFieldInitSpec(this, _menuEntries, {\n row_above: (key, selection) => {\n const lastSelection = selection[selection.length - 1];\n this.dataManager.addSibling(lastSelection.start.row, 'above');\n },\n row_below: (key, selection) => {\n const lastSelection = selection[selection.length - 1];\n this.dataManager.addSibling(lastSelection.start.row, 'below');\n }\n });\n }\n /**\n * Append options to the context menu. (Propagated from the `afterContextMenuDefaultOptions` hook callback)\n * f.\n *\n * @private\n * @param {object} defaultOptions Default context menu options.\n * @returns {*}\n */\n appendOptions(defaultOptions) {\n const newEntries = [{\n key: 'add_child',\n name() {\n return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_NESTED_ROWS_INSERT_CHILD);\n },\n callback: () => {\n const translatedRowIndex = this.dataManager.translateTrimmedRow(this.hot.getSelectedLast()[0]);\n const parent = this.dataManager.getDataObject(translatedRowIndex);\n this.dataManager.addChild(parent);\n },\n disabled: () => {\n const selected = this.hot.getSelectedLast();\n return !selected || selected[0] < 0 || this.hot.selection.isSelectedByColumnHeader() || this.hot.countRows() >= this.hot.getSettings().maxRows;\n }\n }, {\n key: 'detach_from_parent',\n name() {\n return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_NESTED_ROWS_DETACH_CHILD);\n },\n callback: () => {\n this.dataManager.detachFromParent(this.hot.getSelectedLast());\n },\n disabled: () => {\n const selected = this.hot.getSelectedLast();\n const translatedRowIndex = this.dataManager.translateTrimmedRow(selected[0]);\n const parent = this.dataManager.getRowParent(translatedRowIndex);\n return !parent || !selected || selected[0] < 0 || this.hot.selection.isSelectedByColumnHeader() || this.hot.countRows() >= this.hot.getSettings().maxRows;\n }\n }, {\n name: '---------'\n }];\n rangeEach(0, defaultOptions.items.length - 1, i => {\n if (i === 0) {\n arrayEach(newEntries, (val, j) => {\n defaultOptions.items.splice(i + j, 0, val);\n });\n return false;\n }\n });\n return this.modifyRowInsertingOptions(defaultOptions);\n }\n\n /**\n * Modify how the row inserting options work.\n *\n * @private\n * @param {object} defaultOptions Default context menu items.\n * @returns {*}\n */\n modifyRowInsertingOptions(defaultOptions) {\n rangeEach(0, defaultOptions.items.length - 1, i => {\n const option = _classPrivateFieldGet(_menuEntries, this)[defaultOptions.items[i].key];\n if (option !== null && option !== undefined) {\n defaultOptions.items[i].callback = option;\n }\n });\n return defaultOptions;\n }\n}\nexport default ContextMenuUI;", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { isUndefined } from \"../../../helpers/mixed.mjs\";\nimport { warn } from \"../../../helpers/console.mjs\";\nimport { toSingleLine } from \"../../../helpers/templateLiteralTag.mjs\";\n/**\n * Helper class for the row-move-related operations.\n *\n * @private\n * @class RowMoveController\n */\nexport default class RowMoveController {\n constructor(plugin) {\n /**\n * Reference to the Nested Rows plugin instance.\n *\n * @type {NestedRows}\n */\n _defineProperty(this, \"plugin\", void 0);\n /**\n * Reference to the Handsontable instance.\n *\n * @type {Handsontable.Core}\n */\n _defineProperty(this, \"hot\", void 0);\n /**\n * Reference to the Data Manager class instance.\n *\n * @type {DataManager}\n */\n _defineProperty(this, \"dataManager\", void 0);\n /**\n * Reference to the Collapsing UI class instance.\n *\n * @type {CollapsingUI}\n */\n _defineProperty(this, \"collapsingUI\", void 0);\n this.plugin = plugin;\n this.hot = plugin.hot;\n this.dataManager = plugin.dataManager;\n this.collapsingUI = plugin.collapsingUI;\n }\n\n /**\n * `beforeRowMove` hook callback.\n *\n * @param {Array} rows Array of visual row indexes to be moved.\n * @param {number} finalIndex Visual row index, being a start index for the moved rows. Points to where the elements\n * will be placed after the moving action. To check the visualization of the final index, please take a look at\n * [documentation](@/guides/rows/row-moving/row-moving.md).\n * @param {undefined|number} dropIndex Visual row index, being a drop index for the moved rows. Points to where we\n * are going to drop the moved elements. To check visualization of drop index please take a look at\n * [documentation](@/guides/rows/row-moving/row-moving.md).\n * @param {boolean} movePossible Indicates if it's possible to move rows to the desired position.\n * @fires Hooks#afterRowMove\n * @returns {boolean}\n */\n onBeforeRowMove(rows, finalIndex, dropIndex, movePossible) {\n const improperUsage = this.displayAPICompatibilityWarning({\n rows,\n finalIndex,\n dropIndex,\n movePossible\n });\n if (improperUsage) {\n return false;\n }\n this.movedToCollapsed = false;\n const dropToLastRow = dropIndex === this.hot.countRows();\n const physicalDropIndex = dropToLastRow ? this.hot.countSourceRows() : this.dataManager.translateTrimmedRow(dropIndex);\n let allowMove = true;\n const physicalStartIndexes = rows.map(rowIndex => {\n // Don't do the logic for the rest of the rows, as it's bound to fail anyway.\n if (!allowMove) {\n return false;\n }\n const physicalRowIndex = this.dataManager.translateTrimmedRow(rowIndex);\n allowMove = this.shouldAllowMoving(physicalRowIndex, physicalDropIndex);\n return physicalRowIndex;\n });\n const willDataChange = physicalStartIndexes.indexOf(physicalDropIndex) === -1;\n if (!allowMove || !willDataChange) {\n return false;\n }\n const baseParent = this.getBaseParent(physicalStartIndexes);\n const targetParent = this.getTargetParent(dropToLastRow, physicalDropIndex);\n const sameParent = baseParent === targetParent;\n this.movedToCollapsed = this.collapsingUI.areChildrenCollapsed(targetParent);\n\n // Stash the current state of collapsed rows\n this.collapsingUI.collapsedRowsStash.stash();\n this.shiftCollapsibleParentsLocations(physicalStartIndexes, physicalDropIndex, sameParent);\n this.moveRows(physicalStartIndexes, physicalDropIndex, targetParent);\n this.dataManager.rewriteCache();\n this.moveCellsMeta(physicalStartIndexes, physicalDropIndex);\n this.collapsingUI.collapsedRowsStash.applyStash(false);\n\n // TODO: Trying to mock real work of the `ManualRowMove` plugin. It was blocked by returning `false` below.\n this.hot.runHooks('afterRowMove', rows, finalIndex, dropIndex, movePossible, movePossible && this.isRowOrderChanged(rows, finalIndex));\n\n // Not necessary - added to keep compatibility with other plugins (namely: columnSummary).\n this.hot.render();\n this.selectCells(rows, dropIndex);\n return false;\n }\n\n /**\n * Display a `dragRows`/`moveRows` method compatibility warning if needed.\n *\n * @param {object} beforeMoveRowHookArgs A set of arguments from the `beforeMoveRow` hook.\n * @returns {boolean} `true` if is a result of an improper usage of the moving API.\n */\n displayAPICompatibilityWarning(beforeMoveRowHookArgs) {\n const {\n rows,\n finalIndex,\n dropIndex,\n movePossible\n } = beforeMoveRowHookArgs;\n let shouldTerminate = false;\n if (isUndefined(dropIndex)) {\n warn(toSingleLine`Since version 8.0.0 of the Handsontable the 'moveRows' method isn't used for moving rows\\x20\n when the NestedRows plugin is enabled. Please use the 'dragRows' method instead.`);\n\n // TODO: Trying to mock real work of the `ManualRowMove` plugin. It was blocked by returning `false` below.\n this.hot.runHooks('afterRowMove', rows, finalIndex, dropIndex, movePossible, false);\n shouldTerminate = true;\n }\n return shouldTerminate;\n }\n\n /**\n * Check if the moving action should be allowed.\n *\n * @param {number} physicalRowIndex Physical start row index.\n * @param {number} physicalDropIndex Physical drop index.\n * @returns {boolean} `true` if it should continue with the moving action.\n */\n shouldAllowMoving(physicalRowIndex, physicalDropIndex) {\n /*\n We can't move rows when any of them is:\n - a parent\n - a top-level element\n - is being moved to the top level\n - is being moved to the position of any of the moved rows (not changing position)\n */\n\n return !(this.dataManager.isParent(physicalRowIndex) || this.dataManager.isRowHighestLevel(physicalRowIndex) || physicalRowIndex === physicalDropIndex || physicalDropIndex === 0);\n }\n\n /**\n * Get the base row parent.\n *\n * @param {number} physicalStartIndexes Physical start row index.\n * @returns {object|null} The base row parent.\n */\n getBaseParent(physicalStartIndexes) {\n return this.dataManager.getRowParent(physicalStartIndexes[0]);\n }\n\n /**\n * Get the target row parent.\n *\n * @param {boolean} dropToLastRow `true` if the row is moved to the last row of the table.\n * @param {number} physicalDropIndex Physical drop row index.\n * @returns {object|null} The target row parent.\n */\n getTargetParent(dropToLastRow, physicalDropIndex) {\n let targetParent = this.dataManager.getRowParent(dropToLastRow ? physicalDropIndex - 1 : physicalDropIndex);\n\n // If we try to move an element to the place of a top-level parent, snap the element to the previous top-level\n // parent's children instead\n if (targetParent === null || targetParent === undefined) {\n targetParent = this.dataManager.getRowParent(physicalDropIndex - 1);\n }\n return targetParent;\n }\n\n /**\n * Shift the cached collapsible rows position according to the move action.\n *\n * @param {number[]} physicalStartIndexes Physical start row indexes.\n * @param {number} physicalDropIndex Physical drop index.\n * @param {boolean} sameParent `true` if the row's being moved between siblings of the same parent.\n */\n shiftCollapsibleParentsLocations(physicalStartIndexes, physicalDropIndex, sameParent) {\n if (!sameParent) {\n if (Math.max(...physicalStartIndexes) <= physicalDropIndex) {\n this.collapsingUI.collapsedRowsStash.shiftStash(physicalStartIndexes[0], physicalDropIndex, -1 * physicalStartIndexes.length);\n } else {\n this.collapsingUI.collapsedRowsStash.shiftStash(physicalDropIndex, physicalStartIndexes[0], physicalStartIndexes.length);\n }\n }\n }\n\n /**\n * Move the rows at the provided coordinates.\n *\n * @param {number[]} physicalStartIndexes Physical indexes of the rows about to be moved.\n * @param {number} physicalDropIndex Physical drop index.\n * @param {object} targetParent Parent of the destination row.\n */\n moveRows(physicalStartIndexes, physicalDropIndex, targetParent) {\n const moveToLastChild = physicalDropIndex === this.dataManager.getRowIndex(targetParent) + this.dataManager.countChildren(targetParent) + 1;\n this.hot.batchRender(() => {\n physicalStartIndexes.forEach(physicalStartIndex => {\n this.dataManager.moveRow(physicalStartIndex, physicalDropIndex, this.movedToCollapsed, moveToLastChild);\n });\n });\n }\n\n /**\n * Move the cell meta for multiple rows.\n *\n * @param {number[]} baseIndexes Array of indexes for the rows being moved.\n * @param {number} targetIndex Index of the destination of the move.\n */\n moveCellsMeta(baseIndexes, targetIndex) {\n const rowsOfMeta = [];\n const movingDown = Math.max(...baseIndexes) < targetIndex;\n baseIndexes.forEach(baseIndex => {\n rowsOfMeta.push(this.hot.getCellMetaAtRow(baseIndex));\n });\n this.hot.spliceCellsMeta(baseIndexes[0], baseIndexes.length);\n this.hot.spliceCellsMeta(targetIndex - (movingDown ? rowsOfMeta.length : 0), 0, ...rowsOfMeta);\n }\n\n /**\n * Select cells after the move.\n *\n * @param {Array} rows Array of visual row indexes to be moved.\n * @param {undefined|number} dropIndex Visual row index, being a drop index for the moved rows. Points to where we\n * are going to drop the moved elements. To check visualization of drop index please take a look at\n * [documentation](@/guides/rows/row-moving/row-moving.md).\n */\n selectCells(rows, dropIndex) {\n const rowsLen = rows.length;\n let startRow = 0;\n let endRow = 0;\n let selection = null;\n let lastColIndex = null;\n if (this.movedToCollapsed) {\n let physicalDropIndex = null;\n if (rows[rowsLen - 1] < dropIndex) {\n physicalDropIndex = this.dataManager.translateTrimmedRow(dropIndex - rowsLen);\n } else {\n physicalDropIndex = this.dataManager.translateTrimmedRow(dropIndex);\n }\n const parentObject = this.dataManager.getRowParent(physicalDropIndex === null ? this.hot.countSourceRows() - 1 : physicalDropIndex - 1);\n const parentIndex = this.dataManager.getRowIndex(parentObject);\n startRow = this.dataManager.untranslateTrimmedRow(parentIndex);\n endRow = startRow;\n } else if (rows[rowsLen - 1] < dropIndex) {\n endRow = dropIndex - 1;\n startRow = endRow - rowsLen + 1;\n } else {\n startRow = dropIndex;\n endRow = startRow + rowsLen - 1;\n }\n selection = this.hot.selection;\n lastColIndex = this.hot.countCols() - 1;\n selection.setRangeStart(this.hot._createCellCoords(startRow, 0));\n selection.setRangeEnd(this.hot._createCellCoords(endRow, lastColIndex), true);\n }\n\n // TODO: Reimplementation of function which is inside the `ManualRowMove` plugin.\n /**\n * Indicates if order of rows was changed.\n *\n * @param {Array} movedRows Array of visual row indexes to be moved.\n * @param {number} finalIndex Visual row index, being a start index for the moved rows. Points to where the elements\n * will be placed after the moving action. To check the visualization of the final index, please take a look at\n * [documentation](@/guides/rows/row-moving/row-moving.md).\n * @returns {boolean}\n */\n isRowOrderChanged(movedRows, finalIndex) {\n return movedRows.some((row, nrOfMovedElement) => row - nrOfMovedElement !== finalIndex);\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/es.set.difference.v2.js\";\nimport \"core-js/modules/es.set.intersection.v2.js\";\nimport \"core-js/modules/es.set.is-disjoint-from.v2.js\";\nimport \"core-js/modules/es.set.is-subset-of.v2.js\";\nimport \"core-js/modules/es.set.is-superset-of.v2.js\";\nimport \"core-js/modules/es.set.symmetric-difference.v2.js\";\nimport \"core-js/modules/es.set.union.v2.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }\nfunction _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport DataManager from \"./data/dataManager.mjs\";\nimport CollapsingUI from \"./ui/collapsing.mjs\";\nimport HeadersUI from \"./ui/headers.mjs\";\nimport ContextMenuUI from \"./ui/contextMenu.mjs\";\nimport { error } from \"../../helpers/console.mjs\";\nimport { isArrayOfObjects } from \"../../helpers/data.mjs\";\nimport { TrimmingMap } from \"../../translations/index.mjs\";\nimport { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from \"../../shortcutContexts/index.mjs\";\nimport RowMoveController from \"./utils/rowMoveController.mjs\";\nexport const PLUGIN_KEY = 'nestedRows';\nexport const PLUGIN_PRIORITY = 300;\nconst SHORTCUTS_GROUP = PLUGIN_KEY;\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n/**\n * Error message for the wrong data type error.\n */\nconst WRONG_DATA_TYPE_ERROR = 'The Nested Rows plugin requires an Array of Objects as a dataset to be' + ' provided. The plugin has been disabled.';\n\n/**\n * @plugin NestedRows\n * @class NestedRows\n *\n * @description\n * Plugin responsible for displaying and operating on data sources with nested structures.\n */\nvar _skipRender = /*#__PURE__*/new WeakMap();\nvar _skipCoreAPIModifiers = /*#__PURE__*/new WeakMap();\nvar _NestedRows_brand = /*#__PURE__*/new WeakSet();\nexport class NestedRows extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * `beforeRowMove` hook callback.\n *\n * @param {Array} rows Array of visual row indexes to be moved.\n * @param {number} finalIndex Visual row index, being a start index for the moved rows. Points to where the elements\n * will be placed after the moving action. To check the visualization of the final index, please take a look at\n * [documentation](@/guides/rows/row-summary/row-summary.md).\n * @param {undefined|number} dropIndex Visual row index, being a drop index for the moved rows. Points to where we\n * are going to drop the moved elements. To check visualization of drop index please take a look at\n * [documentation](@/guides/rows/row-summary/row-summary.md).\n * @param {boolean} movePossible Indicates if it's possible to move rows to the desired position.\n * @fires Hooks#afterRowMove\n * @returns {boolean}\n */\n _classPrivateMethodInitSpec(this, _NestedRows_brand);\n /**\n * Reference to the DataManager instance.\n *\n * @private\n * @type {object}\n */\n _defineProperty(this, \"dataManager\", null);\n /**\n * Reference to the HeadersUI instance.\n *\n * @private\n * @type {object}\n */\n _defineProperty(this, \"headersUI\", null);\n /**\n * Map of skipped rows by plugin.\n *\n * @private\n * @type {null|TrimmingMap}\n */\n _defineProperty(this, \"collapsedRowsMap\", null);\n /**\n * Allows skipping the render cycle if set as `true`.\n *\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _skipRender, false);\n /**\n * Allows skipping the internal Core methods call if set as `true`.\n *\n * @type {boolean}\n */\n _classPrivateFieldInitSpec(this, _skipCoreAPIModifiers, false);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link NestedRows#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n var _this = this;\n if (this.enabled) {\n return;\n }\n this.collapsedRowsMap = this.hot.rowIndexMapper.registerMap('nestedRows', new TrimmingMap());\n this.dataManager = new DataManager(this, this.hot);\n this.collapsingUI = new CollapsingUI(this, this.hot);\n this.headersUI = new HeadersUI(this, this.hot);\n this.contextMenuUI = new ContextMenuUI(this, this.hot);\n this.rowMoveController = new RowMoveController(this);\n this.addHook('afterInit', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onAfterInit).call(_this, ...args);\n });\n this.addHook('beforeViewRender', function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onBeforeViewRender).call(_this, ...args);\n });\n this.addHook('modifyRowData', function () {\n return _this.onModifyRowData(...arguments);\n });\n this.addHook('modifySourceLength', function () {\n return _this.onModifySourceLength(...arguments);\n });\n this.addHook('beforeDataSplice', function () {\n return _this.onBeforeDataSplice(...arguments);\n });\n this.addHook('filterData', function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onFilterData).call(_this, ...args);\n });\n this.addHook('afterContextMenuDefaultOptions', function () {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onAfterContextMenuDefaultOptions).call(_this, ...args);\n });\n this.addHook('afterGetRowHeader', function () {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onAfterGetRowHeader).call(_this, ...args);\n });\n this.addHook('beforeOnCellMouseDown', function () {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onBeforeOnCellMouseDown).call(_this, ...args);\n });\n this.addHook('beforeRemoveRow', function () {\n for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {\n args[_key7] = arguments[_key7];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onBeforeRemoveRow).call(_this, ...args);\n });\n this.addHook('afterRemoveRow', function () {\n for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {\n args[_key8] = arguments[_key8];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onAfterRemoveRow).call(_this, ...args);\n });\n this.addHook('beforeAddChild', function () {\n for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {\n args[_key9] = arguments[_key9];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onBeforeAddChild).call(_this, ...args);\n });\n this.addHook('afterAddChild', function () {\n for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {\n args[_key10] = arguments[_key10];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onAfterAddChild).call(_this, ...args);\n });\n this.addHook('beforeDetachChild', function () {\n for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {\n args[_key11] = arguments[_key11];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onBeforeDetachChild).call(_this, ...args);\n });\n this.addHook('afterDetachChild', function () {\n for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {\n args[_key12] = arguments[_key12];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onAfterDetachChild).call(_this, ...args);\n });\n this.addHook('modifyRowHeaderWidth', function () {\n for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {\n args[_key13] = arguments[_key13];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onModifyRowHeaderWidth).call(_this, ...args);\n });\n this.addHook('afterCreateRow', function () {\n for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {\n args[_key14] = arguments[_key14];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onAfterCreateRow).call(_this, ...args);\n });\n this.addHook('beforeRowMove', function () {\n for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {\n args[_key15] = arguments[_key15];\n }\n return _assertClassBrand(_NestedRows_brand, _this, _onBeforeRowMove).call(_this, ...args);\n });\n this.addHook('beforeLoadData', data => _assertClassBrand(_NestedRows_brand, this, _onBeforeLoadData).call(this, data));\n this.addHook('beforeUpdateData', data => _assertClassBrand(_NestedRows_brand, this, _onBeforeLoadData).call(this, data));\n this.registerShortcuts();\n super.enablePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n this.hot.rowIndexMapper.unregisterMap('nestedRows');\n this.unregisterShortcuts();\n super.disablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`nestedRows`](@/api/options.md#nestedrows)\n */\n updatePlugin() {\n this.disablePlugin();\n\n // We store a state of the data manager.\n const currentSourceData = this.dataManager.getData();\n this.enablePlugin();\n\n // After enabling plugin previously stored data is restored.\n this.dataManager.updateWithData(currentSourceData);\n super.updatePlugin();\n }\n\n /**\n * Register shortcuts responsible for toggling collapsible columns.\n *\n * @private\n */\n registerShortcuts() {\n this.hot.getShortcutManager().getContext('grid').addShortcut({\n keys: [['Enter']],\n callback: () => {\n const {\n highlight\n } = this.hot.getSelectedRangeLast();\n const row = this.collapsingUI.translateTrimmedRow(highlight.row);\n if (this.collapsingUI.areChildrenCollapsed(row)) {\n this.collapsingUI.expandChildren(row);\n } else {\n this.collapsingUI.collapseChildren(row);\n }\n\n // prevent default Enter behavior (move to the next row within a selection range)\n return false;\n },\n runOnlyIf: () => {\n var _this$hot$getSelected, _this$hot$getSelected2;\n const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;\n return highlight && ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.isSingle()) && this.hot.selection.isCellVisible(highlight) && highlight.col === -1 && highlight.row >= 0;\n },\n group: SHORTCUTS_GROUP,\n relativeToGroup: SHORTCUTS_GROUP_EDITOR,\n position: 'before'\n });\n }\n\n /**\n * Unregister shortcuts responsible for toggling collapsible columns.\n *\n * @private\n */\n unregisterShortcuts() {\n this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);\n }\n /**\n * Enable the modify hook skipping flag - allows retrieving the data from Handsontable without this plugin's\n * modifications.\n *\n * @private\n */\n disableCoreAPIModifiers() {\n _classPrivateFieldSet(_skipCoreAPIModifiers, this, true);\n }\n\n /**\n * Disable the modify hook skipping flag.\n *\n * @private\n */\n enableCoreAPIModifiers() {\n _classPrivateFieldSet(_skipCoreAPIModifiers, this, false);\n }\n\n /**\n * `beforeOnCellMousedown` hook callback.\n *\n * @param {MouseEvent} event Mousedown event.\n * @param {object} coords Cell coords.\n * @param {HTMLElement} TD Clicked cell.\n */\n\n /**\n * The modifyRowData hook callback.\n *\n * @private\n * @param {number} row Visual row index.\n * @returns {boolean}\n */\n onModifyRowData(row) {\n if (_classPrivateFieldGet(_skipCoreAPIModifiers, this)) {\n return;\n }\n return this.dataManager.getDataObject(row);\n }\n\n /**\n * Modify the source data length to match the length of the nested structure.\n *\n * @private\n * @returns {number}\n */\n onModifySourceLength() {\n if (_classPrivateFieldGet(_skipCoreAPIModifiers, this)) {\n return;\n }\n return this.dataManager.countAllRows();\n }\n\n /**\n * @private\n * @param {number} index The index where the data was spliced.\n * @param {number} amount An amount of items to remove.\n * @param {object} element An element to add.\n * @returns {boolean}\n */\n onBeforeDataSplice(index, amount, element) {\n if (_classPrivateFieldGet(_skipCoreAPIModifiers, this) || this.dataManager.isRowHighestLevel(index)) {\n return true;\n }\n this.dataManager.spliceData(index, amount, element);\n return false;\n }\n\n /**\n * Provide custom source data filtering. It's handled by core method and replaces the native filtering.\n *\n * @param {number} index The index where the data filtering starts.\n * @param {number} amount An amount of rows which filtering applies to.\n * @param {number} physicalRows Physical row indexes.\n * @returns {Array}\n */\n\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n super.destroy();\n }\n}\nfunction _onBeforeRowMove(rows, finalIndex, dropIndex, movePossible) {\n return this.rowMoveController.onBeforeRowMove(rows, finalIndex, dropIndex, movePossible);\n}\nfunction _onBeforeOnCellMouseDown(event, coords, TD) {\n this.collapsingUI.toggleState(event, coords, TD);\n}\nfunction _onFilterData(index, amount, physicalRows) {\n this.collapsingUI.collapsedRowsStash.stash();\n this.collapsingUI.collapsedRowsStash.trimStash(physicalRows[0], amount);\n this.collapsingUI.collapsedRowsStash.shiftStash(physicalRows[0], null, -1 * amount);\n this.dataManager.filterData(index, amount, physicalRows);\n _classPrivateFieldSet(_skipRender, this, true);\n return this.dataManager.getData().slice(); // Data contains reference sometimes.\n}\n/**\n * `afterContextMenuDefaultOptions` hook callback.\n *\n * @param {object} defaultOptions The default context menu items order.\n * @returns {boolean}\n */\nfunction _onAfterContextMenuDefaultOptions(defaultOptions) {\n return this.contextMenuUI.appendOptions(defaultOptions);\n}\n/**\n * `afterGetRowHeader` hook callback.\n *\n * @param {number} row Row index.\n * @param {HTMLElement} TH Row header element.\n */\nfunction _onAfterGetRowHeader(row, TH) {\n this.headersUI.appendLevelIndicators(row, TH);\n}\n/**\n * `modifyRowHeaderWidth` hook callback.\n *\n * @param {number} rowHeaderWidth The initial row header width(s).\n * @returns {number}\n */\nfunction _onModifyRowHeaderWidth(rowHeaderWidth) {\n return Math.max(this.headersUI.rowHeaderWidthCache, rowHeaderWidth);\n}\n/**\n * `onAfterRemoveRow` hook callback.\n *\n * @param {number} index Removed row.\n * @param {number} amount Amount of removed rows.\n * @param {Array} logicRows An array of the removed physical rows.\n * @param {string} source Source of action.\n */\nfunction _onAfterRemoveRow(index, amount, logicRows, source) {\n if (source === this.pluginName) {\n return;\n }\n this.hot._registerTimeout(() => {\n _classPrivateFieldSet(_skipRender, this, false);\n this.headersUI.updateRowHeaderWidth();\n this.collapsingUI.collapsedRowsStash.applyStash();\n });\n}\n/**\n * Callback for the `beforeRemoveRow` change list of removed physical indexes by reference. Removing parent node\n * has effect in removing children nodes.\n *\n * @param {number} index Visual index of starter row.\n * @param {number} amount Amount of rows to be removed.\n * @param {Array} physicalRows List of physical indexes.\n */\nfunction _onBeforeRemoveRow(index, amount, physicalRows) {\n const modifiedPhysicalRows = Array.from(physicalRows.reduce((removedRows, physicalIndex) => {\n if (this.dataManager.isParent(physicalIndex)) {\n const children = this.dataManager.getDataObject(physicalIndex).__children;\n\n // Preserve a parent in the list of removed rows.\n removedRows.add(physicalIndex);\n if (Array.isArray(children)) {\n // Add a children to the list of removed rows.\n children.forEach(child => removedRows.add(this.dataManager.getRowIndex(child)));\n }\n return removedRows;\n }\n\n // Don't modify list of removed rows when already checked element isn't a parent.\n return removedRows.add(physicalIndex);\n }, new Set()));\n\n // Modifying hook's argument by the reference.\n physicalRows.length = 0;\n physicalRows.push(...modifiedPhysicalRows);\n}\n/**\n * `beforeAddChild` hook callback.\n */\nfunction _onBeforeAddChild() {\n this.collapsingUI.collapsedRowsStash.stash();\n}\n/**\n * `afterAddChild` hook callback.\n *\n * @param {object} parent Parent element.\n * @param {object} element New child element.\n */\nfunction _onAfterAddChild(parent, element) {\n this.collapsingUI.collapsedRowsStash.shiftStash(this.dataManager.getRowIndex(element));\n this.collapsingUI.collapsedRowsStash.applyStash();\n this.headersUI.updateRowHeaderWidth();\n}\n/**\n * `beforeDetachChild` hook callback.\n */\nfunction _onBeforeDetachChild() {\n this.collapsingUI.collapsedRowsStash.stash();\n}\n/**\n * `afterDetachChild` hook callback.\n *\n * @param {object} parent Parent element.\n * @param {object} element New child element.\n * @param {number} finalElementRowIndex The final row index of the detached element.\n */\nfunction _onAfterDetachChild(parent, element, finalElementRowIndex) {\n this.collapsingUI.collapsedRowsStash.shiftStash(finalElementRowIndex, null, -1);\n this.collapsingUI.collapsedRowsStash.applyStash();\n this.headersUI.updateRowHeaderWidth();\n}\n/**\n * `afterCreateRow` hook callback.\n */\nfunction _onAfterCreateRow() {\n this.dataManager.rewriteCache();\n}\n/**\n * `afterInit` hook callback.\n */\nfunction _onAfterInit() {\n this.headersUI.updateRowHeaderWidth();\n}\n/**\n * `beforeViewRender` hook callback.\n *\n * @param {boolean} force Indicates if the render call was triggered by a change of settings or data.\n * @param {object} skipRender An object, holder for skipRender functionality.\n */\nfunction _onBeforeViewRender(force, skipRender) {\n if (_classPrivateFieldGet(_skipRender, this)) {\n skipRender.skipRender = true;\n }\n}\n/**\n * `beforeLoadData` hook callback.\n *\n * @param {Array} data The source data.\n */\nfunction _onBeforeLoadData(data) {\n if (!isArrayOfObjects(data)) {\n error(WRONG_DATA_TYPE_ERROR);\n this.hot.getSettings()[PLUGIN_KEY] = false;\n this.disablePlugin();\n return;\n }\n this.dataManager.setData(data);\n this.dataManager.rewriteCache();\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, NestedRows } from \"./nestedRows.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/es.json.stringify.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { arrayEach } from \"../../helpers/array.mjs\";\n/**\n * @private\n * @class Storage\n */\nclass Storage {\n // eslint-disable-next-line no-restricted-globals\n constructor(prefix) {\n let rootWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;\n /**\n * Reference to proper window.\n *\n * @type {Window}\n */\n _defineProperty(this, \"rootWindow\", void 0);\n /**\n * Prefix for key (id element).\n *\n * @type {string}\n */\n _defineProperty(this, \"prefix\", void 0);\n /**\n * Saved keys.\n *\n * @type {Array}\n */\n _defineProperty(this, \"savedKeys\", []);\n this.rootWindow = rootWindow;\n this.prefix = prefix;\n this.loadSavedKeys();\n }\n\n /**\n * Save data to localStorage.\n *\n * @param {string} key Key string.\n * @param {Mixed} value Value to save.\n */\n saveValue(key, value) {\n this.rootWindow.localStorage.setItem(`${this.prefix}_${key}`, JSON.stringify(value));\n if (this.savedKeys.indexOf(key) === -1) {\n this.savedKeys.push(key);\n this.saveSavedKeys();\n }\n }\n\n /**\n * Load data from localStorage.\n *\n * @param {string} key Key string.\n * @param {object} defaultValue Object containing the loaded data.\n *\n * @returns {object|undefined}\n */\n loadValue(key, defaultValue) {\n const itemKey = typeof key === 'undefined' ? defaultValue : key;\n const value = this.rootWindow.localStorage.getItem(`${this.prefix}_${itemKey}`);\n return value === null ? undefined : JSON.parse(value);\n }\n\n /**\n * Reset given data from localStorage.\n *\n * @param {string} key Key string.\n */\n reset(key) {\n this.rootWindow.localStorage.removeItem(`${this.prefix}_${key}`);\n }\n\n /**\n * Reset all data from localStorage.\n *\n */\n resetAll() {\n arrayEach(this.savedKeys, (value, index) => {\n this.rootWindow.localStorage.removeItem(`${this.prefix}_${this.savedKeys[index]}`);\n });\n this.clearSavedKeys();\n }\n\n /**\n * Load and save all keys from localStorage.\n *\n * @private\n */\n loadSavedKeys() {\n const keysJSON = this.rootWindow.localStorage.getItem(`${this.prefix}__persistentStateKeys`);\n const keys = typeof keysJSON === 'string' ? JSON.parse(keysJSON) : undefined;\n this.savedKeys = keys || [];\n }\n\n /**\n * Save saved key in localStorage.\n *\n * @private\n */\n saveSavedKeys() {\n this.rootWindow.localStorage.setItem(`${this.prefix}__persistentStateKeys`, JSON.stringify(this.savedKeys));\n }\n\n /**\n * Clear saved key from localStorage.\n *\n * @private\n */\n clearSavedKeys() {\n this.savedKeys.length = 0;\n this.saveSavedKeys();\n }\n}\nexport default Storage;", "import \"core-js/modules/es.error.cause.js\";\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport Storage from \"./storage.mjs\";\nimport Hooks from \"../../pluginHooks.mjs\";\nHooks.getSingleton().register('persistentStateSave');\nHooks.getSingleton().register('persistentStateLoad');\nHooks.getSingleton().register('persistentStateReset');\nexport const PLUGIN_KEY = 'persistentState';\nexport const PLUGIN_PRIORITY = 0;\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @plugin PersistentState\n * @class PersistentState\n *\n * @description\n * Save the state of column sorting, column positions and column sizes in local storage to preserve table state\n * between page reloads.\n *\n * In order to enable data storage mechanism, {@link Options#persistentState} option must be set to `true`.\n *\n * When persistentState is enabled it exposes 3 hooks:\n * - {@link Hooks#persistentStateSave} - Saves value under given key in browser local storage.\n * - {@link Hooks#persistentStateLoad} - Loads value, saved under given key, from browser local storage. The loaded\n * value will be saved in `saveTo.value`.\n * - {@link Hooks#persistentStateReset} - Clears the value saved under key. If no key is given, all values associated\n * with table will be cleared.\n *\n * __Note:__ The main reason behind using `persistentState` hooks rather than regular LocalStorage API is that it\n * ensures separation of data stored by multiple Handsontable instances. In other words, if you have two (or more)\n * instances of Handsontable on one page, data saved by one instance won't be accessible by the second instance.\n * Those two instances can store data under the same key and no data would be overwritten.\n *\n * __Important:__ In order for the data separation to work properly, make sure that each instance of Handsontable has a unique `id`.\n *\n */\nexport class PersistentState extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * Instance of {@link Storage}.\n *\n * @private\n * @type {Storage}\n */\n _defineProperty(this, \"storage\", void 0);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link PersistentState#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n if (this.enabled) {\n return;\n }\n if (!this.storage) {\n this.storage = new Storage(this.hot.rootElement.id, this.hot.rootWindow);\n }\n this.addHook('persistentStateSave', (key, value) => this.saveValue(key, value));\n this.addHook('persistentStateLoad', (key, saveTo) => this.loadValue(key, saveTo));\n this.addHook('persistentStateReset', () => this.resetValue());\n super.enablePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n this.storage = undefined;\n super.disablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`persistentState`](@/api/options.md#persistentstate)\n */\n updatePlugin() {\n this.disablePlugin();\n this.enablePlugin();\n super.updatePlugin();\n }\n\n /**\n * Loads the value from local storage.\n *\n * @param {string} key Storage key.\n * @param {object} saveTo Saved value from local storage.\n */\n loadValue(key, saveTo) {\n saveTo.value = this.storage.loadValue(key);\n }\n\n /**\n * Saves the data to local storage.\n *\n * @param {string} key Storage key.\n * @param {Mixed} value Value to save.\n */\n saveValue(key, value) {\n this.storage.saveValue(key, value);\n }\n\n /**\n * Resets the data or all data from local storage.\n *\n * @param {string} key [optional] Storage key.\n */\n resetValue(key) {\n if (typeof key === 'undefined') {\n this.storage.resetAll();\n } else {\n this.storage.reset(key);\n }\n }\n\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n super.destroy();\n }\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, PersistentState } from \"./persistentState.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport { isObject } from \"../../helpers/object.mjs\";\nimport { rangeEach } from \"../../helpers/number.mjs\";\nimport { isUndefined } from \"../../helpers/mixed.mjs\";\nexport const PLUGIN_KEY = 'search';\nexport const PLUGIN_PRIORITY = 190;\nconst DEFAULT_SEARCH_RESULT_CLASS = 'htSearchResult';\nconst DEFAULT_CALLBACK = function (instance, row, col, data, testResult) {\n instance.getCellMeta(row, col).isSearchResult = testResult;\n};\nconst DEFAULT_QUERY_METHOD = function (query, value, cellProperties) {\n if (isUndefined(query) || query === null || !query.toLocaleLowerCase || query.length === 0) {\n return false;\n }\n if (isUndefined(value) || value === null) {\n return false;\n }\n return value.toString().toLocaleLowerCase(cellProperties.locale).indexOf(query.toLocaleLowerCase(cellProperties.locale)) !== -1;\n};\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @plugin Search\n * @class Search\n *\n * @description\n * The search plugin provides an easy interface to search data across Handsontable.\n *\n * In order to enable search mechanism, {@link Options#search} option must be set to `true`.\n *\n * @example\n * ```js\n * // as boolean\n * search: true\n * // as a object with one or more options\n * search: {\n * callback: myNewCallbackFunction,\n * queryMethod: myNewQueryMethod,\n * searchResultClass: 'customClass'\n * }\n *\n * // Access to search plugin instance:\n * const searchPlugin = hot.getPlugin('search');\n *\n * // Set callback programmatically:\n * searchPlugin.setCallback(myNewCallbackFunction);\n * // Set query method programmatically:\n * searchPlugin.setQueryMethod(myNewQueryMethod);\n * // Set search result cells class programmatically:\n * searchPlugin.setSearchResultClass(customClass);\n * ```\n */\nvar _Search_brand = /*#__PURE__*/new WeakSet();\nexport class Search extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * The `beforeRenderer` hook callback.\n *\n * @param {HTMLTableCellElement} TD The rendered `TD` element.\n * @param {number} row Visual row index.\n * @param {number} col Visual column index.\n * @param {string|number} prop Column property name or a column index, if datasource is an array of arrays.\n * @param {string} value Value of the rendered cell.\n * @param {object} cellProperties Object containing the cell's properties.\n */\n _classPrivateMethodInitSpec(this, _Search_brand);\n /**\n * Function called during querying for each cell from the {@link DataMap}.\n *\n * @private\n * @type {Function}\n */\n _defineProperty(this, \"callback\", DEFAULT_CALLBACK);\n /**\n * Query function is responsible for determining whether a query matches the value stored in a cell.\n *\n * @private\n * @type {Function}\n */\n _defineProperty(this, \"queryMethod\", DEFAULT_QUERY_METHOD);\n /**\n * Class name added to each cell that belongs to the searched query.\n *\n * @private\n * @type {string}\n */\n _defineProperty(this, \"searchResultClass\", DEFAULT_SEARCH_RESULT_CLASS);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link AutoRowSize#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n var _this = this;\n if (this.enabled) {\n return;\n }\n const searchSettings = this.hot.getSettings()[PLUGIN_KEY];\n this.updatePluginSettings(searchSettings);\n this.addHook('beforeRenderer', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _assertClassBrand(_Search_brand, _this, _onBeforeRenderer).call(_this, ...args);\n });\n super.enablePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n var _this2 = this;\n const beforeRendererCallback = function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _assertClassBrand(_Search_brand, _this2, _onBeforeRenderer).call(_this2, ...args);\n };\n this.hot.addHook('beforeRenderer', beforeRendererCallback);\n this.hot.addHookOnce('afterViewRender', () => {\n this.hot.removeHook('beforeRenderer', beforeRendererCallback);\n });\n super.disablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`search`](@/api/options.md#search)\n */\n updatePlugin() {\n this.disablePlugin();\n this.enablePlugin();\n super.updatePlugin();\n }\n\n /**\n * Makes the query.\n *\n * @param {string} queryStr Value to be search.\n * @param {Function} [callback] Callback function performed on cells with values which matches to the searched query.\n * @param {Function} [queryMethod] Query function responsible for determining whether a query matches the value stored in a cell.\n * @returns {object[]} Return an array of objects with `row`, `col`, `data` properties or empty array.\n */\n query(queryStr) {\n let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getCallback();\n let queryMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.getQueryMethod();\n const rowCount = this.hot.countRows();\n const colCount = this.hot.countCols();\n const queryResult = [];\n const instance = this.hot;\n rangeEach(0, rowCount - 1, rowIndex => {\n rangeEach(0, colCount - 1, colIndex => {\n const cellData = this.hot.getDataAtCell(rowIndex, colIndex);\n const cellProperties = this.hot.getCellMeta(rowIndex, colIndex);\n const cellCallback = cellProperties.search.callback || callback;\n const cellQueryMethod = cellProperties.search.queryMethod || queryMethod;\n const testResult = cellQueryMethod(queryStr, cellData, cellProperties);\n if (testResult) {\n const singleResult = {\n row: rowIndex,\n col: colIndex,\n data: cellData\n };\n queryResult.push(singleResult);\n }\n if (cellCallback) {\n cellCallback(instance, rowIndex, colIndex, cellData, testResult);\n }\n });\n });\n return queryResult;\n }\n\n /**\n * Gets the callback function.\n *\n * @returns {Function} Return the callback function.\n */\n getCallback() {\n return this.callback;\n }\n\n /**\n * Sets the callback function. This function will be called during querying for each cell.\n *\n * @param {Function} newCallback A callback function.\n */\n setCallback(newCallback) {\n this.callback = newCallback;\n }\n\n /**\n * Gets the query method function.\n *\n * @returns {Function} Return the query method.\n */\n getQueryMethod() {\n return this.queryMethod;\n }\n\n /**\n * Sets the query method function. The function is responsible for determining whether a query matches the value stored in a cell.\n *\n * @param {Function} newQueryMethod A function with specific match logic.\n */\n setQueryMethod(newQueryMethod) {\n this.queryMethod = newQueryMethod;\n }\n\n /**\n * Gets search result cells class name.\n *\n * @returns {string} Return the cell class name.\n */\n getSearchResultClass() {\n return this.searchResultClass;\n }\n\n /**\n * Sets search result cells class name. This class name will be added to each cell that belongs to the searched query.\n *\n * @param {string} newElementClass CSS class name.\n */\n setSearchResultClass(newElementClass) {\n this.searchResultClass = newElementClass;\n }\n\n /**\n * Updates the settings of the plugin.\n *\n * @param {object} searchSettings The plugin settings, taken from Handsontable configuration.\n * @private\n */\n updatePluginSettings(searchSettings) {\n if (isObject(searchSettings)) {\n if (searchSettings.searchResultClass) {\n this.setSearchResultClass(searchSettings.searchResultClass);\n }\n if (searchSettings.queryMethod) {\n this.setQueryMethod(searchSettings.queryMethod);\n }\n if (searchSettings.callback) {\n this.setCallback(searchSettings.callback);\n }\n }\n }\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n super.destroy();\n }\n}\nfunction _onBeforeRenderer(TD, row, col, prop, value, cellProperties) {\n // TODO: #4972\n const className = cellProperties.className || [];\n let classArray = [];\n if (typeof className === 'string') {\n classArray = className.split(' ');\n } else {\n classArray.push(...className);\n }\n if (this.isEnabled() && cellProperties.isSearchResult) {\n if (!classArray.includes(this.searchResultClass)) {\n classArray.push(`${this.searchResultClass}`);\n }\n } else if (classArray.includes(this.searchResultClass)) {\n classArray.splice(classArray.indexOf(this.searchResultClass), 1);\n }\n cellProperties.className = classArray.join(' ');\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, Search } from \"./search.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { addClass, removeClass } from \"../../helpers/dom/element.mjs\";\nimport { arrayEach } from \"../../helpers/array.mjs\";\nimport { BasePlugin } from \"../base/index.mjs\";\nimport { isTouchSupported } from \"../../helpers/feature.mjs\";\nexport const PLUGIN_KEY = 'touchScroll';\nexport const PLUGIN_PRIORITY = 200;\n\n/**\n * @private\n * @plugin TouchScroll\n * @class TouchScroll\n */\nvar _TouchScroll_brand = /*#__PURE__*/new WeakSet();\nexport class TouchScroll extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * After view render listener.\n */\n _classPrivateMethodInitSpec(this, _TouchScroll_brand);\n /**\n * Collection of scrollbars to update.\n *\n * @type {Array}\n */\n _defineProperty(this, \"scrollbars\", []);\n /**\n * Collection of overlays to update.\n *\n * @type {Array}\n */\n _defineProperty(this, \"clones\", []);\n /**\n * Flag which determines if collection of overlays should be refilled on every table render.\n *\n * @type {boolean}\n * @default false\n */\n _defineProperty(this, \"lockedCollection\", false);\n /**\n * Flag which determines if walkontable should freeze overlays while scrolling.\n *\n * @type {boolean}\n * @default false\n */\n _defineProperty(this, \"freezeOverlays\", false);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n static get SETTING_KEYS() {\n return true;\n }\n /**\n * Check if plugin is enabled.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return isTouchSupported();\n }\n\n /**\n * Enable the plugin.\n */\n enablePlugin() {\n if (this.enabled) {\n return;\n }\n this.addHook('afterViewRender', () => _assertClassBrand(_TouchScroll_brand, this, _onAfterViewRender).call(this));\n this.registerEvents();\n super.enablePlugin();\n }\n\n /**\n * Updates the plugin to use the latest options you have specified.\n */\n updatePlugin() {\n this.lockedCollection = false;\n super.updatePlugin();\n }\n\n /**\n * Disable plugin for this Handsontable instance.\n */\n disablePlugin() {\n super.disablePlugin();\n }\n\n /**\n * Register all necessary events.\n *\n * @private\n */\n registerEvents() {\n this.addHook('beforeTouchScroll', () => _assertClassBrand(_TouchScroll_brand, this, _onBeforeTouchScroll).call(this));\n this.addHook('afterMomentumScroll', () => _assertClassBrand(_TouchScroll_brand, this, _onAfterMomentumScroll).call(this));\n }\n}\nfunction _onAfterViewRender() {\n if (this.lockedCollection) {\n return;\n }\n const {\n topOverlay,\n bottomOverlay,\n inlineStartOverlay,\n topInlineStartCornerOverlay,\n bottomInlineStartCornerOverlay\n } = this.hot.view._wt.wtOverlays;\n this.lockedCollection = true;\n this.scrollbars.length = 0;\n this.scrollbars.push(topOverlay);\n if (bottomOverlay.clone) {\n this.scrollbars.push(bottomOverlay);\n }\n this.scrollbars.push(inlineStartOverlay);\n if (topInlineStartCornerOverlay) {\n this.scrollbars.push(topInlineStartCornerOverlay);\n }\n if (bottomInlineStartCornerOverlay && bottomInlineStartCornerOverlay.clone) {\n this.scrollbars.push(bottomInlineStartCornerOverlay);\n }\n this.clones = [];\n if (topOverlay.needFullRender) {\n this.clones.push(topOverlay.clone.wtTable.holder.parentNode);\n }\n if (bottomOverlay.needFullRender) {\n this.clones.push(bottomOverlay.clone.wtTable.holder.parentNode);\n }\n if (inlineStartOverlay.needFullRender) {\n this.clones.push(inlineStartOverlay.clone.wtTable.holder.parentNode);\n }\n if (topInlineStartCornerOverlay) {\n this.clones.push(topInlineStartCornerOverlay.clone.wtTable.holder.parentNode);\n }\n if (bottomInlineStartCornerOverlay && bottomInlineStartCornerOverlay.clone) {\n this.clones.push(bottomInlineStartCornerOverlay.clone.wtTable.holder.parentNode);\n }\n}\n/**\n * Touch scroll listener.\n */\nfunction _onBeforeTouchScroll() {\n this.freezeOverlays = true;\n arrayEach(this.clones, clone => {\n addClass(clone, 'hide-tween');\n });\n}\n/**\n * After momentum scroll listener.\n */\nfunction _onAfterMomentumScroll() {\n this.freezeOverlays = false;\n arrayEach(this.clones, clone => {\n removeClass(clone, 'hide-tween');\n addClass(clone, 'show-tween');\n });\n this.hot._registerTimeout(() => {\n arrayEach(this.clones, clone => {\n removeClass(clone, 'show-tween');\n });\n }, 400);\n arrayEach(this.scrollbars, scrollbar => {\n scrollbar.refresh();\n scrollbar.resetFixedPosition();\n });\n this.hot.view._wt.wtOverlays.syncScrollWithMaster();\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, TouchScroll } from \"./touchScroll.mjs\";", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/es.set.difference.v2.js\";\nimport \"core-js/modules/es.set.intersection.v2.js\";\nimport \"core-js/modules/es.set.is-disjoint-from.v2.js\";\nimport \"core-js/modules/es.set.is-subset-of.v2.js\";\nimport \"core-js/modules/es.set.is-superset-of.v2.js\";\nimport \"core-js/modules/es.set.symmetric-difference.v2.js\";\nimport \"core-js/modules/es.set.union.v2.js\";\nfunction _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }\nfunction _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _assertClassBrand(e, t, n) { if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError(\"Private element is not present on this object\"); }\nimport { BasePlugin } from \"../base/index.mjs\";\nimport { TrimmingMap } from \"../../translations/index.mjs\";\nimport { arrayEach, arrayReduce } from \"../../helpers/array.mjs\";\nexport const PLUGIN_KEY = 'trimRows';\nexport const PLUGIN_PRIORITY = 330;\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n\n/**\n * @plugin TrimRows\n * @class TrimRows\n *\n * @description\n * The plugin allows to trim certain rows. The trimming is achieved by applying the transformation algorithm to the data\n * transformation. In this case, when the row is trimmed it is not accessible using `getData*` methods thus the trimmed\n * data is not visible to other plugins.\n *\n * @example\n * ::: only-for javascript\n * ```js\n * const container = document.getElementById('example');\n * const hot = new Handsontable(container, {\n * data: getData(),\n * // hide selected rows on table initialization\n * trimRows: [1, 2, 5]\n * });\n *\n * // access the trimRows plugin instance\n * const trimRowsPlugin = hot.getPlugin('trimRows');\n *\n * // hide single row\n * trimRowsPlugin.trimRow(1);\n *\n * // hide multiple rows\n * trimRowsPlugin.trimRow(1, 2, 9);\n *\n * // or as an array\n * trimRowsPlugin.trimRows([1, 2, 9]);\n *\n * // show single row\n * trimRowsPlugin.untrimRow(1);\n *\n * // show multiple rows\n * trimRowsPlugin.untrimRow(1, 2, 9);\n *\n * // or as an array\n * trimRowsPlugin.untrimRows([1, 2, 9]);\n *\n * // rerender table to see the changes\n * hot.render();\n * ```\n * :::\n *\n * ::: only-for react\n * ```jsx\n * const hotRef = useRef(null);\n *\n * ...\n *\n * \n *\n * const hot = hotRef.current.hotInstance;\n * // access the trimRows plugin instance\n * const trimRowsPlugin = hot.getPlugin('trimRows');\n *\n * // hide single row\n * trimRowsPlugin.trimRow(1);\n *\n * // hide multiple rows\n * trimRowsPlugin.trimRow(1, 2, 9);\n *\n * // or as an array\n * trimRowsPlugin.trimRows([1, 2, 9]);\n *\n * // show single row\n * trimRowsPlugin.untrimRow(1);\n *\n * // show multiple rows\n * trimRowsPlugin.untrimRow(1, 2, 9);\n *\n * // or as an array\n * trimRowsPlugin.untrimRows([1, 2, 9]);\n *\n * // rerender table to see the changes\n * hot.render();\n * ```\n * :::\n */\nvar _TrimRows_brand = /*#__PURE__*/new WeakSet();\nexport class TrimRows extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * On map initialized hook callback.\n */\n _classPrivateMethodInitSpec(this, _TrimRows_brand);\n /**\n * Map of skipped rows by the plugin.\n *\n * @private\n * @type {null|TrimmingMap}\n */\n _defineProperty(this, \"trimmedRowsMap\", null);\n }\n static get PLUGIN_KEY() {\n return PLUGIN_KEY;\n }\n static get PLUGIN_PRIORITY() {\n return PLUGIN_PRIORITY;\n }\n /**\n * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}\n * hook and if it returns `true` then the {@link AutoRowSize#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings()[PLUGIN_KEY];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\n if (this.enabled) {\n return;\n }\n this.trimmedRowsMap = this.hot.rowIndexMapper.registerMap('trimRows', new TrimmingMap());\n this.trimmedRowsMap.addLocalHook('init', () => _assertClassBrand(_TrimRows_brand, this, _onMapInit).call(this));\n super.enablePlugin();\n }\n\n /**\n * Updates the plugin's state.\n *\n * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:\n * - [`trimRows`](@/api/options.md#trimrows)\n */\n updatePlugin() {\n const trimmedRows = this.hot.getSettings()[PLUGIN_KEY];\n if (Array.isArray(trimmedRows)) {\n this.hot.batchExecution(() => {\n this.trimmedRowsMap.clear();\n arrayEach(trimmedRows, physicalRow => {\n this.trimmedRowsMap.setValueAtIndex(physicalRow, true);\n });\n }, true);\n }\n super.updatePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n this.hot.rowIndexMapper.unregisterMap('trimRows');\n super.disablePlugin();\n }\n\n /**\n * Get list of trimmed rows.\n *\n * @returns {Array} Physical rows.\n */\n getTrimmedRows() {\n return this.trimmedRowsMap.getTrimmedIndexes();\n }\n\n /**\n * Trims the rows provided in the array.\n *\n * @param {number[]} rows Array of physical row indexes.\n * @fires Hooks#beforeTrimRow\n * @fires Hooks#afterTrimRow\n */\n trimRows(rows) {\n const currentTrimConfig = this.getTrimmedRows();\n const isValidConfig = this.isValidConfig(rows);\n let destinationTrimConfig = currentTrimConfig;\n if (isValidConfig) {\n destinationTrimConfig = Array.from(new Set(currentTrimConfig.concat(rows)));\n }\n const allowTrimRow = this.hot.runHooks('beforeTrimRow', currentTrimConfig, destinationTrimConfig, isValidConfig);\n if (allowTrimRow === false) {\n return;\n }\n if (isValidConfig) {\n this.hot.batchExecution(() => {\n arrayEach(rows, physicalRow => {\n this.trimmedRowsMap.setValueAtIndex(physicalRow, true);\n });\n }, true);\n }\n this.hot.runHooks('afterTrimRow', currentTrimConfig, destinationTrimConfig, isValidConfig, isValidConfig && destinationTrimConfig.length > currentTrimConfig.length);\n }\n\n /**\n * Trims the row provided as a physical row index (counting from 0).\n *\n * @param {...number} row Physical row index.\n */\n trimRow() {\n for (var _len = arguments.length, row = new Array(_len), _key = 0; _key < _len; _key++) {\n row[_key] = arguments[_key];\n }\n this.trimRows(row);\n }\n\n /**\n * Untrims the rows provided in the array.\n *\n * @param {number[]} rows Array of physical row indexes.\n * @fires Hooks#beforeUntrimRow\n * @fires Hooks#afterUntrimRow\n */\n untrimRows(rows) {\n const currentTrimConfig = this.getTrimmedRows();\n const isValidConfig = this.isValidConfig(rows);\n let destinationTrimConfig = currentTrimConfig;\n const trimmingMapValues = this.trimmedRowsMap.getValues().slice();\n const isAnyRowUntrimmed = rows.length > 0;\n if (isValidConfig && isAnyRowUntrimmed) {\n // Preparing new values for trimming map.\n arrayEach(rows, physicalRow => {\n trimmingMapValues[physicalRow] = false;\n });\n\n // Preparing new trimming config.\n destinationTrimConfig = arrayReduce(trimmingMapValues, (trimmedIndexes, isTrimmed, physicalIndex) => {\n if (isTrimmed) {\n trimmedIndexes.push(physicalIndex);\n }\n return trimmedIndexes;\n }, []);\n }\n const allowUntrimRow = this.hot.runHooks('beforeUntrimRow', currentTrimConfig, destinationTrimConfig, isValidConfig && isAnyRowUntrimmed);\n if (allowUntrimRow === false) {\n return;\n }\n if (isValidConfig && isAnyRowUntrimmed) {\n this.trimmedRowsMap.setValues(trimmingMapValues);\n }\n this.hot.runHooks('afterUntrimRow', currentTrimConfig, destinationTrimConfig, isValidConfig && isAnyRowUntrimmed, isValidConfig && destinationTrimConfig.length < currentTrimConfig.length);\n }\n\n /**\n * Untrims the row provided as a physical row index (counting from 0).\n *\n * @param {...number} row Physical row index.\n */\n untrimRow() {\n for (var _len2 = arguments.length, row = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n row[_key2] = arguments[_key2];\n }\n this.untrimRows(row);\n }\n\n /**\n * Checks if given row is hidden.\n *\n * @param {number} physicalRow Physical row index.\n * @returns {boolean}\n */\n isTrimmed(physicalRow) {\n return this.trimmedRowsMap.getValueAtIndex(physicalRow) || false;\n }\n\n /**\n * Untrims all trimmed rows.\n */\n untrimAll() {\n this.untrimRows(this.getTrimmedRows());\n }\n\n /**\n * Get if trim config is valid. Check whether all of the provided physical row indexes are within source data.\n *\n * @param {Array} trimmedRows List of physical row indexes.\n * @returns {boolean}\n */\n isValidConfig(trimmedRows) {\n const sourceRows = this.hot.countSourceRows();\n return trimmedRows.every(trimmedRow => Number.isInteger(trimmedRow) && trimmedRow >= 0 && trimmedRow < sourceRows);\n }\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n super.destroy();\n }\n}\nfunction _onMapInit() {\n const trimmedRows = this.hot.getSettings()[PLUGIN_KEY];\n if (Array.isArray(trimmedRows)) {\n this.hot.batchExecution(() => {\n arrayEach(trimmedRows, physicalRow => {\n this.trimmedRowsMap.setValueAtIndex(physicalRow, true);\n });\n }, true);\n }\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, TrimRows } from \"./trimRows.mjs\";", "'use strict';\nmodule.exports = {};\n", "'use strict';\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar Iterators = require('../internals/iterators');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar ArrayPrototype = Array.prototype;\n\n// check on default Array iterator\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);\n};\n", "'use strict';\nvar classof = require('../internals/classof');\nvar getMethod = require('../internals/get-method');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\nvar Iterators = require('../internals/iterators');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\n\nmodule.exports = function (it) {\n if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR)\n || getMethod(it, '@@iterator')\n || Iterators[classof(it)];\n};\n", "'use strict';\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar tryToString = require('../internals/try-to-string');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\nvar $TypeError = TypeError;\n\nmodule.exports = function (argument, usingIterator) {\n var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;\n if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));\n throw new $TypeError(tryToString(argument) + ' is not iterable');\n};\n", "'use strict';\nvar bind = require('../internals/function-bind-context');\nvar call = require('../internals/function-call');\nvar anObject = require('../internals/an-object');\nvar tryToString = require('../internals/try-to-string');\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar getIterator = require('../internals/get-iterator');\nvar getIteratorMethod = require('../internals/get-iterator-method');\nvar iteratorClose = require('../internals/iterator-close');\n\nvar $TypeError = TypeError;\n\nvar Result = function (stopped, result) {\n this.stopped = stopped;\n this.result = result;\n};\n\nvar ResultPrototype = Result.prototype;\n\nmodule.exports = function (iterable, unboundFunction, options) {\n var that = options && options.that;\n var AS_ENTRIES = !!(options && options.AS_ENTRIES);\n var IS_RECORD = !!(options && options.IS_RECORD);\n var IS_ITERATOR = !!(options && options.IS_ITERATOR);\n var INTERRUPTED = !!(options && options.INTERRUPTED);\n var fn = bind(unboundFunction, that);\n var iterator, iterFn, index, length, result, next, step;\n\n var stop = function (condition) {\n if (iterator) iteratorClose(iterator, 'normal', condition);\n return new Result(true, condition);\n };\n\n var callFn = function (value) {\n if (AS_ENTRIES) {\n anObject(value);\n return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);\n } return INTERRUPTED ? fn(value, stop) : fn(value);\n };\n\n if (IS_RECORD) {\n iterator = iterable.iterator;\n } else if (IS_ITERATOR) {\n iterator = iterable;\n } else {\n iterFn = getIteratorMethod(iterable);\n if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');\n // optimisation for array iterators\n if (isArrayIteratorMethod(iterFn)) {\n for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {\n result = callFn(iterable[index]);\n if (result && isPrototypeOf(ResultPrototype, result)) return result;\n } return new Result(false);\n }\n iterator = getIterator(iterable, iterFn);\n }\n\n next = IS_RECORD ? iterable.next : iterator.next;\n while (!(step = call(next, iterator)).done) {\n try {\n result = callFn(step.value);\n } catch (error) {\n iteratorClose(iterator, 'throw', error);\n }\n if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;\n } return new Result(false);\n};\n", "'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = function (object, key, value) {\n if (DESCRIPTORS) definePropertyModule.f(object, key, createPropertyDescriptor(0, value));\n else object[key] = value;\n};\n", "'use strict';\nvar $ = require('../internals/export');\nvar iterate = require('../internals/iterate');\nvar createProperty = require('../internals/create-property');\n\n// `Object.fromEntries` method\n// https://github.com/tc39/proposal-object-from-entries\n$({ target: 'Object', stat: true }, {\n fromEntries: function fromEntries(iterable) {\n var obj = {};\n iterate(iterable, function (k, v) {\n createProperty(obj, k, v);\n }, { AS_ENTRIES: true });\n return obj;\n }\n});\n", "import \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/es.object.from-entries.js\";\nimport Hooks from \"../../pluginHooks.mjs\";\nimport { arrayMap, arrayEach } from \"../../helpers/array.mjs\";\nimport { rangeEach } from \"../../helpers/number.mjs\";\nimport { inherit, deepClone } from \"../../helpers/object.mjs\";\nimport { align } from \"../contextMenu/utils.mjs\";\nimport { getMoves } from \"../../helpers/moves.mjs\";\nconst SHORTCUTS_GROUP = 'undoRedo';\nexport const PLUGIN_KEY = 'undoRedo';\n\n/**\n * @description\n * Handsontable UndoRedo plugin allows to undo and redo certain actions done in the table.\n *\n * __Note__, that not all actions are currently undo-able. The UndoRedo plugin is enabled by default.\n * @example\n * ```js\n * undo: true\n * ```\n * @class UndoRedo\n * @plugin UndoRedo\n * @param {Core} instance The Handsontable instance.\n */\nfunction UndoRedo(instance) {\n const plugin = this;\n this.instance = instance;\n this.doneActions = [];\n this.undoneActions = [];\n this.ignoreNewActions = false;\n this.enabled = false;\n instance.addHook('afterChange', function (changes, source) {\n const changesLen = changes && changes.length;\n if (!changesLen) {\n return;\n }\n const hasDifferences = changes.find(change => {\n const [,, oldValue, newValue] = change;\n return oldValue !== newValue;\n });\n if (!hasDifferences) {\n return;\n }\n const wrappedAction = () => {\n const clonedChanges = changes.reduce((arr, change) => {\n arr.push([...change]);\n return arr;\n }, []);\n arrayEach(clonedChanges, change => {\n change[1] = instance.propToCol(change[1]);\n });\n const selected = changesLen > 1 ? this.getSelected() : [[clonedChanges[0][0], clonedChanges[0][1]]];\n return new UndoRedo.ChangeAction(clonedChanges, selected);\n };\n plugin.done(wrappedAction, source);\n });\n instance.addHook('afterCreateRow', (index, amount, source) => {\n plugin.done(() => new UndoRedo.CreateRowAction(index, amount), source);\n });\n const getCellMetas = (fromRow, toRow, fromColumn, toColumn) => {\n const genericKeys = ['visualRow', 'visualCol', 'row', 'col', 'prop'];\n const genericKeysLength = genericKeys.length;\n const cellMetas = [];\n rangeEach(fromColumn, toColumn, columnIndex => {\n rangeEach(fromRow, toRow, rowIndex => {\n const cellMeta = instance.getCellMeta(rowIndex, columnIndex);\n if (Object.keys(cellMeta).length !== genericKeysLength) {\n const uniqueMeta = Object.fromEntries(Object.entries(cellMeta).filter(_ref => {\n let [key] = _ref;\n return genericKeys.includes(key) === false;\n }));\n cellMetas.push([cellMeta.visualRow, cellMeta.visualCol, uniqueMeta]);\n }\n });\n });\n return cellMetas;\n };\n instance.addHook('beforeRemoveRow', (index, amount, logicRows, source) => {\n const wrappedAction = () => {\n const physicalRowIndex = instance.toPhysicalRow(index);\n const lastRowIndex = physicalRowIndex + amount - 1;\n const removedData = deepClone(plugin.instance.getSourceData(physicalRowIndex, 0, physicalRowIndex + amount - 1, plugin.instance.countSourceCols() - 1));\n return new UndoRedo.RemoveRowAction(physicalRowIndex, removedData, instance.getSettings().fixedRowsBottom, instance.getSettings().fixedRowsTop, instance.rowIndexMapper.getIndexesSequence(), getCellMetas(physicalRowIndex, lastRowIndex, 0, instance.countCols() - 1));\n };\n plugin.done(wrappedAction, source);\n });\n instance.addHook('afterCreateCol', (index, amount, source) => {\n plugin.done(() => new UndoRedo.CreateColumnAction(index, amount), source);\n });\n instance.addHook('beforeRemoveCol', (index, amount, logicColumns, source) => {\n const wrappedAction = () => {\n const originalData = plugin.instance.getSourceDataArray();\n const columnIndex = (plugin.instance.countCols() + index) % plugin.instance.countCols();\n const lastColumnIndex = columnIndex + amount - 1;\n const removedData = [];\n const headers = [];\n const indexes = [];\n rangeEach(originalData.length - 1, i => {\n const column = [];\n const origRow = originalData[i];\n rangeEach(columnIndex, lastColumnIndex, j => {\n column.push(origRow[instance.toPhysicalColumn(j)]);\n });\n removedData.push(column);\n });\n rangeEach(amount - 1, i => {\n indexes.push(instance.toPhysicalColumn(columnIndex + i));\n });\n if (Array.isArray(instance.getSettings().colHeaders)) {\n rangeEach(amount - 1, i => {\n headers.push(instance.getSettings().colHeaders[instance.toPhysicalColumn(columnIndex + i)] || null);\n });\n }\n const columnsMap = instance.columnIndexMapper.getIndexesSequence();\n const rowsMap = instance.rowIndexMapper.getIndexesSequence();\n return new UndoRedo.RemoveColumnAction(columnIndex, indexes, removedData, headers, columnsMap, rowsMap, instance.getSettings().fixedColumnsStart, getCellMetas(0, instance.countRows(), columnIndex, lastColumnIndex));\n };\n plugin.done(wrappedAction, source);\n });\n instance.addHook('beforeCellAlignment', (stateBefore, range, type, alignment) => {\n plugin.done(() => new UndoRedo.CellAlignmentAction(stateBefore, range, type, alignment));\n });\n instance.addHook('beforeFilter', (conditionsStack, previousConditionsStack) => {\n plugin.done(() => new UndoRedo.FiltersAction(conditionsStack, previousConditionsStack));\n });\n instance.addHook('beforeRowMove', (rows, finalIndex) => {\n if (rows === false) {\n return;\n }\n plugin.done(() => new UndoRedo.RowMoveAction(rows, finalIndex));\n });\n instance.addHook('beforeColumnMove', (columns, finalIndex) => {\n if (columns === false) {\n return;\n }\n plugin.done(() => new UndoRedo.ColumnMoveAction(columns, finalIndex));\n });\n instance.addHook('beforeMergeCells', (cellRange, auto) => {\n if (auto) {\n return;\n }\n plugin.done(() => new UndoRedo.MergeCellsAction(instance, cellRange));\n });\n instance.addHook('afterUnmergeCells', (cellRange, auto) => {\n if (auto) {\n return;\n }\n plugin.done(() => new UndoRedo.UnmergeCellsAction(instance, cellRange));\n });\n instance.addHook('beforeColumnSort', (currentSortConfig, destinationSortConfigs, sortPossible) => {\n if (!sortPossible) {\n return;\n }\n plugin.done(() => new UndoRedo.ColumnSortAction(currentSortConfig, destinationSortConfigs));\n });\n\n // TODO: Why this callback is needed? One test doesn't pass after calling method right after plugin creation (outside the callback).\n instance.addHook('afterInit', () => {\n plugin.init();\n });\n}\n\n/**\n * Stash information about performed actions.\n *\n * @function done\n * @memberof UndoRedo#\n * @fires Hooks#beforeUndoStackChange\n * @fires Hooks#afterUndoStackChange\n * @fires Hooks#beforeRedoStackChange\n * @fires Hooks#afterRedoStackChange\n * @param {Function} wrappedAction The action descriptor wrapped in a closure.\n * @param {string} [source] Source of the action. It is defined just for more general actions (not related to plugins).\n */\nUndoRedo.prototype.done = function (wrappedAction, source) {\n if (this.ignoreNewActions) {\n return;\n }\n const isBlockedByDefault = source === 'UndoRedo.undo' || source === 'UndoRedo.redo' || source === 'auto';\n if (isBlockedByDefault) {\n return;\n }\n const doneActionsCopy = this.doneActions.slice();\n const continueAction = this.instance.runHooks('beforeUndoStackChange', doneActionsCopy, source);\n if (continueAction === false) {\n return;\n }\n const newAction = wrappedAction();\n const undoneActionsCopy = this.undoneActions.slice();\n this.doneActions.push(newAction);\n this.instance.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());\n this.instance.runHooks('beforeRedoStackChange', undoneActionsCopy);\n this.undoneActions.length = 0;\n this.instance.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());\n};\n\n/**\n * Undo the last action performed to the table.\n *\n * @function undo\n * @memberof UndoRedo#\n * @fires Hooks#beforeUndoStackChange\n * @fires Hooks#afterUndoStackChange\n * @fires Hooks#beforeRedoStackChange\n * @fires Hooks#afterRedoStackChange\n * @fires Hooks#beforeUndo\n * @fires Hooks#afterUndo\n */\nUndoRedo.prototype.undo = function () {\n if (this.isUndoAvailable()) {\n const doneActionsCopy = this.doneActions.slice();\n this.instance.runHooks('beforeUndoStackChange', doneActionsCopy);\n const action = this.doneActions.pop();\n this.instance.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());\n const actionClone = deepClone(action);\n const continueAction = this.instance.runHooks('beforeUndo', actionClone);\n if (continueAction === false) {\n return;\n }\n this.ignoreNewActions = true;\n const that = this;\n const undoneActionsCopy = this.undoneActions.slice();\n this.instance.runHooks('beforeRedoStackChange', undoneActionsCopy);\n action.undo(this.instance, () => {\n that.ignoreNewActions = false;\n that.undoneActions.push(action);\n });\n this.instance.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());\n this.instance.runHooks('afterUndo', actionClone);\n }\n};\n\n/**\n * Redo the previous action performed to the table (used to reverse an undo).\n *\n * @function redo\n * @memberof UndoRedo#\n * @fires Hooks#beforeUndoStackChange\n * @fires Hooks#afterUndoStackChange\n * @fires Hooks#beforeRedoStackChange\n * @fires Hooks#afterRedoStackChange\n * @fires Hooks#beforeRedo\n * @fires Hooks#afterRedo\n */\nUndoRedo.prototype.redo = function () {\n if (this.isRedoAvailable()) {\n const undoneActionsCopy = this.undoneActions.slice();\n this.instance.runHooks('beforeRedoStackChange', undoneActionsCopy);\n const action = this.undoneActions.pop();\n this.instance.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());\n const actionClone = deepClone(action);\n const continueAction = this.instance.runHooks('beforeRedo', actionClone);\n if (continueAction === false) {\n return;\n }\n this.ignoreNewActions = true;\n const that = this;\n const doneActionsCopy = this.doneActions.slice();\n this.instance.runHooks('beforeUndoStackChange', doneActionsCopy);\n action.redo(this.instance, () => {\n that.ignoreNewActions = false;\n that.doneActions.push(action);\n });\n this.instance.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());\n this.instance.runHooks('afterRedo', actionClone);\n }\n};\n\n/**\n * Checks if undo action is available.\n *\n * @function isUndoAvailable\n * @memberof UndoRedo#\n * @returns {boolean} Return `true` if undo can be performed, `false` otherwise.\n */\nUndoRedo.prototype.isUndoAvailable = function () {\n return this.doneActions.length > 0;\n};\n\n/**\n * Checks if redo action is available.\n *\n * @function isRedoAvailable\n * @memberof UndoRedo#\n * @returns {boolean} Return `true` if redo can be performed, `false` otherwise.\n */\nUndoRedo.prototype.isRedoAvailable = function () {\n return this.undoneActions.length > 0;\n};\n\n/**\n * Clears undo history.\n *\n * @function clear\n * @memberof UndoRedo#\n */\nUndoRedo.prototype.clear = function () {\n this.doneActions.length = 0;\n this.undoneActions.length = 0;\n};\n\n/**\n * Checks if the plugin is enabled.\n *\n * @function isEnabled\n * @memberof UndoRedo#\n * @returns {boolean}\n */\nUndoRedo.prototype.isEnabled = function () {\n return this.enabled;\n};\n\n/**\n * Enables the plugin.\n *\n * @function enable\n * @memberof UndoRedo#\n */\nUndoRedo.prototype.enable = function () {\n if (this.isEnabled()) {\n return;\n }\n const hot = this.instance;\n this.enabled = true;\n exposeUndoRedoMethods(hot);\n this.registerShortcuts();\n hot.addHook('afterChange', onAfterChange);\n};\n\n/**\n * Disables the plugin.\n *\n * @function disable\n * @memberof UndoRedo#\n */\nUndoRedo.prototype.disable = function () {\n if (!this.isEnabled()) {\n return;\n }\n const hot = this.instance;\n this.enabled = false;\n removeExposedUndoRedoMethods(hot);\n this.unregisterShortcuts();\n hot.removeHook('afterChange', onAfterChange);\n};\n\n/**\n * Destroys the instance.\n *\n * @function destroy\n * @memberof UndoRedo#\n */\nUndoRedo.prototype.destroy = function () {\n this.clear();\n this.instance = null;\n this.doneActions = null;\n this.undoneActions = null;\n};\nUndoRedo.Action = function () {};\nUndoRedo.Action.prototype.undo = function () {};\nUndoRedo.Action.prototype.redo = function () {};\n\n/**\n * Change action.\n *\n * @private\n * @param {Array} changes 2D array containing information about each of the edited cells.\n * @param {number[]} selected The cell selection.\n */\nUndoRedo.ChangeAction = function (changes, selected) {\n this.changes = changes;\n this.selected = selected;\n this.actionType = 'change';\n};\ninherit(UndoRedo.ChangeAction, UndoRedo.Action);\nUndoRedo.ChangeAction.prototype.undo = function (instance, undoneCallback) {\n const data = deepClone(this.changes);\n const emptyRowsAtTheEnd = instance.countEmptyRows(true);\n const emptyColsAtTheEnd = instance.countEmptyCols(true);\n for (let i = 0, len = data.length; i < len; i++) {\n data[i].splice(3, 1);\n }\n instance.addHookOnce('afterChange', undoneCallback);\n instance.setDataAtCell(data, null, null, 'UndoRedo.undo');\n for (let i = 0, len = data.length; i < len; i++) {\n const [row, column] = data[i];\n if (instance.getSettings().minSpareRows && row + 1 + instance.getSettings().minSpareRows === instance.countRows() && emptyRowsAtTheEnd === instance.getSettings().minSpareRows) {\n instance.alter('remove_row', parseInt(row + 1, 10), instance.getSettings().minSpareRows);\n instance.undoRedo.doneActions.pop();\n }\n if (instance.getSettings().minSpareCols && column + 1 + instance.getSettings().minSpareCols === instance.countCols() && emptyColsAtTheEnd === instance.getSettings().minSpareCols) {\n instance.alter('remove_col', parseInt(column + 1, 10), instance.getSettings().minSpareCols);\n instance.undoRedo.doneActions.pop();\n }\n }\n const selectedLast = instance.getSelectedLast();\n if (selectedLast !== undefined) {\n const [changedRow, changedColumn] = data[0];\n const [selectedRow, selectedColumn] = selectedLast;\n const firstFullyVisibleRow = instance.view.getFirstFullyVisibleRow();\n const firstFullyVisibleColumn = instance.view.getFirstFullyVisibleColumn();\n const isInVerticalViewPort = changedRow >= firstFullyVisibleRow;\n const isInHorizontalViewPort = changedColumn >= firstFullyVisibleColumn;\n const isInViewport = isInVerticalViewPort && isInHorizontalViewPort;\n const isChangedSelection = selectedRow !== changedRow || selectedColumn !== changedColumn;\n\n // Performing scroll only when selection has been changed right after editing a cell.\n if (isInViewport === false && isChangedSelection === true) {\n const scrollConfig = {\n row: changedRow,\n col: changedColumn\n };\n if (isInVerticalViewPort === false) {\n scrollConfig.verticalSnap = 'top';\n }\n if (isInHorizontalViewPort === false) {\n scrollConfig.horizontalSnap = 'start';\n }\n instance.scrollViewportTo(scrollConfig);\n }\n }\n instance.selectCells(this.selected, false, false);\n};\nUndoRedo.ChangeAction.prototype.redo = function (instance, onFinishCallback) {\n const data = deepClone(this.changes);\n for (let i = 0, len = data.length; i < len; i++) {\n data[i].splice(2, 1);\n }\n instance.addHookOnce('afterChange', onFinishCallback);\n instance.setDataAtCell(data, null, null, 'UndoRedo.redo');\n if (this.selected) {\n instance.selectCells(this.selected, false, false);\n }\n};\n\n/**\n * Create row action.\n *\n * @private\n * @param {number} index The visual row index.\n * @param {number} amount The number of created rows.\n */\nUndoRedo.CreateRowAction = function (index, amount) {\n this.index = index;\n this.amount = amount;\n this.actionType = 'insert_row';\n};\ninherit(UndoRedo.CreateRowAction, UndoRedo.Action);\nUndoRedo.CreateRowAction.prototype.undo = function (instance, undoneCallback) {\n const rowCount = instance.countRows();\n const minSpareRows = instance.getSettings().minSpareRows;\n if (this.index >= rowCount && this.index - minSpareRows < rowCount) {\n this.index -= minSpareRows; // work around the situation where the needed row was removed due to an 'undo' of a made change\n }\n instance.addHookOnce('afterRemoveRow', undoneCallback);\n instance.alter('remove_row', this.index, this.amount, 'UndoRedo.undo');\n};\nUndoRedo.CreateRowAction.prototype.redo = function (instance, redoneCallback) {\n instance.addHookOnce('afterCreateRow', redoneCallback);\n instance.alter('insert_row_above', this.index, this.amount, 'UndoRedo.redo');\n};\n\n/**\n * Remove row action.\n *\n * @private\n * @param {number} index The visual row index.\n * @param {Array} data The removed data.\n * @param {number} fixedRowsBottom Number of fixed rows on the bottom. Remove row action change it sometimes.\n * @param {number} fixedRowsTop Number of fixed rows on the top. Remove row action change it sometimes.\n * @param {Array} rowIndexesSequence Row index sequence taken from the row index mapper.\n * @param {Array} removedCellMetas List of removed cell metas.\n */\nUndoRedo.RemoveRowAction = function (index, data, fixedRowsBottom, fixedRowsTop, rowIndexesSequence, removedCellMetas) {\n this.index = index;\n this.data = data;\n this.actionType = 'remove_row';\n this.fixedRowsBottom = fixedRowsBottom;\n this.fixedRowsTop = fixedRowsTop;\n this.rowIndexesSequence = rowIndexesSequence;\n this.removedCellMetas = removedCellMetas;\n};\ninherit(UndoRedo.RemoveRowAction, UndoRedo.Action);\nUndoRedo.RemoveRowAction.prototype.undo = function (instance, undoneCallback) {\n const settings = instance.getSettings();\n const changes = [];\n\n // Changing by the reference as `updateSettings` doesn't work the best.\n settings.fixedRowsBottom = this.fixedRowsBottom;\n settings.fixedRowsTop = this.fixedRowsTop;\n\n // Prepare the change list to fill the source data.\n this.data.forEach((dataRow, rowIndexDelta) => {\n Object.keys(dataRow).forEach(columnProp => {\n const columnIndex = parseInt(columnProp, 10);\n changes.push([this.index + rowIndexDelta, isNaN(columnIndex) ? columnProp : columnIndex, dataRow[columnProp]]);\n });\n });\n instance.alter('insert_row_above', this.index, this.data.length, 'UndoRedo.undo');\n this.removedCellMetas.forEach(_ref2 => {\n let [rowIndex, columnIndex, cellMeta] = _ref2;\n instance.setCellMetaObject(rowIndex, columnIndex, cellMeta);\n });\n instance.addHookOnce('afterViewRender', undoneCallback);\n instance.setSourceDataAtCell(changes, null, null, 'UndoRedo.undo');\n instance.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);\n};\nUndoRedo.RemoveRowAction.prototype.redo = function (instance, redoneCallback) {\n instance.addHookOnce('afterRemoveRow', redoneCallback);\n instance.alter('remove_row', this.index, this.data.length, 'UndoRedo.redo');\n};\n\n/**\n * Create column action.\n *\n * @private\n * @param {number} index The visual column index.\n * @param {number} amount The number of created columns.\n */\nUndoRedo.CreateColumnAction = function (index, amount) {\n this.index = index;\n this.amount = amount;\n this.actionType = 'insert_col';\n};\ninherit(UndoRedo.CreateColumnAction, UndoRedo.Action);\nUndoRedo.CreateColumnAction.prototype.undo = function (instance, undoneCallback) {\n instance.addHookOnce('afterRemoveCol', undoneCallback);\n instance.alter('remove_col', this.index, this.amount, 'UndoRedo.undo');\n};\nUndoRedo.CreateColumnAction.prototype.redo = function (instance, redoneCallback) {\n instance.addHookOnce('afterCreateCol', redoneCallback);\n instance.alter('insert_col_start', this.index, this.amount, 'UndoRedo.redo');\n};\n\n/**\n * Remove column action.\n *\n * @private\n * @param {number} index The visual column index.\n * @param {number[]} indexes The visual column indexes.\n * @param {Array} data The removed data.\n * @param {Array} headers The header values.\n * @param {number[]} columnPositions The column position.\n * @param {number[]} rowPositions The row position.\n * @param {number} fixedColumnsStart Number of fixed columns on the left. Remove column action change it sometimes.\n * @param {Array} removedCellMetas List of removed cell metas.\n */\nUndoRedo.RemoveColumnAction = function (index, indexes, data, headers, columnPositions, rowPositions, fixedColumnsStart, removedCellMetas) {\n // eslint-disable-line max-len\n this.index = index;\n this.indexes = indexes;\n this.data = data;\n this.amount = this.data[0].length;\n this.headers = headers;\n this.columnPositions = columnPositions.slice(0);\n this.rowPositions = rowPositions.slice(0);\n this.actionType = 'remove_col';\n this.fixedColumnsStart = fixedColumnsStart;\n this.removedCellMetas = removedCellMetas;\n};\ninherit(UndoRedo.RemoveColumnAction, UndoRedo.Action);\nUndoRedo.RemoveColumnAction.prototype.undo = function (instance, undoneCallback) {\n const settings = instance.getSettings();\n\n // Changing by the reference as `updateSettings` doesn't work the best.\n settings.fixedColumnsStart = this.fixedColumnsStart;\n const ascendingIndexes = this.indexes.slice(0).sort();\n const sortByIndexes = (elem, j, arr) => arr[this.indexes.indexOf(ascendingIndexes[j])];\n const removedDataLength = this.data.length;\n const sortedData = [];\n for (let rowIndex = 0; rowIndex < removedDataLength; rowIndex++) {\n sortedData.push(arrayMap(this.data[rowIndex], sortByIndexes));\n }\n const sortedHeaders = arrayMap(this.headers, sortByIndexes);\n const changes = [];\n instance.alter('insert_col_start', this.indexes[0], this.indexes.length, 'UndoRedo.undo');\n arrayEach(instance.getSourceDataArray(), (rowData, rowIndex) => {\n arrayEach(ascendingIndexes, (changedIndex, contiquesIndex) => {\n rowData[changedIndex] = sortedData[rowIndex][contiquesIndex];\n changes.push([rowIndex, changedIndex, rowData[changedIndex]]);\n });\n });\n instance.setSourceDataAtCell(changes, undefined, undefined, 'UndoRedo.undo');\n if (typeof this.headers !== 'undefined') {\n arrayEach(sortedHeaders, (headerData, columnIndex) => {\n instance.getSettings().colHeaders[ascendingIndexes[columnIndex]] = headerData;\n });\n }\n this.removedCellMetas.forEach(_ref3 => {\n let [rowIndex, columnIndex, cellMeta] = _ref3;\n instance.setCellMetaObject(rowIndex, columnIndex, cellMeta);\n });\n instance.batchExecution(() => {\n // Restore row sequence in a case when all columns are removed. the original\n // row sequence is lost in that case.\n instance.rowIndexMapper.setIndexesSequence(this.rowPositions);\n instance.columnIndexMapper.setIndexesSequence(this.columnPositions);\n }, true);\n instance.addHookOnce('afterViewRender', undoneCallback);\n instance.render();\n};\nUndoRedo.RemoveColumnAction.prototype.redo = function (instance, redoneCallback) {\n instance.addHookOnce('afterRemoveCol', redoneCallback);\n instance.alter('remove_col', this.index, this.amount, 'UndoRedo.redo');\n};\n\n/**\n * Cell alignment action.\n *\n * @private\n * @param {Array} stateBefore The previous state.\n * @param {object} range The cell range.\n * @param {string} type The type of the alignment (\"top\", \"left\", \"bottom\" or \"right\").\n * @param {string} alignment The alignment CSS class.\n */\nUndoRedo.CellAlignmentAction = function (stateBefore, range, type, alignment) {\n this.stateBefore = stateBefore;\n this.range = range;\n this.type = type;\n this.alignment = alignment;\n};\nUndoRedo.CellAlignmentAction.prototype.undo = function (instance, undoneCallback) {\n arrayEach(this.range, range => {\n range.forAll((row, col) => {\n // Alignment classes should only collected within cell ranges. We skip header coordinates.\n if (row >= 0 && col >= 0) {\n instance.setCellMeta(row, col, 'className', this.stateBefore[row][col] || ' htLeft');\n }\n });\n });\n instance.addHookOnce('afterViewRender', undoneCallback);\n instance.render();\n};\nUndoRedo.CellAlignmentAction.prototype.redo = function (instance, undoneCallback) {\n align(this.range, this.type, this.alignment, (row, col) => instance.getCellMeta(row, col), (row, col, key, value) => instance.setCellMeta(row, col, key, value));\n instance.addHookOnce('afterViewRender', undoneCallback);\n instance.render();\n};\n\n/**\n * Filters action.\n *\n * @private\n * @param {Array} conditionsStack An array of the filter conditions.\n * @param {Array} previousConditionsStack An array of the previous filter conditions.\n */\nUndoRedo.FiltersAction = function (conditionsStack, previousConditionsStack) {\n this.previousConditionsStack = previousConditionsStack;\n this.conditionsStack = conditionsStack;\n this.actionType = 'filter';\n};\ninherit(UndoRedo.FiltersAction, UndoRedo.Action);\nUndoRedo.FiltersAction.prototype.undo = function (instance, undoneCallback) {\n const filters = instance.getPlugin('filters');\n instance.addHookOnce('afterViewRender', undoneCallback);\n if (this.previousConditionsStack) {\n filters.conditionCollection.importAllConditions(this.previousConditionsStack);\n }\n filters.filter();\n};\nUndoRedo.FiltersAction.prototype.redo = function (instance, redoneCallback) {\n const filters = instance.getPlugin('filters');\n instance.addHookOnce('afterViewRender', redoneCallback);\n filters.conditionCollection.importAllConditions(this.conditionsStack);\n filters.filter();\n};\n\n/**\n * Merge Cells action.\n *\n * @util\n */\nclass MergeCellsAction extends UndoRedo.Action {\n constructor(instance, cellRange) {\n super();\n this.cellRange = cellRange;\n const topStartCorner = this.cellRange.getTopStartCorner();\n const bottomEndCorner = this.cellRange.getBottomEndCorner();\n this.rangeData = instance.getData(topStartCorner.row, topStartCorner.col, bottomEndCorner.row, bottomEndCorner.col);\n }\n undo(instance, undoneCallback) {\n const mergeCellsPlugin = instance.getPlugin('mergeCells');\n instance.addHookOnce('afterViewRender', undoneCallback);\n mergeCellsPlugin.unmergeRange(this.cellRange, true);\n const topStartCorner = this.cellRange.getTopStartCorner();\n instance.populateFromArray(topStartCorner.row, topStartCorner.col, this.rangeData, undefined, undefined, 'MergeCells');\n }\n redo(instance, redoneCallback) {\n const mergeCellsPlugin = instance.getPlugin('mergeCells');\n instance.addHookOnce('afterViewRender', redoneCallback);\n mergeCellsPlugin.mergeRange(this.cellRange);\n }\n}\nUndoRedo.MergeCellsAction = MergeCellsAction;\n\n/**\n * Unmerge Cells action.\n *\n * @util\n */\nclass UnmergeCellsAction extends UndoRedo.Action {\n constructor(instance, cellRange) {\n super();\n this.cellRange = cellRange;\n }\n undo(instance, undoneCallback) {\n const mergeCellsPlugin = instance.getPlugin('mergeCells');\n instance.addHookOnce('afterViewRender', undoneCallback);\n mergeCellsPlugin.mergeRange(this.cellRange, true);\n }\n redo(instance, redoneCallback) {\n const mergeCellsPlugin = instance.getPlugin('mergeCells');\n instance.addHookOnce('afterViewRender', redoneCallback);\n mergeCellsPlugin.unmergeRange(this.cellRange, true);\n instance.render();\n }\n}\nUndoRedo.UnmergeCellsAction = UnmergeCellsAction;\n\n/**\n * ManualRowMove action.\n *\n * @TODO removeRow undo should works on logical index\n * @private\n * @param {number[]} rows An array with moved rows.\n * @param {number} finalIndex The destination index.\n */\nUndoRedo.RowMoveAction = function (rows, finalIndex) {\n this.rows = rows.slice();\n this.finalRowIndex = finalIndex;\n this.actionType = 'row_move';\n};\ninherit(UndoRedo.RowMoveAction, UndoRedo.Action);\nUndoRedo.RowMoveAction.prototype.undo = function (instance, undoneCallback) {\n const manualRowMove = instance.getPlugin('manualRowMove');\n instance.addHookOnce('afterViewRender', undoneCallback);\n const rowMoves = getMoves(this.rows, this.finalRowIndex, instance.rowIndexMapper.getNumberOfIndexes());\n rowMoves.reverse().forEach(_ref4 => {\n let {\n from,\n to\n } = _ref4;\n if (from < to) {\n to -= 1;\n }\n manualRowMove.moveRow(to, from);\n });\n instance.render();\n instance.deselectCell();\n instance.selectRows(this.rows[0], this.rows[0] + this.rows.length - 1);\n};\nUndoRedo.RowMoveAction.prototype.redo = function (instance, redoneCallback) {\n const manualRowMove = instance.getPlugin('manualRowMove');\n instance.addHookOnce('afterViewRender', redoneCallback);\n manualRowMove.moveRows(this.rows.slice(), this.finalRowIndex);\n instance.render();\n instance.deselectCell();\n instance.selectRows(this.finalRowIndex, this.finalRowIndex + this.rows.length - 1);\n};\n\n/**\n * ManualColumnMove action.\n *\n * @private\n * @param {number[]} columns An array with moved columns.\n * @param {number} finalIndex The destination index.\n */\nUndoRedo.ColumnMoveAction = function (columns, finalIndex) {\n this.columns = columns.slice();\n this.finalColumnIndex = finalIndex;\n this.actionType = 'col_move';\n};\ninherit(UndoRedo.ColumnMoveAction, UndoRedo.Action);\nUndoRedo.ColumnMoveAction.prototype.undo = function (instance, undoneCallback) {\n const manualColumnMove = instance.getPlugin('manualColumnMove');\n instance.addHookOnce('afterViewRender', undoneCallback);\n const columnMoves = getMoves(this.columns, this.finalColumnIndex, instance.columnIndexMapper.getNumberOfIndexes());\n columnMoves.reverse().forEach(_ref5 => {\n let {\n from,\n to\n } = _ref5;\n if (from < to) {\n to -= 1;\n }\n manualColumnMove.moveColumn(to, from);\n });\n instance.render();\n instance.deselectCell();\n instance.selectColumns(this.columns[0], this.columns[0] + this.columns.length - 1);\n};\nUndoRedo.ColumnMoveAction.prototype.redo = function (instance, redoneCallback) {\n const manualColumnMove = instance.getPlugin('manualColumnMove');\n instance.addHookOnce('afterViewRender', redoneCallback);\n manualColumnMove.moveColumns(this.columns.slice(), this.finalColumnIndex);\n instance.render();\n instance.deselectCell();\n instance.selectColumns(this.finalColumnIndex, this.finalColumnIndex + this.columns.length - 1);\n};\n\n/**\n * ColumnSort action.\n *\n * @private\n * @param {Array} currentSortState The current sort state.\n * @param {Array} newSortState The new sort state.\n */\nUndoRedo.ColumnSortAction = function (currentSortState, newSortState) {\n this.previousSortState = currentSortState;\n this.nextSortState = newSortState;\n};\ninherit(UndoRedo.ColumnSortAction, UndoRedo.Action);\nUndoRedo.ColumnSortAction.prototype.undo = function (instance, undoneCallback) {\n const sortPlugin = instance.getPlugin('columnSorting');\n const multiSortPlugin = instance.getPlugin('multiColumnSorting');\n const enabledSortPlugin = multiSortPlugin.isEnabled() ? multiSortPlugin : sortPlugin;\n if (this.previousSortState.length) {\n enabledSortPlugin.sort(this.previousSortState);\n } else {\n enabledSortPlugin.clearSort();\n }\n undoneCallback();\n};\nUndoRedo.ColumnSortAction.prototype.redo = function (instance, redoneCallback) {\n const sortPlugin = instance.getPlugin('columnSorting');\n const multiSortPlugin = instance.getPlugin('multiColumnSorting');\n const enabledSortPlugin = multiSortPlugin.isEnabled() ? multiSortPlugin : sortPlugin;\n enabledSortPlugin.sort(this.nextSortState);\n redoneCallback();\n};\n\n/**\n * Enabling and disabling plugin and attaching its to an instance.\n *\n * @private\n */\nUndoRedo.prototype.init = function () {\n const settings = this.instance.getSettings().undo;\n const pluginEnabled = typeof settings === 'undefined' || settings;\n if (!this.instance.undoRedo) {\n this.instance.undoRedo = this;\n }\n if (pluginEnabled) {\n this.instance.undoRedo.enable();\n } else {\n this.instance.undoRedo.disable();\n }\n};\n\n/**\n * Registers shortcuts responsible for performing undo/redo.\n *\n * @private\n */\nUndoRedo.prototype.registerShortcuts = function () {\n const shortcutManager = this.instance.getShortcutManager();\n const gridContext = shortcutManager.getContext('grid');\n const runOnlyIf = event => {\n return !event.altKey; // right ALT in some systems triggers ALT+CTR\n };\n const config = {\n runOnlyIf,\n group: SHORTCUTS_GROUP\n };\n gridContext.addShortcuts([{\n keys: [['Control/Meta', 'z']],\n callback: () => {\n this.undo();\n }\n }, {\n keys: [['Control/Meta', 'y'], ['Control/Meta', 'Shift', 'z']],\n callback: () => {\n this.redo();\n }\n }], config);\n};\n\n/**\n * Unregister shortcuts responsible for performing undo/redo.\n *\n * @private\n */\nUndoRedo.prototype.unregisterShortcuts = function () {\n const shortcutManager = this.instance.getShortcutManager();\n const gridContext = shortcutManager.getContext('grid');\n gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);\n};\n\n/**\n * @param {Array} changes 2D array containing information about each of the edited cells.\n * @param {string} source String that identifies source of hook call.\n * @returns {boolean}\n */\nfunction onAfterChange(changes, source) {\n const instance = this;\n if (source === 'loadData') {\n return instance.undoRedo.clear();\n }\n}\n\n/**\n * @param {Core} instance The Handsontable instance.\n */\nfunction exposeUndoRedoMethods(instance) {\n /**\n * {@link UndoRedo#undo}.\n *\n * @alias undo\n * @memberof! Core#\n * @returns {boolean}\n */\n instance.undo = function () {\n return instance.undoRedo.undo();\n };\n\n /**\n * {@link UndoRedo#redo}.\n *\n * @alias redo\n * @memberof! Core#\n * @returns {boolean}\n */\n instance.redo = function () {\n return instance.undoRedo.redo();\n };\n\n /**\n * {@link UndoRedo#isUndoAvailable}.\n *\n * @alias isUndoAvailable\n * @memberof! Core#\n * @returns {boolean}\n */\n instance.isUndoAvailable = function () {\n return instance.undoRedo.isUndoAvailable();\n };\n\n /**\n * {@link UndoRedo#isRedoAvailable}.\n *\n * @alias isRedoAvailable\n * @memberof! Core#\n * @returns {boolean}\n */\n instance.isRedoAvailable = function () {\n return instance.undoRedo.isRedoAvailable();\n };\n\n /**\n * {@link UndoRedo#clear}.\n *\n * @alias clearUndo\n * @memberof! Core#\n * @returns {boolean}\n */\n instance.clearUndo = function () {\n return instance.undoRedo.clear();\n };\n}\n\n/**\n * @param {Core} instance The Handsontable instance.\n */\nfunction removeExposedUndoRedoMethods(instance) {\n delete instance.undo;\n delete instance.redo;\n delete instance.isUndoAvailable;\n delete instance.isRedoAvailable;\n delete instance.clearUndo;\n}\nconst hook = Hooks.getSingleton();\nhook.add('afterUpdateSettings', function () {\n var _this$getPlugin;\n (_this$getPlugin = this.getPlugin('undoRedo')) === null || _this$getPlugin === void 0 || _this$getPlugin.init();\n});\nhook.register('beforeUndo');\nhook.register('afterUndo');\nhook.register('beforeRedo');\nhook.register('afterRedo');\nUndoRedo.PLUGIN_KEY = PLUGIN_KEY;\nUndoRedo.SETTING_KEYS = true;\nexport default UndoRedo;", "import UndoRedo, { PLUGIN_KEY } from \"./undoRedo.mjs\";\nexport { PLUGIN_KEY, UndoRedo };", "import { AutoColumnSize } from \"./autoColumnSize/index.mjs\";\nimport { Autofill } from \"./autofill/index.mjs\";\nimport { AutoRowSize } from \"./autoRowSize/index.mjs\";\nimport { BasePlugin } from \"./base/index.mjs\";\nimport { BindRowsWithHeaders } from \"./bindRowsWithHeaders/index.mjs\";\nimport { CollapsibleColumns } from \"./collapsibleColumns/index.mjs\";\nimport { ColumnSorting } from \"./columnSorting/index.mjs\";\nimport { ColumnSummary } from \"./columnSummary/index.mjs\";\nimport { Comments } from \"./comments/index.mjs\";\nimport { ContextMenu } from \"./contextMenu/index.mjs\";\nimport { CopyPaste } from \"./copyPaste/index.mjs\";\nimport { CustomBorders } from \"./customBorders/index.mjs\";\nimport { DragToScroll } from \"./dragToScroll/index.mjs\";\nimport { DropdownMenu } from \"./dropdownMenu/index.mjs\";\nimport { ExportFile } from \"./exportFile/index.mjs\";\nimport { Filters } from \"./filters/index.mjs\";\nimport { Formulas } from \"./formulas/index.mjs\";\nimport { HiddenColumns } from \"./hiddenColumns/index.mjs\";\nimport { HiddenRows } from \"./hiddenRows/index.mjs\";\nimport { ManualColumnFreeze } from \"./manualColumnFreeze/index.mjs\";\nimport { ManualColumnMove } from \"./manualColumnMove/index.mjs\";\nimport { ManualColumnResize } from \"./manualColumnResize/index.mjs\";\nimport { ManualRowMove } from \"./manualRowMove/index.mjs\";\nimport { ManualRowResize } from \"./manualRowResize/index.mjs\";\nimport { MergeCells } from \"./mergeCells/index.mjs\";\nimport { MultiColumnSorting } from \"./multiColumnSorting/index.mjs\";\nimport { MultipleSelectionHandles } from \"./multipleSelectionHandles/index.mjs\";\nimport { NestedHeaders } from \"./nestedHeaders/index.mjs\";\nimport { NestedRows } from \"./nestedRows/index.mjs\";\nimport { PersistentState } from \"./persistentState/index.mjs\";\nimport { Search } from \"./search/index.mjs\";\nimport { TouchScroll } from \"./touchScroll/index.mjs\";\nimport { TrimRows } from \"./trimRows/index.mjs\";\nimport { UndoRedo } from \"./undoRedo/index.mjs\";\nimport { registerPlugin } from \"./registry.mjs\";\n/**\n * Registers all available plugins.\n */\nexport function registerAllPlugins() {\n registerPlugin(AutoColumnSize);\n registerPlugin(Autofill);\n registerPlugin(AutoRowSize);\n registerPlugin(BindRowsWithHeaders);\n registerPlugin(CollapsibleColumns);\n registerPlugin(ColumnSorting);\n registerPlugin(ColumnSummary);\n registerPlugin(Comments);\n registerPlugin(ContextMenu);\n registerPlugin(CopyPaste);\n registerPlugin(CustomBorders);\n registerPlugin(DragToScroll);\n registerPlugin(DropdownMenu);\n registerPlugin(ExportFile);\n registerPlugin(Filters);\n registerPlugin(Formulas);\n registerPlugin(HiddenColumns);\n registerPlugin(HiddenRows);\n registerPlugin(ManualColumnFreeze);\n registerPlugin(ManualColumnMove);\n registerPlugin(ManualColumnResize);\n registerPlugin(ManualRowMove);\n registerPlugin(ManualRowResize);\n registerPlugin(MergeCells);\n registerPlugin(MultiColumnSorting);\n registerPlugin(MultipleSelectionHandles);\n registerPlugin(NestedHeaders);\n registerPlugin(NestedRows);\n registerPlugin(PersistentState);\n registerPlugin(Search);\n registerPlugin(TouchScroll);\n registerPlugin(TrimRows);\n registerPlugin(UndoRedo);\n}\nexport { AutoColumnSize, Autofill, AutoRowSize, BasePlugin, BindRowsWithHeaders, CollapsibleColumns, ColumnSorting, ColumnSummary, Comments, ContextMenu, CopyPaste, CustomBorders, DragToScroll, DropdownMenu, ExportFile, Filters, Formulas, HiddenColumns, HiddenRows, ManualColumnFreeze, ManualColumnMove, ManualColumnResize, ManualRowMove, ManualRowResize, MergeCells, MultiColumnSorting, MultipleSelectionHandles, NestedHeaders, NestedRows, PersistentState, Search, TouchScroll, TrimRows, UndoRedo };\nexport { getPlugin, getPluginsNames, registerPlugin } from \"./registry.mjs\";", "/* eslint-disable handsontable/restricted-module-imports */\n// Since the Handsontable was modularized, importing some submodules is\n// restricted. Importing the main entry of the submodule can make the\n// \"dead\" code elimination process more difficult or even impossible.\n// The \"handsontable/restricted-module-imports\" rule is on guard.\n// This file exports the functions that allow include packages to\n// the Base version of the Handsontable, so that's why the rule is\n// disabled here (see more #7506).\nimport { registerAllEditors } from \"./editors/index.mjs\";\nimport { registerAllRenderers } from \"./renderers/index.mjs\";\nimport { registerAllValidators } from \"./validators/index.mjs\";\nimport { registerAllCellTypes } from \"./cellTypes/index.mjs\";\nimport { registerAllPlugins } from \"./plugins/index.mjs\";\n/* eslint-enable handsontable/restricted-module-imports */\nexport { registerAllEditors, registerAllRenderers, registerAllValidators, registerAllCellTypes, registerAllPlugins };\n\n/**\n * Registers all available Handsontable modules.\n */\nexport function registerAllModules() {\n registerAllEditors();\n registerAllRenderers();\n registerAllValidators();\n registerAllCellTypes();\n registerAllPlugins();\n}", "import \"core-js/modules/es.error.cause.js\";\n/**\n * @param {Core} Handsontable The Handsontable instance.\n */\nexport default function jQueryWrapper(Handsontable) {\n // eslint-disable-next-line\n const jQuery = typeof window === 'undefined' ? false : window.jQuery;\n if (!jQuery) {\n return;\n }\n jQuery.fn.handsontable = function (action) {\n const $this = this.first(); // Use only first element from list\n let instance = $this.data('handsontable');\n\n // Init case\n if (typeof action !== 'string') {\n const userSettings = action || {};\n if (instance) {\n instance.updateSettings(userSettings);\n } else {\n instance = new Handsontable.Core($this[0], userSettings);\n $this.data('handsontable', instance);\n instance.init();\n }\n return $this;\n }\n let output;\n\n // Action case\n if (instance) {\n if (typeof instance[action] !== 'undefined') {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n output = instance[action].call(instance, ...args);\n if (action === 'destroy') {\n $this.removeData();\n }\n } else {\n throw new Error(`Handsontable do not provide action: ${action}`);\n }\n }\n return output;\n };\n}", "var _Handsontable$cellTyp, _Handsontable$editors, _Handsontable$rendere, _Handsontable$validat, _Handsontable$plugins;\nimport Handsontable, { CellCoords, CellRange } from \"./base.mjs\";\nimport { registerAllModules } from \"./registry.mjs\";\nimport EventManager, { getListenersCounter } from \"./eventManager.mjs\";\nimport { getRegisteredMapsCounter } from \"./translations/index.mjs\";\nimport jQueryWrapper from \"./helpers/wrappers/jquery.mjs\";\nimport GhostTable from \"./utils/ghostTable.mjs\";\nimport * as parseTableHelpers from \"./utils/parseTable.mjs\";\nimport * as arrayHelpers from \"./helpers/array.mjs\";\nimport * as browserHelpers from \"./helpers/browser.mjs\";\nimport * as dataHelpers from \"./helpers/data.mjs\";\nimport * as dateHelpers from \"./helpers/date.mjs\";\nimport * as featureHelpers from \"./helpers/feature.mjs\";\nimport * as functionHelpers from \"./helpers/function.mjs\";\nimport * as mixedHelpers from \"./helpers/mixed.mjs\";\nimport * as numberHelpers from \"./helpers/number.mjs\";\nimport * as objectHelpers from \"./helpers/object.mjs\";\nimport * as stringHelpers from \"./helpers/string.mjs\";\nimport * as unicodeHelpers from \"./helpers/unicode.mjs\";\nimport * as domHelpers from \"./helpers/dom/element.mjs\";\nimport * as domEventHelpers from \"./helpers/dom/event.mjs\";\nimport { getRegisteredEditorNames, getEditor, registerEditor } from \"./editors/registry.mjs\";\nimport { getRegisteredRendererNames, getRenderer, registerRenderer } from \"./renderers/registry.mjs\";\nimport { getRegisteredValidatorNames, getValidator, registerValidator } from \"./validators/registry.mjs\";\nimport { getRegisteredCellTypeNames, getCellType, registerCellType } from \"./cellTypes/registry.mjs\";\nimport { getPluginsNames, getPlugin, registerPlugin } from \"./plugins/registry.mjs\";\nimport { BasePlugin } from \"./plugins/base/index.mjs\";\nregisterAllModules();\njQueryWrapper(Handsontable);\n\n// TODO: Remove this exports after rewrite tests about this module\nHandsontable.__GhostTable = GhostTable;\nHandsontable._getListenersCounter = getListenersCounter; // For MemoryLeak tests\nHandsontable._getRegisteredMapsCounter = getRegisteredMapsCounter; // For MemoryLeak tests\nHandsontable.EventManager = EventManager;\n\n// Export all helpers to the Handsontable object\nconst HELPERS = [arrayHelpers, browserHelpers, dataHelpers, dateHelpers, featureHelpers, functionHelpers, mixedHelpers, numberHelpers, objectHelpers, stringHelpers, unicodeHelpers, parseTableHelpers];\nconst DOM = [domHelpers, domEventHelpers];\nHandsontable.helper = {};\nHandsontable.dom = {};\n\n// Fill general helpers.\narrayHelpers.arrayEach(HELPERS, helper => {\n arrayHelpers.arrayEach(Object.getOwnPropertyNames(helper), key => {\n if (key.charAt(0) !== '_') {\n Handsontable.helper[key] = helper[key];\n }\n });\n});\n\n// Fill DOM helpers.\narrayHelpers.arrayEach(DOM, helper => {\n arrayHelpers.arrayEach(Object.getOwnPropertyNames(helper), key => {\n if (key.charAt(0) !== '_') {\n Handsontable.dom[key] = helper[key];\n }\n });\n});\n\n// Export cell types.\nHandsontable.cellTypes = (_Handsontable$cellTyp = Handsontable.cellTypes) !== null && _Handsontable$cellTyp !== void 0 ? _Handsontable$cellTyp : {};\narrayHelpers.arrayEach(getRegisteredCellTypeNames(), cellTypeName => {\n Handsontable.cellTypes[cellTypeName] = getCellType(cellTypeName);\n});\nHandsontable.cellTypes.registerCellType = registerCellType;\nHandsontable.cellTypes.getCellType = getCellType;\n\n// Export all registered editors from the Handsontable.\nHandsontable.editors = (_Handsontable$editors = Handsontable.editors) !== null && _Handsontable$editors !== void 0 ? _Handsontable$editors : {};\narrayHelpers.arrayEach(getRegisteredEditorNames(), editorName => {\n Handsontable.editors[`${stringHelpers.toUpperCaseFirst(editorName)}Editor`] = getEditor(editorName);\n});\nHandsontable.editors.registerEditor = registerEditor;\nHandsontable.editors.getEditor = getEditor;\n\n// Export all registered renderers from the Handsontable.\nHandsontable.renderers = (_Handsontable$rendere = Handsontable.renderers) !== null && _Handsontable$rendere !== void 0 ? _Handsontable$rendere : {};\narrayHelpers.arrayEach(getRegisteredRendererNames(), rendererName => {\n const renderer = getRenderer(rendererName);\n if (rendererName === 'base') {\n Handsontable.renderers.cellDecorator = renderer;\n }\n Handsontable.renderers[`${stringHelpers.toUpperCaseFirst(rendererName)}Renderer`] = renderer;\n});\nHandsontable.renderers.registerRenderer = registerRenderer;\nHandsontable.renderers.getRenderer = getRenderer;\n\n// Export all registered validators from the Handsontable.\nHandsontable.validators = (_Handsontable$validat = Handsontable.validators) !== null && _Handsontable$validat !== void 0 ? _Handsontable$validat : {};\narrayHelpers.arrayEach(getRegisteredValidatorNames(), validatorName => {\n Handsontable.validators[`${stringHelpers.toUpperCaseFirst(validatorName)}Validator`] = getValidator(validatorName);\n});\nHandsontable.validators.registerValidator = registerValidator;\nHandsontable.validators.getValidator = getValidator;\n\n// Export all registered plugins from the Handsontable.\n// Make sure to initialize the plugin dictionary as an empty object. Otherwise, while\n// transpiling the files into ES and CommonJS format, the injected CoreJS helper\n// `import \"core-js/modules/es.object.get-own-property-names\";` won't be processed\n// by the `./config/plugin/babel/add-import-extension` babel plugin. Thus, the distribution\n// files will be broken. The reason is not known right now (probably it's caused by bug in\n// the Babel or missing something in the plugin).\nHandsontable.plugins = (_Handsontable$plugins = Handsontable.plugins) !== null && _Handsontable$plugins !== void 0 ? _Handsontable$plugins : {};\narrayHelpers.arrayEach(getPluginsNames(), pluginName => {\n Handsontable.plugins[pluginName] = getPlugin(pluginName);\n});\nHandsontable.plugins[`${stringHelpers.toUpperCaseFirst(BasePlugin.PLUGIN_KEY)}Plugin`] = BasePlugin;\nHandsontable.plugins.registerPlugin = registerPlugin;\nHandsontable.plugins.getPlugin = getPlugin;\nexport { CellCoords, CellRange };\nexport default Handsontable;", "importJobEnglishLevelOptions = checkWindowObject('importJobEnglishLevelOptions')\nimportJobWorkingHourStartOptions = checkWindowObject('importJobWorkingHourStartOptions')\nimportJobWorkingHourEndOptions = checkWindowObject('importJobWorkingHourEndOptions')\nimportJobPlaceholderTranslations = checkWindowObject('importJobPlaceholderTranslations')\n\nfunction checkWindowObject(obj) { return typeof window[obj] !== 'undefined' && window[obj] }\n\nlet importJobColumns = [\n {\n data: 'import_status',\n renderer: 'importStatusRenderer',\n readOnly: true\n },\n {\n data: 'title',\n type: 'text',\n placeholder: importJobPlaceholderTranslations['title'],\n validator: 'titleValidator',\n width: 255\n },\n {\n data: 'division_id',\n type: 'dropdown',\n placeholder: importJobPlaceholderTranslations['division_id'],\n width: 150\n },\n {\n data: 'employment_type',\n type: 'dropdown',\n placeholder: importJobPlaceholderTranslations['employment_type'],\n width: 150\n },\n {\n data: 'salary_min',\n type: 'numeric',\n numericFormat: {\n pattern: '0,0'\n },\n placeholder: importJobPlaceholderTranslations['salary_min'],\n width: 120\n },\n {\n data: 'salary_max',\n type: 'numeric',\n numericFormat: {\n pattern: '0,0'\n },\n placeholder: importJobPlaceholderTranslations['salary_max'],\n validator: 'salaryMaxValidator',\n width: 120\n },\n {\n data: 'working_location_ids',\n type: 'dropdown',\n placeholder: importJobPlaceholderTranslations['working_location_ids'],\n validator: 'workingLocationValidator',\n readOnly: true,\n width: 200\n },\n {\n data: 'description',\n type: 'text',\n placeholder: importJobPlaceholderTranslations['description'],\n validator: 'textLengthValidator',\n width: 255\n },\n {\n data: 'requirement',\n type: 'text',\n placeholder: importJobPlaceholderTranslations['requirement'],\n validator: 'textLengthValidator',\n width: 255\n },\n {\n data: 'english_level_id',\n type: 'dropdown',\n placeholder: importJobPlaceholderTranslations['english_level_id'],\n readOnly: true,\n width: 150\n },\n {\n data: 'working_hour_start',\n type: 'dropdown',\n placeholder: importJobPlaceholderTranslations['working_hour_start'],\n width: 200\n },\n {\n data: 'working_hour_end',\n type: 'dropdown',\n preventOverflow: 'vertical',\n placeholder: importJobPlaceholderTranslations['working_hour_end'],\n width: 200\n },\n {\n data: 'holiday',\n type: 'text',\n placeholder: importJobPlaceholderTranslations['holiday'],\n validator: 'stringLengthValidator',\n width: 255\n },\n {\n data: 'benefit',\n type: 'text',\n placeholder: importJobPlaceholderTranslations['benefit'],\n validator: 'textLengthValidator',\n width: 255\n },\n {\n data: 'report_to',\n type: 'text',\n placeholder: importJobPlaceholderTranslations['report_to'],\n validator: 'stringLengthValidator',\n width: 255\n },\n {\n data: 'hiring_target',\n type: 'numeric',\n numericFormat: {\n pattern: '0'\n },\n placeholder: importJobPlaceholderTranslations['hiring_target'],\n width: 200\n }\n]\n\nmodule.exports = { importJobColumns }\n", "importJobErrorMessages = checkWindowObject('importJobErrorMessages')\n\nfunction checkWindowObject(obj) { return typeof window[obj] !== 'undefined' && window[obj] }\n\nfunction decodeHTMLEntities(text) {\n const parser = new DOMParser(), doc = parser.parseFromString(text, 'text/html')\n\n return doc.documentElement.textContent;\n}\n\nconst importJobCells = function(row, col, prop) {\n const cellProperties = {},\n errorMessages = importJobErrorMessages.filter((element) => {\n return element.index === row && element.errors[prop]\n }).pop()\n\n if (errorMessages) {\n cellProperties.comment = { value: decodeHTMLEntities(errorMessages['errors'][prop]), readOnly: true }\n cellProperties.className = 'htInvalid'\n }\n\n return errorMessages ? cellProperties : {}\n}\n\nmodule.exports = { importJobCells }\n", "import Handsontable from 'handsontable'\n\nlet importStatusRenderer = (instance, td, row, col, prop, value, cellProperties) => {\n Handsontable.renderers.TextRenderer(instance, td, row, col, prop, value, cellProperties)\n\n switch (value) {\n case true:\n td.className = 'import-status valid'\n td.innerText = '\u2713'\n break\n\n case false:\n td.className = 'import-status invalid'\n td.innerText = '\u2717'\n break\n }\n}\n\nmodule.exports = { importStatusRenderer }\n", "function closeOtherSelection(otherSelectionContainer) {\n otherSelectionContainer.forEach((element) => {\n if (element.classList.contains('active')) { element.classList.remove('active') }\n })\n}\n\nfunction assignSelectionRow(selectionContainer, row) {\n const jobRow = selectionContainer.querySelector('input[name=\"job[row]\"]')\n\n jobRow && (jobRow.value = row)\n}\n\nfunction deSelect(selectionContainer) {\n const ssDeselect = selectionContainer.querySelector('.ss-deselect')\n\n ssDeselect && ssDeselect.click()\n}\n\nconst handleCellMouseDown = function(table, selectionContainer, otherSelectionContainer, propName) {\n table.addHook('afterOnCellMouseDown', (event, coords, td) => {\n if (event.button !== 0) return\n\n const prop = table.colToProp(coords.col)\n\n if (prop === propName) {\n closeOtherSelection(otherSelectionContainer)\n selectionContainer.classList.add('active')\n\n assignSelectionRow(selectionContainer, coords.row)\n deSelect(selectionContainer)\n }\n })\n}\n\nconst divisionSelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'division_id')\n}\n\nconst employmentTypeSelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'employment_type')\n}\n\nconst locationSelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'working_location_ids')\n}\n\nconst englishLevelSelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'english_level_id')\n}\n\nconst workingHourStartSelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'working_hour_start')\n}\n\nconst workingHourEndSelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'working_hour_end')\n}\n\nmodule.exports = { divisionSelection, employmentTypeSelection, locationSelection, englishLevelSelection,\n workingHourStartSelection, workingHourEndSelection }\n", "let validatorRegExp = {\n email: /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/,\n working_location: /^[0-9]+(-[0-9]+)*$/,\n url: /^(https?:\\/\\/)[a-zA-Z0-9-]+(\\.[a-zA-Z]{2,})+([\\/?].*)?$/\n}\n\nlet presence = (value) => { return value !== '' }\nlet email = (value) => { return value === null || validatorRegExp.email.test(value) }\nlet emailNotDuplicate = (value, duplicateEmails) => { return value === null || duplicateEmails.length === 0 }\nlet phoneNumber = (value) => { return value === null || value.length <= 15 }\nlet salary = (value) => { return value === null || value < 2000000000 }\nlet salaryMax = (max, min) => { return max === null || max >= min }\nlet workingLocation = (value) => { return value === null || validatorRegExp.working_location.test(value) }\nlet stringLength = (value) => { return value === null || value.length <= 255 }\nlet textLength = (value) => { return value === null || value.length <= 2000 }\nlet url = (value) => { return value === null || validatorRegExp.url.test(value) }\n\nconst fullNameValidator = function(value, callback) {\n callback(presence(value) && stringLength(value))\n}\n\nconst titleValidator = function(value, callback) {\n callback(presence(value) && stringLength(value))\n}\n\nconst emailValidator = function(value, callback) {\n const emails = this.instance.getDataAtCol(this.col)\n const duplicateEmails = emails.filter((email) => email !== null && email !== '' && email === value)\n\n callback(presence(value) && email(value) && emailNotDuplicate(value, duplicateEmails))\n}\n\nconst phoneNumberLengthValidator = function(value, callback) {\n callback(phoneNumber(value))\n}\n\nconst salaryValidator = function(value, callback) {\n callback(salary(value))\n}\n\nconst salaryMaxValidator = function(value, callback) {\n const rowData = this.instance.getSourceDataAtRow(this.row)\n const salaryMin = (rowData && rowData.salary_min) ? rowData.salary_min : 0\n\n callback(salaryMax(value, salaryMin))\n}\n\nconst workingLocationValidator = function(value, callback) {\n callback(workingLocation(value))\n}\n\nconst stringLengthValidator = function(value, callback) {\n callback(stringLength(value))\n}\n\nconst textLengthValidator = function(value, callback) {\n callback(textLength(value))\n}\n\nconst urlValidator = function(value, callback) {\n callback(url(value) && stringLength(value))\n}\n\nmodule.exports = { fullNameValidator, titleValidator, emailValidator, phoneNumberLengthValidator,\n salaryValidator, salaryMaxValidator, workingLocationValidator, stringLengthValidator, textLengthValidator, urlValidator }\n", "currentCompanyMemberIsAdmin = checkWindowObject('currentCompanyMemberIsAdmin')\ncurrentCompanyMemberDisplaySalary = checkWindowObject('currentCompanyMemberDisplaySalary')\nimportTalentGenderOptions = checkWindowObject('importTalentGenderOptions')\nimportTalentBirthdayDefaultDate = checkWindowObject('importTalentBirthdayDefaultDate')\nImportTalentGraduatedYearOptions = checkWindowObject('ImportTalentGraduatedYearOptions')\nimportTalentEnglishLevelOptions = checkWindowObject('importTalentEnglishLevelOptions')\nimportTalentPlaceholderTranslations = checkWindowObject('importTalentPlaceholderTranslations')\n\nfunction checkWindowObject(obj) { return typeof window[obj] !== 'undefined' && window[obj] }\n\nlet importTalentColumns = [\n {\n data: 'import_status',\n renderer: 'importStatusRenderer',\n readOnly: true\n },\n {\n data: 'full_name',\n type: 'text',\n placeholder: importTalentPlaceholderTranslations['full_name'],\n validator: 'fullNameValidator',\n width: 255\n },\n {\n data: 'email',\n type: 'text',\n placeholder: importTalentPlaceholderTranslations['email'],\n validator: 'emailValidator',\n width: 255\n },\n {\n data: 'active_job_id',\n type: 'dropdown',\n placeholder: importTalentPlaceholderTranslations['active_job_id'],\n width: 255\n },\n {\n data: 'cv',\n type: 'dropdown',\n placeholder: importTalentPlaceholderTranslations['cv'],\n readOnly: true,\n width: 255\n },\n {\n data: 'company_member_id',\n placeholder: importTalentPlaceholderTranslations['company_member_id'],\n renderer: 'companyMemberRenderer',\n width: 255\n },\n {\n data: 'phone_number',\n type: 'text',\n placeholder: importTalentPlaceholderTranslations['phone_number'],\n validator: 'phoneNumberLengthValidator',\n width: 150\n },\n {\n data: 'current_job_title',\n type: 'text',\n placeholder: importTalentPlaceholderTranslations['current_job_title'],\n validator: 'stringLengthValidator',\n width: 255\n },\n {\n data: 'current_company_name',\n type: 'text',\n placeholder: importTalentPlaceholderTranslations['current_company_name'],\n validator: 'stringLengthValidator',\n width: 255\n },\n {\n data: 'gender',\n type: 'dropdown',\n placeholder: importTalentPlaceholderTranslations['gender'],\n readOnly: true,\n width: 120\n },\n {\n data: 'birthday',\n type: 'date',\n correctFormat: true,\n dateFormat: 'YYYY-MM-DD',\n defaultDate: importTalentBirthdayDefaultDate,\n datePickerConfig: {\n firstDay: 0\n },\n placeholder: importTalentPlaceholderTranslations['birthday'],\n width: 150\n },\n {\n data: 'nationality_id',\n type: 'dropdown',\n placeholder: importTalentPlaceholderTranslations['nationality_id'],\n width: 150\n },\n {\n data: 'nickname',\n type: 'text',\n placeholder: importTalentPlaceholderTranslations['nickname'],\n validator: 'stringLengthValidator',\n width: 255\n },\n {\n data: 'linkedin_url',\n type: 'text',\n placeholder: importTalentPlaceholderTranslations['linkedin_url'],\n validator: 'urlValidator',\n width: 255\n },\n {\n data: 'current_salary',\n placeholder: importTalentPlaceholderTranslations['current_salary'],\n renderer: 'salaryRenderer',\n width: 150\n },\n {\n data: 'expected_salary',\n placeholder: importTalentPlaceholderTranslations['expected_salary'],\n renderer: 'salaryRenderer',\n width: 150\n },\n {\n data: 'work_experience',\n type: 'text',\n placeholder: importTalentPlaceholderTranslations['work_experience'],\n validator: 'textLengthValidator',\n width: 255\n },\n {\n data: 'strong_point',\n type: 'text',\n placeholder: importTalentPlaceholderTranslations['strong_point'],\n validator: 'textLengthValidator',\n width: 255\n },\n {\n data: 'degree_id',\n type: 'dropdown',\n placeholder: importTalentPlaceholderTranslations['degree_id'],\n width: 150\n },\n {\n data: 'major',\n type: 'text',\n placeholder: importTalentPlaceholderTranslations['major'],\n validator: 'stringLengthValidator',\n width: 255\n },\n {\n data: 'graduated_year',\n type: 'dropdown',\n placeholder: importTalentPlaceholderTranslations['graduated_year'],\n width: 150\n },\n {\n data: 'institution_name',\n type: 'text',\n placeholder: importTalentPlaceholderTranslations['institution_name'],\n validator: 'stringLengthValidator',\n width: 255\n },\n {\n data: 'gpa_score',\n type: 'numeric',\n numericFormat: {\n pattern: '0.0'\n },\n placeholder: importTalentPlaceholderTranslations['gpa_score'],\n width: 150\n },\n {\n data: 'living_locations',\n type: 'text',\n placeholder: importTalentPlaceholderTranslations['living_locations'],\n validator: 'stringLengthValidator',\n width: 255\n },\n {\n data: 'english_level_id',\n type: 'dropdown',\n placeholder: importTalentPlaceholderTranslations['english_level_id'],\n readOnly: true,\n width: 150\n },\n {\n data: 'language_ids',\n type: 'dropdown',\n placeholder: importTalentPlaceholderTranslations['language_ids'],\n readOnly: true,\n width: 255\n },\n {\n data: 'start_working_date',\n type: 'date',\n correctFormat: true,\n dateFormat: 'YYYY-MM-DD',\n datePickerConfig: {\n firstDay: 0\n },\n placeholder: importTalentPlaceholderTranslations['start_working_date'],\n width: 255\n },\n {\n data: 'additional_file1',\n type: 'dropdown',\n placeholder: importTalentPlaceholderTranslations['additional_file1'],\n readOnly: true,\n width: 255\n },\n {\n data: 'additional_file2',\n type: 'dropdown',\n placeholder: importTalentPlaceholderTranslations['additional_file2'],\n readOnly: true,\n width: 255\n },\n {\n data: 'cv_type',\n readOnly: true\n },\n {\n data: 'cv_content',\n readOnly: true\n },\n {\n data: 'additional_file1_type',\n readOnly: true\n },\n {\n data: 'additional_file1_content',\n readOnly: true\n },\n {\n data: 'additional_file2_type',\n readOnly: true\n },\n {\n data: 'additional_file2_content',\n readOnly: true\n }\n]\n\nmodule.exports = { importTalentColumns }\n", "importTalentErrorMessages = checkWindowObject('importTalentErrorMessages')\n\nfunction checkWindowObject(obj) { return typeof window[obj] !== 'undefined' && window[obj] }\n\nfunction decodeHTMLEntities(text) {\n const parser = new DOMParser(), doc = parser.parseFromString(text, 'text/html')\n\n return doc.documentElement.textContent;\n}\n\nfunction propWithoutId(prop) {\n return prop.endsWith('_id') ? prop.replace('_id', '') : prop\n}\n\nfunction errorMessagesFiltered(row, prop) {\n return importTalentErrorMessages.filter((element) => {\n return element.index === row && (element.errors[prop] || element.errors[propWithoutId(prop)])\n }).pop()\n}\n\nconst importTalentCells = function(row, col, prop) {\n const cellProperties = {}, errorMessages = errorMessagesFiltered(row, prop)\n\n if (errorMessages) {\n const value = errorMessages['errors'][prop] || errorMessages['errors'][propWithoutId(prop)]\n\n cellProperties.comment = { value: decodeHTMLEntities(value), readOnly: true }\n cellProperties.className = 'htInvalid'\n }\n\n return errorMessages ? cellProperties : {}\n}\n\nmodule.exports = { importTalentCells }\n", "import Handsontable from 'handsontable'\n\ncurrentCompanyMemberId = checkWindowObject('currentCompanyMemberId')\ncurrentCompanyMemberIsAdmin = checkWindowObject('currentCompanyMemberIsAdmin')\n\nfunction checkWindowObject(obj) { return typeof window[obj] !== 'undefined' && window[obj] }\n\nlet companyMemberRenderer = (instance, td, row, col, prop, value, cellProperties) => {\n Handsontable.renderers.TextRenderer(instance, td, row, col, prop, value, cellProperties)\n\n if(currentCompanyMemberIsAdmin) {\n cellProperties.type = 'dropdown'\n } else {\n td.innerText = currentCompanyMemberId\n }\n\n cellProperties.readOnly = !currentCompanyMemberIsAdmin\n}\n\nmodule.exports = { companyMemberRenderer }\n", "import Handsontable from 'handsontable'\n\ncurrentCompanyMemberDisplaySalary = checkWindowObject('currentCompanyMemberDisplaySalary')\n\nfunction checkWindowObject(obj) { return typeof window[obj] !== 'undefined' && window[obj] }\n\nlet salaryRenderer = (instance, td, row, col, prop, value, cellProperties) => {\n Handsontable.renderers.TextRenderer(instance, td, row, col, prop, value, cellProperties)\n\n if (currentCompanyMemberDisplaySalary) {\n cellProperties.type = 'numeric'\n cellProperties.numericFormat = { pattern: '0,0' }\n cellProperties.validator = 'salaryValidator'\n } else {\n td.innerText = '-'\n }\n\n cellProperties.readOnly = !currentCompanyMemberDisplaySalary\n}\n\nmodule.exports = { salaryRenderer }\n", "currentCompanyMemberIsAdmin = checkWindowObject('currentCompanyMemberIsAdmin')\n\nfunction checkWindowObject(obj) { return typeof window[obj] !== 'undefined' && window[obj] }\n\nfunction closeOtherSelection(otherSelectionContainer) {\n otherSelectionContainer.forEach((element) => {\n if (element.classList.contains('active')) { element.classList.remove('active') }\n })\n}\n\nfunction assignSelectionRow(selectionContainer, row) {\n const talentRow = selectionContainer.querySelector('input[name=\"talent[row]\"]')\n\n talentRow && (talentRow.value = row)\n}\n\nfunction deSelect(selectionContainer) {\n const ssDeselect = selectionContainer.querySelector('.ss-deselect')\n\n ssDeselect && ssDeselect.click()\n}\n\nconst handleCellMouseDown = function(table, selectionContainer, otherSelectionContainer, propName) {\n table.addHook('afterOnCellMouseDown', (event, coords, td) => {\n if (event.button !== 0) return\n\n const prop = table.colToProp(coords.col)\n\n if (prop === propName) {\n closeOtherSelection(otherSelectionContainer)\n selectionContainer.classList.add('active')\n\n assignSelectionRow(selectionContainer, coords.row)\n deSelect(selectionContainer)\n }\n })\n}\n\nconst activeJobSelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'active_job_id')\n}\n\nconst companyMemberSelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'company_member_id')\n}\n\nconst genderSelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'gender')\n}\n\nconst nationalitySelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'nationality_id')\n}\n\nconst degreeSelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'degree_id')\n}\n\nconst graduatedYearSelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'graduated_year')\n}\n\nconst languageSelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'language_ids')\n}\n\nconst englishLevelSelection = function(table, selectionContainer, otherSelectionContainer) {\n handleCellMouseDown(table, selectionContainer, otherSelectionContainer, 'english_level_id')\n}\n\nmodule.exports = { activeJobSelection, companyMemberSelection, genderSelection, nationalitySelection, degreeSelection,\n graduatedYearSelection, languageSelection, englishLevelSelection }\n", "function closeOtherAttachment(otherAttachmentContainer) {\n otherAttachmentContainer.forEach((element) => {\n if (element.classList.contains('active')) { element.classList.remove('active') }\n })\n}\n\n// function clickOutsideAttachment(attachmentContainer, td) {\n// document.addEventListener('click', function(event) {\n// const containerAttachmentAround = attachmentContainer.contains(event.target),\n// containerAttachmentVisible = window.getComputedStyle(attachmentContainer).visibility !== 'hidden',\n// containerAttachmentArea = !containerAttachmentAround && containerAttachmentVisible,\n// tdAround = td.contains(event.target),\n// tdVisible = window.getComputedStyle(td).visibility !== 'hidden',\n// tdArea = !tdAround && tdVisible,\n// leftClicked = (event.button === 1)\n//\n// if (containerAttachmentArea && tdArea && leftClicked) { attachmentContainer.classList.remove('active') }\n// })\n// }\n\nfunction assignAttachmentRow(attachmentContainer, row) {\n attachmentContainer.querySelector('input[name=\"talent[row]\"]').value = row\n}\n\nfunction deSelect(attachmentContainer) {\n // attachmentContainer.querySelector('.ss-deselect').click()\n}\n\nconst handleCellMouseDown = function(table, attachmentContainer, otherAttachmentContainer, propName) {\n table.addHook('afterOnCellMouseDown', (event, coords, td) => {\n if (event.button !== 0) return\n\n const prop = table.colToProp(coords.col)\n\n if (prop === propName) {\n closeOtherAttachment(otherAttachmentContainer)\n attachmentContainer.classList.add('active')\n\n assignAttachmentRow(attachmentContainer, coords.row)\n deSelect(attachmentContainer)\n\n // clickOutsideAttachment(attachmentContainer, td)\n }\n })\n}\n\nconst cv = function(table, attachmentContainer, otherAttachmentContainer) {\n handleCellMouseDown(table, attachmentContainer, otherAttachmentContainer, 'cv')\n}\n\nconst additionalFile1 = function(table, attachmentContainer, otherAttachmentContainer) {\n handleCellMouseDown(table, attachmentContainer, otherAttachmentContainer, 'additional_file1')\n}\n\nconst additionalFile2 = function(table, attachmentContainer, otherAttachmentContainer) {\n handleCellMouseDown(table, attachmentContainer, otherAttachmentContainer, 'additional_file2')\n}\n\nmodule.exports = { cv, additionalFile1, additionalFile2 }", "/*\nTrix 1.3.2\nCopyright \u00A9 2024 Basecamp, LLC\nhttp://trix-editor.org/\n */\n(function(){}).call(this),function(){var t;null==window.Set&&(window.Set=t=function(){function t(){this.clear()}return t.prototype.clear=function(){return this.values=[]},t.prototype.has=function(t){return-1!==this.values.indexOf(t)},t.prototype.add=function(t){return this.has(t)||this.values.push(t),this},t.prototype[\"delete\"]=function(t){var e;return-1===(e=this.values.indexOf(t))?!1:(this.values.splice(e,1),!0)},t.prototype.forEach=function(){var t;return(t=this.values).forEach.apply(t,arguments)},t}())}.call(this),function(t){function e(){}function n(t,e){return function(){t.apply(e,arguments)}}function i(t){if(\"object\"!=typeof this)throw new TypeError(\"Promises must be constructed via new\");if(\"function\"!=typeof t)throw new TypeError(\"not a function\");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],c(t,this)}function o(t,e){for(;3===t._state;)t=t._value;return 0===t._state?void t._deferreds.push(e):(t._handled=!0,void h(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null===n)return void(1===t._state?r:s)(e.promise,t._value);var i;try{i=n(t._value)}catch(o){return void s(e.promise,o)}r(e.promise,i)}))}function r(t,e){try{if(e===t)throw new TypeError(\"A promise cannot be resolved with itself.\");if(e&&(\"object\"==typeof e||\"function\"==typeof e)){var o=e.then;if(e instanceof i)return t._state=3,t._value=e,void a(t);if(\"function\"==typeof o)return void c(n(o,e),t)}t._state=1,t._value=e,a(t)}catch(r){s(t,r)}}function s(t,e){t._state=2,t._value=e,a(t)}function a(t){2===t._state&&0===t._deferreds.length&&setTimeout(function(){t._handled||p(t._value)},1);for(var e=0,n=t._deferreds.length;n>e;e++)o(t,t._deferreds[e]);t._deferreds=null}function u(t,e,n){this.onFulfilled=\"function\"==typeof t?t:null,this.onRejected=\"function\"==typeof e?e:null,this.promise=n}function c(t,e){var n=!1;try{t(function(t){n||(n=!0,r(e,t))},function(t){n||(n=!0,s(e,t))})}catch(i){if(n)return;n=!0,s(e,i)}}var l=setTimeout,h=\"function\"==typeof setImmediate&&setImmediate||function(t){l(t,1)},p=function(t){\"undefined\"!=typeof console&&console&&console.warn(\"Possible Unhandled Promise Rejection:\",t)};i.prototype[\"catch\"]=function(t){return this.then(null,t)},i.prototype.then=function(t,n){var r=new i(e);return o(this,new u(t,n,r)),r},i.all=function(t){var e=Array.prototype.slice.call(t);return new i(function(t,n){function i(r,s){try{if(s&&(\"object\"==typeof s||\"function\"==typeof s)){var a=s.then;if(\"function\"==typeof a)return void a.call(s,function(t){i(r,t)},n)}e[r]=s,0===--o&&t(e)}catch(u){n(u)}}if(0===e.length)return t([]);for(var o=e.length,r=0;ri;i++)t[i].then(e,n)})},i._setImmediateFn=function(t){h=t},i._setUnhandledRejectionFn=function(t){p=t},\"undefined\"!=typeof module&&module.exports?module.exports=i:t.Promise||(t.Promise=i)}(this),function(){var t=\"object\"==typeof window.customElements,e=\"function\"==typeof document.registerElement,n=t||e;n||(/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\"undefined\"==typeof WeakMap&&!function(){var t=Object.defineProperty,e=Date.now()%1e9,n=function(){this.name=\"__st\"+(1e9*Math.random()>>>0)+(e++ +\"__\")};n.prototype={set:function(e,n){var i=e[this.name];return i&&i[0]===e?i[1]=n:t(e,this.name,{value:[e,n],writable:!0}),this},get:function(t){var e;return(e=t[this.name])&&e[0]===t?e[1]:void 0},\"delete\":function(t){var e=t[this.name];return e&&e[0]===t?(e[0]=e[1]=void 0,!0):!1},has:function(t){var e=t[this.name];return e?e[0]===t:!1}},window.WeakMap=n}(),function(t){function e(t){A.push(t),b||(b=!0,g(i))}function n(t){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(t)||t}function i(){b=!1;var t=A;A=[],t.sort(function(t,e){return t.uid_-e.uid_});var e=!1;t.forEach(function(t){var n=t.takeRecords();o(t),n.length&&(t.callback_(n,t),e=!0)}),e&&i()}function o(t){t.nodes_.forEach(function(e){var n=m.get(e);n&&n.forEach(function(e){e.observer===t&&e.removeTransientObservers()})})}function r(t,e){for(var n=t;n;n=n.parentNode){var i=m.get(n);if(i)for(var o=0;o0){var o=n[i-1],r=d(o,t);if(r)return void(n[i-1]=r)}else e(this.observer);n[i]=t},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(t){var e=this.options;e.attributes&&t.addEventListener(\"DOMAttrModified\",this,!0),e.characterData&&t.addEventListener(\"DOMCharacterDataModified\",this,!0),e.childList&&t.addEventListener(\"DOMNodeInserted\",this,!0),(e.childList||e.subtree)&&t.addEventListener(\"DOMNodeRemoved\",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(t){var e=this.options;e.attributes&&t.removeEventListener(\"DOMAttrModified\",this,!0),e.characterData&&t.removeEventListener(\"DOMCharacterDataModified\",this,!0),e.childList&&t.removeEventListener(\"DOMNodeInserted\",this,!0),(e.childList||e.subtree)&&t.removeEventListener(\"DOMNodeRemoved\",this,!0)},addTransientObserver:function(t){if(t!==this.target){this.addListeners_(t),this.transientObservedNodes.push(t);var e=m.get(t);e||m.set(t,e=[]),e.push(this)}},removeTransientObservers:function(){var t=this.transientObservedNodes;this.transientObservedNodes=[],t.forEach(function(t){this.removeListeners_(t);for(var e=m.get(t),n=0;n=0)){n.push(t);for(var i,o=t.querySelectorAll(\"link[rel=\"+s+\"]\"),a=0,u=o.length;u>a&&(i=o[a]);a++)i.import&&r(i.import,e,n);e(t)}}var s=window.HTMLImports?window.HTMLImports.IMPORT_LINK_TYPE:\"none\";t.forDocumentTree=o,t.forSubtree=e}),window.CustomElements.addModule(function(t){function e(t,e){return n(t,e)||i(t,e)}function n(e,n){return t.upgrade(e,n)?!0:void(n&&s(e))}function i(t,e){b(t,function(t){return n(t,e)?!0:void 0})}function o(t){w.push(t),x||(x=!0,setTimeout(r))}function r(){x=!1;for(var t,e=w,n=0,i=e.length;i>n&&(t=e[n]);n++)t();w=[]}function s(t){C?o(function(){a(t)}):a(t)}function a(t){t.__upgraded__&&!t.__attached&&(t.__attached=!0,t.attachedCallback&&t.attachedCallback())}function u(t){c(t),b(t,function(t){c(t)})}function c(t){C?o(function(){l(t)}):l(t)}function l(t){t.__upgraded__&&t.__attached&&(t.__attached=!1,t.detachedCallback&&t.detachedCallback())}function h(t){for(var e=t,n=window.wrap(document);e;){if(e==n)return!0;e=e.parentNode||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host}}function p(t){if(t.shadowRoot&&!t.shadowRoot.__watched){y.dom&&console.log(\"watching shadow-root for: \",t.localName);for(var e=t.shadowRoot;e;)g(e),e=e.olderShadowRoot}}function d(t,n){if(y.dom){var i=n[0];if(i&&\"childList\"===i.type&&i.addedNodes&&i.addedNodes){for(var o=i.addedNodes[0];o&&o!==document&&!o.host;)o=o.parentNode;var r=o&&(o.URL||o._URL||o.host&&o.host.localName)||\"\";r=r.split(\"/?\").shift().split(\"/\").pop()}console.group(\"mutations (%d) [%s]\",n.length,r||\"\")}var s=h(t);n.forEach(function(t){\"childList\"===t.type&&(E(t.addedNodes,function(t){t.localName&&e(t,s)}),E(t.removedNodes,function(t){t.localName&&u(t)}))}),y.dom&&console.groupEnd()}function f(t){for(t=window.wrap(t),t||(t=window.wrap(document));t.parentNode;)t=t.parentNode;var e=t.__observer;e&&(d(t,e.takeRecords()),r())}function g(t){if(!t.__observer){var e=new MutationObserver(d.bind(this,t));e.observe(t,{childList:!0,subtree:!0}),t.__observer=e}}function m(t){t=window.wrap(t),y.dom&&console.group(\"upgradeDocument: \",t.baseURI.split(\"/\").pop());var n=t===window.wrap(document);e(t,n),g(t),y.dom&&console.groupEnd()}function v(t){A(t,m)}var y=t.flags,b=t.forSubtree,A=t.forDocumentTree,C=window.MutationObserver._isPolyfilled&&y[\"throttle-attached\"];t.hasPolyfillMutations=C,t.hasThrottledAttached=C;var x=!1,w=[],E=Array.prototype.forEach.call.bind(Array.prototype.forEach),S=Element.prototype.createShadowRoot;S&&(Element.prototype.createShadowRoot=function(){var t=S.call(this);return window.CustomElements.watchShadow(this),t}),t.watchShadow=p,t.upgradeDocumentTree=v,t.upgradeDocument=m,t.upgradeSubtree=i,t.upgradeAll=e,t.attached=s,t.takeRecords=f}),window.CustomElements.addModule(function(t){function e(e,i){if(\"template\"===e.localName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(e),!e.__upgraded__&&e.nodeType===Node.ELEMENT_NODE){var o=e.getAttribute(\"is\"),r=t.getRegisteredDefinition(e.localName)||t.getRegisteredDefinition(o);if(r&&(o&&r.tag==e.localName||!o&&!r.extends))return n(e,r,i)}}function n(e,n,o){return s.upgrade&&console.group(\"upgrade:\",e.localName),n.is&&e.setAttribute(\"is\",n.is),i(e,n),e.__upgraded__=!0,r(e),o&&t.attached(e),t.upgradeSubtree(e,o),s.upgrade&&console.groupEnd(),e}function i(t,e){Object.__proto__?t.__proto__=e.prototype:(o(t,e.prototype,e.native),t.__proto__=e.prototype)}function o(t,e,n){for(var i={},o=e;o!==n&&o!==HTMLElement.prototype;){for(var r,s=Object.getOwnPropertyNames(o),a=0;r=s[a];a++)i[r]||(Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(o,r)),i[r]=1);o=Object.getPrototypeOf(o)}}function r(t){t.createdCallback&&t.createdCallback()}var s=t.flags;t.upgrade=e,t.upgradeWithDefinition=n,t.implementPrototype=i}),window.CustomElements.addModule(function(t){function e(e,i){var u=i||{};if(!e)throw new Error(\"document.registerElement: first argument `name` must not be empty\");if(e.indexOf(\"-\")<0)throw new Error(\"document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '\"+String(e)+\"'.\");if(o(e))throw new Error(\"Failed to execute 'registerElement' on 'Document': Registration failed for type '\"+String(e)+\"'. The type name is invalid.\");if(c(e))throw new Error(\"DuplicateDefinitionError: a type with name '\"+String(e)+\"' is already registered\");return u.prototype||(u.prototype=Object.create(HTMLElement.prototype)),u.__name=e.toLowerCase(),u.extends&&(u.extends=u.extends.toLowerCase()),u.lifecycle=u.lifecycle||{},u.ancestry=r(u.extends),s(u),a(u),n(u.prototype),l(u.__name,u),u.ctor=h(u),u.ctor.prototype=u.prototype,u.prototype.constructor=u.ctor,t.ready&&m(document),u.ctor}function n(t){if(!t.setAttribute._polyfilled){var e=t.setAttribute;t.setAttribute=function(t,n){i.call(this,t,n,e)};var n=t.removeAttribute;t.removeAttribute=function(t){i.call(this,t,null,n)},t.setAttribute._polyfilled=!0}}function i(t,e,n){t=t.toLowerCase();var i=this.getAttribute(t);n.apply(this,arguments);var o=this.getAttribute(t);this.attributeChangedCallback&&o!==i&&this.attributeChangedCallback(t,i,o)}function o(t){for(var e=0;e=0&&b(i,HTMLElement),i)}function f(t,e){var n=t[e];t[e]=function(){var t=n.apply(this,arguments);return v(t),t}}var g,m=(t.isIE,t.upgradeDocumentTree),v=t.upgradeAll,y=t.upgradeWithDefinition,b=t.implementPrototype,A=t.useNative,C=[\"annotation-xml\",\"color-profile\",\"font-face\",\"font-face-src\",\"font-face-uri\",\"font-face-format\",\"font-face-name\",\"missing-glyph\"],x={},w=\"http://www.w3.org/1999/xhtml\",E=document.createElement.bind(document),S=document.createElementNS.bind(document);g=Object.__proto__||A?function(t,e){return t instanceof e}:function(t,e){if(t instanceof e)return!0;for(var n=t;n;){if(n===e.prototype)return!0;n=n.__proto__}return!1},f(Node.prototype,\"cloneNode\"),f(document,\"importNode\"),document.registerElement=e,document.createElement=d,document.createElementNS=p,t.registry=x,t.instanceof=g,t.reservedTagList=C,t.getRegisteredDefinition=c,document.register=document.registerElement}),function(t){function e(){r(window.wrap(document)),window.CustomElements.ready=!0;var t=window.requestAnimationFrame||function(t){setTimeout(t,16)};t(function(){setTimeout(function(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(window.CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.readyTime),document.dispatchEvent(new CustomEvent(\"WebComponentsReady\",{bubbles:!0}))})})}var n=t.useNative,i=t.initializeModules;if(t.isIE,n){var o=function(){};t.watchShadow=o,t.upgrade=o,t.upgradeAll=o,t.upgradeDocumentTree=o,t.upgradeSubtree=o,t.takeRecords=o,t.instanceof=function(t,e){return t instanceof e}}else i();var r=t.upgradeDocumentTree,s=t.upgradeDocument;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=window.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(t){return t}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function(t){t.import&&s(wrap(t.import))}),\"complete\"===document.readyState||t.flags.eager)e();else if(\"interactive\"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var a=window.HTMLImports&&!window.HTMLImports.ready?\"HTMLImportsLoaded\":\"DOMContentLoaded\";window.addEventListener(a,e)}else e()}(window.CustomElements))}.call(this),function(){}.call(this),function(){var t=this;(function(){(function(){this.Trix={VERSION:\"1.3.2\",ZERO_WIDTH_SPACE:\"\\ufeff\",NON_BREAKING_SPACE:\"\\xa0\",OBJECT_REPLACEMENT_CHARACTER:\"\\ufffc\",browser:{composesExistingText:/Android.*Chrome/.test(navigator.userAgent),forcesObjectResizing:/Trident.*rv:11/.test(navigator.userAgent),supportsInputEvents:function(){var t,e,n,i;if(\"undefined\"==typeof InputEvent)return!1;for(i=[\"data\",\"getTargetRanges\",\"inputType\"],t=0,e=i.length;e>t;t++)if(n=i[t],!(n in InputEvent.prototype))return!1;return!0}()},config:{}}}).call(this)}).call(t);var e=t.Trix;(function(){(function(){e.BasicObject=function(){function t(){}var e,n,i;return t.proxyMethod=function(t){var i,o,r,s,a;return r=n(t),i=r.name,s=r.toMethod,a=r.toProperty,o=r.optional,this.prototype[i]=function(){var t,n;return t=null!=s?o?\"function\"==typeof this[s]?this[s]():void 0:this[s]():null!=a?this[a]:void 0,o?(n=null!=t?t[i]:void 0,null!=n?e.call(n,t,arguments):void 0):(n=t[i],e.call(n,t,arguments))}},n=function(t){var e,n;if(!(n=t.match(i)))throw new Error(\"can't parse @proxyMethod expression: \"+t);return e={name:n[4]},null!=n[2]?e.toMethod=n[1]:e.toProperty=n[1],null!=n[3]&&(e.optional=!0),e},e=Function.prototype.apply,i=/^(.+?)(\\(\\))?(\\?)?\\.(.+?)$/,t}()}).call(this),function(){var t=function(t,e){function i(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;e.Object=function(n){function i(){this.id=++o}var o;return t(i,n),o=0,i.fromJSONString=function(t){return this.fromJSON(JSON.parse(t))},i.prototype.hasSameConstructorAs=function(t){return this.constructor===(null!=t?t.constructor:void 0)},i.prototype.isEqualTo=function(t){return this===t},i.prototype.inspect=function(){var t,e,n;return t=function(){var t,i,o;i=null!=(t=this.contentsForInspection())?t:{},o=[];for(e in i)n=i[e],o.push(e+\"=\"+n);return o}.call(this),\"#<\"+this.constructor.name+\":\"+this.id+(t.length?\" \"+t.join(\", \"):\"\")+\">\"},i.prototype.contentsForInspection=function(){},i.prototype.toJSONString=function(){return JSON.stringify(this)},i.prototype.toUTF16String=function(){return e.UTF16String.box(this)},i.prototype.getCacheKey=function(){return this.id.toString()},i}(e.BasicObject)}.call(this),function(){e.extend=function(t){var e,n;for(e in t)n=t[e],this[e]=n;return this}}.call(this),function(){e.extend({defer:function(t){return setTimeout(t,1)}})}.call(this),function(){var t,n;e.extend({normalizeSpaces:function(t){return t.replace(RegExp(\"\"+e.ZERO_WIDTH_SPACE,\"g\"),\"\").replace(RegExp(\"\"+e.NON_BREAKING_SPACE,\"g\"),\" \")},normalizeNewlines:function(t){return t.replace(/\\r\\n/g,\"\\n\")},breakableWhitespacePattern:RegExp(\"[^\\\\S\"+e.NON_BREAKING_SPACE+\"]\"),squishBreakableWhitespace:function(t){return t.replace(RegExp(\"\"+e.breakableWhitespacePattern.source,\"g\"),\" \").replace(/\\ {2,}/g,\" \")},summarizeStringChange:function(t,i){var o,r,s,a;return t=e.UTF16String.box(t),i=e.UTF16String.box(i),i.lengthn&&t.charAt(n).isEqualTo(e.charAt(n));)n++;for(;i>n+1&&t.charAt(i-1).isEqualTo(e.charAt(o-1));)i--,o--;return{utf16String:t.slice(n,i),offset:n}}}.call(this),function(){e.extend({copyObject:function(t){var e,n,i;null==t&&(t={}),n={};for(e in t)i=t[e],n[e]=i;return n},objectsAreEqual:function(t,e){var n,i;if(null==t&&(t={}),null==e&&(e={}),Object.keys(t).length!==Object.keys(e).length)return!1;for(n in t)if(i=t[n],i!==e[n])return!1;return!0}})}.call(this),function(){var t=[].slice;e.extend({arraysAreEqual:function(t,e){var n,i,o,r;if(null==t&&(t=[]),null==e&&(e=[]),t.length!==e.length)return!1;for(i=n=0,o=t.length;o>n;i=++n)if(r=t[i],r!==e[i])return!1;return!0},arrayStartsWith:function(t,n){return null==t&&(t=[]),null==n&&(n=[]),e.arraysAreEqual(t.slice(0,n.length),n)},spliceArray:function(){var e,n,i;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],i=n.slice(0),i.splice.apply(i,e),i},summarizeArrayChange:function(t,e){var n,i,o,r,s,a,u,c,l,h,p;for(null==t&&(t=[]),null==e&&(e=[]),n=[],h=[],o=new Set,r=0,u=t.length;u>r;r++)p=t[r],o.add(p);for(i=new Set,s=0,c=e.length;c>s;s++)p=e[s],i.add(p),o.has(p)||n.push(p);for(a=0,l=t.length;l>a;a++)p=t[a],i.has(p)||h.push(p);return{added:n,removed:h}}})}.call(this),function(){var t,n,i,o;t=null,n=null,o=null,i=null,e.extend({getAllAttributeNames:function(){return null!=t?t:t=e.getTextAttributeNames().concat(e.getBlockAttributeNames())},getBlockConfig:function(t){return e.config.blockAttributes[t]},getBlockAttributeNames:function(){return null!=n?n:n=Object.keys(e.config.blockAttributes)},getTextConfig:function(t){return e.config.textAttributes[t]},getTextAttributeNames:function(){return null!=o?o:o=Object.keys(e.config.textAttributes)},getListAttributeNames:function(){var t,n;return null!=i?i:i=function(){var i,o;i=e.config.blockAttributes,o=[];for(t in i)n=i[t].listAttribute,null!=n&&o.push(n);return o}()}})}.call(this),function(){var t,n,i,o,r,s=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};t=document.documentElement,n=null!=(i=null!=(o=null!=(r=t.matchesSelector)?r:t.webkitMatchesSelector)?o:t.msMatchesSelector)?i:t.mozMatchesSelector,e.extend({handleEvent:function(n,i){var o,r,s,a,u,c,l,h,p,d,f,g;return h=null!=i?i:{},c=h.onElement,u=h.matchingSelector,g=h.withCallback,a=h.inPhase,l=h.preventDefault,d=h.times,r=null!=c?c:t,p=u,o=g,f=\"capturing\"===a,s=function(t){var n;return null!=d&&0===--d&&s.destroy(),n=e.findClosestElementFromNode(t.target,{matchingSelector:p}),null!=n&&(null!=g&&g.call(n,t,n),l)?t.preventDefault():void 0},s.destroy=function(){return r.removeEventListener(n,s,f)},r.addEventListener(n,s,f),s},handleEventOnce:function(t,n){return null==n&&(n={}),n.times=1,e.handleEvent(t,n)},triggerEvent:function(n,i){var o,r,s,a,u,c,l;return l=null!=i?i:{},c=l.onElement,r=l.bubbles,s=l.cancelable,o=l.attributes,a=null!=c?c:t,r=r!==!1,s=s!==!1,u=document.createEvent(\"Events\"),u.initEvent(n,r,s),null!=o&&e.extend.call(u,o),a.dispatchEvent(u)},elementMatchesSelector:function(t,e){return 1===(null!=t?t.nodeType:void 0)?n.call(t,e):void 0},findClosestElementFromNode:function(t,n){var i,o,r;for(o=null!=n?n:{},i=o.matchingSelector,r=o.untilNode;null!=t&&t.nodeType!==Node.ELEMENT_NODE;)t=t.parentNode;if(null!=t){if(null==i)return t;if(t.closest&&null==r)return t.closest(i);for(;t&&t!==r;){if(e.elementMatchesSelector(t,i))return t;t=t.parentNode}}},findInnerElement:function(t){for(;null!=t?t.firstElementChild:void 0;)t=t.firstElementChild;return t},innerElementIsActive:function(t){return document.activeElement!==t&&e.elementContainsNode(t,document.activeElement)},elementContainsNode:function(t,e){if(t&&e)for(;e;){if(e===t)return!0;e=e.parentNode}},findNodeFromContainerAndOffset:function(t,e){var n;if(t)return t.nodeType===Node.TEXT_NODE?t:0===e?null!=(n=t.firstChild)?n:t:t.childNodes.item(e-1)},findElementFromContainerAndOffset:function(t,n){var i;return i=e.findNodeFromContainerAndOffset(t,n),e.findClosestElementFromNode(i)},findChildIndexOfNode:function(t){var e;if(null!=t?t.parentNode:void 0){for(e=0;t=t.previousSibling;)e++;return e}},removeNode:function(t){var e;return null!=t&&null!=(e=t.parentNode)?e.removeChild(t):void 0},walkTree:function(t,e){var n,i,o,r,s;return o=null!=e?e:{},i=o.onlyNodesOfType,r=o.usingFilter,n=o.expandEntityReferences,s=function(){switch(i){case\"element\":return NodeFilter.SHOW_ELEMENT;case\"text\":return NodeFilter.SHOW_TEXT;case\"comment\":return NodeFilter.SHOW_COMMENT;default:return NodeFilter.SHOW_ALL}}(),document.createTreeWalker(t,s,null!=r?r:null,n===!0)},tagName:function(t){var e;return null!=t&&null!=(e=t.tagName)?e.toLowerCase():void 0},makeElement:function(t,e){var n,i,o,r,s,a,u,c,l,h,p,d,f,g;if(null==e&&(e={}),\"object\"==typeof t?(e=t,t=e.tagName):e={attributes:e},o=document.createElement(t),null!=e.editable&&(null==e.attributes&&(e.attributes={}),e.attributes.contenteditable=e.editable),e.attributes){l=e.attributes;for(a in l)g=l[a],o.setAttribute(a,g)}if(e.style){h=e.style;for(a in h)g=h[a],o.style[a]=g}if(e.data){p=e.data;for(a in p)g=p[a],o.dataset[a]=g}if(e.className)for(d=e.className.split(\" \"),r=0,u=d.length;u>r;r++)i=d[r],o.classList.add(i);if(e.textContent&&(o.textContent=e.textContent),e.childNodes)for(f=[].concat(e.childNodes),s=0,c=f.length;c>s;s++)n=f[s],o.appendChild(n);return o},getBlockTagNames:function(){var t,n;return null!=e.blockTagNames?e.blockTagNames:e.blockTagNames=function(){var i,o;i=e.config.blockAttributes,o=[];for(t in i)n=i[t].tagName,n&&o.push(n);return o}()},nodeIsBlockContainer:function(t){return e.nodeIsBlockStartComment(null!=t?t.firstChild:void 0)},nodeProbablyIsBlockContainer:function(t){var n,i;return n=e.tagName(t),s.call(e.getBlockTagNames(),n)>=0&&(i=e.tagName(t.firstChild),s.call(e.getBlockTagNames(),i)<0)},nodeIsBlockStart:function(t,n){var i;return i=(null!=n?n:{strict:!0}).strict,i?e.nodeIsBlockStartComment(t):e.nodeIsBlockStartComment(t)||!e.nodeIsBlockStartComment(t.firstChild)&&e.nodeProbablyIsBlockContainer(t)},nodeIsBlockStartComment:function(t){return e.nodeIsCommentNode(t)&&\"block\"===(null!=t?t.data:void 0)},nodeIsCommentNode:function(t){return(null!=t?t.nodeType:void 0)===Node.COMMENT_NODE},nodeIsCursorTarget:function(t,n){var i;return i=(null!=n?n:{}).name,t?e.nodeIsTextNode(t)?t.data===e.ZERO_WIDTH_SPACE?i?t.parentNode.dataset.trixCursorTarget===i:!0:void 0:e.nodeIsCursorTarget(t.firstChild):void 0},nodeIsAttachmentElement:function(t){return e.elementMatchesSelector(t,e.AttachmentView.attachmentSelector)},nodeIsEmptyTextNode:function(t){return e.nodeIsTextNode(t)&&\"\"===(null!=t?t.data:void 0)},nodeIsTextNode:function(t){return(null!=t?t.nodeType:void 0)===Node.TEXT_NODE}})}.call(this),function(){var t,n,i,o,r;t=e.copyObject,o=e.objectsAreEqual,e.extend({normalizeRange:i=function(t){var e;if(null!=t)return Array.isArray(t)||(t=[t,t]),[n(t[0]),n(null!=(e=t[1])?e:t[0])]},rangeIsCollapsed:function(t){var e,n,o;if(null!=t)return n=i(t),o=n[0],e=n[1],r(o,e)},rangesAreEqual:function(t,e){var n,o,s,a,u,c;if(null!=t&&null!=e)return s=i(t),o=s[0],n=s[1],a=i(e),c=a[0],u=a[1],r(o,c)&&r(n,u)}}),n=function(e){return\"number\"==typeof e?e:t(e)},r=function(t,e){return\"number\"==typeof t?t===e:o(t,e)}}.call(this),function(){var t,n,i,o,r,s,a;e.registerElement=function(t,e){var n,i;return null==e&&(e={}),t=t.toLowerCase(),e=a(e),i=s(e),(n=i.defaultCSS)&&(delete i.defaultCSS,o(n,t)),r(t,i)},o=function(t,e){var n;return n=i(e),n.textContent=t.replace(/%t/g,e)},i=function(e){var n,i;return n=document.createElement(\"style\"),n.setAttribute(\"type\",\"text/css\"),n.setAttribute(\"data-tag-name\",e.toLowerCase()),(i=t())&&n.setAttribute(\"nonce\",i),document.head.insertBefore(n,document.head.firstChild),n},t=function(){var t;return(t=n(\"trix-csp-nonce\")||n(\"csp-nonce\"))?t.getAttribute(\"content\"):void 0},n=function(t){return document.head.querySelector(\"meta[name=\"+t+\"]\")},s=function(t){var e,n,i;n={};for(e in t)i=t[e],n[e]=\"function\"==typeof i?{value:i}:i;return n},a=function(){var t;return t=function(t){var e,n,i,o,r;for(e={},r=[\"initialize\",\"connect\",\"disconnect\"],n=0,o=r.length;o>n;n++)i=r[n],e[i]=t[i],delete t[i];return e},window.customElements?function(e){var n,i,o,r,s;return s=t(e),o=s.initialize,n=s.connect,i=s.disconnect,o&&(r=n,n=function(){return this.initialized||(this.initialized=!0,o.call(this)),null!=r?r.call(this):void 0}),n&&(e.connectedCallback=n),i&&(e.disconnectedCallback=i),e}:function(e){var n,i,o,r;return r=t(e),o=r.initialize,n=r.connect,i=r.disconnect,o&&(e.createdCallback=o),n&&(e.attachedCallback=n),i&&(e.detachedCallback=i),e}}(),r=function(){return window.customElements?function(t,e){var n;return n=function(){return\"object\"==typeof Reflect?Reflect.construct(HTMLElement,[],n):HTMLElement.apply(this)},Object.setPrototypeOf(n.prototype,HTMLElement.prototype),Object.setPrototypeOf(n,HTMLElement),Object.defineProperties(n.prototype,e),window.customElements.define(t,n),n}:function(t,e){var n,i;return i=Object.create(HTMLElement.prototype,e),n=document.registerElement(t,{prototype:i}),Object.defineProperty(i,\"constructor\",{value:n}),n}}()}.call(this),function(){var t,n;e.extend({getDOMSelection:function(){var t;return t=window.getSelection(),t.rangeCount>0?t:void 0},getDOMRange:function(){var n,i;return(n=null!=(i=e.getDOMSelection())?i.getRangeAt(0):void 0)&&!t(n)?n:void 0},setDOMRange:function(t){var n;return n=window.getSelection(),n.removeAllRanges(),n.addRange(t),e.selectionChangeObserver.update()}}),t=function(t){return n(t.startContainer)||n(t.endContainer)},n=function(t){return!Object.getPrototypeOf(t)}}.call(this),function(){var t;t={\"application/x-trix-feature-detection\":\"test\"},e.extend({dataTransferIsPlainText:function(t){var e,n,i;return i=t.getData(\"text/plain\"),n=t.getData(\"text/html\"),i&&n?(e=(new DOMParser).parseFromString(n,\"text/html\").body,e.textContent===i?!e.querySelector(\"*\"):void 0):null!=i?i.length:void 0},dataTransferIsWritable:function(e){var n,i;if(null!=(null!=e?e.setData:void 0)){for(n in t)if(i=t[n],!function(){try{return e.setData(n,i),e.getData(n)===i}catch(t){}}())return;return!0}},keyEventIsKeyboardCommand:function(){return/Mac|^iP/.test(navigator.platform)?function(t){return t.metaKey}:function(t){return t.ctrlKey}}()})}.call(this),function(){e.extend({RTL_PATTERN:/[\\u05BE\\u05C0\\u05C3\\u05D0-\\u05EA\\u05F0-\\u05F4\\u061B\\u061F\\u0621-\\u063A\\u0640-\\u064A\\u066D\\u0671-\\u06B7\\u06BA-\\u06BE\\u06C0-\\u06CE\\u06D0-\\u06D5\\u06E5\\u06E6\\u200F\\u202B\\u202E\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE72\\uFE74\\uFE76-\\uFEFC]/,getDirection:function(){var t,n,i,o;return n=e.makeElement(\"input\",{dir:\"auto\",name:\"x\",dirName:\"x.dir\"}),t=e.makeElement(\"form\"),t.appendChild(n),i=function(){try{return new FormData(t).has(n.dirName)}catch(e){}}(),o=function(){try{return n.matches(\":dir(ltr),:dir(rtl)\")}catch(t){}}(),i?function(e){return n.value=e,new FormData(t).get(n.dirName)}:o?function(t){return n.value=t,n.matches(\":dir(rtl)\")?\"rtl\":\"ltr\"}:function(t){var n;return n=t.trim().charAt(0),e.RTL_PATTERN.test(n)?\"rtl\":\"ltr\"}}()})}.call(this),function(){}.call(this),function(){var t,n=function(t,e){function n(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=e.arraysAreEqual,e.Hash=function(i){function o(t){null==t&&(t={}),this.values=s(t),o.__super__.constructor.apply(this,arguments)}var r,s,a,u,c;return n(o,i),o.fromCommonAttributesOfObjects=function(t){var e,n,i,o,s,a;if(null==t&&(t=[]),!t.length)return new this;for(e=r(t[0]),i=e.getKeys(),a=t.slice(1),n=0,o=a.length;o>n;n++)s=a[n],i=e.getKeysCommonToHash(r(s)),e=e.slice(i);return e},o.box=function(t){return r(t)},o.prototype.add=function(t,e){return this.merge(u(t,e))},o.prototype.remove=function(t){return new e.Hash(s(this.values,t))},o.prototype.get=function(t){return this.values[t]},o.prototype.has=function(t){return t in this.values},o.prototype.merge=function(t){return new e.Hash(a(this.values,c(t)))},o.prototype.slice=function(t){var n,i,o,r;for(r={},n=0,o=t.length;o>n;n++)i=t[n],this.has(i)&&(r[i]=this.values[i]);return new e.Hash(r)},o.prototype.getKeys=function(){return Object.keys(this.values)},o.prototype.getKeysCommonToHash=function(t){var e,n,i,o,s;for(t=r(t),o=this.getKeys(),s=[],e=0,i=o.length;i>e;e++)n=o[e],this.values[n]===t.values[n]&&s.push(n);return s},o.prototype.isEqualTo=function(e){return t(this.toArray(),r(e).toArray())},o.prototype.isEmpty=function(){return 0===this.getKeys().length},o.prototype.toArray=function(){var t,e,n;return(null!=this.array?this.array:this.array=function(){var i;e=[],i=this.values;for(t in i)n=i[t],e.push(t,n);return e}.call(this)).slice(0)},o.prototype.toObject=function(){return s(this.values)},o.prototype.toJSON=function(){return this.toObject()},o.prototype.contentsForInspection=function(){return{values:JSON.stringify(this.values)}},u=function(t,e){var n;return n={},n[t]=e,n},a=function(t,e){var n,i,o;i=s(t);for(n in e)o=e[n],i[n]=o;return i},s=function(t,e){var n,i,o,r,s;for(r={},s=Object.keys(t).sort(),n=0,o=s.length;o>n;n++)i=s[n],i!==e&&(r[i]=t[i]);return r},r=function(t){return t instanceof e.Hash?t:new e.Hash(t)},c=function(t){return t instanceof e.Hash?t.values:t\n},o}(e.Object)}.call(this),function(){e.ObjectGroup=function(){function t(t,e){var n,i;this.objects=null!=t?t:[],i=e.depth,n=e.asTree,n&&(this.depth=i,this.objects=this.constructor.groupObjects(this.objects,{asTree:n,depth:this.depth+1}))}return t.groupObjects=function(t,e){var n,i,o,r,s,a,u,c,l;for(null==t&&(t=[]),l=null!=e?e:{},o=l.depth,n=l.asTree,n&&null==o&&(o=0),c=[],s=0,a=t.length;a>s;s++){if(u=t[s],r){if((\"function\"==typeof u.canBeGrouped?u.canBeGrouped(o):void 0)&&(\"function\"==typeof(i=r[r.length-1]).canBeGroupedWith?i.canBeGroupedWith(u,o):void 0)){r.push(u);continue}c.push(new this(r,{depth:o,asTree:n})),r=null}(\"function\"==typeof u.canBeGrouped?u.canBeGrouped(o):void 0)?r=[u]:c.push(u)}return r&&c.push(new this(r,{depth:o,asTree:n})),c},t.prototype.getObjects=function(){return this.objects},t.prototype.getDepth=function(){return this.depth},t.prototype.getCacheKey=function(){var t,e,n,i,o;for(e=[\"objectGroup\"],o=this.getObjects(),t=0,n=o.length;n>t;t++)i=o[t],e.push(i.getCacheKey());return e.join(\"/\")},t}()}.call(this),function(){var t=function(t,e){function i(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;e.ObjectMap=function(e){function n(t){var e,n,i,o,r;for(null==t&&(t=[]),this.objects={},i=0,o=t.length;o>i;i++)r=t[i],n=JSON.stringify(r),null==(e=this.objects)[n]&&(e[n]=r)}return t(n,e),n.prototype.find=function(t){var e;return e=JSON.stringify(t),this.objects[e]},n}(e.BasicObject)}.call(this),function(){e.ElementStore=function(){function t(t){this.reset(t)}var e;return t.prototype.add=function(t){var n;return n=e(t),this.elements[n]=t},t.prototype.remove=function(t){var n,i;return n=e(t),(i=this.elements[n])?(delete this.elements[n],i):void 0},t.prototype.reset=function(t){var e,n,i;for(null==t&&(t=[]),this.elements={},n=0,i=t.length;i>n;n++)e=t[n],this.add(e);return t},e=function(t){return t.dataset.trixStoreKey},t}()}.call(this),function(){}.call(this),function(){var t=function(t,e){function i(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;e.Operation=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.isPerforming=function(){return this.performing===!0},n.prototype.hasPerformed=function(){return this.performed===!0},n.prototype.hasSucceeded=function(){return this.performed&&this.succeeded},n.prototype.hasFailed=function(){return this.performed&&!this.succeeded},n.prototype.getPromise=function(){return null!=this.promise?this.promise:this.promise=new Promise(function(t){return function(e,n){return t.performing=!0,t.perform(function(i,o){return t.succeeded=i,t.performing=!1,t.performed=!0,t.succeeded?e(o):n(o)})}}(this))},n.prototype.perform=function(t){return t(!1)},n.prototype.release=function(){var t;return null!=(t=this.promise)&&\"function\"==typeof t.cancel&&t.cancel(),this.promise=null,this.performing=null,this.performed=null,this.succeeded=null},n.proxyMethod(\"getPromise().then\"),n.proxyMethod(\"getPromise().catch\"),n}(e.BasicObject)}.call(this),function(){var t,n,i,o,r,s=function(t,e){function n(){this.constructor=t}for(var i in e)a.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;e.UTF16String=function(t){function e(t,e){this.ucs2String=t,this.codepoints=e,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}return s(e,t),e.box=function(t){return null==t&&(t=\"\"),t instanceof this?t:this.fromUCS2String(null!=t?t.toString():void 0)},e.fromUCS2String=function(t){return new this(t,o(t))},e.fromCodepoints=function(t){return new this(r(t),t)},e.prototype.offsetToUCS2Offset=function(t){return r(this.codepoints.slice(0,Math.max(0,t))).length},e.prototype.offsetFromUCS2Offset=function(t){return o(this.ucs2String.slice(0,Math.max(0,t))).length},e.prototype.slice=function(){var t;return this.constructor.fromCodepoints((t=this.codepoints).slice.apply(t,arguments))},e.prototype.charAt=function(t){return this.slice(t,t+1)},e.prototype.isEqualTo=function(t){return this.constructor.box(t).ucs2String===this.ucs2String},e.prototype.toJSON=function(){return this.ucs2String},e.prototype.getCacheKey=function(){return this.ucs2String},e.prototype.toString=function(){return this.ucs2String},e}(e.BasicObject),t=1===(\"function\"==typeof Array.from?Array.from(\"\\ud83d\\udc7c\").length:void 0),n=null!=(\"function\"==typeof\" \".codePointAt?\" \".codePointAt(0):void 0),i=\" \\ud83d\\udc7c\"===(\"function\"==typeof String.fromCodePoint?String.fromCodePoint(32,128124):void 0),o=t&&n?function(t){return Array.from(t).map(function(t){return t.codePointAt(0)})}:function(t){var e,n,i,o,r;for(o=[],e=0,i=t.length;i>e;)r=t.charCodeAt(e++),r>=55296&&56319>=r&&i>e&&(n=t.charCodeAt(e++),56320===(64512&n)?r=((1023&r)<<10)+(1023&n)+65536:e--),o.push(r);return o},r=i?function(t){return String.fromCodePoint.apply(String,t)}:function(t){var e,n,i;return e=function(){var e,o,r;for(r=[],e=0,o=t.length;o>e;e++)i=t[e],n=\"\",i>65535&&(i-=65536,n+=String.fromCharCode(i>>>10&1023|55296),i=56320|1023&i),r.push(n+String.fromCharCode(i));return r}(),e.join(\"\")}}.call(this),function(){}.call(this),function(){}.call(this),function(){e.config.lang={attachFiles:\"Attach Files\",bold:\"Bold\",bullets:\"Bullets\",\"byte\":\"Byte\",bytes:\"Bytes\",captionPlaceholder:\"Add a caption\\u2026\",code:\"Code\",heading1:\"Heading\",indent:\"Increase Level\",italic:\"Italic\",link:\"Link\",numbers:\"Numbers\",outdent:\"Decrease Level\",quote:\"Quote\",redo:\"Redo\",remove:\"Remove\",strike:\"Strikethrough\",undo:\"Undo\",unlink:\"Unlink\",url:\"URL\",urlPlaceholder:\"Enter a URL\\u2026\",GB:\"GB\",KB:\"KB\",MB:\"MB\",PB:\"PB\",TB:\"TB\"}}.call(this),function(){e.config.css={attachment:\"attachment\",attachmentCaption:\"attachment__caption\",attachmentCaptionEditor:\"attachment__caption-editor\",attachmentMetadata:\"attachment__metadata\",attachmentMetadataContainer:\"attachment__metadata-container\",attachmentName:\"attachment__name\",attachmentProgress:\"attachment__progress\",attachmentSize:\"attachment__size\",attachmentToolbar:\"attachment__toolbar\",attachmentGallery:\"attachment-gallery\"}}.call(this),function(){var t;e.config.blockAttributes=t={\"default\":{tagName:\"div\",parse:!1},quote:{tagName:\"blockquote\",nestable:!0},heading1:{tagName:\"h1\",terminal:!0,breakOnReturn:!0,group:!1},code:{tagName:\"pre\",terminal:!0,text:{plaintext:!0}},bulletList:{tagName:\"ul\",parse:!1},bullet:{tagName:\"li\",listAttribute:\"bulletList\",group:!1,nestable:!0,test:function(n){return e.tagName(n.parentNode)===t[this.listAttribute].tagName}},numberList:{tagName:\"ol\",parse:!1},number:{tagName:\"li\",listAttribute:\"numberList\",group:!1,nestable:!0,test:function(n){return e.tagName(n.parentNode)===t[this.listAttribute].tagName}},attachmentGallery:{tagName:\"div\",exclusive:!0,terminal:!0,parse:!1,group:!1}}}.call(this),function(){var t,n;t=e.config.lang,n=[t.bytes,t.KB,t.MB,t.GB,t.TB,t.PB],e.config.fileSize={prefix:\"IEC\",precision:2,formatter:function(e){var i,o,r,s,a;switch(e){case 0:return\"0 \"+t.bytes;case 1:return\"1 \"+t.byte;default:return i=function(){switch(this.prefix){case\"SI\":return 1e3;case\"IEC\":return 1024}}.call(this),o=Math.floor(Math.log(e)/Math.log(i)),r=e/Math.pow(i,o),s=r.toFixed(this.precision),a=s.replace(/0*$/,\"\").replace(/\\.$/,\"\"),a+\" \"+n[o]}}}}.call(this),function(){e.config.textAttributes={bold:{tagName:\"strong\",inheritable:!0,parser:function(t){var e;return e=window.getComputedStyle(t),\"bold\"===e.fontWeight||e.fontWeight>=600}},italic:{tagName:\"em\",inheritable:!0,parser:function(t){var e;return e=window.getComputedStyle(t),\"italic\"===e.fontStyle}},href:{groupTagName:\"a\",parser:function(t){var n,i,o;return n=e.AttachmentView.attachmentSelector,o=\"a:not(\"+n+\")\",(i=e.findClosestElementFromNode(t,{matchingSelector:o}))?i.getAttribute(\"href\"):void 0}},strike:{tagName:\"del\",inheritable:!0},frozen:{style:{backgroundColor:\"highlight\"}}}}.call(this),function(){var t,n,i,o,r;r=\"[data-trix-serialize=false]\",o=[\"contenteditable\",\"data-trix-id\",\"data-trix-store-key\",\"data-trix-mutable\",\"data-trix-placeholder\",\"tabindex\"],n=\"data-trix-serialized-attributes\",i=\"[\"+n+\"]\",t=new RegExp(\"\",\"g\"),e.extend({serializers:{\"application/json\":function(t){var n;if(t instanceof e.Document)n=t;else{if(!(t instanceof HTMLElement))throw new Error(\"unserializable object\");n=e.Document.fromHTML(t.innerHTML)}return n.toSerializableDocument().toJSONString()},\"text/html\":function(s){var a,u,c,l,h,p,d,f,g,m,v,y,b,A,C,x,w;if(s instanceof e.Document)l=e.DocumentView.render(s);else{if(!(s instanceof HTMLElement))throw new Error(\"unserializable object\");l=s.cloneNode(!0)}for(A=l.querySelectorAll(r),h=0,g=A.length;g>h;h++)c=A[h],e.removeNode(c);for(p=0,m=o.length;m>p;p++)for(a=o[p],C=l.querySelectorAll(\"[\"+a+\"]\"),d=0,v=C.length;v>d;d++)c=C[d],c.removeAttribute(a);for(x=l.querySelectorAll(i),f=0,y=x.length;y>f;f++){c=x[f];try{u=JSON.parse(c.getAttribute(n)),c.removeAttribute(n);for(b in u)w=u[b],c.setAttribute(b,w)}catch(E){}}return l.innerHTML.replace(t,\"\")}},deserializers:{\"application/json\":function(t){return e.Document.fromJSONString(t)},\"text/html\":function(t){return e.Document.fromHTML(t)}},serializeToContentType:function(t,n){var i;if(i=e.serializers[n])return i(t);throw new Error(\"unknown content type: \"+n)},deserializeFromContentType:function(t,n){var i;if(i=e.deserializers[n])return i(t);throw new Error(\"unknown content type: \"+n)}})}.call(this),function(){var t;t=e.config.lang,e.config.toolbar={getDefaultHTML:function(){return'
\\n \\n \\n \\n \\n \\n \\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\\n \\n \\n \\n\\n \\n\\n \\n \\n \\n \\n
\\n\\n
\\n
\\n \\n
\\n
'}}}.call(this),function(){e.config.undoInterval=5e3}.call(this),function(){e.config.attachments={preview:{presentation:\"gallery\",caption:{name:!0,size:!0}},file:{caption:{size:!0}}}}.call(this),function(){e.config.keyNames={8:\"backspace\",9:\"tab\",13:\"return\",27:\"escape\",37:\"left\",39:\"right\",46:\"delete\",68:\"d\",72:\"h\",79:\"o\"}}.call(this),function(){e.config.input={level2Enabled:!0,getLevel:function(){return this.level2Enabled&&e.browser.supportsInputEvents?2:0},pickFiles:function(t){var n;return n=e.makeElement(\"input\",{type:\"file\",multiple:!0,hidden:!0,id:this.fileInputId}),n.addEventListener(\"change\",function(){return t(n.files),e.removeNode(n)}),e.removeNode(document.getElementById(this.fileInputId)),document.body.appendChild(n),n.click()},fileInputId:\"trix-file-input-\"+Date.now().toString(16)}}.call(this),function(){}.call(this),function(){e.registerElement(\"trix-toolbar\",{defaultCSS:\"%t {\\n display: block;\\n}\\n\\n%t {\\n white-space: nowrap;\\n}\\n\\n%t [data-trix-dialog] {\\n display: none;\\n}\\n\\n%t [data-trix-dialog][data-trix-active] {\\n display: block;\\n}\\n\\n%t [data-trix-dialog] [data-trix-validate]:invalid {\\n background-color: #ffdddd;\\n}\",initialize:function(){return\"\"===this.innerHTML?this.innerHTML=e.config.toolbar.getDefaultHTML():void 0}})}.call(this),function(){var t=function(t,e){function i(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty,i=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};e.ObjectView=function(n){function o(t,e){this.object=t,this.options=null!=e?e:{},this.childViews=[],this.rootView=this}return t(o,n),o.prototype.getNodes=function(){var t,e,n,i,o;for(null==this.nodes&&(this.nodes=this.createNodes()),i=this.nodes,o=[],t=0,e=i.length;e>t;t++)n=i[t],o.push(n.cloneNode(!0));return o},o.prototype.invalidate=function(){var t;return this.nodes=null,this.childViews=[],null!=(t=this.parentView)?t.invalidate():void 0},o.prototype.invalidateViewForObject=function(t){var e;return null!=(e=this.findViewForObject(t))?e.invalidate():void 0},o.prototype.findOrCreateCachedChildView=function(t,e){var n;return(n=this.getCachedViewForObject(e))?this.recordChildView(n):(n=this.createChildView.apply(this,arguments),this.cacheViewForObject(n,e)),n},o.prototype.createChildView=function(t,n,i){var o;return null==i&&(i={}),n instanceof e.ObjectGroup&&(i.viewClass=t,t=e.ObjectGroupView),o=new t(n,i),this.recordChildView(o)},o.prototype.recordChildView=function(t){return t.parentView=this,t.rootView=this.rootView,this.childViews.push(t),t},o.prototype.getAllChildViews=function(){var t,e,n,i,o;for(o=[],i=this.childViews,e=0,n=i.length;n>e;e++)t=i[e],o.push(t),o=o.concat(t.getAllChildViews());return o},o.prototype.findElement=function(){return this.findElementForObject(this.object)},o.prototype.findElementForObject=function(t){var e;return(e=null!=t?t.id:void 0)?this.rootView.element.querySelector(\"[data-trix-id='\"+e+\"']\"):void 0},o.prototype.findViewForObject=function(t){var e,n,i,o;for(i=this.getAllChildViews(),e=0,n=i.length;n>e;e++)if(o=i[e],o.object===t)return o},o.prototype.getViewCache=function(){return this.rootView!==this?this.rootView.getViewCache():this.isViewCachingEnabled()?null!=this.viewCache?this.viewCache:this.viewCache={}:void 0},o.prototype.isViewCachingEnabled=function(){return this.shouldCacheViews!==!1},o.prototype.enableViewCaching=function(){return this.shouldCacheViews=!0},o.prototype.disableViewCaching=function(){return this.shouldCacheViews=!1},o.prototype.getCachedViewForObject=function(t){var e;return null!=(e=this.getViewCache())?e[t.getCacheKey()]:void 0},o.prototype.cacheViewForObject=function(t,e){var n;return null!=(n=this.getViewCache())?n[e.getCacheKey()]=t:void 0},o.prototype.garbageCollectCachedViews=function(){var t,e,n,o,r,s;if(t=this.getViewCache()){s=this.getAllChildViews().concat(this),n=function(){var t,e,n;for(n=[],t=0,e=s.length;e>t;t++)r=s[t],n.push(r.object.getCacheKey());return n}(),o=[];for(e in t)i.call(n,e)<0&&o.push(delete t[e]);return o}},o}(e.BasicObject)}.call(this),function(){var t=function(t,e){function i(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;e.ObjectGroupView=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.objectGroup=this.object,this.viewClass=this.options.viewClass,delete this.options.viewClass}return t(n,e),n.prototype.getChildViews=function(){var t,e,n,i;if(!this.childViews.length)for(i=this.objectGroup.getObjects(),t=0,e=i.length;e>t;t++)n=i[t],this.findOrCreateCachedChildView(this.viewClass,n,this.options);return this.childViews},n.prototype.createNodes=function(){var t,e,n,i,o,r,s,a,u;for(t=this.createContainerElement(),s=this.getChildViews(),e=0,i=s.length;i>e;e++)for(u=s[e],a=u.getNodes(),n=0,o=a.length;o>n;n++)r=a[n],t.appendChild(r);return[t]},n.prototype.createContainerElement=function(t){return null==t&&(t=this.objectGroup.getDepth()),this.getChildViews()[0].createContainerElement(t)},n}(e.ObjectView)}.call(this),function(){var t=function(t,e){function i(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;e.Controller=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n}(e.BasicObject)}.call(this),function(){var t,n,i,o,r,s,a=function(t,e){return function(){return t.apply(e,arguments)}},u=function(t,e){function n(){this.constructor=t}for(var i in e)c.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty,l=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};t=e.findClosestElementFromNode,i=e.nodeIsEmptyTextNode,n=e.nodeIsBlockStartComment,o=e.normalizeSpaces,r=e.summarizeStringChange,s=e.tagName,e.MutationObserver=function(e){function c(t){this.element=t,this.didMutate=a(this.didMutate,this),this.observer=new window.MutationObserver(this.didMutate),this.start()}var h,p,d,f;return u(c,e),p=\"data-trix-mutable\",d=\"[\"+p+\"]\",f={attributes:!0,childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0},c.prototype.start=function(){return this.reset(),this.observer.observe(this.element,f)},c.prototype.stop=function(){return this.observer.disconnect()},c.prototype.didMutate=function(t){var e,n;return(e=this.mutations).push.apply(e,this.findSignificantMutations(t)),this.mutations.length?(null!=(n=this.delegate)&&\"function\"==typeof n.elementDidMutate&&n.elementDidMutate(this.getMutationSummary()),this.reset()):void 0},c.prototype.reset=function(){return this.mutations=[]},c.prototype.findSignificantMutations=function(t){var e,n,i,o;for(o=[],e=0,n=t.length;n>e;e++)i=t[e],this.mutationIsSignificant(i)&&o.push(i);return o},c.prototype.mutationIsSignificant=function(t){var e,n,i,o;if(this.nodeIsMutable(t.target))return!1;for(o=this.nodesModifiedByMutation(t),e=0,n=o.length;n>e;e++)if(i=o[e],this.nodeIsSignificant(i))return!0;return!1},c.prototype.nodeIsSignificant=function(t){return t!==this.element&&!this.nodeIsMutable(t)&&!i(t)},c.prototype.nodeIsMutable=function(e){return t(e,{matchingSelector:d})},c.prototype.nodesModifiedByMutation=function(t){var e;switch(e=[],t.type){case\"attributes\":t.attributeName!==p&&e.push(t.target);break;case\"characterData\":e.push(t.target.parentNode),e.push(t.target);break;case\"childList\":e.push.apply(e,t.addedNodes),e.push.apply(e,t.removedNodes)}return e},c.prototype.getMutationSummary=function(){return this.getTextMutationSummary()},c.prototype.getTextMutationSummary=function(){var t,e,n,i,o,r,s,a,u,c,h;for(a=this.getTextChangesFromCharacterData(),n=a.additions,o=a.deletions,h=this.getTextChangesFromChildList(),u=h.additions,r=0,s=u.length;s>r;r++)e=u[r],l.call(n,e)<0&&n.push(e);return o.push.apply(o,h.deletions),c={},(t=n.join(\"\"))&&(c.textAdded=t),(i=o.join(\"\"))&&(c.textDeleted=i),c},c.prototype.getMutationsByType=function(t){var e,n,i,o,r;for(o=this.mutations,r=[],e=0,n=o.length;n>e;e++)i=o[e],i.type===t&&r.push(i);return r},c.prototype.getTextChangesFromChildList=function(){var t,e,i,r,s,a,u,c,l,p,d;for(t=[],u=[],a=this.getMutationsByType(\"childList\"),e=0,r=a.length;r>e;e++)s=a[e],t.push.apply(t,s.addedNodes),u.push.apply(u,s.removedNodes);return c=0===t.length&&1===u.length&&n(u[0]),c?(p=[],d=[\"\\n\"]):(p=h(t),d=h(u)),{additions:function(){var t,e,n;for(n=[],i=t=0,e=p.length;e>t;i=++t)l=p[i],l!==d[i]&&n.push(o(l));return n}(),deletions:function(){var t,e,n;for(n=[],i=t=0,e=d.length;e>t;i=++t)l=d[i],l!==p[i]&&n.push(o(l));return n}()}},c.prototype.getTextChangesFromCharacterData=function(){var t,e,n,i,s,a,u,c;return e=this.getMutationsByType(\"characterData\"),e.length&&(c=e[0],n=e[e.length-1],s=o(c.oldValue),i=o(n.target.data),a=r(s,i),t=a.added,u=a.removed),{additions:t?[t]:[],deletions:u?[u]:[]}},h=function(t){var e,n,i,o;for(null==t&&(t=[]),o=[],e=0,n=t.length;n>e;e++)switch(i=t[e],i.nodeType){case Node.TEXT_NODE:o.push(i.data);break;case Node.ELEMENT_NODE:\"br\"===s(i)?o.push(\"\\n\"):o.push.apply(o,h(i.childNodes))}return o},c}(e.BasicObject)}.call(this),function(){var t=function(t,e){function i(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;e.FileVerificationOperation=function(e){function n(t){this.file=t}return t(n,e),n.prototype.perform=function(t){var e;return e=new FileReader,e.onerror=function(){return t(!1)},e.onload=function(n){return function(){e.onerror=null;try{e.abort()}catch(i){}return t(!0,n.file)}}(this),e.readAsArrayBuffer(this.file)},n}(e.Operation)}.call(this),function(){var t,n,i=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;t=e.handleEvent,n=e.innerElementIsActive,e.InputController=function(o){function r(n){var i;this.element=n,this.mutationObserver=new e.MutationObserver(this.element),this.mutationObserver.delegate=this;for(i in this.events)t(i,{onElement:this.element,withCallback:this.handlerFor(i)})}return i(r,o),r.prototype.events={},r.prototype.elementDidMutate=function(){},r.prototype.editorWillSyncDocumentView=function(){return this.mutationObserver.stop()},r.prototype.editorDidSyncDocumentView=function(){return this.mutationObserver.start()},r.prototype.requestRender=function(){var t;return null!=(t=this.delegate)&&\"function\"==typeof t.inputControllerDidRequestRender?t.inputControllerDidRequestRender():void 0},r.prototype.requestReparse=function(){var t;return null!=(t=this.delegate)&&\"function\"==typeof t.inputControllerDidRequestReparse&&t.inputControllerDidRequestReparse(),this.requestRender()},r.prototype.attachFiles=function(t){var n,i;return i=function(){var i,o,r;for(r=[],i=0,o=t.length;o>i;i++)n=t[i],r.push(new e.FileVerificationOperation(n));return r}(),Promise.all(i).then(function(t){return function(e){return t.handleInput(function(){var t,n;return null!=(t=this.delegate)&&t.inputControllerWillAttachFiles(),null!=(n=this.responder)&&n.insertFiles(e),this.requestRender()})}}(this))},r.prototype.handlerFor=function(t){return function(e){return function(i){return i.defaultPrevented?void 0:e.handleInput(function(){return n(this.element)?void 0:(this.eventName=t,this.events[t].call(this,i))})}}(this)},r.prototype.handleInput=function(t){var e,n;try{return null!=(e=this.delegate)&&e.inputControllerWillHandleInput(),t.call(this)}finally{null!=(n=this.delegate)&&n.inputControllerDidHandleInput()}},r.prototype.createLinkHTML=function(t,e){var n;return n=document.createElement(\"a\"),n.href=t,n.textContent=null!=e?e:t,n.outerHTML},r}(e.BasicObject)}.call(this),function(){var t,n,i,o,r,s,a,u,c,l,h,p,d,f=function(t,e){function n(){this.constructor=t}for(var i in e)g.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},g={}.hasOwnProperty,m=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};c=e.makeElement,l=e.objectsAreEqual,d=e.tagName,n=e.browser,a=e.keyEventIsKeyboardCommand,o=e.dataTransferIsWritable,i=e.dataTransferIsPlainText,u=e.config.keyNames,e.Level0InputController=function(n){function s(){s.__super__.constructor.apply(this,arguments),this.resetInputSummary()}var d;return f(s,n),d=0,s.prototype.setInputSummary=function(t){var e,n;null==t&&(t={}),this.inputSummary.eventName=this.eventName;for(e in t)n=t[e],this.inputSummary[e]=n;return this.inputSummary},s.prototype.resetInputSummary=function(){return this.inputSummary={}},s.prototype.reset=function(){return this.resetInputSummary(),e.selectionChangeObserver.reset()},s.prototype.elementDidMutate=function(t){var e;return this.isComposing()?null!=(e=this.delegate)&&\"function\"==typeof e.inputControllerDidAllowUnhandledInput?e.inputControllerDidAllowUnhandledInput():void 0:this.handleInput(function(){return this.mutationIsSignificant(t)&&(this.mutationIsExpected(t)?this.requestRender():this.requestReparse()),this.reset()})},s.prototype.mutationIsExpected=function(t){var e,n,i,o,r,s,a,u,c,l;return a=t.textAdded,u=t.textDeleted,this.inputSummary.preferDocument?!0:(e=null!=a?a===this.inputSummary.textAdded:!this.inputSummary.textAdded,n=null!=u?this.inputSummary.didDelete:!this.inputSummary.didDelete,c=(\"\\n\"===a||\" \\n\"===a)&&!e,l=\"\\n\"===u&&!n,s=c&&!l||l&&!c,s&&(o=this.getSelectedRange())&&(i=c?a.replace(/\\n$/,\"\").length||-1:(null!=a?a.length:void 0)||1,null!=(r=this.responder)?r.positionIsBlockBreak(o[1]+i):void 0)?!0:e&&n)},s.prototype.mutationIsSignificant=function(t){var e,n,i;return i=Object.keys(t).length>0,e=\"\"===(null!=(n=this.compositionInput)?n.getEndData():void 0),i||!e},s.prototype.events={keydown:function(t){var n,i,o,r,s,c,l,h,p;if(this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0,r=u[t.keyCode]){for(i=this.keys,h=[\"ctrl\",\"alt\",\"shift\",\"meta\"],o=0,c=h.length;c>o;o++)l=h[o],t[l+\"Key\"]&&(\"ctrl\"===l&&(l=\"control\"),i=null!=i?i[l]:void 0);null!=(null!=i?i[r]:void 0)&&(this.setInputSummary({keyName:r}),e.selectionChangeObserver.reset(),i[r].call(this,t))}return a(t)&&(n=String.fromCharCode(t.keyCode).toLowerCase())&&(s=function(){var e,n,i,o;for(i=[\"alt\",\"shift\"],o=[],e=0,n=i.length;n>e;e++)l=i[e],t[l+\"Key\"]&&o.push(l);return o}(),s.push(n),null!=(p=this.delegate)?p.inputControllerDidReceiveKeyboardCommand(s):void 0)?t.preventDefault():void 0},keypress:function(t){var e,n,i;if(null==this.inputSummary.eventName&&!t.metaKey&&(!t.ctrlKey||t.altKey))return(i=p(t))?(null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString(i),this.setInputSummary({textAdded:i,didDelete:this.selectionIsExpanded()})):void 0},textInput:function(t){var e,n,i,o;return e=t.data,o=this.inputSummary.textAdded,o&&o!==e&&o.toUpperCase()===e?(n=this.getSelectedRange(),this.setSelectedRange([n[0],n[1]+o.length]),null!=(i=this.responder)&&i.insertString(e),this.setInputSummary({textAdded:e}),this.setSelectedRange(n)):void 0},dragenter:function(t){return t.preventDefault()},dragstart:function(t){var e,n;return n=t.target,this.serializeSelectionToDataTransfer(t.dataTransfer),this.draggedRange=this.getSelectedRange(),null!=(e=this.delegate)&&\"function\"==typeof e.inputControllerDidStartDrag?e.inputControllerDidStartDrag():void 0},dragover:function(t){var e,n;return!this.draggedRange&&!this.canAcceptDataTransfer(t.dataTransfer)||(t.preventDefault(),e={x:t.clientX,y:t.clientY},l(e,this.draggingPoint))?void 0:(this.draggingPoint=e,null!=(n=this.delegate)&&\"function\"==typeof n.inputControllerDidReceiveDragOverPoint?n.inputControllerDidReceiveDragOverPoint(this.draggingPoint):void 0)},dragend:function(){var t;return null!=(t=this.delegate)&&\"function\"==typeof t.inputControllerDidCancelDrag&&t.inputControllerDidCancelDrag(),this.draggedRange=null,this.draggingPoint=null},drop:function(t){var n,i,o,r,s,a,u,c,l;return t.preventDefault(),o=null!=(s=t.dataTransfer)?s.files:void 0,r={x:t.clientX,y:t.clientY},null!=(a=this.responder)&&a.setLocationRangeFromPointRange(r),(null!=o?o.length:void 0)?this.attachFiles(o):this.draggedRange?(null!=(u=this.delegate)&&u.inputControllerWillMoveText(),null!=(c=this.responder)&&c.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender()):(i=t.dataTransfer.getData(\"application/x-trix-document\"))&&(n=e.Document.fromJSONString(i),null!=(l=this.responder)&&l.insertDocument(n),this.requestRender()),this.draggedRange=null,this.draggingPoint=null},cut:function(t){var e,n;return(null!=(e=this.responder)?e.selectionIsExpanded():void 0)&&(this.serializeSelectionToDataTransfer(t.clipboardData)&&t.preventDefault(),null!=(n=this.delegate)&&n.inputControllerWillCutText(),this.deleteInDirection(\"backward\"),t.defaultPrevented)?this.requestRender():void 0},copy:function(t){var e;return(null!=(e=this.responder)?e.selectionIsExpanded():void 0)&&this.serializeSelectionToDataTransfer(t.clipboardData)?t.preventDefault():void 0},paste:function(t){var n,o,s,a,u,c,l,p,f,g,v,y,b,A,C,x,w,E,S,R,k,D,L;return n=null!=(p=t.clipboardData)?p:t.testClipboardData,l={clipboard:n},null==n||h(t)?void this.getPastedHTMLUsingHiddenElement(function(t){return function(e){var n,i,o;return l.type=\"text/html\",l.html=e,null!=(n=t.delegate)&&n.inputControllerWillPaste(l),null!=(i=t.responder)&&i.insertHTML(l.html),t.requestRender(),null!=(o=t.delegate)?o.inputControllerDidPaste(l):void 0}}(this)):((a=n.getData(\"URL\"))?(l.type=\"text/html\",L=(c=n.getData(\"public.url-name\"))?e.squishBreakableWhitespace(c).trim():a,l.html=this.createLinkHTML(a,L),null!=(f=this.delegate)&&f.inputControllerWillPaste(l),this.setInputSummary({textAdded:L,didDelete:this.selectionIsExpanded()}),null!=(C=this.responder)&&C.insertHTML(l.html),this.requestRender(),null!=(x=this.delegate)&&x.inputControllerDidPaste(l)):i(n)?(l.type=\"text/plain\",l.string=n.getData(\"text/plain\"),null!=(w=this.delegate)&&w.inputControllerWillPaste(l),this.setInputSummary({textAdded:l.string,didDelete:this.selectionIsExpanded()}),null!=(E=this.responder)&&E.insertString(l.string),this.requestRender(),null!=(S=this.delegate)&&S.inputControllerDidPaste(l)):(u=n.getData(\"text/html\"))?(l.type=\"text/html\",l.html=u,null!=(R=this.delegate)&&R.inputControllerWillPaste(l),null!=(k=this.responder)&&k.insertHTML(l.html),this.requestRender(),null!=(D=this.delegate)&&D.inputControllerDidPaste(l)):m.call(n.types,\"Files\")>=0&&(s=null!=(g=n.items)&&null!=(v=g[0])&&\"function\"==typeof v.getAsFile?v.getAsFile():void 0)&&(!s.name&&(o=r(s))&&(s.name=\"pasted-file-\"+ ++d+\".\"+o),l.type=\"File\",l.file=s,null!=(y=this.delegate)&&y.inputControllerWillAttachFiles(),null!=(b=this.responder)&&b.insertFile(l.file),this.requestRender(),null!=(A=this.delegate)&&A.inputControllerDidPaste(l)),t.preventDefault())},compositionstart:function(t){return this.getCompositionInput().start(t.data)},compositionupdate:function(t){return this.getCompositionInput().update(t.data)},compositionend:function(t){return this.getCompositionInput().end(t.data)},beforeinput:function(){return this.inputSummary.didInput=!0\n},input:function(t){return this.inputSummary.didInput=!0,t.stopPropagation()}},s.prototype.keys={backspace:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection(\"backward\",t)},\"delete\":function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection(\"forward\",t)},\"return\":function(){var t,e;return this.setInputSummary({preferDocument:!0}),null!=(t=this.delegate)&&t.inputControllerWillPerformTyping(),null!=(e=this.responder)?e.insertLineBreak():void 0},tab:function(t){var e,n;return(null!=(e=this.responder)?e.canIncreaseNestingLevel():void 0)?(null!=(n=this.responder)&&n.increaseNestingLevel(),this.requestRender(),t.preventDefault()):void 0},left:function(t){var e;return this.selectionIsInCursorTarget()?(t.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection(\"backward\"):void 0):void 0},right:function(t){var e;return this.selectionIsInCursorTarget()?(t.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection(\"forward\"):void 0):void 0},control:{d:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection(\"forward\",t)},h:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection(\"backward\",t)},o:function(t){var e,n;return t.preventDefault(),null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString(\"\\n\",{updatePosition:!1}),this.requestRender()}},shift:{\"return\":function(t){var e,n;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString(\"\\n\"),this.requestRender(),t.preventDefault()},tab:function(t){var e,n;return(null!=(e=this.responder)?e.canDecreaseNestingLevel():void 0)?(null!=(n=this.responder)&&n.decreaseNestingLevel(),this.requestRender(),t.preventDefault()):void 0},left:function(t){return this.selectionIsInCursorTarget()?(t.preventDefault(),this.expandSelectionInDirection(\"backward\")):void 0},right:function(t){return this.selectionIsInCursorTarget()?(t.preventDefault(),this.expandSelectionInDirection(\"forward\")):void 0}},alt:{backspace:function(){var t;return this.setInputSummary({preferDocument:!1}),null!=(t=this.delegate)?t.inputControllerWillPerformTyping():void 0}},meta:{backspace:function(){var t;return this.setInputSummary({preferDocument:!1}),null!=(t=this.delegate)?t.inputControllerWillPerformTyping():void 0}}},s.prototype.getCompositionInput=function(){return this.isComposing()?this.compositionInput:this.compositionInput=new t(this)},s.prototype.isComposing=function(){return null!=this.compositionInput&&!this.compositionInput.isEnded()},s.prototype.deleteInDirection=function(t,e){var n;return(null!=(n=this.responder)?n.deleteInDirection(t):void 0)!==!1?this.setInputSummary({didDelete:!0}):e?(e.preventDefault(),this.requestRender()):void 0},s.prototype.serializeSelectionToDataTransfer=function(t){var n,i;if(o(t))return n=null!=(i=this.responder)?i.getSelectedDocument().toSerializableDocument():void 0,t.setData(\"application/x-trix-document\",JSON.stringify(n)),t.setData(\"text/html\",e.DocumentView.render(n).innerHTML),t.setData(\"text/plain\",n.toString().replace(/\\n$/,\"\")),!0},s.prototype.canAcceptDataTransfer=function(t){var e,n,i,o,r,s;for(s={},o=null!=(i=null!=t?t.types:void 0)?i:[],e=0,n=o.length;n>e;e++)r=o[e],s[r]=!0;return s.Files||s[\"application/x-trix-document\"]||s[\"text/html\"]||s[\"text/plain\"]},s.prototype.getPastedHTMLUsingHiddenElement=function(t){var n,i,o;return i=this.getSelectedRange(),o={position:\"absolute\",left:window.pageXOffset+\"px\",top:window.pageYOffset+\"px\",opacity:0},n=c({style:o,tagName:\"div\",editable:!0}),document.body.appendChild(n),n.focus(),requestAnimationFrame(function(o){return function(){var r;return r=n.innerHTML,e.removeNode(n),o.setSelectedRange(i),t(r)}}(this))},s.proxyMethod(\"responder?.getSelectedRange\"),s.proxyMethod(\"responder?.setSelectedRange\"),s.proxyMethod(\"responder?.expandSelectionInDirection\"),s.proxyMethod(\"responder?.selectionIsInCursorTarget\"),s.proxyMethod(\"responder?.selectionIsExpanded\"),s}(e.InputController),r=function(t){var e,n;return null!=(e=t.type)&&null!=(n=e.match(/\\/(\\w+)$/))?n[1]:void 0},s=null!=(\"function\"==typeof\" \".codePointAt?\" \".codePointAt(0):void 0),p=function(t){var n;return t.key&&s&&t.key.codePointAt(0)===t.keyCode?t.key:(null===t.which?n=t.keyCode:0!==t.which&&0!==t.charCode&&(n=t.charCode),null!=n&&\"escape\"!==u[n]?e.UTF16String.fromCodepoints([n]).toString():void 0)},h=function(t){var e,n,i,o,r,s,a,u,c,l;if(u=t.clipboardData){if(m.call(u.types,\"text/html\")>=0){for(c=u.types,i=0,s=c.length;s>i;i++)if(l=c[i],e=/^CorePasteboardFlavorType/.test(l),n=/^dyn\\./.test(l)&&u.getData(l),a=e||n)return!0;return!1}return o=m.call(u.types,\"com.apple.webarchive\")>=0,r=m.call(u.types,\"com.apple.flat-rtfd\")>=0,o||r}},t=function(t){function e(t){var e;this.inputController=t,e=this.inputController,this.responder=e.responder,this.delegate=e.delegate,this.inputSummary=e.inputSummary,this.data={}}return f(e,t),e.prototype.start=function(t){var e,n;return this.data.start=t,this.isSignificant()?(\"keypress\"===this.inputSummary.eventName&&this.inputSummary.textAdded&&null!=(e=this.responder)&&e.deleteInDirection(\"left\"),this.selectionIsExpanded()||(this.insertPlaceholder(),this.requestRender()),this.range=null!=(n=this.responder)?n.getSelectedRange():void 0):void 0},e.prototype.update=function(t){var e;return this.data.update=t,this.isSignificant()&&(e=this.selectPlaceholder())?(this.forgetPlaceholder(),this.range=e):void 0},e.prototype.end=function(t){var e,n,i,o;return this.data.end=t,this.isSignificant()?(this.forgetPlaceholder(),this.canApplyToDocument()?(this.setInputSummary({preferDocument:!0,didInput:!1}),null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.setSelectedRange(this.range),null!=(i=this.responder)&&i.insertString(this.data.end),null!=(o=this.responder)?o.setSelectedRange(this.range[0]+this.data.end.length):void 0):null!=this.data.start||null!=this.data.update?(this.requestReparse(),this.inputController.reset()):void 0):this.inputController.reset()},e.prototype.getEndData=function(){return this.data.end},e.prototype.isEnded=function(){return null!=this.getEndData()},e.prototype.isSignificant=function(){return n.composesExistingText?this.inputSummary.didInput:!0},e.prototype.canApplyToDocument=function(){var t,e;return 0===(null!=(t=this.data.start)?t.length:void 0)&&(null!=(e=this.data.end)?e.length:void 0)>0&&null!=this.range},e.proxyMethod(\"inputController.setInputSummary\"),e.proxyMethod(\"inputController.requestRender\"),e.proxyMethod(\"inputController.requestReparse\"),e.proxyMethod(\"responder?.selectionIsExpanded\"),e.proxyMethod(\"responder?.insertPlaceholder\"),e.proxyMethod(\"responder?.selectPlaceholder\"),e.proxyMethod(\"responder?.forgetPlaceholder\"),e}(e.BasicObject)}.call(this),function(){var t,n,i,o=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty,a=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};t=e.dataTransferIsPlainText,n=e.keyEventIsKeyboardCommand,i=e.objectsAreEqual,e.Level2InputController=function(s){function u(){return this.render=o(this.render,this),u.__super__.constructor.apply(this,arguments)}var c,l,h,p,d,f;return r(u,s),u.prototype.elementDidMutate=function(){var t;return this.scheduledRender?this.composing&&null!=(t=this.delegate)&&\"function\"==typeof t.inputControllerDidAllowUnhandledInput?t.inputControllerDidAllowUnhandledInput():void 0:this.reparse()},u.prototype.scheduleRender=function(){return null!=this.scheduledRender?this.scheduledRender:this.scheduledRender=requestAnimationFrame(this.render)},u.prototype.render=function(){var t;return cancelAnimationFrame(this.scheduledRender),this.scheduledRender=null,this.composing||null!=(t=this.delegate)&&t.render(),\"function\"==typeof this.afterRender&&this.afterRender(),this.afterRender=null},u.prototype.reparse=function(){var t;return null!=(t=this.delegate)?t.reparse():void 0},u.prototype.events={keydown:function(t){var e,i,o,r;if(n(t)){if(e=l(t),null!=(r=this.delegate)?r.inputControllerDidReceiveKeyboardCommand(e):void 0)return t.preventDefault()}else if(o=t.key,t.altKey&&(o+=\"+Alt\"),t.shiftKey&&(o+=\"+Shift\"),i=this.keys[o])return this.withEvent(t,i)},paste:function(t){var e,n,i,o,r,s,a,u,c;return h(t)?(t.preventDefault(),this.attachFiles(t.clipboardData.files)):p(t)?(t.preventDefault(),n={type:\"text/plain\",string:t.clipboardData.getData(\"text/plain\")},null!=(i=this.delegate)&&i.inputControllerWillPaste(n),null!=(o=this.responder)&&o.insertString(n.string),this.render(),null!=(r=this.delegate)?r.inputControllerDidPaste(n):void 0):(e=null!=(s=t.clipboardData)?s.getData(\"URL\"):void 0)?(t.preventDefault(),n={type:\"text/html\",html:this.createLinkHTML(e)},null!=(a=this.delegate)&&a.inputControllerWillPaste(n),null!=(u=this.responder)&&u.insertHTML(n.html),this.render(),null!=(c=this.delegate)?c.inputControllerDidPaste(n):void 0):void 0},beforeinput:function(t){var e;return(e=this.inputTypes[t.inputType])?(this.withEvent(t,e),this.scheduleRender()):void 0},input:function(){return e.selectionChangeObserver.reset()},dragstart:function(t){var e,n;return(null!=(e=this.responder)?e.selectionContainsAttachments():void 0)?(t.dataTransfer.setData(\"application/x-trix-dragging\",!0),this.dragging={range:null!=(n=this.responder)?n.getSelectedRange():void 0,point:d(t)}):void 0},dragenter:function(t){return c(t)?t.preventDefault():void 0},dragover:function(t){var e,n;if(this.dragging){if(t.preventDefault(),e=d(t),!i(e,this.dragging.point))return this.dragging.point=e,null!=(n=this.responder)?n.setLocationRangeFromPointRange(e):void 0}else if(c(t))return t.preventDefault()},drop:function(t){var e,n,i,o;return this.dragging?(t.preventDefault(),null!=(n=this.delegate)&&n.inputControllerWillMoveText(),null!=(i=this.responder)&&i.moveTextFromRange(this.dragging.range),this.dragging=null,this.scheduleRender()):c(t)?(t.preventDefault(),e=d(t),null!=(o=this.responder)&&o.setLocationRangeFromPointRange(e),this.attachFiles(t.dataTransfer.files)):void 0},dragend:function(){var t;return this.dragging?(null!=(t=this.responder)&&t.setSelectedRange(this.dragging.range),this.dragging=null):void 0},compositionend:function(){return this.composing?(this.composing=!1,this.scheduleRender()):void 0}},u.prototype.keys={ArrowLeft:function(){var t,e;return(null!=(t=this.responder)?t.shouldManageMovingCursorInDirection(\"backward\"):void 0)?(this.event.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection(\"backward\"):void 0):void 0},ArrowRight:function(){var t,e;return(null!=(t=this.responder)?t.shouldManageMovingCursorInDirection(\"forward\"):void 0)?(this.event.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection(\"forward\"):void 0):void 0},Backspace:function(){var t,e,n;return(null!=(t=this.responder)?t.shouldManageDeletingInDirection(\"backward\"):void 0)?(this.event.preventDefault(),null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.deleteInDirection(\"backward\"),this.render()):void 0},Tab:function(){var t,e;return(null!=(t=this.responder)?t.canIncreaseNestingLevel():void 0)?(this.event.preventDefault(),null!=(e=this.responder)&&e.increaseNestingLevel(),this.render()):void 0},\"Tab+Shift\":function(){var t,e;return(null!=(t=this.responder)?t.canDecreaseNestingLevel():void 0)?(this.event.preventDefault(),null!=(e=this.responder)&&e.decreaseNestingLevel(),this.render()):void 0}},u.prototype.inputTypes={deleteByComposition:function(){return this.deleteInDirection(\"backward\",{recordUndoEntry:!1})},deleteByCut:function(){return this.deleteInDirection(\"backward\")},deleteByDrag:function(){return this.event.preventDefault(),this.withTargetDOMRange(function(){var t;return this.deleteByDragRange=null!=(t=this.responder)?t.getSelectedRange():void 0})},deleteCompositionText:function(){return this.deleteInDirection(\"backward\",{recordUndoEntry:!1})},deleteContent:function(){return this.deleteInDirection(\"backward\")},deleteContentBackward:function(){return this.deleteInDirection(\"backward\")},deleteContentForward:function(){return this.deleteInDirection(\"forward\")},deleteEntireSoftLine:function(){return this.deleteInDirection(\"forward\")},deleteHardLineBackward:function(){return this.deleteInDirection(\"backward\")},deleteHardLineForward:function(){return this.deleteInDirection(\"forward\")},deleteSoftLineBackward:function(){return this.deleteInDirection(\"backward\")},deleteSoftLineForward:function(){return this.deleteInDirection(\"forward\")},deleteWordBackward:function(){return this.deleteInDirection(\"backward\")},deleteWordForward:function(){return this.deleteInDirection(\"forward\")},formatBackColor:function(){return this.activateAttributeIfSupported(\"backgroundColor\",this.event.data)},formatBold:function(){return this.toggleAttributeIfSupported(\"bold\")},formatFontColor:function(){return this.activateAttributeIfSupported(\"color\",this.event.data)},formatFontName:function(){return this.activateAttributeIfSupported(\"font\",this.event.data)},formatIndent:function(){var t;return(null!=(t=this.responder)?t.canIncreaseNestingLevel():void 0)?this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.increaseNestingLevel():void 0}):void 0},formatItalic:function(){return this.toggleAttributeIfSupported(\"italic\")},formatJustifyCenter:function(){return this.toggleAttributeIfSupported(\"justifyCenter\")},formatJustifyFull:function(){return this.toggleAttributeIfSupported(\"justifyFull\")},formatJustifyLeft:function(){return this.toggleAttributeIfSupported(\"justifyLeft\")},formatJustifyRight:function(){return this.toggleAttributeIfSupported(\"justifyRight\")},formatOutdent:function(){var t;return(null!=(t=this.responder)?t.canDecreaseNestingLevel():void 0)?this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.decreaseNestingLevel():void 0}):void 0},formatRemove:function(){return this.withTargetDOMRange(function(){var t,e,n,i;i=[];for(t in null!=(e=this.responder)?e.getCurrentAttributes():void 0)i.push(null!=(n=this.responder)?n.removeCurrentAttribute(t):void 0);return i})},formatSetBlockTextDirection:function(){return this.activateAttributeIfSupported(\"blockDir\",this.event.data)},formatSetInlineTextDirection:function(){return this.activateAttributeIfSupported(\"textDir\",this.event.data)},formatStrikeThrough:function(){return this.toggleAttributeIfSupported(\"strike\")},formatSubscript:function(){return this.toggleAttributeIfSupported(\"sub\")},formatSuperscript:function(){return this.toggleAttributeIfSupported(\"sup\")},formatUnderline:function(){return this.toggleAttributeIfSupported(\"underline\")},historyRedo:function(){var t;return null!=(t=this.delegate)?t.inputControllerWillPerformRedo():void 0},historyUndo:function(){var t;return null!=(t=this.delegate)?t.inputControllerWillPerformUndo():void 0},insertCompositionText:function(){return this.composing=!0,this.insertString(this.event.data)},insertFromComposition:function(){return this.composing=!1,this.insertString(this.event.data)},insertFromDrop:function(){var t,e;return(t=this.deleteByDragRange)?(this.deleteByDragRange=null,null!=(e=this.delegate)&&e.inputControllerWillMoveText(),this.withTargetDOMRange(function(){var e;return null!=(e=this.responder)?e.moveTextFromRange(t):void 0})):void 0},insertFromPaste:function(){var n,i,o,r,s,a,u,c,l,h,p;return n=this.event.dataTransfer,s={dataTransfer:n},(i=n.getData(\"URL\"))?(this.event.preventDefault(),s.type=\"text/html\",p=(r=n.getData(\"public.url-name\"))?e.squishBreakableWhitespace(r).trim():i,s.html=this.createLinkHTML(i,p),null!=(a=this.delegate)&&a.inputControllerWillPaste(s),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.insertHTML(s.html):void 0}),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(s):void 0}}(this)):t(n)?(s.type=\"text/plain\",s.string=n.getData(\"text/plain\"),null!=(u=this.delegate)&&u.inputControllerWillPaste(s),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.insertString(s.string):void 0}),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(s):void 0}}(this)):(o=n.getData(\"text/html\"))?(this.event.preventDefault(),s.type=\"text/html\",s.html=o,null!=(c=this.delegate)&&c.inputControllerWillPaste(s),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.insertHTML(s.html):void 0}),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(s):void 0}}(this)):(null!=(l=n.files)?l.length:void 0)?(s.type=\"File\",s.file=n.files[0],null!=(h=this.delegate)&&h.inputControllerWillPaste(s),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.insertFile(s.file):void 0}),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(s):void 0}}(this)):void 0},insertFromYank:function(){return this.insertString(this.event.data)},insertLineBreak:function(){return this.insertString(\"\\n\")},insertLink:function(){return this.activateAttributeIfSupported(\"href\",this.event.data)},insertOrderedList:function(){return this.toggleAttributeIfSupported(\"number\")},insertParagraph:function(){var t;return null!=(t=this.delegate)&&t.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.insertLineBreak():void 0})},insertReplacementText:function(){return this.insertString(this.event.dataTransfer.getData(\"text/plain\"),{updatePosition:!1})},insertText:function(){var t,e;return this.insertString(null!=(t=this.event.data)?t:null!=(e=this.event.dataTransfer)?e.getData(\"text/plain\"):void 0)},insertTranspose:function(){return this.insertString(this.event.data)},insertUnorderedList:function(){return this.toggleAttributeIfSupported(\"bullet\")}},u.prototype.insertString=function(t,e){var n;return null==t&&(t=\"\"),null!=(n=this.delegate)&&n.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var n;return null!=(n=this.responder)?n.insertString(t,e):void 0})},u.prototype.toggleAttributeIfSupported=function(t){var n;return a.call(e.getAllAttributeNames(),t)>=0?(null!=(n=this.delegate)&&n.inputControllerWillPerformFormatting(t),this.withTargetDOMRange(function(){var e;return null!=(e=this.responder)?e.toggleCurrentAttribute(t):void 0})):void 0},u.prototype.activateAttributeIfSupported=function(t,n){var i;return a.call(e.getAllAttributeNames(),t)>=0?(null!=(i=this.delegate)&&i.inputControllerWillPerformFormatting(t),this.withTargetDOMRange(function(){var e;return null!=(e=this.responder)?e.setCurrentAttribute(t,n):void 0})):void 0},u.prototype.deleteInDirection=function(t,e){var n,i,o,r;return o=(null!=e?e:{recordUndoEntry:!0}).recordUndoEntry,o&&null!=(r=this.delegate)&&r.inputControllerWillPerformTyping(),i=function(e){return function(){var n;return null!=(n=e.responder)?n.deleteInDirection(t):void 0}}(this),(n=this.getTargetDOMRange({minLength:2}))?this.withTargetDOMRange(n,i):i()},u.prototype.withTargetDOMRange=function(t,n){var i;return\"function\"==typeof t&&(n=t,t=this.getTargetDOMRange()),t?null!=(i=this.responder)?i.withTargetDOMRange(t,n.bind(this)):void 0:(e.selectionChangeObserver.reset(),n.call(this))},u.prototype.getTargetDOMRange=function(t){var e,n,i,o;return i=(null!=t?t:{minLength:0}).minLength,(o=\"function\"==typeof(e=this.event).getTargetRanges?e.getTargetRanges():void 0)&&o.length&&(n=f(o[0]),0===i||n.toString().length>=i)?n:void 0},f=function(t){var e;return e=document.createRange(),e.setStart(t.startContainer,t.startOffset),e.setEnd(t.endContainer,t.endOffset),e},u.prototype.withEvent=function(t,e){var n;this.event=t;try{n=e.call(this)}finally{this.event=null}return n},c=function(t){var e,n;return a.call(null!=(e=null!=(n=t.dataTransfer)?n.types:void 0)?e:[],\"Files\")>=0},h=function(t){var e;return(e=t.clipboardData)?a.call(e.types,\"Files\")>=0&&1===e.types.length&&e.files.length>=1:void 0},p=function(t){var e;return(e=t.clipboardData)?a.call(e.types,\"text/plain\")>=0&&1===e.types.length:void 0},l=function(t){var e;return e=[],t.altKey&&e.push(\"alt\"),t.shiftKey&&e.push(\"shift\"),e.push(t.key),e},d=function(t){return{x:t.clientX,y:t.clientY}},u}(e.InputController)}.call(this),function(){var t,n,i,o,r,s,a,u,c=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function n(){this.constructor=t}for(var i in e)h.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;n=e.defer,i=e.handleEvent,s=e.makeElement,u=e.tagName,a=e.config,r=a.lang,t=a.css,o=a.keyNames,e.AttachmentEditorController=function(a){function h(t,e,n,i){this.attachmentPiece=t,this.element=e,this.container=n,this.options=null!=i?i:{},this.didBlurCaption=c(this.didBlurCaption,this),this.didChangeCaption=c(this.didChangeCaption,this),this.didInputCaption=c(this.didInputCaption,this),this.didKeyDownCaption=c(this.didKeyDownCaption,this),this.didClickActionButton=c(this.didClickActionButton,this),this.didClickToolbar=c(this.didClickToolbar,this),this.attachment=this.attachmentPiece.attachment,\"a\"===u(this.element)&&(this.element=this.element.firstChild),this.install()}var p;return l(h,a),p=function(t){return function(){var e;return e=t.apply(this,arguments),e[\"do\"](),null==this.undos&&(this.undos=[]),this.undos.push(e.undo)}},h.prototype.install=function(){return this.makeElementMutable(),this.addToolbar(),this.attachment.isPreviewable()?this.installCaptionEditor():void 0},h.prototype.uninstall=function(){var t,e;for(this.savePendingCaption();e=this.undos.pop();)e();return null!=(t=this.delegate)?t.didUninstallAttachmentEditor(this):void 0},h.prototype.savePendingCaption=function(){var t,e,n;return null!=this.pendingCaption?(t=this.pendingCaption,this.pendingCaption=null,t?null!=(e=this.delegate)&&\"function\"==typeof e.attachmentEditorDidRequestUpdatingAttributesForAttachment?e.attachmentEditorDidRequestUpdatingAttributesForAttachment({caption:t},this.attachment):void 0:null!=(n=this.delegate)&&\"function\"==typeof n.attachmentEditorDidRequestRemovingAttributeForAttachment?n.attachmentEditorDidRequestRemovingAttributeForAttachment(\"caption\",this.attachment):void 0):void 0},h.prototype.makeElementMutable=p(function(){return{\"do\":function(t){return function(){return t.element.dataset.trixMutable=!0}}(this),undo:function(t){return function(){return delete t.element.dataset.trixMutable}}(this)}}),h.prototype.addToolbar=p(function(){var n;return n=s({tagName:\"div\",className:t.attachmentToolbar,data:{trixMutable:!0},childNodes:s({tagName:\"div\",className:\"trix-button-row\",childNodes:s({tagName:\"span\",className:\"trix-button-group trix-button-group--actions\",childNodes:s({tagName:\"button\",className:\"trix-button trix-button--remove\",textContent:r.remove,attributes:{title:r.remove},data:{trixAction:\"remove\"}})})})}),this.attachment.isPreviewable()&&n.appendChild(s({tagName:\"div\",className:t.attachmentMetadataContainer,childNodes:s({tagName:\"span\",className:t.attachmentMetadata,childNodes:[s({tagName:\"span\",className:t.attachmentName,textContent:this.attachment.getFilename(),attributes:{title:this.attachment.getFilename()}}),s({tagName:\"span\",className:t.attachmentSize,textContent:this.attachment.getFormattedFilesize()})]})})),i(\"click\",{onElement:n,withCallback:this.didClickToolbar}),i(\"click\",{onElement:n,matchingSelector:\"[data-trix-action]\",withCallback:this.didClickActionButton}),{\"do\":function(t){return function(){return t.element.appendChild(n)}}(this),undo:function(){return function(){return e.removeNode(n)}}(this)}}),h.prototype.installCaptionEditor=p(function(){var o,a,u,c,l;return c=s({tagName:\"textarea\",className:t.attachmentCaptionEditor,attributes:{placeholder:r.captionPlaceholder},data:{trixMutable:!0}}),c.value=this.attachmentPiece.getCaption(),l=c.cloneNode(),l.classList.add(\"trix-autoresize-clone\"),l.tabIndex=-1,o=function(){return l.value=c.value,c.style.height=l.scrollHeight+\"px\"},i(\"input\",{onElement:c,withCallback:o}),i(\"input\",{onElement:c,withCallback:this.didInputCaption}),i(\"keydown\",{onElement:c,withCallback:this.didKeyDownCaption}),i(\"change\",{onElement:c,withCallback:this.didChangeCaption}),i(\"blur\",{onElement:c,withCallback:this.didBlurCaption}),u=this.element.querySelector(\"figcaption\"),a=u.cloneNode(),{\"do\":function(e){return function(){return u.style.display=\"none\",a.appendChild(c),a.appendChild(l),a.classList.add(t.attachmentCaption+\"--editing\"),u.parentElement.insertBefore(a,u),o(),e.options.editCaption?n(function(){return c.focus()}):void 0}}(this),undo:function(){return e.removeNode(a),u.style.display=null}}}),h.prototype.didClickToolbar=function(t){return t.preventDefault(),t.stopPropagation()},h.prototype.didClickActionButton=function(t){var e,n;switch(e=t.target.getAttribute(\"data-trix-action\")){case\"remove\":return null!=(n=this.delegate)?n.attachmentEditorDidRequestRemovalOfAttachment(this.attachment):void 0}},h.prototype.didKeyDownCaption=function(t){var e;return\"return\"===o[t.keyCode]?(t.preventDefault(),this.savePendingCaption(),null!=(e=this.delegate)&&\"function\"==typeof e.attachmentEditorDidRequestDeselectingAttachment?e.attachmentEditorDidRequestDeselectingAttachment(this.attachment):void 0):void 0},h.prototype.didInputCaption=function(t){return this.pendingCaption=t.target.value.replace(/\\s/g,\" \").trim()},h.prototype.didChangeCaption=function(){return this.savePendingCaption()},h.prototype.didBlurCaption=function(){return this.savePendingCaption()},h}(e.BasicObject)}.call(this),function(){var t,n,i,o=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;i=e.makeElement,t=e.config.css,e.AttachmentView=function(r){function s(){s.__super__.constructor.apply(this,arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}var a;return o(s,r),s.attachmentSelector=\"[data-trix-attachment]\",s.prototype.createContentNodes=function(){return[]},s.prototype.createNodes=function(){var e,n,o,r,s,u,c;if(e=r=i({tagName:\"figure\",className:this.getClassName(),data:this.getData(),editable:!1}),(n=this.getHref())&&(r=i({tagName:\"a\",editable:!1,attributes:{href:n,tabindex:-1}}),e.appendChild(r)),this.attachment.hasContent())r.innerHTML=this.attachment.getContent();else for(c=this.createContentNodes(),o=0,s=c.length;s>o;o++)u=c[o],r.appendChild(u);return r.appendChild(this.createCaptionElement()),this.attachment.isPending()&&(this.progressElement=i({tagName:\"progress\",attributes:{\"class\":t.attachmentProgress,value:this.attachment.getUploadProgress(),max:100},data:{trixMutable:!0,trixStoreKey:[\"progressElement\",this.attachment.id].join(\"/\")}}),e.appendChild(this.progressElement)),[a(\"left\"),e,a(\"right\")]},s.prototype.createCaptionElement=function(){var e,n,o,r,s,a,u;return o=i({tagName:\"figcaption\",className:t.attachmentCaption}),(e=this.attachmentPiece.getCaption())?(o.classList.add(t.attachmentCaption+\"--edited\"),o.textContent=e):(n=this.getCaptionConfig(),n.name&&(r=this.attachment.getFilename()),n.size&&(a=this.attachment.getFormattedFilesize()),r&&(s=i({tagName:\"span\",className:t.attachmentName,textContent:r}),o.appendChild(s)),a&&(r&&o.appendChild(document.createTextNode(\" \")),u=i({tagName:\"span\",className:t.attachmentSize,textContent:a}),o.appendChild(u))),o},s.prototype.getClassName=function(){var e,n;return n=[t.attachment,t.attachment+\"--\"+this.attachment.getType()],(e=this.attachment.getExtension())&&n.push(t.attachment+\"--\"+e),n.join(\" \")},s.prototype.getData=function(){var t,e;return e={trixAttachment:JSON.stringify(this.attachment),trixContentType:this.attachment.getContentType(),trixId:this.attachment.id},t=this.attachmentPiece.attributes,t.isEmpty()||(e.trixAttributes=JSON.stringify(t)),this.attachment.isPending()&&(e.trixSerialize=!1),e},s.prototype.getHref=function(){return n(this.attachment.getContent(),\"a\")?void 0:this.attachment.getHref()},s.prototype.getCaptionConfig=function(){var t,n,i;return i=this.attachment.getType(),t=e.copyObject(null!=(n=e.config.attachments[i])?n.caption:void 0),\"file\"===i&&(t.name=!0),t},s.prototype.findProgressElement=function(){var t;return null!=(t=this.findElement())?t.querySelector(\"progress\"):void 0},a=function(t){return i({tagName:\"span\",textContent:e.ZERO_WIDTH_SPACE,data:{trixCursorTarget:t,trixSerialize:!1}})},s.prototype.attachmentDidChangeUploadProgress=function(){var t,e;return e=this.attachment.getUploadProgress(),null!=(t=this.findProgressElement())?t.value=e:void 0},s}(e.ObjectView),n=function(t,e){var n;return n=i(\"div\"),n.innerHTML=null!=t?t:\"\",n.querySelector(e)}}.call(this),function(){var t,n=function(t,e){function n(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=e.makeElement,e.PreviewableAttachmentView=function(i){function o(){o.__super__.constructor.apply(this,arguments),this.attachment.previewDelegate=this}return n(o,i),o.prototype.createContentNodes=function(){return this.image=t({tagName:\"img\",attributes:{src:\"\"},data:{trixMutable:!0}}),this.refresh(this.image),[this.image]},o.prototype.createCaptionElement=function(){var t;return t=o.__super__.createCaptionElement.apply(this,arguments),t.textContent||t.setAttribute(\"data-trix-placeholder\",e.config.lang.captionPlaceholder),t},o.prototype.refresh=function(t){var e;return null==t&&(t=null!=(e=this.findElement())?e.querySelector(\"img\"):void 0),t?this.updateAttributesForImage(t):void 0},o.prototype.updateAttributesForImage=function(t){var e,n,i,o,r,s;return r=this.attachment.getURL(),n=this.attachment.getPreviewURL(),t.src=n||r,n===r?t.removeAttribute(\"data-trix-serialized-attributes\"):(i=JSON.stringify({src:r}),t.setAttribute(\"data-trix-serialized-attributes\",i)),s=this.attachment.getWidth(),e=this.attachment.getHeight(),null!=s&&(t.width=s),null!=e&&(t.height=e),o=[\"imageElement\",this.attachment.id,t.src,t.width,t.height].join(\"/\"),t.dataset.trixStoreKey=o},o.prototype.attachmentDidChangeAttributes=function(){return this.refresh(this.image),this.refresh()},o}(e.AttachmentView)}.call(this),function(){var t,n,i,o=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;i=e.makeElement,t=e.findInnerElement,n=e.getTextConfig,e.PieceView=function(r){function s(){var t;s.__super__.constructor.apply(this,arguments),this.piece=this.object,this.attributes=this.piece.getAttributes(),t=this.options,this.textConfig=t.textConfig,this.context=t.context,this.piece.attachment?this.attachment=this.piece.attachment:this.string=this.piece.toString()}var a;return o(s,r),s.prototype.createNodes=function(){var e,n,i,o,r,s;if(s=this.attachment?this.createAttachmentNodes():this.createStringNodes(),e=this.createElement()){for(i=t(e),n=0,o=s.length;o>n;n++)r=s[n],i.appendChild(r);s=[e]}return s},s.prototype.createAttachmentNodes=function(){var t,n;return t=this.attachment.isPreviewable()?e.PreviewableAttachmentView:e.AttachmentView,n=this.createChildView(t,this.piece.attachment,{piece:this.piece}),n.getNodes()},s.prototype.createStringNodes=function(){var t,e,n,o,r,s,a,u,c,l;if(null!=(u=this.textConfig)?u.plaintext:void 0)return[document.createTextNode(this.string)];for(a=[],c=this.string.split(\"\\n\"),n=e=0,o=c.length;o>e;n=++e)l=c[n],n>0&&(t=i(\"br\"),a.push(t)),(r=l.length)&&(s=document.createTextNode(this.preserveSpaces(l)),a.push(s));return a},s.prototype.createElement=function(){var t,e,o,r,s,a,u,c,l;c={},a=this.attributes;for(r in a)if(l=a[r],(t=n(r))&&(t.tagName&&(s=i(t.tagName),o?(o.appendChild(s),o=s):e=o=s),t.styleProperty&&(c[t.styleProperty]=l),t.style)){u=t.style;for(r in u)l=u[r],c[r]=l}if(Object.keys(c).length){null==e&&(e=i(\"span\"));for(r in c)l=c[r],e.style[r]=l}return e},s.prototype.createContainerElement=function(){var t,e,o,r,s;r=this.attributes;for(o in r)if(s=r[o],(e=n(o))&&e.groupTagName)return t={},t[o]=s,i(e.groupTagName,t)},a=e.NON_BREAKING_SPACE,s.prototype.preserveSpaces=function(t){return this.context.isLast&&(t=t.replace(/\\ $/,a)),t=t.replace(/(\\S)\\ {3}(\\S)/g,\"$1 \"+a+\" $2\").replace(/\\ {2}/g,a+\" \").replace(/\\ {2}/g,\" \"+a),(this.context.isFirst||this.context.followsWhitespace)&&(t=t.replace(/^\\ /,a)),t},s}(e.ObjectView)}.call(this),function(){var t=function(t,e){function i(){this.constructor=t\n}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;e.TextView=function(n){function i(){i.__super__.constructor.apply(this,arguments),this.text=this.object,this.textConfig=this.options.textConfig}var o;return t(i,n),i.prototype.createNodes=function(){var t,n,i,r,s,a,u,c,l,h;for(a=[],c=e.ObjectGroup.groupObjects(this.getPieces()),r=c.length-1,i=n=0,s=c.length;s>n;i=++n)u=c[i],t={},0===i&&(t.isFirst=!0),i===r&&(t.isLast=!0),o(l)&&(t.followsWhitespace=!0),h=this.findOrCreateCachedChildView(e.PieceView,u,{textConfig:this.textConfig,context:t}),a.push.apply(a,h.getNodes()),l=u;return a},i.prototype.getPieces=function(){var t,e,n,i,o;for(i=this.text.getPieces(),o=[],t=0,e=i.length;e>t;t++)n=i[t],n.hasAttribute(\"blockBreak\")||o.push(n);return o},o=function(t){return/\\s$/.test(null!=t?t.toString():void 0)},i}(e.ObjectView)}.call(this),function(){var t,n,i,o=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;i=e.makeElement,n=e.getBlockConfig,t=e.config.css,e.BlockView=function(r){function s(){s.__super__.constructor.apply(this,arguments),this.block=this.object,this.attributes=this.block.getAttributes()}return o(s,r),s.prototype.createNodes=function(){var t,o,r,s,a,u,c,l,h,p,d;if(o=document.createComment(\"block\"),c=[o],this.block.isEmpty()?c.push(i(\"br\")):(p=null!=(l=n(this.block.getLastAttribute()))?l.text:void 0,d=this.findOrCreateCachedChildView(e.TextView,this.block.text,{textConfig:p}),c.push.apply(c,d.getNodes()),this.shouldAddExtraNewlineElement()&&c.push(i(\"br\"))),this.attributes.length)return c;for(h=e.config.blockAttributes[\"default\"].tagName,this.block.isRTL()&&(t={dir:\"rtl\"}),r=i({tagName:h,attributes:t}),s=0,a=c.length;a>s;s++)u=c[s],r.appendChild(u);return[r]},s.prototype.createContainerElement=function(e){var o,r,s,a,u;return o=this.attributes[e],u=n(o).tagName,0===e&&this.block.isRTL()&&(r={dir:\"rtl\"}),\"attachmentGallery\"===o&&(a=this.block.getBlockBreakPosition(),s=t.attachmentGallery+\" \"+t.attachmentGallery+\"--\"+a),i({tagName:u,className:s,attributes:r})},s.prototype.shouldAddExtraNewlineElement=function(){return/\\n\\n$/.test(this.block.toString())},s}(e.ObjectView)}.call(this),function(){var t,n,i=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;t=e.defer,n=e.makeElement,e.DocumentView=function(o){function r(){r.__super__.constructor.apply(this,arguments),this.element=this.options.element,this.elementStore=new e.ElementStore,this.setDocument(this.object)}var s,a,u;return i(r,o),r.render=function(t){var e,i;return e=n(\"div\"),i=new this(t,{element:e}),i.render(),i.sync(),e},r.prototype.setDocument=function(t){return t.isEqualTo(this.document)?void 0:this.document=this.object=t},r.prototype.render=function(){var t,i,o,r,s,a,u;if(this.childViews=[],this.shadowElement=n(\"div\"),!this.document.isEmpty()){for(s=e.ObjectGroup.groupObjects(this.document.getBlocks(),{asTree:!0}),a=[],t=0,i=s.length;i>t;t++)r=s[t],u=this.findOrCreateCachedChildView(e.BlockView,r),a.push(function(){var t,e,n,i;for(n=u.getNodes(),i=[],t=0,e=n.length;e>t;t++)o=n[t],i.push(this.shadowElement.appendChild(o));return i}.call(this));return a}},r.prototype.isSynced=function(){return s(this.shadowElement,this.element)},r.prototype.sync=function(){var t;for(t=this.createDocumentFragmentForSync();this.element.lastChild;)this.element.removeChild(this.element.lastChild);return this.element.appendChild(t),this.didSync()},r.prototype.didSync=function(){return this.elementStore.reset(a(this.element)),t(function(t){return function(){return t.garbageCollectCachedViews()}}(this))},r.prototype.createDocumentFragmentForSync=function(){var t,e,n,i,o,r,s,u,c,l;for(e=document.createDocumentFragment(),u=this.shadowElement.childNodes,n=0,o=u.length;o>n;n++)s=u[n],e.appendChild(s.cloneNode(!0));for(c=a(e),i=0,r=c.length;r>i;i++)t=c[i],(l=this.elementStore.remove(t))&&t.parentNode.replaceChild(l,t);return e},a=function(t){return t.querySelectorAll(\"[data-trix-store-key]\")},s=function(t,e){return u(t.innerHTML)===u(e.innerHTML)},u=function(t){return t.replace(/ /g,\" \")},r}(e.ObjectView)}.call(this),function(){var t,n,i,o,r,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function n(){this.constructor=t}for(var i in e)u.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=e.findClosestElementFromNode,o=e.handleEvent,r=e.innerElementIsActive,n=e.defer,t=e.AttachmentView.attachmentSelector,e.CompositionController=function(u){function c(n,i){this.element=n,this.composition=i,this.didClickAttachment=s(this.didClickAttachment,this),this.didBlur=s(this.didBlur,this),this.didFocus=s(this.didFocus,this),this.documentView=new e.DocumentView(this.composition.document,{element:this.element}),o(\"focus\",{onElement:this.element,withCallback:this.didFocus}),o(\"blur\",{onElement:this.element,withCallback:this.didBlur}),o(\"click\",{onElement:this.element,matchingSelector:\"a[contenteditable=false]\",preventDefault:!0}),o(\"mousedown\",{onElement:this.element,matchingSelector:t,withCallback:this.didClickAttachment}),o(\"click\",{onElement:this.element,matchingSelector:\"a\"+t,preventDefault:!0})}return a(c,u),c.prototype.didFocus=function(){var t,e,n;return t=function(t){return function(){var e;return t.focused?void 0:(t.focused=!0,null!=(e=t.delegate)&&\"function\"==typeof e.compositionControllerDidFocus?e.compositionControllerDidFocus():void 0)}}(this),null!=(e=null!=(n=this.blurPromise)?n.then(t):void 0)?e:t()},c.prototype.didBlur=function(){return this.blurPromise=new Promise(function(t){return function(e){return n(function(){var n;return r(t.element)||(t.focused=null,null!=(n=t.delegate)&&\"function\"==typeof n.compositionControllerDidBlur&&n.compositionControllerDidBlur()),t.blurPromise=null,e()})}}(this))},c.prototype.didClickAttachment=function(t,e){var n,o,r;return n=this.findAttachmentForElement(e),o=null!=i(t.target,{matchingSelector:\"figcaption\"}),null!=(r=this.delegate)&&\"function\"==typeof r.compositionControllerDidSelectAttachment?r.compositionControllerDidSelectAttachment(n,{editCaption:o}):void 0},c.prototype.getSerializableElement=function(){return this.isEditingAttachment()?this.documentView.shadowElement:this.element},c.prototype.render=function(){var t,e,n;return this.revision!==this.composition.revision&&(this.documentView.setDocument(this.composition.document),this.documentView.render(),this.revision=this.composition.revision),this.canSyncDocumentView()&&!this.documentView.isSynced()&&(null!=(t=this.delegate)&&\"function\"==typeof t.compositionControllerWillSyncDocumentView&&t.compositionControllerWillSyncDocumentView(),this.documentView.sync(),null!=(e=this.delegate)&&\"function\"==typeof e.compositionControllerDidSyncDocumentView&&e.compositionControllerDidSyncDocumentView()),null!=(n=this.delegate)&&\"function\"==typeof n.compositionControllerDidRender?n.compositionControllerDidRender():void 0},c.prototype.rerenderViewForObject=function(t){return this.invalidateViewForObject(t),this.render()},c.prototype.invalidateViewForObject=function(t){return this.documentView.invalidateViewForObject(t)},c.prototype.isViewCachingEnabled=function(){return this.documentView.isViewCachingEnabled()},c.prototype.enableViewCaching=function(){return this.documentView.enableViewCaching()},c.prototype.disableViewCaching=function(){return this.documentView.disableViewCaching()},c.prototype.refreshViewCache=function(){return this.documentView.garbageCollectCachedViews()},c.prototype.isEditingAttachment=function(){return null!=this.attachmentEditor},c.prototype.installAttachmentEditorForAttachment=function(t,n){var i,o,r;if((null!=(r=this.attachmentEditor)?r.attachment:void 0)!==t&&(o=this.documentView.findElementForObject(t)))return this.uninstallAttachmentEditor(),i=this.composition.document.getAttachmentPieceForAttachment(t),this.attachmentEditor=new e.AttachmentEditorController(i,o,this.element,n),this.attachmentEditor.delegate=this},c.prototype.uninstallAttachmentEditor=function(){var t;return null!=(t=this.attachmentEditor)?t.uninstall():void 0},c.prototype.didUninstallAttachmentEditor=function(){return this.attachmentEditor=null,this.render()},c.prototype.attachmentEditorDidRequestUpdatingAttributesForAttachment=function(t,e){var n;return null!=(n=this.delegate)&&\"function\"==typeof n.compositionControllerWillUpdateAttachment&&n.compositionControllerWillUpdateAttachment(e),this.composition.updateAttributesForAttachment(t,e)},c.prototype.attachmentEditorDidRequestRemovingAttributeForAttachment=function(t,e){var n;return null!=(n=this.delegate)&&\"function\"==typeof n.compositionControllerWillUpdateAttachment&&n.compositionControllerWillUpdateAttachment(e),this.composition.removeAttributeForAttachment(t,e)},c.prototype.attachmentEditorDidRequestRemovalOfAttachment=function(t){var e;return null!=(e=this.delegate)&&\"function\"==typeof e.compositionControllerDidRequestRemovalOfAttachment?e.compositionControllerDidRequestRemovalOfAttachment(t):void 0},c.prototype.attachmentEditorDidRequestDeselectingAttachment=function(t){var e;return null!=(e=this.delegate)&&\"function\"==typeof e.compositionControllerDidRequestDeselectingAttachment?e.compositionControllerDidRequestDeselectingAttachment(t):void 0},c.prototype.canSyncDocumentView=function(){return!this.isEditingAttachment()},c.prototype.findAttachmentForElement=function(t){return this.composition.document.getAttachmentById(parseInt(t.dataset.trixId,10))},c}(e.BasicObject)}.call(this),function(){var t,n,i,o=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=e.handleEvent,i=e.triggerEvent,t=e.findClosestElementFromNode,e.ToolbarController=function(e){function s(t){this.element=t,this.didKeyDownDialogInput=o(this.didKeyDownDialogInput,this),this.didClickDialogButton=o(this.didClickDialogButton,this),this.didClickAttributeButton=o(this.didClickAttributeButton,this),this.didClickActionButton=o(this.didClickActionButton,this),this.attributes={},this.actions={},this.resetDialogInputs(),n(\"mousedown\",{onElement:this.element,matchingSelector:a,withCallback:this.didClickActionButton}),n(\"mousedown\",{onElement:this.element,matchingSelector:c,withCallback:this.didClickAttributeButton}),n(\"click\",{onElement:this.element,matchingSelector:v,preventDefault:!0}),n(\"click\",{onElement:this.element,matchingSelector:l,withCallback:this.didClickDialogButton}),n(\"keydown\",{onElement:this.element,matchingSelector:h,withCallback:this.didKeyDownDialogInput})}var a,u,c,l,h,p,d,f,g,m,v;return r(s,e),c=\"[data-trix-attribute]\",a=\"[data-trix-action]\",v=c+\", \"+a,p=\"[data-trix-dialog]\",u=p+\"[data-trix-active]\",l=p+\" [data-trix-method]\",h=p+\" [data-trix-input]\",s.prototype.didClickActionButton=function(t,e){var n,i,o;return null!=(i=this.delegate)&&i.toolbarDidClickButton(),t.preventDefault(),n=d(e),this.getDialog(n)?this.toggleDialog(n):null!=(o=this.delegate)?o.toolbarDidInvokeAction(n):void 0},s.prototype.didClickAttributeButton=function(t,e){var n,i,o;return null!=(i=this.delegate)&&i.toolbarDidClickButton(),t.preventDefault(),n=f(e),this.getDialog(n)?this.toggleDialog(n):null!=(o=this.delegate)&&o.toolbarDidToggleAttribute(n),this.refreshAttributeButtons()},s.prototype.didClickDialogButton=function(e,n){var i,o;return i=t(n,{matchingSelector:p}),o=n.getAttribute(\"data-trix-method\"),this[o].call(this,i)},s.prototype.didKeyDownDialogInput=function(t,e){var n,i;return 13===t.keyCode&&(t.preventDefault(),n=e.getAttribute(\"name\"),i=this.getDialog(n),this.setAttribute(i)),27===t.keyCode?(t.preventDefault(),this.hideDialog()):void 0},s.prototype.updateActions=function(t){return this.actions=t,this.refreshActionButtons()},s.prototype.refreshActionButtons=function(){return this.eachActionButton(function(t){return function(e,n){return e.disabled=t.actions[n]===!1}}(this))},s.prototype.eachActionButton=function(t){var e,n,i,o,r;for(o=this.element.querySelectorAll(a),r=[],n=0,i=o.length;i>n;n++)e=o[n],r.push(t(e,d(e)));return r},s.prototype.updateAttributes=function(t){return this.attributes=t,this.refreshAttributeButtons()},s.prototype.refreshAttributeButtons=function(){return this.eachAttributeButton(function(t){return function(e,n){return e.disabled=t.attributes[n]===!1,t.attributes[n]||t.dialogIsVisible(n)?(e.setAttribute(\"data-trix-active\",\"\"),e.classList.add(\"trix-active\")):(e.removeAttribute(\"data-trix-active\"),e.classList.remove(\"trix-active\"))}}(this))},s.prototype.eachAttributeButton=function(t){var e,n,i,o,r;for(o=this.element.querySelectorAll(c),r=[],n=0,i=o.length;i>n;n++)e=o[n],r.push(t(e,f(e)));return r},s.prototype.applyKeyboardCommand=function(t){var e,n,o,r,s,a,u;for(s=JSON.stringify(t.sort()),u=this.element.querySelectorAll(\"[data-trix-key]\"),r=0,a=u.length;a>r;r++)if(e=u[r],o=e.getAttribute(\"data-trix-key\").split(\"+\"),n=JSON.stringify(o.sort()),n===s)return i(\"mousedown\",{onElement:e}),!0;return!1},s.prototype.dialogIsVisible=function(t){var e;return(e=this.getDialog(t))?e.hasAttribute(\"data-trix-active\"):void 0},s.prototype.toggleDialog=function(t){return this.dialogIsVisible(t)?this.hideDialog():this.showDialog(t)},s.prototype.showDialog=function(t){var e,n,i,o,r,s,a,u,c,l;for(this.hideDialog(),null!=(a=this.delegate)&&a.toolbarWillShowDialog(),i=this.getDialog(t),i.setAttribute(\"data-trix-active\",\"\"),i.classList.add(\"trix-active\"),u=i.querySelectorAll(\"input[disabled]\"),o=0,s=u.length;s>o;o++)n=u[o],n.removeAttribute(\"disabled\");return(e=f(i))&&(r=m(i,t))&&(r.value=null!=(c=this.attributes[e])?c:\"\",r.select()),null!=(l=this.delegate)?l.toolbarDidShowDialog(t):void 0},s.prototype.setAttribute=function(t){var e,n,i;return e=f(t),n=m(t,e),n.willValidate&&!n.checkValidity()?(n.setAttribute(\"data-trix-validate\",\"\"),n.classList.add(\"trix-validate\"),n.focus()):(null!=(i=this.delegate)&&i.toolbarDidUpdateAttribute(e,n.value),this.hideDialog())},s.prototype.removeAttribute=function(t){var e,n;return e=f(t),null!=(n=this.delegate)&&n.toolbarDidRemoveAttribute(e),this.hideDialog()},s.prototype.hideDialog=function(){var t,e;return(t=this.element.querySelector(u))?(t.removeAttribute(\"data-trix-active\"),t.classList.remove(\"trix-active\"),this.resetDialogInputs(),null!=(e=this.delegate)?e.toolbarDidHideDialog(g(t)):void 0):void 0},s.prototype.resetDialogInputs=function(){var t,e,n,i,o;for(i=this.element.querySelectorAll(h),o=[],t=0,n=i.length;n>t;t++)e=i[t],e.setAttribute(\"disabled\",\"disabled\"),e.removeAttribute(\"data-trix-validate\"),o.push(e.classList.remove(\"trix-validate\"));return o},s.prototype.getDialog=function(t){return this.element.querySelector(\"[data-trix-dialog=\"+t+\"]\")},m=function(t,e){return null==e&&(e=f(t)),t.querySelector(\"[data-trix-input][name='\"+e+\"']\")},d=function(t){return t.getAttribute(\"data-trix-action\")},f=function(t){var e;return null!=(e=t.getAttribute(\"data-trix-attribute\"))?e:t.getAttribute(\"data-trix-dialog-attribute\")},g=function(t){return t.getAttribute(\"data-trix-dialog\")},s}(e.BasicObject)}.call(this),function(){var t=function(t,e){function i(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;e.ImagePreloadOperation=function(e){function n(t){this.url=t}return t(n,e),n.prototype.perform=function(t){var e;return e=new Image,e.onload=function(n){return function(){return e.width=n.width=e.naturalWidth,e.height=n.height=e.naturalHeight,t(!0,e)}}(this),e.onerror=function(){return t(!1)},e.src=this.url},n}(e.Operation)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;e.Attachment=function(i){function o(n){null==n&&(n={}),this.releaseFile=t(this.releaseFile,this),o.__super__.constructor.apply(this,arguments),this.attributes=e.Hash.box(n),this.didChangeAttributes()}return n(o,i),o.previewablePattern=/^image(\\/(gif|png|jpe?g)|$)/,o.attachmentForFile=function(t){var e,n;return n=this.attributesForFile(t),e=new this(n),e.setFile(t),e},o.attributesForFile=function(t){return new e.Hash({filename:t.name,filesize:t.size,contentType:t.type})},o.fromJSON=function(t){return new this(t)},o.prototype.getAttribute=function(t){return this.attributes.get(t)},o.prototype.hasAttribute=function(t){return this.attributes.has(t)},o.prototype.getAttributes=function(){return this.attributes.toObject()},o.prototype.setAttributes=function(t){var e,n,i;return null==t&&(t={}),e=this.attributes.merge(t),this.attributes.isEqualTo(e)?void 0:(this.attributes=e,this.didChangeAttributes(),null!=(n=this.previewDelegate)&&\"function\"==typeof n.attachmentDidChangeAttributes&&n.attachmentDidChangeAttributes(this),null!=(i=this.delegate)&&\"function\"==typeof i.attachmentDidChangeAttributes?i.attachmentDidChangeAttributes(this):void 0)},o.prototype.didChangeAttributes=function(){return this.isPreviewable()?this.preloadURL():void 0},o.prototype.isPending=function(){return null!=this.file&&!(this.getURL()||this.getHref())},o.prototype.isPreviewable=function(){return this.attributes.has(\"previewable\")?this.attributes.get(\"previewable\"):this.constructor.previewablePattern.test(this.getContentType())},o.prototype.getType=function(){return this.hasContent()?\"content\":this.isPreviewable()?\"preview\":\"file\"},o.prototype.getURL=function(){return this.attributes.get(\"url\")},o.prototype.getHref=function(){return this.attributes.get(\"href\")},o.prototype.getFilename=function(){var t;return null!=(t=this.attributes.get(\"filename\"))?t:\"\"},o.prototype.getFilesize=function(){return this.attributes.get(\"filesize\")},o.prototype.getFormattedFilesize=function(){var t;return t=this.attributes.get(\"filesize\"),\"number\"==typeof t?e.config.fileSize.formatter(t):\"\"},o.prototype.getExtension=function(){var t;return null!=(t=this.getFilename().match(/\\.(\\w+)$/))?t[1].toLowerCase():void 0},o.prototype.getContentType=function(){return this.attributes.get(\"contentType\")},o.prototype.hasContent=function(){return this.attributes.has(\"content\")},o.prototype.getContent=function(){return this.attributes.get(\"content\")},o.prototype.getWidth=function(){return this.attributes.get(\"width\")},o.prototype.getHeight=function(){return this.attributes.get(\"height\")},o.prototype.getFile=function(){return this.file},o.prototype.setFile=function(t){return this.file=t,this.isPreviewable()?this.preloadFile():void 0},o.prototype.releaseFile=function(){return this.releasePreloadedFile(),this.file=null},o.prototype.getUploadProgress=function(){var t;return null!=(t=this.uploadProgress)?t:0},o.prototype.setUploadProgress=function(t){var e;return this.uploadProgress!==t?(this.uploadProgress=t,null!=(e=this.uploadProgressDelegate)&&\"function\"==typeof e.attachmentDidChangeUploadProgress?e.attachmentDidChangeUploadProgress(this):void 0):void 0},o.prototype.toJSON=function(){return this.getAttributes()},o.prototype.getCacheKey=function(){return[o.__super__.getCacheKey.apply(this,arguments),this.attributes.getCacheKey(),this.getPreviewURL()].join(\"/\")},o.prototype.getPreviewURL=function(){return this.previewURL||this.preloadingURL},o.prototype.setPreviewURL=function(t){var e,n;return t!==this.getPreviewURL()?(this.previewURL=t,null!=(e=this.previewDelegate)&&\"function\"==typeof e.attachmentDidChangeAttributes&&e.attachmentDidChangeAttributes(this),null!=(n=this.delegate)&&\"function\"==typeof n.attachmentDidChangePreviewURL?n.attachmentDidChangePreviewURL(this):void 0):void 0},o.prototype.preloadURL=function(){return this.preload(this.getURL(),this.releaseFile)},o.prototype.preloadFile=function(){return this.file?(this.fileObjectURL=URL.createObjectURL(this.file),this.preload(this.fileObjectURL)):void 0},o.prototype.releasePreloadedFile=function(){return this.fileObjectURL?(URL.revokeObjectURL(this.fileObjectURL),this.fileObjectURL=null):void 0},o.prototype.preload=function(t,n){var i;return t&&t!==this.getPreviewURL()?(this.preloadingURL=t,i=new e.ImagePreloadOperation(t),i.then(function(e){return function(i){var o,r;return r=i.width,o=i.height,e.getWidth()&&e.getHeight()||e.setAttributes({width:r,height:o}),e.preloadingURL=null,e.setPreviewURL(t),\"function\"==typeof n?n():void 0}}(this))[\"catch\"](function(t){return function(){return t.preloadingURL=null,\"function\"==typeof n?n():void 0}}(this))):void 0},o}(e.Object)}.call(this),function(){var t=function(t,e){function i(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;e.Piece=function(n){function i(t,n){null==n&&(n={}),i.__super__.constructor.apply(this,arguments),this.attributes=e.Hash.box(n)}return t(i,n),i.types={},i.registerType=function(t,e){return e.type=t,this.types[t]=e},i.fromJSON=function(t){var e;return(e=this.types[t.type])?e.fromJSON(t):void 0},i.prototype.copyWithAttributes=function(t){return new this.constructor(this.getValue(),t)},i.prototype.copyWithAdditionalAttributes=function(t){return this.copyWithAttributes(this.attributes.merge(t))},i.prototype.copyWithoutAttribute=function(t){return this.copyWithAttributes(this.attributes.remove(t))},i.prototype.copy=function(){return this.copyWithAttributes(this.attributes)},i.prototype.getAttribute=function(t){return this.attributes.get(t)},i.prototype.getAttributesHash=function(){return this.attributes},i.prototype.getAttributes=function(){return this.attributes.toObject()},i.prototype.getCommonAttributes=function(){var t,e,n;return(n=pieceList.getPieceAtIndex(0))?(t=n.attributes,e=t.getKeys(),pieceList.eachPiece(function(n){return e=t.getKeysCommonToHash(n.attributes),t=t.slice(e)}),t.toObject()):{}},i.prototype.hasAttribute=function(t){return this.attributes.has(t)},i.prototype.hasSameStringValueAsPiece=function(t){return null!=t&&this.toString()===t.toString()},i.prototype.hasSameAttributesAsPiece=function(t){return null!=t&&(this.attributes===t.attributes||this.attributes.isEqualTo(t.attributes))},i.prototype.isBlockBreak=function(){return!1},i.prototype.isEqualTo=function(t){return i.__super__.isEqualTo.apply(this,arguments)||this.hasSameConstructorAs(t)&&this.hasSameStringValueAsPiece(t)&&this.hasSameAttributesAsPiece(t)},i.prototype.isEmpty=function(){return 0===this.length},i.prototype.isSerializable=function(){return!0},i.prototype.toJSON=function(){return{type:this.constructor.type,attributes:this.getAttributes()}},i.prototype.contentsForInspection=function(){return{type:this.constructor.type,attributes:this.attributes.inspect()}},i.prototype.canBeGrouped=function(){return this.hasAttribute(\"href\")},i.prototype.canBeGroupedWith=function(t){return this.getAttribute(\"href\")===t.getAttribute(\"href\")},i.prototype.getLength=function(){return this.length},i.prototype.canBeConsolidatedWith=function(){return!1},i}(e.Object)}.call(this),function(){var t=function(t,e){function i(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;e.Piece.registerType(\"attachment\",e.AttachmentPiece=function(n){function i(t){this.attachment=t,i.__super__.constructor.apply(this,arguments),this.length=1,this.ensureAttachmentExclusivelyHasAttribute(\"href\"),this.attachment.hasContent()||this.removeProhibitedAttributes()}return t(i,n),i.fromJSON=function(t){return new this(e.Attachment.fromJSON(t.attachment),t.attributes)},i.permittedAttributes=[\"caption\",\"presentation\"],i.prototype.ensureAttachmentExclusivelyHasAttribute=function(t){return this.hasAttribute(t)?(this.attachment.hasAttribute(t)||this.attachment.setAttributes(this.attributes.slice(t)),this.attributes=this.attributes.remove(t)):void 0},i.prototype.removeProhibitedAttributes=function(){var t;return t=this.attributes.slice(this.constructor.permittedAttributes),t.isEqualTo(this.attributes)?void 0:this.attributes=t},i.prototype.getValue=function(){return this.attachment},i.prototype.isSerializable=function(){return!this.attachment.isPending()},i.prototype.getCaption=function(){var t;return null!=(t=this.attributes.get(\"caption\"))?t:\"\"},i.prototype.isEqualTo=function(t){var e;return i.__super__.isEqualTo.apply(this,arguments)&&this.attachment.id===(null!=t&&null!=(e=t.attachment)?e.id:void 0)},i.prototype.toString=function(){return e.OBJECT_REPLACEMENT_CHARACTER},i.prototype.toJSON=function(){var t;return t=i.__super__.toJSON.apply(this,arguments),t.attachment=this.attachment,t},i.prototype.getCacheKey=function(){return[i.__super__.getCacheKey.apply(this,arguments),this.attachment.getCacheKey()].join(\"/\")},i.prototype.toConsole=function(){return JSON.stringify(this.toString())},i}(e.Piece))}.call(this),function(){var t,n=function(t,e){function n(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=e.normalizeNewlines,e.Piece.registerType(\"string\",e.StringPiece=function(e){function i(e){i.__super__.constructor.apply(this,arguments),this.string=t(e),this.length=this.string.length}return n(i,e),i.fromJSON=function(t){return new this(t.string,t.attributes)},i.prototype.getValue=function(){return this.string},i.prototype.toString=function(){return this.string.toString()},i.prototype.isBlockBreak=function(){return\"\\n\"===this.toString()&&this.getAttribute(\"blockBreak\")===!0},i.prototype.toJSON=function(){var t;return t=i.__super__.toJSON.apply(this,arguments),t.string=this.string,t},i.prototype.canBeConsolidatedWith=function(t){return null!=t&&this.hasSameConstructorAs(t)&&this.hasSameAttributesAsPiece(t)},i.prototype.consolidateWith=function(t){return new this.constructor(this.toString()+t.toString(),this.attributes)},i.prototype.splitAtOffset=function(t){var e,n;return 0===t?(e=null,n=this):t===this.length?(e=this,n=null):(e=new this.constructor(this.string.slice(0,t),this.attributes),n=new this.constructor(this.string.slice(t),this.attributes)),[e,n]},i.prototype.toConsole=function(){var t;return t=this.string,t.length>15&&(t=t.slice(0,14)+\"\\u2026\"),JSON.stringify(t.toString())},i}(e.Piece))}.call(this),function(){var t,n=function(t,e){function n(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty,o=[].slice;t=e.spliceArray,e.SplittableList=function(e){function i(t){null==t&&(t=[]),i.__super__.constructor.apply(this,arguments),this.objects=t.slice(0),this.length=this.objects.length}var r,s,a;return n(i,e),i.box=function(t){return t instanceof this?t:new this(t)},i.prototype.indexOf=function(t){return this.objects.indexOf(t)},i.prototype.splice=function(){var e;return e=1<=arguments.length?o.call(arguments,0):[],new this.constructor(t.apply(null,[this.objects].concat(o.call(e))))},i.prototype.eachObject=function(t){var e,n,i,o,r,s;for(r=this.objects,s=[],n=e=0,i=r.length;i>e;n=++e)o=r[n],s.push(t(o,n));return s},i.prototype.insertObjectAtIndex=function(t,e){return this.splice(e,0,t)},i.prototype.insertSplittableListAtIndex=function(t,e){return this.splice.apply(this,[e,0].concat(o.call(t.objects)))},i.prototype.insertSplittableListAtPosition=function(t,e){var n,i,o;return o=this.splitObjectAtPosition(e),i=o[0],n=o[1],new this.constructor(i).insertSplittableListAtIndex(t,n)},i.prototype.editObjectAtIndex=function(t,e){return this.replaceObjectAtIndex(e(this.objects[t]),t)},i.prototype.replaceObjectAtIndex=function(t,e){return this.splice(e,1,t)},i.prototype.removeObjectAtIndex=function(t){return this.splice(t,1)},i.prototype.getObjectAtIndex=function(t){return this.objects[t]},i.prototype.getSplittableListInRange=function(t){var e,n,i,o;return i=this.splitObjectsAtRange(t),n=i[0],e=i[1],o=i[2],new this.constructor(n.slice(e,o+1))},i.prototype.selectSplittableList=function(t){var e,n;return n=function(){var n,i,o,r;for(o=this.objects,r=[],n=0,i=o.length;i>n;n++)e=o[n],t(e)&&r.push(e);return r}.call(this),new this.constructor(n)},i.prototype.removeObjectsInRange=function(t){var e,n,i,o;return i=this.splitObjectsAtRange(t),n=i[0],e=i[1],o=i[2],new this.constructor(n).splice(e,o-e+1)},i.prototype.transformObjectsInRange=function(t,e){var n,i,o,r,s,a,u;return s=this.splitObjectsAtRange(t),r=s[0],i=s[1],a=s[2],u=function(){var t,s,u;for(u=[],n=t=0,s=r.length;s>t;n=++t)o=r[n],u.push(n>=i&&a>=n?e(o):o);return u}(),new this.constructor(u)},i.prototype.splitObjectsAtRange=function(t){var e,n,i,o,s,u;return o=this.splitObjectAtPosition(a(t)),n=o[0],e=o[1],i=o[2],s=new this.constructor(n).splitObjectAtPosition(r(t)+i),n=s[0],u=s[1],[n,e,u-1]},i.prototype.getObjectAtPosition=function(t){var e,n,i;return i=this.findIndexAndOffsetAtPosition(t),e=i.index,n=i.offset,this.objects[e]},i.prototype.splitObjectAtPosition=function(t){var e,n,i,o,r,s,a,u,c,l;return s=this.findIndexAndOffsetAtPosition(t),e=s.index,r=s.offset,o=this.objects.slice(0),null!=e?0===r?(c=e,l=0):(i=this.getObjectAtIndex(e),a=i.splitAtOffset(r),n=a[0],u=a[1],o.splice(e,1,n,u),c=e+1,l=n.getLength()-r):(c=o.length,l=0),[o,c,l]},i.prototype.consolidate=function(){var t,e,n,i,o,r;for(i=[],o=this.objects[0],r=this.objects.slice(1),t=0,e=r.length;e>t;t++)n=r[t],(\"function\"==typeof o.canBeConsolidatedWith?o.canBeConsolidatedWith(n):void 0)?o=o.consolidateWith(n):(i.push(o),o=n);return null!=o&&i.push(o),new this.constructor(i)},i.prototype.consolidateFromIndexToIndex=function(t,e){var n,i,r;return i=this.objects.slice(0),r=i.slice(t,e+1),n=new this.constructor(r).consolidate().toArray(),this.splice.apply(this,[t,r.length].concat(o.call(n)))},i.prototype.findIndexAndOffsetAtPosition=function(t){var e,n,i,o,r,s,a;for(e=0,a=this.objects,i=n=0,o=a.length;o>n;i=++n){if(s=a[i],r=e+s.getLength(),t>=e&&r>t)return{index:i,offset:t-e};e=r}return{index:null,offset:null}},i.prototype.findPositionAtIndexAndOffset=function(t,e){var n,i,o,r,s,a;for(s=0,a=this.objects,n=i=0,o=a.length;o>i;n=++i)if(r=a[n],t>n)s+=r.getLength();else if(n===t){s+=e;break}return s},i.prototype.getEndPosition=function(){var t,e;return null!=this.endPosition?this.endPosition:this.endPosition=function(){var n,i,o;for(e=0,o=this.objects,n=0,i=o.length;i>n;n++)t=o[n],e+=t.getLength();return e}.call(this)},i.prototype.toString=function(){return this.objects.join(\"\")},i.prototype.toArray=function(){return this.objects.slice(0)},i.prototype.toJSON=function(){return this.toArray()},i.prototype.isEqualTo=function(t){return i.__super__.isEqualTo.apply(this,arguments)||s(this.objects,null!=t?t.objects:void 0)},s=function(t,e){var n,i,o,r,s;if(null==e&&(e=[]),t.length!==e.length)return!1;for(s=!0,i=n=0,o=t.length;o>n;i=++n)r=t[i],s&&!r.isEqualTo(e[i])&&(s=!1);return s},i.prototype.contentsForInspection=function(){var t;return{objects:\"[\"+function(){var e,n,i,o;for(i=this.objects,o=[],e=0,n=i.length;n>e;e++)t=i[e],o.push(t.inspect());return o}.call(this).join(\", \")+\"]\"}},a=function(t){return t[0]},r=function(t){return t[1]},i}(e.Object)}.call(this),function(){var t=function(t,e){function i(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;e.Text=function(n){function i(t){var n;null==t&&(t=[]),i.__super__.constructor.apply(this,arguments),this.pieceList=new e.SplittableList(function(){var e,i,o;for(o=[],e=0,i=t.length;i>e;e++)n=t[e],n.isEmpty()||o.push(n);return o}())}return t(i,n),i.textForAttachmentWithAttributes=function(t,n){var i;return i=new e.AttachmentPiece(t,n),new this([i])},i.textForStringWithAttributes=function(t,n){var i;return i=new e.StringPiece(t,n),new this([i])},i.fromJSON=function(t){var n,i;return i=function(){var i,o,r;for(r=[],i=0,o=t.length;o>i;i++)n=t[i],r.push(e.Piece.fromJSON(n));return r}(),new this(i)},i.prototype.copy=function(){return this.copyWithPieceList(this.pieceList)},i.prototype.copyWithPieceList=function(t){return new this.constructor(t.consolidate().toArray())},i.prototype.copyUsingObjectMap=function(t){var e,n;return n=function(){var n,i,o,r,s;for(o=this.getPieces(),s=[],n=0,i=o.length;i>n;n++)e=o[n],s.push(null!=(r=t.find(e))?r:e);return s}.call(this),new this.constructor(n)},i.prototype.appendText=function(t){return this.insertTextAtPosition(t,this.getLength())},i.prototype.insertTextAtPosition=function(t,e){return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(t.pieceList,e))\n},i.prototype.removeTextAtRange=function(t){return this.copyWithPieceList(this.pieceList.removeObjectsInRange(t))},i.prototype.replaceTextAtRange=function(t,e){return this.removeTextAtRange(e).insertTextAtPosition(t,e[0])},i.prototype.moveTextFromRangeToPosition=function(t,e){var n,i;if(!(t[0]<=e&&e<=t[1]))return i=this.getTextAtRange(t),n=i.getLength(),t[0]t;t++)n=i[t],o.push(n.getAttributes());return o}.call(this),e.Hash.fromCommonAttributesOfObjects(t).toObject()},i.prototype.getCommonAttributesAtRange=function(t){var e;return null!=(e=this.getTextAtRange(t).getCommonAttributes())?e:{}},i.prototype.getExpandedRangeForAttributeAtOffset=function(t,e){var n,i,o;for(n=o=e,i=this.getLength();n>0&&this.getCommonAttributesAtRange([n-1,o])[t];)n--;for(;i>o&&this.getCommonAttributesAtRange([e,o+1])[t];)o++;return[n,o]},i.prototype.getTextAtRange=function(t){return this.copyWithPieceList(this.pieceList.getSplittableListInRange(t))},i.prototype.getStringAtRange=function(t){return this.pieceList.getSplittableListInRange(t).toString()},i.prototype.getStringAtPosition=function(t){return this.getStringAtRange([t,t+1])},i.prototype.startsWithString=function(t){return this.getStringAtRange([0,t.length])===t},i.prototype.endsWithString=function(t){var e;return e=this.getLength(),this.getStringAtRange([e-t.length,e])===t},i.prototype.getAttachmentPieces=function(){var t,e,n,i,o;for(i=this.pieceList.toArray(),o=[],t=0,e=i.length;e>t;t++)n=i[t],null!=n.attachment&&o.push(n);return o},i.prototype.getAttachments=function(){var t,e,n,i,o;for(i=this.getAttachmentPieces(),o=[],t=0,e=i.length;e>t;t++)n=i[t],o.push(n.attachment);return o},i.prototype.getAttachmentAndPositionById=function(t){var e,n,i,o,r,s;for(o=0,r=this.pieceList.toArray(),e=0,n=r.length;n>e;e++){if(i=r[e],(null!=(s=i.attachment)?s.id:void 0)===t)return{attachment:i.attachment,position:o};o+=i.length}return{attachment:null,position:null}},i.prototype.getAttachmentById=function(t){var e,n,i;return i=this.getAttachmentAndPositionById(t),e=i.attachment,n=i.position,e},i.prototype.getRangeOfAttachment=function(t){var e,n;return n=this.getAttachmentAndPositionById(t.id),t=n.attachment,e=n.position,null!=t?[e,e+1]:void 0},i.prototype.updateAttributesForAttachment=function(t,e){var n;return(n=this.getRangeOfAttachment(e))?this.addAttributesAtRange(t,n):this},i.prototype.getLength=function(){return this.pieceList.getEndPosition()},i.prototype.isEmpty=function(){return 0===this.getLength()},i.prototype.isEqualTo=function(t){var e;return i.__super__.isEqualTo.apply(this,arguments)||(null!=t&&null!=(e=t.pieceList)?e.isEqualTo(this.pieceList):void 0)},i.prototype.isBlockBreak=function(){return 1===this.getLength()&&this.pieceList.getObjectAtIndex(0).isBlockBreak()},i.prototype.eachPiece=function(t){return this.pieceList.eachObject(t)},i.prototype.getPieces=function(){return this.pieceList.toArray()},i.prototype.getPieceAtPosition=function(t){return this.pieceList.getObjectAtPosition(t)},i.prototype.contentsForInspection=function(){return{pieceList:this.pieceList.inspect()}},i.prototype.toSerializableText=function(){var t;return t=this.pieceList.selectSplittableList(function(t){return t.isSerializable()}),this.copyWithPieceList(t)},i.prototype.toString=function(){return this.pieceList.toString()},i.prototype.toJSON=function(){return this.pieceList.toJSON()},i.prototype.toConsole=function(){var t;return JSON.stringify(function(){var e,n,i,o;for(i=this.pieceList.toArray(),o=[],e=0,n=i.length;n>e;e++)t=i[e],o.push(JSON.parse(t.toConsole()));return o}.call(this))},i.prototype.getDirection=function(){return e.getDirection(this.toString())},i.prototype.isRTL=function(){return\"rtl\"===this.getDirection()},i}(e.Object)}.call(this),function(){var t,n,i,o,r,s=function(t,e){function n(){this.constructor=t}for(var i in e)a.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty,u=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},c=[].slice;t=e.arraysAreEqual,r=e.spliceArray,i=e.getBlockConfig,n=e.getBlockAttributeNames,o=e.getListAttributeNames,e.Block=function(n){function a(t,n){null==t&&(t=new e.Text),null==n&&(n=[]),a.__super__.constructor.apply(this,arguments),this.text=h(t),this.attributes=n}var l,h,p,d,f,g,m,v,y;return s(a,n),a.fromJSON=function(t){var n;return n=e.Text.fromJSON(t.text),new this(n,t.attributes)},a.prototype.isEmpty=function(){return this.text.isBlockBreak()},a.prototype.isEqualTo=function(e){return a.__super__.isEqualTo.apply(this,arguments)||this.text.isEqualTo(null!=e?e.text:void 0)&&t(this.attributes,null!=e?e.attributes:void 0)},a.prototype.copyWithText=function(t){return new this.constructor(t,this.attributes)},a.prototype.copyWithoutText=function(){return this.copyWithText(null)},a.prototype.copyWithAttributes=function(t){return new this.constructor(this.text,t)},a.prototype.copyWithoutAttributes=function(){return this.copyWithAttributes(null)},a.prototype.copyUsingObjectMap=function(t){var e;return this.copyWithText((e=t.find(this.text))?e:this.text.copyUsingObjectMap(t))},a.prototype.addAttribute=function(t){var e;return e=this.attributes.concat(d(t)),this.copyWithAttributes(e)},a.prototype.removeAttribute=function(t){var e,n;return n=i(t).listAttribute,e=g(g(this.attributes,t),n),this.copyWithAttributes(e)},a.prototype.removeLastAttribute=function(){return this.removeAttribute(this.getLastAttribute())},a.prototype.getLastAttribute=function(){return f(this.attributes)},a.prototype.getAttributes=function(){return this.attributes.slice(0)},a.prototype.getAttributeLevel=function(){return this.attributes.length},a.prototype.getAttributeAtLevel=function(t){return this.attributes[t-1]},a.prototype.hasAttribute=function(t){return u.call(this.attributes,t)>=0},a.prototype.hasAttributes=function(){return this.getAttributeLevel()>0},a.prototype.getLastNestableAttribute=function(){return f(this.getNestableAttributes())},a.prototype.getNestableAttributes=function(){var t,e,n,o,r;for(o=this.attributes,r=[],e=0,n=o.length;n>e;e++)t=o[e],i(t).nestable&&r.push(t);return r},a.prototype.getNestingLevel=function(){return this.getNestableAttributes().length},a.prototype.decreaseNestingLevel=function(){var t;return(t=this.getLastNestableAttribute())?this.removeAttribute(t):this},a.prototype.increaseNestingLevel=function(){var t,e,n;return(t=this.getLastNestableAttribute())?(n=this.attributes.lastIndexOf(t),e=r.apply(null,[this.attributes,n+1,0].concat(c.call(d(t)))),this.copyWithAttributes(e)):this},a.prototype.getListItemAttributes=function(){var t,e,n,o,r;for(o=this.attributes,r=[],e=0,n=o.length;n>e;e++)t=o[e],i(t).listAttribute&&r.push(t);return r},a.prototype.isListItem=function(){var t;return null!=(t=i(this.getLastAttribute()))?t.listAttribute:void 0},a.prototype.isTerminalBlock=function(){var t;return null!=(t=i(this.getLastAttribute()))?t.terminal:void 0},a.prototype.breaksOnReturn=function(){var t;return null!=(t=i(this.getLastAttribute()))?t.breakOnReturn:void 0},a.prototype.findLineBreakInDirectionFromPosition=function(t,e){var n,i;return i=this.toString(),n=function(){switch(t){case\"forward\":return i.indexOf(\"\\n\",e);case\"backward\":return i.slice(0,e).lastIndexOf(\"\\n\")}}(),-1!==n?n:void 0},a.prototype.contentsForInspection=function(){return{text:this.text.inspect(),attributes:this.attributes}},a.prototype.toString=function(){return this.text.toString()},a.prototype.toJSON=function(){return{text:this.text,attributes:this.attributes}},a.prototype.getDirection=function(){return this.text.getDirection()},a.prototype.isRTL=function(){return this.text.isRTL()},a.prototype.getLength=function(){return this.text.getLength()},a.prototype.canBeConsolidatedWith=function(t){return!this.hasAttributes()&&!t.hasAttributes()&&this.getDirection()===t.getDirection()},a.prototype.consolidateWith=function(t){var n,i;return n=e.Text.textForStringWithAttributes(\"\\n\"),i=this.getTextWithoutBlockBreak().appendText(n),this.copyWithText(i.appendText(t.text))},a.prototype.splitAtOffset=function(t){var e,n;return 0===t?(e=null,n=this):t===this.getLength()?(e=this,n=null):(e=this.copyWithText(this.text.getTextAtRange([0,t])),n=this.copyWithText(this.text.getTextAtRange([t,this.getLength()]))),[e,n]},a.prototype.getBlockBreakPosition=function(){return this.text.getLength()-1},a.prototype.getTextWithoutBlockBreak=function(){return m(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()},a.prototype.canBeGrouped=function(t){return this.attributes[t]},a.prototype.canBeGroupedWith=function(t,e){var n,r,s,a;return s=t.getAttributes(),r=s[e],n=this.attributes[e],!(n!==r||i(n).group===!1&&(a=s[e+1],u.call(o(),a)<0)||this.getDirection()!==t.getDirection()&&!t.isEmpty())},h=function(t){return t=y(t),t=l(t)},y=function(t){var n,i,o,r,s,a;return r=!1,a=t.getPieces(),i=2<=a.length?c.call(a,0,n=a.length-1):(n=0,[]),o=a[n++],null==o?t:(i=function(){var t,e,n;for(n=[],t=0,e=i.length;e>t;t++)s=i[t],s.isBlockBreak()?(r=!0,n.push(v(s))):n.push(s);return n}(),r?new e.Text(c.call(i).concat([o])):t)},p=e.Text.textForStringWithAttributes(\"\\n\",{blockBreak:!0}),l=function(t){return m(t)?t:t.appendText(p)},m=function(t){var e,n;return n=t.getLength(),0===n?!1:(e=t.getTextAtRange([n-1,n]),e.isBlockBreak())},v=function(t){return t.copyWithoutAttribute(\"blockBreak\")},d=function(t){var e;return e=i(t).listAttribute,null!=e?[e,t]:[t]},f=function(t){return t.slice(-1)[0]},g=function(t,e){var n;return n=t.lastIndexOf(e),-1===n?t:r(t,n,1)},a}(e.Object)}.call(this),function(){var t,n,i,o=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty,s=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},a=[].slice;n=e.tagName,i=e.walkTree,t=e.nodeIsAttachmentElement,e.HTMLSanitizer=function(r){function u(t,e){var n;n=null!=e?e:{},this.allowedAttributes=n.allowedAttributes,this.forbiddenProtocols=n.forbiddenProtocols,this.forbiddenElements=n.forbiddenElements,null==this.allowedAttributes&&(this.allowedAttributes=c),null==this.forbiddenProtocols&&(this.forbiddenProtocols=h),null==this.forbiddenElements&&(this.forbiddenElements=l),this.body=p(t)}var c,l,h,p;return o(u,r),c=\"style href src width height class\".split(\" \"),h=\"javascript:\".split(\" \"),l=\"script iframe noscript\".split(\" \"),u.sanitize=function(t,e){var n;return n=new this(t,e),n.sanitize(),n},u.prototype.sanitize=function(){return this.sanitizeElements(),this.normalizeListElementNesting()},u.prototype.getHTML=function(){return this.body.innerHTML},u.prototype.getBody=function(){return this.body},u.prototype.sanitizeElements=function(){var t,n,o,r,s;for(s=i(this.body),r=[];s.nextNode();)switch(o=s.currentNode,o.nodeType){case Node.ELEMENT_NODE:this.elementIsRemovable(o)?r.push(o):this.sanitizeElement(o);break;case Node.COMMENT_NODE:r.push(o)}for(t=0,n=r.length;n>t;t++)o=r[t],e.removeNode(o);return this.body},u.prototype.sanitizeElement=function(t){var e,n,i,o,r;for(t.hasAttribute(\"href\")&&(o=t.protocol,s.call(this.forbiddenProtocols,o)>=0&&t.removeAttribute(\"href\")),r=a.call(t.attributes),e=0,n=r.length;n>e;e++)i=r[e].name,s.call(this.allowedAttributes,i)>=0||0===i.indexOf(\"data-trix\")||t.removeAttribute(i);return t},u.prototype.normalizeListElementNesting=function(){var t,e,i,o,r;for(r=a.call(this.body.querySelectorAll(\"ul,ol\")),t=0,e=r.length;e>t;t++)i=r[t],(o=i.previousElementSibling)&&\"li\"===n(o)&&o.appendChild(i);return this.body},u.prototype.elementIsRemovable=function(t){return(null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE?this.elementIsForbidden(t)||this.elementIsntSerializable(t):void 0},u.prototype.elementIsForbidden=function(t){var e;return e=n(t),s.call(this.forbiddenElements,e)>=0},u.prototype.elementIsntSerializable=function(e){return\"false\"===e.getAttribute(\"data-trix-serialize\")&&!t(e)},p=function(t){var e,n,i,o,r;for(null==t&&(t=\"\"),t=t.replace(/<\\/html[^>]*>[^]*$/i,\"\"),e=document.implementation.createHTMLDocument(\"\"),e.documentElement.innerHTML=t,r=e.head.querySelectorAll(\"style\"),i=0,o=r.length;o>i;i++)n=r[i],e.body.appendChild(n);return e.body},u}(e.BasicObject)}.call(this),function(){var t,n,i,o,r,s,a,u,c,l,h,p=function(t,e){function n(){this.constructor=t}for(var i in e)d.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},d={}.hasOwnProperty,f=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};t=e.arraysAreEqual,s=e.makeElement,l=e.tagName,r=e.getBlockTagNames,h=e.walkTree,o=e.findClosestElementFromNode,i=e.elementContainsNode,a=e.nodeIsAttachmentElement,u=e.normalizeSpaces,n=e.breakableWhitespacePattern,c=e.squishBreakableWhitespace,e.HTMLParser=function(d){function g(t,e){this.html=t,this.referenceElement=(null!=e?e:{}).referenceElement,this.blocks=[],this.blockElements=[],this.processedElements=[]}var m,v,y,b,A,C,x,w,E,S,R,k;return p(g,d),g.parse=function(t,e){var n;return n=new this(t,e),n.parse(),n},g.prototype.getDocument=function(){return e.Document.fromJSON(this.blocks)},g.prototype.parse=function(){var t,n;try{for(this.createHiddenContainer(),t=e.HTMLSanitizer.sanitize(this.html).getHTML(),this.containerElement.innerHTML=t,n=h(this.containerElement,{usingFilter:x});n.nextNode();)this.processNode(n.currentNode);return this.translateBlockElementMarginsToNewlines()}finally{this.removeHiddenContainer()}},g.prototype.createHiddenContainer=function(){return this.referenceElement?(this.containerElement=this.referenceElement.cloneNode(!1),this.containerElement.removeAttribute(\"id\"),this.containerElement.setAttribute(\"data-trix-internal\",\"\"),this.containerElement.style.display=\"none\",this.referenceElement.parentNode.insertBefore(this.containerElement,this.referenceElement.nextSibling)):(this.containerElement=s({tagName:\"div\",style:{display:\"none\"}}),document.body.appendChild(this.containerElement))},g.prototype.removeHiddenContainer=function(){return e.removeNode(this.containerElement)},x=function(t){return\"style\"===l(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},g.prototype.processNode=function(t){switch(t.nodeType){case Node.TEXT_NODE:if(!this.isInsignificantTextNode(t))return this.appendBlockForTextNode(t),this.processTextNode(t);break;case Node.ELEMENT_NODE:return this.appendBlockForElement(t),this.processElement(t)}},g.prototype.appendBlockForTextNode=function(e){var n,i,o;return i=e.parentNode,i===this.currentBlockElement&&this.isBlockElement(e.previousSibling)?this.appendStringWithAttributes(\"\\n\"):i!==this.containerElement&&!this.isBlockElement(i)||(n=this.getBlockAttributes(i),t(n,null!=(o=this.currentBlock)?o.attributes:void 0))?void 0:(this.currentBlock=this.appendBlockForAttributesWithElement(n,i),this.currentBlockElement=i)},g.prototype.appendBlockForElement=function(e){var n,o,r,s;if(r=this.isBlockElement(e),o=i(this.currentBlockElement,e),r&&!this.isBlockElement(e.firstChild)){if((!this.isInsignificantTextNode(e.firstChild)||!this.isBlockElement(e.firstElementChild))&&(n=this.getBlockAttributes(e),e.firstChild))return o&&t(n,this.currentBlock.attributes)?this.appendStringWithAttributes(\"\\n\"):(this.currentBlock=this.appendBlockForAttributesWithElement(n,e),this.currentBlockElement=e)}else if(this.currentBlockElement&&!o&&!r)return(s=this.findParentBlockElement(e))?this.appendBlockForElement(s):(this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null)},g.prototype.findParentBlockElement=function(t){var e;for(e=t.parentElement;e&&e!==this.containerElement;){if(this.isBlockElement(e)&&f.call(this.blockElements,e)>=0)return e;e=e.parentElement}return null},g.prototype.processTextNode=function(t){var e,n;return n=t.data,v(t.parentNode)||(n=c(n),R(null!=(e=t.previousSibling)?e.textContent:void 0)&&(n=A(n))),this.appendStringWithAttributes(n,this.getTextAttributes(t.parentNode))},g.prototype.processElement=function(t){var e,n,i,o,r;if(a(t))return e=w(t,\"attachment\"),Object.keys(e).length&&(o=this.getTextAttributes(t),this.appendAttachmentWithAttributes(e,o),t.innerHTML=\"\"),this.processedElements.push(t);switch(l(t)){case\"br\":return this.isExtraBR(t)||this.isBlockElement(t.nextSibling)||this.appendStringWithAttributes(\"\\n\",this.getTextAttributes(t)),this.processedElements.push(t);case\"img\":e={url:t.getAttribute(\"src\"),contentType:\"image\"},i=b(t);for(n in i)r=i[n],e[n]=r;return this.appendAttachmentWithAttributes(e,this.getTextAttributes(t)),this.processedElements.push(t);case\"tr\":if(t.parentNode.firstChild!==t)return this.appendStringWithAttributes(\"\\n\");break;case\"td\":if(t.parentNode.firstChild!==t)return this.appendStringWithAttributes(\" | \")}},g.prototype.appendBlockForAttributesWithElement=function(t,e){var n;return this.blockElements.push(e),n=m(t),this.blocks.push(n),n},g.prototype.appendEmptyBlock=function(){return this.appendBlockForAttributesWithElement([],null)},g.prototype.appendStringWithAttributes=function(t,e){return this.appendPiece(S(t,e))},g.prototype.appendAttachmentWithAttributes=function(t,e){return this.appendPiece(E(t,e))},g.prototype.appendPiece=function(t){return 0===this.blocks.length&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(t)},g.prototype.appendStringToTextAtIndex=function(t,e){var n,i;return i=this.blocks[e].text,n=i[i.length-1],\"string\"===(null!=n?n.type:void 0)?n.string+=t:i.push(S(t))},g.prototype.prependStringToTextAtIndex=function(t,e){var n,i;return i=this.blocks[e].text,n=i[0],\"string\"===(null!=n?n.type:void 0)?n.string=t+n.string:i.unshift(S(t))},S=function(t,e){var n;return null==e&&(e={}),n=\"string\",t=u(t),{string:t,attributes:e,type:n}},E=function(t,e){var n;return null==e&&(e={}),n=\"attachment\",{attachment:t,attributes:e,type:n}},m=function(t){var e;return null==t&&(t={}),e=[],{text:e,attributes:t}},g.prototype.getTextAttributes=function(t){var n,i,r,s,u,c,l,h,p,d,f,g;r={},p=e.config.textAttributes;for(n in p)if(u=p[n],u.tagName&&o(t,{matchingSelector:u.tagName,untilNode:this.containerElement}))r[n]=!0;else if(u.parser){if(g=u.parser(t)){for(i=!1,d=this.findBlockElementAncestors(t),c=0,h=d.length;h>c;c++)if(s=d[c],u.parser(s)===g){i=!0;break}i||(r[n]=g)}}else u.styleProperty&&(g=t.style[u.styleProperty])&&(r[n]=g);if(a(t)){f=w(t,\"attributes\");for(l in f)g=f[l],r[l]=g}return r},g.prototype.getBlockAttributes=function(t){var n,i,o,r;for(i=[];t&&t!==this.containerElement;){r=e.config.blockAttributes;for(n in r)o=r[n],o.parse!==!1&&l(t)===o.tagName&&((\"function\"==typeof o.test?o.test(t):void 0)||!o.test)&&(i.push(n),o.listAttribute&&i.push(o.listAttribute));t=t.parentNode}return i.reverse()},g.prototype.findBlockElementAncestors=function(t){var e,n;for(e=[];t&&t!==this.containerElement;)n=l(t),f.call(r(),n)>=0&&e.push(t),t=t.parentNode;return e},w=function(t,e){var n;try{return n=JSON.parse(t.getAttribute(\"data-trix-\"+e)),\"text/html\"===n.contentType&&n.content&&(n.content=HTMLSanitizer.sanitize(n.content).getHTML()),n}catch(i){return{}}},b=function(t){var e,n,i;return i=t.getAttribute(\"width\"),n=t.getAttribute(\"height\"),e={},i&&(e.width=parseInt(i,10)),n&&(e.height=parseInt(n,10)),e},g.prototype.isBlockElement=function(t){var e;if((null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE&&!a(t)&&!o(t,{matchingSelector:\"td\",untilNode:this.containerElement}))return e=l(t),f.call(r(),e)>=0||\"block\"===window.getComputedStyle(t).display},g.prototype.isInsignificantTextNode=function(t){var e,n,i;if((null!=t?t.nodeType:void 0)===Node.TEXT_NODE&&k(t.data)&&(n=t.parentNode,i=t.previousSibling,e=t.nextSibling,(!C(n.previousSibling)||this.isBlockElement(n.previousSibling))&&!v(n)))return!i||this.isBlockElement(i)||!e||this.isBlockElement(e)},g.prototype.isExtraBR=function(t){return\"br\"===l(t)&&this.isBlockElement(t.parentNode)&&t.parentNode.lastChild===t},v=function(t){var e;return e=window.getComputedStyle(t).whiteSpace,\"pre\"===e||\"pre-wrap\"===e||\"pre-line\"===e},C=function(t){return t&&!R(t.textContent)},g.prototype.translateBlockElementMarginsToNewlines=function(){var t,e,n,i,o,r,s,a;for(e=this.getMarginOfDefaultBlockElement(),s=this.blocks,a=[],i=n=0,o=s.length;o>n;i=++n)t=s[i],(r=this.getMarginOfBlockElementAtIndex(i))&&(r.top>2*e.top&&this.prependStringToTextAtIndex(\"\\n\",i),a.push(r.bottom>2*e.bottom?this.appendStringToTextAtIndex(\"\\n\",i):void 0));return a},g.prototype.getMarginOfBlockElementAtIndex=function(t){var e,n;return!(e=this.blockElements[t])||!e.textContent||(n=l(e),f.call(r(),n)>=0||f.call(this.processedElements,e)>=0)?void 0:y(e)},g.prototype.getMarginOfDefaultBlockElement=function(){var t;return t=s(e.config.blockAttributes[\"default\"].tagName),this.containerElement.appendChild(t),y(t)},y=function(t){var e;return e=window.getComputedStyle(t),\"block\"===e.display?{top:parseInt(e.marginTop),bottom:parseInt(e.marginBottom)}:void 0},A=function(t){return t.replace(RegExp(\"^\"+n.source+\"+\"),\"\")},k=function(t){return RegExp(\"^\"+n.source+\"*$\").test(t)},R=function(t){return/\\s$/.test(t)},g}(e.BasicObject)}.call(this),function(){var t,n,i,o,r=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty,a=[].slice,u=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};t=e.arraysAreEqual,i=e.normalizeRange,o=e.rangeIsCollapsed,n=e.getBlockConfig,e.Document=function(s){function c(t){null==t&&(t=[]),c.__super__.constructor.apply(this,arguments),0===t.length&&(t=[new e.Block]),this.blockList=e.SplittableList.box(t)}var l;return r(c,s),c.fromJSON=function(t){var n,i;return i=function(){var i,o,r;for(r=[],i=0,o=t.length;o>i;i++)n=t[i],r.push(e.Block.fromJSON(n));return r}(),new this(i)},c.fromHTML=function(t,n){return e.HTMLParser.parse(t,n).getDocument()},c.fromString=function(t,n){var i;return i=e.Text.textForStringWithAttributes(t,n),new this([new e.Block(i)])},c.prototype.isEmpty=function(){var t;return 1===this.blockList.length&&(t=this.getBlockAtIndex(0),t.isEmpty()&&!t.hasAttributes())},c.prototype.copy=function(t){var e;return null==t&&(t={}),e=t.consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray(),new this.constructor(e)},c.prototype.copyUsingObjectsFromDocument=function(t){var n;return n=new e.ObjectMap(t.getObjects()),this.copyUsingObjectMap(n)},c.prototype.copyUsingObjectMap=function(t){var e,n,i;return n=function(){var n,o,r,s;for(r=this.getBlocks(),s=[],n=0,o=r.length;o>n;n++)e=r[n],s.push((i=t.find(e))?i:e.copyUsingObjectMap(t));return s}.call(this),new this.constructor(n)},c.prototype.copyWithBaseBlockAttributes=function(t){var e,n,i;return null==t&&(t=[]),i=function(){var i,o,r,s;for(r=this.getBlocks(),s=[],i=0,o=r.length;o>i;i++)n=r[i],e=t.concat(n.getAttributes()),s.push(n.copyWithAttributes(e));return s}.call(this),new this.constructor(i)},c.prototype.replaceBlock=function(t,e){var n;return n=this.blockList.indexOf(t),-1===n?this:new this.constructor(this.blockList.replaceObjectAtIndex(e,n))},c.prototype.insertDocumentAtRange=function(t,e){var n,r,s,a,u,c,l;return r=t.blockList,u=(e=i(e))[0],c=this.locationFromPosition(u),s=c.index,a=c.offset,l=this,n=this.getBlockAtPosition(u),o(e)&&n.isEmpty()&&!n.hasAttributes()?l=new this.constructor(l.blockList.removeObjectAtIndex(s)):n.getBlockBreakPosition()===a&&u++,l=l.removeTextAtRange(e),new this.constructor(l.blockList.insertSplittableListAtPosition(r,u))},c.prototype.mergeDocumentAtRange=function(e,n){var o,r,s,a,u,c,l,h,p,d,f,g;return f=(n=i(n))[0],d=this.locationFromPosition(f),r=this.getBlockAtIndex(d.index).getAttributes(),o=e.getBaseBlockAttributes(),g=r.slice(-o.length),t(o,g)?(l=r.slice(0,-o.length),c=e.copyWithBaseBlockAttributes(l)):c=e.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(r),s=c.getBlockCount(),a=c.getBlockAtIndex(0),t(r,a.getAttributes())?(u=a.getTextWithoutBlockBreak(),p=this.insertTextAtRange(u,n),s>1&&(c=new this.constructor(c.getBlocks().slice(1)),h=f+u.getLength(),p=p.insertDocumentAtRange(c,h))):p=this.insertDocumentAtRange(c,n),p},c.prototype.insertTextAtRange=function(t,e){var n,o,r,s,a;return a=(e=i(e))[0],s=this.locationFromPosition(a),o=s.index,r=s.offset,n=this.removeTextAtRange(e),new this.constructor(n.blockList.editObjectAtIndex(o,function(e){return e.copyWithText(e.text.insertTextAtPosition(t,r))}))},c.prototype.removeTextAtRange=function(t){var e,n,r,s,a,u,c,l,h,p,d,f,g,m,v,y,b,A,C,x,w;return p=t=i(t),l=p[0],A=p[1],o(t)?this:(d=this.locationRangeFromRange(t),u=d[0],y=d[1],a=u.index,c=u.offset,s=this.getBlockAtIndex(a),v=y.index,b=y.offset,m=this.getBlockAtIndex(v),f=A-l===1&&s.getBlockBreakPosition()===c&&m.getBlockBreakPosition()!==b&&\"\\n\"===m.text.getStringAtPosition(b),f?r=this.blockList.editObjectAtIndex(v,function(t){return t.copyWithText(t.text.removeTextAtRange([b,b+1]))}):(h=s.text.getTextAtRange([0,c]),C=m.text.getTextAtRange([b,m.getLength()]),x=h.appendText(C),g=a!==v&&0===c,w=g&&s.getAttributeLevel()>=m.getAttributeLevel(),n=w?m.copyWithText(x):s.copyWithText(x),e=v+1-a,r=this.blockList.splice(a,e,n)),new this.constructor(r))},c.prototype.moveTextFromRangeToPosition=function(t,e){var n,o,r,s,u,c,l,h,p,d;return c=t=i(t),p=c[0],r=c[1],e>=p&&r>=e?this:(o=this.getDocumentAtRange(t),h=this.removeTextAtRange(t),u=e>p,u&&(e-=o.getLength()),l=o.getBlocks(),s=l[0],n=2<=l.length?a.call(l,1):[],0===n.length?(d=s.getTextWithoutBlockBreak(),u&&(e+=1)):d=s.text,h=h.insertTextAtRange(d,e),0===n.length?h:(o=new this.constructor(n),e+=d.getLength(),h.insertDocumentAtRange(o,e)))},c.prototype.addAttributeAtRange=function(t,e,i){var o;return o=this.blockList,this.eachBlockAtRange(i,function(i,r,s){return o=o.editObjectAtIndex(s,function(){return n(t)?i.addAttribute(t,e):r[0]===r[1]?i:i.copyWithText(i.text.addAttributeAtRange(t,e,r))})}),new this.constructor(o)},c.prototype.addAttribute=function(t,e){var n;return n=this.blockList,this.eachBlock(function(i,o){return n=n.editObjectAtIndex(o,function(){return i.addAttribute(t,e)})}),new this.constructor(n)},c.prototype.removeAttributeAtRange=function(t,e){var i;return i=this.blockList,this.eachBlockAtRange(e,function(e,o,r){return n(t)?i=i.editObjectAtIndex(r,function(){return e.removeAttribute(t)}):o[0]!==o[1]?i=i.editObjectAtIndex(r,function(){return e.copyWithText(e.text.removeAttributeAtRange(t,o))}):void 0}),new this.constructor(i)},c.prototype.updateAttributesForAttachment=function(t,e){var n,i,o,r;return o=(i=this.getRangeOfAttachment(e))[0],n=this.locationFromPosition(o).index,r=this.getTextAtIndex(n),new this.constructor(this.blockList.editObjectAtIndex(n,function(n){return n.copyWithText(r.updateAttributesForAttachment(t,e))}))},c.prototype.removeAttributeForAttachment=function(t,e){var n;return n=this.getRangeOfAttachment(e),this.removeAttributeAtRange(t,n)},c.prototype.insertBlockBreakAtRange=function(t){var n,o,r,s;return s=(t=i(t))[0],r=this.locationFromPosition(s).offset,o=this.removeTextAtRange(t),0===r&&(n=[new e.Block]),new this.constructor(o.blockList.insertSplittableListAtPosition(new e.SplittableList(n),s))},c.prototype.applyBlockAttributeAtRange=function(t,e,i){var o,r,s,a;return s=this.expandRangeToLineBreaksAndSplitBlocks(i),r=s.document,i=s.range,o=n(t),o.listAttribute?(r=r.removeLastListAttributeAtRange(i,{exceptAttributeName:t}),a=r.convertLineBreaksToBlockBreaksInRange(i),r=a.document,i=a.range):r=o.exclusive?r.removeBlockAttributesAtRange(i):o.terminal?r.removeLastTerminalAttributeAtRange(i):r.consolidateBlocksAtRange(i),r.addAttributeAtRange(t,e,i)},c.prototype.removeLastListAttributeAtRange=function(t,e){var i;return null==e&&(e={}),i=this.blockList,this.eachBlockAtRange(t,function(t,o,r){var s;if((s=t.getLastAttribute())&&n(s).listAttribute&&s!==e.exceptAttributeName)return i=i.editObjectAtIndex(r,function(){return t.removeAttribute(s)})}),new this.constructor(i)},c.prototype.removeLastTerminalAttributeAtRange=function(t){var e;return e=this.blockList,this.eachBlockAtRange(t,function(t,i,o){var r;if((r=t.getLastAttribute())&&n(r).terminal)return e=e.editObjectAtIndex(o,function(){return t.removeAttribute(r)})}),new this.constructor(e)},c.prototype.removeBlockAttributesAtRange=function(t){var e;return e=this.blockList,this.eachBlockAtRange(t,function(t,n,i){return t.hasAttributes()?e=e.editObjectAtIndex(i,function(){return t.copyWithoutAttributes()}):void 0}),new this.constructor(e)},c.prototype.expandRangeToLineBreaksAndSplitBlocks=function(t){var e,n,o,r,s,a,u,c,l;return a=t=i(t),l=a[0],r=a[1],c=this.locationFromPosition(l),o=this.locationFromPosition(r),e=this,u=e.getBlockAtIndex(c.index),null!=(c.offset=u.findLineBreakInDirectionFromPosition(\"backward\",c.offset))&&(s=e.positionFromLocation(c),e=e.insertBlockBreakAtRange([s,s+1]),o.index+=1,o.offset-=e.getBlockAtIndex(c.index).getLength(),c.index+=1),c.offset=0,0===o.offset&&o.index>c.index?(o.index-=1,o.offset=e.getBlockAtIndex(o.index).getBlockBreakPosition()):(n=e.getBlockAtIndex(o.index),\"\\n\"===n.text.getStringAtRange([o.offset-1,o.offset])?o.offset-=1:o.offset=n.findLineBreakInDirectionFromPosition(\"forward\",o.offset),o.offset!==n.getBlockBreakPosition()&&(s=e.positionFromLocation(o),e=e.insertBlockBreakAtRange([s,s+1]))),l=e.positionFromLocation(c),r=e.positionFromLocation(o),t=i([l,r]),{document:e,range:t}},c.prototype.convertLineBreaksToBlockBreaksInRange=function(t){var e,n,o;return n=(t=i(t))[0],o=this.getStringAtRange(t).slice(0,-1),e=this,o.replace(/.*?\\n/g,function(t){return n+=t.length,e=e.insertBlockBreakAtRange([n-1,n])}),{document:e,range:t}},c.prototype.consolidateBlocksAtRange=function(t){var e,n,o,r,s;return o=t=i(t),s=o[0],n=o[1],r=this.locationFromPosition(s).index,e=this.locationFromPosition(n).index,new this.constructor(this.blockList.consolidateFromIndexToIndex(r,e))},c.prototype.getDocumentAtRange=function(t){var e;return t=i(t),e=this.blockList.getSplittableListInRange(t).toArray(),new this.constructor(e)},c.prototype.getStringAtRange=function(t){var e,n,o;return o=t=i(t),n=o[o.length-1],n!==this.getLength()&&(e=-1),this.getDocumentAtRange(t).toString().slice(0,e)},c.prototype.getBlockAtIndex=function(t){return this.blockList.getObjectAtIndex(t)},c.prototype.getBlockAtPosition=function(t){var e;return e=this.locationFromPosition(t).index,this.getBlockAtIndex(e)},c.prototype.getTextAtIndex=function(t){var e;return null!=(e=this.getBlockAtIndex(t))?e.text:void 0},c.prototype.getTextAtPosition=function(t){var e;return e=this.locationFromPosition(t).index,this.getTextAtIndex(e)},c.prototype.getPieceAtPosition=function(t){var e,n,i;return i=this.locationFromPosition(t),e=i.index,n=i.offset,this.getTextAtIndex(e).getPieceAtPosition(n)},c.prototype.getCharacterAtPosition=function(t){var e,n,i;return i=this.locationFromPosition(t),e=i.index,n=i.offset,this.getTextAtIndex(e).getStringAtRange([n,n+1])},c.prototype.getLength=function(){return this.blockList.getEndPosition()},c.prototype.getBlocks=function(){return this.blockList.toArray()},c.prototype.getBlockCount=function(){return this.blockList.length},c.prototype.getEditCount=function(){return this.editCount},c.prototype.eachBlock=function(t){return this.blockList.eachObject(t)},c.prototype.eachBlockAtRange=function(t,e){var n,o,r,s,a,u,c,l,h,p,d,f;if(u=t=i(t),d=u[0],r=u[1],p=this.locationFromPosition(d),o=this.locationFromPosition(r),p.index===o.index)return n=this.getBlockAtIndex(p.index),f=[p.offset,o.offset],e(n,f,p.index);for(h=[],a=s=c=p.index,l=o.index;l>=c?l>=s:s>=l;a=l>=c?++s:--s)(n=this.getBlockAtIndex(a))?(f=function(){switch(a){case p.index:return[p.offset,n.text.getLength()];case o.index:return[0,o.offset];default:return[0,n.text.getLength()]}}(),h.push(e(n,f,a))):h.push(void 0);return h},c.prototype.getCommonAttributesAtRange=function(t){var n,r,s;\nreturn r=(t=i(t))[0],o(t)?this.getCommonAttributesAtPosition(r):(s=[],n=[],this.eachBlockAtRange(t,function(t,e){return e[0]!==e[1]?(s.push(t.text.getCommonAttributesAtRange(e)),n.push(l(t))):void 0}),e.Hash.fromCommonAttributesOfObjects(s).merge(e.Hash.fromCommonAttributesOfObjects(n)).toObject())},c.prototype.getCommonAttributesAtPosition=function(t){var n,i,o,r,s,a,c,h,p,d;if(p=this.locationFromPosition(t),s=p.index,h=p.offset,o=this.getBlockAtIndex(s),!o)return{};r=l(o),n=o.text.getAttributesAtPosition(h),i=o.text.getAttributesAtPosition(h-1),a=function(){var t,n;t=e.config.textAttributes,n=[];for(c in t)d=t[c],d.inheritable&&n.push(c);return n}();for(c in i)d=i[c],(d===n[c]||u.call(a,c)>=0)&&(r[c]=d);return r},c.prototype.getRangeOfCommonAttributeAtPosition=function(t,e){var n,o,r,s,a,u,c,l,h;return a=this.locationFromPosition(e),r=a.index,s=a.offset,h=this.getTextAtIndex(r),u=h.getExpandedRangeForAttributeAtOffset(t,s),l=u[0],o=u[1],c=this.positionFromLocation({index:r,offset:l}),n=this.positionFromLocation({index:r,offset:o}),i([c,n])},c.prototype.getBaseBlockAttributes=function(){var t,e,n,i,o,r,s;for(t=this.getBlockAtIndex(0).getAttributes(),n=i=1,s=this.getBlockCount();s>=1?s>i:i>s;n=s>=1?++i:--i)e=this.getBlockAtIndex(n).getAttributes(),r=Math.min(t.length,e.length),t=function(){var n,i,s;for(s=[],o=n=0,i=r;(i>=0?i>n:n>i)&&e[o]===t[o];o=i>=0?++n:--n)s.push(e[o]);return s}();return t},l=function(t){var e,n;return n={},(e=t.getLastAttribute())&&(n[e]=!0),n},c.prototype.getAttachmentById=function(t){var e,n,i,o;for(o=this.getAttachments(),n=0,i=o.length;i>n;n++)if(e=o[n],e.id===t)return e},c.prototype.getAttachmentPieces=function(){var t;return t=[],this.blockList.eachObject(function(e){var n;return n=e.text,t=t.concat(n.getAttachmentPieces())}),t},c.prototype.getAttachments=function(){var t,e,n,i,o;for(i=this.getAttachmentPieces(),o=[],t=0,e=i.length;e>t;t++)n=i[t],o.push(n.attachment);return o},c.prototype.getRangeOfAttachment=function(t){var e,n,o,r,s,a,u;for(r=0,s=this.blockList.toArray(),n=e=0,o=s.length;o>e;n=++e){if(a=s[n].text,u=a.getRangeOfAttachment(t))return i([r+u[0],r+u[1]]);r+=a.getLength()}},c.prototype.getLocationRangeOfAttachment=function(t){var e;return e=this.getRangeOfAttachment(t),this.locationRangeFromRange(e)},c.prototype.getAttachmentPieceForAttachment=function(t){var e,n,i,o;for(o=this.getAttachmentPieces(),e=0,n=o.length;n>e;e++)if(i=o[e],i.attachment===t)return i},c.prototype.findRangesForBlockAttribute=function(t){var e,n,i,o,r,s,a;for(r=0,s=[],a=this.getBlocks(),n=0,i=a.length;i>n;n++)e=a[n],o=e.getLength(),e.hasAttribute(t)&&s.push([r,r+o]),r+=o;return s},c.prototype.findRangesForTextAttribute=function(t,e){var n,i,o,r,s,a,u,c,l,h;for(h=(null!=e?e:{}).withValue,a=0,u=[],c=[],r=function(e){return null!=h?e.getAttribute(t)===h:e.hasAttribute(t)},l=this.getPieces(),n=0,i=l.length;i>n;n++)s=l[n],o=s.getLength(),r(s)&&(u[1]===a?u[1]=a+o:c.push(u=[a,a+o])),a+=o;return c},c.prototype.locationFromPosition=function(t){var e,n;return n=this.blockList.findIndexAndOffsetAtPosition(Math.max(0,t)),null!=n.index?n:(e=this.getBlocks(),{index:e.length-1,offset:e[e.length-1].getLength()})},c.prototype.positionFromLocation=function(t){return this.blockList.findPositionAtIndexAndOffset(t.index,t.offset)},c.prototype.locationRangeFromPosition=function(t){return i(this.locationFromPosition(t))},c.prototype.locationRangeFromRange=function(t){var e,n,o,r;if(t=i(t))return r=t[0],n=t[1],o=this.locationFromPosition(r),e=this.locationFromPosition(n),i([o,e])},c.prototype.rangeFromLocationRange=function(t){var e,n;return t=i(t),e=this.positionFromLocation(t[0]),o(t)||(n=this.positionFromLocation(t[1])),i([e,n])},c.prototype.isEqualTo=function(t){return this.blockList.isEqualTo(null!=t?t.blockList:void 0)},c.prototype.getTexts=function(){var t,e,n,i,o;for(i=this.getBlocks(),o=[],e=0,n=i.length;n>e;e++)t=i[e],o.push(t.text);return o},c.prototype.getPieces=function(){var t,e,n,i,o;for(n=[],i=this.getTexts(),t=0,e=i.length;e>t;t++)o=i[t],n.push.apply(n,o.getPieces());return n},c.prototype.getObjects=function(){return this.getBlocks().concat(this.getTexts()).concat(this.getPieces())},c.prototype.toSerializableDocument=function(){var t;return t=[],this.blockList.eachObject(function(e){return t.push(e.copyWithText(e.text.toSerializableText()))}),new this.constructor(t)},c.prototype.toString=function(){return this.blockList.toString()},c.prototype.toJSON=function(){return this.blockList.toJSON()},c.prototype.toConsole=function(){var t;return JSON.stringify(function(){var e,n,i,o;for(i=this.blockList.toArray(),o=[],e=0,n=i.length;n>e;e++)t=i[e],o.push(JSON.parse(t.text.toConsole()));return o}.call(this))},c}(e.Object)}.call(this),function(){e.LineBreakInsertion=function(){function t(t){var e;this.composition=t,this.document=this.composition.document,e=this.composition.getSelectedRange(),this.startPosition=e[0],this.endPosition=e[1],this.startLocation=this.document.locationFromPosition(this.startPosition),this.endLocation=this.document.locationFromPosition(this.endPosition),this.block=this.document.getBlockAtIndex(this.endLocation.index),this.breaksOnReturn=this.block.breaksOnReturn(),this.previousCharacter=this.block.text.getStringAtPosition(this.endLocation.offset-1),this.nextCharacter=this.block.text.getStringAtPosition(this.endLocation.offset)}return t.prototype.shouldInsertBlockBreak=function(){return this.block.hasAttributes()&&this.block.isListItem()&&!this.block.isEmpty()?0!==this.startLocation.offset:this.breaksOnReturn&&\"\\n\"!==this.nextCharacter},t.prototype.shouldBreakFormattedBlock=function(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&\"\\n\"===this.nextCharacter||\"\\n\"===this.previousCharacter)},t.prototype.shouldDecreaseListLevel=function(){return this.block.hasAttributes()&&this.block.isListItem()&&this.block.isEmpty()},t.prototype.shouldPrependListItem=function(){return this.block.isListItem()&&0===this.startLocation.offset&&!this.block.isEmpty()},t.prototype.shouldRemoveLastBlockAttribute=function(){return this.block.hasAttributes()&&!this.block.isListItem()&&this.block.isEmpty()},t}()}.call(this),function(){var t,n,i,o,r,s,a,u,c,l,h=function(t,e){function n(){this.constructor=t}for(var i in e)p.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty;s=e.normalizeRange,c=e.rangesAreEqual,u=e.rangeIsCollapsed,a=e.objectsAreEqual,t=e.arrayStartsWith,l=e.summarizeArrayChange,i=e.getAllAttributeNames,o=e.getBlockConfig,r=e.getTextConfig,n=e.extend,e.Composition=function(p){function d(){this.document=new e.Document,this.attachments=[],this.currentAttributes={},this.revision=0}var f;return h(d,p),d.prototype.setDocument=function(t){var e;return t.isEqualTo(this.document)?void 0:(this.document=t,this.refreshAttachments(),this.revision++,null!=(e=this.delegate)&&\"function\"==typeof e.compositionDidChangeDocument?e.compositionDidChangeDocument(t):void 0)},d.prototype.getSnapshot=function(){return{document:this.document,selectedRange:this.getSelectedRange()}},d.prototype.loadSnapshot=function(t){var n,i,o,r;return n=t.document,r=t.selectedRange,null!=(i=this.delegate)&&\"function\"==typeof i.compositionWillLoadSnapshot&&i.compositionWillLoadSnapshot(),this.setDocument(null!=n?n:new e.Document),this.setSelection(null!=r?r:[0,0]),null!=(o=this.delegate)&&\"function\"==typeof o.compositionDidLoadSnapshot?o.compositionDidLoadSnapshot():void 0},d.prototype.insertText=function(t,e){var n,i,o,r;return r=(null!=e?e:{updatePosition:!0}).updatePosition,i=this.getSelectedRange(),this.setDocument(this.document.insertTextAtRange(t,i)),o=i[0],n=o+t.getLength(),r&&this.setSelection(n),this.notifyDelegateOfInsertionAtRange([o,n])},d.prototype.insertBlock=function(t){var n;return null==t&&(t=new e.Block),n=new e.Document([t]),this.insertDocument(n)},d.prototype.insertDocument=function(t){var n,i,o;return null==t&&(t=new e.Document),i=this.getSelectedRange(),this.setDocument(this.document.insertDocumentAtRange(t,i)),o=i[0],n=o+t.getLength(),this.setSelection(n),this.notifyDelegateOfInsertionAtRange([o,n])},d.prototype.insertString=function(t,n){var i,o;return i=this.getCurrentTextAttributes(),o=e.Text.textForStringWithAttributes(t,i),this.insertText(o,n)},d.prototype.insertBlockBreak=function(){var t,e,n;return e=this.getSelectedRange(),this.setDocument(this.document.insertBlockBreakAtRange(e)),n=e[0],t=n+1,this.setSelection(t),this.notifyDelegateOfInsertionAtRange([n,t])},d.prototype.insertLineBreak=function(){var t,n;return n=new e.LineBreakInsertion(this),n.shouldDecreaseListLevel()?(this.decreaseListLevel(),this.setSelection(n.startPosition)):n.shouldPrependListItem()?(t=new e.Document([n.block.copyWithoutText()]),this.insertDocument(t)):n.shouldInsertBlockBreak()?this.insertBlockBreak():n.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():n.shouldBreakFormattedBlock()?this.breakFormattedBlock(n):this.insertString(\"\\n\")},d.prototype.insertHTML=function(t){var n,i,o,r;return n=e.Document.fromHTML(t),o=this.getSelectedRange(),this.setDocument(this.document.mergeDocumentAtRange(n,o)),r=o[0],i=r+n.getLength()-1,this.setSelection(i),this.notifyDelegateOfInsertionAtRange([r,i])},d.prototype.replaceHTML=function(t){var n,i,o;return n=e.Document.fromHTML(t).copyUsingObjectsFromDocument(this.document),i=this.getLocationRange({strict:!1}),o=this.document.rangeFromLocationRange(i),this.setDocument(n),this.setSelection(o)},d.prototype.insertFile=function(t){return this.insertFiles([t])},d.prototype.insertFiles=function(t){var n,i,o,r,s,a;for(i=[],r=0,s=t.length;s>r;r++)o=t[r],(null!=(a=this.delegate)?a.compositionShouldAcceptFile(o):void 0)&&(n=e.Attachment.attachmentForFile(o),i.push(n));return this.insertAttachments(i)},d.prototype.insertAttachment=function(t){return this.insertAttachments([t])},d.prototype.insertAttachments=function(t){var n,i,o,r,s,a,u,c,l;for(c=new e.Text,r=0,s=t.length;s>r;r++)n=t[r],l=n.getType(),a=null!=(u=e.config.attachments[l])?u.presentation:void 0,o=this.getCurrentTextAttributes(),a&&(o.presentation=a),i=e.Text.textForAttachmentWithAttributes(n,o),c=c.appendText(i);return this.insertText(c)},d.prototype.shouldManageDeletingInDirection=function(t){var e;if(e=this.getLocationRange(),u(e)){if(\"backward\"===t&&0===e[0].offset)return!0;if(this.shouldManageMovingCursorInDirection(t))return!0}else if(e[0].index!==e[1].index)return!0;return!1},d.prototype.deleteInDirection=function(t,e){var n,i,o,r,s,a,c,l;return r=(null!=e?e:{}).length,s=this.getLocationRange(),a=this.getSelectedRange(),c=u(a),c?o=\"backward\"===t&&0===s[0].offset:l=s[0].index!==s[1].index,o&&this.canDecreaseBlockAttributeLevel()&&(i=this.getBlock(),i.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(a[0]),i.isEmpty())?!1:(c&&(a=this.getExpandedRangeInDirection(t,{length:r}),\"backward\"===t&&(n=this.getAttachmentAtRange(a))),n?(this.editAttachment(n),!1):(this.setDocument(this.document.removeTextAtRange(a)),this.setSelection(a[0]),o||l?!1:void 0))},d.prototype.moveTextFromRange=function(t){var e;return e=this.getSelectedRange()[0],this.setDocument(this.document.moveTextFromRangeToPosition(t,e)),this.setSelection(e)},d.prototype.removeAttachment=function(t){var e;return(e=this.document.getRangeOfAttachment(t))?(this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(e)),this.setSelection(e[0])):void 0},d.prototype.removeLastBlockAttribute=function(){var t,e,n,i;return n=this.getSelectedRange(),i=n[0],e=n[1],t=this.document.getBlockAtPosition(e),this.removeCurrentAttribute(t.getLastAttribute()),this.setSelection(i)},f=\" \",d.prototype.insertPlaceholder=function(){return this.placeholderPosition=this.getPosition(),this.insertString(f)},d.prototype.selectPlaceholder=function(){return null!=this.placeholderPosition?(this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+f.length]),this.getSelectedRange()):void 0},d.prototype.forgetPlaceholder=function(){return this.placeholderPosition=null},d.prototype.hasCurrentAttribute=function(t){var e;return e=this.currentAttributes[t],null!=e&&e!==!1},d.prototype.toggleCurrentAttribute=function(t){var e;return(e=!this.currentAttributes[t])?this.setCurrentAttribute(t,e):this.removeCurrentAttribute(t)},d.prototype.canSetCurrentAttribute=function(t){return o(t)?this.canSetCurrentBlockAttribute(t):this.canSetCurrentTextAttribute(t)},d.prototype.canSetCurrentTextAttribute=function(){var t,e,n,i,o;if(e=this.getSelectedDocument()){for(o=e.getAttachments(),n=0,i=o.length;i>n;n++)if(t=o[n],!t.hasContent())return!1;return!0}},d.prototype.canSetCurrentBlockAttribute=function(){var t;if(t=this.getBlock())return!t.isTerminalBlock()},d.prototype.setCurrentAttribute=function(t,e){return o(t)?this.setBlockAttribute(t,e):(this.setTextAttribute(t,e),this.currentAttributes[t]=e,this.notifyDelegateOfCurrentAttributesChange())},d.prototype.setTextAttribute=function(t,n){var i,o,r,s;if(o=this.getSelectedRange())return r=o[0],i=o[1],r!==i?this.setDocument(this.document.addAttributeAtRange(t,n,o)):\"href\"===t?(s=e.Text.textForStringWithAttributes(n,{href:n}),this.insertText(s)):void 0},d.prototype.setBlockAttribute=function(t,e){var n,i;if(i=this.getSelectedRange())return this.canSetCurrentAttribute(t)?(n=this.getBlock(),this.setDocument(this.document.applyBlockAttributeAtRange(t,e,i)),this.setSelection(i)):void 0},d.prototype.removeCurrentAttribute=function(t){return o(t)?(this.removeBlockAttribute(t),this.updateCurrentAttributes()):(this.removeTextAttribute(t),delete this.currentAttributes[t],this.notifyDelegateOfCurrentAttributesChange())},d.prototype.removeTextAttribute=function(t){var e;if(e=this.getSelectedRange())return this.setDocument(this.document.removeAttributeAtRange(t,e))},d.prototype.removeBlockAttribute=function(t){var e;if(e=this.getSelectedRange())return this.setDocument(this.document.removeAttributeAtRange(t,e))},d.prototype.canDecreaseNestingLevel=function(){var t;return(null!=(t=this.getBlock())?t.getNestingLevel():void 0)>0},d.prototype.canIncreaseNestingLevel=function(){var e,n,i;if(e=this.getBlock())return(null!=(i=o(e.getLastNestableAttribute()))?i.listAttribute:0)?(n=this.getPreviousBlock())?t(n.getListItemAttributes(),e.getListItemAttributes()):void 0:e.getNestingLevel()>0},d.prototype.decreaseNestingLevel=function(){var t;if(t=this.getBlock())return this.setDocument(this.document.replaceBlock(t,t.decreaseNestingLevel()))},d.prototype.increaseNestingLevel=function(){var t;if(t=this.getBlock())return this.setDocument(this.document.replaceBlock(t,t.increaseNestingLevel()))},d.prototype.canDecreaseBlockAttributeLevel=function(){var t;return(null!=(t=this.getBlock())?t.getAttributeLevel():void 0)>0},d.prototype.decreaseBlockAttributeLevel=function(){var t,e;return(t=null!=(e=this.getBlock())?e.getLastAttribute():void 0)?this.removeCurrentAttribute(t):void 0},d.prototype.decreaseListLevel=function(){var t,e,n,i,o,r;for(r=this.getSelectedRange()[0],o=this.document.locationFromPosition(r).index,n=o,t=this.getBlock().getAttributeLevel();(e=this.document.getBlockAtIndex(n+1))&&e.isListItem()&&e.getAttributeLevel()>t;)n++;return r=this.document.positionFromLocation({index:o,offset:0}),i=this.document.positionFromLocation({index:n,offset:0}),this.setDocument(this.document.removeLastListAttributeAtRange([r,i]))},d.prototype.updateCurrentAttributes=function(){var t,e,n,o,r,s;if(s=this.getSelectedRange({ignoreLock:!0})){for(e=this.document.getCommonAttributesAtRange(s),r=i(),n=0,o=r.length;o>n;n++)t=r[n],e[t]||this.canSetCurrentAttribute(t)||(e[t]=!1);if(!a(e,this.currentAttributes))return this.currentAttributes=e,this.notifyDelegateOfCurrentAttributesChange()}},d.prototype.getCurrentAttributes=function(){return n.call({},this.currentAttributes)},d.prototype.getCurrentTextAttributes=function(){var t,e,n,i;t={},n=this.currentAttributes;for(e in n)i=n[e],i!==!1&&r(e)&&(t[e]=i);return t},d.prototype.freezeSelection=function(){return this.setCurrentAttribute(\"frozen\",!0)},d.prototype.thawSelection=function(){return this.removeCurrentAttribute(\"frozen\")},d.prototype.hasFrozenSelection=function(){return this.hasCurrentAttribute(\"frozen\")},d.proxyMethod(\"getSelectionManager().getPointRange\"),d.proxyMethod(\"getSelectionManager().setLocationRangeFromPointRange\"),d.proxyMethod(\"getSelectionManager().createLocationRangeFromDOMRange\"),d.proxyMethod(\"getSelectionManager().locationIsCursorTarget\"),d.proxyMethod(\"getSelectionManager().selectionIsExpanded\"),d.proxyMethod(\"delegate?.getSelectionManager\"),d.prototype.setSelection=function(t){var e,n;return e=this.document.locationRangeFromRange(t),null!=(n=this.delegate)?n.compositionDidRequestChangingSelectionToLocationRange(e):void 0},d.prototype.getSelectedRange=function(){var t;return(t=this.getLocationRange())?this.document.rangeFromLocationRange(t):void 0},d.prototype.setSelectedRange=function(t){var e;return e=this.document.locationRangeFromRange(t),this.getSelectionManager().setLocationRange(e)},d.prototype.getPosition=function(){var t;return(t=this.getLocationRange())?this.document.positionFromLocation(t[0]):void 0},d.prototype.getLocationRange=function(t){var e,n;return null!=(e=null!=(n=this.targetLocationRange)?n:this.getSelectionManager().getLocationRange(t))?e:s({index:0,offset:0})},d.prototype.withTargetLocationRange=function(t,e){var n;this.targetLocationRange=t;try{n=e()}finally{this.targetLocationRange=null}return n},d.prototype.withTargetRange=function(t,e){var n;return n=this.document.locationRangeFromRange(t),this.withTargetLocationRange(n,e)},d.prototype.withTargetDOMRange=function(t,e){var n;return n=this.createLocationRangeFromDOMRange(t,{strict:!1}),this.withTargetLocationRange(n,e)},d.prototype.getExpandedRangeInDirection=function(t,e){var n,i,o,r;return i=(null!=e?e:{}).length,o=this.getSelectedRange(),r=o[0],n=o[1],\"backward\"===t?i?r-=i:r=this.translateUTF16PositionFromOffset(r,-1):i?n+=i:n=this.translateUTF16PositionFromOffset(n,1),s([r,n])},d.prototype.shouldManageMovingCursorInDirection=function(t){var e;return this.editingAttachment?!0:(e=this.getExpandedRangeInDirection(t),null!=this.getAttachmentAtRange(e))},d.prototype.moveCursorInDirection=function(t){var e,n,i,o;return this.editingAttachment?i=this.document.getRangeOfAttachment(this.editingAttachment):(o=this.getSelectedRange(),i=this.getExpandedRangeInDirection(t),n=!c(o,i)),this.setSelectedRange(\"backward\"===t?i[0]:i[1]),n&&(e=this.getAttachmentAtRange(i))?this.editAttachment(e):void 0},d.prototype.expandSelectionInDirection=function(t,e){var n,i;return n=(null!=e?e:{}).length,i=this.getExpandedRangeInDirection(t,{length:n}),this.setSelectedRange(i)},d.prototype.expandSelectionForEditing=function(){return this.hasCurrentAttribute(\"href\")?this.expandSelectionAroundCommonAttribute(\"href\"):void 0},d.prototype.expandSelectionAroundCommonAttribute=function(t){var e,n;return e=this.getPosition(),n=this.document.getRangeOfCommonAttributeAtPosition(t,e),this.setSelectedRange(n)},d.prototype.selectionContainsAttachments=function(){var t;return(null!=(t=this.getSelectedAttachments())?t.length:void 0)>0},d.prototype.selectionIsInCursorTarget=function(){return this.editingAttachment||this.positionIsCursorTarget(this.getPosition())},d.prototype.positionIsCursorTarget=function(t){var e;return(e=this.document.locationFromPosition(t))?this.locationIsCursorTarget(e):void 0},d.prototype.positionIsBlockBreak=function(t){var e;return null!=(e=this.document.getPieceAtPosition(t))?e.isBlockBreak():void 0},d.prototype.getSelectedDocument=function(){var t;return(t=this.getSelectedRange())?this.document.getDocumentAtRange(t):void 0},d.prototype.getSelectedAttachments=function(){var t;return null!=(t=this.getSelectedDocument())?t.getAttachments():void 0},d.prototype.getAttachments=function(){return this.attachments.slice(0)},d.prototype.refreshAttachments=function(){var t,e,n,i,o,r,s,a,u,c,h,p;for(n=this.document.getAttachments(),a=l(this.attachments,n),t=a.added,h=a.removed,this.attachments=n,i=0,r=h.length;r>i;i++)e=h[i],e.delegate=null,null!=(u=this.delegate)&&\"function\"==typeof u.compositionDidRemoveAttachment&&u.compositionDidRemoveAttachment(e);for(p=[],o=0,s=t.length;s>o;o++)e=t[o],e.delegate=this,p.push(null!=(c=this.delegate)&&\"function\"==typeof c.compositionDidAddAttachment?c.compositionDidAddAttachment(e):void 0);return p},d.prototype.attachmentDidChangeAttributes=function(t){var e;return this.revision++,null!=(e=this.delegate)&&\"function\"==typeof e.compositionDidEditAttachment?e.compositionDidEditAttachment(t):void 0},d.prototype.attachmentDidChangePreviewURL=function(t){var e;return this.revision++,null!=(e=this.delegate)&&\"function\"==typeof e.compositionDidChangeAttachmentPreviewURL?e.compositionDidChangeAttachmentPreviewURL(t):void 0},d.prototype.editAttachment=function(t,e){var n;if(t!==this.editingAttachment)return this.stopEditingAttachment(),this.editingAttachment=t,null!=(n=this.delegate)&&\"function\"==typeof n.compositionDidStartEditingAttachment?n.compositionDidStartEditingAttachment(this.editingAttachment,e):void 0},d.prototype.stopEditingAttachment=function(){var t;if(this.editingAttachment)return null!=(t=this.delegate)&&\"function\"==typeof t.compositionDidStopEditingAttachment&&t.compositionDidStopEditingAttachment(this.editingAttachment),this.editingAttachment=null},d.prototype.updateAttributesForAttachment=function(t,e){return this.setDocument(this.document.updateAttributesForAttachment(t,e))},d.prototype.removeAttributeForAttachment=function(t,e){return this.setDocument(this.document.removeAttributeForAttachment(t,e))},d.prototype.breakFormattedBlock=function(t){var n,i,o,r,s;return i=t.document,n=t.block,r=t.startPosition,s=[r-1,r],n.getBlockBreakPosition()===t.startLocation.offset?(n.breaksOnReturn()&&\"\\n\"===t.nextCharacter?r+=1:i=i.removeTextAtRange(s),s=[r,r]):\"\\n\"===t.nextCharacter?\"\\n\"===t.previousCharacter?s=[r-1,r+1]:(s=[r,r+1],r+=1):t.startLocation.offset-1!==0&&(r+=1),o=new e.Document([n.removeLastAttribute().copyWithoutText()]),this.setDocument(i.insertDocumentAtRange(o,s)),this.setSelection(r)},d.prototype.getPreviousBlock=function(){var t,e;return(e=this.getLocationRange())&&(t=e[0].index,t>0)?this.document.getBlockAtIndex(t-1):void 0},d.prototype.getBlock=function(){var t;return(t=this.getLocationRange())?this.document.getBlockAtIndex(t[0].index):void 0},d.prototype.getAttachmentAtRange=function(t){var n;return n=this.document.getDocumentAtRange(t),n.toString()===e.OBJECT_REPLACEMENT_CHARACTER+\"\\n\"?n.getAttachments()[0]:void 0},d.prototype.notifyDelegateOfCurrentAttributesChange=function(){var t;return null!=(t=this.delegate)&&\"function\"==typeof t.compositionDidChangeCurrentAttributes?t.compositionDidChangeCurrentAttributes(this.currentAttributes):void 0},d.prototype.notifyDelegateOfInsertionAtRange=function(t){var e;return null!=(e=this.delegate)&&\"function\"==typeof e.compositionDidPerformInsertionAtRange?e.compositionDidPerformInsertionAtRange(t):void 0},d.prototype.translateUTF16PositionFromOffset=function(t,e){var n,i;return i=this.document.toUTF16String(),n=i.offsetFromUCS2Offset(t),i.offsetToUCS2Offset(n+e)},d}(e.BasicObject)}.call(this),function(){var t=function(t,e){function i(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;e.UndoManager=function(e){function n(t){this.composition=t,this.undoEntries=[],this.redoEntries=[]}var i;return t(n,e),n.prototype.recordUndoEntry=function(t,e){var n,o,r,s,a;return s=null!=e?e:{},o=s.context,n=s.consolidatable,r=this.undoEntries.slice(-1)[0],n&&i(r,t,o)?void 0:(a=this.createEntry({description:t,context:o}),this.undoEntries.push(a),this.redoEntries=[])},n.prototype.undo=function(){var t,e;return(e=this.undoEntries.pop())?(t=this.createEntry(e),this.redoEntries.push(t),this.composition.loadSnapshot(e.snapshot)):void 0},n.prototype.redo=function(){var t,e;return(t=this.redoEntries.pop())?(e=this.createEntry(t),this.undoEntries.push(e),this.composition.loadSnapshot(t.snapshot)):void 0},n.prototype.canUndo=function(){return this.undoEntries.length>0},n.prototype.canRedo=function(){return this.redoEntries.length>0},n.prototype.createEntry=function(t){var e,n,i;return i=null!=t?t:{},n=i.description,e=i.context,{description:null!=n?n.toString():void 0,context:JSON.stringify(e),snapshot:this.composition.getSnapshot()}},i=function(t,e,n){return(null!=t?t.description:void 0)===(null!=e?e.toString():void 0)&&(null!=t?t.context:void 0)===JSON.stringify(n)},n}(e.BasicObject)}.call(this),function(){var t;e.attachmentGalleryFilter=function(e){var n;return n=new t(e),n.perform(),n.getSnapshot()},t=function(){function t(t){this.document=t.document,this.selectedRange=t.selectedRange}var e,n,i;return e=\"attachmentGallery\",n=\"presentation\",i=\"gallery\",t.prototype.perform=function(){return this.removeBlockAttribute(),this.applyBlockAttribute()},t.prototype.getSnapshot=function(){return{document:this.document,selectedRange:this.selectedRange}},t.prototype.removeBlockAttribute=function(){var t,n,i,o,r;for(o=this.findRangesOfBlocks(),r=[],t=0,n=o.length;n>t;t++)i=o[t],r.push(this.document=this.document.removeAttributeAtRange(e,i));return r},t.prototype.applyBlockAttribute=function(){var t,n,i,o,r,s;for(i=0,r=this.findRangesOfPieces(),s=[],t=0,n=r.length;n>t;t++)o=r[t],o[1]-o[0]>1&&(o[0]+=i,o[1]+=i,\"\\n\"!==this.document.getCharacterAtPosition(o[1])&&(this.document=this.document.insertBlockBreakAtRange(o[1]),o[1]n;n++)e=t[n],this.manageAttachment(e)}return t(i,n),i.prototype.getAttachments=function(){var t,e,n,i;n=this.managedAttachments,i=[];for(e in n)t=n[e],i.push(t);return i},i.prototype.manageAttachment=function(t){var n,i;return null!=(n=this.managedAttachments)[i=t.id]?n[i]:n[i]=new e.ManagedAttachment(this,t)},i.prototype.attachmentIsManaged=function(t){return t.id in this.managedAttachments},i.prototype.requestRemovalOfAttachment=function(t){var e;return this.attachmentIsManaged(t)&&null!=(e=this.delegate)&&\"function\"==typeof e.attachmentManagerDidRequestRemovalOfAttachment?e.attachmentManagerDidRequestRemovalOfAttachment(t):void 0},i.prototype.unmanageAttachment=function(t){var e;return e=this.managedAttachments[t.id],delete this.managedAttachments[t.id],e},i}(e.BasicObject)}.call(this),function(){var t,n,i,o,r,s,a,u,c,l,h;t=e.elementContainsNode,n=e.findChildIndexOfNode,r=e.nodeIsBlockStart,s=e.nodeIsBlockStartComment,o=e.nodeIsBlockContainer,a=e.nodeIsCursorTarget,u=e.nodeIsEmptyTextNode,c=e.nodeIsTextNode,i=e.nodeIsAttachmentElement,l=e.tagName,h=e.walkTree,e.LocationMapper=function(){function e(t){this.element=t\n}var p,d,f,g;return e.prototype.findLocationFromContainerAndOffset=function(e,i,o){var s,u,l,p,g,m,v;for(m=(null!=o?o:{strict:!0}).strict,u=0,l=!1,p={index:0,offset:0},(s=this.findAttachmentElementParentForNode(e))&&(e=s.parentNode,i=n(s)),v=h(this.element,{usingFilter:f});v.nextNode();){if(g=v.currentNode,g===e&&c(e)){a(g)||(p.offset+=i);break}if(g.parentNode===e){if(u++===i)break}else if(!t(e,g)&&u>0)break;r(g,{strict:m})?(l&&p.index++,p.offset=0,l=!0):p.offset+=d(g)}return p},e.prototype.findContainerAndOffsetFromLocation=function(t){var e,i,s,u,l;if(0===t.index&&0===t.offset){for(e=this.element,u=0;e.firstChild;)if(e=e.firstChild,o(e)){u=1;break}return[e,u]}if(l=this.findNodeAndOffsetFromLocation(t),i=l[0],s=l[1],i){if(c(i))0===d(i)?(e=i.parentNode.parentNode,u=n(i.parentNode),a(i,{name:\"right\"})&&u++):(e=i,u=t.offset-s);else{if(e=i.parentNode,!r(i.previousSibling)&&!o(e))for(;i===e.lastChild&&(i=e,e=e.parentNode,!o(e)););u=n(i),0!==t.offset&&u++}return[e,u]}},e.prototype.findNodeAndOffsetFromLocation=function(t){var e,n,i,o,r,s,u,l;for(u=0,l=this.getSignificantNodesForIndex(t.index),n=0,i=l.length;i>n;n++){if(e=l[n],o=d(e),t.offset<=u+o)if(c(e)){if(r=e,s=u,t.offset===s&&a(r))break}else r||(r=e,s=u);if(u+=o,u>t.offset)break}return[r,s]},e.prototype.findAttachmentElementParentForNode=function(t){for(;t&&t!==this.element;){if(i(t))return t;t=t.parentNode}},e.prototype.getSignificantNodesForIndex=function(t){var e,n,i,o,r;for(i=[],r=h(this.element,{usingFilter:p}),o=!1;r.nextNode();)if(n=r.currentNode,s(n)){if(\"undefined\"!=typeof e&&null!==e?e++:e=0,e===t)o=!0;else if(o)break}else o&&i.push(n);return i},d=function(t){var e;return t.nodeType===Node.TEXT_NODE?a(t)?0:(e=t.textContent,e.length):\"br\"===l(t)||i(t)?1:0},p=function(t){return g(t)===NodeFilter.FILTER_ACCEPT?f(t):NodeFilter.FILTER_REJECT},g=function(t){return u(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},f=function(t){return i(t.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},e}()}.call(this),function(){var t,n,i=[].slice;t=e.getDOMRange,n=e.setDOMRange,e.PointMapper=function(){function e(){}return e.prototype.createDOMRangeFromPoint=function(e){var i,o,r,s,a,u,c,l;if(c=e.x,l=e.y,document.caretPositionFromPoint)return a=document.caretPositionFromPoint(c,l),r=a.offsetNode,o=a.offset,i=document.createRange(),i.setStart(r,o),i;if(document.caretRangeFromPoint)return document.caretRangeFromPoint(c,l);if(document.body.createTextRange){s=t();try{u=document.body.createTextRange(),u.moveToPoint(c,l),u.select()}catch(h){}return i=t(),n(s),i}},e.prototype.getClientRectsForDOMRange=function(t){var e,n,o;return n=i.call(t.getClientRects()),o=n[0],e=n[n.length-1],[o,e]},e}()}.call(this),function(){var t,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty,r=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};t=e.getDOMRange,e.SelectionChangeObserver=function(e){function o(){this.run=n(this.run,this),this.update=n(this.update,this),this.selectionManagers=[]}var s;return i(o,e),o.prototype.start=function(){return this.started?void 0:(this.started=!0,\"onselectionchange\"in document?document.addEventListener(\"selectionchange\",this.update,!0):this.run())},o.prototype.stop=function(){return this.started?(this.started=!1,document.removeEventListener(\"selectionchange\",this.update,!0)):void 0},o.prototype.registerSelectionManager=function(t){return r.call(this.selectionManagers,t)<0?(this.selectionManagers.push(t),this.start()):void 0},o.prototype.unregisterSelectionManager=function(t){var e;return this.selectionManagers=function(){var n,i,o,r;for(o=this.selectionManagers,r=[],n=0,i=o.length;i>n;n++)e=o[n],e!==t&&r.push(e);return r}.call(this),0===this.selectionManagers.length?this.stop():void 0},o.prototype.notifySelectionManagersOfSelectionChange=function(){var t,e,n,i,o;for(n=this.selectionManagers,i=[],t=0,e=n.length;e>t;t++)o=n[t],i.push(o.selectionDidChange());return i},o.prototype.update=function(){var e;return e=t(),s(e,this.domRange)?void 0:(this.domRange=e,this.notifySelectionManagersOfSelectionChange())},o.prototype.reset=function(){return this.domRange=null,this.update()},o.prototype.run=function(){return this.started?(this.update(),requestAnimationFrame(this.run)):void 0},s=function(t,e){return(null!=t?t.startContainer:void 0)===(null!=e?e.startContainer:void 0)&&(null!=t?t.startOffset:void 0)===(null!=e?e.startOffset:void 0)&&(null!=t?t.endContainer:void 0)===(null!=e?e.endContainer:void 0)&&(null!=t?t.endOffset:void 0)===(null!=e?e.endOffset:void 0)},o}(e.BasicObject),null==e.selectionChangeObserver&&(e.selectionChangeObserver=new e.SelectionChangeObserver)}.call(this),function(){var t,n,i,o,r,s,a,u,c,l,h=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function n(){this.constructor=t}for(var i in e)d.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},d={}.hasOwnProperty;i=e.getDOMSelection,n=e.getDOMRange,l=e.setDOMRange,t=e.elementContainsNode,s=e.nodeIsCursorTarget,r=e.innerElementIsActive,o=e.handleEvent,a=e.normalizeRange,u=e.rangeIsCollapsed,c=e.rangesAreEqual,e.SelectionManager=function(d){function f(t){this.element=t,this.selectionDidChange=h(this.selectionDidChange,this),this.didMouseDown=h(this.didMouseDown,this),this.locationMapper=new e.LocationMapper(this.element),this.pointMapper=new e.PointMapper,this.lockCount=0,o(\"mousedown\",{onElement:this.element,withCallback:this.didMouseDown})}return p(f,d),f.prototype.getLocationRange=function(t){var e,i;return null==t&&(t={}),e=t.strict===!1?this.createLocationRangeFromDOMRange(n(),{strict:!1}):t.ignoreLock?this.currentLocationRange:null!=(i=this.lockedLocationRange)?i:this.currentLocationRange},f.prototype.setLocationRange=function(t){var e;if(!this.lockedLocationRange)return t=a(t),(e=this.createDOMRangeFromLocationRange(t))?(l(e),this.updateCurrentLocationRange(t)):void 0},f.prototype.setLocationRangeFromPointRange=function(t){var e,n;return t=a(t),n=this.getLocationAtPoint(t[0]),e=this.getLocationAtPoint(t[1]),this.setLocationRange([n,e])},f.prototype.getClientRectAtLocationRange=function(t){var e;return(e=this.createDOMRangeFromLocationRange(t))?this.getClientRectsForDOMRange(e)[1]:void 0},f.prototype.locationIsCursorTarget=function(t){var e,n,i;return i=this.findNodeAndOffsetFromLocation(t),e=i[0],n=i[1],s(e)},f.prototype.lock=function(){return 0===this.lockCount++?(this.updateCurrentLocationRange(),this.lockedLocationRange=this.getLocationRange()):void 0},f.prototype.unlock=function(){var t;return 0===--this.lockCount&&(t=this.lockedLocationRange,this.lockedLocationRange=null,null!=t)?this.setLocationRange(t):void 0},f.prototype.clearSelection=function(){var t;return null!=(t=i())?t.removeAllRanges():void 0},f.prototype.selectionIsCollapsed=function(){var t;return(null!=(t=n())?t.collapsed:void 0)===!0},f.prototype.selectionIsExpanded=function(){return!this.selectionIsCollapsed()},f.prototype.createLocationRangeFromDOMRange=function(t,e){var n,i;if(null!=t&&this.domRangeWithinElement(t)&&(i=this.findLocationFromContainerAndOffset(t.startContainer,t.startOffset,e)))return t.collapsed||(n=this.findLocationFromContainerAndOffset(t.endContainer,t.endOffset,e)),a([i,n])},f.proxyMethod(\"locationMapper.findLocationFromContainerAndOffset\"),f.proxyMethod(\"locationMapper.findContainerAndOffsetFromLocation\"),f.proxyMethod(\"locationMapper.findNodeAndOffsetFromLocation\"),f.proxyMethod(\"pointMapper.createDOMRangeFromPoint\"),f.proxyMethod(\"pointMapper.getClientRectsForDOMRange\"),f.prototype.didMouseDown=function(){return this.pauseTemporarily()},f.prototype.pauseTemporarily=function(){var e,n,i,r;return this.paused=!0,n=function(e){return function(){var n,o,s;for(e.paused=!1,clearTimeout(r),o=0,s=i.length;s>o;o++)n=i[o],n.destroy();return t(document,e.element)?e.selectionDidChange():void 0}}(this),r=setTimeout(n,200),i=function(){var t,i,r,s;for(r=[\"mousemove\",\"keydown\"],s=[],t=0,i=r.length;i>t;t++)e=r[t],s.push(o(e,{onElement:document,withCallback:n}));return s}()},f.prototype.selectionDidChange=function(){return this.paused||r(this.element)?void 0:this.updateCurrentLocationRange()},f.prototype.updateCurrentLocationRange=function(t){var e;return(null!=t?t:t=this.createLocationRangeFromDOMRange(n()))&&!c(t,this.currentLocationRange)?(this.currentLocationRange=t,null!=(e=this.delegate)&&\"function\"==typeof e.locationRangeDidChange?e.locationRangeDidChange(this.currentLocationRange.slice(0)):void 0):void 0},f.prototype.createDOMRangeFromLocationRange=function(t){var e,n,i,o;return i=this.findContainerAndOffsetFromLocation(t[0]),n=u(t)?i:null!=(o=this.findContainerAndOffsetFromLocation(t[1]))?o:i,null!=i&&null!=n?(e=document.createRange(),e.setStart.apply(e,i),e.setEnd.apply(e,n),e):void 0},f.prototype.getLocationAtPoint=function(t){var e,n;return(e=this.createDOMRangeFromPoint(t))&&null!=(n=this.createLocationRangeFromDOMRange(e))?n[0]:void 0},f.prototype.domRangeWithinElement=function(e){return e.collapsed?t(this.element,e.startContainer):t(this.element,e.startContainer)&&t(this.element,e.endContainer)},f}(e.BasicObject)}.call(this),function(){var t,n,i,o,r=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty,a=[].slice;i=e.rangeIsCollapsed,o=e.rangesAreEqual,n=e.objectsAreEqual,t=e.getBlockConfig,e.EditorController=function(s){function u(t){var n,i;this.editorElement=t.editorElement,n=t.document,i=t.html,this.selectionManager=new e.SelectionManager(this.editorElement),this.selectionManager.delegate=this,this.composition=new e.Composition,this.composition.delegate=this,this.attachmentManager=new e.AttachmentManager(this.composition.getAttachments()),this.attachmentManager.delegate=this,this.inputController=new(e[\"Level\"+e.config.input.getLevel()+\"InputController\"])(this.editorElement),this.inputController.delegate=this,this.inputController.responder=this.composition,this.compositionController=new e.CompositionController(this.editorElement,this.composition),this.compositionController.delegate=this,this.toolbarController=new e.ToolbarController(this.editorElement.toolbarElement),this.toolbarController.delegate=this,this.editor=new e.Editor(this.composition,this.selectionManager,this.editorElement),null!=n?this.editor.loadDocument(n):this.editor.loadHTML(i)}var c;return r(u,s),u.prototype.registerSelectionManager=function(){return e.selectionChangeObserver.registerSelectionManager(this.selectionManager)},u.prototype.unregisterSelectionManager=function(){return e.selectionChangeObserver.unregisterSelectionManager(this.selectionManager)},u.prototype.render=function(){return this.compositionController.render()},u.prototype.reparse=function(){return this.composition.replaceHTML(this.editorElement.innerHTML)},u.prototype.compositionDidChangeDocument=function(){return this.notifyEditorElement(\"document-change\"),this.handlingInput?void 0:this.render()},u.prototype.compositionDidChangeCurrentAttributes=function(t){return this.currentAttributes=t,this.toolbarController.updateAttributes(this.currentAttributes),this.updateCurrentActions(),this.notifyEditorElement(\"attributes-change\",{attributes:this.currentAttributes})},u.prototype.compositionDidPerformInsertionAtRange=function(t){return this.pasting?this.pastedRange=t:void 0},u.prototype.compositionShouldAcceptFile=function(t){return this.notifyEditorElement(\"file-accept\",{file:t})},u.prototype.compositionDidAddAttachment=function(t){var e;return e=this.attachmentManager.manageAttachment(t),this.notifyEditorElement(\"attachment-add\",{attachment:e})},u.prototype.compositionDidEditAttachment=function(t){var e;return this.compositionController.rerenderViewForObject(t),e=this.attachmentManager.manageAttachment(t),this.notifyEditorElement(\"attachment-edit\",{attachment:e}),this.notifyEditorElement(\"change\")},u.prototype.compositionDidChangeAttachmentPreviewURL=function(t){return this.compositionController.invalidateViewForObject(t),this.notifyEditorElement(\"change\")},u.prototype.compositionDidRemoveAttachment=function(t){var e;return e=this.attachmentManager.unmanageAttachment(t),this.notifyEditorElement(\"attachment-remove\",{attachment:e})},u.prototype.compositionDidStartEditingAttachment=function(t,e){return this.attachmentLocationRange=this.composition.document.getLocationRangeOfAttachment(t),this.compositionController.installAttachmentEditorForAttachment(t,e),this.selectionManager.setLocationRange(this.attachmentLocationRange)},u.prototype.compositionDidStopEditingAttachment=function(){return this.compositionController.uninstallAttachmentEditor(),this.attachmentLocationRange=null},u.prototype.compositionDidRequestChangingSelectionToLocationRange=function(t){return!this.loadingSnapshot||this.isFocused()?(this.requestedLocationRange=t,this.compositionRevisionWhenLocationRangeRequested=this.composition.revision,this.handlingInput?void 0:this.render()):void 0},u.prototype.compositionWillLoadSnapshot=function(){return this.loadingSnapshot=!0},u.prototype.compositionDidLoadSnapshot=function(){return this.compositionController.refreshViewCache(),this.render(),this.loadingSnapshot=!1},u.prototype.getSelectionManager=function(){return this.selectionManager},u.proxyMethod(\"getSelectionManager().setLocationRange\"),u.proxyMethod(\"getSelectionManager().getLocationRange\"),u.prototype.attachmentManagerDidRequestRemovalOfAttachment=function(t){return this.removeAttachment(t)},u.prototype.compositionControllerWillSyncDocumentView=function(){return this.inputController.editorWillSyncDocumentView(),this.selectionManager.lock(),this.selectionManager.clearSelection()},u.prototype.compositionControllerDidSyncDocumentView=function(){return this.inputController.editorDidSyncDocumentView(),this.selectionManager.unlock(),this.updateCurrentActions(),this.notifyEditorElement(\"sync\")},u.prototype.compositionControllerDidRender=function(){return null!=this.requestedLocationRange&&(this.compositionRevisionWhenLocationRangeRequested===this.composition.revision&&this.selectionManager.setLocationRange(this.requestedLocationRange),this.requestedLocationRange=null,this.compositionRevisionWhenLocationRangeRequested=null),this.renderedCompositionRevision!==this.composition.revision&&(this.runEditorFilters(),this.composition.updateCurrentAttributes(),this.notifyEditorElement(\"render\")),this.renderedCompositionRevision=this.composition.revision},u.prototype.compositionControllerDidFocus=function(){return this.isFocusedInvisibly()&&this.setLocationRange({index:0,offset:0}),this.toolbarController.hideDialog(),this.notifyEditorElement(\"focus\")},u.prototype.compositionControllerDidBlur=function(){return this.notifyEditorElement(\"blur\")},u.prototype.compositionControllerDidSelectAttachment=function(t,e){return this.toolbarController.hideDialog(),this.composition.editAttachment(t,e)},u.prototype.compositionControllerDidRequestDeselectingAttachment=function(t){var e,n;return e=null!=(n=this.attachmentLocationRange)?n:this.composition.document.getLocationRangeOfAttachment(t),this.selectionManager.setLocationRange(e[1])},u.prototype.compositionControllerWillUpdateAttachment=function(t){return this.editor.recordUndoEntry(\"Edit Attachment\",{context:t.id,consolidatable:!0})},u.prototype.compositionControllerDidRequestRemovalOfAttachment=function(t){return this.removeAttachment(t)},u.prototype.inputControllerWillHandleInput=function(){return this.handlingInput=!0,this.requestedRender=!1},u.prototype.inputControllerDidRequestRender=function(){return this.requestedRender=!0},u.prototype.inputControllerDidHandleInput=function(){return this.handlingInput=!1,this.requestedRender?(this.requestedRender=!1,this.render()):void 0},u.prototype.inputControllerDidAllowUnhandledInput=function(){return this.notifyEditorElement(\"change\")},u.prototype.inputControllerDidRequestReparse=function(){return this.reparse()},u.prototype.inputControllerWillPerformTyping=function(){return this.recordTypingUndoEntry()},u.prototype.inputControllerWillPerformFormatting=function(t){return this.recordFormattingUndoEntry(t)},u.prototype.inputControllerWillCutText=function(){return this.editor.recordUndoEntry(\"Cut\")},u.prototype.inputControllerWillPaste=function(t){return this.editor.recordUndoEntry(\"Paste\"),this.pasting=!0,this.notifyEditorElement(\"before-paste\",{paste:t})},u.prototype.inputControllerDidPaste=function(t){return t.range=this.pastedRange,this.pastedRange=null,this.pasting=null,this.notifyEditorElement(\"paste\",{paste:t})},u.prototype.inputControllerWillMoveText=function(){return this.editor.recordUndoEntry(\"Move\")},u.prototype.inputControllerWillAttachFiles=function(){return this.editor.recordUndoEntry(\"Drop Files\")},u.prototype.inputControllerWillPerformUndo=function(){return this.editor.undo()},u.prototype.inputControllerWillPerformRedo=function(){return this.editor.redo()},u.prototype.inputControllerDidReceiveKeyboardCommand=function(t){return this.toolbarController.applyKeyboardCommand(t)},u.prototype.inputControllerDidStartDrag=function(){return this.locationRangeBeforeDrag=this.selectionManager.getLocationRange()},u.prototype.inputControllerDidReceiveDragOverPoint=function(t){return this.selectionManager.setLocationRangeFromPointRange(t)},u.prototype.inputControllerDidCancelDrag=function(){return this.selectionManager.setLocationRange(this.locationRangeBeforeDrag),this.locationRangeBeforeDrag=null},u.prototype.locationRangeDidChange=function(t){return this.composition.updateCurrentAttributes(),this.updateCurrentActions(),this.attachmentLocationRange&&!o(this.attachmentLocationRange,t)&&this.composition.stopEditingAttachment(),this.notifyEditorElement(\"selection-change\")},u.prototype.toolbarDidClickButton=function(){return this.getLocationRange()?void 0:this.setLocationRange({index:0,offset:0})},u.prototype.toolbarDidInvokeAction=function(t){return this.invokeAction(t)},u.prototype.toolbarDidToggleAttribute=function(t){return this.recordFormattingUndoEntry(t),this.composition.toggleCurrentAttribute(t),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},u.prototype.toolbarDidUpdateAttribute=function(t,e){return this.recordFormattingUndoEntry(t),this.composition.setCurrentAttribute(t,e),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},u.prototype.toolbarDidRemoveAttribute=function(t){return this.recordFormattingUndoEntry(t),this.composition.removeCurrentAttribute(t),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},u.prototype.toolbarWillShowDialog=function(){return this.composition.expandSelectionForEditing(),this.freezeSelection()},u.prototype.toolbarDidShowDialog=function(t){return this.notifyEditorElement(\"toolbar-dialog-show\",{dialogName:t})},u.prototype.toolbarDidHideDialog=function(t){return this.thawSelection(),this.editorElement.focus(),this.notifyEditorElement(\"toolbar-dialog-hide\",{dialogName:t})},u.prototype.freezeSelection=function(){return this.selectionFrozen?void 0:(this.selectionManager.lock(),this.composition.freezeSelection(),this.selectionFrozen=!0,this.render())},u.prototype.thawSelection=function(){return this.selectionFrozen?(this.composition.thawSelection(),this.selectionManager.unlock(),this.selectionFrozen=!1,this.render()):void 0},u.prototype.actions={undo:{test:function(){return this.editor.canUndo()},perform:function(){return this.editor.undo()}},redo:{test:function(){return this.editor.canRedo()},perform:function(){return this.editor.redo()}},link:{test:function(){return this.editor.canActivateAttribute(\"href\")}},increaseNestingLevel:{test:function(){return this.editor.canIncreaseNestingLevel()},perform:function(){return this.editor.increaseNestingLevel()&&this.render()}},decreaseNestingLevel:{test:function(){return this.editor.canDecreaseNestingLevel()},perform:function(){return this.editor.decreaseNestingLevel()&&this.render()}},attachFiles:{test:function(){return!0},perform:function(){return e.config.input.pickFiles(this.editor.insertFiles)}}},u.prototype.canInvokeAction=function(t){var e,n;return this.actionIsExternal(t)?!0:!!(null!=(e=this.actions[t])&&null!=(n=e.test)?n.call(this):void 0)},u.prototype.invokeAction=function(t){var e,n;return this.actionIsExternal(t)?this.notifyEditorElement(\"action-invoke\",{actionName:t}):null!=(e=this.actions[t])&&null!=(n=e.perform)?n.call(this):void 0},u.prototype.actionIsExternal=function(t){return/^x-./.test(t)},u.prototype.getCurrentActions=function(){var t,e;e={};for(t in this.actions)e[t]=this.canInvokeAction(t);return e},u.prototype.updateCurrentActions=function(){var t;return t=this.getCurrentActions(),n(t,this.currentActions)?void 0:(this.currentActions=t,this.toolbarController.updateActions(this.currentActions),this.notifyEditorElement(\"actions-change\",{actions:this.currentActions}))},u.prototype.runEditorFilters=function(){var t,e,n,i,o,r,s,a;for(a=this.composition.getSnapshot(),o=this.editor.filters,n=0,i=o.length;i>n;n++)e=o[n],t=a.document,s=a.selectedRange,a=null!=(r=e.call(this.editor,a))?r:{},null==a.document&&(a.document=t),null==a.selectedRange&&(a.selectedRange=s);return c(a,this.composition.getSnapshot())?void 0:this.composition.loadSnapshot(a)},c=function(t,e){return o(t.selectedRange,e.selectedRange)&&t.document.isEqualTo(e.document)},u.prototype.updateInputElement=function(){var t,n;return t=this.compositionController.getSerializableElement(),n=e.serializeToContentType(t,\"text/html\"),this.editorElement.setInputElementValue(n)},u.prototype.notifyEditorElement=function(t,e){switch(t){case\"document-change\":this.documentChangedSinceLastRender=!0;break;case\"render\":this.documentChangedSinceLastRender&&(this.documentChangedSinceLastRender=!1,this.notifyEditorElement(\"change\"));break;case\"change\":case\"attachment-add\":case\"attachment-edit\":case\"attachment-remove\":this.updateInputElement()}return this.editorElement.notify(t,e)},u.prototype.removeAttachment=function(t){return this.editor.recordUndoEntry(\"Delete Attachment\"),this.composition.removeAttachment(t),this.render()},u.prototype.recordFormattingUndoEntry=function(e){var n,o;return n=t(e),o=this.selectionManager.getLocationRange(),n||!i(o)?this.editor.recordUndoEntry(\"Formatting\",{context:this.getUndoContext(),consolidatable:!0}):void 0},u.prototype.recordTypingUndoEntry=function(){return this.editor.recordUndoEntry(\"Typing\",{context:this.getUndoContext(this.currentAttributes),consolidatable:!0})},u.prototype.getUndoContext=function(){var t;return t=1<=arguments.length?a.call(arguments,0):[],[this.getLocationContext(),this.getTimeContext()].concat(a.call(t))},u.prototype.getLocationContext=function(){var t;return t=this.selectionManager.getLocationRange(),i(t)?t[0].index:t},u.prototype.getTimeContext=function(){return e.config.undoInterval>0?Math.floor((new Date).getTime()/e.config.undoInterval):0},u.prototype.isFocused=function(){var t;return this.editorElement===(null!=(t=this.editorElement.ownerDocument)?t.activeElement:void 0)},u.prototype.isFocusedInvisibly=function(){return this.isFocused()&&!this.getLocationRange()},u}(e.Controller)}.call(this),function(){var t,n,i,o,r,s,a,u=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};n=e.browser,s=e.makeElement,a=e.triggerEvent,o=e.handleEvent,r=e.handleEventOnce,i=e.findClosestElementFromNode,t=e.AttachmentView.attachmentSelector,e.registerElement(\"trix-editor\",function(){var c,l,h,p,d,f,g,m,v;return g=0,l=function(t){return!document.querySelector(\":focus\")&&t.hasAttribute(\"autofocus\")&&document.querySelector(\"[autofocus]\")===t?t.focus():void 0},m=function(t){return t.hasAttribute(\"contenteditable\")?void 0:(t.setAttribute(\"contenteditable\",\"\"),r(\"focus\",{onElement:t,withCallback:function(){return h(t)}}))},h=function(t){return d(t),v(t)},d=function(t){return(\"function\"==typeof document.queryCommandSupported?document.queryCommandSupported(\"enableObjectResizing\"):void 0)?(document.execCommand(\"enableObjectResizing\",!1,!1),o(\"mscontrolselect\",{onElement:t,preventDefault:!0})):void 0},v=function(){var t;return(\"function\"==typeof document.queryCommandSupported?document.queryCommandSupported(\"DefaultParagraphSeparator\"):void 0)&&(t=e.config.blockAttributes[\"default\"].tagName,\"div\"===t||\"p\"===t)?document.execCommand(\"DefaultParagraphSeparator\",!1,t):void 0},c=function(t){return t.hasAttribute(\"role\")?void 0:t.setAttribute(\"role\",\"textbox\")},f=function(t){var e;if(!t.hasAttribute(\"aria-label\")&&!t.hasAttribute(\"aria-labelledby\"))return(e=function(){var e,n,i;return i=function(){var n,i,o,r;for(o=t.labels,r=[],n=0,i=o.length;i>n;n++)e=o[n],e.contains(t)||r.push(e.textContent);return r}(),(n=i.join(\" \"))?t.setAttribute(\"aria-label\",n):t.removeAttribute(\"aria-label\")})(),o(\"focus\",{onElement:t,withCallback:e})},p=function(){return n.forcesObjectResizing?{display:\"inline\",width:\"auto\"}:{display:\"inline-block\",width:\"1px\"}}(),{defaultCSS:\"%t {\\n display: block;\\n}\\n\\n%t:empty:not(:focus)::before {\\n content: attr(placeholder);\\n color: graytext;\\n cursor: text;\\n pointer-events: none;\\n}\\n\\n%t a[contenteditable=false] {\\n cursor: text;\\n}\\n\\n%t img {\\n max-width: 100%;\\n height: auto;\\n}\\n\\n%t \"+t+\" figcaption textarea {\\n resize: none;\\n}\\n\\n%t \"+t+\" figcaption textarea.trix-autoresize-clone {\\n position: absolute;\\n left: -9999px;\\n max-height: 0px;\\n}\\n\\n%t \"+t+\" figcaption[data-trix-placeholder]:empty::before {\\n content: attr(data-trix-placeholder);\\n color: graytext;\\n}\\n\\n%t [data-trix-cursor-target] {\\n display: \"+p.display+\" !important;\\n width: \"+p.width+\" !important;\\n padding: 0 !important;\\n margin: 0 !important;\\n border: none !important;\\n}\\n\\n%t [data-trix-cursor-target=left] {\\n vertical-align: top !important;\\n margin-left: -1px !important;\\n}\\n\\n%t [data-trix-cursor-target=right] {\\n vertical-align: bottom !important;\\n margin-right: -1px !important;\\n}\",trixId:{get:function(){return this.hasAttribute(\"trix-id\")?this.getAttribute(\"trix-id\"):(this.setAttribute(\"trix-id\",++g),this.trixId)}},labels:{get:function(){var t,e,n;return e=[],this.id&&this.ownerDocument&&e.push.apply(e,this.ownerDocument.querySelectorAll(\"label[for='\"+this.id+\"']\")),(t=i(this,{matchingSelector:\"label\"}))&&((n=t.control)===this||null===n)&&e.push(t),e}},toolbarElement:{get:function(){var t,e,n;return this.hasAttribute(\"toolbar\")?null!=(e=this.ownerDocument)?e.getElementById(this.getAttribute(\"toolbar\")):void 0:this.parentNode?(n=\"trix-toolbar-\"+this.trixId,this.setAttribute(\"toolbar\",n),t=s(\"trix-toolbar\",{id:n}),this.parentNode.insertBefore(t,this),t):void 0}},inputElement:{get:function(){var t,e,n;return this.hasAttribute(\"input\")?null!=(n=this.ownerDocument)?n.getElementById(this.getAttribute(\"input\")):void 0:this.parentNode?(e=\"trix-input-\"+this.trixId,this.setAttribute(\"input\",e),t=s(\"input\",{type:\"hidden\",id:e}),this.parentNode.insertBefore(t,this.nextElementSibling),t):void 0}},editor:{get:function(){var t;return null!=(t=this.editorController)?t.editor:void 0}},name:{get:function(){var t;return null!=(t=this.inputElement)?t.name:void 0}},value:{get:function(){var t;return null!=(t=this.inputElement)?t.value:void 0},set:function(t){var e;return this.defaultValue=t,null!=(e=this.editor)?e.loadHTML(this.defaultValue):void 0}},notify:function(t,e){return this.editorController?a(\"trix-\"+t,{onElement:this,attributes:e}):void 0},setInputElementValue:function(t){var e;return null!=(e=this.inputElement)?e.value=t:void 0},initialize:function(){return this.hasAttribute(\"data-trix-internal\")?void 0:(m(this),c(this),f(this))},connect:function(){return this.hasAttribute(\"data-trix-internal\")?void 0:(this.editorController||(a(\"trix-before-initialize\",{onElement:this}),this.editorController=new e.EditorController({editorElement:this,html:this.defaultValue=this.value}),requestAnimationFrame(function(t){return function(){return a(\"trix-initialize\",{onElement:t})}}(this))),this.editorController.registerSelectionManager(),this.registerResetListener(),this.registerClickListener(),l(this))},disconnect:function(){var t;return null!=(t=this.editorController)&&t.unregisterSelectionManager(),this.unregisterResetListener(),this.unregisterClickListener()},registerResetListener:function(){return this.resetListener=this.resetBubbled.bind(this),window.addEventListener(\"reset\",this.resetListener,!1)},unregisterResetListener:function(){return window.removeEventListener(\"reset\",this.resetListener,!1)},registerClickListener:function(){return this.clickListener=this.clickBubbled.bind(this),window.addEventListener(\"click\",this.clickListener,!1)},unregisterClickListener:function(){return window.removeEventListener(\"click\",this.clickListener,!1)},resetBubbled:function(t){var e;if(!t.defaultPrevented&&t.target===(null!=(e=this.inputElement)?e.form:void 0))return this.reset()},clickBubbled:function(t){var e;if(!(t.defaultPrevented||this.contains(t.target)||!(e=i(t.target,{matchingSelector:\"label\"}))||u.call(this.labels,e)<0))return this.focus()},reset:function(){return this.value=this.defaultValue}}}())}.call(this),function(){}.call(this)}).call(this),\"object\"==typeof module&&module.exports?module.exports=e:\"function\"==typeof define&&define.amd&&define(e)}.call(this);", "/*\nTurbo 7.2.4\nCopyright \u00A9 2022 37signals LLC\n */\n(function () {\n if (window.Reflect === undefined ||\n window.customElements === undefined ||\n window.customElements.polyfillWrapFlushCallback) {\n return;\n }\n const BuiltInHTMLElement = HTMLElement;\n const wrapperForTheName = {\n HTMLElement: function HTMLElement() {\n return Reflect.construct(BuiltInHTMLElement, [], this.constructor);\n },\n };\n window.HTMLElement = wrapperForTheName[\"HTMLElement\"];\n HTMLElement.prototype = BuiltInHTMLElement.prototype;\n HTMLElement.prototype.constructor = HTMLElement;\n Object.setPrototypeOf(HTMLElement, BuiltInHTMLElement);\n})();\n\n/**\n * The MIT License (MIT)\n * \n * Copyright (c) 2019 Javan Makhmali\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n(function(prototype) {\n if (typeof prototype.requestSubmit == \"function\") return\n\n prototype.requestSubmit = function(submitter) {\n if (submitter) {\n validateSubmitter(submitter, this);\n submitter.click();\n } else {\n submitter = document.createElement(\"input\");\n submitter.type = \"submit\";\n submitter.hidden = true;\n this.appendChild(submitter);\n submitter.click();\n this.removeChild(submitter);\n }\n };\n\n function validateSubmitter(submitter, form) {\n submitter instanceof HTMLElement || raise(TypeError, \"parameter 1 is not of type 'HTMLElement'\");\n submitter.type == \"submit\" || raise(TypeError, \"The specified element is not a submit button\");\n submitter.form == form || raise(DOMException, \"The specified element is not owned by this form element\", \"NotFoundError\");\n }\n\n function raise(errorConstructor, message, name) {\n throw new errorConstructor(\"Failed to execute 'requestSubmit' on 'HTMLFormElement': \" + message + \".\", name)\n }\n})(HTMLFormElement.prototype);\n\nconst submittersByForm = new WeakMap();\nfunction findSubmitterFromClickTarget(target) {\n const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null;\n const candidate = element ? element.closest(\"input, button\") : null;\n return (candidate === null || candidate === void 0 ? void 0 : candidate.type) == \"submit\" ? candidate : null;\n}\nfunction clickCaptured(event) {\n const submitter = findSubmitterFromClickTarget(event.target);\n if (submitter && submitter.form) {\n submittersByForm.set(submitter.form, submitter);\n }\n}\n(function () {\n if (\"submitter\" in Event.prototype)\n return;\n let prototype;\n if (\"SubmitEvent\" in window && /Apple Computer/.test(navigator.vendor)) {\n prototype = window.SubmitEvent.prototype;\n }\n else if (\"SubmitEvent\" in window) {\n return;\n }\n else {\n prototype = window.Event.prototype;\n }\n addEventListener(\"click\", clickCaptured, true);\n Object.defineProperty(prototype, \"submitter\", {\n get() {\n if (this.type == \"submit\" && this.target instanceof HTMLFormElement) {\n return submittersByForm.get(this.target);\n }\n },\n });\n})();\n\nvar FrameLoadingStyle;\n(function (FrameLoadingStyle) {\n FrameLoadingStyle[\"eager\"] = \"eager\";\n FrameLoadingStyle[\"lazy\"] = \"lazy\";\n})(FrameLoadingStyle || (FrameLoadingStyle = {}));\nclass FrameElement extends HTMLElement {\n constructor() {\n super();\n this.loaded = Promise.resolve();\n this.delegate = new FrameElement.delegateConstructor(this);\n }\n static get observedAttributes() {\n return [\"disabled\", \"complete\", \"loading\", \"src\"];\n }\n connectedCallback() {\n this.delegate.connect();\n }\n disconnectedCallback() {\n this.delegate.disconnect();\n }\n reload() {\n return this.delegate.sourceURLReloaded();\n }\n attributeChangedCallback(name) {\n if (name == \"loading\") {\n this.delegate.loadingStyleChanged();\n }\n else if (name == \"complete\") {\n this.delegate.completeChanged();\n }\n else if (name == \"src\") {\n this.delegate.sourceURLChanged();\n }\n else {\n this.delegate.disabledChanged();\n }\n }\n get src() {\n return this.getAttribute(\"src\");\n }\n set src(value) {\n if (value) {\n this.setAttribute(\"src\", value);\n }\n else {\n this.removeAttribute(\"src\");\n }\n }\n get loading() {\n return frameLoadingStyleFromString(this.getAttribute(\"loading\") || \"\");\n }\n set loading(value) {\n if (value) {\n this.setAttribute(\"loading\", value);\n }\n else {\n this.removeAttribute(\"loading\");\n }\n }\n get disabled() {\n return this.hasAttribute(\"disabled\");\n }\n set disabled(value) {\n if (value) {\n this.setAttribute(\"disabled\", \"\");\n }\n else {\n this.removeAttribute(\"disabled\");\n }\n }\n get autoscroll() {\n return this.hasAttribute(\"autoscroll\");\n }\n set autoscroll(value) {\n if (value) {\n this.setAttribute(\"autoscroll\", \"\");\n }\n else {\n this.removeAttribute(\"autoscroll\");\n }\n }\n get complete() {\n return !this.delegate.isLoading;\n }\n get isActive() {\n return this.ownerDocument === document && !this.isPreview;\n }\n get isPreview() {\n var _a, _b;\n return (_b = (_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.documentElement) === null || _b === void 0 ? void 0 : _b.hasAttribute(\"data-turbo-preview\");\n }\n}\nfunction frameLoadingStyleFromString(style) {\n switch (style.toLowerCase()) {\n case \"lazy\":\n return FrameLoadingStyle.lazy;\n default:\n return FrameLoadingStyle.eager;\n }\n}\n\nfunction expandURL(locatable) {\n return new URL(locatable.toString(), document.baseURI);\n}\nfunction getAnchor(url) {\n let anchorMatch;\n if (url.hash) {\n return url.hash.slice(1);\n }\n else if ((anchorMatch = url.href.match(/#(.*)$/))) {\n return anchorMatch[1];\n }\n}\nfunction getAction(form, submitter) {\n const action = (submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute(\"formaction\")) || form.getAttribute(\"action\") || form.action;\n return expandURL(action);\n}\nfunction getExtension(url) {\n return (getLastPathComponent(url).match(/\\.[^.]*$/) || [])[0] || \"\";\n}\nfunction isHTML(url) {\n return !!getExtension(url).match(/^(?:|\\.(?:htm|html|xhtml|php))$/);\n}\nfunction isPrefixedBy(baseURL, url) {\n const prefix = getPrefix(url);\n return baseURL.href === expandURL(prefix).href || baseURL.href.startsWith(prefix);\n}\nfunction locationIsVisitable(location, rootLocation) {\n return isPrefixedBy(location, rootLocation) && isHTML(location);\n}\nfunction getRequestURL(url) {\n const anchor = getAnchor(url);\n return anchor != null ? url.href.slice(0, -(anchor.length + 1)) : url.href;\n}\nfunction toCacheKey(url) {\n return getRequestURL(url);\n}\nfunction urlsAreEqual(left, right) {\n return expandURL(left).href == expandURL(right).href;\n}\nfunction getPathComponents(url) {\n return url.pathname.split(\"/\").slice(1);\n}\nfunction getLastPathComponent(url) {\n return getPathComponents(url).slice(-1)[0];\n}\nfunction getPrefix(url) {\n return addTrailingSlash(url.origin + url.pathname);\n}\nfunction addTrailingSlash(value) {\n return value.endsWith(\"/\") ? value : value + \"/\";\n}\n\nclass FetchResponse {\n constructor(response) {\n this.response = response;\n }\n get succeeded() {\n return this.response.ok;\n }\n get failed() {\n return !this.succeeded;\n }\n get clientError() {\n return this.statusCode >= 400 && this.statusCode <= 499;\n }\n get serverError() {\n return this.statusCode >= 500 && this.statusCode <= 599;\n }\n get redirected() {\n return this.response.redirected;\n }\n get location() {\n return expandURL(this.response.url);\n }\n get isHTML() {\n return this.contentType && this.contentType.match(/^(?:text\\/([^\\s;,]+\\b)?html|application\\/xhtml\\+xml)\\b/);\n }\n get statusCode() {\n return this.response.status;\n }\n get contentType() {\n return this.header(\"Content-Type\");\n }\n get responseText() {\n return this.response.clone().text();\n }\n get responseHTML() {\n if (this.isHTML) {\n return this.response.clone().text();\n }\n else {\n return Promise.resolve(undefined);\n }\n }\n header(name) {\n return this.response.headers.get(name);\n }\n}\n\nfunction isAction(action) {\n return action == \"advance\" || action == \"replace\" || action == \"restore\";\n}\n\nfunction activateScriptElement(element) {\n if (element.getAttribute(\"data-turbo-eval\") == \"false\") {\n return element;\n }\n else {\n const createdScriptElement = document.createElement(\"script\");\n const cspNonce = getMetaContent(\"csp-nonce\");\n if (cspNonce) {\n createdScriptElement.nonce = cspNonce;\n }\n createdScriptElement.textContent = element.textContent;\n createdScriptElement.async = false;\n copyElementAttributes(createdScriptElement, element);\n return createdScriptElement;\n }\n}\nfunction copyElementAttributes(destinationElement, sourceElement) {\n for (const { name, value } of sourceElement.attributes) {\n destinationElement.setAttribute(name, value);\n }\n}\nfunction createDocumentFragment(html) {\n const template = document.createElement(\"template\");\n template.innerHTML = html;\n return template.content;\n}\nfunction dispatch(eventName, { target, cancelable, detail } = {}) {\n const event = new CustomEvent(eventName, {\n cancelable,\n bubbles: true,\n detail,\n });\n if (target && target.isConnected) {\n target.dispatchEvent(event);\n }\n else {\n document.documentElement.dispatchEvent(event);\n }\n return event;\n}\nfunction nextAnimationFrame() {\n return new Promise((resolve) => requestAnimationFrame(() => resolve()));\n}\nfunction nextEventLoopTick() {\n return new Promise((resolve) => setTimeout(() => resolve(), 0));\n}\nfunction nextMicrotask() {\n return Promise.resolve();\n}\nfunction parseHTMLDocument(html = \"\") {\n return new DOMParser().parseFromString(html, \"text/html\");\n}\nfunction unindent(strings, ...values) {\n const lines = interpolate(strings, values).replace(/^\\n/, \"\").split(\"\\n\");\n const match = lines[0].match(/^\\s+/);\n const indent = match ? match[0].length : 0;\n return lines.map((line) => line.slice(indent)).join(\"\\n\");\n}\nfunction interpolate(strings, values) {\n return strings.reduce((result, string, i) => {\n const value = values[i] == undefined ? \"\" : values[i];\n return result + string + value;\n }, \"\");\n}\nfunction uuid() {\n return Array.from({ length: 36 })\n .map((_, i) => {\n if (i == 8 || i == 13 || i == 18 || i == 23) {\n return \"-\";\n }\n else if (i == 14) {\n return \"4\";\n }\n else if (i == 19) {\n return (Math.floor(Math.random() * 4) + 8).toString(16);\n }\n else {\n return Math.floor(Math.random() * 15).toString(16);\n }\n })\n .join(\"\");\n}\nfunction getAttribute(attributeName, ...elements) {\n for (const value of elements.map((element) => element === null || element === void 0 ? void 0 : element.getAttribute(attributeName))) {\n if (typeof value == \"string\")\n return value;\n }\n return null;\n}\nfunction hasAttribute(attributeName, ...elements) {\n return elements.some((element) => element && element.hasAttribute(attributeName));\n}\nfunction markAsBusy(...elements) {\n for (const element of elements) {\n if (element.localName == \"turbo-frame\") {\n element.setAttribute(\"busy\", \"\");\n }\n element.setAttribute(\"aria-busy\", \"true\");\n }\n}\nfunction clearBusyState(...elements) {\n for (const element of elements) {\n if (element.localName == \"turbo-frame\") {\n element.removeAttribute(\"busy\");\n }\n element.removeAttribute(\"aria-busy\");\n }\n}\nfunction waitForLoad(element, timeoutInMilliseconds = 2000) {\n return new Promise((resolve) => {\n const onComplete = () => {\n element.removeEventListener(\"error\", onComplete);\n element.removeEventListener(\"load\", onComplete);\n resolve();\n };\n element.addEventListener(\"load\", onComplete, { once: true });\n element.addEventListener(\"error\", onComplete, { once: true });\n setTimeout(resolve, timeoutInMilliseconds);\n });\n}\nfunction getHistoryMethodForAction(action) {\n switch (action) {\n case \"replace\":\n return history.replaceState;\n case \"advance\":\n case \"restore\":\n return history.pushState;\n }\n}\nfunction getVisitAction(...elements) {\n const action = getAttribute(\"data-turbo-action\", ...elements);\n return isAction(action) ? action : null;\n}\nfunction getMetaElement(name) {\n return document.querySelector(`meta[name=\"${name}\"]`);\n}\nfunction getMetaContent(name) {\n const element = getMetaElement(name);\n return element && element.content;\n}\nfunction setMetaContent(name, content) {\n let element = getMetaElement(name);\n if (!element) {\n element = document.createElement(\"meta\");\n element.setAttribute(\"name\", name);\n document.head.appendChild(element);\n }\n element.setAttribute(\"content\", content);\n return element;\n}\n\nvar FetchMethod;\n(function (FetchMethod) {\n FetchMethod[FetchMethod[\"get\"] = 0] = \"get\";\n FetchMethod[FetchMethod[\"post\"] = 1] = \"post\";\n FetchMethod[FetchMethod[\"put\"] = 2] = \"put\";\n FetchMethod[FetchMethod[\"patch\"] = 3] = \"patch\";\n FetchMethod[FetchMethod[\"delete\"] = 4] = \"delete\";\n})(FetchMethod || (FetchMethod = {}));\nfunction fetchMethodFromString(method) {\n switch (method.toLowerCase()) {\n case \"get\":\n return FetchMethod.get;\n case \"post\":\n return FetchMethod.post;\n case \"put\":\n return FetchMethod.put;\n case \"patch\":\n return FetchMethod.patch;\n case \"delete\":\n return FetchMethod.delete;\n }\n}\nclass FetchRequest {\n constructor(delegate, method, location, body = new URLSearchParams(), target = null) {\n this.abortController = new AbortController();\n this.resolveRequestPromise = (_value) => { };\n this.delegate = delegate;\n this.method = method;\n this.headers = this.defaultHeaders;\n this.body = body;\n this.url = location;\n this.target = target;\n }\n get location() {\n return this.url;\n }\n get params() {\n return this.url.searchParams;\n }\n get entries() {\n return this.body ? Array.from(this.body.entries()) : [];\n }\n cancel() {\n this.abortController.abort();\n }\n async perform() {\n var _a, _b;\n const { fetchOptions } = this;\n (_b = (_a = this.delegate).prepareHeadersForRequest) === null || _b === void 0 ? void 0 : _b.call(_a, this.headers, this);\n await this.allowRequestToBeIntercepted(fetchOptions);\n try {\n this.delegate.requestStarted(this);\n const response = await fetch(this.url.href, fetchOptions);\n return await this.receive(response);\n }\n catch (error) {\n if (error.name !== \"AbortError\") {\n if (this.willDelegateErrorHandling(error)) {\n this.delegate.requestErrored(this, error);\n }\n throw error;\n }\n }\n finally {\n this.delegate.requestFinished(this);\n }\n }\n async receive(response) {\n const fetchResponse = new FetchResponse(response);\n const event = dispatch(\"turbo:before-fetch-response\", {\n cancelable: true,\n detail: { fetchResponse },\n target: this.target,\n });\n if (event.defaultPrevented) {\n this.delegate.requestPreventedHandlingResponse(this, fetchResponse);\n }\n else if (fetchResponse.succeeded) {\n this.delegate.requestSucceededWithResponse(this, fetchResponse);\n }\n else {\n this.delegate.requestFailedWithResponse(this, fetchResponse);\n }\n return fetchResponse;\n }\n get fetchOptions() {\n var _a;\n return {\n method: FetchMethod[this.method].toUpperCase(),\n credentials: \"same-origin\",\n headers: this.headers,\n redirect: \"follow\",\n body: this.isIdempotent ? null : this.body,\n signal: this.abortSignal,\n referrer: (_a = this.delegate.referrer) === null || _a === void 0 ? void 0 : _a.href,\n };\n }\n get defaultHeaders() {\n return {\n Accept: \"text/html, application/xhtml+xml\",\n };\n }\n get isIdempotent() {\n return this.method == FetchMethod.get;\n }\n get abortSignal() {\n return this.abortController.signal;\n }\n acceptResponseType(mimeType) {\n this.headers[\"Accept\"] = [mimeType, this.headers[\"Accept\"]].join(\", \");\n }\n async allowRequestToBeIntercepted(fetchOptions) {\n const requestInterception = new Promise((resolve) => (this.resolveRequestPromise = resolve));\n const event = dispatch(\"turbo:before-fetch-request\", {\n cancelable: true,\n detail: {\n fetchOptions,\n url: this.url,\n resume: this.resolveRequestPromise,\n },\n target: this.target,\n });\n if (event.defaultPrevented)\n await requestInterception;\n }\n willDelegateErrorHandling(error) {\n const event = dispatch(\"turbo:fetch-request-error\", {\n target: this.target,\n cancelable: true,\n detail: { request: this, error: error },\n });\n return !event.defaultPrevented;\n }\n}\n\nclass AppearanceObserver {\n constructor(delegate, element) {\n this.started = false;\n this.intersect = (entries) => {\n const lastEntry = entries.slice(-1)[0];\n if (lastEntry === null || lastEntry === void 0 ? void 0 : lastEntry.isIntersecting) {\n this.delegate.elementAppearedInViewport(this.element);\n }\n };\n this.delegate = delegate;\n this.element = element;\n this.intersectionObserver = new IntersectionObserver(this.intersect);\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.intersectionObserver.observe(this.element);\n }\n }\n stop() {\n if (this.started) {\n this.started = false;\n this.intersectionObserver.unobserve(this.element);\n }\n }\n}\n\nclass StreamMessage {\n constructor(fragment) {\n this.fragment = importStreamElements(fragment);\n }\n static wrap(message) {\n if (typeof message == \"string\") {\n return new this(createDocumentFragment(message));\n }\n else {\n return message;\n }\n }\n}\nStreamMessage.contentType = \"text/vnd.turbo-stream.html\";\nfunction importStreamElements(fragment) {\n for (const element of fragment.querySelectorAll(\"turbo-stream\")) {\n const streamElement = document.importNode(element, true);\n for (const inertScriptElement of streamElement.templateElement.content.querySelectorAll(\"script\")) {\n inertScriptElement.replaceWith(activateScriptElement(inertScriptElement));\n }\n element.replaceWith(streamElement);\n }\n return fragment;\n}\n\nvar FormSubmissionState;\n(function (FormSubmissionState) {\n FormSubmissionState[FormSubmissionState[\"initialized\"] = 0] = \"initialized\";\n FormSubmissionState[FormSubmissionState[\"requesting\"] = 1] = \"requesting\";\n FormSubmissionState[FormSubmissionState[\"waiting\"] = 2] = \"waiting\";\n FormSubmissionState[FormSubmissionState[\"receiving\"] = 3] = \"receiving\";\n FormSubmissionState[FormSubmissionState[\"stopping\"] = 4] = \"stopping\";\n FormSubmissionState[FormSubmissionState[\"stopped\"] = 5] = \"stopped\";\n})(FormSubmissionState || (FormSubmissionState = {}));\nvar FormEnctype;\n(function (FormEnctype) {\n FormEnctype[\"urlEncoded\"] = \"application/x-www-form-urlencoded\";\n FormEnctype[\"multipart\"] = \"multipart/form-data\";\n FormEnctype[\"plain\"] = \"text/plain\";\n})(FormEnctype || (FormEnctype = {}));\nfunction formEnctypeFromString(encoding) {\n switch (encoding.toLowerCase()) {\n case FormEnctype.multipart:\n return FormEnctype.multipart;\n case FormEnctype.plain:\n return FormEnctype.plain;\n default:\n return FormEnctype.urlEncoded;\n }\n}\nclass FormSubmission {\n constructor(delegate, formElement, submitter, mustRedirect = false) {\n this.state = FormSubmissionState.initialized;\n this.delegate = delegate;\n this.formElement = formElement;\n this.submitter = submitter;\n this.formData = buildFormData(formElement, submitter);\n this.location = expandURL(this.action);\n if (this.method == FetchMethod.get) {\n mergeFormDataEntries(this.location, [...this.body.entries()]);\n }\n this.fetchRequest = new FetchRequest(this, this.method, this.location, this.body, this.formElement);\n this.mustRedirect = mustRedirect;\n }\n static confirmMethod(message, _element, _submitter) {\n return Promise.resolve(confirm(message));\n }\n get method() {\n var _a;\n const method = ((_a = this.submitter) === null || _a === void 0 ? void 0 : _a.getAttribute(\"formmethod\")) || this.formElement.getAttribute(\"method\") || \"\";\n return fetchMethodFromString(method.toLowerCase()) || FetchMethod.get;\n }\n get action() {\n var _a;\n const formElementAction = typeof this.formElement.action === \"string\" ? this.formElement.action : null;\n if ((_a = this.submitter) === null || _a === void 0 ? void 0 : _a.hasAttribute(\"formaction\")) {\n return this.submitter.getAttribute(\"formaction\") || \"\";\n }\n else {\n return this.formElement.getAttribute(\"action\") || formElementAction || \"\";\n }\n }\n get body() {\n if (this.enctype == FormEnctype.urlEncoded || this.method == FetchMethod.get) {\n return new URLSearchParams(this.stringFormData);\n }\n else {\n return this.formData;\n }\n }\n get enctype() {\n var _a;\n return formEnctypeFromString(((_a = this.submitter) === null || _a === void 0 ? void 0 : _a.getAttribute(\"formenctype\")) || this.formElement.enctype);\n }\n get isIdempotent() {\n return this.fetchRequest.isIdempotent;\n }\n get stringFormData() {\n return [...this.formData].reduce((entries, [name, value]) => {\n return entries.concat(typeof value == \"string\" ? [[name, value]] : []);\n }, []);\n }\n async start() {\n const { initialized, requesting } = FormSubmissionState;\n const confirmationMessage = getAttribute(\"data-turbo-confirm\", this.submitter, this.formElement);\n if (typeof confirmationMessage === \"string\") {\n const answer = await FormSubmission.confirmMethod(confirmationMessage, this.formElement, this.submitter);\n if (!answer) {\n return;\n }\n }\n if (this.state == initialized) {\n this.state = requesting;\n return this.fetchRequest.perform();\n }\n }\n stop() {\n const { stopping, stopped } = FormSubmissionState;\n if (this.state != stopping && this.state != stopped) {\n this.state = stopping;\n this.fetchRequest.cancel();\n return true;\n }\n }\n prepareHeadersForRequest(headers, request) {\n if (!request.isIdempotent) {\n const token = getCookieValue(getMetaContent(\"csrf-param\")) || getMetaContent(\"csrf-token\");\n if (token) {\n headers[\"X-CSRF-Token\"] = token;\n }\n }\n if (this.requestAcceptsTurboStreamResponse(request)) {\n request.acceptResponseType(StreamMessage.contentType);\n }\n }\n requestStarted(_request) {\n var _a;\n this.state = FormSubmissionState.waiting;\n (_a = this.submitter) === null || _a === void 0 ? void 0 : _a.setAttribute(\"disabled\", \"\");\n dispatch(\"turbo:submit-start\", {\n target: this.formElement,\n detail: { formSubmission: this },\n });\n this.delegate.formSubmissionStarted(this);\n }\n requestPreventedHandlingResponse(request, response) {\n this.result = { success: response.succeeded, fetchResponse: response };\n }\n requestSucceededWithResponse(request, response) {\n if (response.clientError || response.serverError) {\n this.delegate.formSubmissionFailedWithResponse(this, response);\n }\n else if (this.requestMustRedirect(request) && responseSucceededWithoutRedirect(response)) {\n const error = new Error(\"Form responses must redirect to another location\");\n this.delegate.formSubmissionErrored(this, error);\n }\n else {\n this.state = FormSubmissionState.receiving;\n this.result = { success: true, fetchResponse: response };\n this.delegate.formSubmissionSucceededWithResponse(this, response);\n }\n }\n requestFailedWithResponse(request, response) {\n this.result = { success: false, fetchResponse: response };\n this.delegate.formSubmissionFailedWithResponse(this, response);\n }\n requestErrored(request, error) {\n this.result = { success: false, error };\n this.delegate.formSubmissionErrored(this, error);\n }\n requestFinished(_request) {\n var _a;\n this.state = FormSubmissionState.stopped;\n (_a = this.submitter) === null || _a === void 0 ? void 0 : _a.removeAttribute(\"disabled\");\n dispatch(\"turbo:submit-end\", {\n target: this.formElement,\n detail: Object.assign({ formSubmission: this }, this.result),\n });\n this.delegate.formSubmissionFinished(this);\n }\n requestMustRedirect(request) {\n return !request.isIdempotent && this.mustRedirect;\n }\n requestAcceptsTurboStreamResponse(request) {\n return !request.isIdempotent || hasAttribute(\"data-turbo-stream\", this.submitter, this.formElement);\n }\n}\nfunction buildFormData(formElement, submitter) {\n const formData = new FormData(formElement);\n const name = submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute(\"name\");\n const value = submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute(\"value\");\n if (name) {\n formData.append(name, value || \"\");\n }\n return formData;\n}\nfunction getCookieValue(cookieName) {\n if (cookieName != null) {\n const cookies = document.cookie ? document.cookie.split(\"; \") : [];\n const cookie = cookies.find((cookie) => cookie.startsWith(cookieName));\n if (cookie) {\n const value = cookie.split(\"=\").slice(1).join(\"=\");\n return value ? decodeURIComponent(value) : undefined;\n }\n }\n}\nfunction responseSucceededWithoutRedirect(response) {\n return response.statusCode == 200 && !response.redirected;\n}\nfunction mergeFormDataEntries(url, entries) {\n const searchParams = new URLSearchParams();\n for (const [name, value] of entries) {\n if (value instanceof File)\n continue;\n searchParams.append(name, value);\n }\n url.search = searchParams.toString();\n return url;\n}\n\nclass Snapshot {\n constructor(element) {\n this.element = element;\n }\n get activeElement() {\n return this.element.ownerDocument.activeElement;\n }\n get children() {\n return [...this.element.children];\n }\n hasAnchor(anchor) {\n return this.getElementForAnchor(anchor) != null;\n }\n getElementForAnchor(anchor) {\n return anchor ? this.element.querySelector(`[id='${anchor}'], a[name='${anchor}']`) : null;\n }\n get isConnected() {\n return this.element.isConnected;\n }\n get firstAutofocusableElement() {\n const inertDisabledOrHidden = \"[inert], :disabled, [hidden], details:not([open]), dialog:not([open])\";\n for (const element of this.element.querySelectorAll(\"[autofocus]\")) {\n if (element.closest(inertDisabledOrHidden) == null)\n return element;\n else\n continue;\n }\n return null;\n }\n get permanentElements() {\n return queryPermanentElementsAll(this.element);\n }\n getPermanentElementById(id) {\n return getPermanentElementById(this.element, id);\n }\n getPermanentElementMapForSnapshot(snapshot) {\n const permanentElementMap = {};\n for (const currentPermanentElement of this.permanentElements) {\n const { id } = currentPermanentElement;\n const newPermanentElement = snapshot.getPermanentElementById(id);\n if (newPermanentElement) {\n permanentElementMap[id] = [currentPermanentElement, newPermanentElement];\n }\n }\n return permanentElementMap;\n }\n}\nfunction getPermanentElementById(node, id) {\n return node.querySelector(`#${id}[data-turbo-permanent]`);\n}\nfunction queryPermanentElementsAll(node) {\n return node.querySelectorAll(\"[id][data-turbo-permanent]\");\n}\n\nclass FormSubmitObserver {\n constructor(delegate, eventTarget) {\n this.started = false;\n this.submitCaptured = () => {\n this.eventTarget.removeEventListener(\"submit\", this.submitBubbled, false);\n this.eventTarget.addEventListener(\"submit\", this.submitBubbled, false);\n };\n this.submitBubbled = ((event) => {\n if (!event.defaultPrevented) {\n const form = event.target instanceof HTMLFormElement ? event.target : undefined;\n const submitter = event.submitter || undefined;\n if (form &&\n submissionDoesNotDismissDialog(form, submitter) &&\n submissionDoesNotTargetIFrame(form, submitter) &&\n this.delegate.willSubmitForm(form, submitter)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n this.delegate.formSubmitted(form, submitter);\n }\n }\n });\n this.delegate = delegate;\n this.eventTarget = eventTarget;\n }\n start() {\n if (!this.started) {\n this.eventTarget.addEventListener(\"submit\", this.submitCaptured, true);\n this.started = true;\n }\n }\n stop() {\n if (this.started) {\n this.eventTarget.removeEventListener(\"submit\", this.submitCaptured, true);\n this.started = false;\n }\n }\n}\nfunction submissionDoesNotDismissDialog(form, submitter) {\n const method = (submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute(\"formmethod\")) || form.getAttribute(\"method\");\n return method != \"dialog\";\n}\nfunction submissionDoesNotTargetIFrame(form, submitter) {\n const target = (submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute(\"formtarget\")) || form.target;\n for (const element of document.getElementsByName(target)) {\n if (element instanceof HTMLIFrameElement)\n return false;\n }\n return true;\n}\n\nclass View {\n constructor(delegate, element) {\n this.resolveRenderPromise = (_value) => { };\n this.resolveInterceptionPromise = (_value) => { };\n this.delegate = delegate;\n this.element = element;\n }\n scrollToAnchor(anchor) {\n const element = this.snapshot.getElementForAnchor(anchor);\n if (element) {\n this.scrollToElement(element);\n this.focusElement(element);\n }\n else {\n this.scrollToPosition({ x: 0, y: 0 });\n }\n }\n scrollToAnchorFromLocation(location) {\n this.scrollToAnchor(getAnchor(location));\n }\n scrollToElement(element) {\n element.scrollIntoView();\n }\n focusElement(element) {\n if (element instanceof HTMLElement) {\n if (element.hasAttribute(\"tabindex\")) {\n element.focus();\n }\n else {\n element.setAttribute(\"tabindex\", \"-1\");\n element.focus();\n element.removeAttribute(\"tabindex\");\n }\n }\n }\n scrollToPosition({ x, y }) {\n this.scrollRoot.scrollTo(x, y);\n }\n scrollToTop() {\n this.scrollToPosition({ x: 0, y: 0 });\n }\n get scrollRoot() {\n return window;\n }\n async render(renderer) {\n const { isPreview, shouldRender, newSnapshot: snapshot } = renderer;\n if (shouldRender) {\n try {\n this.renderPromise = new Promise((resolve) => (this.resolveRenderPromise = resolve));\n this.renderer = renderer;\n await this.prepareToRenderSnapshot(renderer);\n const renderInterception = new Promise((resolve) => (this.resolveInterceptionPromise = resolve));\n const options = { resume: this.resolveInterceptionPromise, render: this.renderer.renderElement };\n const immediateRender = this.delegate.allowsImmediateRender(snapshot, options);\n if (!immediateRender)\n await renderInterception;\n await this.renderSnapshot(renderer);\n this.delegate.viewRenderedSnapshot(snapshot, isPreview);\n this.delegate.preloadOnLoadLinksForView(this.element);\n this.finishRenderingSnapshot(renderer);\n }\n finally {\n delete this.renderer;\n this.resolveRenderPromise(undefined);\n delete this.renderPromise;\n }\n }\n else {\n this.invalidate(renderer.reloadReason);\n }\n }\n invalidate(reason) {\n this.delegate.viewInvalidated(reason);\n }\n async prepareToRenderSnapshot(renderer) {\n this.markAsPreview(renderer.isPreview);\n await renderer.prepareToRender();\n }\n markAsPreview(isPreview) {\n if (isPreview) {\n this.element.setAttribute(\"data-turbo-preview\", \"\");\n }\n else {\n this.element.removeAttribute(\"data-turbo-preview\");\n }\n }\n async renderSnapshot(renderer) {\n await renderer.render();\n }\n finishRenderingSnapshot(renderer) {\n renderer.finishRendering();\n }\n}\n\nclass FrameView extends View {\n invalidate() {\n this.element.innerHTML = \"\";\n }\n get snapshot() {\n return new Snapshot(this.element);\n }\n}\n\nclass LinkInterceptor {\n constructor(delegate, element) {\n this.clickBubbled = (event) => {\n if (this.respondsToEventTarget(event.target)) {\n this.clickEvent = event;\n }\n else {\n delete this.clickEvent;\n }\n };\n this.linkClicked = ((event) => {\n if (this.clickEvent && this.respondsToEventTarget(event.target) && event.target instanceof Element) {\n if (this.delegate.shouldInterceptLinkClick(event.target, event.detail.url, event.detail.originalEvent)) {\n this.clickEvent.preventDefault();\n event.preventDefault();\n this.delegate.linkClickIntercepted(event.target, event.detail.url, event.detail.originalEvent);\n }\n }\n delete this.clickEvent;\n });\n this.willVisit = ((_event) => {\n delete this.clickEvent;\n });\n this.delegate = delegate;\n this.element = element;\n }\n start() {\n this.element.addEventListener(\"click\", this.clickBubbled);\n document.addEventListener(\"turbo:click\", this.linkClicked);\n document.addEventListener(\"turbo:before-visit\", this.willVisit);\n }\n stop() {\n this.element.removeEventListener(\"click\", this.clickBubbled);\n document.removeEventListener(\"turbo:click\", this.linkClicked);\n document.removeEventListener(\"turbo:before-visit\", this.willVisit);\n }\n respondsToEventTarget(target) {\n const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null;\n return element && element.closest(\"turbo-frame, html\") == this.element;\n }\n}\n\nclass LinkClickObserver {\n constructor(delegate, eventTarget) {\n this.started = false;\n this.clickCaptured = () => {\n this.eventTarget.removeEventListener(\"click\", this.clickBubbled, false);\n this.eventTarget.addEventListener(\"click\", this.clickBubbled, false);\n };\n this.clickBubbled = (event) => {\n if (event instanceof MouseEvent && this.clickEventIsSignificant(event)) {\n const target = (event.composedPath && event.composedPath()[0]) || event.target;\n const link = this.findLinkFromClickTarget(target);\n if (link && doesNotTargetIFrame(link)) {\n const location = this.getLocationForLink(link);\n if (this.delegate.willFollowLinkToLocation(link, location, event)) {\n event.preventDefault();\n this.delegate.followedLinkToLocation(link, location);\n }\n }\n }\n };\n this.delegate = delegate;\n this.eventTarget = eventTarget;\n }\n start() {\n if (!this.started) {\n this.eventTarget.addEventListener(\"click\", this.clickCaptured, true);\n this.started = true;\n }\n }\n stop() {\n if (this.started) {\n this.eventTarget.removeEventListener(\"click\", this.clickCaptured, true);\n this.started = false;\n }\n }\n clickEventIsSignificant(event) {\n return !((event.target && event.target.isContentEditable) ||\n event.defaultPrevented ||\n event.which > 1 ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey);\n }\n findLinkFromClickTarget(target) {\n if (target instanceof Element) {\n return target.closest(\"a[href]:not([target^=_]):not([download])\");\n }\n }\n getLocationForLink(link) {\n return expandURL(link.getAttribute(\"href\") || \"\");\n }\n}\nfunction doesNotTargetIFrame(anchor) {\n for (const element of document.getElementsByName(anchor.target)) {\n if (element instanceof HTMLIFrameElement)\n return false;\n }\n return true;\n}\n\nclass FormLinkClickObserver {\n constructor(delegate, element) {\n this.delegate = delegate;\n this.linkInterceptor = new LinkClickObserver(this, element);\n }\n start() {\n this.linkInterceptor.start();\n }\n stop() {\n this.linkInterceptor.stop();\n }\n willFollowLinkToLocation(link, location, originalEvent) {\n return (this.delegate.willSubmitFormLinkToLocation(link, location, originalEvent) &&\n link.hasAttribute(\"data-turbo-method\"));\n }\n followedLinkToLocation(link, location) {\n const action = location.href;\n const form = document.createElement(\"form\");\n form.setAttribute(\"data-turbo\", \"true\");\n form.setAttribute(\"action\", action);\n form.setAttribute(\"hidden\", \"\");\n const method = link.getAttribute(\"data-turbo-method\");\n if (method)\n form.setAttribute(\"method\", method);\n const turboFrame = link.getAttribute(\"data-turbo-frame\");\n if (turboFrame)\n form.setAttribute(\"data-turbo-frame\", turboFrame);\n const turboAction = link.getAttribute(\"data-turbo-action\");\n if (turboAction)\n form.setAttribute(\"data-turbo-action\", turboAction);\n const turboConfirm = link.getAttribute(\"data-turbo-confirm\");\n if (turboConfirm)\n form.setAttribute(\"data-turbo-confirm\", turboConfirm);\n const turboStream = link.hasAttribute(\"data-turbo-stream\");\n if (turboStream)\n form.setAttribute(\"data-turbo-stream\", \"\");\n this.delegate.submittedFormLinkToLocation(link, location, form);\n document.body.appendChild(form);\n form.addEventListener(\"turbo:submit-end\", () => form.remove(), { once: true });\n requestAnimationFrame(() => form.requestSubmit());\n }\n}\n\nclass Bardo {\n constructor(delegate, permanentElementMap) {\n this.delegate = delegate;\n this.permanentElementMap = permanentElementMap;\n }\n static preservingPermanentElements(delegate, permanentElementMap, callback) {\n const bardo = new this(delegate, permanentElementMap);\n bardo.enter();\n callback();\n bardo.leave();\n }\n enter() {\n for (const id in this.permanentElementMap) {\n const [currentPermanentElement, newPermanentElement] = this.permanentElementMap[id];\n this.delegate.enteringBardo(currentPermanentElement, newPermanentElement);\n this.replaceNewPermanentElementWithPlaceholder(newPermanentElement);\n }\n }\n leave() {\n for (const id in this.permanentElementMap) {\n const [currentPermanentElement] = this.permanentElementMap[id];\n this.replaceCurrentPermanentElementWithClone(currentPermanentElement);\n this.replacePlaceholderWithPermanentElement(currentPermanentElement);\n this.delegate.leavingBardo(currentPermanentElement);\n }\n }\n replaceNewPermanentElementWithPlaceholder(permanentElement) {\n const placeholder = createPlaceholderForPermanentElement(permanentElement);\n permanentElement.replaceWith(placeholder);\n }\n replaceCurrentPermanentElementWithClone(permanentElement) {\n const clone = permanentElement.cloneNode(true);\n permanentElement.replaceWith(clone);\n }\n replacePlaceholderWithPermanentElement(permanentElement) {\n const placeholder = this.getPlaceholderById(permanentElement.id);\n placeholder === null || placeholder === void 0 ? void 0 : placeholder.replaceWith(permanentElement);\n }\n getPlaceholderById(id) {\n return this.placeholders.find((element) => element.content == id);\n }\n get placeholders() {\n return [...document.querySelectorAll(\"meta[name=turbo-permanent-placeholder][content]\")];\n }\n}\nfunction createPlaceholderForPermanentElement(permanentElement) {\n const element = document.createElement(\"meta\");\n element.setAttribute(\"name\", \"turbo-permanent-placeholder\");\n element.setAttribute(\"content\", permanentElement.id);\n return element;\n}\n\nclass Renderer {\n constructor(currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) {\n this.activeElement = null;\n this.currentSnapshot = currentSnapshot;\n this.newSnapshot = newSnapshot;\n this.isPreview = isPreview;\n this.willRender = willRender;\n this.renderElement = renderElement;\n this.promise = new Promise((resolve, reject) => (this.resolvingFunctions = { resolve, reject }));\n }\n get shouldRender() {\n return true;\n }\n get reloadReason() {\n return;\n }\n prepareToRender() {\n return;\n }\n finishRendering() {\n if (this.resolvingFunctions) {\n this.resolvingFunctions.resolve();\n delete this.resolvingFunctions;\n }\n }\n preservingPermanentElements(callback) {\n Bardo.preservingPermanentElements(this, this.permanentElementMap, callback);\n }\n focusFirstAutofocusableElement() {\n const element = this.connectedSnapshot.firstAutofocusableElement;\n if (elementIsFocusable(element)) {\n element.focus();\n }\n }\n enteringBardo(currentPermanentElement) {\n if (this.activeElement)\n return;\n if (currentPermanentElement.contains(this.currentSnapshot.activeElement)) {\n this.activeElement = this.currentSnapshot.activeElement;\n }\n }\n leavingBardo(currentPermanentElement) {\n if (currentPermanentElement.contains(this.activeElement) && this.activeElement instanceof HTMLElement) {\n this.activeElement.focus();\n this.activeElement = null;\n }\n }\n get connectedSnapshot() {\n return this.newSnapshot.isConnected ? this.newSnapshot : this.currentSnapshot;\n }\n get currentElement() {\n return this.currentSnapshot.element;\n }\n get newElement() {\n return this.newSnapshot.element;\n }\n get permanentElementMap() {\n return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot);\n }\n}\nfunction elementIsFocusable(element) {\n return element && typeof element.focus == \"function\";\n}\n\nclass FrameRenderer extends Renderer {\n constructor(delegate, currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) {\n super(currentSnapshot, newSnapshot, renderElement, isPreview, willRender);\n this.delegate = delegate;\n }\n static renderElement(currentElement, newElement) {\n var _a;\n const destinationRange = document.createRange();\n destinationRange.selectNodeContents(currentElement);\n destinationRange.deleteContents();\n const frameElement = newElement;\n const sourceRange = (_a = frameElement.ownerDocument) === null || _a === void 0 ? void 0 : _a.createRange();\n if (sourceRange) {\n sourceRange.selectNodeContents(frameElement);\n currentElement.appendChild(sourceRange.extractContents());\n }\n }\n get shouldRender() {\n return true;\n }\n async render() {\n await nextAnimationFrame();\n this.preservingPermanentElements(() => {\n this.loadFrameElement();\n });\n this.scrollFrameIntoView();\n await nextAnimationFrame();\n this.focusFirstAutofocusableElement();\n await nextAnimationFrame();\n this.activateScriptElements();\n }\n loadFrameElement() {\n this.delegate.willRenderFrame(this.currentElement, this.newElement);\n this.renderElement(this.currentElement, this.newElement);\n }\n scrollFrameIntoView() {\n if (this.currentElement.autoscroll || this.newElement.autoscroll) {\n const element = this.currentElement.firstElementChild;\n const block = readScrollLogicalPosition(this.currentElement.getAttribute(\"data-autoscroll-block\"), \"end\");\n const behavior = readScrollBehavior(this.currentElement.getAttribute(\"data-autoscroll-behavior\"), \"auto\");\n if (element) {\n element.scrollIntoView({ block, behavior });\n return true;\n }\n }\n return false;\n }\n activateScriptElements() {\n for (const inertScriptElement of this.newScriptElements) {\n const activatedScriptElement = activateScriptElement(inertScriptElement);\n inertScriptElement.replaceWith(activatedScriptElement);\n }\n }\n get newScriptElements() {\n return this.currentElement.querySelectorAll(\"script\");\n }\n}\nfunction readScrollLogicalPosition(value, defaultValue) {\n if (value == \"end\" || value == \"start\" || value == \"center\" || value == \"nearest\") {\n return value;\n }\n else {\n return defaultValue;\n }\n}\nfunction readScrollBehavior(value, defaultValue) {\n if (value == \"auto\" || value == \"smooth\") {\n return value;\n }\n else {\n return defaultValue;\n }\n}\n\nclass ProgressBar {\n constructor() {\n this.hiding = false;\n this.value = 0;\n this.visible = false;\n this.trickle = () => {\n this.setValue(this.value + Math.random() / 100);\n };\n this.stylesheetElement = this.createStylesheetElement();\n this.progressElement = this.createProgressElement();\n this.installStylesheetElement();\n this.setValue(0);\n }\n static get defaultCSS() {\n return unindent `\n .turbo-progress-bar {\n position: fixed;\n display: block;\n top: 0;\n left: 0;\n height: 3px;\n background: #0076ff;\n z-index: 2147483647;\n transition:\n width ${ProgressBar.animationDuration}ms ease-out,\n opacity ${ProgressBar.animationDuration / 2}ms ${ProgressBar.animationDuration / 2}ms ease-in;\n transform: translate3d(0, 0, 0);\n }\n `;\n }\n show() {\n if (!this.visible) {\n this.visible = true;\n this.installProgressElement();\n this.startTrickling();\n }\n }\n hide() {\n if (this.visible && !this.hiding) {\n this.hiding = true;\n this.fadeProgressElement(() => {\n this.uninstallProgressElement();\n this.stopTrickling();\n this.visible = false;\n this.hiding = false;\n });\n }\n }\n setValue(value) {\n this.value = value;\n this.refresh();\n }\n installStylesheetElement() {\n document.head.insertBefore(this.stylesheetElement, document.head.firstChild);\n }\n installProgressElement() {\n this.progressElement.style.width = \"0\";\n this.progressElement.style.opacity = \"1\";\n document.documentElement.insertBefore(this.progressElement, document.body);\n this.refresh();\n }\n fadeProgressElement(callback) {\n this.progressElement.style.opacity = \"0\";\n setTimeout(callback, ProgressBar.animationDuration * 1.5);\n }\n uninstallProgressElement() {\n if (this.progressElement.parentNode) {\n document.documentElement.removeChild(this.progressElement);\n }\n }\n startTrickling() {\n if (!this.trickleInterval) {\n this.trickleInterval = window.setInterval(this.trickle, ProgressBar.animationDuration);\n }\n }\n stopTrickling() {\n window.clearInterval(this.trickleInterval);\n delete this.trickleInterval;\n }\n refresh() {\n requestAnimationFrame(() => {\n this.progressElement.style.width = `${10 + this.value * 90}%`;\n });\n }\n createStylesheetElement() {\n const element = document.createElement(\"style\");\n element.type = \"text/css\";\n element.textContent = ProgressBar.defaultCSS;\n if (this.cspNonce) {\n element.nonce = this.cspNonce;\n }\n return element;\n }\n createProgressElement() {\n const element = document.createElement(\"div\");\n element.className = \"turbo-progress-bar\";\n return element;\n }\n get cspNonce() {\n return getMetaContent(\"csp-nonce\");\n }\n}\nProgressBar.animationDuration = 300;\n\nclass HeadSnapshot extends Snapshot {\n constructor() {\n super(...arguments);\n this.detailsByOuterHTML = this.children\n .filter((element) => !elementIsNoscript(element))\n .map((element) => elementWithoutNonce(element))\n .reduce((result, element) => {\n const { outerHTML } = element;\n const details = outerHTML in result\n ? result[outerHTML]\n : {\n type: elementType(element),\n tracked: elementIsTracked(element),\n elements: [],\n };\n return Object.assign(Object.assign({}, result), { [outerHTML]: Object.assign(Object.assign({}, details), { elements: [...details.elements, element] }) });\n }, {});\n }\n get trackedElementSignature() {\n return Object.keys(this.detailsByOuterHTML)\n .filter((outerHTML) => this.detailsByOuterHTML[outerHTML].tracked)\n .join(\"\");\n }\n getScriptElementsNotInSnapshot(snapshot) {\n return this.getElementsMatchingTypeNotInSnapshot(\"script\", snapshot);\n }\n getStylesheetElementsNotInSnapshot(snapshot) {\n return this.getElementsMatchingTypeNotInSnapshot(\"stylesheet\", snapshot);\n }\n getElementsMatchingTypeNotInSnapshot(matchedType, snapshot) {\n return Object.keys(this.detailsByOuterHTML)\n .filter((outerHTML) => !(outerHTML in snapshot.detailsByOuterHTML))\n .map((outerHTML) => this.detailsByOuterHTML[outerHTML])\n .filter(({ type }) => type == matchedType)\n .map(({ elements: [element] }) => element);\n }\n get provisionalElements() {\n return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => {\n const { type, tracked, elements } = this.detailsByOuterHTML[outerHTML];\n if (type == null && !tracked) {\n return [...result, ...elements];\n }\n else if (elements.length > 1) {\n return [...result, ...elements.slice(1)];\n }\n else {\n return result;\n }\n }, []);\n }\n getMetaValue(name) {\n const element = this.findMetaElementByName(name);\n return element ? element.getAttribute(\"content\") : null;\n }\n findMetaElementByName(name) {\n return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => {\n const { elements: [element], } = this.detailsByOuterHTML[outerHTML];\n return elementIsMetaElementWithName(element, name) ? element : result;\n }, undefined);\n }\n}\nfunction elementType(element) {\n if (elementIsScript(element)) {\n return \"script\";\n }\n else if (elementIsStylesheet(element)) {\n return \"stylesheet\";\n }\n}\nfunction elementIsTracked(element) {\n return element.getAttribute(\"data-turbo-track\") == \"reload\";\n}\nfunction elementIsScript(element) {\n const tagName = element.localName;\n return tagName == \"script\";\n}\nfunction elementIsNoscript(element) {\n const tagName = element.localName;\n return tagName == \"noscript\";\n}\nfunction elementIsStylesheet(element) {\n const tagName = element.localName;\n return tagName == \"style\" || (tagName == \"link\" && element.getAttribute(\"rel\") == \"stylesheet\");\n}\nfunction elementIsMetaElementWithName(element, name) {\n const tagName = element.localName;\n return tagName == \"meta\" && element.getAttribute(\"name\") == name;\n}\nfunction elementWithoutNonce(element) {\n if (element.hasAttribute(\"nonce\")) {\n element.setAttribute(\"nonce\", \"\");\n }\n return element;\n}\n\nclass PageSnapshot extends Snapshot {\n constructor(element, headSnapshot) {\n super(element);\n this.headSnapshot = headSnapshot;\n }\n static fromHTMLString(html = \"\") {\n return this.fromDocument(parseHTMLDocument(html));\n }\n static fromElement(element) {\n return this.fromDocument(element.ownerDocument);\n }\n static fromDocument({ head, body }) {\n return new this(body, new HeadSnapshot(head));\n }\n clone() {\n const clonedElement = this.element.cloneNode(true);\n const selectElements = this.element.querySelectorAll(\"select\");\n const clonedSelectElements = clonedElement.querySelectorAll(\"select\");\n for (const [index, source] of selectElements.entries()) {\n const clone = clonedSelectElements[index];\n for (const option of clone.selectedOptions)\n option.selected = false;\n for (const option of source.selectedOptions)\n clone.options[option.index].selected = true;\n }\n for (const clonedPasswordInput of clonedElement.querySelectorAll('input[type=\"password\"]')) {\n clonedPasswordInput.value = \"\";\n }\n return new PageSnapshot(clonedElement, this.headSnapshot);\n }\n get headElement() {\n return this.headSnapshot.element;\n }\n get rootLocation() {\n var _a;\n const root = (_a = this.getSetting(\"root\")) !== null && _a !== void 0 ? _a : \"/\";\n return expandURL(root);\n }\n get cacheControlValue() {\n return this.getSetting(\"cache-control\");\n }\n get isPreviewable() {\n return this.cacheControlValue != \"no-preview\";\n }\n get isCacheable() {\n return this.cacheControlValue != \"no-cache\";\n }\n get isVisitable() {\n return this.getSetting(\"visit-control\") != \"reload\";\n }\n getSetting(name) {\n return this.headSnapshot.getMetaValue(`turbo-${name}`);\n }\n}\n\nvar TimingMetric;\n(function (TimingMetric) {\n TimingMetric[\"visitStart\"] = \"visitStart\";\n TimingMetric[\"requestStart\"] = \"requestStart\";\n TimingMetric[\"requestEnd\"] = \"requestEnd\";\n TimingMetric[\"visitEnd\"] = \"visitEnd\";\n})(TimingMetric || (TimingMetric = {}));\nvar VisitState;\n(function (VisitState) {\n VisitState[\"initialized\"] = \"initialized\";\n VisitState[\"started\"] = \"started\";\n VisitState[\"canceled\"] = \"canceled\";\n VisitState[\"failed\"] = \"failed\";\n VisitState[\"completed\"] = \"completed\";\n})(VisitState || (VisitState = {}));\nconst defaultOptions = {\n action: \"advance\",\n historyChanged: false,\n visitCachedSnapshot: () => { },\n willRender: true,\n updateHistory: true,\n shouldCacheSnapshot: true,\n acceptsStreamResponse: false,\n};\nvar SystemStatusCode;\n(function (SystemStatusCode) {\n SystemStatusCode[SystemStatusCode[\"networkFailure\"] = 0] = \"networkFailure\";\n SystemStatusCode[SystemStatusCode[\"timeoutFailure\"] = -1] = \"timeoutFailure\";\n SystemStatusCode[SystemStatusCode[\"contentTypeMismatch\"] = -2] = \"contentTypeMismatch\";\n})(SystemStatusCode || (SystemStatusCode = {}));\nclass Visit {\n constructor(delegate, location, restorationIdentifier, options = {}) {\n this.identifier = uuid();\n this.timingMetrics = {};\n this.followedRedirect = false;\n this.historyChanged = false;\n this.scrolled = false;\n this.shouldCacheSnapshot = true;\n this.acceptsStreamResponse = false;\n this.snapshotCached = false;\n this.state = VisitState.initialized;\n this.delegate = delegate;\n this.location = location;\n this.restorationIdentifier = restorationIdentifier || uuid();\n const { action, historyChanged, referrer, snapshot, snapshotHTML, response, visitCachedSnapshot, willRender, updateHistory, shouldCacheSnapshot, acceptsStreamResponse, } = Object.assign(Object.assign({}, defaultOptions), options);\n this.action = action;\n this.historyChanged = historyChanged;\n this.referrer = referrer;\n this.snapshot = snapshot;\n this.snapshotHTML = snapshotHTML;\n this.response = response;\n this.isSamePage = this.delegate.locationWithActionIsSamePage(this.location, this.action);\n this.visitCachedSnapshot = visitCachedSnapshot;\n this.willRender = willRender;\n this.updateHistory = updateHistory;\n this.scrolled = !willRender;\n this.shouldCacheSnapshot = shouldCacheSnapshot;\n this.acceptsStreamResponse = acceptsStreamResponse;\n }\n get adapter() {\n return this.delegate.adapter;\n }\n get view() {\n return this.delegate.view;\n }\n get history() {\n return this.delegate.history;\n }\n get restorationData() {\n return this.history.getRestorationDataForIdentifier(this.restorationIdentifier);\n }\n get silent() {\n return this.isSamePage;\n }\n start() {\n if (this.state == VisitState.initialized) {\n this.recordTimingMetric(TimingMetric.visitStart);\n this.state = VisitState.started;\n this.adapter.visitStarted(this);\n this.delegate.visitStarted(this);\n }\n }\n cancel() {\n if (this.state == VisitState.started) {\n if (this.request) {\n this.request.cancel();\n }\n this.cancelRender();\n this.state = VisitState.canceled;\n }\n }\n complete() {\n if (this.state == VisitState.started) {\n this.recordTimingMetric(TimingMetric.visitEnd);\n this.state = VisitState.completed;\n this.followRedirect();\n if (!this.followedRedirect) {\n this.adapter.visitCompleted(this);\n this.delegate.visitCompleted(this);\n }\n }\n }\n fail() {\n if (this.state == VisitState.started) {\n this.state = VisitState.failed;\n this.adapter.visitFailed(this);\n }\n }\n changeHistory() {\n var _a;\n if (!this.historyChanged && this.updateHistory) {\n const actionForHistory = this.location.href === ((_a = this.referrer) === null || _a === void 0 ? void 0 : _a.href) ? \"replace\" : this.action;\n const method = getHistoryMethodForAction(actionForHistory);\n this.history.update(method, this.location, this.restorationIdentifier);\n this.historyChanged = true;\n }\n }\n issueRequest() {\n if (this.hasPreloadedResponse()) {\n this.simulateRequest();\n }\n else if (this.shouldIssueRequest() && !this.request) {\n this.request = new FetchRequest(this, FetchMethod.get, this.location);\n this.request.perform();\n }\n }\n simulateRequest() {\n if (this.response) {\n this.startRequest();\n this.recordResponse();\n this.finishRequest();\n }\n }\n startRequest() {\n this.recordTimingMetric(TimingMetric.requestStart);\n this.adapter.visitRequestStarted(this);\n }\n recordResponse(response = this.response) {\n this.response = response;\n if (response) {\n const { statusCode } = response;\n if (isSuccessful(statusCode)) {\n this.adapter.visitRequestCompleted(this);\n }\n else {\n this.adapter.visitRequestFailedWithStatusCode(this, statusCode);\n }\n }\n }\n finishRequest() {\n this.recordTimingMetric(TimingMetric.requestEnd);\n this.adapter.visitRequestFinished(this);\n }\n loadResponse() {\n if (this.response) {\n const { statusCode, responseHTML } = this.response;\n this.render(async () => {\n if (this.shouldCacheSnapshot)\n this.cacheSnapshot();\n if (this.view.renderPromise)\n await this.view.renderPromise;\n if (isSuccessful(statusCode) && responseHTML != null) {\n await this.view.renderPage(PageSnapshot.fromHTMLString(responseHTML), false, this.willRender, this);\n this.performScroll();\n this.adapter.visitRendered(this);\n this.complete();\n }\n else {\n await this.view.renderError(PageSnapshot.fromHTMLString(responseHTML), this);\n this.adapter.visitRendered(this);\n this.fail();\n }\n });\n }\n }\n getCachedSnapshot() {\n const snapshot = this.view.getCachedSnapshotForLocation(this.location) || this.getPreloadedSnapshot();\n if (snapshot && (!getAnchor(this.location) || snapshot.hasAnchor(getAnchor(this.location)))) {\n if (this.action == \"restore\" || snapshot.isPreviewable) {\n return snapshot;\n }\n }\n }\n getPreloadedSnapshot() {\n if (this.snapshotHTML) {\n return PageSnapshot.fromHTMLString(this.snapshotHTML);\n }\n }\n hasCachedSnapshot() {\n return this.getCachedSnapshot() != null;\n }\n loadCachedSnapshot() {\n const snapshot = this.getCachedSnapshot();\n if (snapshot) {\n const isPreview = this.shouldIssueRequest();\n this.render(async () => {\n this.cacheSnapshot();\n if (this.isSamePage) {\n this.adapter.visitRendered(this);\n }\n else {\n if (this.view.renderPromise)\n await this.view.renderPromise;\n await this.view.renderPage(snapshot, isPreview, this.willRender, this);\n this.performScroll();\n this.adapter.visitRendered(this);\n if (!isPreview) {\n this.complete();\n }\n }\n });\n }\n }\n followRedirect() {\n var _a;\n if (this.redirectedToLocation && !this.followedRedirect && ((_a = this.response) === null || _a === void 0 ? void 0 : _a.redirected)) {\n this.adapter.visitProposedToLocation(this.redirectedToLocation, {\n action: \"replace\",\n response: this.response,\n });\n this.followedRedirect = true;\n }\n }\n goToSamePageAnchor() {\n if (this.isSamePage) {\n this.render(async () => {\n this.cacheSnapshot();\n this.performScroll();\n this.changeHistory();\n this.adapter.visitRendered(this);\n });\n }\n }\n prepareHeadersForRequest(headers, request) {\n if (this.acceptsStreamResponse) {\n request.acceptResponseType(StreamMessage.contentType);\n }\n }\n requestStarted() {\n this.startRequest();\n }\n requestPreventedHandlingResponse(_request, _response) { }\n async requestSucceededWithResponse(request, response) {\n const responseHTML = await response.responseHTML;\n const { redirected, statusCode } = response;\n if (responseHTML == undefined) {\n this.recordResponse({\n statusCode: SystemStatusCode.contentTypeMismatch,\n redirected,\n });\n }\n else {\n this.redirectedToLocation = response.redirected ? response.location : undefined;\n this.recordResponse({ statusCode: statusCode, responseHTML, redirected });\n }\n }\n async requestFailedWithResponse(request, response) {\n const responseHTML = await response.responseHTML;\n const { redirected, statusCode } = response;\n if (responseHTML == undefined) {\n this.recordResponse({\n statusCode: SystemStatusCode.contentTypeMismatch,\n redirected,\n });\n }\n else {\n this.recordResponse({ statusCode: statusCode, responseHTML, redirected });\n }\n }\n requestErrored(_request, _error) {\n this.recordResponse({\n statusCode: SystemStatusCode.networkFailure,\n redirected: false,\n });\n }\n requestFinished() {\n this.finishRequest();\n }\n performScroll() {\n if (!this.scrolled && !this.view.forceReloaded) {\n if (this.action == \"restore\") {\n this.scrollToRestoredPosition() || this.scrollToAnchor() || this.view.scrollToTop();\n }\n else {\n this.scrollToAnchor() || this.view.scrollToTop();\n }\n if (this.isSamePage) {\n this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation, this.location);\n }\n this.scrolled = true;\n }\n }\n scrollToRestoredPosition() {\n const { scrollPosition } = this.restorationData;\n if (scrollPosition) {\n this.view.scrollToPosition(scrollPosition);\n return true;\n }\n }\n scrollToAnchor() {\n const anchor = getAnchor(this.location);\n if (anchor != null) {\n this.view.scrollToAnchor(anchor);\n return true;\n }\n }\n recordTimingMetric(metric) {\n this.timingMetrics[metric] = new Date().getTime();\n }\n getTimingMetrics() {\n return Object.assign({}, this.timingMetrics);\n }\n getHistoryMethodForAction(action) {\n switch (action) {\n case \"replace\":\n return history.replaceState;\n case \"advance\":\n case \"restore\":\n return history.pushState;\n }\n }\n hasPreloadedResponse() {\n return typeof this.response == \"object\";\n }\n shouldIssueRequest() {\n if (this.isSamePage) {\n return false;\n }\n else if (this.action == \"restore\") {\n return !this.hasCachedSnapshot();\n }\n else {\n return this.willRender;\n }\n }\n cacheSnapshot() {\n if (!this.snapshotCached) {\n this.view.cacheSnapshot(this.snapshot).then((snapshot) => snapshot && this.visitCachedSnapshot(snapshot));\n this.snapshotCached = true;\n }\n }\n async render(callback) {\n this.cancelRender();\n await new Promise((resolve) => {\n this.frame = requestAnimationFrame(() => resolve());\n });\n await callback();\n delete this.frame;\n }\n cancelRender() {\n if (this.frame) {\n cancelAnimationFrame(this.frame);\n delete this.frame;\n }\n }\n}\nfunction isSuccessful(statusCode) {\n return statusCode >= 200 && statusCode < 300;\n}\n\nclass BrowserAdapter {\n constructor(session) {\n this.progressBar = new ProgressBar();\n this.showProgressBar = () => {\n this.progressBar.show();\n };\n this.session = session;\n }\n visitProposedToLocation(location, options) {\n this.navigator.startVisit(location, (options === null || options === void 0 ? void 0 : options.restorationIdentifier) || uuid(), options);\n }\n visitStarted(visit) {\n this.location = visit.location;\n visit.loadCachedSnapshot();\n visit.issueRequest();\n visit.goToSamePageAnchor();\n }\n visitRequestStarted(visit) {\n this.progressBar.setValue(0);\n if (visit.hasCachedSnapshot() || visit.action != \"restore\") {\n this.showVisitProgressBarAfterDelay();\n }\n else {\n this.showProgressBar();\n }\n }\n visitRequestCompleted(visit) {\n visit.loadResponse();\n }\n visitRequestFailedWithStatusCode(visit, statusCode) {\n switch (statusCode) {\n case SystemStatusCode.networkFailure:\n case SystemStatusCode.timeoutFailure:\n case SystemStatusCode.contentTypeMismatch:\n return this.reload({\n reason: \"request_failed\",\n context: {\n statusCode,\n },\n });\n default:\n return visit.loadResponse();\n }\n }\n visitRequestFinished(_visit) {\n this.progressBar.setValue(1);\n this.hideVisitProgressBar();\n }\n visitCompleted(_visit) { }\n pageInvalidated(reason) {\n this.reload(reason);\n }\n visitFailed(_visit) { }\n visitRendered(_visit) { }\n formSubmissionStarted(_formSubmission) {\n this.progressBar.setValue(0);\n this.showFormProgressBarAfterDelay();\n }\n formSubmissionFinished(_formSubmission) {\n this.progressBar.setValue(1);\n this.hideFormProgressBar();\n }\n showVisitProgressBarAfterDelay() {\n this.visitProgressBarTimeout = window.setTimeout(this.showProgressBar, this.session.progressBarDelay);\n }\n hideVisitProgressBar() {\n this.progressBar.hide();\n if (this.visitProgressBarTimeout != null) {\n window.clearTimeout(this.visitProgressBarTimeout);\n delete this.visitProgressBarTimeout;\n }\n }\n showFormProgressBarAfterDelay() {\n if (this.formProgressBarTimeout == null) {\n this.formProgressBarTimeout = window.setTimeout(this.showProgressBar, this.session.progressBarDelay);\n }\n }\n hideFormProgressBar() {\n this.progressBar.hide();\n if (this.formProgressBarTimeout != null) {\n window.clearTimeout(this.formProgressBarTimeout);\n delete this.formProgressBarTimeout;\n }\n }\n reload(reason) {\n var _a;\n dispatch(\"turbo:reload\", { detail: reason });\n window.location.href = ((_a = this.location) === null || _a === void 0 ? void 0 : _a.toString()) || window.location.href;\n }\n get navigator() {\n return this.session.navigator;\n }\n}\n\nclass CacheObserver {\n constructor() {\n this.started = false;\n this.removeStaleElements = ((_event) => {\n const staleElements = [...document.querySelectorAll('[data-turbo-cache=\"false\"]')];\n for (const element of staleElements) {\n element.remove();\n }\n });\n }\n start() {\n if (!this.started) {\n this.started = true;\n addEventListener(\"turbo:before-cache\", this.removeStaleElements, false);\n }\n }\n stop() {\n if (this.started) {\n this.started = false;\n removeEventListener(\"turbo:before-cache\", this.removeStaleElements, false);\n }\n }\n}\n\nclass FrameRedirector {\n constructor(session, element) {\n this.session = session;\n this.element = element;\n this.linkInterceptor = new LinkInterceptor(this, element);\n this.formSubmitObserver = new FormSubmitObserver(this, element);\n }\n start() {\n this.linkInterceptor.start();\n this.formSubmitObserver.start();\n }\n stop() {\n this.linkInterceptor.stop();\n this.formSubmitObserver.stop();\n }\n shouldInterceptLinkClick(element, _location, _event) {\n return this.shouldRedirect(element);\n }\n linkClickIntercepted(element, url, event) {\n const frame = this.findFrameElement(element);\n if (frame) {\n frame.delegate.linkClickIntercepted(element, url, event);\n }\n }\n willSubmitForm(element, submitter) {\n return (element.closest(\"turbo-frame\") == null &&\n this.shouldSubmit(element, submitter) &&\n this.shouldRedirect(element, submitter));\n }\n formSubmitted(element, submitter) {\n const frame = this.findFrameElement(element, submitter);\n if (frame) {\n frame.delegate.formSubmitted(element, submitter);\n }\n }\n shouldSubmit(form, submitter) {\n var _a;\n const action = getAction(form, submitter);\n const meta = this.element.ownerDocument.querySelector(`meta[name=\"turbo-root\"]`);\n const rootLocation = expandURL((_a = meta === null || meta === void 0 ? void 0 : meta.content) !== null && _a !== void 0 ? _a : \"/\");\n return this.shouldRedirect(form, submitter) && locationIsVisitable(action, rootLocation);\n }\n shouldRedirect(element, submitter) {\n const isNavigatable = element instanceof HTMLFormElement\n ? this.session.submissionIsNavigatable(element, submitter)\n : this.session.elementIsNavigatable(element);\n if (isNavigatable) {\n const frame = this.findFrameElement(element, submitter);\n return frame ? frame != element.closest(\"turbo-frame\") : false;\n }\n else {\n return false;\n }\n }\n findFrameElement(element, submitter) {\n const id = (submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute(\"data-turbo-frame\")) || element.getAttribute(\"data-turbo-frame\");\n if (id && id != \"_top\") {\n const frame = this.element.querySelector(`#${id}:not([disabled])`);\n if (frame instanceof FrameElement) {\n return frame;\n }\n }\n }\n}\n\nclass History {\n constructor(delegate) {\n this.restorationIdentifier = uuid();\n this.restorationData = {};\n this.started = false;\n this.pageLoaded = false;\n this.onPopState = (event) => {\n if (this.shouldHandlePopState()) {\n const { turbo } = event.state || {};\n if (turbo) {\n this.location = new URL(window.location.href);\n const { restorationIdentifier } = turbo;\n this.restorationIdentifier = restorationIdentifier;\n this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location, restorationIdentifier);\n }\n }\n };\n this.onPageLoad = async (_event) => {\n await nextMicrotask();\n this.pageLoaded = true;\n };\n this.delegate = delegate;\n }\n start() {\n if (!this.started) {\n addEventListener(\"popstate\", this.onPopState, false);\n addEventListener(\"load\", this.onPageLoad, false);\n this.started = true;\n this.replace(new URL(window.location.href));\n }\n }\n stop() {\n if (this.started) {\n removeEventListener(\"popstate\", this.onPopState, false);\n removeEventListener(\"load\", this.onPageLoad, false);\n this.started = false;\n }\n }\n push(location, restorationIdentifier) {\n this.update(history.pushState, location, restorationIdentifier);\n }\n replace(location, restorationIdentifier) {\n this.update(history.replaceState, location, restorationIdentifier);\n }\n update(method, location, restorationIdentifier = uuid()) {\n const state = { turbo: { restorationIdentifier } };\n method.call(history, state, \"\", location.href);\n this.location = location;\n this.restorationIdentifier = restorationIdentifier;\n }\n getRestorationDataForIdentifier(restorationIdentifier) {\n return this.restorationData[restorationIdentifier] || {};\n }\n updateRestorationData(additionalData) {\n const { restorationIdentifier } = this;\n const restorationData = this.restorationData[restorationIdentifier];\n this.restorationData[restorationIdentifier] = Object.assign(Object.assign({}, restorationData), additionalData);\n }\n assumeControlOfScrollRestoration() {\n var _a;\n if (!this.previousScrollRestoration) {\n this.previousScrollRestoration = (_a = history.scrollRestoration) !== null && _a !== void 0 ? _a : \"auto\";\n history.scrollRestoration = \"manual\";\n }\n }\n relinquishControlOfScrollRestoration() {\n if (this.previousScrollRestoration) {\n history.scrollRestoration = this.previousScrollRestoration;\n delete this.previousScrollRestoration;\n }\n }\n shouldHandlePopState() {\n return this.pageIsLoaded();\n }\n pageIsLoaded() {\n return this.pageLoaded || document.readyState == \"complete\";\n }\n}\n\nclass Navigator {\n constructor(delegate) {\n this.delegate = delegate;\n }\n proposeVisit(location, options = {}) {\n if (this.delegate.allowsVisitingLocationWithAction(location, options.action)) {\n if (locationIsVisitable(location, this.view.snapshot.rootLocation)) {\n this.delegate.visitProposedToLocation(location, options);\n }\n else {\n window.location.href = location.toString();\n }\n }\n }\n startVisit(locatable, restorationIdentifier, options = {}) {\n this.stop();\n this.currentVisit = new Visit(this, expandURL(locatable), restorationIdentifier, Object.assign({ referrer: this.location }, options));\n this.currentVisit.start();\n }\n submitForm(form, submitter) {\n this.stop();\n this.formSubmission = new FormSubmission(this, form, submitter, true);\n this.formSubmission.start();\n }\n stop() {\n if (this.formSubmission) {\n this.formSubmission.stop();\n delete this.formSubmission;\n }\n if (this.currentVisit) {\n this.currentVisit.cancel();\n delete this.currentVisit;\n }\n }\n get adapter() {\n return this.delegate.adapter;\n }\n get view() {\n return this.delegate.view;\n }\n get history() {\n return this.delegate.history;\n }\n formSubmissionStarted(formSubmission) {\n if (typeof this.adapter.formSubmissionStarted === \"function\") {\n this.adapter.formSubmissionStarted(formSubmission);\n }\n }\n async formSubmissionSucceededWithResponse(formSubmission, fetchResponse) {\n if (formSubmission == this.formSubmission) {\n const responseHTML = await fetchResponse.responseHTML;\n if (responseHTML) {\n const shouldCacheSnapshot = formSubmission.method == FetchMethod.get;\n if (!shouldCacheSnapshot) {\n this.view.clearSnapshotCache();\n }\n const { statusCode, redirected } = fetchResponse;\n const action = this.getActionForFormSubmission(formSubmission);\n const visitOptions = {\n action,\n shouldCacheSnapshot,\n response: { statusCode, responseHTML, redirected },\n };\n this.proposeVisit(fetchResponse.location, visitOptions);\n }\n }\n }\n async formSubmissionFailedWithResponse(formSubmission, fetchResponse) {\n const responseHTML = await fetchResponse.responseHTML;\n if (responseHTML) {\n const snapshot = PageSnapshot.fromHTMLString(responseHTML);\n if (fetchResponse.serverError) {\n await this.view.renderError(snapshot, this.currentVisit);\n }\n else {\n await this.view.renderPage(snapshot, false, true, this.currentVisit);\n }\n this.view.scrollToTop();\n this.view.clearSnapshotCache();\n }\n }\n formSubmissionErrored(formSubmission, error) {\n console.error(error);\n }\n formSubmissionFinished(formSubmission) {\n if (typeof this.adapter.formSubmissionFinished === \"function\") {\n this.adapter.formSubmissionFinished(formSubmission);\n }\n }\n visitStarted(visit) {\n this.delegate.visitStarted(visit);\n }\n visitCompleted(visit) {\n this.delegate.visitCompleted(visit);\n }\n locationWithActionIsSamePage(location, action) {\n const anchor = getAnchor(location);\n const currentAnchor = getAnchor(this.view.lastRenderedLocation);\n const isRestorationToTop = action === \"restore\" && typeof anchor === \"undefined\";\n return (action !== \"replace\" &&\n getRequestURL(location) === getRequestURL(this.view.lastRenderedLocation) &&\n (isRestorationToTop || (anchor != null && anchor !== currentAnchor)));\n }\n visitScrolledToSamePageLocation(oldURL, newURL) {\n this.delegate.visitScrolledToSamePageLocation(oldURL, newURL);\n }\n get location() {\n return this.history.location;\n }\n get restorationIdentifier() {\n return this.history.restorationIdentifier;\n }\n getActionForFormSubmission(formSubmission) {\n const { formElement, submitter } = formSubmission;\n const action = getAttribute(\"data-turbo-action\", submitter, formElement);\n return isAction(action) ? action : \"advance\";\n }\n}\n\nvar PageStage;\n(function (PageStage) {\n PageStage[PageStage[\"initial\"] = 0] = \"initial\";\n PageStage[PageStage[\"loading\"] = 1] = \"loading\";\n PageStage[PageStage[\"interactive\"] = 2] = \"interactive\";\n PageStage[PageStage[\"complete\"] = 3] = \"complete\";\n})(PageStage || (PageStage = {}));\nclass PageObserver {\n constructor(delegate) {\n this.stage = PageStage.initial;\n this.started = false;\n this.interpretReadyState = () => {\n const { readyState } = this;\n if (readyState == \"interactive\") {\n this.pageIsInteractive();\n }\n else if (readyState == \"complete\") {\n this.pageIsComplete();\n }\n };\n this.pageWillUnload = () => {\n this.delegate.pageWillUnload();\n };\n this.delegate = delegate;\n }\n start() {\n if (!this.started) {\n if (this.stage == PageStage.initial) {\n this.stage = PageStage.loading;\n }\n document.addEventListener(\"readystatechange\", this.interpretReadyState, false);\n addEventListener(\"pagehide\", this.pageWillUnload, false);\n this.started = true;\n }\n }\n stop() {\n if (this.started) {\n document.removeEventListener(\"readystatechange\", this.interpretReadyState, false);\n removeEventListener(\"pagehide\", this.pageWillUnload, false);\n this.started = false;\n }\n }\n pageIsInteractive() {\n if (this.stage == PageStage.loading) {\n this.stage = PageStage.interactive;\n this.delegate.pageBecameInteractive();\n }\n }\n pageIsComplete() {\n this.pageIsInteractive();\n if (this.stage == PageStage.interactive) {\n this.stage = PageStage.complete;\n this.delegate.pageLoaded();\n }\n }\n get readyState() {\n return document.readyState;\n }\n}\n\nclass ScrollObserver {\n constructor(delegate) {\n this.started = false;\n this.onScroll = () => {\n this.updatePosition({ x: window.pageXOffset, y: window.pageYOffset });\n };\n this.delegate = delegate;\n }\n start() {\n if (!this.started) {\n addEventListener(\"scroll\", this.onScroll, false);\n this.onScroll();\n this.started = true;\n }\n }\n stop() {\n if (this.started) {\n removeEventListener(\"scroll\", this.onScroll, false);\n this.started = false;\n }\n }\n updatePosition(position) {\n this.delegate.scrollPositionChanged(position);\n }\n}\n\nclass StreamMessageRenderer {\n render({ fragment }) {\n Bardo.preservingPermanentElements(this, getPermanentElementMapForFragment(fragment), () => document.documentElement.appendChild(fragment));\n }\n enteringBardo(currentPermanentElement, newPermanentElement) {\n newPermanentElement.replaceWith(currentPermanentElement.cloneNode(true));\n }\n leavingBardo() { }\n}\nfunction getPermanentElementMapForFragment(fragment) {\n const permanentElementsInDocument = queryPermanentElementsAll(document.documentElement);\n const permanentElementMap = {};\n for (const permanentElementInDocument of permanentElementsInDocument) {\n const { id } = permanentElementInDocument;\n for (const streamElement of fragment.querySelectorAll(\"turbo-stream\")) {\n const elementInStream = getPermanentElementById(streamElement.templateElement.content, id);\n if (elementInStream) {\n permanentElementMap[id] = [permanentElementInDocument, elementInStream];\n }\n }\n }\n return permanentElementMap;\n}\n\nclass StreamObserver {\n constructor(delegate) {\n this.sources = new Set();\n this.started = false;\n this.inspectFetchResponse = ((event) => {\n const response = fetchResponseFromEvent(event);\n if (response && fetchResponseIsStream(response)) {\n event.preventDefault();\n this.receiveMessageResponse(response);\n }\n });\n this.receiveMessageEvent = (event) => {\n if (this.started && typeof event.data == \"string\") {\n this.receiveMessageHTML(event.data);\n }\n };\n this.delegate = delegate;\n }\n start() {\n if (!this.started) {\n this.started = true;\n addEventListener(\"turbo:before-fetch-response\", this.inspectFetchResponse, false);\n }\n }\n stop() {\n if (this.started) {\n this.started = false;\n removeEventListener(\"turbo:before-fetch-response\", this.inspectFetchResponse, false);\n }\n }\n connectStreamSource(source) {\n if (!this.streamSourceIsConnected(source)) {\n this.sources.add(source);\n source.addEventListener(\"message\", this.receiveMessageEvent, false);\n }\n }\n disconnectStreamSource(source) {\n if (this.streamSourceIsConnected(source)) {\n this.sources.delete(source);\n source.removeEventListener(\"message\", this.receiveMessageEvent, false);\n }\n }\n streamSourceIsConnected(source) {\n return this.sources.has(source);\n }\n async receiveMessageResponse(response) {\n const html = await response.responseHTML;\n if (html) {\n this.receiveMessageHTML(html);\n }\n }\n receiveMessageHTML(html) {\n this.delegate.receivedMessageFromStream(StreamMessage.wrap(html));\n }\n}\nfunction fetchResponseFromEvent(event) {\n var _a;\n const fetchResponse = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.fetchResponse;\n if (fetchResponse instanceof FetchResponse) {\n return fetchResponse;\n }\n}\nfunction fetchResponseIsStream(response) {\n var _a;\n const contentType = (_a = response.contentType) !== null && _a !== void 0 ? _a : \"\";\n return contentType.startsWith(StreamMessage.contentType);\n}\n\nclass ErrorRenderer extends Renderer {\n static renderElement(currentElement, newElement) {\n const { documentElement, body } = document;\n documentElement.replaceChild(newElement, body);\n }\n async render() {\n this.replaceHeadAndBody();\n this.activateScriptElements();\n }\n replaceHeadAndBody() {\n const { documentElement, head } = document;\n documentElement.replaceChild(this.newHead, head);\n this.renderElement(this.currentElement, this.newElement);\n }\n activateScriptElements() {\n for (const replaceableElement of this.scriptElements) {\n const parentNode = replaceableElement.parentNode;\n if (parentNode) {\n const element = activateScriptElement(replaceableElement);\n parentNode.replaceChild(element, replaceableElement);\n }\n }\n }\n get newHead() {\n return this.newSnapshot.headSnapshot.element;\n }\n get scriptElements() {\n return document.documentElement.querySelectorAll(\"script\");\n }\n}\n\nclass PageRenderer extends Renderer {\n static renderElement(currentElement, newElement) {\n if (document.body && newElement instanceof HTMLBodyElement) {\n document.body.replaceWith(newElement);\n }\n else {\n document.documentElement.appendChild(newElement);\n }\n }\n get shouldRender() {\n return this.newSnapshot.isVisitable && this.trackedElementsAreIdentical;\n }\n get reloadReason() {\n if (!this.newSnapshot.isVisitable) {\n return {\n reason: \"turbo_visit_control_is_reload\",\n };\n }\n if (!this.trackedElementsAreIdentical) {\n return {\n reason: \"tracked_element_mismatch\",\n };\n }\n }\n async prepareToRender() {\n await this.mergeHead();\n }\n async render() {\n if (this.willRender) {\n this.replaceBody();\n }\n }\n finishRendering() {\n super.finishRendering();\n if (!this.isPreview) {\n this.focusFirstAutofocusableElement();\n }\n }\n get currentHeadSnapshot() {\n return this.currentSnapshot.headSnapshot;\n }\n get newHeadSnapshot() {\n return this.newSnapshot.headSnapshot;\n }\n get newElement() {\n return this.newSnapshot.element;\n }\n async mergeHead() {\n const newStylesheetElements = this.copyNewHeadStylesheetElements();\n this.copyNewHeadScriptElements();\n this.removeCurrentHeadProvisionalElements();\n this.copyNewHeadProvisionalElements();\n await newStylesheetElements;\n }\n replaceBody() {\n this.preservingPermanentElements(() => {\n this.activateNewBody();\n this.assignNewBody();\n });\n }\n get trackedElementsAreIdentical() {\n return this.currentHeadSnapshot.trackedElementSignature == this.newHeadSnapshot.trackedElementSignature;\n }\n async copyNewHeadStylesheetElements() {\n const loadingElements = [];\n for (const element of this.newHeadStylesheetElements) {\n loadingElements.push(waitForLoad(element));\n document.head.appendChild(element);\n }\n await Promise.all(loadingElements);\n }\n copyNewHeadScriptElements() {\n for (const element of this.newHeadScriptElements) {\n document.head.appendChild(activateScriptElement(element));\n }\n }\n removeCurrentHeadProvisionalElements() {\n for (const element of this.currentHeadProvisionalElements) {\n document.head.removeChild(element);\n }\n }\n copyNewHeadProvisionalElements() {\n for (const element of this.newHeadProvisionalElements) {\n document.head.appendChild(element);\n }\n }\n activateNewBody() {\n document.adoptNode(this.newElement);\n this.activateNewBodyScriptElements();\n }\n activateNewBodyScriptElements() {\n for (const inertScriptElement of this.newBodyScriptElements) {\n const activatedScriptElement = activateScriptElement(inertScriptElement);\n inertScriptElement.replaceWith(activatedScriptElement);\n }\n }\n assignNewBody() {\n this.renderElement(this.currentElement, this.newElement);\n }\n get newHeadStylesheetElements() {\n return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot);\n }\n get newHeadScriptElements() {\n return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot);\n }\n get currentHeadProvisionalElements() {\n return this.currentHeadSnapshot.provisionalElements;\n }\n get newHeadProvisionalElements() {\n return this.newHeadSnapshot.provisionalElements;\n }\n get newBodyScriptElements() {\n return this.newElement.querySelectorAll(\"script\");\n }\n}\n\nclass SnapshotCache {\n constructor(size) {\n this.keys = [];\n this.snapshots = {};\n this.size = size;\n }\n has(location) {\n return toCacheKey(location) in this.snapshots;\n }\n get(location) {\n if (this.has(location)) {\n const snapshot = this.read(location);\n this.touch(location);\n return snapshot;\n }\n }\n put(location, snapshot) {\n this.write(location, snapshot);\n this.touch(location);\n return snapshot;\n }\n clear() {\n this.snapshots = {};\n }\n read(location) {\n return this.snapshots[toCacheKey(location)];\n }\n write(location, snapshot) {\n this.snapshots[toCacheKey(location)] = snapshot;\n }\n touch(location) {\n const key = toCacheKey(location);\n const index = this.keys.indexOf(key);\n if (index > -1)\n this.keys.splice(index, 1);\n this.keys.unshift(key);\n this.trim();\n }\n trim() {\n for (const key of this.keys.splice(this.size)) {\n delete this.snapshots[key];\n }\n }\n}\n\nclass PageView extends View {\n constructor() {\n super(...arguments);\n this.snapshotCache = new SnapshotCache(10);\n this.lastRenderedLocation = new URL(location.href);\n this.forceReloaded = false;\n }\n renderPage(snapshot, isPreview = false, willRender = true, visit) {\n const renderer = new PageRenderer(this.snapshot, snapshot, PageRenderer.renderElement, isPreview, willRender);\n if (!renderer.shouldRender) {\n this.forceReloaded = true;\n }\n else {\n visit === null || visit === void 0 ? void 0 : visit.changeHistory();\n }\n return this.render(renderer);\n }\n renderError(snapshot, visit) {\n visit === null || visit === void 0 ? void 0 : visit.changeHistory();\n const renderer = new ErrorRenderer(this.snapshot, snapshot, ErrorRenderer.renderElement, false);\n return this.render(renderer);\n }\n clearSnapshotCache() {\n this.snapshotCache.clear();\n }\n async cacheSnapshot(snapshot = this.snapshot) {\n if (snapshot.isCacheable) {\n this.delegate.viewWillCacheSnapshot();\n const { lastRenderedLocation: location } = this;\n await nextEventLoopTick();\n const cachedSnapshot = snapshot.clone();\n this.snapshotCache.put(location, cachedSnapshot);\n return cachedSnapshot;\n }\n }\n getCachedSnapshotForLocation(location) {\n return this.snapshotCache.get(location);\n }\n get snapshot() {\n return PageSnapshot.fromElement(this.element);\n }\n}\n\nclass Preloader {\n constructor(delegate) {\n this.selector = \"a[data-turbo-preload]\";\n this.delegate = delegate;\n }\n get snapshotCache() {\n return this.delegate.navigator.view.snapshotCache;\n }\n start() {\n if (document.readyState === \"loading\") {\n return document.addEventListener(\"DOMContentLoaded\", () => {\n this.preloadOnLoadLinksForView(document.body);\n });\n }\n else {\n this.preloadOnLoadLinksForView(document.body);\n }\n }\n preloadOnLoadLinksForView(element) {\n for (const link of element.querySelectorAll(this.selector)) {\n this.preloadURL(link);\n }\n }\n async preloadURL(link) {\n const location = new URL(link.href);\n if (this.snapshotCache.has(location)) {\n return;\n }\n try {\n const response = await fetch(location.toString(), { headers: { \"VND.PREFETCH\": \"true\", Accept: \"text/html\" } });\n const responseText = await response.text();\n const snapshot = PageSnapshot.fromHTMLString(responseText);\n this.snapshotCache.put(location, snapshot);\n }\n catch (_) {\n }\n }\n}\n\nclass Session {\n constructor() {\n this.navigator = new Navigator(this);\n this.history = new History(this);\n this.preloader = new Preloader(this);\n this.view = new PageView(this, document.documentElement);\n this.adapter = new BrowserAdapter(this);\n this.pageObserver = new PageObserver(this);\n this.cacheObserver = new CacheObserver();\n this.linkClickObserver = new LinkClickObserver(this, window);\n this.formSubmitObserver = new FormSubmitObserver(this, document);\n this.scrollObserver = new ScrollObserver(this);\n this.streamObserver = new StreamObserver(this);\n this.formLinkClickObserver = new FormLinkClickObserver(this, document.documentElement);\n this.frameRedirector = new FrameRedirector(this, document.documentElement);\n this.streamMessageRenderer = new StreamMessageRenderer();\n this.drive = true;\n this.enabled = true;\n this.progressBarDelay = 500;\n this.started = false;\n this.formMode = \"on\";\n }\n start() {\n if (!this.started) {\n this.pageObserver.start();\n this.cacheObserver.start();\n this.formLinkClickObserver.start();\n this.linkClickObserver.start();\n this.formSubmitObserver.start();\n this.scrollObserver.start();\n this.streamObserver.start();\n this.frameRedirector.start();\n this.history.start();\n this.preloader.start();\n this.started = true;\n this.enabled = true;\n }\n }\n disable() {\n this.enabled = false;\n }\n stop() {\n if (this.started) {\n this.pageObserver.stop();\n this.cacheObserver.stop();\n this.formLinkClickObserver.stop();\n this.linkClickObserver.stop();\n this.formSubmitObserver.stop();\n this.scrollObserver.stop();\n this.streamObserver.stop();\n this.frameRedirector.stop();\n this.history.stop();\n this.started = false;\n }\n }\n registerAdapter(adapter) {\n this.adapter = adapter;\n }\n visit(location, options = {}) {\n const frameElement = options.frame ? document.getElementById(options.frame) : null;\n if (frameElement instanceof FrameElement) {\n frameElement.src = location.toString();\n frameElement.loaded;\n }\n else {\n this.navigator.proposeVisit(expandURL(location), options);\n }\n }\n connectStreamSource(source) {\n this.streamObserver.connectStreamSource(source);\n }\n disconnectStreamSource(source) {\n this.streamObserver.disconnectStreamSource(source);\n }\n renderStreamMessage(message) {\n this.streamMessageRenderer.render(StreamMessage.wrap(message));\n }\n clearCache() {\n this.view.clearSnapshotCache();\n }\n setProgressBarDelay(delay) {\n this.progressBarDelay = delay;\n }\n setFormMode(mode) {\n this.formMode = mode;\n }\n get location() {\n return this.history.location;\n }\n get restorationIdentifier() {\n return this.history.restorationIdentifier;\n }\n historyPoppedToLocationWithRestorationIdentifier(location, restorationIdentifier) {\n if (this.enabled) {\n this.navigator.startVisit(location, restorationIdentifier, {\n action: \"restore\",\n historyChanged: true,\n });\n }\n else {\n this.adapter.pageInvalidated({\n reason: \"turbo_disabled\",\n });\n }\n }\n scrollPositionChanged(position) {\n this.history.updateRestorationData({ scrollPosition: position });\n }\n willSubmitFormLinkToLocation(link, location) {\n return this.elementIsNavigatable(link) && locationIsVisitable(location, this.snapshot.rootLocation);\n }\n submittedFormLinkToLocation() { }\n willFollowLinkToLocation(link, location, event) {\n return (this.elementIsNavigatable(link) &&\n locationIsVisitable(location, this.snapshot.rootLocation) &&\n this.applicationAllowsFollowingLinkToLocation(link, location, event));\n }\n followedLinkToLocation(link, location) {\n const action = this.getActionForLink(link);\n const acceptsStreamResponse = link.hasAttribute(\"data-turbo-stream\");\n this.visit(location.href, { action, acceptsStreamResponse });\n }\n allowsVisitingLocationWithAction(location, action) {\n return this.locationWithActionIsSamePage(location, action) || this.applicationAllowsVisitingLocation(location);\n }\n visitProposedToLocation(location, options) {\n extendURLWithDeprecatedProperties(location);\n this.adapter.visitProposedToLocation(location, options);\n }\n visitStarted(visit) {\n if (!visit.acceptsStreamResponse) {\n markAsBusy(document.documentElement);\n }\n extendURLWithDeprecatedProperties(visit.location);\n if (!visit.silent) {\n this.notifyApplicationAfterVisitingLocation(visit.location, visit.action);\n }\n }\n visitCompleted(visit) {\n clearBusyState(document.documentElement);\n this.notifyApplicationAfterPageLoad(visit.getTimingMetrics());\n }\n locationWithActionIsSamePage(location, action) {\n return this.navigator.locationWithActionIsSamePage(location, action);\n }\n visitScrolledToSamePageLocation(oldURL, newURL) {\n this.notifyApplicationAfterVisitingSamePageLocation(oldURL, newURL);\n }\n willSubmitForm(form, submitter) {\n const action = getAction(form, submitter);\n return (this.submissionIsNavigatable(form, submitter) &&\n locationIsVisitable(expandURL(action), this.snapshot.rootLocation));\n }\n formSubmitted(form, submitter) {\n this.navigator.submitForm(form, submitter);\n }\n pageBecameInteractive() {\n this.view.lastRenderedLocation = this.location;\n this.notifyApplicationAfterPageLoad();\n }\n pageLoaded() {\n this.history.assumeControlOfScrollRestoration();\n }\n pageWillUnload() {\n this.history.relinquishControlOfScrollRestoration();\n }\n receivedMessageFromStream(message) {\n this.renderStreamMessage(message);\n }\n viewWillCacheSnapshot() {\n var _a;\n if (!((_a = this.navigator.currentVisit) === null || _a === void 0 ? void 0 : _a.silent)) {\n this.notifyApplicationBeforeCachingSnapshot();\n }\n }\n allowsImmediateRender({ element }, options) {\n const event = this.notifyApplicationBeforeRender(element, options);\n const { defaultPrevented, detail: { render }, } = event;\n if (this.view.renderer && render) {\n this.view.renderer.renderElement = render;\n }\n return !defaultPrevented;\n }\n viewRenderedSnapshot(_snapshot, _isPreview) {\n this.view.lastRenderedLocation = this.history.location;\n this.notifyApplicationAfterRender();\n }\n preloadOnLoadLinksForView(element) {\n this.preloader.preloadOnLoadLinksForView(element);\n }\n viewInvalidated(reason) {\n this.adapter.pageInvalidated(reason);\n }\n frameLoaded(frame) {\n this.notifyApplicationAfterFrameLoad(frame);\n }\n frameRendered(fetchResponse, frame) {\n this.notifyApplicationAfterFrameRender(fetchResponse, frame);\n }\n applicationAllowsFollowingLinkToLocation(link, location, ev) {\n const event = this.notifyApplicationAfterClickingLinkToLocation(link, location, ev);\n return !event.defaultPrevented;\n }\n applicationAllowsVisitingLocation(location) {\n const event = this.notifyApplicationBeforeVisitingLocation(location);\n return !event.defaultPrevented;\n }\n notifyApplicationAfterClickingLinkToLocation(link, location, event) {\n return dispatch(\"turbo:click\", {\n target: link,\n detail: { url: location.href, originalEvent: event },\n cancelable: true,\n });\n }\n notifyApplicationBeforeVisitingLocation(location) {\n return dispatch(\"turbo:before-visit\", {\n detail: { url: location.href },\n cancelable: true,\n });\n }\n notifyApplicationAfterVisitingLocation(location, action) {\n return dispatch(\"turbo:visit\", { detail: { url: location.href, action } });\n }\n notifyApplicationBeforeCachingSnapshot() {\n return dispatch(\"turbo:before-cache\");\n }\n notifyApplicationBeforeRender(newBody, options) {\n return dispatch(\"turbo:before-render\", {\n detail: Object.assign({ newBody }, options),\n cancelable: true,\n });\n }\n notifyApplicationAfterRender() {\n return dispatch(\"turbo:render\");\n }\n notifyApplicationAfterPageLoad(timing = {}) {\n return dispatch(\"turbo:load\", {\n detail: { url: this.location.href, timing },\n });\n }\n notifyApplicationAfterVisitingSamePageLocation(oldURL, newURL) {\n dispatchEvent(new HashChangeEvent(\"hashchange\", {\n oldURL: oldURL.toString(),\n newURL: newURL.toString(),\n }));\n }\n notifyApplicationAfterFrameLoad(frame) {\n return dispatch(\"turbo:frame-load\", { target: frame });\n }\n notifyApplicationAfterFrameRender(fetchResponse, frame) {\n return dispatch(\"turbo:frame-render\", {\n detail: { fetchResponse },\n target: frame,\n cancelable: true,\n });\n }\n submissionIsNavigatable(form, submitter) {\n if (this.formMode == \"off\") {\n return false;\n }\n else {\n const submitterIsNavigatable = submitter ? this.elementIsNavigatable(submitter) : true;\n if (this.formMode == \"optin\") {\n return submitterIsNavigatable && form.closest('[data-turbo=\"true\"]') != null;\n }\n else {\n return submitterIsNavigatable && this.elementIsNavigatable(form);\n }\n }\n }\n elementIsNavigatable(element) {\n const container = element.closest(\"[data-turbo]\");\n const withinFrame = element.closest(\"turbo-frame\");\n if (this.drive || withinFrame) {\n if (container) {\n return container.getAttribute(\"data-turbo\") != \"false\";\n }\n else {\n return true;\n }\n }\n else {\n if (container) {\n return container.getAttribute(\"data-turbo\") == \"true\";\n }\n else {\n return false;\n }\n }\n }\n getActionForLink(link) {\n const action = link.getAttribute(\"data-turbo-action\");\n return isAction(action) ? action : \"advance\";\n }\n get snapshot() {\n return this.view.snapshot;\n }\n}\nfunction extendURLWithDeprecatedProperties(url) {\n Object.defineProperties(url, deprecatedLocationPropertyDescriptors);\n}\nconst deprecatedLocationPropertyDescriptors = {\n absoluteURL: {\n get() {\n return this.toString();\n },\n },\n};\n\nclass Cache {\n constructor(session) {\n this.session = session;\n }\n clear() {\n this.session.clearCache();\n }\n resetCacheControl() {\n this.setCacheControl(\"\");\n }\n exemptPageFromCache() {\n this.setCacheControl(\"no-cache\");\n }\n exemptPageFromPreview() {\n this.setCacheControl(\"no-preview\");\n }\n setCacheControl(value) {\n setMetaContent(\"turbo-cache-control\", value);\n }\n}\n\nconst StreamActions = {\n after() {\n this.targetElements.forEach((e) => { var _a; return (_a = e.parentElement) === null || _a === void 0 ? void 0 : _a.insertBefore(this.templateContent, e.nextSibling); });\n },\n append() {\n this.removeDuplicateTargetChildren();\n this.targetElements.forEach((e) => e.append(this.templateContent));\n },\n before() {\n this.targetElements.forEach((e) => { var _a; return (_a = e.parentElement) === null || _a === void 0 ? void 0 : _a.insertBefore(this.templateContent, e); });\n },\n prepend() {\n this.removeDuplicateTargetChildren();\n this.targetElements.forEach((e) => e.prepend(this.templateContent));\n },\n remove() {\n this.targetElements.forEach((e) => e.remove());\n },\n replace() {\n this.targetElements.forEach((e) => e.replaceWith(this.templateContent));\n },\n update() {\n this.targetElements.forEach((e) => e.replaceChildren(this.templateContent));\n },\n};\n\nconst session = new Session();\nconst cache = new Cache(session);\nconst { navigator: navigator$1 } = session;\nfunction start() {\n session.start();\n}\nfunction registerAdapter(adapter) {\n session.registerAdapter(adapter);\n}\nfunction visit(location, options) {\n session.visit(location, options);\n}\nfunction connectStreamSource(source) {\n session.connectStreamSource(source);\n}\nfunction disconnectStreamSource(source) {\n session.disconnectStreamSource(source);\n}\nfunction renderStreamMessage(message) {\n session.renderStreamMessage(message);\n}\nfunction clearCache() {\n console.warn(\"Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`\");\n session.clearCache();\n}\nfunction setProgressBarDelay(delay) {\n session.setProgressBarDelay(delay);\n}\nfunction setConfirmMethod(confirmMethod) {\n FormSubmission.confirmMethod = confirmMethod;\n}\nfunction setFormMode(mode) {\n session.setFormMode(mode);\n}\n\nvar Turbo = /*#__PURE__*/Object.freeze({\n __proto__: null,\n navigator: navigator$1,\n session: session,\n cache: cache,\n PageRenderer: PageRenderer,\n PageSnapshot: PageSnapshot,\n FrameRenderer: FrameRenderer,\n start: start,\n registerAdapter: registerAdapter,\n visit: visit,\n connectStreamSource: connectStreamSource,\n disconnectStreamSource: disconnectStreamSource,\n renderStreamMessage: renderStreamMessage,\n clearCache: clearCache,\n setProgressBarDelay: setProgressBarDelay,\n setConfirmMethod: setConfirmMethod,\n setFormMode: setFormMode,\n StreamActions: StreamActions\n});\n\nclass FrameController {\n constructor(element) {\n this.fetchResponseLoaded = (_fetchResponse) => { };\n this.currentFetchRequest = null;\n this.resolveVisitPromise = () => { };\n this.connected = false;\n this.hasBeenLoaded = false;\n this.ignoredAttributes = new Set();\n this.action = null;\n this.visitCachedSnapshot = ({ element }) => {\n const frame = element.querySelector(\"#\" + this.element.id);\n if (frame && this.previousFrameElement) {\n frame.replaceChildren(...this.previousFrameElement.children);\n }\n delete this.previousFrameElement;\n };\n this.element = element;\n this.view = new FrameView(this, this.element);\n this.appearanceObserver = new AppearanceObserver(this, this.element);\n this.formLinkClickObserver = new FormLinkClickObserver(this, this.element);\n this.linkInterceptor = new LinkInterceptor(this, this.element);\n this.restorationIdentifier = uuid();\n this.formSubmitObserver = new FormSubmitObserver(this, this.element);\n }\n connect() {\n if (!this.connected) {\n this.connected = true;\n if (this.loadingStyle == FrameLoadingStyle.lazy) {\n this.appearanceObserver.start();\n }\n else {\n this.loadSourceURL();\n }\n this.formLinkClickObserver.start();\n this.linkInterceptor.start();\n this.formSubmitObserver.start();\n }\n }\n disconnect() {\n if (this.connected) {\n this.connected = false;\n this.appearanceObserver.stop();\n this.formLinkClickObserver.stop();\n this.linkInterceptor.stop();\n this.formSubmitObserver.stop();\n }\n }\n disabledChanged() {\n if (this.loadingStyle == FrameLoadingStyle.eager) {\n this.loadSourceURL();\n }\n }\n sourceURLChanged() {\n if (this.isIgnoringChangesTo(\"src\"))\n return;\n if (this.element.isConnected) {\n this.complete = false;\n }\n if (this.loadingStyle == FrameLoadingStyle.eager || this.hasBeenLoaded) {\n this.loadSourceURL();\n }\n }\n sourceURLReloaded() {\n const { src } = this.element;\n this.ignoringChangesToAttribute(\"complete\", () => {\n this.element.removeAttribute(\"complete\");\n });\n this.element.src = null;\n this.element.src = src;\n return this.element.loaded;\n }\n completeChanged() {\n if (this.isIgnoringChangesTo(\"complete\"))\n return;\n this.loadSourceURL();\n }\n loadingStyleChanged() {\n if (this.loadingStyle == FrameLoadingStyle.lazy) {\n this.appearanceObserver.start();\n }\n else {\n this.appearanceObserver.stop();\n this.loadSourceURL();\n }\n }\n async loadSourceURL() {\n if (this.enabled && this.isActive && !this.complete && this.sourceURL) {\n this.element.loaded = this.visit(expandURL(this.sourceURL));\n this.appearanceObserver.stop();\n await this.element.loaded;\n this.hasBeenLoaded = true;\n }\n }\n async loadResponse(fetchResponse) {\n if (fetchResponse.redirected || (fetchResponse.succeeded && fetchResponse.isHTML)) {\n this.sourceURL = fetchResponse.response.url;\n }\n try {\n const html = await fetchResponse.responseHTML;\n if (html) {\n const { body } = parseHTMLDocument(html);\n const newFrameElement = await this.extractForeignFrameElement(body);\n if (newFrameElement) {\n const snapshot = new Snapshot(newFrameElement);\n const renderer = new FrameRenderer(this, this.view.snapshot, snapshot, FrameRenderer.renderElement, false, false);\n if (this.view.renderPromise)\n await this.view.renderPromise;\n this.changeHistory();\n await this.view.render(renderer);\n this.complete = true;\n session.frameRendered(fetchResponse, this.element);\n session.frameLoaded(this.element);\n this.fetchResponseLoaded(fetchResponse);\n }\n else if (this.willHandleFrameMissingFromResponse(fetchResponse)) {\n console.warn(`A matching frame for #${this.element.id} was missing from the response, transforming into full-page Visit.`);\n this.visitResponse(fetchResponse.response);\n }\n }\n }\n catch (error) {\n console.error(error);\n this.view.invalidate();\n }\n finally {\n this.fetchResponseLoaded = () => { };\n }\n }\n elementAppearedInViewport(_element) {\n this.loadSourceURL();\n }\n willSubmitFormLinkToLocation(link) {\n return this.shouldInterceptNavigation(link);\n }\n submittedFormLinkToLocation(link, _location, form) {\n const frame = this.findFrameElement(link);\n if (frame)\n form.setAttribute(\"data-turbo-frame\", frame.id);\n }\n shouldInterceptLinkClick(element, _location, _event) {\n return this.shouldInterceptNavigation(element);\n }\n linkClickIntercepted(element, location) {\n this.navigateFrame(element, location);\n }\n willSubmitForm(element, submitter) {\n return element.closest(\"turbo-frame\") == this.element && this.shouldInterceptNavigation(element, submitter);\n }\n formSubmitted(element, submitter) {\n if (this.formSubmission) {\n this.formSubmission.stop();\n }\n this.formSubmission = new FormSubmission(this, element, submitter);\n const { fetchRequest } = this.formSubmission;\n this.prepareHeadersForRequest(fetchRequest.headers, fetchRequest);\n this.formSubmission.start();\n }\n prepareHeadersForRequest(headers, request) {\n var _a;\n headers[\"Turbo-Frame\"] = this.id;\n if ((_a = this.currentNavigationElement) === null || _a === void 0 ? void 0 : _a.hasAttribute(\"data-turbo-stream\")) {\n request.acceptResponseType(StreamMessage.contentType);\n }\n }\n requestStarted(_request) {\n markAsBusy(this.element);\n }\n requestPreventedHandlingResponse(_request, _response) {\n this.resolveVisitPromise();\n }\n async requestSucceededWithResponse(request, response) {\n await this.loadResponse(response);\n this.resolveVisitPromise();\n }\n async requestFailedWithResponse(request, response) {\n console.error(response);\n await this.loadResponse(response);\n this.resolveVisitPromise();\n }\n requestErrored(request, error) {\n console.error(error);\n this.resolveVisitPromise();\n }\n requestFinished(_request) {\n clearBusyState(this.element);\n }\n formSubmissionStarted({ formElement }) {\n markAsBusy(formElement, this.findFrameElement(formElement));\n }\n formSubmissionSucceededWithResponse(formSubmission, response) {\n const frame = this.findFrameElement(formSubmission.formElement, formSubmission.submitter);\n frame.delegate.proposeVisitIfNavigatedWithAction(frame, formSubmission.formElement, formSubmission.submitter);\n frame.delegate.loadResponse(response);\n }\n formSubmissionFailedWithResponse(formSubmission, fetchResponse) {\n this.element.delegate.loadResponse(fetchResponse);\n }\n formSubmissionErrored(formSubmission, error) {\n console.error(error);\n }\n formSubmissionFinished({ formElement }) {\n clearBusyState(formElement, this.findFrameElement(formElement));\n }\n allowsImmediateRender({ element: newFrame }, options) {\n const event = dispatch(\"turbo:before-frame-render\", {\n target: this.element,\n detail: Object.assign({ newFrame }, options),\n cancelable: true,\n });\n const { defaultPrevented, detail: { render }, } = event;\n if (this.view.renderer && render) {\n this.view.renderer.renderElement = render;\n }\n return !defaultPrevented;\n }\n viewRenderedSnapshot(_snapshot, _isPreview) { }\n preloadOnLoadLinksForView(element) {\n session.preloadOnLoadLinksForView(element);\n }\n viewInvalidated() { }\n willRenderFrame(currentElement, _newElement) {\n this.previousFrameElement = currentElement.cloneNode(true);\n }\n async visit(url) {\n var _a;\n const request = new FetchRequest(this, FetchMethod.get, url, new URLSearchParams(), this.element);\n (_a = this.currentFetchRequest) === null || _a === void 0 ? void 0 : _a.cancel();\n this.currentFetchRequest = request;\n return new Promise((resolve) => {\n this.resolveVisitPromise = () => {\n this.resolveVisitPromise = () => { };\n this.currentFetchRequest = null;\n resolve();\n };\n request.perform();\n });\n }\n navigateFrame(element, url, submitter) {\n const frame = this.findFrameElement(element, submitter);\n this.pageSnapshot = PageSnapshot.fromElement(frame).clone();\n frame.delegate.proposeVisitIfNavigatedWithAction(frame, element, submitter);\n this.withCurrentNavigationElement(element, () => {\n frame.src = url;\n });\n }\n proposeVisitIfNavigatedWithAction(frame, element, submitter) {\n this.action = getVisitAction(submitter, element, frame);\n if (isAction(this.action)) {\n const { visitCachedSnapshot } = frame.delegate;\n frame.delegate.fetchResponseLoaded = (fetchResponse) => {\n if (frame.src) {\n const { statusCode, redirected } = fetchResponse;\n const responseHTML = frame.ownerDocument.documentElement.outerHTML;\n const response = { statusCode, redirected, responseHTML };\n const options = {\n response,\n visitCachedSnapshot,\n willRender: false,\n updateHistory: false,\n restorationIdentifier: this.restorationIdentifier,\n snapshot: this.pageSnapshot,\n };\n if (this.action)\n options.action = this.action;\n session.visit(frame.src, options);\n }\n };\n }\n }\n changeHistory() {\n if (this.action) {\n const method = getHistoryMethodForAction(this.action);\n session.history.update(method, expandURL(this.element.src || \"\"), this.restorationIdentifier);\n }\n }\n willHandleFrameMissingFromResponse(fetchResponse) {\n this.element.setAttribute(\"complete\", \"\");\n const response = fetchResponse.response;\n const visit = async (url, options = {}) => {\n if (url instanceof Response) {\n this.visitResponse(url);\n }\n else {\n session.visit(url, options);\n }\n };\n const event = dispatch(\"turbo:frame-missing\", {\n target: this.element,\n detail: { response, visit },\n cancelable: true,\n });\n return !event.defaultPrevented;\n }\n async visitResponse(response) {\n const wrapped = new FetchResponse(response);\n const responseHTML = await wrapped.responseHTML;\n const { location, redirected, statusCode } = wrapped;\n return session.visit(location, { response: { redirected, statusCode, responseHTML } });\n }\n findFrameElement(element, submitter) {\n var _a;\n const id = getAttribute(\"data-turbo-frame\", submitter, element) || this.element.getAttribute(\"target\");\n return (_a = getFrameElementById(id)) !== null && _a !== void 0 ? _a : this.element;\n }\n async extractForeignFrameElement(container) {\n let element;\n const id = CSS.escape(this.id);\n try {\n element = activateElement(container.querySelector(`turbo-frame#${id}`), this.sourceURL);\n if (element) {\n return element;\n }\n element = activateElement(container.querySelector(`turbo-frame[src][recurse~=${id}]`), this.sourceURL);\n if (element) {\n await element.loaded;\n return await this.extractForeignFrameElement(element);\n }\n }\n catch (error) {\n console.error(error);\n return new FrameElement();\n }\n return null;\n }\n formActionIsVisitable(form, submitter) {\n const action = getAction(form, submitter);\n return locationIsVisitable(expandURL(action), this.rootLocation);\n }\n shouldInterceptNavigation(element, submitter) {\n const id = getAttribute(\"data-turbo-frame\", submitter, element) || this.element.getAttribute(\"target\");\n if (element instanceof HTMLFormElement && !this.formActionIsVisitable(element, submitter)) {\n return false;\n }\n if (!this.enabled || id == \"_top\") {\n return false;\n }\n if (id) {\n const frameElement = getFrameElementById(id);\n if (frameElement) {\n return !frameElement.disabled;\n }\n }\n if (!session.elementIsNavigatable(element)) {\n return false;\n }\n if (submitter && !session.elementIsNavigatable(submitter)) {\n return false;\n }\n return true;\n }\n get id() {\n return this.element.id;\n }\n get enabled() {\n return !this.element.disabled;\n }\n get sourceURL() {\n if (this.element.src) {\n return this.element.src;\n }\n }\n set sourceURL(sourceURL) {\n this.ignoringChangesToAttribute(\"src\", () => {\n this.element.src = sourceURL !== null && sourceURL !== void 0 ? sourceURL : null;\n });\n }\n get loadingStyle() {\n return this.element.loading;\n }\n get isLoading() {\n return this.formSubmission !== undefined || this.resolveVisitPromise() !== undefined;\n }\n get complete() {\n return this.element.hasAttribute(\"complete\");\n }\n set complete(value) {\n this.ignoringChangesToAttribute(\"complete\", () => {\n if (value) {\n this.element.setAttribute(\"complete\", \"\");\n }\n else {\n this.element.removeAttribute(\"complete\");\n }\n });\n }\n get isActive() {\n return this.element.isActive && this.connected;\n }\n get rootLocation() {\n var _a;\n const meta = this.element.ownerDocument.querySelector(`meta[name=\"turbo-root\"]`);\n const root = (_a = meta === null || meta === void 0 ? void 0 : meta.content) !== null && _a !== void 0 ? _a : \"/\";\n return expandURL(root);\n }\n isIgnoringChangesTo(attributeName) {\n return this.ignoredAttributes.has(attributeName);\n }\n ignoringChangesToAttribute(attributeName, callback) {\n this.ignoredAttributes.add(attributeName);\n callback();\n this.ignoredAttributes.delete(attributeName);\n }\n withCurrentNavigationElement(element, callback) {\n this.currentNavigationElement = element;\n callback();\n delete this.currentNavigationElement;\n }\n}\nfunction getFrameElementById(id) {\n if (id != null) {\n const element = document.getElementById(id);\n if (element instanceof FrameElement) {\n return element;\n }\n }\n}\nfunction activateElement(element, currentURL) {\n if (element) {\n const src = element.getAttribute(\"src\");\n if (src != null && currentURL != null && urlsAreEqual(src, currentURL)) {\n throw new Error(`Matching element has a source URL which references itself`);\n }\n if (element.ownerDocument !== document) {\n element = document.importNode(element, true);\n }\n if (element instanceof FrameElement) {\n element.connectedCallback();\n element.disconnectedCallback();\n return element;\n }\n }\n}\n\nclass StreamElement extends HTMLElement {\n static async renderElement(newElement) {\n await newElement.performAction();\n }\n async connectedCallback() {\n try {\n await this.render();\n }\n catch (error) {\n console.error(error);\n }\n finally {\n this.disconnect();\n }\n }\n async render() {\n var _a;\n return ((_a = this.renderPromise) !== null && _a !== void 0 ? _a : (this.renderPromise = (async () => {\n const event = this.beforeRenderEvent;\n if (this.dispatchEvent(event)) {\n await nextAnimationFrame();\n await event.detail.render(this);\n }\n })()));\n }\n disconnect() {\n try {\n this.remove();\n }\n catch (_a) { }\n }\n removeDuplicateTargetChildren() {\n this.duplicateChildren.forEach((c) => c.remove());\n }\n get duplicateChildren() {\n var _a;\n const existingChildren = this.targetElements.flatMap((e) => [...e.children]).filter((c) => !!c.id);\n const newChildrenIds = [...(((_a = this.templateContent) === null || _a === void 0 ? void 0 : _a.children) || [])].filter((c) => !!c.id).map((c) => c.id);\n return existingChildren.filter((c) => newChildrenIds.includes(c.id));\n }\n get performAction() {\n if (this.action) {\n const actionFunction = StreamActions[this.action];\n if (actionFunction) {\n return actionFunction;\n }\n this.raise(\"unknown action\");\n }\n this.raise(\"action attribute is missing\");\n }\n get targetElements() {\n if (this.target) {\n return this.targetElementsById;\n }\n else if (this.targets) {\n return this.targetElementsByQuery;\n }\n else {\n this.raise(\"target or targets attribute is missing\");\n }\n }\n get templateContent() {\n return this.templateElement.content.cloneNode(true);\n }\n get templateElement() {\n if (this.firstElementChild === null) {\n const template = this.ownerDocument.createElement(\"template\");\n this.appendChild(template);\n return template;\n }\n else if (this.firstElementChild instanceof HTMLTemplateElement) {\n return this.firstElementChild;\n }\n this.raise(\"first child element must be a