{ "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/vanilla-lazyload/dist/lazyload.min.js", "../../../node_modules/litepicker/dist/nocss/litepicker.umd.js", "../../javascript/controllers/dashboard/base/create_panel.js", "../../javascript/controllers/dashboard/base/create_content.js", "../../../node_modules/lottie-web/build/player/lottie.js", "../../../node_modules/tiny-slider/dist/tiny-slider.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/an-instance.js", "../../../node_modules/core-js/internals/correct-prototype-getter.js", "../../../node_modules/core-js/internals/object-get-prototype-of.js", "../../../node_modules/core-js/internals/define-built-in-accessor.js", "../../../node_modules/core-js/internals/create-property.js", "../../../node_modules/core-js/internals/object-keys.js", "../../../node_modules/core-js/internals/object-define-properties.js", "../../../node_modules/core-js/internals/html.js", "../../../node_modules/core-js/internals/object-create.js", "../../../node_modules/core-js/internals/iterators-core.js", "../../../node_modules/core-js/modules/esnext.iterator.constructor.js", "../../../node_modules/core-js/internals/define-built-ins.js", "../../../node_modules/core-js/internals/create-iter-result-object.js", "../../../node_modules/core-js/internals/iterator-create-proxy.js", "../../../node_modules/core-js/internals/call-with-safe-iteration-closing.js", "../../../node_modules/core-js/modules/esnext.iterator.filter.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/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/modules/esnext.iterator.for-each.js", "../../../node_modules/core-js/internals/iterator-map.js", "../../../node_modules/core-js/modules/esnext.iterator.map.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/dist/purify.es.mjs", "../../../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/handsontable/helpers/console.mjs", "../../../node_modules/handsontable/core/hooks/constants.mjs", "../../../node_modules/core-js/internals/array-from-constructor-and-list.js", "../../../node_modules/core-js/internals/get-built-in-prototype-method.js", "../../../node_modules/core-js/internals/add-to-unscopables.js", "../../../node_modules/core-js/modules/es.array.to-sorted.js", "../../../node_modules/core-js/modules/esnext.iterator.find.js", "../../../node_modules/handsontable/core/hooks/bucket.mjs", "../../../node_modules/handsontable/core/hooks/index.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/core-js/modules/esnext.iterator.reduce.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/viewSize.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/orderView/constants.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs", "../../../node_modules/core-js/internals/delete-property-or-throw.js", "../../../node_modules/core-js/modules/es.array.unshift.js", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.mjs", "../../../node_modules/handsontable/3rdparty/walkontable/src/utils/orderView/viewDiffer/index.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/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/utils.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/utils/stylesHandler.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/core-js/modules/esnext.iterator.every.js", "../../../node_modules/handsontable/helpers/data.mjs", "../../../node_modules/handsontable/dataMap/dataSource.mjs", "../../../node_modules/core-js/modules/esnext.iterator.some.js", "../../../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/helpers/themes.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/es/numbro.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/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/core-js/modules/es.array.unscopables.flat-map.js", "../../../node_modules/core-js/internals/get-iterator-flattenable.js", "../../../node_modules/core-js/modules/esnext.iterator.flat-map.js", "../../../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/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/stretchColumns/strategies/_base.mjs", "../../../node_modules/handsontable/plugins/stretchColumns/strategies/all.mjs", "../../../node_modules/handsontable/plugins/stretchColumns/strategies/last.mjs", "../../../node_modules/handsontable/plugins/stretchColumns/calculator.mjs", "../../../node_modules/handsontable/plugins/stretchColumns/stretchColumns.mjs", "../../../node_modules/handsontable/plugins/stretchColumns/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/handsontable/plugins/undoRedo/actions/_base.mjs", "../../../node_modules/handsontable/plugins/undoRedo/actions/cellAlignment.mjs", "../../../node_modules/handsontable/plugins/undoRedo/actions/columnMove.mjs", "../../../node_modules/handsontable/plugins/undoRedo/actions/columnSort.mjs", "../../../node_modules/handsontable/plugins/undoRedo/actions/createColumn.mjs", "../../../node_modules/handsontable/plugins/undoRedo/actions/createRow.mjs", "../../../node_modules/handsontable/plugins/undoRedo/actions/dataChange.mjs", "../../../node_modules/handsontable/plugins/undoRedo/actions/filters.mjs", "../../../node_modules/handsontable/plugins/undoRedo/actions/mergeCells.mjs", "../../../node_modules/core-js/modules/es.object.from-entries.js", "../../../node_modules/handsontable/plugins/undoRedo/utils.mjs", "../../../node_modules/handsontable/plugins/undoRedo/actions/removeColumn.mjs", "../../../node_modules/handsontable/plugins/undoRedo/actions/removeRow.mjs", "../../../node_modules/handsontable/plugins/undoRedo/actions/rowMove.mjs", "../../../node_modules/handsontable/plugins/undoRedo/actions/unmergeCells.mjs", "../../../node_modules/handsontable/plugins/undoRedo/actions/index.mjs", "../../../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/@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/applications/modal_controller.js", "../../../node_modules/slim-select/dist/slimselect.es.js", "../../javascript/controllers/companies/applications/select_controller.js", "../../javascript/controllers/companies/banner_controller.js", "../../javascript/controllers/companies/image_controller.js", "../../javascript/controllers/companies/information/select_controller.js", "../../javascript/controllers/companies/information/tabs_controller.js", "../../javascript/controllers/companies/information_controller.js", "../../javascript/controllers/companies/input/switch_controller.js", "../../javascript/controllers/companies/inputs/form_controller.js", "../../javascript/controllers/companies/lazy_load_controller.js", "../../javascript/controllers/companies/members/calendar_connect_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", "../../javascript/controllers/companies/modal_confirmation_controller.js", "../../javascript/controllers/companies/modal_controller.js", "../../javascript/controllers/companies/process_status/form_controller.js", "../../javascript/controllers/companies/process_status/select_controller.js", "../../javascript/controllers/companies/public_information/image_controller.js", "../../javascript/controllers/companies/public_information/select_controller.js", "../../javascript/controllers/companies/public_information/services_controller.js", "../../javascript/controllers/companies/public_information/values_controller.js", "../../javascript/controllers/companies/talent_setting/inputs/switch_controller.js", "../../javascript/controllers/company_members/inputs/password_controller.js", "../../javascript/controllers/customization/collapsing_controller.js", "../../javascript/controllers/customization/tabs_controller.js", "../../javascript/controllers/customization/tooltip_controller.js", "../../javascript/controllers/dashboard/period_filter_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/@cfcs/core/src/core/utils.ts", "../../../node_modules/@cfcs/core/src/dom/utils.ts", "../../../node_modules/@cfcs/core/src/reactive/const.ts", "../../../node_modules/@cfcs/core/src/reactive/detectDependencies.ts", "../../../node_modules/@cfcs/core/src/reactive/Observer.ts", "../../../node_modules/@cfcs/core/src/reactive/ComputedObserver.ts", "../../../node_modules/@cfcs/core/src/reactive/decorators/Observe.ts", "../../../node_modules/@cfcs/core/src/reactive/decorators/ReactiveSubscribe.ts", "../../../node_modules/@cfcs/core/src/reactive/inline.ts", "../../../node_modules/@cfcs/core/src/reactive/utils.ts", "../../../node_modules/@cfcs/core/src/reactive/adaptReactive.ts", "../../../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/CrossFlicking.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/reactive/index.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", "../../javascript/controllers/help/categories_controller.js", "../../javascript/controllers/help/faq_controller.js", "../../javascript/controllers/help/search_controller.js", "../../javascript/controllers/home/banner_animation_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_sliders_controller.js", "../../javascript/controllers/home/index/intro_animation_controller.js", "../../javascript/controllers/home/index/receive_candidates_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/scrolling_controller.js", "../../javascript/controllers/home/workflow_sliders_controller.js", "../../javascript/controllers/inputs/file_controller.js", "../../javascript/controllers/inputs/password_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/copy_button_controller.js", "../../javascript/controllers/jobs/filters_controller.js", "../../javascript/controllers/jobs/inputs/select_controller.js", "../../javascript/controllers/jobs/inputs/switch_controller.js", "../../javascript/controllers/jobs/inputs/text_controller.js", "../../javascript/controllers/jobs/jd_drop_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/public/form_acceptation_controller.js", "../../javascript/controllers/jobs/publish/inputs/select_controller.js", "../../javascript/controllers/jobs/publish/tour/complete_controller.js", "../../javascript/controllers/jobs/publish/tour/confirm_controller.js", "../../javascript/controllers/jobs/publish/tour/new_controller.js", "../../javascript/controllers/jobs/publish/tour/talent_fields_controller.js", "../../javascript/controllers/jobs/share/modal_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/dpa_agreement_controller.js", "../../javascript/controllers/layouts/header_controller.js", "../../javascript/controllers/layouts/header_flash_controller.js", "../../javascript/controllers/layouts/header_language_controller.js", "../../javascript/controllers/layouts/header_submenu_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/lp_hiring/banner_sliders_controller.js", "../../javascript/controllers/my_tasks/filters_controller.js", "../../javascript/controllers/my_tasks/tasks_list_controller.js", "../../javascript/controllers/selection_processes/batch/selections_controller.js", "../../javascript/controllers/selection_processes/filters_controller.js", "../../javascript/controllers/selection_processes/inputs/filter_dropdown_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_confirmation_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/active_process_form/date_picker_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/salary_range_filter_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/status_filter_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/resume_drop_controller.js", "../../javascript/controllers/talents/tabs_controller.js", "../../javascript/controllers/talents/tasks/status_controller.js", "../../javascript/controllers/transfer/export_columns_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", "!function(n,t){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define(t):(n=\"undefined\"!=typeof globalThis?globalThis:n||self).LazyLoad=t()}(this,(function(){\"use strict\";function n(){return n=Object.assign||function(n){for(var t=1;t1,r={elements_selector:\".lazy\",container:e||t?document:null,threshold:300,thresholds:null,data_src:\"src\",data_srcset:\"srcset\",data_sizes:\"sizes\",data_bg:\"bg\",data_bg_hidpi:\"bg-hidpi\",data_bg_multi:\"bg-multi\",data_bg_multi_hidpi:\"bg-multi-hidpi\",data_bg_set:\"bg-set\",data_poster:\"poster\",class_applied:\"applied\",class_loading:\"loading\",class_loaded:\"loaded\",class_error:\"error\",class_entered:\"entered\",class_exited:\"exited\",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1,restore_on_error:!1},c=function(t){return n({},r,t)},l=function(n,t){var e,i=\"LazyLoad::Initialized\",o=new n(t);try{e=new CustomEvent(i,{detail:{instance:o}})}catch(n){(e=document.createEvent(\"CustomEvent\")).initCustomEvent(i,!1,!1,{instance:o})}window.dispatchEvent(e)},u=\"src\",s=\"srcset\",d=\"sizes\",f=\"poster\",_=\"llOriginalAttrs\",g=\"data\",v=\"loading\",b=\"loaded\",m=\"applied\",p=\"error\",h=\"native\",E=\"data-\",I=\"ll-status\",y=function(n,t){return n.getAttribute(E+t)},k=function(n){return y(n,I)},w=function(n,t){return function(n,t,e){var i=\"data-ll-status\";null!==e?n.setAttribute(i,e):n.removeAttribute(i)}(n,0,t)},A=function(n){return w(n,null)},L=function(n){return null===k(n)},O=function(n){return k(n)===h},x=[v,b,m,p],C=function(n,t,e,i){n&&(void 0===i?void 0===e?n(t):n(t,e):n(t,e,i))},N=function(n,t){o?n.classList.add(t):n.className+=(n.className?\" \":\"\")+t},M=function(n,t){o?n.classList.remove(t):n.className=n.className.replace(new RegExp(\"(^|\\\\s+)\"+t+\"(\\\\s+|$)\"),\" \").replace(/^\\s+/,\"\").replace(/\\s+$/,\"\")},z=function(n){return n.llTempImage},T=function(n,t){if(t){var e=t._observer;e&&e.unobserve(n)}},R=function(n,t){n&&(n.loadingCount+=t)},G=function(n,t){n&&(n.toLoadCount=t)},j=function(n){for(var t,e=[],i=0;t=n.children[i];i+=1)\"SOURCE\"===t.tagName&&e.push(t);return e},D=function(n,t){var e=n.parentNode;e&&\"PICTURE\"===e.tagName&&j(e).forEach(t)},H=function(n,t){j(n).forEach(t)},V=[u],F=[u,f],B=[u,s,d],J=[g],P=function(n){return!!n[_]},S=function(n){return n[_]},U=function(n){return delete n[_]},$=function(n,t){if(!P(n)){var e={};t.forEach((function(t){e[t]=n.getAttribute(t)})),n[_]=e}},q=function(n,t){if(P(n)){var e=S(n);t.forEach((function(t){!function(n,t,e){e?n.setAttribute(t,e):n.removeAttribute(t)}(n,t,e[t])}))}},K=function(n,t,e){N(n,t.class_applied),w(n,m),e&&(t.unobserve_completed&&T(n,t),C(t.callback_applied,n,e))},Q=function(n,t,e){N(n,t.class_loading),w(n,v),e&&(R(e,1),C(t.callback_loading,n,e))},W=function(n,t,e){e&&n.setAttribute(t,e)},X=function(n,t){W(n,d,y(n,t.data_sizes)),W(n,s,y(n,t.data_srcset)),W(n,u,y(n,t.data_src))},Y={IMG:function(n,t){D(n,(function(n){$(n,B),X(n,t)})),$(n,B),X(n,t)},IFRAME:function(n,t){$(n,V),W(n,u,y(n,t.data_src))},VIDEO:function(n,t){H(n,(function(n){$(n,V),W(n,u,y(n,t.data_src))})),$(n,F),W(n,f,y(n,t.data_poster)),W(n,u,y(n,t.data_src)),n.load()},OBJECT:function(n,t){$(n,J),W(n,g,y(n,t.data_src))}},Z=[\"IMG\",\"IFRAME\",\"VIDEO\",\"OBJECT\"],nn=function(n,t){!t||function(n){return n.loadingCount>0}(t)||function(n){return n.toLoadCount>0}(t)||C(n.callback_finish,t)},tn=function(n,t,e){n.addEventListener(t,e),n.llEvLisnrs[t]=e},en=function(n,t,e){n.removeEventListener(t,e)},on=function(n){return!!n.llEvLisnrs},an=function(n){if(on(n)){var t=n.llEvLisnrs;for(var e in t){var i=t[e];en(n,e,i)}delete n.llEvLisnrs}},rn=function(n,t,e){!function(n){delete n.llTempImage}(n),R(e,-1),function(n){n&&(n.toLoadCount-=1)}(e),M(n,t.class_loading),t.unobserve_completed&&T(n,e)},cn=function(n,t,e){var i=z(n)||n;on(i)||function(n,t,e){on(n)||(n.llEvLisnrs={});var i=\"VIDEO\"===n.tagName?\"loadeddata\":\"load\";tn(n,i,t),tn(n,\"error\",e)}(i,(function(o){!function(n,t,e,i){var o=O(t);rn(t,e,i),N(t,e.class_loaded),w(t,b),C(e.callback_loaded,t,i),o||nn(e,i)}(0,n,t,e),an(i)}),(function(o){!function(n,t,e,i){var o=O(t);rn(t,e,i),N(t,e.class_error),w(t,p),C(e.callback_error,t,i),e.restore_on_error&&q(t,B),o||nn(e,i)}(0,n,t,e),an(i)}))},ln=function(n,t,e){!function(n){return Z.indexOf(n.tagName)>-1}(n)?function(n,t,e){!function(n){n.llTempImage=document.createElement(\"IMG\")}(n),cn(n,t,e),function(n){P(n)||(n[_]={backgroundImage:n.style.backgroundImage})}(n),function(n,t,e){var i=y(n,t.data_bg),o=y(n,t.data_bg_hidpi),r=a&&o?o:i;r&&(n.style.backgroundImage='url(\"'.concat(r,'\")'),z(n).setAttribute(u,r),Q(n,t,e))}(n,t,e),function(n,t,e){var i=y(n,t.data_bg_multi),o=y(n,t.data_bg_multi_hidpi),r=a&&o?o:i;r&&(n.style.backgroundImage=r,K(n,t,e))}(n,t,e),function(n,t,e){var i=y(n,t.data_bg_set);if(i){var o=i.split(\"|\"),a=o.map((function(n){return\"image-set(\".concat(n,\")\")}));n.style.backgroundImage=a.join(),\"\"===n.style.backgroundImage&&(a=o.map((function(n){return\"-webkit-image-set(\".concat(n,\")\")})),n.style.backgroundImage=a.join()),K(n,t,e)}}(n,t,e)}(n,t,e):function(n,t,e){cn(n,t,e),function(n,t,e){var i=Y[n.tagName];i&&(i(n,t),Q(n,t,e))}(n,t,e)}(n,t,e)},un=function(n){n.removeAttribute(u),n.removeAttribute(s),n.removeAttribute(d)},sn=function(n){D(n,(function(n){q(n,B)})),q(n,B)},dn={IMG:sn,IFRAME:function(n){q(n,V)},VIDEO:function(n){H(n,(function(n){q(n,V)})),q(n,F),n.load()},OBJECT:function(n){q(n,J)}},fn=function(n,t){(function(n){var t=dn[n.tagName];t?t(n):function(n){if(P(n)){var t=S(n);n.style.backgroundImage=t.backgroundImage}}(n)})(n),function(n,t){L(n)||O(n)||(M(n,t.class_entered),M(n,t.class_exited),M(n,t.class_applied),M(n,t.class_loading),M(n,t.class_loaded),M(n,t.class_error))}(n,t),A(n),U(n)},_n=[\"IMG\",\"IFRAME\",\"VIDEO\"],gn=function(n){return n.use_native&&\"loading\"in HTMLImageElement.prototype},vn=function(n,t,e){n.forEach((function(n){return function(n){return n.isIntersecting||n.intersectionRatio>0}(n)?function(n,t,e,i){var o=function(n){return x.indexOf(k(n))>=0}(n);w(n,\"entered\"),N(n,e.class_entered),M(n,e.class_exited),function(n,t,e){t.unobserve_entered&&T(n,e)}(n,e,i),C(e.callback_enter,n,t,i),o||ln(n,e,i)}(n.target,n,t,e):function(n,t,e,i){L(n)||(N(n,e.class_exited),function(n,t,e,i){e.cancel_on_exit&&function(n){return k(n)===v}(n)&&\"IMG\"===n.tagName&&(an(n),function(n){D(n,(function(n){un(n)})),un(n)}(n),sn(n),M(n,e.class_loading),R(i,-1),A(n),C(e.callback_cancel,n,t,i))}(n,t,e,i),C(e.callback_exit,n,t,i))}(n.target,n,t,e)}))},bn=function(n){return Array.prototype.slice.call(n)},mn=function(n){return n.container.querySelectorAll(n.elements_selector)},pn=function(n){return function(n){return k(n)===p}(n)},hn=function(n,t){return function(n){return bn(n).filter(L)}(n||mn(t))},En=function(n,e){var o=c(n);this._settings=o,this.loadingCount=0,function(n,t){i&&!gn(n)&&(t._observer=new IntersectionObserver((function(e){vn(e,n,t)}),function(n){return{root:n.container===document?null:n.container,rootMargin:n.thresholds||n.threshold+\"px\"}}(n)))}(o,this),function(n,e){t&&(e._onlineHandler=function(){!function(n,t){var e;(e=mn(n),bn(e).filter(pn)).forEach((function(t){M(t,n.class_error),A(t)})),t.update()}(n,e)},window.addEventListener(\"online\",e._onlineHandler))}(o,this),this.update(e)};return En.prototype={update:function(n){var t,o,a=this._settings,r=hn(n,a);G(this,r.length),!e&&i?gn(a)?function(n,t,e){n.forEach((function(n){-1!==_n.indexOf(n.tagName)&&function(n,t,e){n.setAttribute(\"loading\",\"lazy\"),cn(n,t,e),function(n,t){var e=Y[n.tagName];e&&e(n,t)}(n,t),w(n,h)}(n,t,e)})),G(e,0)}(r,a,this):(o=r,function(n){n.disconnect()}(t=this._observer),function(n,t){t.forEach((function(t){n.observe(t)}))}(t,o)):this.loadAll(r)},destroy:function(){this._observer&&this._observer.disconnect(),t&&window.removeEventListener(\"online\",this._onlineHandler),mn(this._settings).forEach((function(n){U(n)})),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(n){var t=this,e=this._settings;hn(n,e).forEach((function(n){T(n,t),ln(n,e,t)}))},restoreAll:function(){var n=this._settings;mn(n).forEach((function(t){fn(t,n)}))}},En.load=function(n,t){var e=c(t);ln(n,e)},En.resetStatus=function(n){A(n)},t&&function(n,t){if(t)if(t.length)for(var e,i=0;e=t[i];i+=1)l(n,e);else l(n,t)}(En,window.lazyLoadOptions),En}));\n", "/*!\n * \n * litepicker.umd.js\n * Litepicker v2.0.12 (https://github.com/wakirin/Litepicker)\n * Package: litepicker (https://www.npmjs.com/package/litepicker)\n * License: MIT (https://github.com/wakirin/Litepicker/blob/master/LICENCE.md)\n * Copyright 2019-2021 Rinat G.\n * \n * Hash: f46190e781537007f2f2\n * \n */\n!function(t,e){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define(\"Litepicker\",[],e):\"object\"==typeof exports?exports.Litepicker=e():t.Litepicker=e()}(window,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&\"object\"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,\"default\",{enumerable:!0,value:t}),2&e&&\"string\"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,\"a\",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p=\"\",n(n.s=4)}([function(t,e,n){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});var i=function(){function t(e,n,i){void 0===e&&(e=null),void 0===n&&(n=null),void 0===i&&(i=\"en-US\"),this.dateInstance=\"object\"==typeof n&&null!==n?n.parse(e instanceof t?e.clone().toJSDate():e):\"string\"==typeof n?t.parseDateTime(e,n,i):e?t.parseDateTime(e):t.parseDateTime(new Date),this.lang=i}return t.parseDateTime=function(e,n,i){if(void 0===n&&(n=\"YYYY-MM-DD\"),void 0===i&&(i=\"en-US\"),!e)return new Date(NaN);if(e instanceof Date)return new Date(e);if(e instanceof t)return e.clone().toJSDate();if(/^-?\\d{10,}$/.test(e))return t.getDateZeroTime(new Date(Number(e)));if(\"string\"==typeof e){for(var o=[],s=null;null!=(s=t.regex.exec(n));)\"\\\\\"!==s[1]&&o.push(s);if(o.length){var r={year:null,month:null,shortMonth:null,longMonth:null,day:null,value:\"\"};o[0].index>0&&(r.value+=\".*?\");for(var a=0,h=Object.entries(o);at.getTime()&&this.timestamp()=t.getTime()&&this.timestamp()t.getTime()&&this.timestamp()<=e.getTime();case\"[]\":return this.timestamp()>=t.getTime()&&this.timestamp()<=e.getTime()}},t.prototype.isBefore=function(t,e){switch(void 0===e&&(e=\"seconds\"),e){case\"second\":case\"seconds\":return t.getTime()>this.getTime();case\"day\":case\"days\":return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()>new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime();case\"month\":case\"months\":return new Date(t.getFullYear(),t.getMonth(),1).getTime()>new Date(this.getFullYear(),this.getMonth(),1).getTime();case\"year\":case\"years\":return t.getFullYear()>this.getFullYear()}throw new Error(\"isBefore: Invalid unit!\")},t.prototype.isSameOrBefore=function(t,e){switch(void 0===e&&(e=\"seconds\"),e){case\"second\":case\"seconds\":return t.getTime()>=this.getTime();case\"day\":case\"days\":return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()>=new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime();case\"month\":case\"months\":return new Date(t.getFullYear(),t.getMonth(),1).getTime()>=new Date(this.getFullYear(),this.getMonth(),1).getTime()}throw new Error(\"isSameOrBefore: Invalid unit!\")},t.prototype.isAfter=function(t,e){switch(void 0===e&&(e=\"seconds\"),e){case\"second\":case\"seconds\":return this.getTime()>t.getTime();case\"day\":case\"days\":return new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime()>new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();case\"month\":case\"months\":return new Date(this.getFullYear(),this.getMonth(),1).getTime()>new Date(t.getFullYear(),t.getMonth(),1).getTime();case\"year\":case\"years\":return this.getFullYear()>t.getFullYear()}throw new Error(\"isAfter: Invalid unit!\")},t.prototype.isSameOrAfter=function(t,e){switch(void 0===e&&(e=\"seconds\"),e){case\"second\":case\"seconds\":return this.getTime()>=t.getTime();case\"day\":case\"days\":return new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime()>=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();case\"month\":case\"months\":return new Date(this.getFullYear(),this.getMonth(),1).getTime()>=new Date(t.getFullYear(),t.getMonth(),1).getTime()}throw new Error(\"isSameOrAfter: Invalid unit!\")},t.prototype.isSame=function(t,e){switch(void 0===e&&(e=\"seconds\"),e){case\"second\":case\"seconds\":return this.getTime()===t.getTime();case\"day\":case\"days\":return new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime()===new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();case\"month\":case\"months\":return new Date(this.getFullYear(),this.getMonth(),1).getTime()===new Date(t.getFullYear(),t.getMonth(),1).getTime()}throw new Error(\"isSame: Invalid unit!\")},t.prototype.add=function(t,e){switch(void 0===e&&(e=\"seconds\"),e){case\"second\":case\"seconds\":this.setSeconds(this.getSeconds()+t);break;case\"day\":case\"days\":this.setDate(this.getDate()+t);break;case\"month\":case\"months\":this.setMonth(this.getMonth()+t)}return this},t.prototype.subtract=function(t,e){switch(void 0===e&&(e=\"seconds\"),e){case\"second\":case\"seconds\":this.setSeconds(this.getSeconds()-t);break;case\"day\":case\"days\":this.setDate(this.getDate()-t);break;case\"month\":case\"months\":this.setMonth(this.getMonth()-t)}return this},t.prototype.diff=function(t,e){void 0===e&&(e=\"seconds\");switch(e){default:case\"second\":case\"seconds\":return this.getTime()-t.getTime();case\"day\":case\"days\":return Math.round((this.timestamp()-t.getTime())/864e5);case\"month\":case\"months\":}},t.prototype.format=function(e,n){if(void 0===n&&(n=\"en-US\"),\"object\"==typeof e)return e.output(this.clone().toJSDate());for(var i=\"\",o=[],s=null;null!=(s=t.regex.exec(e));)\"\\\\\"!==s[1]&&o.push(s);if(o.length){o[0].index>0&&(i+=e.substring(0,o[0].index));for(var r=0,a=Object.entries(o);r1&&n.isAfter(e)&&n.setMonth(n.getMonth()-(this.options.numberOfMonths-1)),this.calendars[0]=n.clone()):(e.setDate(1),this.calendars[0]=e.clone())}},e.prototype.bindEvents=function(){document.addEventListener(\"click\",this.onClick.bind(this),!0),this.ui=document.createElement(\"div\"),this.ui.className=h.litepicker,this.ui.style.display=\"none\",this.ui.addEventListener(\"mouseenter\",this.onMouseEnter.bind(this),!0),this.ui.addEventListener(\"mouseleave\",this.onMouseLeave.bind(this),!1),this.options.autoRefresh?(this.options.element instanceof HTMLElement&&this.options.element.addEventListener(\"keyup\",this.onInput.bind(this),!0),this.options.elementEnd instanceof HTMLElement&&this.options.elementEnd.addEventListener(\"keyup\",this.onInput.bind(this),!0)):(this.options.element instanceof HTMLElement&&this.options.element.addEventListener(\"change\",this.onInput.bind(this),!0),this.options.elementEnd instanceof HTMLElement&&this.options.elementEnd.addEventListener(\"change\",this.onInput.bind(this),!0)),this.options.parentEl?this.options.parentEl instanceof HTMLElement?this.options.parentEl.appendChild(this.ui):document.querySelector(this.options.parentEl).appendChild(this.ui):this.options.inlineMode?this.options.element instanceof HTMLInputElement?this.options.element.parentNode.appendChild(this.ui):this.options.element.appendChild(this.ui):document.body.appendChild(this.ui),this.updateInput(),this.init(),\"function\"==typeof this.options.setup&&this.options.setup.call(this,this),this.render(),this.options.inlineMode&&this.show()},e.prototype.updateInput=function(){if(this.options.element instanceof HTMLInputElement){var t=this.options.startDate,e=this.options.endDate;if(this.options.singleMode&&t)this.options.element.value=t.format(this.options.format,this.options.lang);else if(!this.options.singleMode&&t&&e){var n=t.format(this.options.format,this.options.lang),i=e.format(this.options.format,this.options.lang);this.options.elementEnd instanceof HTMLInputElement?(this.options.element.value=n,this.options.elementEnd.value=i):this.options.element.value=\"\"+n+this.options.delimiter+i}t||e||(this.options.element.value=\"\",this.options.elementEnd instanceof HTMLInputElement&&(this.options.elementEnd.value=\"\"))}},e.prototype.isSamePicker=function(t){return t.closest(\".\"+h.litepicker)===this.ui},e.prototype.shouldShown=function(t){return!t.disabled&&(t===this.options.element||this.options.elementEnd&&t===this.options.elementEnd)},e.prototype.shouldResetDatePicked=function(){return this.options.singleMode||2===this.datePicked.length},e.prototype.shouldSwapDatePicked=function(){return 2===this.datePicked.length&&this.datePicked[0].getTime()>this.datePicked[1].getTime()},e.prototype.shouldCheckLockDays=function(){return this.options.disallowLockDaysInRange&&2===this.datePicked.length},e.prototype.onClick=function(t){var e=t.target;if(t.target.shadowRoot&&(e=t.composedPath()[0]),e&&this.ui)if(this.shouldShown(e))this.show(e);else if(e.closest(\".\"+h.litepicker)||!this.isShowning()){if(this.isSamePicker(e))if(this.emit(\"before:click\",e),this.preventClick)this.preventClick=!1;else{if(e.classList.contains(h.dayItem)){if(t.preventDefault(),e.classList.contains(h.isLocked))return;if(this.shouldResetDatePicked()&&(this.datePicked.length=0),this.datePicked[this.datePicked.length]=new a.DateTime(e.dataset.time),this.shouldSwapDatePicked()){var n=this.datePicked[1].clone();this.datePicked[1]=this.datePicked[0].clone(),this.datePicked[0]=n.clone()}if(this.shouldCheckLockDays())l.rangeIsLocked(this.datePicked,this.options)&&(this.emit(\"error:range\",this.datePicked),this.datePicked.length=0);return this.render(),this.emit.apply(this,s([\"preselect\"],s(this.datePicked).map((function(t){return t.clone()})))),void(this.options.autoApply&&(this.options.singleMode&&this.datePicked.length?(this.setDate(this.datePicked[0]),this.hide()):this.options.singleMode||2!==this.datePicked.length||(this.setDateRange(this.datePicked[0],this.datePicked[1]),this.hide())))}if(e.classList.contains(h.buttonPreviousMonth)){t.preventDefault();var i=0,o=this.options.switchingMonths||this.options.numberOfMonths;if(this.options.splitView){var r=e.closest(\".\"+h.monthItem);i=l.findNestedMonthItem(r),o=1}return this.calendars[i].setMonth(this.calendars[i].getMonth()-o),this.gotoDate(this.calendars[i],i),void this.emit(\"change:month\",this.calendars[i],i)}if(e.classList.contains(h.buttonNextMonth)){t.preventDefault();i=0,o=this.options.switchingMonths||this.options.numberOfMonths;if(this.options.splitView){r=e.closest(\".\"+h.monthItem);i=l.findNestedMonthItem(r),o=1}return this.calendars[i].setMonth(this.calendars[i].getMonth()+o),this.gotoDate(this.calendars[i],i),void this.emit(\"change:month\",this.calendars[i],i)}e.classList.contains(h.buttonCancel)&&(t.preventDefault(),this.hide(),this.emit(\"button:cancel\")),e.classList.contains(h.buttonApply)&&(t.preventDefault(),this.options.singleMode&&this.datePicked.length?this.setDate(this.datePicked[0]):this.options.singleMode||2!==this.datePicked.length||this.setDateRange(this.datePicked[0],this.datePicked[1]),this.hide(),this.emit(\"button:apply\",this.options.startDate,this.options.endDate))}}else this.hide()},e.prototype.showTooltip=function(t,e){var n=this.ui.querySelector(\".\"+h.containerTooltip);n.style.visibility=\"visible\",n.innerHTML=e;var i=this.ui.getBoundingClientRect(),o=n.getBoundingClientRect(),s=t.getBoundingClientRect(),r=s.top,a=s.left;if(this.options.inlineMode&&this.options.parentEl){var l=this.ui.parentNode.getBoundingClientRect();r-=l.top,a-=l.left}else r-=i.top,a-=i.left;r-=o.height,a-=o.width/2,a+=s.width/2,n.style.top=r+\"px\",n.style.left=a+\"px\",this.emit(\"tooltip\",n,t)},e.prototype.hideTooltip=function(){this.ui.querySelector(\".\"+h.containerTooltip).style.visibility=\"hidden\"},e.prototype.shouldAllowMouseEnter=function(t){return!this.options.singleMode&&!t.classList.contains(h.isLocked)},e.prototype.shouldAllowRepick=function(){return this.options.elementEnd&&this.options.allowRepick&&this.options.startDate&&this.options.endDate},e.prototype.isDayItem=function(t){return t.classList.contains(h.dayItem)},e.prototype.onMouseEnter=function(t){var e=this,n=t.target;if(this.isDayItem(n)&&this.shouldAllowMouseEnter(n)){if(this.shouldAllowRepick()&&(this.triggerElement===this.options.element?this.datePicked[0]=this.options.endDate.clone():this.triggerElement===this.options.elementEnd&&(this.datePicked[0]=this.options.startDate.clone())),1!==this.datePicked.length)return;var i=this.ui.querySelector(\".\"+h.dayItem+'[data-time=\"'+this.datePicked[0].getTime()+'\"]'),o=this.datePicked[0].clone(),s=new a.DateTime(n.dataset.time),r=!1;if(o.getTime()>s.getTime()){var l=o.clone();o=s.clone(),s=l.clone(),r=!0}if(Array.prototype.slice.call(this.ui.querySelectorAll(\".\"+h.dayItem)).forEach((function(t){var n=new a.DateTime(t.dataset.time),i=e.renderDay(n);n.isBetween(o,s)&&i.classList.add(h.isInRange),t.className=i.className})),n.classList.add(h.isEndDate),r?(i&&i.classList.add(h.isFlipped),n.classList.add(h.isFlipped)):(i&&i.classList.remove(h.isFlipped),n.classList.remove(h.isFlipped)),this.options.showTooltip){var p=s.diff(o,\"day\")+1;if(\"function\"==typeof this.options.tooltipNumber&&(p=this.options.tooltipNumber.call(this,p)),p>0){var c=this.pluralSelector(p),d=p+\" \"+(this.options.tooltipText[c]?this.options.tooltipText[c]:\"[\"+c+\"]\");this.showTooltip(n,d);var u=window.navigator.userAgent,m=/(iphone|ipad)/i.test(u),f=/OS 1([0-2])/i.test(u);m&&f&&n.dispatchEvent(new Event(\"click\"))}else this.hideTooltip()}}},e.prototype.onMouseLeave=function(t){t.target;this.options.allowRepick&&(!this.options.allowRepick||this.options.startDate||this.options.endDate)&&(this.datePicked.length=0,this.render())},e.prototype.onInput=function(t){var e=this.parseInput(),n=e[0],i=e[1],o=this.options.format;if(this.options.elementEnd?n instanceof a.DateTime&&i instanceof a.DateTime&&n.format(o)===this.options.element.value&&i.format(o)===this.options.elementEnd.value:this.options.singleMode?n instanceof a.DateTime&&n.format(o)===this.options.element.value:n instanceof a.DateTime&&i instanceof a.DateTime&&\"\"+n.format(o)+this.options.delimiter+i.format(o)===this.options.element.value){if(i&&n.getTime()>i.getTime()){var s=n.clone();n=i.clone(),i=s.clone()}this.options.startDate=new a.DateTime(n,this.options.format,this.options.lang),i&&(this.options.endDate=new a.DateTime(i,this.options.format,this.options.lang)),this.updateInput(),this.render();var r=n.clone(),h=0;(this.options.elementEnd?n.format(o)===t.target.value:t.target.value.startsWith(n.format(o)))||(r=i.clone(),h=this.options.numberOfMonths-1),this.emit(\"selected\",this.getStartDate(),this.getEndDate()),this.gotoDate(r,h)}},e}(r.Calendar);e.Litepicker=p},function(t,e,n){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.findNestedMonthItem=function(t){for(var e=t.parentNode.childNodes,n=0;nv)(u=document.createElement(\"option\")).value=String(t.getFullYear()),u.text=String(t.getFullYear()),u.selected=!0,u.disabled=!0,g.appendChild(u);for(d=v;d>=y;d-=1){var u=document.createElement(\"option\"),D=new r.DateTime(new Date(d,0,1,0,0,0));u.value=String(d),u.text=String(d),u.disabled=this.options.minDate&&D.isBefore(new r.DateTime(this.options.minDate),\"year\")||this.options.maxDate&&D.isAfter(new r.DateTime(this.options.maxDate),\"year\"),u.selected=t.getFullYear()===d,g.appendChild(u)}if(t.getFullYear()W\");for(var L=1;L<=7;L+=1){var E=3+this.options.firstDay+L,S=document.createElement(\"div\");S.innerHTML=this.weekdayName(E),S.title=this.weekdayName(E,\"long\"),b.appendChild(S)}var P=document.createElement(\"div\");P.className=a.containerDays;var x=this.calcSkipDays(i);this.options.showWeekNumbers&&x&&P.appendChild(this.renderWeekNumber(i));for(var I=0;I1&&1===this.datePicked.length){var o=this.options.minDays-1,s=this.datePicked[0].clone().subtract(o,\"day\"),l=this.datePicked[0].clone().add(o,\"day\");t.isBetween(s,this.datePicked[0],\"(]\")&&e.classList.add(a.isLocked),t.isBetween(this.datePicked[0],l,\"[)\")&&e.classList.add(a.isLocked)}if(this.options.maxDays&&1===this.datePicked.length){var p=this.options.maxDays;s=this.datePicked[0].clone().subtract(p,\"day\"),l=this.datePicked[0].clone().add(p,\"day\");t.isSameOrBefore(s)&&e.classList.add(a.isLocked),t.isSameOrAfter(l)&&e.classList.add(a.isLocked)}(this.options.selectForward&&1===this.datePicked.length&&t.isBefore(this.datePicked[0])&&e.classList.add(a.isLocked),this.options.selectBackward&&1===this.datePicked.length&&t.isAfter(this.datePicked[0])&&e.classList.add(a.isLocked),h.dateIsLocked(t,this.options,this.datePicked)&&e.classList.add(a.isLocked),this.options.highlightedDays.length)&&(this.options.highlightedDays.filter((function(e){return e instanceof Array?t.isBetween(e[0],e[1],\"[]\"):e.isSame(t,\"day\")})).length&&e.classList.add(a.isHighlighted));return e.tabIndex=e.classList.contains(\"is-locked\")?-1:0,this.emit(\"render:day\",e,t),e},e.prototype.renderFooter=function(){var t=document.createElement(\"div\");if(t.className=a.containerFooter,this.options.footerHTML?t.innerHTML=this.options.footerHTML:t.innerHTML='\\n \\n \\n \\n \",this.options.singleMode){if(1===this.datePicked.length){var e=this.datePicked[0].format(this.options.format,this.options.lang);t.querySelector(\".\"+a.previewDateRange).innerHTML=e}}else if(1===this.datePicked.length&&t.querySelector(\".\"+a.buttonApply).setAttribute(\"disabled\",\"\"),2===this.datePicked.length){e=this.datePicked[0].format(this.options.format,this.options.lang);var n=this.datePicked[1].format(this.options.format,this.options.lang);t.querySelector(\".\"+a.previewDateRange).innerHTML=\"\"+e+this.options.delimiter+n}return this.emit(\"render:footer\",t),t},e.prototype.renderWeekNumber=function(t){var e=document.createElement(\"div\"),n=t.getWeek(this.options.firstDay);return e.className=a.weekNumber,e.innerHTML=53===n&&0===t.getMonth()?\"53 / 1\":n,e},e.prototype.renderTooltip=function(){var t=document.createElement(\"div\");return t.className=a.containerTooltip,t},e.prototype.weekdayName=function(t,e){return void 0===e&&(e=\"short\"),new Date(1970,0,t,12,0,0,0).toLocaleString(this.options.lang,{weekday:e})},e.prototype.calcSkipDays=function(t){var e=t.getDay()-this.options.firstDay;return e<0&&(e+=7),e},e}(s.LPCore);e.Calendar=l},function(t,e,n){\"use strict\";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),s=this&&this.__assign||function(){return(s=Object.assign||function(t){for(var e,n=1,i=arguments.length;n',nextMonth:'',reset:'\\n \\n \\n '},tooltipText:{one:\"day\",other:\"days\"}},n.options=s(s({},n.options),e.element.dataset),Object.keys(n.options).forEach((function(t){\"true\"!==n.options[t]&&\"false\"!==n.options[t]||(n.options[t]=\"true\"===n.options[t])}));var i=s(s({},n.options.dropdowns),e.dropdowns),o=s(s({},n.options.buttonText),e.buttonText),r=s(s({},n.options.tooltipText),e.tooltipText);n.options=s(s({},n.options),e),n.options.dropdowns=s({},i),n.options.buttonText=s({},o),n.options.tooltipText=s({},r),n.options.elementEnd||(n.options.allowRepick=!1),n.options.lockDays.length&&(n.options.lockDays=a.DateTime.convertArray(n.options.lockDays,n.options.lockDaysFormat)),n.options.highlightedDays.length&&(n.options.highlightedDays=a.DateTime.convertArray(n.options.highlightedDays,n.options.highlightedDaysFormat));var h=n.parseInput(),l=h[0],p=h[1];n.options.startDate&&(n.options.singleMode||n.options.endDate)&&(l=new a.DateTime(n.options.startDate,n.options.format,n.options.lang)),l&&n.options.endDate&&(p=new a.DateTime(n.options.endDate,n.options.format,n.options.lang)),l instanceof a.DateTime&&!isNaN(l.getTime())&&(n.options.startDate=l),n.options.startDate&&p instanceof a.DateTime&&!isNaN(p.getTime())&&(n.options.endDate=p),!n.options.singleMode||n.options.startDate instanceof a.DateTime||(n.options.startDate=null),n.options.singleMode||n.options.startDate instanceof a.DateTime&&n.options.endDate instanceof a.DateTime||(n.options.startDate=null,n.options.endDate=null);for(var c=0;cwindow.innerHeight,l=e.top+s-n.height>=n.height;h&&l&&(r=e.top+s-n.height)}if(/left|right/.test(i[0])||i[1]&&\"auto\"!==i[1]&&/left|right/.test(i[1]))a=/left|right/.test(i[0])?e[i[0]]+o:e[i[1]]+o,\"right\"!==i[0]&&\"right\"!==i[1]||(a-=n.width);else{a=e.left+o;h=e.left+n.width>window.innerWidth;var p=e.right+o-n.width>=0;h&&p&&(a=e.right+o-n.width)}return{left:a,top:r}},e}(r.EventEmitter);e.LPCore=l},function(t,e,n){\"use strict\";var i,o=\"object\"==typeof Reflect?Reflect:null,s=o&&\"function\"==typeof o.apply?o.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};i=o&&\"function\"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var r=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var h=10;function l(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function p(t,e,n,i){var o,s,r,a;if(\"function\"!=typeof n)throw new TypeError('The \"listener\" argument must be of type Function. Received type '+typeof n);if(void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit(\"newListener\",e,n.listener?n.listener:n),s=t._events),r=s[e]),void 0===r)r=s[e]=n,++t._eventsCount;else if(\"function\"==typeof r?r=s[e]=i?[n,r]:[r,n]:i?r.unshift(n):r.push(n),(o=l(t))>0&&r.length>o&&!r.warned){r.warned=!0;var h=new Error(\"Possible EventEmitter memory leak detected. \"+r.length+\" \"+String(e)+\" listeners added. Use emitter.setMaxListeners() to increase limit\");h.name=\"MaxListenersExceededWarning\",h.emitter=t,h.type=e,h.count=r.length,a=h,console&&console.warn&&console.warn(a)}return t}function c(){for(var t=[],e=0;e0&&(r=e[0]),r instanceof Error)throw r;var a=new Error(\"Unhandled error.\"+(r?\" (\"+r.message+\")\":\"\"));throw a.context=r,a}var h=o[t];if(void 0===h)return!1;if(\"function\"==typeof h)s(h,this,e);else{var l=h.length,p=f(h,l);for(n=0;n=0;s--)if(n[s]===e||n[s].listener===e){r=n[s].listener,o=s;break}if(o<0)return this;0===o?n.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},a.prototype.listeners=function(t){return u(this,t,!0)},a.prototype.rawListeners=function(t){return u(this,t,!1)},a.listenerCount=function(t,e){return\"function\"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,n){\"use strict\";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;nthis.options.endDate.getTime()&&(this.options.endDate=this.options.startDate.clone(),this.options.startDate=new o.DateTime(t,this.options.format,this.options.lang)),this.updateInput())},s.Litepicker.prototype.setDateRange=function(t,e,n){void 0===n&&(n=!1),this.triggerElement=void 0;var i=new o.DateTime(t,this.options.format,this.options.lang),s=new o.DateTime(e,this.options.format,this.options.lang);(this.options.disallowLockDaysInRange?r.rangeIsLocked([i,s],this.options):r.dateIsLocked(i,this.options,[i,s])||r.dateIsLocked(s,this.options,[i,s]))&&!n?this.emit(\"error:range\",[i,s]):(this.setStartDate(i),this.setEndDate(s),this.options.inlineMode&&this.render(),this.updateInput(),this.emit(\"selected\",this.getStartDate(),this.getEndDate()))},s.Litepicker.prototype.gotoDate=function(t,e){void 0===e&&(e=0);var n=new o.DateTime(t);n.setDate(1),this.calendars[e]=n.clone(),this.render()},s.Litepicker.prototype.setLockDays=function(t){this.options.lockDays=o.DateTime.convertArray(t,this.options.lockDaysFormat),this.render()},s.Litepicker.prototype.setHighlightedDays=function(t){this.options.highlightedDays=o.DateTime.convertArray(t,this.options.highlightedDaysFormat),this.render()},s.Litepicker.prototype.setOptions=function(t){delete t.element,delete t.elementEnd,delete t.parentEl,t.startDate&&(t.startDate=new o.DateTime(t.startDate,this.options.format,this.options.lang)),t.endDate&&(t.endDate=new o.DateTime(t.endDate,this.options.format,this.options.lang));var e=i(i({},this.options.dropdowns),t.dropdowns),n=i(i({},this.options.buttonText),t.buttonText),s=i(i({},this.options.tooltipText),t.tooltipText);this.options=i(i({},this.options),t),this.options.dropdowns=i({},e),this.options.buttonText=i({},n),this.options.tooltipText=i({},s),!this.options.singleMode||this.options.startDate instanceof o.DateTime||(this.options.startDate=null,this.options.endDate=null),this.options.singleMode||this.options.startDate instanceof o.DateTime&&this.options.endDate instanceof o.DateTime||(this.options.startDate=null,this.options.endDate=null);for(var r=0;r${tour} : ${heading}`\n\n const imgIntro = document.createElement(\"div\")\n imgIntro.className = \"img-intro\"\n const img = document.createElement(\"img\")\n img.src = imgSrc\n img.alt = tour\n\n imgIntro.appendChild(img)\n content.appendChild(headingDiv)\n content.appendChild(imgIntro)\n panel.appendChild(content)\n\n return panel\n}\n\nmodule.exports = { createPanel }\n", "function createContent(number, textTitle, description, gif) {\n const contentDiv = document.createElement(\"div\")\n contentDiv.className = \"content\";\n\n const imgGifDiv = document.createElement(\"div\")\n imgGifDiv.className = \"img-gif\"\n const imgElement = document.createElement(\"img\")\n imgElement.src = gif\n imgElement.alt = number\n imgGifDiv.appendChild(imgElement)\n\n const titleDiv = document.createElement(\"div\")\n titleDiv.className = \"title\"\n titleDiv.innerHTML = `${number} : ${textTitle}`\n\n const detailsDiv = document.createElement(\"div\")\n detailsDiv.className = \"details\";\n detailsDiv.textContent = description\n\n contentDiv.appendChild(imgGifDiv)\n contentDiv.appendChild(titleDiv)\n contentDiv.appendChild(detailsDiv)\n\n return contentDiv\n}\n\nmodule.exports = { createContent }\n", "(typeof document !== \"undefined\") && (typeof navigator !== \"undefined\") && (function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.lottie = factory());\n})(this, (function () { 'use strict';\n\n var svgNS = 'http://www.w3.org/2000/svg';\n var locationHref = '';\n var _useWebWorker = false;\n var initialDefaultFrame = -999999;\n var setWebWorker = function setWebWorker(flag) {\n _useWebWorker = !!flag;\n };\n var getWebWorker = function getWebWorker() {\n return _useWebWorker;\n };\n var setLocationHref = function setLocationHref(value) {\n locationHref = value;\n };\n var getLocationHref = function getLocationHref() {\n return locationHref;\n };\n\n function createTag(type) {\n // return {appendChild:function(){},setAttribute:function(){},style:{}}\n return document.createElement(type);\n }\n\n function extendPrototype(sources, destination) {\n var i;\n var len = sources.length;\n var sourcePrototype;\n for (i = 0; i < len; i += 1) {\n sourcePrototype = sources[i].prototype;\n for (var attr in sourcePrototype) {\n if (Object.prototype.hasOwnProperty.call(sourcePrototype, attr)) destination.prototype[attr] = sourcePrototype[attr];\n }\n }\n }\n function getDescriptor(object, prop) {\n return Object.getOwnPropertyDescriptor(object, prop);\n }\n function createProxyFunction(prototype) {\n function ProxyFunction() {}\n ProxyFunction.prototype = prototype;\n return ProxyFunction;\n }\n\n // import Howl from '../../3rd_party/howler';\n\n var audioControllerFactory = function () {\n function AudioController(audioFactory) {\n this.audios = [];\n this.audioFactory = audioFactory;\n this._volume = 1;\n this._isMuted = false;\n }\n AudioController.prototype = {\n addAudio: function addAudio(audio) {\n this.audios.push(audio);\n },\n pause: function pause() {\n var i;\n var len = this.audios.length;\n for (i = 0; i < len; i += 1) {\n this.audios[i].pause();\n }\n },\n resume: function resume() {\n var i;\n var len = this.audios.length;\n for (i = 0; i < len; i += 1) {\n this.audios[i].resume();\n }\n },\n setRate: function setRate(rateValue) {\n var i;\n var len = this.audios.length;\n for (i = 0; i < len; i += 1) {\n this.audios[i].setRate(rateValue);\n }\n },\n createAudio: function createAudio(assetPath) {\n if (this.audioFactory) {\n return this.audioFactory(assetPath);\n }\n if (window.Howl) {\n return new window.Howl({\n src: [assetPath]\n });\n }\n return {\n isPlaying: false,\n play: function play() {\n this.isPlaying = true;\n },\n seek: function seek() {\n this.isPlaying = false;\n },\n playing: function playing() {},\n rate: function rate() {},\n setVolume: function setVolume() {}\n };\n },\n setAudioFactory: function setAudioFactory(audioFactory) {\n this.audioFactory = audioFactory;\n },\n setVolume: function setVolume(value) {\n this._volume = value;\n this._updateVolume();\n },\n mute: function mute() {\n this._isMuted = true;\n this._updateVolume();\n },\n unmute: function unmute() {\n this._isMuted = false;\n this._updateVolume();\n },\n getVolume: function getVolume() {\n return this._volume;\n },\n _updateVolume: function _updateVolume() {\n var i;\n var len = this.audios.length;\n for (i = 0; i < len; i += 1) {\n this.audios[i].volume(this._volume * (this._isMuted ? 0 : 1));\n }\n }\n };\n return function () {\n return new AudioController();\n };\n }();\n\n var createTypedArray = function () {\n function createRegularArray(type, len) {\n var i = 0;\n var arr = [];\n var value;\n switch (type) {\n case 'int16':\n case 'uint8c':\n value = 1;\n break;\n default:\n value = 1.1;\n break;\n }\n for (i = 0; i < len; i += 1) {\n arr.push(value);\n }\n return arr;\n }\n function createTypedArrayFactory(type, len) {\n if (type === 'float32') {\n return new Float32Array(len);\n }\n if (type === 'int16') {\n return new Int16Array(len);\n }\n if (type === 'uint8c') {\n return new Uint8ClampedArray(len);\n }\n return createRegularArray(type, len);\n }\n if (typeof Uint8ClampedArray === 'function' && typeof Float32Array === 'function') {\n return createTypedArrayFactory;\n }\n return createRegularArray;\n }();\n function createSizedArray(len) {\n return Array.apply(null, {\n length: len\n });\n }\n\n function _typeof$6(o) { \"@babel/helpers - typeof\"; return _typeof$6 = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof$6(o); }\n var subframeEnabled = true;\n var expressionsPlugin = null;\n var expressionsInterfaces = null;\n var idPrefix$1 = '';\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n var _shouldRoundValues = false;\n var bmPow = Math.pow;\n var bmSqrt = Math.sqrt;\n var bmFloor = Math.floor;\n var bmMax = Math.max;\n var bmMin = Math.min;\n var BMMath = {};\n (function () {\n var propertyNames = ['abs', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atanh', 'atan2', 'ceil', 'cbrt', 'expm1', 'clz32', 'cos', 'cosh', 'exp', 'floor', 'fround', 'hypot', 'imul', 'log', 'log1p', 'log2', 'log10', 'max', 'min', 'pow', 'random', 'round', 'sign', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'E', 'LN10', 'LN2', 'LOG10E', 'LOG2E', 'PI', 'SQRT1_2', 'SQRT2'];\n var i;\n var len = propertyNames.length;\n for (i = 0; i < len; i += 1) {\n BMMath[propertyNames[i]] = Math[propertyNames[i]];\n }\n })();\n function ProjectInterface$1() {\n return {};\n }\n BMMath.random = Math.random;\n BMMath.abs = function (val) {\n var tOfVal = _typeof$6(val);\n if (tOfVal === 'object' && val.length) {\n var absArr = createSizedArray(val.length);\n var i;\n var len = val.length;\n for (i = 0; i < len; i += 1) {\n absArr[i] = Math.abs(val[i]);\n }\n return absArr;\n }\n return Math.abs(val);\n };\n var defaultCurveSegments = 150;\n var degToRads = Math.PI / 180;\n var roundCorner = 0.5519;\n function roundValues(flag) {\n _shouldRoundValues = !!flag;\n }\n function bmRnd(value) {\n if (_shouldRoundValues) {\n return Math.round(value);\n }\n return value;\n }\n function styleDiv(element) {\n element.style.position = 'absolute';\n element.style.top = 0;\n element.style.left = 0;\n element.style.display = 'block';\n element.style.transformOrigin = '0 0';\n element.style.webkitTransformOrigin = '0 0';\n element.style.backfaceVisibility = 'visible';\n element.style.webkitBackfaceVisibility = 'visible';\n element.style.transformStyle = 'preserve-3d';\n element.style.webkitTransformStyle = 'preserve-3d';\n element.style.mozTransformStyle = 'preserve-3d';\n }\n function BMEnterFrameEvent(type, currentTime, totalTime, frameMultiplier) {\n this.type = type;\n this.currentTime = currentTime;\n this.totalTime = totalTime;\n this.direction = frameMultiplier < 0 ? -1 : 1;\n }\n function BMCompleteEvent(type, frameMultiplier) {\n this.type = type;\n this.direction = frameMultiplier < 0 ? -1 : 1;\n }\n function BMCompleteLoopEvent(type, totalLoops, currentLoop, frameMultiplier) {\n this.type = type;\n this.currentLoop = currentLoop;\n this.totalLoops = totalLoops;\n this.direction = frameMultiplier < 0 ? -1 : 1;\n }\n function BMSegmentStartEvent(type, firstFrame, totalFrames) {\n this.type = type;\n this.firstFrame = firstFrame;\n this.totalFrames = totalFrames;\n }\n function BMDestroyEvent(type, target) {\n this.type = type;\n this.target = target;\n }\n function BMRenderFrameErrorEvent(nativeError, currentTime) {\n this.type = 'renderFrameError';\n this.nativeError = nativeError;\n this.currentTime = currentTime;\n }\n function BMConfigErrorEvent(nativeError) {\n this.type = 'configError';\n this.nativeError = nativeError;\n }\n function BMAnimationConfigErrorEvent(type, nativeError) {\n this.type = type;\n this.nativeError = nativeError;\n }\n var createElementID = function () {\n var _count = 0;\n return function createID() {\n _count += 1;\n return idPrefix$1 + '__lottie_element_' + _count;\n };\n }();\n function HSVtoRGB(h, s, v) {\n var r;\n var g;\n var b;\n var i;\n var f;\n var p;\n var q;\n var t;\n i = Math.floor(h * 6);\n f = h * 6 - i;\n p = v * (1 - s);\n q = v * (1 - f * s);\n t = v * (1 - (1 - f) * s);\n switch (i % 6) {\n case 0:\n r = v;\n g = t;\n b = p;\n break;\n case 1:\n r = q;\n g = v;\n b = p;\n break;\n case 2:\n r = p;\n g = v;\n b = t;\n break;\n case 3:\n r = p;\n g = q;\n b = v;\n break;\n case 4:\n r = t;\n g = p;\n b = v;\n break;\n case 5:\n r = v;\n g = p;\n b = q;\n break;\n default:\n break;\n }\n return [r, g, b];\n }\n function RGBtoHSV(r, g, b) {\n var max = Math.max(r, g, b);\n var min = Math.min(r, g, b);\n var d = max - min;\n var h;\n var s = max === 0 ? 0 : d / max;\n var v = max / 255;\n switch (max) {\n case min:\n h = 0;\n break;\n case r:\n h = g - b + d * (g < b ? 6 : 0);\n h /= 6 * d;\n break;\n case g:\n h = b - r + d * 2;\n h /= 6 * d;\n break;\n case b:\n h = r - g + d * 4;\n h /= 6 * d;\n break;\n default:\n break;\n }\n return [h, s, v];\n }\n function addSaturationToRGB(color, offset) {\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);\n hsv[1] += offset;\n if (hsv[1] > 1) {\n hsv[1] = 1;\n } else if (hsv[1] <= 0) {\n hsv[1] = 0;\n }\n return HSVtoRGB(hsv[0], hsv[1], hsv[2]);\n }\n function addBrightnessToRGB(color, offset) {\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);\n hsv[2] += offset;\n if (hsv[2] > 1) {\n hsv[2] = 1;\n } else if (hsv[2] < 0) {\n hsv[2] = 0;\n }\n return HSVtoRGB(hsv[0], hsv[1], hsv[2]);\n }\n function addHueToRGB(color, offset) {\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);\n hsv[0] += offset / 360;\n if (hsv[0] > 1) {\n hsv[0] -= 1;\n } else if (hsv[0] < 0) {\n hsv[0] += 1;\n }\n return HSVtoRGB(hsv[0], hsv[1], hsv[2]);\n }\n var rgbToHex = function () {\n var colorMap = [];\n var i;\n var hex;\n for (i = 0; i < 256; i += 1) {\n hex = i.toString(16);\n colorMap[i] = hex.length === 1 ? '0' + hex : hex;\n }\n return function (r, g, b) {\n if (r < 0) {\n r = 0;\n }\n if (g < 0) {\n g = 0;\n }\n if (b < 0) {\n b = 0;\n }\n return '#' + colorMap[r] + colorMap[g] + colorMap[b];\n };\n }();\n var setSubframeEnabled = function setSubframeEnabled(flag) {\n subframeEnabled = !!flag;\n };\n var getSubframeEnabled = function getSubframeEnabled() {\n return subframeEnabled;\n };\n var setExpressionsPlugin = function setExpressionsPlugin(value) {\n expressionsPlugin = value;\n };\n var getExpressionsPlugin = function getExpressionsPlugin() {\n return expressionsPlugin;\n };\n var setExpressionInterfaces = function setExpressionInterfaces(value) {\n expressionsInterfaces = value;\n };\n var getExpressionInterfaces = function getExpressionInterfaces() {\n return expressionsInterfaces;\n };\n var setDefaultCurveSegments = function setDefaultCurveSegments(value) {\n defaultCurveSegments = value;\n };\n var getDefaultCurveSegments = function getDefaultCurveSegments() {\n return defaultCurveSegments;\n };\n var setIdPrefix = function setIdPrefix(value) {\n idPrefix$1 = value;\n };\n var getIdPrefix = function getIdPrefix() {\n return idPrefix$1;\n };\n\n function createNS(type) {\n // return {appendChild:function(){},setAttribute:function(){},style:{}}\n return document.createElementNS(svgNS, type);\n }\n\n function _typeof$5(o) { \"@babel/helpers - typeof\"; return _typeof$5 = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof$5(o); }\n var dataManager = function () {\n var _counterId = 1;\n var processes = [];\n var workerFn;\n var workerInstance;\n var workerProxy = {\n onmessage: function onmessage() {},\n postMessage: function postMessage(path) {\n workerFn({\n data: path\n });\n }\n };\n var _workerSelf = {\n postMessage: function postMessage(data) {\n workerProxy.onmessage({\n data: data\n });\n }\n };\n function createWorker(fn) {\n if (window.Worker && window.Blob && getWebWorker()) {\n var blob = new Blob(['var _workerSelf = self; self.onmessage = ', fn.toString()], {\n type: 'text/javascript'\n });\n // var blob = new Blob(['self.onmessage = ', fn.toString()], { type: 'text/javascript' });\n var url = URL.createObjectURL(blob);\n return new Worker(url);\n }\n workerFn = fn;\n return workerProxy;\n }\n function setupWorker() {\n if (!workerInstance) {\n workerInstance = createWorker(function workerStart(e) {\n function dataFunctionManager() {\n function completeLayers(layers, comps) {\n var layerData;\n var i;\n var len = layers.length;\n var j;\n var jLen;\n var k;\n var kLen;\n for (i = 0; i < len; i += 1) {\n layerData = layers[i];\n if ('ks' in layerData && !layerData.completed) {\n layerData.completed = true;\n if (layerData.hasMask) {\n var maskProps = layerData.masksProperties;\n jLen = maskProps.length;\n for (j = 0; j < jLen; j += 1) {\n if (maskProps[j].pt.k.i) {\n convertPathsToAbsoluteValues(maskProps[j].pt.k);\n } else {\n kLen = maskProps[j].pt.k.length;\n for (k = 0; k < kLen; k += 1) {\n if (maskProps[j].pt.k[k].s) {\n convertPathsToAbsoluteValues(maskProps[j].pt.k[k].s[0]);\n }\n if (maskProps[j].pt.k[k].e) {\n convertPathsToAbsoluteValues(maskProps[j].pt.k[k].e[0]);\n }\n }\n }\n }\n }\n if (layerData.ty === 0) {\n layerData.layers = findCompLayers(layerData.refId, comps);\n completeLayers(layerData.layers, comps);\n } else if (layerData.ty === 4) {\n completeShapes(layerData.shapes);\n } else if (layerData.ty === 5) {\n completeText(layerData);\n }\n }\n }\n }\n function completeChars(chars, assets) {\n if (chars) {\n var i = 0;\n var len = chars.length;\n for (i = 0; i < len; i += 1) {\n if (chars[i].t === 1) {\n // var compData = findComp(chars[i].data.refId, assets);\n chars[i].data.layers = findCompLayers(chars[i].data.refId, assets);\n // chars[i].data.ip = 0;\n // chars[i].data.op = 99999;\n // chars[i].data.st = 0;\n // chars[i].data.sr = 1;\n // chars[i].w = compData.w;\n // chars[i].data.ks = {\n // a: { k: [0, 0, 0], a: 0 },\n // p: { k: [0, -compData.h, 0], a: 0 },\n // r: { k: 0, a: 0 },\n // s: { k: [100, 100], a: 0 },\n // o: { k: 100, a: 0 },\n // };\n completeLayers(chars[i].data.layers, assets);\n }\n }\n }\n }\n function findComp(id, comps) {\n var i = 0;\n var len = comps.length;\n while (i < len) {\n if (comps[i].id === id) {\n return comps[i];\n }\n i += 1;\n }\n return null;\n }\n function findCompLayers(id, comps) {\n var comp = findComp(id, comps);\n if (comp) {\n if (!comp.layers.__used) {\n comp.layers.__used = true;\n return comp.layers;\n }\n return JSON.parse(JSON.stringify(comp.layers));\n }\n return null;\n }\n function completeShapes(arr) {\n var i;\n var len = arr.length;\n var j;\n var jLen;\n for (i = len - 1; i >= 0; i -= 1) {\n if (arr[i].ty === 'sh') {\n if (arr[i].ks.k.i) {\n convertPathsToAbsoluteValues(arr[i].ks.k);\n } else {\n jLen = arr[i].ks.k.length;\n for (j = 0; j < jLen; j += 1) {\n if (arr[i].ks.k[j].s) {\n convertPathsToAbsoluteValues(arr[i].ks.k[j].s[0]);\n }\n if (arr[i].ks.k[j].e) {\n convertPathsToAbsoluteValues(arr[i].ks.k[j].e[0]);\n }\n }\n }\n } else if (arr[i].ty === 'gr') {\n completeShapes(arr[i].it);\n }\n }\n }\n function convertPathsToAbsoluteValues(path) {\n var i;\n var len = path.i.length;\n for (i = 0; i < len; i += 1) {\n path.i[i][0] += path.v[i][0];\n path.i[i][1] += path.v[i][1];\n path.o[i][0] += path.v[i][0];\n path.o[i][1] += path.v[i][1];\n }\n }\n function checkVersion(minimum, animVersionString) {\n var animVersion = animVersionString ? animVersionString.split('.') : [100, 100, 100];\n if (minimum[0] > animVersion[0]) {\n return true;\n }\n if (animVersion[0] > minimum[0]) {\n return false;\n }\n if (minimum[1] > animVersion[1]) {\n return true;\n }\n if (animVersion[1] > minimum[1]) {\n return false;\n }\n if (minimum[2] > animVersion[2]) {\n return true;\n }\n if (animVersion[2] > minimum[2]) {\n return false;\n }\n return null;\n }\n var checkText = function () {\n var minimumVersion = [4, 4, 14];\n function updateTextLayer(textLayer) {\n var documentData = textLayer.t.d;\n textLayer.t.d = {\n k: [{\n s: documentData,\n t: 0\n }]\n };\n }\n function iterateLayers(layers) {\n var i;\n var len = layers.length;\n for (i = 0; i < len; i += 1) {\n if (layers[i].ty === 5) {\n updateTextLayer(layers[i]);\n }\n }\n }\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers);\n if (animationData.assets) {\n var i;\n var len = animationData.assets.length;\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers);\n }\n }\n }\n }\n };\n }();\n var checkChars = function () {\n var minimumVersion = [4, 7, 99];\n return function (animationData) {\n if (animationData.chars && !checkVersion(minimumVersion, animationData.v)) {\n var i;\n var len = animationData.chars.length;\n for (i = 0; i < len; i += 1) {\n var charData = animationData.chars[i];\n if (charData.data && charData.data.shapes) {\n completeShapes(charData.data.shapes);\n charData.data.ip = 0;\n charData.data.op = 99999;\n charData.data.st = 0;\n charData.data.sr = 1;\n charData.data.ks = {\n p: {\n k: [0, 0],\n a: 0\n },\n s: {\n k: [100, 100],\n a: 0\n },\n a: {\n k: [0, 0],\n a: 0\n },\n r: {\n k: 0,\n a: 0\n },\n o: {\n k: 100,\n a: 0\n }\n };\n if (!animationData.chars[i].t) {\n charData.data.shapes.push({\n ty: 'no'\n });\n charData.data.shapes[0].it.push({\n p: {\n k: [0, 0],\n a: 0\n },\n s: {\n k: [100, 100],\n a: 0\n },\n a: {\n k: [0, 0],\n a: 0\n },\n r: {\n k: 0,\n a: 0\n },\n o: {\n k: 100,\n a: 0\n },\n sk: {\n k: 0,\n a: 0\n },\n sa: {\n k: 0,\n a: 0\n },\n ty: 'tr'\n });\n }\n }\n }\n }\n };\n }();\n var checkPathProperties = function () {\n var minimumVersion = [5, 7, 15];\n function updateTextLayer(textLayer) {\n var pathData = textLayer.t.p;\n if (typeof pathData.a === 'number') {\n pathData.a = {\n a: 0,\n k: pathData.a\n };\n }\n if (typeof pathData.p === 'number') {\n pathData.p = {\n a: 0,\n k: pathData.p\n };\n }\n if (typeof pathData.r === 'number') {\n pathData.r = {\n a: 0,\n k: pathData.r\n };\n }\n }\n function iterateLayers(layers) {\n var i;\n var len = layers.length;\n for (i = 0; i < len; i += 1) {\n if (layers[i].ty === 5) {\n updateTextLayer(layers[i]);\n }\n }\n }\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers);\n if (animationData.assets) {\n var i;\n var len = animationData.assets.length;\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers);\n }\n }\n }\n }\n };\n }();\n var checkColors = function () {\n var minimumVersion = [4, 1, 9];\n function iterateShapes(shapes) {\n var i;\n var len = shapes.length;\n var j;\n var jLen;\n for (i = 0; i < len; i += 1) {\n if (shapes[i].ty === 'gr') {\n iterateShapes(shapes[i].it);\n } else if (shapes[i].ty === 'fl' || shapes[i].ty === 'st') {\n if (shapes[i].c.k && shapes[i].c.k[0].i) {\n jLen = shapes[i].c.k.length;\n for (j = 0; j < jLen; j += 1) {\n if (shapes[i].c.k[j].s) {\n shapes[i].c.k[j].s[0] /= 255;\n shapes[i].c.k[j].s[1] /= 255;\n shapes[i].c.k[j].s[2] /= 255;\n shapes[i].c.k[j].s[3] /= 255;\n }\n if (shapes[i].c.k[j].e) {\n shapes[i].c.k[j].e[0] /= 255;\n shapes[i].c.k[j].e[1] /= 255;\n shapes[i].c.k[j].e[2] /= 255;\n shapes[i].c.k[j].e[3] /= 255;\n }\n }\n } else {\n shapes[i].c.k[0] /= 255;\n shapes[i].c.k[1] /= 255;\n shapes[i].c.k[2] /= 255;\n shapes[i].c.k[3] /= 255;\n }\n }\n }\n }\n function iterateLayers(layers) {\n var i;\n var len = layers.length;\n for (i = 0; i < len; i += 1) {\n if (layers[i].ty === 4) {\n iterateShapes(layers[i].shapes);\n }\n }\n }\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers);\n if (animationData.assets) {\n var i;\n var len = animationData.assets.length;\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers);\n }\n }\n }\n }\n };\n }();\n var checkShapes = function () {\n var minimumVersion = [4, 4, 18];\n function completeClosingShapes(arr) {\n var i;\n var len = arr.length;\n var j;\n var jLen;\n for (i = len - 1; i >= 0; i -= 1) {\n if (arr[i].ty === 'sh') {\n if (arr[i].ks.k.i) {\n arr[i].ks.k.c = arr[i].closed;\n } else {\n jLen = arr[i].ks.k.length;\n for (j = 0; j < jLen; j += 1) {\n if (arr[i].ks.k[j].s) {\n arr[i].ks.k[j].s[0].c = arr[i].closed;\n }\n if (arr[i].ks.k[j].e) {\n arr[i].ks.k[j].e[0].c = arr[i].closed;\n }\n }\n }\n } else if (arr[i].ty === 'gr') {\n completeClosingShapes(arr[i].it);\n }\n }\n }\n function iterateLayers(layers) {\n var layerData;\n var i;\n var len = layers.length;\n var j;\n var jLen;\n var k;\n var kLen;\n for (i = 0; i < len; i += 1) {\n layerData = layers[i];\n if (layerData.hasMask) {\n var maskProps = layerData.masksProperties;\n jLen = maskProps.length;\n for (j = 0; j < jLen; j += 1) {\n if (maskProps[j].pt.k.i) {\n maskProps[j].pt.k.c = maskProps[j].cl;\n } else {\n kLen = maskProps[j].pt.k.length;\n for (k = 0; k < kLen; k += 1) {\n if (maskProps[j].pt.k[k].s) {\n maskProps[j].pt.k[k].s[0].c = maskProps[j].cl;\n }\n if (maskProps[j].pt.k[k].e) {\n maskProps[j].pt.k[k].e[0].c = maskProps[j].cl;\n }\n }\n }\n }\n }\n if (layerData.ty === 4) {\n completeClosingShapes(layerData.shapes);\n }\n }\n }\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers);\n if (animationData.assets) {\n var i;\n var len = animationData.assets.length;\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers);\n }\n }\n }\n }\n };\n }();\n function completeData(animationData) {\n if (animationData.__complete) {\n return;\n }\n checkColors(animationData);\n checkText(animationData);\n checkChars(animationData);\n checkPathProperties(animationData);\n checkShapes(animationData);\n completeLayers(animationData.layers, animationData.assets);\n completeChars(animationData.chars, animationData.assets);\n animationData.__complete = true;\n }\n function completeText(data) {\n if (data.t.a.length === 0 && !('m' in data.t.p)) {\n // data.singleShape = true;\n }\n }\n var moduleOb = {};\n moduleOb.completeData = completeData;\n moduleOb.checkColors = checkColors;\n moduleOb.checkChars = checkChars;\n moduleOb.checkPathProperties = checkPathProperties;\n moduleOb.checkShapes = checkShapes;\n moduleOb.completeLayers = completeLayers;\n return moduleOb;\n }\n if (!_workerSelf.dataManager) {\n _workerSelf.dataManager = dataFunctionManager();\n }\n if (!_workerSelf.assetLoader) {\n _workerSelf.assetLoader = function () {\n function formatResponse(xhr) {\n // using typeof doubles the time of execution of this method,\n // so if available, it's better to use the header to validate the type\n var contentTypeHeader = xhr.getResponseHeader('content-type');\n if (contentTypeHeader && xhr.responseType === 'json' && contentTypeHeader.indexOf('json') !== -1) {\n return xhr.response;\n }\n if (xhr.response && _typeof$5(xhr.response) === 'object') {\n return xhr.response;\n }\n if (xhr.response && typeof xhr.response === 'string') {\n return JSON.parse(xhr.response);\n }\n if (xhr.responseText) {\n return JSON.parse(xhr.responseText);\n }\n return null;\n }\n function loadAsset(path, fullPath, callback, errorCallback) {\n var response;\n var xhr = new XMLHttpRequest();\n // set responseType after calling open or IE will break.\n try {\n // This crashes on Android WebView prior to KitKat\n xhr.responseType = 'json';\n } catch (err) {} // eslint-disable-line no-empty\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n if (xhr.status === 200) {\n response = formatResponse(xhr);\n callback(response);\n } else {\n try {\n response = formatResponse(xhr);\n callback(response);\n } catch (err) {\n if (errorCallback) {\n errorCallback(err);\n }\n }\n }\n }\n };\n try {\n // Hack to workaround banner validation\n xhr.open(['G', 'E', 'T'].join(''), path, true);\n } catch (error) {\n // Hack to workaround banner validation\n xhr.open(['G', 'E', 'T'].join(''), fullPath + '/' + path, true);\n }\n xhr.send();\n }\n return {\n load: loadAsset\n };\n }();\n }\n if (e.data.type === 'loadAnimation') {\n _workerSelf.assetLoader.load(e.data.path, e.data.fullPath, function (data) {\n _workerSelf.dataManager.completeData(data);\n _workerSelf.postMessage({\n id: e.data.id,\n payload: data,\n status: 'success'\n });\n }, function () {\n _workerSelf.postMessage({\n id: e.data.id,\n status: 'error'\n });\n });\n } else if (e.data.type === 'complete') {\n var animation = e.data.animation;\n _workerSelf.dataManager.completeData(animation);\n _workerSelf.postMessage({\n id: e.data.id,\n payload: animation,\n status: 'success'\n });\n } else if (e.data.type === 'loadData') {\n _workerSelf.assetLoader.load(e.data.path, e.data.fullPath, function (data) {\n _workerSelf.postMessage({\n id: e.data.id,\n payload: data,\n status: 'success'\n });\n }, function () {\n _workerSelf.postMessage({\n id: e.data.id,\n status: 'error'\n });\n });\n }\n });\n workerInstance.onmessage = function (event) {\n var data = event.data;\n var id = data.id;\n var process = processes[id];\n processes[id] = null;\n if (data.status === 'success') {\n process.onComplete(data.payload);\n } else if (process.onError) {\n process.onError();\n }\n };\n }\n }\n function createProcess(onComplete, onError) {\n _counterId += 1;\n var id = 'processId_' + _counterId;\n processes[id] = {\n onComplete: onComplete,\n onError: onError\n };\n return id;\n }\n function loadAnimation(path, onComplete, onError) {\n setupWorker();\n var processId = createProcess(onComplete, onError);\n workerInstance.postMessage({\n type: 'loadAnimation',\n path: path,\n fullPath: window.location.origin + window.location.pathname,\n id: processId\n });\n }\n function loadData(path, onComplete, onError) {\n setupWorker();\n var processId = createProcess(onComplete, onError);\n workerInstance.postMessage({\n type: 'loadData',\n path: path,\n fullPath: window.location.origin + window.location.pathname,\n id: processId\n });\n }\n function completeAnimation(anim, onComplete, onError) {\n setupWorker();\n var processId = createProcess(onComplete, onError);\n workerInstance.postMessage({\n type: 'complete',\n animation: anim,\n id: processId\n });\n }\n return {\n loadAnimation: loadAnimation,\n loadData: loadData,\n completeAnimation: completeAnimation\n };\n }();\n\n var ImagePreloader = function () {\n var proxyImage = function () {\n var canvas = createTag('canvas');\n canvas.width = 1;\n canvas.height = 1;\n var ctx = canvas.getContext('2d');\n ctx.fillStyle = 'rgba(0,0,0,0)';\n ctx.fillRect(0, 0, 1, 1);\n return canvas;\n }();\n function imageLoaded() {\n this.loadedAssets += 1;\n if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {\n if (this.imagesLoadedCb) {\n this.imagesLoadedCb(null);\n }\n }\n }\n function footageLoaded() {\n this.loadedFootagesCount += 1;\n if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {\n if (this.imagesLoadedCb) {\n this.imagesLoadedCb(null);\n }\n }\n }\n function getAssetsPath(assetData, assetsPath, originalPath) {\n var path = '';\n if (assetData.e) {\n path = assetData.p;\n } else if (assetsPath) {\n var imagePath = assetData.p;\n if (imagePath.indexOf('images/') !== -1) {\n imagePath = imagePath.split('/')[1];\n }\n path = assetsPath + imagePath;\n } else {\n path = originalPath;\n path += assetData.u ? assetData.u : '';\n path += assetData.p;\n }\n return path;\n }\n function testImageLoaded(img) {\n var _count = 0;\n var intervalId = setInterval(function () {\n var box = img.getBBox();\n if (box.width || _count > 500) {\n this._imageLoaded();\n clearInterval(intervalId);\n }\n _count += 1;\n }.bind(this), 50);\n }\n function createImageData(assetData) {\n var path = getAssetsPath(assetData, this.assetsPath, this.path);\n var img = createNS('image');\n if (isSafari) {\n this.testImageLoaded(img);\n } else {\n img.addEventListener('load', this._imageLoaded, false);\n }\n img.addEventListener('error', function () {\n ob.img = proxyImage;\n this._imageLoaded();\n }.bind(this), false);\n img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path);\n if (this._elementHelper.append) {\n this._elementHelper.append(img);\n } else {\n this._elementHelper.appendChild(img);\n }\n var ob = {\n img: img,\n assetData: assetData\n };\n return ob;\n }\n function createImgData(assetData) {\n var path = getAssetsPath(assetData, this.assetsPath, this.path);\n var img = createTag('img');\n img.crossOrigin = 'anonymous';\n img.addEventListener('load', this._imageLoaded, false);\n img.addEventListener('error', function () {\n ob.img = proxyImage;\n this._imageLoaded();\n }.bind(this), false);\n img.src = path;\n var ob = {\n img: img,\n assetData: assetData\n };\n return ob;\n }\n function createFootageData(data) {\n var ob = {\n assetData: data\n };\n var path = getAssetsPath(data, this.assetsPath, this.path);\n dataManager.loadData(path, function (footageData) {\n ob.img = footageData;\n this._footageLoaded();\n }.bind(this), function () {\n ob.img = {};\n this._footageLoaded();\n }.bind(this));\n return ob;\n }\n function loadAssets(assets, cb) {\n this.imagesLoadedCb = cb;\n var i;\n var len = assets.length;\n for (i = 0; i < len; i += 1) {\n if (!assets[i].layers) {\n if (!assets[i].t || assets[i].t === 'seq') {\n this.totalImages += 1;\n this.images.push(this._createImageData(assets[i]));\n } else if (assets[i].t === 3) {\n this.totalFootages += 1;\n this.images.push(this.createFootageData(assets[i]));\n }\n }\n }\n }\n function setPath(path) {\n this.path = path || '';\n }\n function setAssetsPath(path) {\n this.assetsPath = path || '';\n }\n function getAsset(assetData) {\n var i = 0;\n var len = this.images.length;\n while (i < len) {\n if (this.images[i].assetData === assetData) {\n return this.images[i].img;\n }\n i += 1;\n }\n return null;\n }\n function destroy() {\n this.imagesLoadedCb = null;\n this.images.length = 0;\n }\n function loadedImages() {\n return this.totalImages === this.loadedAssets;\n }\n function loadedFootages() {\n return this.totalFootages === this.loadedFootagesCount;\n }\n function setCacheType(type, elementHelper) {\n if (type === 'svg') {\n this._elementHelper = elementHelper;\n this._createImageData = this.createImageData.bind(this);\n } else {\n this._createImageData = this.createImgData.bind(this);\n }\n }\n function ImagePreloaderFactory() {\n this._imageLoaded = imageLoaded.bind(this);\n this._footageLoaded = footageLoaded.bind(this);\n this.testImageLoaded = testImageLoaded.bind(this);\n this.createFootageData = createFootageData.bind(this);\n this.assetsPath = '';\n this.path = '';\n this.totalImages = 0;\n this.totalFootages = 0;\n this.loadedAssets = 0;\n this.loadedFootagesCount = 0;\n this.imagesLoadedCb = null;\n this.images = [];\n }\n ImagePreloaderFactory.prototype = {\n loadAssets: loadAssets,\n setAssetsPath: setAssetsPath,\n setPath: setPath,\n loadedImages: loadedImages,\n loadedFootages: loadedFootages,\n destroy: destroy,\n getAsset: getAsset,\n createImgData: createImgData,\n createImageData: createImageData,\n imageLoaded: imageLoaded,\n footageLoaded: footageLoaded,\n setCacheType: setCacheType\n };\n return ImagePreloaderFactory;\n }();\n\n function BaseEvent() {}\n BaseEvent.prototype = {\n triggerEvent: function triggerEvent(eventName, args) {\n if (this._cbs[eventName]) {\n var callbacks = this._cbs[eventName];\n for (var i = 0; i < callbacks.length; i += 1) {\n callbacks[i](args);\n }\n }\n },\n addEventListener: function addEventListener(eventName, callback) {\n if (!this._cbs[eventName]) {\n this._cbs[eventName] = [];\n }\n this._cbs[eventName].push(callback);\n return function () {\n this.removeEventListener(eventName, callback);\n }.bind(this);\n },\n removeEventListener: function removeEventListener(eventName, callback) {\n if (!callback) {\n this._cbs[eventName] = null;\n } else if (this._cbs[eventName]) {\n var i = 0;\n var len = this._cbs[eventName].length;\n while (i < len) {\n if (this._cbs[eventName][i] === callback) {\n this._cbs[eventName].splice(i, 1);\n i -= 1;\n len -= 1;\n }\n i += 1;\n }\n if (!this._cbs[eventName].length) {\n this._cbs[eventName] = null;\n }\n }\n }\n };\n\n var markerParser = function () {\n function parsePayloadLines(payload) {\n var lines = payload.split('\\r\\n');\n var keys = {};\n var line;\n var keysCount = 0;\n for (var i = 0; i < lines.length; i += 1) {\n line = lines[i].split(':');\n if (line.length === 2) {\n keys[line[0]] = line[1].trim();\n keysCount += 1;\n }\n }\n if (keysCount === 0) {\n throw new Error();\n }\n return keys;\n }\n return function (_markers) {\n var markers = [];\n for (var i = 0; i < _markers.length; i += 1) {\n var _marker = _markers[i];\n var markerData = {\n time: _marker.tm,\n duration: _marker.dr\n };\n try {\n markerData.payload = JSON.parse(_markers[i].cm);\n } catch (_) {\n try {\n markerData.payload = parsePayloadLines(_markers[i].cm);\n } catch (__) {\n markerData.payload = {\n name: _markers[i].cm\n };\n }\n }\n markers.push(markerData);\n }\n return markers;\n };\n }();\n\n var ProjectInterface = function () {\n function registerComposition(comp) {\n this.compositions.push(comp);\n }\n return function () {\n function _thisProjectFunction(name) {\n var i = 0;\n var len = this.compositions.length;\n while (i < len) {\n if (this.compositions[i].data && this.compositions[i].data.nm === name) {\n if (this.compositions[i].prepareFrame && this.compositions[i].data.xt) {\n this.compositions[i].prepareFrame(this.currentFrame);\n }\n return this.compositions[i].compInterface;\n }\n i += 1;\n }\n return null;\n }\n _thisProjectFunction.compositions = [];\n _thisProjectFunction.currentFrame = 0;\n _thisProjectFunction.registerComposition = registerComposition;\n return _thisProjectFunction;\n };\n }();\n\n var renderers = {};\n var registerRenderer = function registerRenderer(key, value) {\n renderers[key] = value;\n };\n function getRenderer(key) {\n return renderers[key];\n }\n function getRegisteredRenderer() {\n // Returns canvas by default for compatibility\n if (renderers.canvas) {\n return 'canvas';\n }\n // Returns any renderer that is registered\n for (var key in renderers) {\n if (renderers[key]) {\n return key;\n }\n }\n return '';\n }\n\n function _typeof$4(o) { \"@babel/helpers - typeof\"; return _typeof$4 = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof$4(o); }\n var AnimationItem = function AnimationItem() {\n this._cbs = [];\n this.name = '';\n this.path = '';\n this.isLoaded = false;\n this.currentFrame = 0;\n this.currentRawFrame = 0;\n this.firstFrame = 0;\n this.totalFrames = 0;\n this.frameRate = 0;\n this.frameMult = 0;\n this.playSpeed = 1;\n this.playDirection = 1;\n this.playCount = 0;\n this.animationData = {};\n this.assets = [];\n this.isPaused = true;\n this.autoplay = false;\n this.loop = true;\n this.renderer = null;\n this.animationID = createElementID();\n this.assetsPath = '';\n this.timeCompleted = 0;\n this.segmentPos = 0;\n this.isSubframeEnabled = getSubframeEnabled();\n this.segments = [];\n this._idle = true;\n this._completedLoop = false;\n this.projectInterface = ProjectInterface();\n this.imagePreloader = new ImagePreloader();\n this.audioController = audioControllerFactory();\n this.markers = [];\n this.configAnimation = this.configAnimation.bind(this);\n this.onSetupError = this.onSetupError.bind(this);\n this.onSegmentComplete = this.onSegmentComplete.bind(this);\n this.drawnFrameEvent = new BMEnterFrameEvent('drawnFrame', 0, 0, 0);\n this.expressionsPlugin = getExpressionsPlugin();\n };\n extendPrototype([BaseEvent], AnimationItem);\n AnimationItem.prototype.setParams = function (params) {\n if (params.wrapper || params.container) {\n this.wrapper = params.wrapper || params.container;\n }\n var animType = 'svg';\n if (params.animType) {\n animType = params.animType;\n } else if (params.renderer) {\n animType = params.renderer;\n }\n var RendererClass = getRenderer(animType);\n this.renderer = new RendererClass(this, params.rendererSettings);\n this.imagePreloader.setCacheType(animType, this.renderer.globalData.defs);\n this.renderer.setProjectInterface(this.projectInterface);\n this.animType = animType;\n if (params.loop === '' || params.loop === null || params.loop === undefined || params.loop === true) {\n this.loop = true;\n } else if (params.loop === false) {\n this.loop = false;\n } else {\n this.loop = parseInt(params.loop, 10);\n }\n this.autoplay = 'autoplay' in params ? params.autoplay : true;\n this.name = params.name ? params.name : '';\n this.autoloadSegments = Object.prototype.hasOwnProperty.call(params, 'autoloadSegments') ? params.autoloadSegments : true;\n this.assetsPath = params.assetsPath;\n this.initialSegment = params.initialSegment;\n if (params.audioFactory) {\n this.audioController.setAudioFactory(params.audioFactory);\n }\n if (params.animationData) {\n this.setupAnimation(params.animationData);\n } else if (params.path) {\n if (params.path.lastIndexOf('\\\\') !== -1) {\n this.path = params.path.substr(0, params.path.lastIndexOf('\\\\') + 1);\n } else {\n this.path = params.path.substr(0, params.path.lastIndexOf('/') + 1);\n }\n this.fileName = params.path.substr(params.path.lastIndexOf('/') + 1);\n this.fileName = this.fileName.substr(0, this.fileName.lastIndexOf('.json'));\n dataManager.loadAnimation(params.path, this.configAnimation, this.onSetupError);\n }\n };\n AnimationItem.prototype.onSetupError = function () {\n this.trigger('data_failed');\n };\n AnimationItem.prototype.setupAnimation = function (data) {\n dataManager.completeAnimation(data, this.configAnimation);\n };\n AnimationItem.prototype.setData = function (wrapper, animationData) {\n if (animationData) {\n if (_typeof$4(animationData) !== 'object') {\n animationData = JSON.parse(animationData);\n }\n }\n var params = {\n wrapper: wrapper,\n animationData: animationData\n };\n var wrapperAttributes = wrapper.attributes;\n params.path = wrapperAttributes.getNamedItem('data-animation-path') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-animation-path').value : wrapperAttributes.getNamedItem('data-bm-path') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-path').value : wrapperAttributes.getNamedItem('bm-path') ? wrapperAttributes.getNamedItem('bm-path').value : '';\n params.animType = wrapperAttributes.getNamedItem('data-anim-type') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-type').value : wrapperAttributes.getNamedItem('data-bm-type') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-type').value : wrapperAttributes.getNamedItem('bm-type') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('bm-type').value : wrapperAttributes.getNamedItem('data-bm-renderer') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-renderer').value : wrapperAttributes.getNamedItem('bm-renderer') ? wrapperAttributes.getNamedItem('bm-renderer').value : getRegisteredRenderer() || 'canvas';\n var loop = wrapperAttributes.getNamedItem('data-anim-loop') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-loop').value : wrapperAttributes.getNamedItem('data-bm-loop') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-loop').value : wrapperAttributes.getNamedItem('bm-loop') ? wrapperAttributes.getNamedItem('bm-loop').value : '';\n if (loop === 'false') {\n params.loop = false;\n } else if (loop === 'true') {\n params.loop = true;\n } else if (loop !== '') {\n params.loop = parseInt(loop, 10);\n }\n var autoplay = wrapperAttributes.getNamedItem('data-anim-autoplay') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-autoplay').value : wrapperAttributes.getNamedItem('data-bm-autoplay') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-autoplay').value : wrapperAttributes.getNamedItem('bm-autoplay') ? wrapperAttributes.getNamedItem('bm-autoplay').value : true;\n params.autoplay = autoplay !== 'false';\n params.name = wrapperAttributes.getNamedItem('data-name') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-name').value : wrapperAttributes.getNamedItem('data-bm-name') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-name').value : wrapperAttributes.getNamedItem('bm-name') ? wrapperAttributes.getNamedItem('bm-name').value : '';\n var prerender = wrapperAttributes.getNamedItem('data-anim-prerender') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-prerender').value : wrapperAttributes.getNamedItem('data-bm-prerender') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-prerender').value : wrapperAttributes.getNamedItem('bm-prerender') ? wrapperAttributes.getNamedItem('bm-prerender').value : '';\n if (prerender === 'false') {\n params.prerender = false;\n }\n if (!params.path) {\n this.trigger('destroy');\n } else {\n this.setParams(params);\n }\n };\n AnimationItem.prototype.includeLayers = function (data) {\n if (data.op > this.animationData.op) {\n this.animationData.op = data.op;\n this.totalFrames = Math.floor(data.op - this.animationData.ip);\n }\n var layers = this.animationData.layers;\n var i;\n var len = layers.length;\n var newLayers = data.layers;\n var j;\n var jLen = newLayers.length;\n for (j = 0; j < jLen; j += 1) {\n i = 0;\n while (i < len) {\n if (layers[i].id === newLayers[j].id) {\n layers[i] = newLayers[j];\n break;\n }\n i += 1;\n }\n }\n if (data.chars || data.fonts) {\n this.renderer.globalData.fontManager.addChars(data.chars);\n this.renderer.globalData.fontManager.addFonts(data.fonts, this.renderer.globalData.defs);\n }\n if (data.assets) {\n len = data.assets.length;\n for (i = 0; i < len; i += 1) {\n this.animationData.assets.push(data.assets[i]);\n }\n }\n this.animationData.__complete = false;\n dataManager.completeAnimation(this.animationData, this.onSegmentComplete);\n };\n AnimationItem.prototype.onSegmentComplete = function (data) {\n this.animationData = data;\n var expressionsPlugin = getExpressionsPlugin();\n if (expressionsPlugin) {\n expressionsPlugin.initExpressions(this);\n }\n this.loadNextSegment();\n };\n AnimationItem.prototype.loadNextSegment = function () {\n var segments = this.animationData.segments;\n if (!segments || segments.length === 0 || !this.autoloadSegments) {\n this.trigger('data_ready');\n this.timeCompleted = this.totalFrames;\n return;\n }\n var segment = segments.shift();\n this.timeCompleted = segment.time * this.frameRate;\n var segmentPath = this.path + this.fileName + '_' + this.segmentPos + '.json';\n this.segmentPos += 1;\n dataManager.loadData(segmentPath, this.includeLayers.bind(this), function () {\n this.trigger('data_failed');\n }.bind(this));\n };\n AnimationItem.prototype.loadSegments = function () {\n var segments = this.animationData.segments;\n if (!segments) {\n this.timeCompleted = this.totalFrames;\n }\n this.loadNextSegment();\n };\n AnimationItem.prototype.imagesLoaded = function () {\n this.trigger('loaded_images');\n this.checkLoaded();\n };\n AnimationItem.prototype.preloadImages = function () {\n this.imagePreloader.setAssetsPath(this.assetsPath);\n this.imagePreloader.setPath(this.path);\n this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this));\n };\n AnimationItem.prototype.configAnimation = function (animData) {\n if (!this.renderer) {\n return;\n }\n try {\n this.animationData = animData;\n if (this.initialSegment) {\n this.totalFrames = Math.floor(this.initialSegment[1] - this.initialSegment[0]);\n this.firstFrame = Math.round(this.initialSegment[0]);\n } else {\n this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip);\n this.firstFrame = Math.round(this.animationData.ip);\n }\n this.renderer.configAnimation(animData);\n if (!animData.assets) {\n animData.assets = [];\n }\n this.assets = this.animationData.assets;\n this.frameRate = this.animationData.fr;\n this.frameMult = this.animationData.fr / 1000;\n this.renderer.searchExtraCompositions(animData.assets);\n this.markers = markerParser(animData.markers || []);\n this.trigger('config_ready');\n this.preloadImages();\n this.loadSegments();\n this.updaFrameModifier();\n this.waitForFontsLoaded();\n if (this.isPaused) {\n this.audioController.pause();\n }\n } catch (error) {\n this.triggerConfigError(error);\n }\n };\n AnimationItem.prototype.waitForFontsLoaded = function () {\n if (!this.renderer) {\n return;\n }\n if (this.renderer.globalData.fontManager.isLoaded) {\n this.checkLoaded();\n } else {\n setTimeout(this.waitForFontsLoaded.bind(this), 20);\n }\n };\n AnimationItem.prototype.checkLoaded = function () {\n if (!this.isLoaded && this.renderer.globalData.fontManager.isLoaded && (this.imagePreloader.loadedImages() || this.renderer.rendererType !== 'canvas') && this.imagePreloader.loadedFootages()) {\n this.isLoaded = true;\n var expressionsPlugin = getExpressionsPlugin();\n if (expressionsPlugin) {\n expressionsPlugin.initExpressions(this);\n }\n this.renderer.initItems();\n setTimeout(function () {\n this.trigger('DOMLoaded');\n }.bind(this), 0);\n this.gotoFrame();\n if (this.autoplay) {\n this.play();\n }\n }\n };\n AnimationItem.prototype.resize = function (width, height) {\n // Adding this validation for backwards compatibility in case an event object was being passed down\n var _width = typeof width === 'number' ? width : undefined;\n var _height = typeof height === 'number' ? height : undefined;\n this.renderer.updateContainerSize(_width, _height);\n };\n AnimationItem.prototype.setSubframe = function (flag) {\n this.isSubframeEnabled = !!flag;\n };\n AnimationItem.prototype.gotoFrame = function () {\n this.currentFrame = this.isSubframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame; // eslint-disable-line no-bitwise\n\n if (this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted) {\n this.currentFrame = this.timeCompleted;\n }\n this.trigger('enterFrame');\n this.renderFrame();\n this.trigger('drawnFrame');\n };\n AnimationItem.prototype.renderFrame = function () {\n if (this.isLoaded === false || !this.renderer) {\n return;\n }\n try {\n if (this.expressionsPlugin) {\n this.expressionsPlugin.resetFrame();\n }\n this.renderer.renderFrame(this.currentFrame + this.firstFrame);\n } catch (error) {\n this.triggerRenderFrameError(error);\n }\n };\n AnimationItem.prototype.play = function (name) {\n if (name && this.name !== name) {\n return;\n }\n if (this.isPaused === true) {\n this.isPaused = false;\n this.trigger('_play');\n this.audioController.resume();\n if (this._idle) {\n this._idle = false;\n this.trigger('_active');\n }\n }\n };\n AnimationItem.prototype.pause = function (name) {\n if (name && this.name !== name) {\n return;\n }\n if (this.isPaused === false) {\n this.isPaused = true;\n this.trigger('_pause');\n this._idle = true;\n this.trigger('_idle');\n this.audioController.pause();\n }\n };\n AnimationItem.prototype.togglePause = function (name) {\n if (name && this.name !== name) {\n return;\n }\n if (this.isPaused === true) {\n this.play();\n } else {\n this.pause();\n }\n };\n AnimationItem.prototype.stop = function (name) {\n if (name && this.name !== name) {\n return;\n }\n this.pause();\n this.playCount = 0;\n this._completedLoop = false;\n this.setCurrentRawFrameValue(0);\n };\n AnimationItem.prototype.getMarkerData = function (markerName) {\n var marker;\n for (var i = 0; i < this.markers.length; i += 1) {\n marker = this.markers[i];\n if (marker.payload && marker.payload.name === markerName) {\n return marker;\n }\n }\n return null;\n };\n AnimationItem.prototype.goToAndStop = function (value, isFrame, name) {\n if (name && this.name !== name) {\n return;\n }\n var numValue = Number(value);\n if (isNaN(numValue)) {\n var marker = this.getMarkerData(value);\n if (marker) {\n this.goToAndStop(marker.time, true);\n }\n } else if (isFrame) {\n this.setCurrentRawFrameValue(value);\n } else {\n this.setCurrentRawFrameValue(value * this.frameModifier);\n }\n this.pause();\n };\n AnimationItem.prototype.goToAndPlay = function (value, isFrame, name) {\n if (name && this.name !== name) {\n return;\n }\n var numValue = Number(value);\n if (isNaN(numValue)) {\n var marker = this.getMarkerData(value);\n if (marker) {\n if (!marker.duration) {\n this.goToAndStop(marker.time, true);\n } else {\n this.playSegments([marker.time, marker.time + marker.duration], true);\n }\n }\n } else {\n this.goToAndStop(numValue, isFrame, name);\n }\n this.play();\n };\n AnimationItem.prototype.advanceTime = function (value) {\n if (this.isPaused === true || this.isLoaded === false) {\n return;\n }\n var nextValue = this.currentRawFrame + value * this.frameModifier;\n var _isComplete = false;\n // Checking if nextValue > totalFrames - 1 for addressing non looping and looping animations.\n // If animation won't loop, it should stop at totalFrames - 1. If it will loop it should complete the last frame and then loop.\n if (nextValue >= this.totalFrames - 1 && this.frameModifier > 0) {\n if (!this.loop || this.playCount === this.loop) {\n if (!this.checkSegments(nextValue > this.totalFrames ? nextValue % this.totalFrames : 0)) {\n _isComplete = true;\n nextValue = this.totalFrames - 1;\n }\n } else if (nextValue >= this.totalFrames) {\n this.playCount += 1;\n if (!this.checkSegments(nextValue % this.totalFrames)) {\n this.setCurrentRawFrameValue(nextValue % this.totalFrames);\n this._completedLoop = true;\n this.trigger('loopComplete');\n }\n } else {\n this.setCurrentRawFrameValue(nextValue);\n }\n } else if (nextValue < 0) {\n if (!this.checkSegments(nextValue % this.totalFrames)) {\n if (this.loop && !(this.playCount-- <= 0 && this.loop !== true)) {\n // eslint-disable-line no-plusplus\n this.setCurrentRawFrameValue(this.totalFrames + nextValue % this.totalFrames);\n if (!this._completedLoop) {\n this._completedLoop = true;\n } else {\n this.trigger('loopComplete');\n }\n } else {\n _isComplete = true;\n nextValue = 0;\n }\n }\n } else {\n this.setCurrentRawFrameValue(nextValue);\n }\n if (_isComplete) {\n this.setCurrentRawFrameValue(nextValue);\n this.pause();\n this.trigger('complete');\n }\n };\n AnimationItem.prototype.adjustSegment = function (arr, offset) {\n this.playCount = 0;\n if (arr[1] < arr[0]) {\n if (this.frameModifier > 0) {\n if (this.playSpeed < 0) {\n this.setSpeed(-this.playSpeed);\n } else {\n this.setDirection(-1);\n }\n }\n this.totalFrames = arr[0] - arr[1];\n this.timeCompleted = this.totalFrames;\n this.firstFrame = arr[1];\n this.setCurrentRawFrameValue(this.totalFrames - 0.001 - offset);\n } else if (arr[1] > arr[0]) {\n if (this.frameModifier < 0) {\n if (this.playSpeed < 0) {\n this.setSpeed(-this.playSpeed);\n } else {\n this.setDirection(1);\n }\n }\n this.totalFrames = arr[1] - arr[0];\n this.timeCompleted = this.totalFrames;\n this.firstFrame = arr[0];\n this.setCurrentRawFrameValue(0.001 + offset);\n }\n this.trigger('segmentStart');\n };\n AnimationItem.prototype.setSegment = function (init, end) {\n var pendingFrame = -1;\n if (this.isPaused) {\n if (this.currentRawFrame + this.firstFrame < init) {\n pendingFrame = init;\n } else if (this.currentRawFrame + this.firstFrame > end) {\n pendingFrame = end - init;\n }\n }\n this.firstFrame = init;\n this.totalFrames = end - init;\n this.timeCompleted = this.totalFrames;\n if (pendingFrame !== -1) {\n this.goToAndStop(pendingFrame, true);\n }\n };\n AnimationItem.prototype.playSegments = function (arr, forceFlag) {\n if (forceFlag) {\n this.segments.length = 0;\n }\n if (_typeof$4(arr[0]) === 'object') {\n var i;\n var len = arr.length;\n for (i = 0; i < len; i += 1) {\n this.segments.push(arr[i]);\n }\n } else {\n this.segments.push(arr);\n }\n if (this.segments.length && forceFlag) {\n this.adjustSegment(this.segments.shift(), 0);\n }\n if (this.isPaused) {\n this.play();\n }\n };\n AnimationItem.prototype.resetSegments = function (forceFlag) {\n this.segments.length = 0;\n this.segments.push([this.animationData.ip, this.animationData.op]);\n if (forceFlag) {\n this.checkSegments(0);\n }\n };\n AnimationItem.prototype.checkSegments = function (offset) {\n if (this.segments.length) {\n this.adjustSegment(this.segments.shift(), offset);\n return true;\n }\n return false;\n };\n AnimationItem.prototype.destroy = function (name) {\n if (name && this.name !== name || !this.renderer) {\n return;\n }\n this.renderer.destroy();\n this.imagePreloader.destroy();\n this.trigger('destroy');\n this._cbs = null;\n this.onEnterFrame = null;\n this.onLoopComplete = null;\n this.onComplete = null;\n this.onSegmentStart = null;\n this.onDestroy = null;\n this.renderer = null;\n this.expressionsPlugin = null;\n this.imagePreloader = null;\n this.projectInterface = null;\n };\n AnimationItem.prototype.setCurrentRawFrameValue = function (value) {\n this.currentRawFrame = value;\n this.gotoFrame();\n };\n AnimationItem.prototype.setSpeed = function (val) {\n this.playSpeed = val;\n this.updaFrameModifier();\n };\n AnimationItem.prototype.setDirection = function (val) {\n this.playDirection = val < 0 ? -1 : 1;\n this.updaFrameModifier();\n };\n AnimationItem.prototype.setLoop = function (isLooping) {\n this.loop = isLooping;\n };\n AnimationItem.prototype.setVolume = function (val, name) {\n if (name && this.name !== name) {\n return;\n }\n this.audioController.setVolume(val);\n };\n AnimationItem.prototype.getVolume = function () {\n return this.audioController.getVolume();\n };\n AnimationItem.prototype.mute = function (name) {\n if (name && this.name !== name) {\n return;\n }\n this.audioController.mute();\n };\n AnimationItem.prototype.unmute = function (name) {\n if (name && this.name !== name) {\n return;\n }\n this.audioController.unmute();\n };\n AnimationItem.prototype.updaFrameModifier = function () {\n this.frameModifier = this.frameMult * this.playSpeed * this.playDirection;\n this.audioController.setRate(this.playSpeed * this.playDirection);\n };\n AnimationItem.prototype.getPath = function () {\n return this.path;\n };\n AnimationItem.prototype.getAssetsPath = function (assetData) {\n var path = '';\n if (assetData.e) {\n path = assetData.p;\n } else if (this.assetsPath) {\n var imagePath = assetData.p;\n if (imagePath.indexOf('images/') !== -1) {\n imagePath = imagePath.split('/')[1];\n }\n path = this.assetsPath + imagePath;\n } else {\n path = this.path;\n path += assetData.u ? assetData.u : '';\n path += assetData.p;\n }\n return path;\n };\n AnimationItem.prototype.getAssetData = function (id) {\n var i = 0;\n var len = this.assets.length;\n while (i < len) {\n if (id === this.assets[i].id) {\n return this.assets[i];\n }\n i += 1;\n }\n return null;\n };\n AnimationItem.prototype.hide = function () {\n this.renderer.hide();\n };\n AnimationItem.prototype.show = function () {\n this.renderer.show();\n };\n AnimationItem.prototype.getDuration = function (isFrame) {\n return isFrame ? this.totalFrames : this.totalFrames / this.frameRate;\n };\n AnimationItem.prototype.updateDocumentData = function (path, documentData, index) {\n try {\n var element = this.renderer.getElementByPath(path);\n element.updateDocumentData(documentData, index);\n } catch (error) {\n // TODO: decide how to handle catch case\n }\n };\n AnimationItem.prototype.trigger = function (name) {\n if (this._cbs && this._cbs[name]) {\n switch (name) {\n case 'enterFrame':\n this.triggerEvent(name, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameModifier));\n break;\n case 'drawnFrame':\n this.drawnFrameEvent.currentTime = this.currentFrame;\n this.drawnFrameEvent.totalTime = this.totalFrames;\n this.drawnFrameEvent.direction = this.frameModifier;\n this.triggerEvent(name, this.drawnFrameEvent);\n break;\n case 'loopComplete':\n this.triggerEvent(name, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));\n break;\n case 'complete':\n this.triggerEvent(name, new BMCompleteEvent(name, this.frameMult));\n break;\n case 'segmentStart':\n this.triggerEvent(name, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));\n break;\n case 'destroy':\n this.triggerEvent(name, new BMDestroyEvent(name, this));\n break;\n default:\n this.triggerEvent(name);\n }\n }\n if (name === 'enterFrame' && this.onEnterFrame) {\n this.onEnterFrame.call(this, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameMult));\n }\n if (name === 'loopComplete' && this.onLoopComplete) {\n this.onLoopComplete.call(this, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));\n }\n if (name === 'complete' && this.onComplete) {\n this.onComplete.call(this, new BMCompleteEvent(name, this.frameMult));\n }\n if (name === 'segmentStart' && this.onSegmentStart) {\n this.onSegmentStart.call(this, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));\n }\n if (name === 'destroy' && this.onDestroy) {\n this.onDestroy.call(this, new BMDestroyEvent(name, this));\n }\n };\n AnimationItem.prototype.triggerRenderFrameError = function (nativeError) {\n var error = new BMRenderFrameErrorEvent(nativeError, this.currentFrame);\n this.triggerEvent('error', error);\n if (this.onError) {\n this.onError.call(this, error);\n }\n };\n AnimationItem.prototype.triggerConfigError = function (nativeError) {\n var error = new BMConfigErrorEvent(nativeError, this.currentFrame);\n this.triggerEvent('error', error);\n if (this.onError) {\n this.onError.call(this, error);\n }\n };\n\n var animationManager = function () {\n var moduleOb = {};\n var registeredAnimations = [];\n var initTime = 0;\n var len = 0;\n var playingAnimationsNum = 0;\n var _stopped = true;\n var _isFrozen = false;\n function removeElement(ev) {\n var i = 0;\n var animItem = ev.target;\n while (i < len) {\n if (registeredAnimations[i].animation === animItem) {\n registeredAnimations.splice(i, 1);\n i -= 1;\n len -= 1;\n if (!animItem.isPaused) {\n subtractPlayingCount();\n }\n }\n i += 1;\n }\n }\n function registerAnimation(element, animationData) {\n if (!element) {\n return null;\n }\n var i = 0;\n while (i < len) {\n if (registeredAnimations[i].elem === element && registeredAnimations[i].elem !== null) {\n return registeredAnimations[i].animation;\n }\n i += 1;\n }\n var animItem = new AnimationItem();\n setupAnimation(animItem, element);\n animItem.setData(element, animationData);\n return animItem;\n }\n function getRegisteredAnimations() {\n var i;\n var lenAnims = registeredAnimations.length;\n var animations = [];\n for (i = 0; i < lenAnims; i += 1) {\n animations.push(registeredAnimations[i].animation);\n }\n return animations;\n }\n function addPlayingCount() {\n playingAnimationsNum += 1;\n activate();\n }\n function subtractPlayingCount() {\n playingAnimationsNum -= 1;\n }\n function setupAnimation(animItem, element) {\n animItem.addEventListener('destroy', removeElement);\n animItem.addEventListener('_active', addPlayingCount);\n animItem.addEventListener('_idle', subtractPlayingCount);\n registeredAnimations.push({\n elem: element,\n animation: animItem\n });\n len += 1;\n }\n function loadAnimation(params) {\n var animItem = new AnimationItem();\n setupAnimation(animItem, null);\n animItem.setParams(params);\n return animItem;\n }\n function setSpeed(val, animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.setSpeed(val, animation);\n }\n }\n function setDirection(val, animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.setDirection(val, animation);\n }\n }\n function play(animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.play(animation);\n }\n }\n function resume(nowTime) {\n var elapsedTime = nowTime - initTime;\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.advanceTime(elapsedTime);\n }\n initTime = nowTime;\n if (playingAnimationsNum && !_isFrozen) {\n window.requestAnimationFrame(resume);\n } else {\n _stopped = true;\n }\n }\n function first(nowTime) {\n initTime = nowTime;\n window.requestAnimationFrame(resume);\n }\n function pause(animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.pause(animation);\n }\n }\n function goToAndStop(value, isFrame, animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.goToAndStop(value, isFrame, animation);\n }\n }\n function stop(animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.stop(animation);\n }\n }\n function togglePause(animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.togglePause(animation);\n }\n }\n function destroy(animation) {\n var i;\n for (i = len - 1; i >= 0; i -= 1) {\n registeredAnimations[i].animation.destroy(animation);\n }\n }\n function searchAnimations(animationData, standalone, renderer) {\n var animElements = [].concat([].slice.call(document.getElementsByClassName('lottie')), [].slice.call(document.getElementsByClassName('bodymovin')));\n var i;\n var lenAnims = animElements.length;\n for (i = 0; i < lenAnims; i += 1) {\n if (renderer) {\n animElements[i].setAttribute('data-bm-type', renderer);\n }\n registerAnimation(animElements[i], animationData);\n }\n if (standalone && lenAnims === 0) {\n if (!renderer) {\n renderer = 'svg';\n }\n var body = document.getElementsByTagName('body')[0];\n body.innerText = '';\n var div = createTag('div');\n div.style.width = '100%';\n div.style.height = '100%';\n div.setAttribute('data-bm-type', renderer);\n body.appendChild(div);\n registerAnimation(div, animationData);\n }\n }\n function resize() {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.resize();\n }\n }\n function activate() {\n if (!_isFrozen && playingAnimationsNum) {\n if (_stopped) {\n window.requestAnimationFrame(first);\n _stopped = false;\n }\n }\n }\n function freeze() {\n _isFrozen = true;\n }\n function unfreeze() {\n _isFrozen = false;\n activate();\n }\n function setVolume(val, animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.setVolume(val, animation);\n }\n }\n function mute(animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.mute(animation);\n }\n }\n function unmute(animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.unmute(animation);\n }\n }\n moduleOb.registerAnimation = registerAnimation;\n moduleOb.loadAnimation = loadAnimation;\n moduleOb.setSpeed = setSpeed;\n moduleOb.setDirection = setDirection;\n moduleOb.play = play;\n moduleOb.pause = pause;\n moduleOb.stop = stop;\n moduleOb.togglePause = togglePause;\n moduleOb.searchAnimations = searchAnimations;\n moduleOb.resize = resize;\n // moduleOb.start = start;\n moduleOb.goToAndStop = goToAndStop;\n moduleOb.destroy = destroy;\n moduleOb.freeze = freeze;\n moduleOb.unfreeze = unfreeze;\n moduleOb.setVolume = setVolume;\n moduleOb.mute = mute;\n moduleOb.unmute = unmute;\n moduleOb.getRegisteredAnimations = getRegisteredAnimations;\n return moduleOb;\n }();\n\n /* eslint-disable */\n var BezierFactory = function () {\n /**\n * BezierEasing - use bezier curve for transition easing function\n * by Ga\u00EBtan Renaudeau 2014 - 2015 \u2013 MIT License\n *\n * Credits: is based on Firefox's nsSMILKeySpline.cpp\n * Usage:\n * var spline = BezierEasing([ 0.25, 0.1, 0.25, 1.0 ])\n * spline.get(x) => returns the easing value | x must be in [0, 1] range\n *\n */\n\n var ob = {};\n ob.getBezierEasing = getBezierEasing;\n var beziers = {};\n function getBezierEasing(a, b, c, d, nm) {\n var str = nm || ('bez_' + a + '_' + b + '_' + c + '_' + d).replace(/\\./g, 'p');\n if (beziers[str]) {\n return beziers[str];\n }\n var bezEasing = new BezierEasing([a, b, c, d]);\n beziers[str] = bezEasing;\n return bezEasing;\n }\n\n // These values are established by empiricism with tests (tradeoff: performance VS precision)\n var NEWTON_ITERATIONS = 4;\n var NEWTON_MIN_SLOPE = 0.001;\n var SUBDIVISION_PRECISION = 0.0000001;\n var SUBDIVISION_MAX_ITERATIONS = 10;\n var kSplineTableSize = 11;\n var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);\n var float32ArraySupported = typeof Float32Array === 'function';\n function A(aA1, aA2) {\n return 1.0 - 3.0 * aA2 + 3.0 * aA1;\n }\n function B(aA1, aA2) {\n return 3.0 * aA2 - 6.0 * aA1;\n }\n function C(aA1) {\n return 3.0 * aA1;\n }\n\n // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.\n function calcBezier(aT, aA1, aA2) {\n return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;\n }\n\n // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.\n function getSlope(aT, aA1, aA2) {\n return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);\n }\n function binarySubdivide(aX, aA, aB, mX1, mX2) {\n var currentX,\n currentT,\n i = 0;\n do {\n currentT = aA + (aB - aA) / 2.0;\n currentX = calcBezier(currentT, mX1, mX2) - aX;\n if (currentX > 0.0) {\n aB = currentT;\n } else {\n aA = currentT;\n }\n } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);\n return currentT;\n }\n function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {\n for (var i = 0; i < NEWTON_ITERATIONS; ++i) {\n var currentSlope = getSlope(aGuessT, mX1, mX2);\n if (currentSlope === 0.0) return aGuessT;\n var currentX = calcBezier(aGuessT, mX1, mX2) - aX;\n aGuessT -= currentX / currentSlope;\n }\n return aGuessT;\n }\n\n /**\n * points is an array of [ mX1, mY1, mX2, mY2 ]\n */\n function BezierEasing(points) {\n this._p = points;\n this._mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);\n this._precomputed = false;\n this.get = this.get.bind(this);\n }\n BezierEasing.prototype = {\n get: function get(x) {\n var mX1 = this._p[0],\n mY1 = this._p[1],\n mX2 = this._p[2],\n mY2 = this._p[3];\n if (!this._precomputed) this._precompute();\n if (mX1 === mY1 && mX2 === mY2) return x; // linear\n // Because JavaScript number are imprecise, we should guarantee the extremes are right.\n if (x === 0) return 0;\n if (x === 1) return 1;\n return calcBezier(this._getTForX(x), mY1, mY2);\n },\n // Private part\n\n _precompute: function _precompute() {\n var mX1 = this._p[0],\n mY1 = this._p[1],\n mX2 = this._p[2],\n mY2 = this._p[3];\n this._precomputed = true;\n if (mX1 !== mY1 || mX2 !== mY2) {\n this._calcSampleValues();\n }\n },\n _calcSampleValues: function _calcSampleValues() {\n var mX1 = this._p[0],\n mX2 = this._p[2];\n for (var i = 0; i < kSplineTableSize; ++i) {\n this._mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);\n }\n },\n /**\n * getTForX chose the fastest heuristic to determine the percentage value precisely from a given X projection.\n */\n _getTForX: function _getTForX(aX) {\n var mX1 = this._p[0],\n mX2 = this._p[2],\n mSampleValues = this._mSampleValues;\n var intervalStart = 0.0;\n var currentSample = 1;\n var lastSample = kSplineTableSize - 1;\n for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {\n intervalStart += kSampleStepSize;\n }\n --currentSample;\n\n // Interpolate to provide an initial guess for t\n var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]);\n var guessForT = intervalStart + dist * kSampleStepSize;\n var initialSlope = getSlope(guessForT, mX1, mX2);\n if (initialSlope >= NEWTON_MIN_SLOPE) {\n return newtonRaphsonIterate(aX, guessForT, mX1, mX2);\n }\n if (initialSlope === 0.0) {\n return guessForT;\n }\n return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);\n }\n };\n return ob;\n }();\n\n var pooling = function () {\n function _double(arr) {\n return arr.concat(createSizedArray(arr.length));\n }\n return {\n \"double\": _double\n };\n }();\n\n var poolFactory = function () {\n return function (initialLength, _create, _release) {\n var _length = 0;\n var _maxLength = initialLength;\n var pool = createSizedArray(_maxLength);\n var ob = {\n newElement: newElement,\n release: release\n };\n function newElement() {\n var element;\n if (_length) {\n _length -= 1;\n element = pool[_length];\n } else {\n element = _create();\n }\n return element;\n }\n function release(element) {\n if (_length === _maxLength) {\n pool = pooling[\"double\"](pool);\n _maxLength *= 2;\n }\n if (_release) {\n _release(element);\n }\n pool[_length] = element;\n _length += 1;\n }\n return ob;\n };\n }();\n\n var bezierLengthPool = function () {\n function create() {\n return {\n addedLength: 0,\n percents: createTypedArray('float32', getDefaultCurveSegments()),\n lengths: createTypedArray('float32', getDefaultCurveSegments())\n };\n }\n return poolFactory(8, create);\n }();\n\n var segmentsLengthPool = function () {\n function create() {\n return {\n lengths: [],\n totalLength: 0\n };\n }\n function release(element) {\n var i;\n var len = element.lengths.length;\n for (i = 0; i < len; i += 1) {\n bezierLengthPool.release(element.lengths[i]);\n }\n element.lengths.length = 0;\n }\n return poolFactory(8, create, release);\n }();\n\n function bezFunction() {\n var math = Math;\n function pointOnLine2D(x1, y1, x2, y2, x3, y3) {\n var det1 = x1 * y2 + y1 * x3 + x2 * y3 - x3 * y2 - y3 * x1 - x2 * y1;\n return det1 > -0.001 && det1 < 0.001;\n }\n function pointOnLine3D(x1, y1, z1, x2, y2, z2, x3, y3, z3) {\n if (z1 === 0 && z2 === 0 && z3 === 0) {\n return pointOnLine2D(x1, y1, x2, y2, x3, y3);\n }\n var dist1 = math.sqrt(math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2) + math.pow(z2 - z1, 2));\n var dist2 = math.sqrt(math.pow(x3 - x1, 2) + math.pow(y3 - y1, 2) + math.pow(z3 - z1, 2));\n var dist3 = math.sqrt(math.pow(x3 - x2, 2) + math.pow(y3 - y2, 2) + math.pow(z3 - z2, 2));\n var diffDist;\n if (dist1 > dist2) {\n if (dist1 > dist3) {\n diffDist = dist1 - dist2 - dist3;\n } else {\n diffDist = dist3 - dist2 - dist1;\n }\n } else if (dist3 > dist2) {\n diffDist = dist3 - dist2 - dist1;\n } else {\n diffDist = dist2 - dist1 - dist3;\n }\n return diffDist > -0.0001 && diffDist < 0.0001;\n }\n var getBezierLength = function () {\n return function (pt1, pt2, pt3, pt4) {\n var curveSegments = getDefaultCurveSegments();\n var k;\n var i;\n var len;\n var ptCoord;\n var perc;\n var addedLength = 0;\n var ptDistance;\n var point = [];\n var lastPoint = [];\n var lengthData = bezierLengthPool.newElement();\n len = pt3.length;\n for (k = 0; k < curveSegments; k += 1) {\n perc = k / (curveSegments - 1);\n ptDistance = 0;\n for (i = 0; i < len; i += 1) {\n ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * pt3[i] + 3 * (1 - perc) * bmPow(perc, 2) * pt4[i] + bmPow(perc, 3) * pt2[i];\n point[i] = ptCoord;\n if (lastPoint[i] !== null) {\n ptDistance += bmPow(point[i] - lastPoint[i], 2);\n }\n lastPoint[i] = point[i];\n }\n if (ptDistance) {\n ptDistance = bmSqrt(ptDistance);\n addedLength += ptDistance;\n }\n lengthData.percents[k] = perc;\n lengthData.lengths[k] = addedLength;\n }\n lengthData.addedLength = addedLength;\n return lengthData;\n };\n }();\n function getSegmentsLength(shapeData) {\n var segmentsLength = segmentsLengthPool.newElement();\n var closed = shapeData.c;\n var pathV = shapeData.v;\n var pathO = shapeData.o;\n var pathI = shapeData.i;\n var i;\n var len = shapeData._length;\n var lengths = segmentsLength.lengths;\n var totalLength = 0;\n for (i = 0; i < len - 1; i += 1) {\n lengths[i] = getBezierLength(pathV[i], pathV[i + 1], pathO[i], pathI[i + 1]);\n totalLength += lengths[i].addedLength;\n }\n if (closed && len) {\n lengths[i] = getBezierLength(pathV[i], pathV[0], pathO[i], pathI[0]);\n totalLength += lengths[i].addedLength;\n }\n segmentsLength.totalLength = totalLength;\n return segmentsLength;\n }\n function BezierData(length) {\n this.segmentLength = 0;\n this.points = new Array(length);\n }\n function PointData(partial, point) {\n this.partialLength = partial;\n this.point = point;\n }\n var buildBezierData = function () {\n var storedData = {};\n return function (pt1, pt2, pt3, pt4) {\n var bezierName = (pt1[0] + '_' + pt1[1] + '_' + pt2[0] + '_' + pt2[1] + '_' + pt3[0] + '_' + pt3[1] + '_' + pt4[0] + '_' + pt4[1]).replace(/\\./g, 'p');\n if (!storedData[bezierName]) {\n var curveSegments = getDefaultCurveSegments();\n var k;\n var i;\n var len;\n var ptCoord;\n var perc;\n var addedLength = 0;\n var ptDistance;\n var point;\n var lastPoint = null;\n if (pt1.length === 2 && (pt1[0] !== pt2[0] || pt1[1] !== pt2[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt1[0] + pt3[0], pt1[1] + pt3[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt2[0] + pt4[0], pt2[1] + pt4[1])) {\n curveSegments = 2;\n }\n var bezierData = new BezierData(curveSegments);\n len = pt3.length;\n for (k = 0; k < curveSegments; k += 1) {\n point = createSizedArray(len);\n perc = k / (curveSegments - 1);\n ptDistance = 0;\n for (i = 0; i < len; i += 1) {\n ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * (pt1[i] + pt3[i]) + 3 * (1 - perc) * bmPow(perc, 2) * (pt2[i] + pt4[i]) + bmPow(perc, 3) * pt2[i];\n point[i] = ptCoord;\n if (lastPoint !== null) {\n ptDistance += bmPow(point[i] - lastPoint[i], 2);\n }\n }\n ptDistance = bmSqrt(ptDistance);\n addedLength += ptDistance;\n bezierData.points[k] = new PointData(ptDistance, point);\n lastPoint = point;\n }\n bezierData.segmentLength = addedLength;\n storedData[bezierName] = bezierData;\n }\n return storedData[bezierName];\n };\n }();\n function getDistancePerc(perc, bezierData) {\n var percents = bezierData.percents;\n var lengths = bezierData.lengths;\n var len = percents.length;\n var initPos = bmFloor((len - 1) * perc);\n var lengthPos = perc * bezierData.addedLength;\n var lPerc = 0;\n if (initPos === len - 1 || initPos === 0 || lengthPos === lengths[initPos]) {\n return percents[initPos];\n }\n var dir = lengths[initPos] > lengthPos ? -1 : 1;\n var flag = true;\n while (flag) {\n if (lengths[initPos] <= lengthPos && lengths[initPos + 1] > lengthPos) {\n lPerc = (lengthPos - lengths[initPos]) / (lengths[initPos + 1] - lengths[initPos]);\n flag = false;\n } else {\n initPos += dir;\n }\n if (initPos < 0 || initPos >= len - 1) {\n // FIX for TypedArrays that don't store floating point values with enough accuracy\n if (initPos === len - 1) {\n return percents[initPos];\n }\n flag = false;\n }\n }\n return percents[initPos] + (percents[initPos + 1] - percents[initPos]) * lPerc;\n }\n function getPointInSegment(pt1, pt2, pt3, pt4, percent, bezierData) {\n var t1 = getDistancePerc(percent, bezierData);\n var u1 = 1 - t1;\n var ptX = math.round((u1 * u1 * u1 * pt1[0] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[0] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[0] + t1 * t1 * t1 * pt2[0]) * 1000) / 1000;\n var ptY = math.round((u1 * u1 * u1 * pt1[1] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[1] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[1] + t1 * t1 * t1 * pt2[1]) * 1000) / 1000;\n return [ptX, ptY];\n }\n var bezierSegmentPoints = createTypedArray('float32', 8);\n function getNewSegment(pt1, pt2, pt3, pt4, startPerc, endPerc, bezierData) {\n if (startPerc < 0) {\n startPerc = 0;\n } else if (startPerc > 1) {\n startPerc = 1;\n }\n var t0 = getDistancePerc(startPerc, bezierData);\n endPerc = endPerc > 1 ? 1 : endPerc;\n var t1 = getDistancePerc(endPerc, bezierData);\n var i;\n var len = pt1.length;\n var u0 = 1 - t0;\n var u1 = 1 - t1;\n var u0u0u0 = u0 * u0 * u0;\n var t0u0u0_3 = t0 * u0 * u0 * 3; // eslint-disable-line camelcase\n var t0t0u0_3 = t0 * t0 * u0 * 3; // eslint-disable-line camelcase\n var t0t0t0 = t0 * t0 * t0;\n //\n var u0u0u1 = u0 * u0 * u1;\n var t0u0u1_3 = t0 * u0 * u1 + u0 * t0 * u1 + u0 * u0 * t1; // eslint-disable-line camelcase\n var t0t0u1_3 = t0 * t0 * u1 + u0 * t0 * t1 + t0 * u0 * t1; // eslint-disable-line camelcase\n var t0t0t1 = t0 * t0 * t1;\n //\n var u0u1u1 = u0 * u1 * u1;\n var t0u1u1_3 = t0 * u1 * u1 + u0 * t1 * u1 + u0 * u1 * t1; // eslint-disable-line camelcase\n var t0t1u1_3 = t0 * t1 * u1 + u0 * t1 * t1 + t0 * u1 * t1; // eslint-disable-line camelcase\n var t0t1t1 = t0 * t1 * t1;\n //\n var u1u1u1 = u1 * u1 * u1;\n var t1u1u1_3 = t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1; // eslint-disable-line camelcase\n var t1t1u1_3 = t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1; // eslint-disable-line camelcase\n var t1t1t1 = t1 * t1 * t1;\n for (i = 0; i < len; i += 1) {\n bezierSegmentPoints[i * 4] = math.round((u0u0u0 * pt1[i] + t0u0u0_3 * pt3[i] + t0t0u0_3 * pt4[i] + t0t0t0 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\n bezierSegmentPoints[i * 4 + 1] = math.round((u0u0u1 * pt1[i] + t0u0u1_3 * pt3[i] + t0t0u1_3 * pt4[i] + t0t0t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\n bezierSegmentPoints[i * 4 + 2] = math.round((u0u1u1 * pt1[i] + t0u1u1_3 * pt3[i] + t0t1u1_3 * pt4[i] + t0t1t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\n bezierSegmentPoints[i * 4 + 3] = math.round((u1u1u1 * pt1[i] + t1u1u1_3 * pt3[i] + t1t1u1_3 * pt4[i] + t1t1t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\n }\n return bezierSegmentPoints;\n }\n return {\n getSegmentsLength: getSegmentsLength,\n getNewSegment: getNewSegment,\n getPointInSegment: getPointInSegment,\n buildBezierData: buildBezierData,\n pointOnLine2D: pointOnLine2D,\n pointOnLine3D: pointOnLine3D\n };\n }\n var bez = bezFunction();\n\n var initFrame = initialDefaultFrame;\n var mathAbs = Math.abs;\n function interpolateValue(frameNum, caching) {\n var offsetTime = this.offsetTime;\n var newValue;\n if (this.propType === 'multidimensional') {\n newValue = createTypedArray('float32', this.pv.length);\n }\n var iterationIndex = caching.lastIndex;\n var i = iterationIndex;\n var len = this.keyframes.length - 1;\n var flag = true;\n var keyData;\n var nextKeyData;\n var keyframeMetadata;\n while (flag) {\n keyData = this.keyframes[i];\n nextKeyData = this.keyframes[i + 1];\n if (i === len - 1 && frameNum >= nextKeyData.t - offsetTime) {\n if (keyData.h) {\n keyData = nextKeyData;\n }\n iterationIndex = 0;\n break;\n }\n if (nextKeyData.t - offsetTime > frameNum) {\n iterationIndex = i;\n break;\n }\n if (i < len - 1) {\n i += 1;\n } else {\n iterationIndex = 0;\n flag = false;\n }\n }\n keyframeMetadata = this.keyframesMetadata[i] || {};\n var k;\n var kLen;\n var perc;\n var jLen;\n var j;\n var fnc;\n var nextKeyTime = nextKeyData.t - offsetTime;\n var keyTime = keyData.t - offsetTime;\n var endValue;\n if (keyData.to) {\n if (!keyframeMetadata.bezierData) {\n keyframeMetadata.bezierData = bez.buildBezierData(keyData.s, nextKeyData.s || keyData.e, keyData.to, keyData.ti);\n }\n var bezierData = keyframeMetadata.bezierData;\n if (frameNum >= nextKeyTime || frameNum < keyTime) {\n var ind = frameNum >= nextKeyTime ? bezierData.points.length - 1 : 0;\n kLen = bezierData.points[ind].point.length;\n for (k = 0; k < kLen; k += 1) {\n newValue[k] = bezierData.points[ind].point[k];\n }\n // caching._lastKeyframeIndex = -1;\n } else {\n if (keyframeMetadata.__fnct) {\n fnc = keyframeMetadata.__fnct;\n } else {\n fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y, keyData.n).get;\n keyframeMetadata.__fnct = fnc;\n }\n perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));\n var distanceInLine = bezierData.segmentLength * perc;\n var segmentPerc;\n var addedLength = caching.lastFrame < frameNum && caching._lastKeyframeIndex === i ? caching._lastAddedLength : 0;\n j = caching.lastFrame < frameNum && caching._lastKeyframeIndex === i ? caching._lastPoint : 0;\n flag = true;\n jLen = bezierData.points.length;\n while (flag) {\n addedLength += bezierData.points[j].partialLength;\n if (distanceInLine === 0 || perc === 0 || j === bezierData.points.length - 1) {\n kLen = bezierData.points[j].point.length;\n for (k = 0; k < kLen; k += 1) {\n newValue[k] = bezierData.points[j].point[k];\n }\n break;\n } else if (distanceInLine >= addedLength && distanceInLine < addedLength + bezierData.points[j + 1].partialLength) {\n segmentPerc = (distanceInLine - addedLength) / bezierData.points[j + 1].partialLength;\n kLen = bezierData.points[j].point.length;\n for (k = 0; k < kLen; k += 1) {\n newValue[k] = bezierData.points[j].point[k] + (bezierData.points[j + 1].point[k] - bezierData.points[j].point[k]) * segmentPerc;\n }\n break;\n }\n if (j < jLen - 1) {\n j += 1;\n } else {\n flag = false;\n }\n }\n caching._lastPoint = j;\n caching._lastAddedLength = addedLength - bezierData.points[j].partialLength;\n caching._lastKeyframeIndex = i;\n }\n } else {\n var outX;\n var outY;\n var inX;\n var inY;\n var keyValue;\n len = keyData.s.length;\n endValue = nextKeyData.s || keyData.e;\n if (this.sh && keyData.h !== 1) {\n if (frameNum >= nextKeyTime) {\n newValue[0] = endValue[0];\n newValue[1] = endValue[1];\n newValue[2] = endValue[2];\n } else if (frameNum <= keyTime) {\n newValue[0] = keyData.s[0];\n newValue[1] = keyData.s[1];\n newValue[2] = keyData.s[2];\n } else {\n var quatStart = createQuaternion(keyData.s);\n var quatEnd = createQuaternion(endValue);\n var time = (frameNum - keyTime) / (nextKeyTime - keyTime);\n quaternionToEuler(newValue, slerp(quatStart, quatEnd, time));\n }\n } else {\n for (i = 0; i < len; i += 1) {\n if (keyData.h !== 1) {\n if (frameNum >= nextKeyTime) {\n perc = 1;\n } else if (frameNum < keyTime) {\n perc = 0;\n } else {\n if (keyData.o.x.constructor === Array) {\n if (!keyframeMetadata.__fnct) {\n keyframeMetadata.__fnct = [];\n }\n if (!keyframeMetadata.__fnct[i]) {\n outX = keyData.o.x[i] === undefined ? keyData.o.x[0] : keyData.o.x[i];\n outY = keyData.o.y[i] === undefined ? keyData.o.y[0] : keyData.o.y[i];\n inX = keyData.i.x[i] === undefined ? keyData.i.x[0] : keyData.i.x[i];\n inY = keyData.i.y[i] === undefined ? keyData.i.y[0] : keyData.i.y[i];\n fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;\n keyframeMetadata.__fnct[i] = fnc;\n } else {\n fnc = keyframeMetadata.__fnct[i];\n }\n } else if (!keyframeMetadata.__fnct) {\n outX = keyData.o.x;\n outY = keyData.o.y;\n inX = keyData.i.x;\n inY = keyData.i.y;\n fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;\n keyData.keyframeMetadata = fnc;\n } else {\n fnc = keyframeMetadata.__fnct;\n }\n perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));\n }\n }\n endValue = nextKeyData.s || keyData.e;\n keyValue = keyData.h === 1 ? keyData.s[i] : keyData.s[i] + (endValue[i] - keyData.s[i]) * perc;\n if (this.propType === 'multidimensional') {\n newValue[i] = keyValue;\n } else {\n newValue = keyValue;\n }\n }\n }\n }\n caching.lastIndex = iterationIndex;\n return newValue;\n }\n\n // based on @Toji's https://github.com/toji/gl-matrix/\n function slerp(a, b, t) {\n var out = [];\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n var aw = a[3];\n var bx = b[0];\n var by = b[1];\n var bz = b[2];\n var bw = b[3];\n var omega;\n var cosom;\n var sinom;\n var scale0;\n var scale1;\n cosom = ax * bx + ay * by + az * bz + aw * bw;\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n if (1.0 - cosom > 0.000001) {\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n }\n function quaternionToEuler(out, quat) {\n var qx = quat[0];\n var qy = quat[1];\n var qz = quat[2];\n var qw = quat[3];\n var heading = Math.atan2(2 * qy * qw - 2 * qx * qz, 1 - 2 * qy * qy - 2 * qz * qz);\n var attitude = Math.asin(2 * qx * qy + 2 * qz * qw);\n var bank = Math.atan2(2 * qx * qw - 2 * qy * qz, 1 - 2 * qx * qx - 2 * qz * qz);\n out[0] = heading / degToRads;\n out[1] = attitude / degToRads;\n out[2] = bank / degToRads;\n }\n function createQuaternion(values) {\n var heading = values[0] * degToRads;\n var attitude = values[1] * degToRads;\n var bank = values[2] * degToRads;\n var c1 = Math.cos(heading / 2);\n var c2 = Math.cos(attitude / 2);\n var c3 = Math.cos(bank / 2);\n var s1 = Math.sin(heading / 2);\n var s2 = Math.sin(attitude / 2);\n var s3 = Math.sin(bank / 2);\n var w = c1 * c2 * c3 - s1 * s2 * s3;\n var x = s1 * s2 * c3 + c1 * c2 * s3;\n var y = s1 * c2 * c3 + c1 * s2 * s3;\n var z = c1 * s2 * c3 - s1 * c2 * s3;\n return [x, y, z, w];\n }\n function getValueAtCurrentTime() {\n var frameNum = this.comp.renderedFrame - this.offsetTime;\n var initTime = this.keyframes[0].t - this.offsetTime;\n var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;\n if (!(frameNum === this._caching.lastFrame || this._caching.lastFrame !== initFrame && (this._caching.lastFrame >= endTime && frameNum >= endTime || this._caching.lastFrame < initTime && frameNum < initTime))) {\n if (this._caching.lastFrame >= frameNum) {\n this._caching._lastKeyframeIndex = -1;\n this._caching.lastIndex = 0;\n }\n var renderResult = this.interpolateValue(frameNum, this._caching);\n this.pv = renderResult;\n }\n this._caching.lastFrame = frameNum;\n return this.pv;\n }\n function setVValue(val) {\n var multipliedValue;\n if (this.propType === 'unidimensional') {\n multipliedValue = val * this.mult;\n if (mathAbs(this.v - multipliedValue) > 0.00001) {\n this.v = multipliedValue;\n this._mdf = true;\n }\n } else {\n var i = 0;\n var len = this.v.length;\n while (i < len) {\n multipliedValue = val[i] * this.mult;\n if (mathAbs(this.v[i] - multipliedValue) > 0.00001) {\n this.v[i] = multipliedValue;\n this._mdf = true;\n }\n i += 1;\n }\n }\n }\n function processEffectsSequence() {\n if (this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) {\n return;\n }\n if (this.lock) {\n this.setVValue(this.pv);\n return;\n }\n this.lock = true;\n this._mdf = this._isFirstFrame;\n var i;\n var len = this.effectsSequence.length;\n var finalValue = this.kf ? this.pv : this.data.k;\n for (i = 0; i < len; i += 1) {\n finalValue = this.effectsSequence[i](finalValue);\n }\n this.setVValue(finalValue);\n this._isFirstFrame = false;\n this.lock = false;\n this.frameId = this.elem.globalData.frameId;\n }\n function addEffect(effectFunction) {\n this.effectsSequence.push(effectFunction);\n this.container.addDynamicProperty(this);\n }\n function ValueProperty(elem, data, mult, container) {\n this.propType = 'unidimensional';\n this.mult = mult || 1;\n this.data = data;\n this.v = mult ? data.k * mult : data.k;\n this.pv = data.k;\n this._mdf = false;\n this.elem = elem;\n this.container = container;\n this.comp = elem.comp;\n this.k = false;\n this.kf = false;\n this.vel = 0;\n this.effectsSequence = [];\n this._isFirstFrame = true;\n this.getValue = processEffectsSequence;\n this.setVValue = setVValue;\n this.addEffect = addEffect;\n }\n function MultiDimensionalProperty(elem, data, mult, container) {\n this.propType = 'multidimensional';\n this.mult = mult || 1;\n this.data = data;\n this._mdf = false;\n this.elem = elem;\n this.container = container;\n this.comp = elem.comp;\n this.k = false;\n this.kf = false;\n this.frameId = -1;\n var i;\n var len = data.k.length;\n this.v = createTypedArray('float32', len);\n this.pv = createTypedArray('float32', len);\n this.vel = createTypedArray('float32', len);\n for (i = 0; i < len; i += 1) {\n this.v[i] = data.k[i] * this.mult;\n this.pv[i] = data.k[i];\n }\n this._isFirstFrame = true;\n this.effectsSequence = [];\n this.getValue = processEffectsSequence;\n this.setVValue = setVValue;\n this.addEffect = addEffect;\n }\n function KeyframedValueProperty(elem, data, mult, container) {\n this.propType = 'unidimensional';\n this.keyframes = data.k;\n this.keyframesMetadata = [];\n this.offsetTime = elem.data.st;\n this.frameId = -1;\n this._caching = {\n lastFrame: initFrame,\n lastIndex: 0,\n value: 0,\n _lastKeyframeIndex: -1\n };\n this.k = true;\n this.kf = true;\n this.data = data;\n this.mult = mult || 1;\n this.elem = elem;\n this.container = container;\n this.comp = elem.comp;\n this.v = initFrame;\n this.pv = initFrame;\n this._isFirstFrame = true;\n this.getValue = processEffectsSequence;\n this.setVValue = setVValue;\n this.interpolateValue = interpolateValue;\n this.effectsSequence = [getValueAtCurrentTime.bind(this)];\n this.addEffect = addEffect;\n }\n function KeyframedMultidimensionalProperty(elem, data, mult, container) {\n this.propType = 'multidimensional';\n var i;\n var len = data.k.length;\n var s;\n var e;\n var to;\n var ti;\n for (i = 0; i < len - 1; i += 1) {\n if (data.k[i].to && data.k[i].s && data.k[i + 1] && data.k[i + 1].s) {\n s = data.k[i].s;\n e = data.k[i + 1].s;\n to = data.k[i].to;\n ti = data.k[i].ti;\n if (s.length === 2 && !(s[0] === e[0] && s[1] === e[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], s[0] + to[0], s[1] + to[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], e[0] + ti[0], e[1] + ti[1]) || s.length === 3 && !(s[0] === e[0] && s[1] === e[1] && s[2] === e[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], s[0] + to[0], s[1] + to[1], s[2] + to[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], e[0] + ti[0], e[1] + ti[1], e[2] + ti[2])) {\n data.k[i].to = null;\n data.k[i].ti = null;\n }\n if (s[0] === e[0] && s[1] === e[1] && to[0] === 0 && to[1] === 0 && ti[0] === 0 && ti[1] === 0) {\n if (s.length === 2 || s[2] === e[2] && to[2] === 0 && ti[2] === 0) {\n data.k[i].to = null;\n data.k[i].ti = null;\n }\n }\n }\n }\n this.effectsSequence = [getValueAtCurrentTime.bind(this)];\n this.data = data;\n this.keyframes = data.k;\n this.keyframesMetadata = [];\n this.offsetTime = elem.data.st;\n this.k = true;\n this.kf = true;\n this._isFirstFrame = true;\n this.mult = mult || 1;\n this.elem = elem;\n this.container = container;\n this.comp = elem.comp;\n this.getValue = processEffectsSequence;\n this.setVValue = setVValue;\n this.interpolateValue = interpolateValue;\n this.frameId = -1;\n var arrLen = data.k[0].s.length;\n this.v = createTypedArray('float32', arrLen);\n this.pv = createTypedArray('float32', arrLen);\n for (i = 0; i < arrLen; i += 1) {\n this.v[i] = initFrame;\n this.pv[i] = initFrame;\n }\n this._caching = {\n lastFrame: initFrame,\n lastIndex: 0,\n value: createTypedArray('float32', arrLen)\n };\n this.addEffect = addEffect;\n }\n var PropertyFactory = function () {\n function getProp(elem, data, type, mult, container) {\n if (data.sid) {\n data = elem.globalData.slotManager.getProp(data);\n }\n var p;\n if (!data.k.length) {\n p = new ValueProperty(elem, data, mult, container);\n } else if (typeof data.k[0] === 'number') {\n p = new MultiDimensionalProperty(elem, data, mult, container);\n } else {\n switch (type) {\n case 0:\n p = new KeyframedValueProperty(elem, data, mult, container);\n break;\n case 1:\n p = new KeyframedMultidimensionalProperty(elem, data, mult, container);\n break;\n default:\n break;\n }\n }\n if (p.effectsSequence.length) {\n container.addDynamicProperty(p);\n }\n return p;\n }\n var ob = {\n getProp: getProp\n };\n return ob;\n }();\n\n function DynamicPropertyContainer() {}\n DynamicPropertyContainer.prototype = {\n addDynamicProperty: function addDynamicProperty(prop) {\n if (this.dynamicProperties.indexOf(prop) === -1) {\n this.dynamicProperties.push(prop);\n this.container.addDynamicProperty(this);\n this._isAnimated = true;\n }\n },\n iterateDynamicProperties: function iterateDynamicProperties() {\n this._mdf = false;\n var i;\n var len = this.dynamicProperties.length;\n for (i = 0; i < len; i += 1) {\n this.dynamicProperties[i].getValue();\n if (this.dynamicProperties[i]._mdf) {\n this._mdf = true;\n }\n }\n },\n initDynamicPropertyContainer: function initDynamicPropertyContainer(container) {\n this.container = container;\n this.dynamicProperties = [];\n this._mdf = false;\n this._isAnimated = false;\n }\n };\n\n var pointPool = function () {\n function create() {\n return createTypedArray('float32', 2);\n }\n return poolFactory(8, create);\n }();\n\n function ShapePath() {\n this.c = false;\n this._length = 0;\n this._maxLength = 8;\n this.v = createSizedArray(this._maxLength);\n this.o = createSizedArray(this._maxLength);\n this.i = createSizedArray(this._maxLength);\n }\n ShapePath.prototype.setPathData = function (closed, len) {\n this.c = closed;\n this.setLength(len);\n var i = 0;\n while (i < len) {\n this.v[i] = pointPool.newElement();\n this.o[i] = pointPool.newElement();\n this.i[i] = pointPool.newElement();\n i += 1;\n }\n };\n ShapePath.prototype.setLength = function (len) {\n while (this._maxLength < len) {\n this.doubleArrayLength();\n }\n this._length = len;\n };\n ShapePath.prototype.doubleArrayLength = function () {\n this.v = this.v.concat(createSizedArray(this._maxLength));\n this.i = this.i.concat(createSizedArray(this._maxLength));\n this.o = this.o.concat(createSizedArray(this._maxLength));\n this._maxLength *= 2;\n };\n ShapePath.prototype.setXYAt = function (x, y, type, pos, replace) {\n var arr;\n this._length = Math.max(this._length, pos + 1);\n if (this._length >= this._maxLength) {\n this.doubleArrayLength();\n }\n switch (type) {\n case 'v':\n arr = this.v;\n break;\n case 'i':\n arr = this.i;\n break;\n case 'o':\n arr = this.o;\n break;\n default:\n arr = [];\n break;\n }\n if (!arr[pos] || arr[pos] && !replace) {\n arr[pos] = pointPool.newElement();\n }\n arr[pos][0] = x;\n arr[pos][1] = y;\n };\n ShapePath.prototype.setTripleAt = function (vX, vY, oX, oY, iX, iY, pos, replace) {\n this.setXYAt(vX, vY, 'v', pos, replace);\n this.setXYAt(oX, oY, 'o', pos, replace);\n this.setXYAt(iX, iY, 'i', pos, replace);\n };\n ShapePath.prototype.reverse = function () {\n var newPath = new ShapePath();\n newPath.setPathData(this.c, this._length);\n var vertices = this.v;\n var outPoints = this.o;\n var inPoints = this.i;\n var init = 0;\n if (this.c) {\n newPath.setTripleAt(vertices[0][0], vertices[0][1], inPoints[0][0], inPoints[0][1], outPoints[0][0], outPoints[0][1], 0, false);\n init = 1;\n }\n var cnt = this._length - 1;\n var len = this._length;\n var i;\n for (i = init; i < len; i += 1) {\n newPath.setTripleAt(vertices[cnt][0], vertices[cnt][1], inPoints[cnt][0], inPoints[cnt][1], outPoints[cnt][0], outPoints[cnt][1], i, false);\n cnt -= 1;\n }\n return newPath;\n };\n ShapePath.prototype.length = function () {\n return this._length;\n };\n\n var shapePool = function () {\n function create() {\n return new ShapePath();\n }\n function release(shapePath) {\n var len = shapePath._length;\n var i;\n for (i = 0; i < len; i += 1) {\n pointPool.release(shapePath.v[i]);\n pointPool.release(shapePath.i[i]);\n pointPool.release(shapePath.o[i]);\n shapePath.v[i] = null;\n shapePath.i[i] = null;\n shapePath.o[i] = null;\n }\n shapePath._length = 0;\n shapePath.c = false;\n }\n function clone(shape) {\n var cloned = factory.newElement();\n var i;\n var len = shape._length === undefined ? shape.v.length : shape._length;\n cloned.setLength(len);\n cloned.c = shape.c;\n for (i = 0; i < len; i += 1) {\n cloned.setTripleAt(shape.v[i][0], shape.v[i][1], shape.o[i][0], shape.o[i][1], shape.i[i][0], shape.i[i][1], i);\n }\n return cloned;\n }\n var factory = poolFactory(4, create, release);\n factory.clone = clone;\n return factory;\n }();\n\n function ShapeCollection() {\n this._length = 0;\n this._maxLength = 4;\n this.shapes = createSizedArray(this._maxLength);\n }\n ShapeCollection.prototype.addShape = function (shapeData) {\n if (this._length === this._maxLength) {\n this.shapes = this.shapes.concat(createSizedArray(this._maxLength));\n this._maxLength *= 2;\n }\n this.shapes[this._length] = shapeData;\n this._length += 1;\n };\n ShapeCollection.prototype.releaseShapes = function () {\n var i;\n for (i = 0; i < this._length; i += 1) {\n shapePool.release(this.shapes[i]);\n }\n this._length = 0;\n };\n\n var shapeCollectionPool = function () {\n var ob = {\n newShapeCollection: newShapeCollection,\n release: release\n };\n var _length = 0;\n var _maxLength = 4;\n var pool = createSizedArray(_maxLength);\n function newShapeCollection() {\n var shapeCollection;\n if (_length) {\n _length -= 1;\n shapeCollection = pool[_length];\n } else {\n shapeCollection = new ShapeCollection();\n }\n return shapeCollection;\n }\n function release(shapeCollection) {\n var i;\n var len = shapeCollection._length;\n for (i = 0; i < len; i += 1) {\n shapePool.release(shapeCollection.shapes[i]);\n }\n shapeCollection._length = 0;\n if (_length === _maxLength) {\n pool = pooling[\"double\"](pool);\n _maxLength *= 2;\n }\n pool[_length] = shapeCollection;\n _length += 1;\n }\n return ob;\n }();\n\n var ShapePropertyFactory = function () {\n var initFrame = -999999;\n function interpolateShape(frameNum, previousValue, caching) {\n var iterationIndex = caching.lastIndex;\n var keyPropS;\n var keyPropE;\n var isHold;\n var j;\n var k;\n var jLen;\n var kLen;\n var perc;\n var vertexValue;\n var kf = this.keyframes;\n if (frameNum < kf[0].t - this.offsetTime) {\n keyPropS = kf[0].s[0];\n isHold = true;\n iterationIndex = 0;\n } else if (frameNum >= kf[kf.length - 1].t - this.offsetTime) {\n keyPropS = kf[kf.length - 1].s ? kf[kf.length - 1].s[0] : kf[kf.length - 2].e[0];\n /* if(kf[kf.length - 1].s){\n keyPropS = kf[kf.length - 1].s[0];\n }else{\n keyPropS = kf[kf.length - 2].e[0];\n } */\n isHold = true;\n } else {\n var i = iterationIndex;\n var len = kf.length - 1;\n var flag = true;\n var keyData;\n var nextKeyData;\n var keyframeMetadata;\n while (flag) {\n keyData = kf[i];\n nextKeyData = kf[i + 1];\n if (nextKeyData.t - this.offsetTime > frameNum) {\n break;\n }\n if (i < len - 1) {\n i += 1;\n } else {\n flag = false;\n }\n }\n keyframeMetadata = this.keyframesMetadata[i] || {};\n isHold = keyData.h === 1;\n iterationIndex = i;\n if (!isHold) {\n if (frameNum >= nextKeyData.t - this.offsetTime) {\n perc = 1;\n } else if (frameNum < keyData.t - this.offsetTime) {\n perc = 0;\n } else {\n var fnc;\n if (keyframeMetadata.__fnct) {\n fnc = keyframeMetadata.__fnct;\n } else {\n fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y).get;\n keyframeMetadata.__fnct = fnc;\n }\n perc = fnc((frameNum - (keyData.t - this.offsetTime)) / (nextKeyData.t - this.offsetTime - (keyData.t - this.offsetTime)));\n }\n keyPropE = nextKeyData.s ? nextKeyData.s[0] : keyData.e[0];\n }\n keyPropS = keyData.s[0];\n }\n jLen = previousValue._length;\n kLen = keyPropS.i[0].length;\n caching.lastIndex = iterationIndex;\n for (j = 0; j < jLen; j += 1) {\n for (k = 0; k < kLen; k += 1) {\n vertexValue = isHold ? keyPropS.i[j][k] : keyPropS.i[j][k] + (keyPropE.i[j][k] - keyPropS.i[j][k]) * perc;\n previousValue.i[j][k] = vertexValue;\n vertexValue = isHold ? keyPropS.o[j][k] : keyPropS.o[j][k] + (keyPropE.o[j][k] - keyPropS.o[j][k]) * perc;\n previousValue.o[j][k] = vertexValue;\n vertexValue = isHold ? keyPropS.v[j][k] : keyPropS.v[j][k] + (keyPropE.v[j][k] - keyPropS.v[j][k]) * perc;\n previousValue.v[j][k] = vertexValue;\n }\n }\n }\n function interpolateShapeCurrentTime() {\n var frameNum = this.comp.renderedFrame - this.offsetTime;\n var initTime = this.keyframes[0].t - this.offsetTime;\n var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;\n var lastFrame = this._caching.lastFrame;\n if (!(lastFrame !== initFrame && (lastFrame < initTime && frameNum < initTime || lastFrame > endTime && frameNum > endTime))) {\n /// /\n this._caching.lastIndex = lastFrame < frameNum ? this._caching.lastIndex : 0;\n this.interpolateShape(frameNum, this.pv, this._caching);\n /// /\n }\n this._caching.lastFrame = frameNum;\n return this.pv;\n }\n function resetShape() {\n this.paths = this.localShapeCollection;\n }\n function shapesEqual(shape1, shape2) {\n if (shape1._length !== shape2._length || shape1.c !== shape2.c) {\n return false;\n }\n var i;\n var len = shape1._length;\n for (i = 0; i < len; i += 1) {\n if (shape1.v[i][0] !== shape2.v[i][0] || shape1.v[i][1] !== shape2.v[i][1] || shape1.o[i][0] !== shape2.o[i][0] || shape1.o[i][1] !== shape2.o[i][1] || shape1.i[i][0] !== shape2.i[i][0] || shape1.i[i][1] !== shape2.i[i][1]) {\n return false;\n }\n }\n return true;\n }\n function setVValue(newPath) {\n if (!shapesEqual(this.v, newPath)) {\n this.v = shapePool.clone(newPath);\n this.localShapeCollection.releaseShapes();\n this.localShapeCollection.addShape(this.v);\n this._mdf = true;\n this.paths = this.localShapeCollection;\n }\n }\n function processEffectsSequence() {\n if (this.elem.globalData.frameId === this.frameId) {\n return;\n }\n if (!this.effectsSequence.length) {\n this._mdf = false;\n return;\n }\n if (this.lock) {\n this.setVValue(this.pv);\n return;\n }\n this.lock = true;\n this._mdf = false;\n var finalValue;\n if (this.kf) {\n finalValue = this.pv;\n } else if (this.data.ks) {\n finalValue = this.data.ks.k;\n } else {\n finalValue = this.data.pt.k;\n }\n var i;\n var len = this.effectsSequence.length;\n for (i = 0; i < len; i += 1) {\n finalValue = this.effectsSequence[i](finalValue);\n }\n this.setVValue(finalValue);\n this.lock = false;\n this.frameId = this.elem.globalData.frameId;\n }\n function ShapeProperty(elem, data, type) {\n this.propType = 'shape';\n this.comp = elem.comp;\n this.container = elem;\n this.elem = elem;\n this.data = data;\n this.k = false;\n this.kf = false;\n this._mdf = false;\n var pathData = type === 3 ? data.pt.k : data.ks.k;\n this.v = shapePool.clone(pathData);\n this.pv = shapePool.clone(this.v);\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\n this.paths = this.localShapeCollection;\n this.paths.addShape(this.v);\n this.reset = resetShape;\n this.effectsSequence = [];\n }\n function addEffect(effectFunction) {\n this.effectsSequence.push(effectFunction);\n this.container.addDynamicProperty(this);\n }\n ShapeProperty.prototype.interpolateShape = interpolateShape;\n ShapeProperty.prototype.getValue = processEffectsSequence;\n ShapeProperty.prototype.setVValue = setVValue;\n ShapeProperty.prototype.addEffect = addEffect;\n function KeyframedShapeProperty(elem, data, type) {\n this.propType = 'shape';\n this.comp = elem.comp;\n this.elem = elem;\n this.container = elem;\n this.offsetTime = elem.data.st;\n this.keyframes = type === 3 ? data.pt.k : data.ks.k;\n this.keyframesMetadata = [];\n this.k = true;\n this.kf = true;\n var len = this.keyframes[0].s[0].i.length;\n this.v = shapePool.newElement();\n this.v.setPathData(this.keyframes[0].s[0].c, len);\n this.pv = shapePool.clone(this.v);\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\n this.paths = this.localShapeCollection;\n this.paths.addShape(this.v);\n this.lastFrame = initFrame;\n this.reset = resetShape;\n this._caching = {\n lastFrame: initFrame,\n lastIndex: 0\n };\n this.effectsSequence = [interpolateShapeCurrentTime.bind(this)];\n }\n KeyframedShapeProperty.prototype.getValue = processEffectsSequence;\n KeyframedShapeProperty.prototype.interpolateShape = interpolateShape;\n KeyframedShapeProperty.prototype.setVValue = setVValue;\n KeyframedShapeProperty.prototype.addEffect = addEffect;\n var EllShapeProperty = function () {\n var cPoint = roundCorner;\n function EllShapePropertyFactory(elem, data) {\n this.v = shapePool.newElement();\n this.v.setPathData(true, 4);\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\n this.paths = this.localShapeCollection;\n this.localShapeCollection.addShape(this.v);\n this.d = data.d;\n this.elem = elem;\n this.comp = elem.comp;\n this.frameId = -1;\n this.initDynamicPropertyContainer(elem);\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);\n this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);\n if (this.dynamicProperties.length) {\n this.k = true;\n } else {\n this.k = false;\n this.convertEllToPath();\n }\n }\n EllShapePropertyFactory.prototype = {\n reset: resetShape,\n getValue: function getValue() {\n if (this.elem.globalData.frameId === this.frameId) {\n return;\n }\n this.frameId = this.elem.globalData.frameId;\n this.iterateDynamicProperties();\n if (this._mdf) {\n this.convertEllToPath();\n }\n },\n convertEllToPath: function convertEllToPath() {\n var p0 = this.p.v[0];\n var p1 = this.p.v[1];\n var s0 = this.s.v[0] / 2;\n var s1 = this.s.v[1] / 2;\n var _cw = this.d !== 3;\n var _v = this.v;\n _v.v[0][0] = p0;\n _v.v[0][1] = p1 - s1;\n _v.v[1][0] = _cw ? p0 + s0 : p0 - s0;\n _v.v[1][1] = p1;\n _v.v[2][0] = p0;\n _v.v[2][1] = p1 + s1;\n _v.v[3][0] = _cw ? p0 - s0 : p0 + s0;\n _v.v[3][1] = p1;\n _v.i[0][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;\n _v.i[0][1] = p1 - s1;\n _v.i[1][0] = _cw ? p0 + s0 : p0 - s0;\n _v.i[1][1] = p1 - s1 * cPoint;\n _v.i[2][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;\n _v.i[2][1] = p1 + s1;\n _v.i[3][0] = _cw ? p0 - s0 : p0 + s0;\n _v.i[3][1] = p1 + s1 * cPoint;\n _v.o[0][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;\n _v.o[0][1] = p1 - s1;\n _v.o[1][0] = _cw ? p0 + s0 : p0 - s0;\n _v.o[1][1] = p1 + s1 * cPoint;\n _v.o[2][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;\n _v.o[2][1] = p1 + s1;\n _v.o[3][0] = _cw ? p0 - s0 : p0 + s0;\n _v.o[3][1] = p1 - s1 * cPoint;\n }\n };\n extendPrototype([DynamicPropertyContainer], EllShapePropertyFactory);\n return EllShapePropertyFactory;\n }();\n var StarShapeProperty = function () {\n function StarShapePropertyFactory(elem, data) {\n this.v = shapePool.newElement();\n this.v.setPathData(true, 0);\n this.elem = elem;\n this.comp = elem.comp;\n this.data = data;\n this.frameId = -1;\n this.d = data.d;\n this.initDynamicPropertyContainer(elem);\n if (data.sy === 1) {\n this.ir = PropertyFactory.getProp(elem, data.ir, 0, 0, this);\n this.is = PropertyFactory.getProp(elem, data.is, 0, 0.01, this);\n this.convertToPath = this.convertStarToPath;\n } else {\n this.convertToPath = this.convertPolygonToPath;\n }\n this.pt = PropertyFactory.getProp(elem, data.pt, 0, 0, this);\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);\n this.r = PropertyFactory.getProp(elem, data.r, 0, degToRads, this);\n this.or = PropertyFactory.getProp(elem, data.or, 0, 0, this);\n this.os = PropertyFactory.getProp(elem, data.os, 0, 0.01, this);\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\n this.localShapeCollection.addShape(this.v);\n this.paths = this.localShapeCollection;\n if (this.dynamicProperties.length) {\n this.k = true;\n } else {\n this.k = false;\n this.convertToPath();\n }\n }\n StarShapePropertyFactory.prototype = {\n reset: resetShape,\n getValue: function getValue() {\n if (this.elem.globalData.frameId === this.frameId) {\n return;\n }\n this.frameId = this.elem.globalData.frameId;\n this.iterateDynamicProperties();\n if (this._mdf) {\n this.convertToPath();\n }\n },\n convertStarToPath: function convertStarToPath() {\n var numPts = Math.floor(this.pt.v) * 2;\n var angle = Math.PI * 2 / numPts;\n /* this.v.v.length = numPts;\n this.v.i.length = numPts;\n this.v.o.length = numPts; */\n var longFlag = true;\n var longRad = this.or.v;\n var shortRad = this.ir.v;\n var longRound = this.os.v;\n var shortRound = this.is.v;\n var longPerimSegment = 2 * Math.PI * longRad / (numPts * 2);\n var shortPerimSegment = 2 * Math.PI * shortRad / (numPts * 2);\n var i;\n var rad;\n var roundness;\n var perimSegment;\n var currentAng = -Math.PI / 2;\n currentAng += this.r.v;\n var dir = this.data.d === 3 ? -1 : 1;\n this.v._length = 0;\n for (i = 0; i < numPts; i += 1) {\n rad = longFlag ? longRad : shortRad;\n roundness = longFlag ? longRound : shortRound;\n perimSegment = longFlag ? longPerimSegment : shortPerimSegment;\n var x = rad * Math.cos(currentAng);\n var y = rad * Math.sin(currentAng);\n var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);\n var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);\n x += +this.p.v[0];\n y += +this.p.v[1];\n this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);\n\n /* this.v.v[i] = [x,y];\n this.v.i[i] = [x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir];\n this.v.o[i] = [x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir];\n this.v._length = numPts; */\n longFlag = !longFlag;\n currentAng += angle * dir;\n }\n },\n convertPolygonToPath: function convertPolygonToPath() {\n var numPts = Math.floor(this.pt.v);\n var angle = Math.PI * 2 / numPts;\n var rad = this.or.v;\n var roundness = this.os.v;\n var perimSegment = 2 * Math.PI * rad / (numPts * 4);\n var i;\n var currentAng = -Math.PI * 0.5;\n var dir = this.data.d === 3 ? -1 : 1;\n currentAng += this.r.v;\n this.v._length = 0;\n for (i = 0; i < numPts; i += 1) {\n var x = rad * Math.cos(currentAng);\n var y = rad * Math.sin(currentAng);\n var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);\n var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);\n x += +this.p.v[0];\n y += +this.p.v[1];\n this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);\n currentAng += angle * dir;\n }\n this.paths.length = 0;\n this.paths[0] = this.v;\n }\n };\n extendPrototype([DynamicPropertyContainer], StarShapePropertyFactory);\n return StarShapePropertyFactory;\n }();\n var RectShapeProperty = function () {\n function RectShapePropertyFactory(elem, data) {\n this.v = shapePool.newElement();\n this.v.c = true;\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\n this.localShapeCollection.addShape(this.v);\n this.paths = this.localShapeCollection;\n this.elem = elem;\n this.comp = elem.comp;\n this.frameId = -1;\n this.d = data.d;\n this.initDynamicPropertyContainer(elem);\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);\n this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);\n this.r = PropertyFactory.getProp(elem, data.r, 0, 0, this);\n if (this.dynamicProperties.length) {\n this.k = true;\n } else {\n this.k = false;\n this.convertRectToPath();\n }\n }\n RectShapePropertyFactory.prototype = {\n convertRectToPath: function convertRectToPath() {\n var p0 = this.p.v[0];\n var p1 = this.p.v[1];\n var v0 = this.s.v[0] / 2;\n var v1 = this.s.v[1] / 2;\n var round = bmMin(v0, v1, this.r.v);\n var cPoint = round * (1 - roundCorner);\n this.v._length = 0;\n if (this.d === 2 || this.d === 1) {\n this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, 0, true);\n this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, p0 + v0, p1 + v1 - round, 1, true);\n if (round !== 0) {\n this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, 2, true);\n this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0 + round, p1 + v1, 3, true);\n this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, 4, true);\n this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1 + round, 5, true);\n this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, 6, true);\n this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, p0 + v0 - round, p1 - v1, 7, true);\n } else {\n this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0, p1 + v1, 2);\n this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1, 3);\n }\n } else {\n this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, p0 + v0, p1 - v1 + round, 0, true);\n if (round !== 0) {\n this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, 1, true);\n this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0 + round, p1 - v1, 2, true);\n this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, 3, true);\n this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1 - round, 4, true);\n this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, 5, true);\n this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0 - round, p1 + v1, 6, true);\n this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, 7, true);\n } else {\n this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0, p1 - v1, 1, true);\n this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1, 2, true);\n this.v.setTripleAt(p0 + v0, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0, p1 + v1, 3, true);\n }\n }\n },\n getValue: function getValue() {\n if (this.elem.globalData.frameId === this.frameId) {\n return;\n }\n this.frameId = this.elem.globalData.frameId;\n this.iterateDynamicProperties();\n if (this._mdf) {\n this.convertRectToPath();\n }\n },\n reset: resetShape\n };\n extendPrototype([DynamicPropertyContainer], RectShapePropertyFactory);\n return RectShapePropertyFactory;\n }();\n function getShapeProp(elem, data, type) {\n var prop;\n if (type === 3 || type === 4) {\n var dataProp = type === 3 ? data.pt : data.ks;\n var keys = dataProp.k;\n if (keys.length) {\n prop = new KeyframedShapeProperty(elem, data, type);\n } else {\n prop = new ShapeProperty(elem, data, type);\n }\n } else if (type === 5) {\n prop = new RectShapeProperty(elem, data);\n } else if (type === 6) {\n prop = new EllShapeProperty(elem, data);\n } else if (type === 7) {\n prop = new StarShapeProperty(elem, data);\n }\n if (prop.k) {\n elem.addDynamicProperty(prop);\n }\n return prop;\n }\n function getConstructorFunction() {\n return ShapeProperty;\n }\n function getKeyframedConstructorFunction() {\n return KeyframedShapeProperty;\n }\n var ob = {};\n ob.getShapeProp = getShapeProp;\n ob.getConstructorFunction = getConstructorFunction;\n ob.getKeyframedConstructorFunction = getKeyframedConstructorFunction;\n return ob;\n }();\n\n /*!\n Transformation Matrix v2.0\n (c) Epistemex 2014-2015\n www.epistemex.com\n By Ken Fyrstenberg\n Contributions by leeoniya.\n License: MIT, header required.\n */\n\n /**\n * 2D transformation matrix object initialized with identity matrix.\n *\n * The matrix can synchronize a canvas context by supplying the context\n * as an argument, or later apply current absolute transform to an\n * existing context.\n *\n * All values are handled as floating point values.\n *\n * @param {CanvasRenderingContext2D} [context] - Optional context to sync with Matrix\n * @prop {number} a - scale x\n * @prop {number} b - shear y\n * @prop {number} c - shear x\n * @prop {number} d - scale y\n * @prop {number} e - translate x\n * @prop {number} f - translate y\n * @prop {CanvasRenderingContext2D|null} [context=null] - set or get current canvas context\n * @constructor\n */\n\n var Matrix = function () {\n var _cos = Math.cos;\n var _sin = Math.sin;\n var _tan = Math.tan;\n var _rnd = Math.round;\n function reset() {\n this.props[0] = 1;\n this.props[1] = 0;\n this.props[2] = 0;\n this.props[3] = 0;\n this.props[4] = 0;\n this.props[5] = 1;\n this.props[6] = 0;\n this.props[7] = 0;\n this.props[8] = 0;\n this.props[9] = 0;\n this.props[10] = 1;\n this.props[11] = 0;\n this.props[12] = 0;\n this.props[13] = 0;\n this.props[14] = 0;\n this.props[15] = 1;\n return this;\n }\n function rotate(angle) {\n if (angle === 0) {\n return this;\n }\n var mCos = _cos(angle);\n var mSin = _sin(angle);\n return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\n }\n function rotateX(angle) {\n if (angle === 0) {\n return this;\n }\n var mCos = _cos(angle);\n var mSin = _sin(angle);\n return this._t(1, 0, 0, 0, 0, mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1);\n }\n function rotateY(angle) {\n if (angle === 0) {\n return this;\n }\n var mCos = _cos(angle);\n var mSin = _sin(angle);\n return this._t(mCos, 0, mSin, 0, 0, 1, 0, 0, -mSin, 0, mCos, 0, 0, 0, 0, 1);\n }\n function rotateZ(angle) {\n if (angle === 0) {\n return this;\n }\n var mCos = _cos(angle);\n var mSin = _sin(angle);\n return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\n }\n function shear(sx, sy) {\n return this._t(1, sy, sx, 1, 0, 0);\n }\n function skew(ax, ay) {\n return this.shear(_tan(ax), _tan(ay));\n }\n function skewFromAxis(ax, angle) {\n var mCos = _cos(angle);\n var mSin = _sin(angle);\n return this._t(mCos, mSin, 0, 0, -mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)._t(1, 0, 0, 0, _tan(ax), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\n // return this._t(mCos, mSin, -mSin, mCos, 0, 0)._t(1, 0, _tan(ax), 1, 0, 0)._t(mCos, -mSin, mSin, mCos, 0, 0);\n }\n function scale(sx, sy, sz) {\n if (!sz && sz !== 0) {\n sz = 1;\n }\n if (sx === 1 && sy === 1 && sz === 1) {\n return this;\n }\n return this._t(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1);\n }\n function setTransform(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {\n this.props[0] = a;\n this.props[1] = b;\n this.props[2] = c;\n this.props[3] = d;\n this.props[4] = e;\n this.props[5] = f;\n this.props[6] = g;\n this.props[7] = h;\n this.props[8] = i;\n this.props[9] = j;\n this.props[10] = k;\n this.props[11] = l;\n this.props[12] = m;\n this.props[13] = n;\n this.props[14] = o;\n this.props[15] = p;\n return this;\n }\n function translate(tx, ty, tz) {\n tz = tz || 0;\n if (tx !== 0 || ty !== 0 || tz !== 0) {\n return this._t(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1);\n }\n return this;\n }\n function transform(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2) {\n var _p = this.props;\n if (a2 === 1 && b2 === 0 && c2 === 0 && d2 === 0 && e2 === 0 && f2 === 1 && g2 === 0 && h2 === 0 && i2 === 0 && j2 === 0 && k2 === 1 && l2 === 0) {\n // NOTE: commenting this condition because TurboFan deoptimizes code when present\n // if(m2 !== 0 || n2 !== 0 || o2 !== 0){\n _p[12] = _p[12] * a2 + _p[15] * m2;\n _p[13] = _p[13] * f2 + _p[15] * n2;\n _p[14] = _p[14] * k2 + _p[15] * o2;\n _p[15] *= p2;\n // }\n this._identityCalculated = false;\n return this;\n }\n var a1 = _p[0];\n var b1 = _p[1];\n var c1 = _p[2];\n var d1 = _p[3];\n var e1 = _p[4];\n var f1 = _p[5];\n var g1 = _p[6];\n var h1 = _p[7];\n var i1 = _p[8];\n var j1 = _p[9];\n var k1 = _p[10];\n var l1 = _p[11];\n var m1 = _p[12];\n var n1 = _p[13];\n var o1 = _p[14];\n var p1 = _p[15];\n\n /* matrix order (canvas compatible):\n * ace\n * bdf\n * 001\n */\n _p[0] = a1 * a2 + b1 * e2 + c1 * i2 + d1 * m2;\n _p[1] = a1 * b2 + b1 * f2 + c1 * j2 + d1 * n2;\n _p[2] = a1 * c2 + b1 * g2 + c1 * k2 + d1 * o2;\n _p[3] = a1 * d2 + b1 * h2 + c1 * l2 + d1 * p2;\n _p[4] = e1 * a2 + f1 * e2 + g1 * i2 + h1 * m2;\n _p[5] = e1 * b2 + f1 * f2 + g1 * j2 + h1 * n2;\n _p[6] = e1 * c2 + f1 * g2 + g1 * k2 + h1 * o2;\n _p[7] = e1 * d2 + f1 * h2 + g1 * l2 + h1 * p2;\n _p[8] = i1 * a2 + j1 * e2 + k1 * i2 + l1 * m2;\n _p[9] = i1 * b2 + j1 * f2 + k1 * j2 + l1 * n2;\n _p[10] = i1 * c2 + j1 * g2 + k1 * k2 + l1 * o2;\n _p[11] = i1 * d2 + j1 * h2 + k1 * l2 + l1 * p2;\n _p[12] = m1 * a2 + n1 * e2 + o1 * i2 + p1 * m2;\n _p[13] = m1 * b2 + n1 * f2 + o1 * j2 + p1 * n2;\n _p[14] = m1 * c2 + n1 * g2 + o1 * k2 + p1 * o2;\n _p[15] = m1 * d2 + n1 * h2 + o1 * l2 + p1 * p2;\n this._identityCalculated = false;\n return this;\n }\n function multiply(matrix) {\n var matrixProps = matrix.props;\n return this.transform(matrixProps[0], matrixProps[1], matrixProps[2], matrixProps[3], matrixProps[4], matrixProps[5], matrixProps[6], matrixProps[7], matrixProps[8], matrixProps[9], matrixProps[10], matrixProps[11], matrixProps[12], matrixProps[13], matrixProps[14], matrixProps[15]);\n }\n function isIdentity() {\n if (!this._identityCalculated) {\n this._identity = !(this.props[0] !== 1 || this.props[1] !== 0 || this.props[2] !== 0 || this.props[3] !== 0 || this.props[4] !== 0 || this.props[5] !== 1 || this.props[6] !== 0 || this.props[7] !== 0 || this.props[8] !== 0 || this.props[9] !== 0 || this.props[10] !== 1 || this.props[11] !== 0 || this.props[12] !== 0 || this.props[13] !== 0 || this.props[14] !== 0 || this.props[15] !== 1);\n this._identityCalculated = true;\n }\n return this._identity;\n }\n function equals(matr) {\n var i = 0;\n while (i < 16) {\n if (matr.props[i] !== this.props[i]) {\n return false;\n }\n i += 1;\n }\n return true;\n }\n function clone(matr) {\n var i;\n for (i = 0; i < 16; i += 1) {\n matr.props[i] = this.props[i];\n }\n return matr;\n }\n function cloneFromProps(props) {\n var i;\n for (i = 0; i < 16; i += 1) {\n this.props[i] = props[i];\n }\n }\n function applyToPoint(x, y, z) {\n return {\n x: x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],\n y: x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],\n z: x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]\n };\n /* return {\n x: x * me.a + y * me.c + me.e,\n y: x * me.b + y * me.d + me.f\n }; */\n }\n function applyToX(x, y, z) {\n return x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12];\n }\n function applyToY(x, y, z) {\n return x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13];\n }\n function applyToZ(x, y, z) {\n return x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14];\n }\n function getInverseMatrix() {\n var determinant = this.props[0] * this.props[5] - this.props[1] * this.props[4];\n var a = this.props[5] / determinant;\n var b = -this.props[1] / determinant;\n var c = -this.props[4] / determinant;\n var d = this.props[0] / determinant;\n var e = (this.props[4] * this.props[13] - this.props[5] * this.props[12]) / determinant;\n var f = -(this.props[0] * this.props[13] - this.props[1] * this.props[12]) / determinant;\n var inverseMatrix = new Matrix();\n inverseMatrix.props[0] = a;\n inverseMatrix.props[1] = b;\n inverseMatrix.props[4] = c;\n inverseMatrix.props[5] = d;\n inverseMatrix.props[12] = e;\n inverseMatrix.props[13] = f;\n return inverseMatrix;\n }\n function inversePoint(pt) {\n var inverseMatrix = this.getInverseMatrix();\n return inverseMatrix.applyToPointArray(pt[0], pt[1], pt[2] || 0);\n }\n function inversePoints(pts) {\n var i;\n var len = pts.length;\n var retPts = [];\n for (i = 0; i < len; i += 1) {\n retPts[i] = inversePoint(pts[i]);\n }\n return retPts;\n }\n function applyToTriplePoints(pt1, pt2, pt3) {\n var arr = createTypedArray('float32', 6);\n if (this.isIdentity()) {\n arr[0] = pt1[0];\n arr[1] = pt1[1];\n arr[2] = pt2[0];\n arr[3] = pt2[1];\n arr[4] = pt3[0];\n arr[5] = pt3[1];\n } else {\n var p0 = this.props[0];\n var p1 = this.props[1];\n var p4 = this.props[4];\n var p5 = this.props[5];\n var p12 = this.props[12];\n var p13 = this.props[13];\n arr[0] = pt1[0] * p0 + pt1[1] * p4 + p12;\n arr[1] = pt1[0] * p1 + pt1[1] * p5 + p13;\n arr[2] = pt2[0] * p0 + pt2[1] * p4 + p12;\n arr[3] = pt2[0] * p1 + pt2[1] * p5 + p13;\n arr[4] = pt3[0] * p0 + pt3[1] * p4 + p12;\n arr[5] = pt3[0] * p1 + pt3[1] * p5 + p13;\n }\n return arr;\n }\n function applyToPointArray(x, y, z) {\n var arr;\n if (this.isIdentity()) {\n arr = [x, y, z];\n } else {\n arr = [x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12], x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13], x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]];\n }\n return arr;\n }\n function applyToPointStringified(x, y) {\n if (this.isIdentity()) {\n return x + ',' + y;\n }\n var _p = this.props;\n return Math.round((x * _p[0] + y * _p[4] + _p[12]) * 100) / 100 + ',' + Math.round((x * _p[1] + y * _p[5] + _p[13]) * 100) / 100;\n }\n function toCSS() {\n // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.\n /* if(this.isIdentity()) {\n return '';\n } */\n var i = 0;\n var props = this.props;\n var cssValue = 'matrix3d(';\n var v = 10000;\n while (i < 16) {\n cssValue += _rnd(props[i] * v) / v;\n cssValue += i === 15 ? ')' : ',';\n i += 1;\n }\n return cssValue;\n }\n function roundMatrixProperty(val) {\n var v = 10000;\n if (val < 0.000001 && val > 0 || val > -0.000001 && val < 0) {\n return _rnd(val * v) / v;\n }\n return val;\n }\n function to2dCSS() {\n // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.\n /* if(this.isIdentity()) {\n return '';\n } */\n var props = this.props;\n var _a = roundMatrixProperty(props[0]);\n var _b = roundMatrixProperty(props[1]);\n var _c = roundMatrixProperty(props[4]);\n var _d = roundMatrixProperty(props[5]);\n var _e = roundMatrixProperty(props[12]);\n var _f = roundMatrixProperty(props[13]);\n return 'matrix(' + _a + ',' + _b + ',' + _c + ',' + _d + ',' + _e + ',' + _f + ')';\n }\n return function () {\n this.reset = reset;\n this.rotate = rotate;\n this.rotateX = rotateX;\n this.rotateY = rotateY;\n this.rotateZ = rotateZ;\n this.skew = skew;\n this.skewFromAxis = skewFromAxis;\n this.shear = shear;\n this.scale = scale;\n this.setTransform = setTransform;\n this.translate = translate;\n this.transform = transform;\n this.multiply = multiply;\n this.applyToPoint = applyToPoint;\n this.applyToX = applyToX;\n this.applyToY = applyToY;\n this.applyToZ = applyToZ;\n this.applyToPointArray = applyToPointArray;\n this.applyToTriplePoints = applyToTriplePoints;\n this.applyToPointStringified = applyToPointStringified;\n this.toCSS = toCSS;\n this.to2dCSS = to2dCSS;\n this.clone = clone;\n this.cloneFromProps = cloneFromProps;\n this.equals = equals;\n this.inversePoints = inversePoints;\n this.inversePoint = inversePoint;\n this.getInverseMatrix = getInverseMatrix;\n this._t = this.transform;\n this.isIdentity = isIdentity;\n this._identity = true;\n this._identityCalculated = false;\n this.props = createTypedArray('float32', 16);\n this.reset();\n };\n }();\n\n function _typeof$3(o) { \"@babel/helpers - typeof\"; return _typeof$3 = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof$3(o); }\n var lottie = {};\n var standalone = '__[STANDALONE]__';\n var animationData = '__[ANIMATIONDATA]__';\n var renderer = '';\n function setLocation(href) {\n setLocationHref(href);\n }\n function searchAnimations() {\n if (standalone === true) {\n animationManager.searchAnimations(animationData, standalone, renderer);\n } else {\n animationManager.searchAnimations();\n }\n }\n function setSubframeRendering(flag) {\n setSubframeEnabled(flag);\n }\n function setPrefix(prefix) {\n setIdPrefix(prefix);\n }\n function loadAnimation(params) {\n if (standalone === true) {\n params.animationData = JSON.parse(animationData);\n }\n return animationManager.loadAnimation(params);\n }\n function setQuality(value) {\n if (typeof value === 'string') {\n switch (value) {\n case 'high':\n setDefaultCurveSegments(200);\n break;\n default:\n case 'medium':\n setDefaultCurveSegments(50);\n break;\n case 'low':\n setDefaultCurveSegments(10);\n break;\n }\n } else if (!isNaN(value) && value > 1) {\n setDefaultCurveSegments(value);\n }\n if (getDefaultCurveSegments() >= 50) {\n roundValues(false);\n } else {\n roundValues(true);\n }\n }\n function inBrowser() {\n return typeof navigator !== 'undefined';\n }\n function installPlugin(type, plugin) {\n if (type === 'expressions') {\n setExpressionsPlugin(plugin);\n }\n }\n function getFactory(name) {\n switch (name) {\n case 'propertyFactory':\n return PropertyFactory;\n case 'shapePropertyFactory':\n return ShapePropertyFactory;\n case 'matrix':\n return Matrix;\n default:\n return null;\n }\n }\n lottie.play = animationManager.play;\n lottie.pause = animationManager.pause;\n lottie.setLocationHref = setLocation;\n lottie.togglePause = animationManager.togglePause;\n lottie.setSpeed = animationManager.setSpeed;\n lottie.setDirection = animationManager.setDirection;\n lottie.stop = animationManager.stop;\n lottie.searchAnimations = searchAnimations;\n lottie.registerAnimation = animationManager.registerAnimation;\n lottie.loadAnimation = loadAnimation;\n lottie.setSubframeRendering = setSubframeRendering;\n lottie.resize = animationManager.resize;\n // lottie.start = start;\n lottie.goToAndStop = animationManager.goToAndStop;\n lottie.destroy = animationManager.destroy;\n lottie.setQuality = setQuality;\n lottie.inBrowser = inBrowser;\n lottie.installPlugin = installPlugin;\n lottie.freeze = animationManager.freeze;\n lottie.unfreeze = animationManager.unfreeze;\n lottie.setVolume = animationManager.setVolume;\n lottie.mute = animationManager.mute;\n lottie.unmute = animationManager.unmute;\n lottie.getRegisteredAnimations = animationManager.getRegisteredAnimations;\n lottie.useWebWorker = setWebWorker;\n lottie.setIDPrefix = setPrefix;\n lottie.__getFactory = getFactory;\n lottie.version = '5.13.0';\n function checkReady() {\n if (document.readyState === 'complete') {\n clearInterval(readyStateCheckInterval);\n searchAnimations();\n }\n }\n function getQueryVariable(variable) {\n var vars = queryString.split('&');\n for (var i = 0; i < vars.length; i += 1) {\n var pair = vars[i].split('=');\n if (decodeURIComponent(pair[0]) == variable) {\n // eslint-disable-line eqeqeq\n return decodeURIComponent(pair[1]);\n }\n }\n return null;\n }\n var queryString = '';\n if (standalone) {\n var scripts = document.getElementsByTagName('script');\n var index = scripts.length - 1;\n var myScript = scripts[index] || {\n src: ''\n };\n queryString = myScript.src ? myScript.src.replace(/^[^\\?]+\\??/, '') : ''; // eslint-disable-line no-useless-escape\n renderer = getQueryVariable('renderer');\n }\n var readyStateCheckInterval = setInterval(checkReady, 100);\n\n // this adds bodymovin to the window object for backwards compatibility\n try {\n if (!((typeof exports === \"undefined\" ? \"undefined\" : _typeof$3(exports)) === 'object' && typeof module !== 'undefined') && !(typeof define === 'function' && define.amd) // eslint-disable-line no-undef\n ) {\n window.bodymovin = lottie;\n }\n } catch (err) {\n //\n }\n\n var ShapeModifiers = function () {\n var ob = {};\n var modifiers = {};\n ob.registerModifier = registerModifier;\n ob.getModifier = getModifier;\n function registerModifier(nm, factory) {\n if (!modifiers[nm]) {\n modifiers[nm] = factory;\n }\n }\n function getModifier(nm, elem, data) {\n return new modifiers[nm](elem, data);\n }\n return ob;\n }();\n function ShapeModifier() {}\n ShapeModifier.prototype.initModifierProperties = function () {};\n ShapeModifier.prototype.addShapeToModifier = function () {};\n ShapeModifier.prototype.addShape = function (data) {\n if (!this.closed) {\n // Adding shape to dynamic properties. It covers the case where a shape has no effects applied, to reset it's _mdf state on every tick.\n data.sh.container.addDynamicProperty(data.sh);\n var shapeData = {\n shape: data.sh,\n data: data,\n localShapeCollection: shapeCollectionPool.newShapeCollection()\n };\n this.shapes.push(shapeData);\n this.addShapeToModifier(shapeData);\n if (this._isAnimated) {\n data.setAsAnimated();\n }\n }\n };\n ShapeModifier.prototype.init = function (elem, data) {\n this.shapes = [];\n this.elem = elem;\n this.initDynamicPropertyContainer(elem);\n this.initModifierProperties(elem, data);\n this.frameId = initialDefaultFrame;\n this.closed = false;\n this.k = false;\n if (this.dynamicProperties.length) {\n this.k = true;\n } else {\n this.getValue(true);\n }\n };\n ShapeModifier.prototype.processKeys = function () {\n if (this.elem.globalData.frameId === this.frameId) {\n return;\n }\n this.frameId = this.elem.globalData.frameId;\n this.iterateDynamicProperties();\n };\n extendPrototype([DynamicPropertyContainer], ShapeModifier);\n\n function TrimModifier() {}\n extendPrototype([ShapeModifier], TrimModifier);\n TrimModifier.prototype.initModifierProperties = function (elem, data) {\n this.s = PropertyFactory.getProp(elem, data.s, 0, 0.01, this);\n this.e = PropertyFactory.getProp(elem, data.e, 0, 0.01, this);\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0, this);\n this.sValue = 0;\n this.eValue = 0;\n this.getValue = this.processKeys;\n this.m = data.m;\n this._isAnimated = !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length;\n };\n TrimModifier.prototype.addShapeToModifier = function (shapeData) {\n shapeData.pathsData = [];\n };\n TrimModifier.prototype.calculateShapeEdges = function (s, e, shapeLength, addedLength, totalModifierLength) {\n var segments = [];\n if (e <= 1) {\n segments.push({\n s: s,\n e: e\n });\n } else if (s >= 1) {\n segments.push({\n s: s - 1,\n e: e - 1\n });\n } else {\n segments.push({\n s: s,\n e: 1\n });\n segments.push({\n s: 0,\n e: e - 1\n });\n }\n var shapeSegments = [];\n var i;\n var len = segments.length;\n var segmentOb;\n for (i = 0; i < len; i += 1) {\n segmentOb = segments[i];\n if (!(segmentOb.e * totalModifierLength < addedLength || segmentOb.s * totalModifierLength > addedLength + shapeLength)) {\n var shapeS;\n var shapeE;\n if (segmentOb.s * totalModifierLength <= addedLength) {\n shapeS = 0;\n } else {\n shapeS = (segmentOb.s * totalModifierLength - addedLength) / shapeLength;\n }\n if (segmentOb.e * totalModifierLength >= addedLength + shapeLength) {\n shapeE = 1;\n } else {\n shapeE = (segmentOb.e * totalModifierLength - addedLength) / shapeLength;\n }\n shapeSegments.push([shapeS, shapeE]);\n }\n }\n if (!shapeSegments.length) {\n shapeSegments.push([0, 0]);\n }\n return shapeSegments;\n };\n TrimModifier.prototype.releasePathsData = function (pathsData) {\n var i;\n var len = pathsData.length;\n for (i = 0; i < len; i += 1) {\n segmentsLengthPool.release(pathsData[i]);\n }\n pathsData.length = 0;\n return pathsData;\n };\n TrimModifier.prototype.processShapes = function (_isFirstFrame) {\n var s;\n var e;\n if (this._mdf || _isFirstFrame) {\n var o = this.o.v % 360 / 360;\n if (o < 0) {\n o += 1;\n }\n if (this.s.v > 1) {\n s = 1 + o;\n } else if (this.s.v < 0) {\n s = 0 + o;\n } else {\n s = this.s.v + o;\n }\n if (this.e.v > 1) {\n e = 1 + o;\n } else if (this.e.v < 0) {\n e = 0 + o;\n } else {\n e = this.e.v + o;\n }\n if (s > e) {\n var _s = s;\n s = e;\n e = _s;\n }\n s = Math.round(s * 10000) * 0.0001;\n e = Math.round(e * 10000) * 0.0001;\n this.sValue = s;\n this.eValue = e;\n } else {\n s = this.sValue;\n e = this.eValue;\n }\n var shapePaths;\n var i;\n var len = this.shapes.length;\n var j;\n var jLen;\n var pathsData;\n var pathData;\n var totalShapeLength;\n var totalModifierLength = 0;\n if (e === s) {\n for (i = 0; i < len; i += 1) {\n this.shapes[i].localShapeCollection.releaseShapes();\n this.shapes[i].shape._mdf = true;\n this.shapes[i].shape.paths = this.shapes[i].localShapeCollection;\n if (this._mdf) {\n this.shapes[i].pathsData.length = 0;\n }\n }\n } else if (!(e === 1 && s === 0 || e === 0 && s === 1)) {\n var segments = [];\n var shapeData;\n var localShapeCollection;\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i];\n // if shape hasn't changed and trim properties haven't changed, cached previous path can be used\n if (!shapeData.shape._mdf && !this._mdf && !_isFirstFrame && this.m !== 2) {\n shapeData.shape.paths = shapeData.localShapeCollection;\n } else {\n shapePaths = shapeData.shape.paths;\n jLen = shapePaths._length;\n totalShapeLength = 0;\n if (!shapeData.shape._mdf && shapeData.pathsData.length) {\n totalShapeLength = shapeData.totalShapeLength;\n } else {\n pathsData = this.releasePathsData(shapeData.pathsData);\n for (j = 0; j < jLen; j += 1) {\n pathData = bez.getSegmentsLength(shapePaths.shapes[j]);\n pathsData.push(pathData);\n totalShapeLength += pathData.totalLength;\n }\n shapeData.totalShapeLength = totalShapeLength;\n shapeData.pathsData = pathsData;\n }\n totalModifierLength += totalShapeLength;\n shapeData.shape._mdf = true;\n }\n }\n var shapeS = s;\n var shapeE = e;\n var addedLength = 0;\n var edges;\n for (i = len - 1; i >= 0; i -= 1) {\n shapeData = this.shapes[i];\n if (shapeData.shape._mdf) {\n localShapeCollection = shapeData.localShapeCollection;\n localShapeCollection.releaseShapes();\n // if m === 2 means paths are trimmed individually so edges need to be found for this specific shape relative to whoel group\n if (this.m === 2 && len > 1) {\n edges = this.calculateShapeEdges(s, e, shapeData.totalShapeLength, addedLength, totalModifierLength);\n addedLength += shapeData.totalShapeLength;\n } else {\n edges = [[shapeS, shapeE]];\n }\n jLen = edges.length;\n for (j = 0; j < jLen; j += 1) {\n shapeS = edges[j][0];\n shapeE = edges[j][1];\n segments.length = 0;\n if (shapeE <= 1) {\n segments.push({\n s: shapeData.totalShapeLength * shapeS,\n e: shapeData.totalShapeLength * shapeE\n });\n } else if (shapeS >= 1) {\n segments.push({\n s: shapeData.totalShapeLength * (shapeS - 1),\n e: shapeData.totalShapeLength * (shapeE - 1)\n });\n } else {\n segments.push({\n s: shapeData.totalShapeLength * shapeS,\n e: shapeData.totalShapeLength\n });\n segments.push({\n s: 0,\n e: shapeData.totalShapeLength * (shapeE - 1)\n });\n }\n var newShapesData = this.addShapes(shapeData, segments[0]);\n if (segments[0].s !== segments[0].e) {\n if (segments.length > 1) {\n var lastShapeInCollection = shapeData.shape.paths.shapes[shapeData.shape.paths._length - 1];\n if (lastShapeInCollection.c) {\n var lastShape = newShapesData.pop();\n this.addPaths(newShapesData, localShapeCollection);\n newShapesData = this.addShapes(shapeData, segments[1], lastShape);\n } else {\n this.addPaths(newShapesData, localShapeCollection);\n newShapesData = this.addShapes(shapeData, segments[1]);\n }\n }\n this.addPaths(newShapesData, localShapeCollection);\n }\n }\n shapeData.shape.paths = localShapeCollection;\n }\n }\n } else if (this._mdf) {\n for (i = 0; i < len; i += 1) {\n // Releasign Trim Cached paths data when no trim applied in case shapes are modified inbetween.\n // Don't remove this even if it's losing cached info.\n this.shapes[i].pathsData.length = 0;\n this.shapes[i].shape._mdf = true;\n }\n }\n };\n TrimModifier.prototype.addPaths = function (newPaths, localShapeCollection) {\n var i;\n var len = newPaths.length;\n for (i = 0; i < len; i += 1) {\n localShapeCollection.addShape(newPaths[i]);\n }\n };\n TrimModifier.prototype.addSegment = function (pt1, pt2, pt3, pt4, shapePath, pos, newShape) {\n shapePath.setXYAt(pt2[0], pt2[1], 'o', pos);\n shapePath.setXYAt(pt3[0], pt3[1], 'i', pos + 1);\n if (newShape) {\n shapePath.setXYAt(pt1[0], pt1[1], 'v', pos);\n }\n shapePath.setXYAt(pt4[0], pt4[1], 'v', pos + 1);\n };\n TrimModifier.prototype.addSegmentFromArray = function (points, shapePath, pos, newShape) {\n shapePath.setXYAt(points[1], points[5], 'o', pos);\n shapePath.setXYAt(points[2], points[6], 'i', pos + 1);\n if (newShape) {\n shapePath.setXYAt(points[0], points[4], 'v', pos);\n }\n shapePath.setXYAt(points[3], points[7], 'v', pos + 1);\n };\n TrimModifier.prototype.addShapes = function (shapeData, shapeSegment, shapePath) {\n var pathsData = shapeData.pathsData;\n var shapePaths = shapeData.shape.paths.shapes;\n var i;\n var len = shapeData.shape.paths._length;\n var j;\n var jLen;\n var addedLength = 0;\n var currentLengthData;\n var segmentCount;\n var lengths;\n var segment;\n var shapes = [];\n var initPos;\n var newShape = true;\n if (!shapePath) {\n shapePath = shapePool.newElement();\n segmentCount = 0;\n initPos = 0;\n } else {\n segmentCount = shapePath._length;\n initPos = shapePath._length;\n }\n shapes.push(shapePath);\n for (i = 0; i < len; i += 1) {\n lengths = pathsData[i].lengths;\n shapePath.c = shapePaths[i].c;\n jLen = shapePaths[i].c ? lengths.length : lengths.length + 1;\n for (j = 1; j < jLen; j += 1) {\n currentLengthData = lengths[j - 1];\n if (addedLength + currentLengthData.addedLength < shapeSegment.s) {\n addedLength += currentLengthData.addedLength;\n shapePath.c = false;\n } else if (addedLength > shapeSegment.e) {\n shapePath.c = false;\n break;\n } else {\n if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + currentLengthData.addedLength) {\n this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[j], shapePaths[i].v[j], shapePath, segmentCount, newShape);\n newShape = false;\n } else {\n segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[j], shapePaths[i].o[j - 1], shapePaths[i].i[j], (shapeSegment.s - addedLength) / currentLengthData.addedLength, (shapeSegment.e - addedLength) / currentLengthData.addedLength, lengths[j - 1]);\n this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);\n // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);\n newShape = false;\n shapePath.c = false;\n }\n addedLength += currentLengthData.addedLength;\n segmentCount += 1;\n }\n }\n if (shapePaths[i].c && lengths.length) {\n currentLengthData = lengths[j - 1];\n if (addedLength <= shapeSegment.e) {\n var segmentLength = lengths[j - 1].addedLength;\n if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + segmentLength) {\n this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[0], shapePaths[i].v[0], shapePath, segmentCount, newShape);\n newShape = false;\n } else {\n segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[0], shapePaths[i].o[j - 1], shapePaths[i].i[0], (shapeSegment.s - addedLength) / segmentLength, (shapeSegment.e - addedLength) / segmentLength, lengths[j - 1]);\n this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);\n // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);\n newShape = false;\n shapePath.c = false;\n }\n } else {\n shapePath.c = false;\n }\n addedLength += currentLengthData.addedLength;\n segmentCount += 1;\n }\n if (shapePath._length) {\n shapePath.setXYAt(shapePath.v[initPos][0], shapePath.v[initPos][1], 'i', initPos);\n shapePath.setXYAt(shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1], 'o', shapePath._length - 1);\n }\n if (addedLength > shapeSegment.e) {\n break;\n }\n if (i < len - 1) {\n shapePath = shapePool.newElement();\n newShape = true;\n shapes.push(shapePath);\n segmentCount = 0;\n }\n }\n return shapes;\n };\n\n function PuckerAndBloatModifier() {}\n extendPrototype([ShapeModifier], PuckerAndBloatModifier);\n PuckerAndBloatModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys;\n this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this);\n this._isAnimated = !!this.amount.effectsSequence.length;\n };\n PuckerAndBloatModifier.prototype.processPath = function (path, amount) {\n var percent = amount / 100;\n var centerPoint = [0, 0];\n var pathLength = path._length;\n var i = 0;\n for (i = 0; i < pathLength; i += 1) {\n centerPoint[0] += path.v[i][0];\n centerPoint[1] += path.v[i][1];\n }\n centerPoint[0] /= pathLength;\n centerPoint[1] /= pathLength;\n var clonedPath = shapePool.newElement();\n clonedPath.c = path.c;\n var vX;\n var vY;\n var oX;\n var oY;\n var iX;\n var iY;\n for (i = 0; i < pathLength; i += 1) {\n vX = path.v[i][0] + (centerPoint[0] - path.v[i][0]) * percent;\n vY = path.v[i][1] + (centerPoint[1] - path.v[i][1]) * percent;\n oX = path.o[i][0] + (centerPoint[0] - path.o[i][0]) * -percent;\n oY = path.o[i][1] + (centerPoint[1] - path.o[i][1]) * -percent;\n iX = path.i[i][0] + (centerPoint[0] - path.i[i][0]) * -percent;\n iY = path.i[i][1] + (centerPoint[1] - path.i[i][1]) * -percent;\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, i);\n }\n return clonedPath;\n };\n PuckerAndBloatModifier.prototype.processShapes = function (_isFirstFrame) {\n var shapePaths;\n var i;\n var len = this.shapes.length;\n var j;\n var jLen;\n var amount = this.amount.v;\n if (amount !== 0) {\n var shapeData;\n var localShapeCollection;\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i];\n localShapeCollection = shapeData.localShapeCollection;\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\n localShapeCollection.releaseShapes();\n shapeData.shape._mdf = true;\n shapePaths = shapeData.shape.paths.shapes;\n jLen = shapeData.shape.paths._length;\n for (j = 0; j < jLen; j += 1) {\n localShapeCollection.addShape(this.processPath(shapePaths[j], amount));\n }\n }\n shapeData.shape.paths = shapeData.localShapeCollection;\n }\n }\n if (!this.dynamicProperties.length) {\n this._mdf = false;\n }\n };\n\n var TransformPropertyFactory = function () {\n var defaultVector = [0, 0];\n function applyToMatrix(mat) {\n var _mdf = this._mdf;\n this.iterateDynamicProperties();\n this._mdf = this._mdf || _mdf;\n if (this.a) {\n mat.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);\n }\n if (this.s) {\n mat.scale(this.s.v[0], this.s.v[1], this.s.v[2]);\n }\n if (this.sk) {\n mat.skewFromAxis(-this.sk.v, this.sa.v);\n }\n if (this.r) {\n mat.rotate(-this.r.v);\n } else {\n mat.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);\n }\n if (this.data.p.s) {\n if (this.data.p.z) {\n mat.translate(this.px.v, this.py.v, -this.pz.v);\n } else {\n mat.translate(this.px.v, this.py.v, 0);\n }\n } else {\n mat.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);\n }\n }\n function processKeys(forceRender) {\n if (this.elem.globalData.frameId === this.frameId) {\n return;\n }\n if (this._isDirty) {\n this.precalculateMatrix();\n this._isDirty = false;\n }\n this.iterateDynamicProperties();\n if (this._mdf || forceRender) {\n var frameRate;\n this.v.cloneFromProps(this.pre.props);\n if (this.appliedTransformations < 1) {\n this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);\n }\n if (this.appliedTransformations < 2) {\n this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2]);\n }\n if (this.sk && this.appliedTransformations < 3) {\n this.v.skewFromAxis(-this.sk.v, this.sa.v);\n }\n if (this.r && this.appliedTransformations < 4) {\n this.v.rotate(-this.r.v);\n } else if (!this.r && this.appliedTransformations < 4) {\n this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);\n }\n if (this.autoOriented) {\n var v1;\n var v2;\n frameRate = this.elem.globalData.frameRate;\n if (this.p && this.p.keyframes && this.p.getValueAtTime) {\n if (this.p._caching.lastFrame + this.p.offsetTime <= this.p.keyframes[0].t) {\n v1 = this.p.getValueAtTime((this.p.keyframes[0].t + 0.01) / frameRate, 0);\n v2 = this.p.getValueAtTime(this.p.keyframes[0].t / frameRate, 0);\n } else if (this.p._caching.lastFrame + this.p.offsetTime >= this.p.keyframes[this.p.keyframes.length - 1].t) {\n v1 = this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length - 1].t / frameRate, 0);\n v2 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - 0.05) / frameRate, 0);\n } else {\n v1 = this.p.pv;\n v2 = this.p.getValueAtTime((this.p._caching.lastFrame + this.p.offsetTime - 0.01) / frameRate, this.p.offsetTime);\n }\n } else if (this.px && this.px.keyframes && this.py.keyframes && this.px.getValueAtTime && this.py.getValueAtTime) {\n v1 = [];\n v2 = [];\n var px = this.px;\n var py = this.py;\n if (px._caching.lastFrame + px.offsetTime <= px.keyframes[0].t) {\n v1[0] = px.getValueAtTime((px.keyframes[0].t + 0.01) / frameRate, 0);\n v1[1] = py.getValueAtTime((py.keyframes[0].t + 0.01) / frameRate, 0);\n v2[0] = px.getValueAtTime(px.keyframes[0].t / frameRate, 0);\n v2[1] = py.getValueAtTime(py.keyframes[0].t / frameRate, 0);\n } else if (px._caching.lastFrame + px.offsetTime >= px.keyframes[px.keyframes.length - 1].t) {\n v1[0] = px.getValueAtTime(px.keyframes[px.keyframes.length - 1].t / frameRate, 0);\n v1[1] = py.getValueAtTime(py.keyframes[py.keyframes.length - 1].t / frameRate, 0);\n v2[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t - 0.01) / frameRate, 0);\n v2[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t - 0.01) / frameRate, 0);\n } else {\n v1 = [px.pv, py.pv];\n v2[0] = px.getValueAtTime((px._caching.lastFrame + px.offsetTime - 0.01) / frameRate, px.offsetTime);\n v2[1] = py.getValueAtTime((py._caching.lastFrame + py.offsetTime - 0.01) / frameRate, py.offsetTime);\n }\n } else {\n v2 = defaultVector;\n v1 = v2;\n }\n this.v.rotate(-Math.atan2(v1[1] - v2[1], v1[0] - v2[0]));\n }\n if (this.data.p && this.data.p.s) {\n if (this.data.p.z) {\n this.v.translate(this.px.v, this.py.v, -this.pz.v);\n } else {\n this.v.translate(this.px.v, this.py.v, 0);\n }\n } else {\n this.v.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);\n }\n }\n this.frameId = this.elem.globalData.frameId;\n }\n function precalculateMatrix() {\n this.appliedTransformations = 0;\n this.pre.reset();\n if (!this.a.effectsSequence.length) {\n this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);\n this.appliedTransformations = 1;\n } else {\n return;\n }\n if (!this.s.effectsSequence.length) {\n this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2]);\n this.appliedTransformations = 2;\n } else {\n return;\n }\n if (this.sk) {\n if (!this.sk.effectsSequence.length && !this.sa.effectsSequence.length) {\n this.pre.skewFromAxis(-this.sk.v, this.sa.v);\n this.appliedTransformations = 3;\n } else {\n return;\n }\n }\n if (this.r) {\n if (!this.r.effectsSequence.length) {\n this.pre.rotate(-this.r.v);\n this.appliedTransformations = 4;\n }\n } else if (!this.rz.effectsSequence.length && !this.ry.effectsSequence.length && !this.rx.effectsSequence.length && !this.or.effectsSequence.length) {\n this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);\n this.appliedTransformations = 4;\n }\n }\n function autoOrient() {\n //\n // var prevP = this.getValueAtTime();\n }\n function addDynamicProperty(prop) {\n this._addDynamicProperty(prop);\n this.elem.addDynamicProperty(prop);\n this._isDirty = true;\n }\n function TransformProperty(elem, data, container) {\n this.elem = elem;\n this.frameId = -1;\n this.propType = 'transform';\n this.data = data;\n this.v = new Matrix();\n // Precalculated matrix with non animated properties\n this.pre = new Matrix();\n this.appliedTransformations = 0;\n this.initDynamicPropertyContainer(container || elem);\n if (data.p && data.p.s) {\n this.px = PropertyFactory.getProp(elem, data.p.x, 0, 0, this);\n this.py = PropertyFactory.getProp(elem, data.p.y, 0, 0, this);\n if (data.p.z) {\n this.pz = PropertyFactory.getProp(elem, data.p.z, 0, 0, this);\n }\n } else {\n this.p = PropertyFactory.getProp(elem, data.p || {\n k: [0, 0, 0]\n }, 1, 0, this);\n }\n if (data.rx) {\n this.rx = PropertyFactory.getProp(elem, data.rx, 0, degToRads, this);\n this.ry = PropertyFactory.getProp(elem, data.ry, 0, degToRads, this);\n this.rz = PropertyFactory.getProp(elem, data.rz, 0, degToRads, this);\n if (data.or.k[0].ti) {\n var i;\n var len = data.or.k.length;\n for (i = 0; i < len; i += 1) {\n data.or.k[i].to = null;\n data.or.k[i].ti = null;\n }\n }\n this.or = PropertyFactory.getProp(elem, data.or, 1, degToRads, this);\n // sh Indicates it needs to be capped between -180 and 180\n this.or.sh = true;\n } else {\n this.r = PropertyFactory.getProp(elem, data.r || {\n k: 0\n }, 0, degToRads, this);\n }\n if (data.sk) {\n this.sk = PropertyFactory.getProp(elem, data.sk, 0, degToRads, this);\n this.sa = PropertyFactory.getProp(elem, data.sa, 0, degToRads, this);\n }\n this.a = PropertyFactory.getProp(elem, data.a || {\n k: [0, 0, 0]\n }, 1, 0, this);\n this.s = PropertyFactory.getProp(elem, data.s || {\n k: [100, 100, 100]\n }, 1, 0.01, this);\n // Opacity is not part of the transform properties, that's why it won't use this.dynamicProperties. That way transforms won't get updated if opacity changes.\n if (data.o) {\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, elem);\n } else {\n this.o = {\n _mdf: false,\n v: 1\n };\n }\n this._isDirty = true;\n if (!this.dynamicProperties.length) {\n this.getValue(true);\n }\n }\n TransformProperty.prototype = {\n applyToMatrix: applyToMatrix,\n getValue: processKeys,\n precalculateMatrix: precalculateMatrix,\n autoOrient: autoOrient\n };\n extendPrototype([DynamicPropertyContainer], TransformProperty);\n TransformProperty.prototype.addDynamicProperty = addDynamicProperty;\n TransformProperty.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty;\n function getTransformProperty(elem, data, container) {\n return new TransformProperty(elem, data, container);\n }\n return {\n getTransformProperty: getTransformProperty\n };\n }();\n\n function RepeaterModifier() {}\n extendPrototype([ShapeModifier], RepeaterModifier);\n RepeaterModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys;\n this.c = PropertyFactory.getProp(elem, data.c, 0, null, this);\n this.o = PropertyFactory.getProp(elem, data.o, 0, null, this);\n this.tr = TransformPropertyFactory.getTransformProperty(elem, data.tr, this);\n this.so = PropertyFactory.getProp(elem, data.tr.so, 0, 0.01, this);\n this.eo = PropertyFactory.getProp(elem, data.tr.eo, 0, 0.01, this);\n this.data = data;\n if (!this.dynamicProperties.length) {\n this.getValue(true);\n }\n this._isAnimated = !!this.dynamicProperties.length;\n this.pMatrix = new Matrix();\n this.rMatrix = new Matrix();\n this.sMatrix = new Matrix();\n this.tMatrix = new Matrix();\n this.matrix = new Matrix();\n };\n RepeaterModifier.prototype.applyTransforms = function (pMatrix, rMatrix, sMatrix, transform, perc, inv) {\n var dir = inv ? -1 : 1;\n var scaleX = transform.s.v[0] + (1 - transform.s.v[0]) * (1 - perc);\n var scaleY = transform.s.v[1] + (1 - transform.s.v[1]) * (1 - perc);\n pMatrix.translate(transform.p.v[0] * dir * perc, transform.p.v[1] * dir * perc, transform.p.v[2]);\n rMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);\n rMatrix.rotate(-transform.r.v * dir * perc);\n rMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);\n sMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);\n sMatrix.scale(inv ? 1 / scaleX : scaleX, inv ? 1 / scaleY : scaleY);\n sMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);\n };\n RepeaterModifier.prototype.init = function (elem, arr, pos, elemsData) {\n this.elem = elem;\n this.arr = arr;\n this.pos = pos;\n this.elemsData = elemsData;\n this._currentCopies = 0;\n this._elements = [];\n this._groups = [];\n this.frameId = -1;\n this.initDynamicPropertyContainer(elem);\n this.initModifierProperties(elem, arr[pos]);\n while (pos > 0) {\n pos -= 1;\n // this._elements.unshift(arr.splice(pos,1)[0]);\n this._elements.unshift(arr[pos]);\n }\n if (this.dynamicProperties.length) {\n this.k = true;\n } else {\n this.getValue(true);\n }\n };\n RepeaterModifier.prototype.resetElements = function (elements) {\n var i;\n var len = elements.length;\n for (i = 0; i < len; i += 1) {\n elements[i]._processed = false;\n if (elements[i].ty === 'gr') {\n this.resetElements(elements[i].it);\n }\n }\n };\n RepeaterModifier.prototype.cloneElements = function (elements) {\n var newElements = JSON.parse(JSON.stringify(elements));\n this.resetElements(newElements);\n return newElements;\n };\n RepeaterModifier.prototype.changeGroupRender = function (elements, renderFlag) {\n var i;\n var len = elements.length;\n for (i = 0; i < len; i += 1) {\n elements[i]._render = renderFlag;\n if (elements[i].ty === 'gr') {\n this.changeGroupRender(elements[i].it, renderFlag);\n }\n }\n };\n RepeaterModifier.prototype.processShapes = function (_isFirstFrame) {\n var items;\n var itemsTransform;\n var i;\n var dir;\n var cont;\n var hasReloaded = false;\n if (this._mdf || _isFirstFrame) {\n var copies = Math.ceil(this.c.v);\n if (this._groups.length < copies) {\n while (this._groups.length < copies) {\n var group = {\n it: this.cloneElements(this._elements),\n ty: 'gr'\n };\n group.it.push({\n a: {\n a: 0,\n ix: 1,\n k: [0, 0]\n },\n nm: 'Transform',\n o: {\n a: 0,\n ix: 7,\n k: 100\n },\n p: {\n a: 0,\n ix: 2,\n k: [0, 0]\n },\n r: {\n a: 1,\n ix: 6,\n k: [{\n s: 0,\n e: 0,\n t: 0\n }, {\n s: 0,\n e: 0,\n t: 1\n }]\n },\n s: {\n a: 0,\n ix: 3,\n k: [100, 100]\n },\n sa: {\n a: 0,\n ix: 5,\n k: 0\n },\n sk: {\n a: 0,\n ix: 4,\n k: 0\n },\n ty: 'tr'\n });\n this.arr.splice(0, 0, group);\n this._groups.splice(0, 0, group);\n this._currentCopies += 1;\n }\n this.elem.reloadShapes();\n hasReloaded = true;\n }\n cont = 0;\n var renderFlag;\n for (i = 0; i <= this._groups.length - 1; i += 1) {\n renderFlag = cont < copies;\n this._groups[i]._render = renderFlag;\n this.changeGroupRender(this._groups[i].it, renderFlag);\n if (!renderFlag) {\n var elems = this.elemsData[i].it;\n var transformData = elems[elems.length - 1];\n if (transformData.transform.op.v !== 0) {\n transformData.transform.op._mdf = true;\n transformData.transform.op.v = 0;\n } else {\n transformData.transform.op._mdf = false;\n }\n }\n cont += 1;\n }\n this._currentCopies = copies;\n /// /\n\n var offset = this.o.v;\n var offsetModulo = offset % 1;\n var roundOffset = offset > 0 ? Math.floor(offset) : Math.ceil(offset);\n var pProps = this.pMatrix.props;\n var rProps = this.rMatrix.props;\n var sProps = this.sMatrix.props;\n this.pMatrix.reset();\n this.rMatrix.reset();\n this.sMatrix.reset();\n this.tMatrix.reset();\n this.matrix.reset();\n var iteration = 0;\n if (offset > 0) {\n while (iteration < roundOffset) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);\n iteration += 1;\n }\n if (offsetModulo) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, offsetModulo, false);\n iteration += offsetModulo;\n }\n } else if (offset < 0) {\n while (iteration > roundOffset) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, true);\n iteration -= 1;\n }\n if (offsetModulo) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, -offsetModulo, true);\n iteration -= offsetModulo;\n }\n }\n i = this.data.m === 1 ? 0 : this._currentCopies - 1;\n dir = this.data.m === 1 ? 1 : -1;\n cont = this._currentCopies;\n var j;\n var jLen;\n while (cont) {\n items = this.elemsData[i].it;\n itemsTransform = items[items.length - 1].transform.mProps.v.props;\n jLen = itemsTransform.length;\n items[items.length - 1].transform.mProps._mdf = true;\n items[items.length - 1].transform.op._mdf = true;\n items[items.length - 1].transform.op.v = this._currentCopies === 1 ? this.so.v : this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1));\n if (iteration !== 0) {\n if (i !== 0 && dir === 1 || i !== this._currentCopies - 1 && dir === -1) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);\n }\n this.matrix.transform(rProps[0], rProps[1], rProps[2], rProps[3], rProps[4], rProps[5], rProps[6], rProps[7], rProps[8], rProps[9], rProps[10], rProps[11], rProps[12], rProps[13], rProps[14], rProps[15]);\n this.matrix.transform(sProps[0], sProps[1], sProps[2], sProps[3], sProps[4], sProps[5], sProps[6], sProps[7], sProps[8], sProps[9], sProps[10], sProps[11], sProps[12], sProps[13], sProps[14], sProps[15]);\n this.matrix.transform(pProps[0], pProps[1], pProps[2], pProps[3], pProps[4], pProps[5], pProps[6], pProps[7], pProps[8], pProps[9], pProps[10], pProps[11], pProps[12], pProps[13], pProps[14], pProps[15]);\n for (j = 0; j < jLen; j += 1) {\n itemsTransform[j] = this.matrix.props[j];\n }\n this.matrix.reset();\n } else {\n this.matrix.reset();\n for (j = 0; j < jLen; j += 1) {\n itemsTransform[j] = this.matrix.props[j];\n }\n }\n iteration += 1;\n cont -= 1;\n i += dir;\n }\n } else {\n cont = this._currentCopies;\n i = 0;\n dir = 1;\n while (cont) {\n items = this.elemsData[i].it;\n itemsTransform = items[items.length - 1].transform.mProps.v.props;\n items[items.length - 1].transform.mProps._mdf = false;\n items[items.length - 1].transform.op._mdf = false;\n cont -= 1;\n i += dir;\n }\n }\n return hasReloaded;\n };\n RepeaterModifier.prototype.addShape = function () {};\n\n function RoundCornersModifier() {}\n extendPrototype([ShapeModifier], RoundCornersModifier);\n RoundCornersModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys;\n this.rd = PropertyFactory.getProp(elem, data.r, 0, null, this);\n this._isAnimated = !!this.rd.effectsSequence.length;\n };\n RoundCornersModifier.prototype.processPath = function (path, round) {\n var clonedPath = shapePool.newElement();\n clonedPath.c = path.c;\n var i;\n var len = path._length;\n var currentV;\n var currentI;\n var currentO;\n var closerV;\n var distance;\n var newPosPerc;\n var index = 0;\n var vX;\n var vY;\n var oX;\n var oY;\n var iX;\n var iY;\n for (i = 0; i < len; i += 1) {\n currentV = path.v[i];\n currentO = path.o[i];\n currentI = path.i[i];\n if (currentV[0] === currentO[0] && currentV[1] === currentO[1] && currentV[0] === currentI[0] && currentV[1] === currentI[1]) {\n if ((i === 0 || i === len - 1) && !path.c) {\n clonedPath.setTripleAt(currentV[0], currentV[1], currentO[0], currentO[1], currentI[0], currentI[1], index);\n /* clonedPath.v[index] = currentV;\n clonedPath.o[index] = currentO;\n clonedPath.i[index] = currentI; */\n index += 1;\n } else {\n if (i === 0) {\n closerV = path.v[len - 1];\n } else {\n closerV = path.v[i - 1];\n }\n distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));\n newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;\n iX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;\n vX = iX;\n iY = currentV[1] - (currentV[1] - closerV[1]) * newPosPerc;\n vY = iY;\n oX = vX - (vX - currentV[0]) * roundCorner;\n oY = vY - (vY - currentV[1]) * roundCorner;\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index);\n index += 1;\n if (i === len - 1) {\n closerV = path.v[0];\n } else {\n closerV = path.v[i + 1];\n }\n distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));\n newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;\n oX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;\n vX = oX;\n oY = currentV[1] + (closerV[1] - currentV[1]) * newPosPerc;\n vY = oY;\n iX = vX - (vX - currentV[0]) * roundCorner;\n iY = vY - (vY - currentV[1]) * roundCorner;\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index);\n index += 1;\n }\n } else {\n clonedPath.setTripleAt(path.v[i][0], path.v[i][1], path.o[i][0], path.o[i][1], path.i[i][0], path.i[i][1], index);\n index += 1;\n }\n }\n return clonedPath;\n };\n RoundCornersModifier.prototype.processShapes = function (_isFirstFrame) {\n var shapePaths;\n var i;\n var len = this.shapes.length;\n var j;\n var jLen;\n var rd = this.rd.v;\n if (rd !== 0) {\n var shapeData;\n var localShapeCollection;\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i];\n localShapeCollection = shapeData.localShapeCollection;\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\n localShapeCollection.releaseShapes();\n shapeData.shape._mdf = true;\n shapePaths = shapeData.shape.paths.shapes;\n jLen = shapeData.shape.paths._length;\n for (j = 0; j < jLen; j += 1) {\n localShapeCollection.addShape(this.processPath(shapePaths[j], rd));\n }\n }\n shapeData.shape.paths = shapeData.localShapeCollection;\n }\n }\n if (!this.dynamicProperties.length) {\n this._mdf = false;\n }\n };\n\n function floatEqual(a, b) {\n return Math.abs(a - b) * 100000 <= Math.min(Math.abs(a), Math.abs(b));\n }\n function floatZero(f) {\n return Math.abs(f) <= 0.00001;\n }\n function lerp(p0, p1, amount) {\n return p0 * (1 - amount) + p1 * amount;\n }\n function lerpPoint(p0, p1, amount) {\n return [lerp(p0[0], p1[0], amount), lerp(p0[1], p1[1], amount)];\n }\n function quadRoots(a, b, c) {\n // no root\n if (a === 0) return [];\n var s = b * b - 4 * a * c;\n // Complex roots\n if (s < 0) return [];\n var singleRoot = -b / (2 * a);\n // 1 root\n if (s === 0) return [singleRoot];\n var delta = Math.sqrt(s) / (2 * a);\n // 2 roots\n return [singleRoot - delta, singleRoot + delta];\n }\n function polynomialCoefficients(p0, p1, p2, p3) {\n return [-p0 + 3 * p1 - 3 * p2 + p3, 3 * p0 - 6 * p1 + 3 * p2, -3 * p0 + 3 * p1, p0];\n }\n function singlePoint(p) {\n return new PolynomialBezier(p, p, p, p, false);\n }\n function PolynomialBezier(p0, p1, p2, p3, linearize) {\n if (linearize && pointEqual(p0, p1)) {\n p1 = lerpPoint(p0, p3, 1 / 3);\n }\n if (linearize && pointEqual(p2, p3)) {\n p2 = lerpPoint(p0, p3, 2 / 3);\n }\n var coeffx = polynomialCoefficients(p0[0], p1[0], p2[0], p3[0]);\n var coeffy = polynomialCoefficients(p0[1], p1[1], p2[1], p3[1]);\n this.a = [coeffx[0], coeffy[0]];\n this.b = [coeffx[1], coeffy[1]];\n this.c = [coeffx[2], coeffy[2]];\n this.d = [coeffx[3], coeffy[3]];\n this.points = [p0, p1, p2, p3];\n }\n PolynomialBezier.prototype.point = function (t) {\n return [((this.a[0] * t + this.b[0]) * t + this.c[0]) * t + this.d[0], ((this.a[1] * t + this.b[1]) * t + this.c[1]) * t + this.d[1]];\n };\n PolynomialBezier.prototype.derivative = function (t) {\n return [(3 * t * this.a[0] + 2 * this.b[0]) * t + this.c[0], (3 * t * this.a[1] + 2 * this.b[1]) * t + this.c[1]];\n };\n PolynomialBezier.prototype.tangentAngle = function (t) {\n var p = this.derivative(t);\n return Math.atan2(p[1], p[0]);\n };\n PolynomialBezier.prototype.normalAngle = function (t) {\n var p = this.derivative(t);\n return Math.atan2(p[0], p[1]);\n };\n PolynomialBezier.prototype.inflectionPoints = function () {\n var denom = this.a[1] * this.b[0] - this.a[0] * this.b[1];\n if (floatZero(denom)) return [];\n var tcusp = -0.5 * (this.a[1] * this.c[0] - this.a[0] * this.c[1]) / denom;\n var square = tcusp * tcusp - 1 / 3 * (this.b[1] * this.c[0] - this.b[0] * this.c[1]) / denom;\n if (square < 0) return [];\n var root = Math.sqrt(square);\n if (floatZero(root)) {\n if (root > 0 && root < 1) return [tcusp];\n return [];\n }\n return [tcusp - root, tcusp + root].filter(function (r) {\n return r > 0 && r < 1;\n });\n };\n PolynomialBezier.prototype.split = function (t) {\n if (t <= 0) return [singlePoint(this.points[0]), this];\n if (t >= 1) return [this, singlePoint(this.points[this.points.length - 1])];\n var p10 = lerpPoint(this.points[0], this.points[1], t);\n var p11 = lerpPoint(this.points[1], this.points[2], t);\n var p12 = lerpPoint(this.points[2], this.points[3], t);\n var p20 = lerpPoint(p10, p11, t);\n var p21 = lerpPoint(p11, p12, t);\n var p3 = lerpPoint(p20, p21, t);\n return [new PolynomialBezier(this.points[0], p10, p20, p3, true), new PolynomialBezier(p3, p21, p12, this.points[3], true)];\n };\n function extrema(bez, comp) {\n var min = bez.points[0][comp];\n var max = bez.points[bez.points.length - 1][comp];\n if (min > max) {\n var e = max;\n max = min;\n min = e;\n }\n // Derivative roots to find min/max\n var f = quadRoots(3 * bez.a[comp], 2 * bez.b[comp], bez.c[comp]);\n for (var i = 0; i < f.length; i += 1) {\n if (f[i] > 0 && f[i] < 1) {\n var val = bez.point(f[i])[comp];\n if (val < min) min = val;else if (val > max) max = val;\n }\n }\n return {\n min: min,\n max: max\n };\n }\n PolynomialBezier.prototype.bounds = function () {\n return {\n x: extrema(this, 0),\n y: extrema(this, 1)\n };\n };\n PolynomialBezier.prototype.boundingBox = function () {\n var bounds = this.bounds();\n return {\n left: bounds.x.min,\n right: bounds.x.max,\n top: bounds.y.min,\n bottom: bounds.y.max,\n width: bounds.x.max - bounds.x.min,\n height: bounds.y.max - bounds.y.min,\n cx: (bounds.x.max + bounds.x.min) / 2,\n cy: (bounds.y.max + bounds.y.min) / 2\n };\n };\n function intersectData(bez, t1, t2) {\n var box = bez.boundingBox();\n return {\n cx: box.cx,\n cy: box.cy,\n width: box.width,\n height: box.height,\n bez: bez,\n t: (t1 + t2) / 2,\n t1: t1,\n t2: t2\n };\n }\n function splitData(data) {\n var split = data.bez.split(0.5);\n return [intersectData(split[0], data.t1, data.t), intersectData(split[1], data.t, data.t2)];\n }\n function boxIntersect(b1, b2) {\n return Math.abs(b1.cx - b2.cx) * 2 < b1.width + b2.width && Math.abs(b1.cy - b2.cy) * 2 < b1.height + b2.height;\n }\n function intersectsImpl(d1, d2, depth, tolerance, intersections, maxRecursion) {\n if (!boxIntersect(d1, d2)) return;\n if (depth >= maxRecursion || d1.width <= tolerance && d1.height <= tolerance && d2.width <= tolerance && d2.height <= tolerance) {\n intersections.push([d1.t, d2.t]);\n return;\n }\n var d1s = splitData(d1);\n var d2s = splitData(d2);\n intersectsImpl(d1s[0], d2s[0], depth + 1, tolerance, intersections, maxRecursion);\n intersectsImpl(d1s[0], d2s[1], depth + 1, tolerance, intersections, maxRecursion);\n intersectsImpl(d1s[1], d2s[0], depth + 1, tolerance, intersections, maxRecursion);\n intersectsImpl(d1s[1], d2s[1], depth + 1, tolerance, intersections, maxRecursion);\n }\n PolynomialBezier.prototype.intersections = function (other, tolerance, maxRecursion) {\n if (tolerance === undefined) tolerance = 2;\n if (maxRecursion === undefined) maxRecursion = 7;\n var intersections = [];\n intersectsImpl(intersectData(this, 0, 1), intersectData(other, 0, 1), 0, tolerance, intersections, maxRecursion);\n return intersections;\n };\n PolynomialBezier.shapeSegment = function (shapePath, index) {\n var nextIndex = (index + 1) % shapePath.length();\n return new PolynomialBezier(shapePath.v[index], shapePath.o[index], shapePath.i[nextIndex], shapePath.v[nextIndex], true);\n };\n PolynomialBezier.shapeSegmentInverted = function (shapePath, index) {\n var nextIndex = (index + 1) % shapePath.length();\n return new PolynomialBezier(shapePath.v[nextIndex], shapePath.i[nextIndex], shapePath.o[index], shapePath.v[index], true);\n };\n function crossProduct(a, b) {\n return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];\n }\n function lineIntersection(start1, end1, start2, end2) {\n var v1 = [start1[0], start1[1], 1];\n var v2 = [end1[0], end1[1], 1];\n var v3 = [start2[0], start2[1], 1];\n var v4 = [end2[0], end2[1], 1];\n var r = crossProduct(crossProduct(v1, v2), crossProduct(v3, v4));\n if (floatZero(r[2])) return null;\n return [r[0] / r[2], r[1] / r[2]];\n }\n function polarOffset(p, angle, length) {\n return [p[0] + Math.cos(angle) * length, p[1] - Math.sin(angle) * length];\n }\n function pointDistance(p1, p2) {\n return Math.hypot(p1[0] - p2[0], p1[1] - p2[1]);\n }\n function pointEqual(p1, p2) {\n return floatEqual(p1[0], p2[0]) && floatEqual(p1[1], p2[1]);\n }\n\n function ZigZagModifier() {}\n extendPrototype([ShapeModifier], ZigZagModifier);\n ZigZagModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys;\n this.amplitude = PropertyFactory.getProp(elem, data.s, 0, null, this);\n this.frequency = PropertyFactory.getProp(elem, data.r, 0, null, this);\n this.pointsType = PropertyFactory.getProp(elem, data.pt, 0, null, this);\n this._isAnimated = this.amplitude.effectsSequence.length !== 0 || this.frequency.effectsSequence.length !== 0 || this.pointsType.effectsSequence.length !== 0;\n };\n function setPoint(outputBezier, point, angle, direction, amplitude, outAmplitude, inAmplitude) {\n var angO = angle - Math.PI / 2;\n var angI = angle + Math.PI / 2;\n var px = point[0] + Math.cos(angle) * direction * amplitude;\n var py = point[1] - Math.sin(angle) * direction * amplitude;\n outputBezier.setTripleAt(px, py, px + Math.cos(angO) * outAmplitude, py - Math.sin(angO) * outAmplitude, px + Math.cos(angI) * inAmplitude, py - Math.sin(angI) * inAmplitude, outputBezier.length());\n }\n function getPerpendicularVector(pt1, pt2) {\n var vector = [pt2[0] - pt1[0], pt2[1] - pt1[1]];\n var rot = -Math.PI * 0.5;\n var rotatedVector = [Math.cos(rot) * vector[0] - Math.sin(rot) * vector[1], Math.sin(rot) * vector[0] + Math.cos(rot) * vector[1]];\n return rotatedVector;\n }\n function getProjectingAngle(path, cur) {\n var prevIndex = cur === 0 ? path.length() - 1 : cur - 1;\n var nextIndex = (cur + 1) % path.length();\n var prevPoint = path.v[prevIndex];\n var nextPoint = path.v[nextIndex];\n var pVector = getPerpendicularVector(prevPoint, nextPoint);\n return Math.atan2(0, 1) - Math.atan2(pVector[1], pVector[0]);\n }\n function zigZagCorner(outputBezier, path, cur, amplitude, frequency, pointType, direction) {\n var angle = getProjectingAngle(path, cur);\n var point = path.v[cur % path._length];\n var prevPoint = path.v[cur === 0 ? path._length - 1 : cur - 1];\n var nextPoint = path.v[(cur + 1) % path._length];\n var prevDist = pointType === 2 ? Math.sqrt(Math.pow(point[0] - prevPoint[0], 2) + Math.pow(point[1] - prevPoint[1], 2)) : 0;\n var nextDist = pointType === 2 ? Math.sqrt(Math.pow(point[0] - nextPoint[0], 2) + Math.pow(point[1] - nextPoint[1], 2)) : 0;\n setPoint(outputBezier, path.v[cur % path._length], angle, direction, amplitude, nextDist / ((frequency + 1) * 2), prevDist / ((frequency + 1) * 2), pointType);\n }\n function zigZagSegment(outputBezier, segment, amplitude, frequency, pointType, direction) {\n for (var i = 0; i < frequency; i += 1) {\n var t = (i + 1) / (frequency + 1);\n var dist = pointType === 2 ? Math.sqrt(Math.pow(segment.points[3][0] - segment.points[0][0], 2) + Math.pow(segment.points[3][1] - segment.points[0][1], 2)) : 0;\n var angle = segment.normalAngle(t);\n var point = segment.point(t);\n setPoint(outputBezier, point, angle, direction, amplitude, dist / ((frequency + 1) * 2), dist / ((frequency + 1) * 2), pointType);\n direction = -direction;\n }\n return direction;\n }\n ZigZagModifier.prototype.processPath = function (path, amplitude, frequency, pointType) {\n var count = path._length;\n var clonedPath = shapePool.newElement();\n clonedPath.c = path.c;\n if (!path.c) {\n count -= 1;\n }\n if (count === 0) return clonedPath;\n var direction = -1;\n var segment = PolynomialBezier.shapeSegment(path, 0);\n zigZagCorner(clonedPath, path, 0, amplitude, frequency, pointType, direction);\n for (var i = 0; i < count; i += 1) {\n direction = zigZagSegment(clonedPath, segment, amplitude, frequency, pointType, -direction);\n if (i === count - 1 && !path.c) {\n segment = null;\n } else {\n segment = PolynomialBezier.shapeSegment(path, (i + 1) % count);\n }\n zigZagCorner(clonedPath, path, i + 1, amplitude, frequency, pointType, direction);\n }\n return clonedPath;\n };\n ZigZagModifier.prototype.processShapes = function (_isFirstFrame) {\n var shapePaths;\n var i;\n var len = this.shapes.length;\n var j;\n var jLen;\n var amplitude = this.amplitude.v;\n var frequency = Math.max(0, Math.round(this.frequency.v));\n var pointType = this.pointsType.v;\n if (amplitude !== 0) {\n var shapeData;\n var localShapeCollection;\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i];\n localShapeCollection = shapeData.localShapeCollection;\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\n localShapeCollection.releaseShapes();\n shapeData.shape._mdf = true;\n shapePaths = shapeData.shape.paths.shapes;\n jLen = shapeData.shape.paths._length;\n for (j = 0; j < jLen; j += 1) {\n localShapeCollection.addShape(this.processPath(shapePaths[j], amplitude, frequency, pointType));\n }\n }\n shapeData.shape.paths = shapeData.localShapeCollection;\n }\n }\n if (!this.dynamicProperties.length) {\n this._mdf = false;\n }\n };\n\n function linearOffset(p1, p2, amount) {\n var angle = Math.atan2(p2[0] - p1[0], p2[1] - p1[1]);\n return [polarOffset(p1, angle, amount), polarOffset(p2, angle, amount)];\n }\n function offsetSegment(segment, amount) {\n var p0;\n var p1a;\n var p1b;\n var p2b;\n var p2a;\n var p3;\n var e;\n e = linearOffset(segment.points[0], segment.points[1], amount);\n p0 = e[0];\n p1a = e[1];\n e = linearOffset(segment.points[1], segment.points[2], amount);\n p1b = e[0];\n p2b = e[1];\n e = linearOffset(segment.points[2], segment.points[3], amount);\n p2a = e[0];\n p3 = e[1];\n var p1 = lineIntersection(p0, p1a, p1b, p2b);\n if (p1 === null) p1 = p1a;\n var p2 = lineIntersection(p2a, p3, p1b, p2b);\n if (p2 === null) p2 = p2a;\n return new PolynomialBezier(p0, p1, p2, p3);\n }\n function joinLines(outputBezier, seg1, seg2, lineJoin, miterLimit) {\n var p0 = seg1.points[3];\n var p1 = seg2.points[0];\n\n // Bevel\n if (lineJoin === 3) return p0;\n\n // Connected, they don't need a joint\n if (pointEqual(p0, p1)) return p0;\n\n // Round\n if (lineJoin === 2) {\n var angleOut = -seg1.tangentAngle(1);\n var angleIn = -seg2.tangentAngle(0) + Math.PI;\n var center = lineIntersection(p0, polarOffset(p0, angleOut + Math.PI / 2, 100), p1, polarOffset(p1, angleOut + Math.PI / 2, 100));\n var radius = center ? pointDistance(center, p0) : pointDistance(p0, p1) / 2;\n var tan = polarOffset(p0, angleOut, 2 * radius * roundCorner);\n outputBezier.setXYAt(tan[0], tan[1], 'o', outputBezier.length() - 1);\n tan = polarOffset(p1, angleIn, 2 * radius * roundCorner);\n outputBezier.setTripleAt(p1[0], p1[1], p1[0], p1[1], tan[0], tan[1], outputBezier.length());\n return p1;\n }\n\n // Miter\n var t0 = pointEqual(p0, seg1.points[2]) ? seg1.points[0] : seg1.points[2];\n var t1 = pointEqual(p1, seg2.points[1]) ? seg2.points[3] : seg2.points[1];\n var intersection = lineIntersection(t0, p0, p1, t1);\n if (intersection && pointDistance(intersection, p0) < miterLimit) {\n outputBezier.setTripleAt(intersection[0], intersection[1], intersection[0], intersection[1], intersection[0], intersection[1], outputBezier.length());\n return intersection;\n }\n return p0;\n }\n function getIntersection(a, b) {\n var intersect = a.intersections(b);\n if (intersect.length && floatEqual(intersect[0][0], 1)) intersect.shift();\n if (intersect.length) return intersect[0];\n return null;\n }\n function pruneSegmentIntersection(a, b) {\n var outa = a.slice();\n var outb = b.slice();\n var intersect = getIntersection(a[a.length - 1], b[0]);\n if (intersect) {\n outa[a.length - 1] = a[a.length - 1].split(intersect[0])[0];\n outb[0] = b[0].split(intersect[1])[1];\n }\n if (a.length > 1 && b.length > 1) {\n intersect = getIntersection(a[0], b[b.length - 1]);\n if (intersect) {\n return [[a[0].split(intersect[0])[0]], [b[b.length - 1].split(intersect[1])[1]]];\n }\n }\n return [outa, outb];\n }\n function pruneIntersections(segments) {\n var e;\n for (var i = 1; i < segments.length; i += 1) {\n e = pruneSegmentIntersection(segments[i - 1], segments[i]);\n segments[i - 1] = e[0];\n segments[i] = e[1];\n }\n if (segments.length > 1) {\n e = pruneSegmentIntersection(segments[segments.length - 1], segments[0]);\n segments[segments.length - 1] = e[0];\n segments[0] = e[1];\n }\n return segments;\n }\n function offsetSegmentSplit(segment, amount) {\n /*\n We split each bezier segment into smaller pieces based\n on inflection points, this ensures the control point\n polygon is convex.\n (A cubic bezier can have none, one, or two inflection points)\n */\n var flex = segment.inflectionPoints();\n var left;\n var right;\n var split;\n var mid;\n if (flex.length === 0) {\n return [offsetSegment(segment, amount)];\n }\n if (flex.length === 1 || floatEqual(flex[1], 1)) {\n split = segment.split(flex[0]);\n left = split[0];\n right = split[1];\n return [offsetSegment(left, amount), offsetSegment(right, amount)];\n }\n split = segment.split(flex[0]);\n left = split[0];\n var t = (flex[1] - flex[0]) / (1 - flex[0]);\n split = split[1].split(t);\n mid = split[0];\n right = split[1];\n return [offsetSegment(left, amount), offsetSegment(mid, amount), offsetSegment(right, amount)];\n }\n function OffsetPathModifier() {}\n extendPrototype([ShapeModifier], OffsetPathModifier);\n OffsetPathModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys;\n this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this);\n this.miterLimit = PropertyFactory.getProp(elem, data.ml, 0, null, this);\n this.lineJoin = data.lj;\n this._isAnimated = this.amount.effectsSequence.length !== 0;\n };\n OffsetPathModifier.prototype.processPath = function (inputBezier, amount, lineJoin, miterLimit) {\n var outputBezier = shapePool.newElement();\n outputBezier.c = inputBezier.c;\n var count = inputBezier.length();\n if (!inputBezier.c) {\n count -= 1;\n }\n var i;\n var j;\n var segment;\n var multiSegments = [];\n for (i = 0; i < count; i += 1) {\n segment = PolynomialBezier.shapeSegment(inputBezier, i);\n multiSegments.push(offsetSegmentSplit(segment, amount));\n }\n if (!inputBezier.c) {\n for (i = count - 1; i >= 0; i -= 1) {\n segment = PolynomialBezier.shapeSegmentInverted(inputBezier, i);\n multiSegments.push(offsetSegmentSplit(segment, amount));\n }\n }\n multiSegments = pruneIntersections(multiSegments);\n\n // Add bezier segments to the output and apply line joints\n var lastPoint = null;\n var lastSeg = null;\n for (i = 0; i < multiSegments.length; i += 1) {\n var multiSegment = multiSegments[i];\n if (lastSeg) lastPoint = joinLines(outputBezier, lastSeg, multiSegment[0], lineJoin, miterLimit);\n lastSeg = multiSegment[multiSegment.length - 1];\n for (j = 0; j < multiSegment.length; j += 1) {\n segment = multiSegment[j];\n if (lastPoint && pointEqual(segment.points[0], lastPoint)) {\n outputBezier.setXYAt(segment.points[1][0], segment.points[1][1], 'o', outputBezier.length() - 1);\n } else {\n outputBezier.setTripleAt(segment.points[0][0], segment.points[0][1], segment.points[1][0], segment.points[1][1], segment.points[0][0], segment.points[0][1], outputBezier.length());\n }\n outputBezier.setTripleAt(segment.points[3][0], segment.points[3][1], segment.points[3][0], segment.points[3][1], segment.points[2][0], segment.points[2][1], outputBezier.length());\n lastPoint = segment.points[3];\n }\n }\n if (multiSegments.length) joinLines(outputBezier, lastSeg, multiSegments[0][0], lineJoin, miterLimit);\n return outputBezier;\n };\n OffsetPathModifier.prototype.processShapes = function (_isFirstFrame) {\n var shapePaths;\n var i;\n var len = this.shapes.length;\n var j;\n var jLen;\n var amount = this.amount.v;\n var miterLimit = this.miterLimit.v;\n var lineJoin = this.lineJoin;\n if (amount !== 0) {\n var shapeData;\n var localShapeCollection;\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i];\n localShapeCollection = shapeData.localShapeCollection;\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\n localShapeCollection.releaseShapes();\n shapeData.shape._mdf = true;\n shapePaths = shapeData.shape.paths.shapes;\n jLen = shapeData.shape.paths._length;\n for (j = 0; j < jLen; j += 1) {\n localShapeCollection.addShape(this.processPath(shapePaths[j], amount, lineJoin, miterLimit));\n }\n }\n shapeData.shape.paths = shapeData.localShapeCollection;\n }\n }\n if (!this.dynamicProperties.length) {\n this._mdf = false;\n }\n };\n\n function getFontProperties(fontData) {\n var styles = fontData.fStyle ? fontData.fStyle.split(' ') : [];\n var fWeight = 'normal';\n var fStyle = 'normal';\n var len = styles.length;\n var styleName;\n for (var i = 0; i < len; i += 1) {\n styleName = styles[i].toLowerCase();\n switch (styleName) {\n case 'italic':\n fStyle = 'italic';\n break;\n case 'bold':\n fWeight = '700';\n break;\n case 'black':\n fWeight = '900';\n break;\n case 'medium':\n fWeight = '500';\n break;\n case 'regular':\n case 'normal':\n fWeight = '400';\n break;\n case 'light':\n case 'thin':\n fWeight = '200';\n break;\n default:\n break;\n }\n }\n return {\n style: fStyle,\n weight: fontData.fWeight || fWeight\n };\n }\n\n var FontManager = function () {\n var maxWaitingTime = 5000;\n var emptyChar = {\n w: 0,\n size: 0,\n shapes: [],\n data: {\n shapes: []\n }\n };\n var combinedCharacters = [];\n // Hindi characters\n combinedCharacters = combinedCharacters.concat([2304, 2305, 2306, 2307, 2362, 2363, 2364, 2364, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2387, 2388, 2389, 2390, 2391, 2402, 2403]);\n var BLACK_FLAG_CODE_POINT = 127988;\n var CANCEL_TAG_CODE_POINT = 917631;\n var A_TAG_CODE_POINT = 917601;\n var Z_TAG_CODE_POINT = 917626;\n var VARIATION_SELECTOR_16_CODE_POINT = 65039;\n var ZERO_WIDTH_JOINER_CODE_POINT = 8205;\n var REGIONAL_CHARACTER_A_CODE_POINT = 127462;\n var REGIONAL_CHARACTER_Z_CODE_POINT = 127487;\n var surrogateModifiers = ['d83cdffb', 'd83cdffc', 'd83cdffd', 'd83cdffe', 'd83cdfff'];\n function trimFontOptions(font) {\n var familyArray = font.split(',');\n var i;\n var len = familyArray.length;\n var enabledFamilies = [];\n for (i = 0; i < len; i += 1) {\n if (familyArray[i] !== 'sans-serif' && familyArray[i] !== 'monospace') {\n enabledFamilies.push(familyArray[i]);\n }\n }\n return enabledFamilies.join(',');\n }\n function setUpNode(font, family) {\n var parentNode = createTag('span');\n // Node is invisible to screen readers.\n parentNode.setAttribute('aria-hidden', true);\n parentNode.style.fontFamily = family;\n var node = createTag('span');\n // Characters that vary significantly among different fonts\n node.innerText = 'giItT1WQy@!-/#';\n // Visible - so we can measure it - but not on the screen\n parentNode.style.position = 'absolute';\n parentNode.style.left = '-10000px';\n parentNode.style.top = '-10000px';\n // Large font size makes even subtle changes obvious\n parentNode.style.fontSize = '300px';\n // Reset any font properties\n parentNode.style.fontVariant = 'normal';\n parentNode.style.fontStyle = 'normal';\n parentNode.style.fontWeight = 'normal';\n parentNode.style.letterSpacing = '0';\n parentNode.appendChild(node);\n document.body.appendChild(parentNode);\n\n // Remember width with no applied web font\n var width = node.offsetWidth;\n node.style.fontFamily = trimFontOptions(font) + ', ' + family;\n return {\n node: node,\n w: width,\n parent: parentNode\n };\n }\n function checkLoadedFonts() {\n var i;\n var len = this.fonts.length;\n var node;\n var w;\n var loadedCount = len;\n for (i = 0; i < len; i += 1) {\n if (this.fonts[i].loaded) {\n loadedCount -= 1;\n } else if (this.fonts[i].fOrigin === 'n' || this.fonts[i].origin === 0) {\n this.fonts[i].loaded = true;\n } else {\n node = this.fonts[i].monoCase.node;\n w = this.fonts[i].monoCase.w;\n if (node.offsetWidth !== w) {\n loadedCount -= 1;\n this.fonts[i].loaded = true;\n } else {\n node = this.fonts[i].sansCase.node;\n w = this.fonts[i].sansCase.w;\n if (node.offsetWidth !== w) {\n loadedCount -= 1;\n this.fonts[i].loaded = true;\n }\n }\n if (this.fonts[i].loaded) {\n this.fonts[i].sansCase.parent.parentNode.removeChild(this.fonts[i].sansCase.parent);\n this.fonts[i].monoCase.parent.parentNode.removeChild(this.fonts[i].monoCase.parent);\n }\n }\n }\n if (loadedCount !== 0 && Date.now() - this.initTime < maxWaitingTime) {\n setTimeout(this.checkLoadedFontsBinded, 20);\n } else {\n setTimeout(this.setIsLoadedBinded, 10);\n }\n }\n function createHelper(fontData, def) {\n var engine = document.body && def ? 'svg' : 'canvas';\n var helper;\n var fontProps = getFontProperties(fontData);\n if (engine === 'svg') {\n var tHelper = createNS('text');\n tHelper.style.fontSize = '100px';\n // tHelper.style.fontFamily = fontData.fFamily;\n tHelper.setAttribute('font-family', fontData.fFamily);\n tHelper.setAttribute('font-style', fontProps.style);\n tHelper.setAttribute('font-weight', fontProps.weight);\n tHelper.textContent = '1';\n if (fontData.fClass) {\n tHelper.style.fontFamily = 'inherit';\n tHelper.setAttribute('class', fontData.fClass);\n } else {\n tHelper.style.fontFamily = fontData.fFamily;\n }\n def.appendChild(tHelper);\n helper = tHelper;\n } else {\n var tCanvasHelper = new OffscreenCanvas(500, 500).getContext('2d');\n tCanvasHelper.font = fontProps.style + ' ' + fontProps.weight + ' 100px ' + fontData.fFamily;\n helper = tCanvasHelper;\n }\n function measure(text) {\n if (engine === 'svg') {\n helper.textContent = text;\n return helper.getComputedTextLength();\n }\n return helper.measureText(text).width;\n }\n return {\n measureText: measure\n };\n }\n function addFonts(fontData, defs) {\n if (!fontData) {\n this.isLoaded = true;\n return;\n }\n if (this.chars) {\n this.isLoaded = true;\n this.fonts = fontData.list;\n return;\n }\n if (!document.body) {\n this.isLoaded = true;\n fontData.list.forEach(function (data) {\n data.helper = createHelper(data);\n data.cache = {};\n });\n this.fonts = fontData.list;\n return;\n }\n var fontArr = fontData.list;\n var i;\n var len = fontArr.length;\n var _pendingFonts = len;\n for (i = 0; i < len; i += 1) {\n var shouldLoadFont = true;\n var loadedSelector;\n var j;\n fontArr[i].loaded = false;\n fontArr[i].monoCase = setUpNode(fontArr[i].fFamily, 'monospace');\n fontArr[i].sansCase = setUpNode(fontArr[i].fFamily, 'sans-serif');\n if (!fontArr[i].fPath) {\n fontArr[i].loaded = true;\n _pendingFonts -= 1;\n } else if (fontArr[i].fOrigin === 'p' || fontArr[i].origin === 3) {\n loadedSelector = document.querySelectorAll('style[f-forigin=\"p\"][f-family=\"' + fontArr[i].fFamily + '\"], style[f-origin=\"3\"][f-family=\"' + fontArr[i].fFamily + '\"]');\n if (loadedSelector.length > 0) {\n shouldLoadFont = false;\n }\n if (shouldLoadFont) {\n var s = createTag('style');\n s.setAttribute('f-forigin', fontArr[i].fOrigin);\n s.setAttribute('f-origin', fontArr[i].origin);\n s.setAttribute('f-family', fontArr[i].fFamily);\n s.type = 'text/css';\n s.innerText = '@font-face {font-family: ' + fontArr[i].fFamily + \"; font-style: normal; src: url('\" + fontArr[i].fPath + \"');}\";\n defs.appendChild(s);\n }\n } else if (fontArr[i].fOrigin === 'g' || fontArr[i].origin === 1) {\n loadedSelector = document.querySelectorAll('link[f-forigin=\"g\"], link[f-origin=\"1\"]');\n for (j = 0; j < loadedSelector.length; j += 1) {\n if (loadedSelector[j].href.indexOf(fontArr[i].fPath) !== -1) {\n // Font is already loaded\n shouldLoadFont = false;\n }\n }\n if (shouldLoadFont) {\n var l = createTag('link');\n l.setAttribute('f-forigin', fontArr[i].fOrigin);\n l.setAttribute('f-origin', fontArr[i].origin);\n l.type = 'text/css';\n l.rel = 'stylesheet';\n l.href = fontArr[i].fPath;\n document.body.appendChild(l);\n }\n } else if (fontArr[i].fOrigin === 't' || fontArr[i].origin === 2) {\n loadedSelector = document.querySelectorAll('script[f-forigin=\"t\"], script[f-origin=\"2\"]');\n for (j = 0; j < loadedSelector.length; j += 1) {\n if (fontArr[i].fPath === loadedSelector[j].src) {\n // Font is already loaded\n shouldLoadFont = false;\n }\n }\n if (shouldLoadFont) {\n var sc = createTag('link');\n sc.setAttribute('f-forigin', fontArr[i].fOrigin);\n sc.setAttribute('f-origin', fontArr[i].origin);\n sc.setAttribute('rel', 'stylesheet');\n sc.setAttribute('href', fontArr[i].fPath);\n defs.appendChild(sc);\n }\n }\n fontArr[i].helper = createHelper(fontArr[i], defs);\n fontArr[i].cache = {};\n this.fonts.push(fontArr[i]);\n }\n if (_pendingFonts === 0) {\n this.isLoaded = true;\n } else {\n // On some cases even if the font is loaded, it won't load correctly when measuring text on canvas.\n // Adding this timeout seems to fix it\n setTimeout(this.checkLoadedFonts.bind(this), 100);\n }\n }\n function addChars(chars) {\n if (!chars) {\n return;\n }\n if (!this.chars) {\n this.chars = [];\n }\n var i;\n var len = chars.length;\n var j;\n var jLen = this.chars.length;\n var found;\n for (i = 0; i < len; i += 1) {\n j = 0;\n found = false;\n while (j < jLen) {\n if (this.chars[j].style === chars[i].style && this.chars[j].fFamily === chars[i].fFamily && this.chars[j].ch === chars[i].ch) {\n found = true;\n }\n j += 1;\n }\n if (!found) {\n this.chars.push(chars[i]);\n jLen += 1;\n }\n }\n }\n function getCharData(_char, style, font) {\n var i = 0;\n var len = this.chars.length;\n while (i < len) {\n if (this.chars[i].ch === _char && this.chars[i].style === style && this.chars[i].fFamily === font) {\n return this.chars[i];\n }\n i += 1;\n }\n if ((typeof _char === 'string' && _char.charCodeAt(0) !== 13 || !_char) && console && console.warn // eslint-disable-line no-console\n && !this._warned) {\n this._warned = true;\n console.warn('Missing character from exported characters list: ', _char, style, font); // eslint-disable-line no-console\n }\n return emptyChar;\n }\n function measureText(_char2, fontName, size) {\n var fontData = this.getFontByName(fontName);\n // Using the char instead of char.charCodeAt(0)\n // to avoid collisions between equal chars\n var index = _char2;\n if (!fontData.cache[index]) {\n var tHelper = fontData.helper;\n if (_char2 === ' ') {\n var doubleSize = tHelper.measureText('|' + _char2 + '|');\n var singleSize = tHelper.measureText('||');\n fontData.cache[index] = (doubleSize - singleSize) / 100;\n } else {\n fontData.cache[index] = tHelper.measureText(_char2) / 100;\n }\n }\n return fontData.cache[index] * size;\n }\n function getFontByName(name) {\n var i = 0;\n var len = this.fonts.length;\n while (i < len) {\n if (this.fonts[i].fName === name) {\n return this.fonts[i];\n }\n i += 1;\n }\n return this.fonts[0];\n }\n function getCodePoint(string) {\n var codePoint = 0;\n var first = string.charCodeAt(0);\n if (first >= 0xD800 && first <= 0xDBFF) {\n var second = string.charCodeAt(1);\n if (second >= 0xDC00 && second <= 0xDFFF) {\n codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n }\n }\n return codePoint;\n }\n\n // Skin tone modifiers\n function isModifier(firstCharCode, secondCharCode) {\n var sum = firstCharCode.toString(16) + secondCharCode.toString(16);\n return surrogateModifiers.indexOf(sum) !== -1;\n }\n function isZeroWidthJoiner(charCode) {\n return charCode === ZERO_WIDTH_JOINER_CODE_POINT;\n }\n\n // This codepoint may change the appearance of the preceding character.\n // If that is a symbol, dingbat or emoji, U+FE0F forces it to be rendered\n // as a colorful image as compared to a monochrome text variant.\n function isVariationSelector(charCode) {\n return charCode === VARIATION_SELECTOR_16_CODE_POINT;\n }\n\n // The regional indicator symbols are a set of 26 alphabetic Unicode\n /// characters (A\u2013Z) intended to be used to encode ISO 3166-1 alpha-2\n // two-letter country codes in a way that allows optional special treatment.\n function isRegionalCode(string) {\n var codePoint = getCodePoint(string);\n if (codePoint >= REGIONAL_CHARACTER_A_CODE_POINT && codePoint <= REGIONAL_CHARACTER_Z_CODE_POINT) {\n return true;\n }\n return false;\n }\n\n // Some Emoji implementations represent combinations of\n // two \u201Cregional indicator\u201D letters as a single flag symbol.\n function isFlagEmoji(string) {\n return isRegionalCode(string.substr(0, 2)) && isRegionalCode(string.substr(2, 2));\n }\n function isCombinedCharacter(_char3) {\n return combinedCharacters.indexOf(_char3) !== -1;\n }\n\n // Regional flags start with a BLACK_FLAG_CODE_POINT\n // folowed by 5 chars in the TAG range\n // and end with a CANCEL_TAG_CODE_POINT\n function isRegionalFlag(text, index) {\n var codePoint = getCodePoint(text.substr(index, 2));\n if (codePoint !== BLACK_FLAG_CODE_POINT) {\n return false;\n }\n var count = 0;\n index += 2;\n while (count < 5) {\n codePoint = getCodePoint(text.substr(index, 2));\n if (codePoint < A_TAG_CODE_POINT || codePoint > Z_TAG_CODE_POINT) {\n return false;\n }\n count += 1;\n index += 2;\n }\n return getCodePoint(text.substr(index, 2)) === CANCEL_TAG_CODE_POINT;\n }\n function setIsLoaded() {\n this.isLoaded = true;\n }\n var Font = function Font() {\n this.fonts = [];\n this.chars = null;\n this.typekitLoaded = 0;\n this.isLoaded = false;\n this._warned = false;\n this.initTime = Date.now();\n this.setIsLoadedBinded = this.setIsLoaded.bind(this);\n this.checkLoadedFontsBinded = this.checkLoadedFonts.bind(this);\n };\n Font.isModifier = isModifier;\n Font.isZeroWidthJoiner = isZeroWidthJoiner;\n Font.isFlagEmoji = isFlagEmoji;\n Font.isRegionalCode = isRegionalCode;\n Font.isCombinedCharacter = isCombinedCharacter;\n Font.isRegionalFlag = isRegionalFlag;\n Font.isVariationSelector = isVariationSelector;\n Font.BLACK_FLAG_CODE_POINT = BLACK_FLAG_CODE_POINT;\n var fontPrototype = {\n addChars: addChars,\n addFonts: addFonts,\n getCharData: getCharData,\n getFontByName: getFontByName,\n measureText: measureText,\n checkLoadedFonts: checkLoadedFonts,\n setIsLoaded: setIsLoaded\n };\n Font.prototype = fontPrototype;\n return Font;\n }();\n\n function SlotManager(animationData) {\n this.animationData = animationData;\n }\n SlotManager.prototype.getProp = function (data) {\n if (this.animationData.slots && this.animationData.slots[data.sid]) {\n return Object.assign(data, this.animationData.slots[data.sid].p);\n }\n return data;\n };\n function slotFactory(animationData) {\n return new SlotManager(animationData);\n }\n\n function RenderableElement() {}\n RenderableElement.prototype = {\n initRenderable: function initRenderable() {\n // layer's visibility related to inpoint and outpoint. Rename isVisible to isInRange\n this.isInRange = false;\n // layer's display state\n this.hidden = false;\n // If layer's transparency equals 0, it can be hidden\n this.isTransparent = false;\n // list of animated components\n this.renderableComponents = [];\n },\n addRenderableComponent: function addRenderableComponent(component) {\n if (this.renderableComponents.indexOf(component) === -1) {\n this.renderableComponents.push(component);\n }\n },\n removeRenderableComponent: function removeRenderableComponent(component) {\n if (this.renderableComponents.indexOf(component) !== -1) {\n this.renderableComponents.splice(this.renderableComponents.indexOf(component), 1);\n }\n },\n prepareRenderableFrame: function prepareRenderableFrame(num) {\n this.checkLayerLimits(num);\n },\n checkTransparency: function checkTransparency() {\n if (this.finalTransform.mProp.o.v <= 0) {\n if (!this.isTransparent && this.globalData.renderConfig.hideOnTransparent) {\n this.isTransparent = true;\n this.hide();\n }\n } else if (this.isTransparent) {\n this.isTransparent = false;\n this.show();\n }\n },\n /**\n * @function\n * Initializes frame related properties.\n *\n * @param {number} num\n * current frame number in Layer's time\n *\n */\n checkLayerLimits: function checkLayerLimits(num) {\n if (this.data.ip - this.data.st <= num && this.data.op - this.data.st > num) {\n if (this.isInRange !== true) {\n this.globalData._mdf = true;\n this._mdf = true;\n this.isInRange = true;\n this.show();\n }\n } else if (this.isInRange !== false) {\n this.globalData._mdf = true;\n this.isInRange = false;\n this.hide();\n }\n },\n renderRenderable: function renderRenderable() {\n var i;\n var len = this.renderableComponents.length;\n for (i = 0; i < len; i += 1) {\n this.renderableComponents[i].renderFrame(this._isFirstFrame);\n }\n /* this.maskManager.renderFrame(this.finalTransform.mat);\n this.renderableEffectsManager.renderFrame(this._isFirstFrame); */\n },\n sourceRectAtTime: function sourceRectAtTime() {\n return {\n top: 0,\n left: 0,\n width: 100,\n height: 100\n };\n },\n getLayerSize: function getLayerSize() {\n if (this.data.ty === 5) {\n return {\n w: this.data.textData.width,\n h: this.data.textData.height\n };\n }\n return {\n w: this.data.width,\n h: this.data.height\n };\n }\n };\n\n var getBlendMode = function () {\n var blendModeEnums = {\n 0: 'source-over',\n 1: 'multiply',\n 2: 'screen',\n 3: 'overlay',\n 4: 'darken',\n 5: 'lighten',\n 6: 'color-dodge',\n 7: 'color-burn',\n 8: 'hard-light',\n 9: 'soft-light',\n 10: 'difference',\n 11: 'exclusion',\n 12: 'hue',\n 13: 'saturation',\n 14: 'color',\n 15: 'luminosity'\n };\n return function (mode) {\n return blendModeEnums[mode] || '';\n };\n }();\n\n function SliderEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\n }\n function AngleEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\n }\n function ColorEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);\n }\n function PointEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);\n }\n function LayerIndexEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\n }\n function MaskIndexEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\n }\n function CheckboxEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\n }\n function NoValueEffect() {\n this.p = {};\n }\n\n function EffectsManager(data, element) {\n var effects = data.ef || [];\n this.effectElements = [];\n var i;\n var len = effects.length;\n var effectItem;\n for (i = 0; i < len; i += 1) {\n effectItem = new GroupEffect(effects[i], element);\n this.effectElements.push(effectItem);\n }\n }\n function GroupEffect(data, element) {\n this.init(data, element);\n }\n extendPrototype([DynamicPropertyContainer], GroupEffect);\n GroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties;\n GroupEffect.prototype.init = function (data, element) {\n this.data = data;\n this.effectElements = [];\n this.initDynamicPropertyContainer(element);\n var i;\n var len = this.data.ef.length;\n var eff;\n var effects = this.data.ef;\n for (i = 0; i < len; i += 1) {\n eff = null;\n switch (effects[i].ty) {\n case 0:\n eff = new SliderEffect(effects[i], element, this);\n break;\n case 1:\n eff = new AngleEffect(effects[i], element, this);\n break;\n case 2:\n eff = new ColorEffect(effects[i], element, this);\n break;\n case 3:\n eff = new PointEffect(effects[i], element, this);\n break;\n case 4:\n case 7:\n eff = new CheckboxEffect(effects[i], element, this);\n break;\n case 10:\n eff = new LayerIndexEffect(effects[i], element, this);\n break;\n case 11:\n eff = new MaskIndexEffect(effects[i], element, this);\n break;\n case 5:\n eff = new EffectsManager(effects[i], element, this);\n break;\n // case 6:\n default:\n eff = new NoValueEffect(effects[i], element, this);\n break;\n }\n if (eff) {\n this.effectElements.push(eff);\n }\n }\n };\n\n function BaseElement() {}\n BaseElement.prototype = {\n checkMasks: function checkMasks() {\n if (!this.data.hasMask) {\n return false;\n }\n var i = 0;\n var len = this.data.masksProperties.length;\n while (i < len) {\n if (this.data.masksProperties[i].mode !== 'n' && this.data.masksProperties[i].cl !== false) {\n return true;\n }\n i += 1;\n }\n return false;\n },\n initExpressions: function initExpressions() {\n var expressionsInterfaces = getExpressionInterfaces();\n if (!expressionsInterfaces) {\n return;\n }\n var LayerExpressionInterface = expressionsInterfaces('layer');\n var EffectsExpressionInterface = expressionsInterfaces('effects');\n var ShapeExpressionInterface = expressionsInterfaces('shape');\n var TextExpressionInterface = expressionsInterfaces('text');\n var CompExpressionInterface = expressionsInterfaces('comp');\n this.layerInterface = LayerExpressionInterface(this);\n if (this.data.hasMask && this.maskManager) {\n this.layerInterface.registerMaskInterface(this.maskManager);\n }\n var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this, this.layerInterface);\n this.layerInterface.registerEffectsInterface(effectsInterface);\n if (this.data.ty === 0 || this.data.xt) {\n this.compInterface = CompExpressionInterface(this);\n } else if (this.data.ty === 4) {\n this.layerInterface.shapeInterface = ShapeExpressionInterface(this.shapesData, this.itemsData, this.layerInterface);\n this.layerInterface.content = this.layerInterface.shapeInterface;\n } else if (this.data.ty === 5) {\n this.layerInterface.textInterface = TextExpressionInterface(this);\n this.layerInterface.text = this.layerInterface.textInterface;\n }\n },\n setBlendMode: function setBlendMode() {\n var blendModeValue = getBlendMode(this.data.bm);\n var elem = this.baseElement || this.layerElement;\n elem.style['mix-blend-mode'] = blendModeValue;\n },\n initBaseData: function initBaseData(data, globalData, comp) {\n this.globalData = globalData;\n this.comp = comp;\n this.data = data;\n this.layerId = createElementID();\n\n // Stretch factor for old animations missing this property.\n if (!this.data.sr) {\n this.data.sr = 1;\n }\n // effects manager\n this.effectsManager = new EffectsManager(this.data, this, this.dynamicProperties);\n },\n getType: function getType() {\n return this.type;\n },\n sourceRectAtTime: function sourceRectAtTime() {}\n };\n\n /**\n * @file\n * Handles element's layer frame update.\n * Checks layer in point and out point\n *\n */\n\n function FrameElement() {}\n FrameElement.prototype = {\n /**\n * @function\n * Initializes frame related properties.\n *\n */\n initFrame: function initFrame() {\n // set to true when inpoint is rendered\n this._isFirstFrame = false;\n // list of animated properties\n this.dynamicProperties = [];\n // If layer has been modified in current tick this will be true\n this._mdf = false;\n },\n /**\n * @function\n * Calculates all dynamic values\n *\n * @param {number} num\n * current frame number in Layer's time\n * @param {boolean} isVisible\n * if layers is currently in range\n *\n */\n prepareProperties: function prepareProperties(num, isVisible) {\n var i;\n var len = this.dynamicProperties.length;\n for (i = 0; i < len; i += 1) {\n if (isVisible || this._isParent && this.dynamicProperties[i].propType === 'transform') {\n this.dynamicProperties[i].getValue();\n if (this.dynamicProperties[i]._mdf) {\n this.globalData._mdf = true;\n this._mdf = true;\n }\n }\n }\n },\n addDynamicProperty: function addDynamicProperty(prop) {\n if (this.dynamicProperties.indexOf(prop) === -1) {\n this.dynamicProperties.push(prop);\n }\n }\n };\n\n function FootageElement(data, globalData, comp) {\n this.initFrame();\n this.initRenderable();\n this.assetData = globalData.getAssetData(data.refId);\n this.footageData = globalData.imageLoader.getAsset(this.assetData);\n this.initBaseData(data, globalData, comp);\n }\n FootageElement.prototype.prepareFrame = function () {};\n extendPrototype([RenderableElement, BaseElement, FrameElement], FootageElement);\n FootageElement.prototype.getBaseElement = function () {\n return null;\n };\n FootageElement.prototype.renderFrame = function () {};\n FootageElement.prototype.destroy = function () {};\n FootageElement.prototype.initExpressions = function () {\n var expressionsInterfaces = getExpressionInterfaces();\n if (!expressionsInterfaces) {\n return;\n }\n var FootageInterface = expressionsInterfaces('footage');\n this.layerInterface = FootageInterface(this);\n };\n FootageElement.prototype.getFootageData = function () {\n return this.footageData;\n };\n\n function AudioElement(data, globalData, comp) {\n this.initFrame();\n this.initRenderable();\n this.assetData = globalData.getAssetData(data.refId);\n this.initBaseData(data, globalData, comp);\n this._isPlaying = false;\n this._canPlay = false;\n var assetPath = this.globalData.getAssetsPath(this.assetData);\n this.audio = this.globalData.audioController.createAudio(assetPath);\n this._currentTime = 0;\n this.globalData.audioController.addAudio(this);\n this._volumeMultiplier = 1;\n this._volume = 1;\n this._previousVolume = null;\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {\n _placeholder: true\n };\n this.lv = PropertyFactory.getProp(this, data.au && data.au.lv ? data.au.lv : {\n k: [100]\n }, 1, 0.01, this);\n }\n AudioElement.prototype.prepareFrame = function (num) {\n this.prepareRenderableFrame(num, true);\n this.prepareProperties(num, true);\n if (!this.tm._placeholder) {\n var timeRemapped = this.tm.v;\n this._currentTime = timeRemapped;\n } else {\n this._currentTime = num / this.data.sr;\n }\n this._volume = this.lv.v[0];\n var totalVolume = this._volume * this._volumeMultiplier;\n if (this._previousVolume !== totalVolume) {\n this._previousVolume = totalVolume;\n this.audio.volume(totalVolume);\n }\n };\n extendPrototype([RenderableElement, BaseElement, FrameElement], AudioElement);\n AudioElement.prototype.renderFrame = function () {\n if (this.isInRange && this._canPlay) {\n if (!this._isPlaying) {\n this.audio.play();\n this.audio.seek(this._currentTime / this.globalData.frameRate);\n this._isPlaying = true;\n } else if (!this.audio.playing() || Math.abs(this._currentTime / this.globalData.frameRate - this.audio.seek()) > 0.1) {\n this.audio.seek(this._currentTime / this.globalData.frameRate);\n }\n }\n };\n AudioElement.prototype.show = function () {\n // this.audio.play()\n };\n AudioElement.prototype.hide = function () {\n this.audio.pause();\n this._isPlaying = false;\n };\n AudioElement.prototype.pause = function () {\n this.audio.pause();\n this._isPlaying = false;\n this._canPlay = false;\n };\n AudioElement.prototype.resume = function () {\n this._canPlay = true;\n };\n AudioElement.prototype.setRate = function (rateValue) {\n this.audio.rate(rateValue);\n };\n AudioElement.prototype.volume = function (volumeValue) {\n this._volumeMultiplier = volumeValue;\n this._previousVolume = volumeValue * this._volume;\n this.audio.volume(this._previousVolume);\n };\n AudioElement.prototype.getBaseElement = function () {\n return null;\n };\n AudioElement.prototype.destroy = function () {};\n AudioElement.prototype.sourceRectAtTime = function () {};\n AudioElement.prototype.initExpressions = function () {};\n\n function BaseRenderer() {}\n BaseRenderer.prototype.checkLayers = function (num) {\n var i;\n var len = this.layers.length;\n var data;\n this.completeLayers = true;\n for (i = len - 1; i >= 0; i -= 1) {\n if (!this.elements[i]) {\n data = this.layers[i];\n if (data.ip - data.st <= num - this.layers[i].st && data.op - data.st > num - this.layers[i].st) {\n this.buildItem(i);\n }\n }\n this.completeLayers = this.elements[i] ? this.completeLayers : false;\n }\n this.checkPendingElements();\n };\n BaseRenderer.prototype.createItem = function (layer) {\n switch (layer.ty) {\n case 2:\n return this.createImage(layer);\n case 0:\n return this.createComp(layer);\n case 1:\n return this.createSolid(layer);\n case 3:\n return this.createNull(layer);\n case 4:\n return this.createShape(layer);\n case 5:\n return this.createText(layer);\n case 6:\n return this.createAudio(layer);\n case 13:\n return this.createCamera(layer);\n case 15:\n return this.createFootage(layer);\n default:\n return this.createNull(layer);\n }\n };\n BaseRenderer.prototype.createCamera = function () {\n throw new Error('You\\'re using a 3d camera. Try the html renderer.');\n };\n BaseRenderer.prototype.createAudio = function (data) {\n return new AudioElement(data, this.globalData, this);\n };\n BaseRenderer.prototype.createFootage = function (data) {\n return new FootageElement(data, this.globalData, this);\n };\n BaseRenderer.prototype.buildAllItems = function () {\n var i;\n var len = this.layers.length;\n for (i = 0; i < len; i += 1) {\n this.buildItem(i);\n }\n this.checkPendingElements();\n };\n BaseRenderer.prototype.includeLayers = function (newLayers) {\n this.completeLayers = false;\n var i;\n var len = newLayers.length;\n var j;\n var jLen = this.layers.length;\n for (i = 0; i < len; i += 1) {\n j = 0;\n while (j < jLen) {\n if (this.layers[j].id === newLayers[i].id) {\n this.layers[j] = newLayers[i];\n break;\n }\n j += 1;\n }\n }\n };\n BaseRenderer.prototype.setProjectInterface = function (pInterface) {\n this.globalData.projectInterface = pInterface;\n };\n BaseRenderer.prototype.initItems = function () {\n if (!this.globalData.progressiveLoad) {\n this.buildAllItems();\n }\n };\n BaseRenderer.prototype.buildElementParenting = function (element, parentName, hierarchy) {\n var elements = this.elements;\n var layers = this.layers;\n var i = 0;\n var len = layers.length;\n while (i < len) {\n if (layers[i].ind == parentName) {\n // eslint-disable-line eqeqeq\n if (!elements[i] || elements[i] === true) {\n this.buildItem(i);\n this.addPendingElement(element);\n } else {\n hierarchy.push(elements[i]);\n elements[i].setAsParent();\n if (layers[i].parent !== undefined) {\n this.buildElementParenting(element, layers[i].parent, hierarchy);\n } else {\n element.setHierarchy(hierarchy);\n }\n }\n }\n i += 1;\n }\n };\n BaseRenderer.prototype.addPendingElement = function (element) {\n this.pendingElements.push(element);\n };\n BaseRenderer.prototype.searchExtraCompositions = function (assets) {\n var i;\n var len = assets.length;\n for (i = 0; i < len; i += 1) {\n if (assets[i].xt) {\n var comp = this.createComp(assets[i]);\n comp.initExpressions();\n this.globalData.projectInterface.registerComposition(comp);\n }\n }\n };\n BaseRenderer.prototype.getElementById = function (ind) {\n var i;\n var len = this.elements.length;\n for (i = 0; i < len; i += 1) {\n if (this.elements[i].data.ind === ind) {\n return this.elements[i];\n }\n }\n return null;\n };\n BaseRenderer.prototype.getElementByPath = function (path) {\n var pathValue = path.shift();\n var element;\n if (typeof pathValue === 'number') {\n element = this.elements[pathValue];\n } else {\n var i;\n var len = this.elements.length;\n for (i = 0; i < len; i += 1) {\n if (this.elements[i].data.nm === pathValue) {\n element = this.elements[i];\n break;\n }\n }\n }\n if (path.length === 0) {\n return element;\n }\n return element.getElementByPath(path);\n };\n BaseRenderer.prototype.setupGlobalData = function (animData, fontsContainer) {\n this.globalData.fontManager = new FontManager();\n this.globalData.slotManager = slotFactory(animData);\n this.globalData.fontManager.addChars(animData.chars);\n this.globalData.fontManager.addFonts(animData.fonts, fontsContainer);\n this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem);\n this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem);\n this.globalData.imageLoader = this.animationItem.imagePreloader;\n this.globalData.audioController = this.animationItem.audioController;\n this.globalData.frameId = 0;\n this.globalData.frameRate = animData.fr;\n this.globalData.nm = animData.nm;\n this.globalData.compSize = {\n w: animData.w,\n h: animData.h\n };\n };\n\n var effectTypes = {\n TRANSFORM_EFFECT: 'transformEFfect'\n };\n\n function TransformElement() {}\n TransformElement.prototype = {\n initTransform: function initTransform() {\n var mat = new Matrix();\n this.finalTransform = {\n mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : {\n o: 0\n },\n _matMdf: false,\n _localMatMdf: false,\n _opMdf: false,\n mat: mat,\n localMat: mat,\n localOpacity: 1\n };\n if (this.data.ao) {\n this.finalTransform.mProp.autoOriented = true;\n }\n\n // TODO: check TYPE 11: Guided elements\n if (this.data.ty !== 11) {\n // this.createElements();\n }\n },\n renderTransform: function renderTransform() {\n this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame;\n this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame;\n if (this.hierarchy) {\n var mat;\n var finalMat = this.finalTransform.mat;\n var i = 0;\n var len = this.hierarchy.length;\n // Checking if any of the transformation matrices in the hierarchy chain has changed.\n if (!this.finalTransform._matMdf) {\n while (i < len) {\n if (this.hierarchy[i].finalTransform.mProp._mdf) {\n this.finalTransform._matMdf = true;\n break;\n }\n i += 1;\n }\n }\n if (this.finalTransform._matMdf) {\n mat = this.finalTransform.mProp.v.props;\n finalMat.cloneFromProps(mat);\n for (i = 0; i < len; i += 1) {\n finalMat.multiply(this.hierarchy[i].finalTransform.mProp.v);\n }\n }\n }\n if (!this.localTransforms || this.finalTransform._matMdf) {\n this.finalTransform._localMatMdf = this.finalTransform._matMdf;\n }\n if (this.finalTransform._opMdf) {\n this.finalTransform.localOpacity = this.finalTransform.mProp.o.v;\n }\n },\n renderLocalTransform: function renderLocalTransform() {\n if (this.localTransforms) {\n var i = 0;\n var len = this.localTransforms.length;\n this.finalTransform._localMatMdf = this.finalTransform._matMdf;\n if (!this.finalTransform._localMatMdf || !this.finalTransform._opMdf) {\n while (i < len) {\n if (this.localTransforms[i]._mdf) {\n this.finalTransform._localMatMdf = true;\n }\n if (this.localTransforms[i]._opMdf && !this.finalTransform._opMdf) {\n this.finalTransform.localOpacity = this.finalTransform.mProp.o.v;\n this.finalTransform._opMdf = true;\n }\n i += 1;\n }\n }\n if (this.finalTransform._localMatMdf) {\n var localMat = this.finalTransform.localMat;\n this.localTransforms[0].matrix.clone(localMat);\n for (i = 1; i < len; i += 1) {\n var lmat = this.localTransforms[i].matrix;\n localMat.multiply(lmat);\n }\n localMat.multiply(this.finalTransform.mat);\n }\n if (this.finalTransform._opMdf) {\n var localOp = this.finalTransform.localOpacity;\n for (i = 0; i < len; i += 1) {\n localOp *= this.localTransforms[i].opacity * 0.01;\n }\n this.finalTransform.localOpacity = localOp;\n }\n }\n },\n searchEffectTransforms: function searchEffectTransforms() {\n if (this.renderableEffectsManager) {\n var transformEffects = this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT);\n if (transformEffects.length) {\n this.localTransforms = [];\n this.finalTransform.localMat = new Matrix();\n var i = 0;\n var len = transformEffects.length;\n for (i = 0; i < len; i += 1) {\n this.localTransforms.push(transformEffects[i]);\n }\n }\n }\n },\n globalToLocal: function globalToLocal(pt) {\n var transforms = [];\n transforms.push(this.finalTransform);\n var flag = true;\n var comp = this.comp;\n while (flag) {\n if (comp.finalTransform) {\n if (comp.data.hasMask) {\n transforms.splice(0, 0, comp.finalTransform);\n }\n comp = comp.comp;\n } else {\n flag = false;\n }\n }\n var i;\n var len = transforms.length;\n var ptNew;\n for (i = 0; i < len; i += 1) {\n ptNew = transforms[i].mat.applyToPointArray(0, 0, 0);\n // ptNew = transforms[i].mat.applyToPointArray(pt[0],pt[1],pt[2]);\n pt = [pt[0] - ptNew[0], pt[1] - ptNew[1], 0];\n }\n return pt;\n },\n mHelper: new Matrix()\n };\n\n function MaskElement(data, element, globalData) {\n this.data = data;\n this.element = element;\n this.globalData = globalData;\n this.storedData = [];\n this.masksProperties = this.data.masksProperties || [];\n this.maskElement = null;\n var defs = this.globalData.defs;\n var i;\n var len = this.masksProperties ? this.masksProperties.length : 0;\n this.viewData = createSizedArray(len);\n this.solidPath = '';\n var path;\n var properties = this.masksProperties;\n var count = 0;\n var currentMasks = [];\n var j;\n var jLen;\n var layerId = createElementID();\n var rect;\n var expansor;\n var feMorph;\n var x;\n var maskType = 'clipPath';\n var maskRef = 'clip-path';\n for (i = 0; i < len; i += 1) {\n if (properties[i].mode !== 'a' && properties[i].mode !== 'n' || properties[i].inv || properties[i].o.k !== 100 || properties[i].o.x) {\n maskType = 'mask';\n maskRef = 'mask';\n }\n if ((properties[i].mode === 's' || properties[i].mode === 'i') && count === 0) {\n rect = createNS('rect');\n rect.setAttribute('fill', '#ffffff');\n rect.setAttribute('width', this.element.comp.data.w || 0);\n rect.setAttribute('height', this.element.comp.data.h || 0);\n currentMasks.push(rect);\n } else {\n rect = null;\n }\n path = createNS('path');\n if (properties[i].mode === 'n') {\n // TODO move this to a factory or to a constructor\n this.viewData[i] = {\n op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),\n prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),\n elem: path,\n lastPath: ''\n };\n defs.appendChild(path);\n } else {\n count += 1;\n path.setAttribute('fill', properties[i].mode === 's' ? '#000000' : '#ffffff');\n path.setAttribute('clip-rule', 'nonzero');\n var filterID;\n if (properties[i].x.k !== 0) {\n maskType = 'mask';\n maskRef = 'mask';\n x = PropertyFactory.getProp(this.element, properties[i].x, 0, null, this.element);\n filterID = createElementID();\n expansor = createNS('filter');\n expansor.setAttribute('id', filterID);\n feMorph = createNS('feMorphology');\n feMorph.setAttribute('operator', 'erode');\n feMorph.setAttribute('in', 'SourceGraphic');\n feMorph.setAttribute('radius', '0');\n expansor.appendChild(feMorph);\n defs.appendChild(expansor);\n path.setAttribute('stroke', properties[i].mode === 's' ? '#000000' : '#ffffff');\n } else {\n feMorph = null;\n x = null;\n }\n\n // TODO move this to a factory or to a constructor\n this.storedData[i] = {\n elem: path,\n x: x,\n expan: feMorph,\n lastPath: '',\n lastOperator: '',\n filterId: filterID,\n lastRadius: 0\n };\n if (properties[i].mode === 'i') {\n jLen = currentMasks.length;\n var g = createNS('g');\n for (j = 0; j < jLen; j += 1) {\n g.appendChild(currentMasks[j]);\n }\n var mask = createNS('mask');\n mask.setAttribute('mask-type', 'alpha');\n mask.setAttribute('id', layerId + '_' + count);\n mask.appendChild(path);\n defs.appendChild(mask);\n g.setAttribute('mask', 'url(' + getLocationHref() + '#' + layerId + '_' + count + ')');\n currentMasks.length = 0;\n currentMasks.push(g);\n } else {\n currentMasks.push(path);\n }\n if (properties[i].inv && !this.solidPath) {\n this.solidPath = this.createLayerSolidPath();\n }\n // TODO move this to a factory or to a constructor\n this.viewData[i] = {\n elem: path,\n lastPath: '',\n op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),\n prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),\n invRect: rect\n };\n if (!this.viewData[i].prop.k) {\n this.drawPath(properties[i], this.viewData[i].prop.v, this.viewData[i]);\n }\n }\n }\n this.maskElement = createNS(maskType);\n len = currentMasks.length;\n for (i = 0; i < len; i += 1) {\n this.maskElement.appendChild(currentMasks[i]);\n }\n if (count > 0) {\n this.maskElement.setAttribute('id', layerId);\n this.element.maskedElement.setAttribute(maskRef, 'url(' + getLocationHref() + '#' + layerId + ')');\n defs.appendChild(this.maskElement);\n }\n if (this.viewData.length) {\n this.element.addRenderableComponent(this);\n }\n }\n MaskElement.prototype.getMaskProperty = function (pos) {\n return this.viewData[pos].prop;\n };\n MaskElement.prototype.renderFrame = function (isFirstFrame) {\n var finalMat = this.element.finalTransform.mat;\n var i;\n var len = this.masksProperties.length;\n for (i = 0; i < len; i += 1) {\n if (this.viewData[i].prop._mdf || isFirstFrame) {\n this.drawPath(this.masksProperties[i], this.viewData[i].prop.v, this.viewData[i]);\n }\n if (this.viewData[i].op._mdf || isFirstFrame) {\n this.viewData[i].elem.setAttribute('fill-opacity', this.viewData[i].op.v);\n }\n if (this.masksProperties[i].mode !== 'n') {\n if (this.viewData[i].invRect && (this.element.finalTransform.mProp._mdf || isFirstFrame)) {\n this.viewData[i].invRect.setAttribute('transform', finalMat.getInverseMatrix().to2dCSS());\n }\n if (this.storedData[i].x && (this.storedData[i].x._mdf || isFirstFrame)) {\n var feMorph = this.storedData[i].expan;\n if (this.storedData[i].x.v < 0) {\n if (this.storedData[i].lastOperator !== 'erode') {\n this.storedData[i].lastOperator = 'erode';\n this.storedData[i].elem.setAttribute('filter', 'url(' + getLocationHref() + '#' + this.storedData[i].filterId + ')');\n }\n feMorph.setAttribute('radius', -this.storedData[i].x.v);\n } else {\n if (this.storedData[i].lastOperator !== 'dilate') {\n this.storedData[i].lastOperator = 'dilate';\n this.storedData[i].elem.setAttribute('filter', null);\n }\n this.storedData[i].elem.setAttribute('stroke-width', this.storedData[i].x.v * 2);\n }\n }\n }\n }\n };\n MaskElement.prototype.getMaskelement = function () {\n return this.maskElement;\n };\n MaskElement.prototype.createLayerSolidPath = function () {\n var path = 'M0,0 ';\n path += ' h' + this.globalData.compSize.w;\n path += ' v' + this.globalData.compSize.h;\n path += ' h-' + this.globalData.compSize.w;\n path += ' v-' + this.globalData.compSize.h + ' ';\n return path;\n };\n MaskElement.prototype.drawPath = function (pathData, pathNodes, viewData) {\n var pathString = ' M' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];\n var i;\n var len;\n len = pathNodes._length;\n for (i = 1; i < len; i += 1) {\n // pathString += \" C\"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + \" \"+pathNodes.i[i][0]+','+pathNodes.i[i][1] + \" \"+pathNodes.v[i][0]+','+pathNodes.v[i][1];\n pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[i][0] + ',' + pathNodes.i[i][1] + ' ' + pathNodes.v[i][0] + ',' + pathNodes.v[i][1];\n }\n // pathString += \" C\"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + \" \"+pathNodes.i[0][0]+','+pathNodes.i[0][1] + \" \"+pathNodes.v[0][0]+','+pathNodes.v[0][1];\n if (pathNodes.c && len > 1) {\n pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[0][0] + ',' + pathNodes.i[0][1] + ' ' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];\n }\n // pathNodes.__renderedString = pathString;\n\n if (viewData.lastPath !== pathString) {\n var pathShapeValue = '';\n if (viewData.elem) {\n if (pathNodes.c) {\n pathShapeValue = pathData.inv ? this.solidPath + pathString : pathString;\n }\n viewData.elem.setAttribute('d', pathShapeValue);\n }\n viewData.lastPath = pathString;\n }\n };\n MaskElement.prototype.destroy = function () {\n this.element = null;\n this.globalData = null;\n this.maskElement = null;\n this.data = null;\n this.masksProperties = null;\n };\n\n var filtersFactory = function () {\n var ob = {};\n ob.createFilter = createFilter;\n ob.createAlphaToLuminanceFilter = createAlphaToLuminanceFilter;\n function createFilter(filId, skipCoordinates) {\n var fil = createNS('filter');\n fil.setAttribute('id', filId);\n if (skipCoordinates !== true) {\n fil.setAttribute('filterUnits', 'objectBoundingBox');\n fil.setAttribute('x', '0%');\n fil.setAttribute('y', '0%');\n fil.setAttribute('width', '100%');\n fil.setAttribute('height', '100%');\n }\n return fil;\n }\n function createAlphaToLuminanceFilter() {\n var feColorMatrix = createNS('feColorMatrix');\n feColorMatrix.setAttribute('type', 'matrix');\n feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\n feColorMatrix.setAttribute('values', '0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1');\n return feColorMatrix;\n }\n return ob;\n }();\n\n var featureSupport = function () {\n var ob = {\n maskType: true,\n svgLumaHidden: true,\n offscreenCanvas: typeof OffscreenCanvas !== 'undefined'\n };\n if (/MSIE 10/i.test(navigator.userAgent) || /MSIE 9/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent) || /Edge\\/\\d./i.test(navigator.userAgent)) {\n ob.maskType = false;\n }\n if (/firefox/i.test(navigator.userAgent)) {\n ob.svgLumaHidden = false;\n }\n return ob;\n }();\n\n var registeredEffects$1 = {};\n var idPrefix = 'filter_result_';\n function SVGEffects(elem) {\n var i;\n var source = 'SourceGraphic';\n var len = elem.data.ef ? elem.data.ef.length : 0;\n var filId = createElementID();\n var fil = filtersFactory.createFilter(filId, true);\n var count = 0;\n this.filters = [];\n var filterManager;\n for (i = 0; i < len; i += 1) {\n filterManager = null;\n var type = elem.data.ef[i].ty;\n if (registeredEffects$1[type]) {\n var Effect = registeredEffects$1[type].effect;\n filterManager = new Effect(fil, elem.effectsManager.effectElements[i], elem, idPrefix + count, source);\n source = idPrefix + count;\n if (registeredEffects$1[type].countsAsEffect) {\n count += 1;\n }\n }\n if (filterManager) {\n this.filters.push(filterManager);\n }\n }\n if (count) {\n elem.globalData.defs.appendChild(fil);\n elem.layerElement.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')');\n }\n if (this.filters.length) {\n elem.addRenderableComponent(this);\n }\n }\n SVGEffects.prototype.renderFrame = function (_isFirstFrame) {\n var i;\n var len = this.filters.length;\n for (i = 0; i < len; i += 1) {\n this.filters[i].renderFrame(_isFirstFrame);\n }\n };\n SVGEffects.prototype.getEffects = function (type) {\n var i;\n var len = this.filters.length;\n var effects = [];\n for (i = 0; i < len; i += 1) {\n if (this.filters[i].type === type) {\n effects.push(this.filters[i]);\n }\n }\n return effects;\n };\n function registerEffect$1(id, effect, countsAsEffect) {\n registeredEffects$1[id] = {\n effect: effect,\n countsAsEffect: countsAsEffect\n };\n }\n\n function SVGBaseElement() {}\n SVGBaseElement.prototype = {\n initRendererElement: function initRendererElement() {\n this.layerElement = createNS('g');\n },\n createContainerElements: function createContainerElements() {\n this.matteElement = createNS('g');\n this.transformedElement = this.layerElement;\n this.maskedElement = this.layerElement;\n this._sizeChanged = false;\n var layerElementParent = null;\n // If this layer acts as a mask for the following layer\n if (this.data.td) {\n this.matteMasks = {};\n var gg = createNS('g');\n gg.setAttribute('id', this.layerId);\n gg.appendChild(this.layerElement);\n layerElementParent = gg;\n this.globalData.defs.appendChild(gg);\n } else if (this.data.tt) {\n this.matteElement.appendChild(this.layerElement);\n layerElementParent = this.matteElement;\n this.baseElement = this.matteElement;\n } else {\n this.baseElement = this.layerElement;\n }\n if (this.data.ln) {\n this.layerElement.setAttribute('id', this.data.ln);\n }\n if (this.data.cl) {\n this.layerElement.setAttribute('class', this.data.cl);\n }\n // Clipping compositions to hide content that exceeds boundaries. If collapsed transformations is on, component should not be clipped\n if (this.data.ty === 0 && !this.data.hd) {\n var cp = createNS('clipPath');\n var pt = createNS('path');\n pt.setAttribute('d', 'M0,0 L' + this.data.w + ',0 L' + this.data.w + ',' + this.data.h + ' L0,' + this.data.h + 'z');\n var clipId = createElementID();\n cp.setAttribute('id', clipId);\n cp.appendChild(pt);\n this.globalData.defs.appendChild(cp);\n if (this.checkMasks()) {\n var cpGroup = createNS('g');\n cpGroup.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')');\n cpGroup.appendChild(this.layerElement);\n this.transformedElement = cpGroup;\n if (layerElementParent) {\n layerElementParent.appendChild(this.transformedElement);\n } else {\n this.baseElement = this.transformedElement;\n }\n } else {\n this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')');\n }\n }\n if (this.data.bm !== 0) {\n this.setBlendMode();\n }\n },\n renderElement: function renderElement() {\n if (this.finalTransform._localMatMdf) {\n this.transformedElement.setAttribute('transform', this.finalTransform.localMat.to2dCSS());\n }\n if (this.finalTransform._opMdf) {\n this.transformedElement.setAttribute('opacity', this.finalTransform.localOpacity);\n }\n },\n destroyBaseElement: function destroyBaseElement() {\n this.layerElement = null;\n this.matteElement = null;\n this.maskManager.destroy();\n },\n getBaseElement: function getBaseElement() {\n if (this.data.hd) {\n return null;\n }\n return this.baseElement;\n },\n createRenderableComponents: function createRenderableComponents() {\n this.maskManager = new MaskElement(this.data, this, this.globalData);\n this.renderableEffectsManager = new SVGEffects(this);\n this.searchEffectTransforms();\n },\n getMatte: function getMatte(matteType) {\n // This should not be a common case. But for backward compatibility, we'll create the matte object.\n // It solves animations that have two consecutive layers marked as matte masks.\n // Which is an undefined behavior in AE.\n if (!this.matteMasks) {\n this.matteMasks = {};\n }\n if (!this.matteMasks[matteType]) {\n var id = this.layerId + '_' + matteType;\n var filId;\n var fil;\n var useElement;\n var gg;\n if (matteType === 1 || matteType === 3) {\n var masker = createNS('mask');\n masker.setAttribute('id', id);\n masker.setAttribute('mask-type', matteType === 3 ? 'luminance' : 'alpha');\n useElement = createNS('use');\n useElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#' + this.layerId);\n masker.appendChild(useElement);\n this.globalData.defs.appendChild(masker);\n if (!featureSupport.maskType && matteType === 1) {\n masker.setAttribute('mask-type', 'luminance');\n filId = createElementID();\n fil = filtersFactory.createFilter(filId);\n this.globalData.defs.appendChild(fil);\n fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());\n gg = createNS('g');\n gg.appendChild(useElement);\n masker.appendChild(gg);\n gg.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')');\n }\n } else if (matteType === 2) {\n var maskGroup = createNS('mask');\n maskGroup.setAttribute('id', id);\n maskGroup.setAttribute('mask-type', 'alpha');\n var maskGrouper = createNS('g');\n maskGroup.appendChild(maskGrouper);\n filId = createElementID();\n fil = filtersFactory.createFilter(filId);\n /// /\n var feCTr = createNS('feComponentTransfer');\n feCTr.setAttribute('in', 'SourceGraphic');\n fil.appendChild(feCTr);\n var feFunc = createNS('feFuncA');\n feFunc.setAttribute('type', 'table');\n feFunc.setAttribute('tableValues', '1.0 0.0');\n feCTr.appendChild(feFunc);\n /// /\n this.globalData.defs.appendChild(fil);\n var alphaRect = createNS('rect');\n alphaRect.setAttribute('width', this.comp.data.w);\n alphaRect.setAttribute('height', this.comp.data.h);\n alphaRect.setAttribute('x', '0');\n alphaRect.setAttribute('y', '0');\n alphaRect.setAttribute('fill', '#ffffff');\n alphaRect.setAttribute('opacity', '0');\n maskGrouper.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')');\n maskGrouper.appendChild(alphaRect);\n useElement = createNS('use');\n useElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#' + this.layerId);\n maskGrouper.appendChild(useElement);\n if (!featureSupport.maskType) {\n maskGroup.setAttribute('mask-type', 'luminance');\n fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());\n gg = createNS('g');\n maskGrouper.appendChild(alphaRect);\n gg.appendChild(this.layerElement);\n maskGrouper.appendChild(gg);\n }\n this.globalData.defs.appendChild(maskGroup);\n }\n this.matteMasks[matteType] = id;\n }\n return this.matteMasks[matteType];\n },\n setMatte: function setMatte(id) {\n if (!this.matteElement) {\n return;\n }\n this.matteElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + id + ')');\n }\n };\n\n /**\n * @file\n * Handles AE's layer parenting property.\n *\n */\n\n function HierarchyElement() {}\n HierarchyElement.prototype = {\n /**\n * @function\n * Initializes hierarchy properties\n *\n */\n initHierarchy: function initHierarchy() {\n // element's parent list\n this.hierarchy = [];\n // if element is parent of another layer _isParent will be true\n this._isParent = false;\n this.checkParenting();\n },\n /**\n * @function\n * Sets layer's hierarchy.\n * @param {array} hierarch\n * layer's parent list\n *\n */\n setHierarchy: function setHierarchy(hierarchy) {\n this.hierarchy = hierarchy;\n },\n /**\n * @function\n * Sets layer as parent.\n *\n */\n setAsParent: function setAsParent() {\n this._isParent = true;\n },\n /**\n * @function\n * Searches layer's parenting chain\n *\n */\n checkParenting: function checkParenting() {\n if (this.data.parent !== undefined) {\n this.comp.buildElementParenting(this, this.data.parent, []);\n }\n }\n };\n\n function RenderableDOMElement() {}\n (function () {\n var _prototype = {\n initElement: function initElement(data, globalData, comp) {\n this.initFrame();\n this.initBaseData(data, globalData, comp);\n this.initTransform(data, globalData, comp);\n this.initHierarchy();\n this.initRenderable();\n this.initRendererElement();\n this.createContainerElements();\n this.createRenderableComponents();\n this.createContent();\n this.hide();\n },\n hide: function hide() {\n // console.log('HIDE', this);\n if (!this.hidden && (!this.isInRange || this.isTransparent)) {\n var elem = this.baseElement || this.layerElement;\n elem.style.display = 'none';\n this.hidden = true;\n }\n },\n show: function show() {\n // console.log('SHOW', this);\n if (this.isInRange && !this.isTransparent) {\n if (!this.data.hd) {\n var elem = this.baseElement || this.layerElement;\n elem.style.display = 'block';\n }\n this.hidden = false;\n this._isFirstFrame = true;\n }\n },\n renderFrame: function renderFrame() {\n // If it is exported as hidden (data.hd === true) no need to render\n // If it is not visible no need to render\n if (this.data.hd || this.hidden) {\n return;\n }\n this.renderTransform();\n this.renderRenderable();\n this.renderLocalTransform();\n this.renderElement();\n this.renderInnerContent();\n if (this._isFirstFrame) {\n this._isFirstFrame = false;\n }\n },\n renderInnerContent: function renderInnerContent() {},\n prepareFrame: function prepareFrame(num) {\n this._mdf = false;\n this.prepareRenderableFrame(num);\n this.prepareProperties(num, this.isInRange);\n this.checkTransparency();\n },\n destroy: function destroy() {\n this.innerElem = null;\n this.destroyBaseElement();\n }\n };\n extendPrototype([RenderableElement, createProxyFunction(_prototype)], RenderableDOMElement);\n })();\n\n function IImageElement(data, globalData, comp) {\n this.assetData = globalData.getAssetData(data.refId);\n if (this.assetData && this.assetData.sid) {\n this.assetData = globalData.slotManager.getProp(this.assetData);\n }\n this.initElement(data, globalData, comp);\n this.sourceRect = {\n top: 0,\n left: 0,\n width: this.assetData.w,\n height: this.assetData.h\n };\n }\n extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], IImageElement);\n IImageElement.prototype.createContent = function () {\n var assetPath = this.globalData.getAssetsPath(this.assetData);\n this.innerElem = createNS('image');\n this.innerElem.setAttribute('width', this.assetData.w + 'px');\n this.innerElem.setAttribute('height', this.assetData.h + 'px');\n this.innerElem.setAttribute('preserveAspectRatio', this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio);\n this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);\n this.layerElement.appendChild(this.innerElem);\n };\n IImageElement.prototype.sourceRectAtTime = function () {\n return this.sourceRect;\n };\n\n function ProcessedElement(element, position) {\n this.elem = element;\n this.pos = position;\n }\n\n function IShapeElement() {}\n IShapeElement.prototype = {\n addShapeToModifiers: function addShapeToModifiers(data) {\n var i;\n var len = this.shapeModifiers.length;\n for (i = 0; i < len; i += 1) {\n this.shapeModifiers[i].addShape(data);\n }\n },\n isShapeInAnimatedModifiers: function isShapeInAnimatedModifiers(data) {\n var i = 0;\n var len = this.shapeModifiers.length;\n while (i < len) {\n if (this.shapeModifiers[i].isAnimatedWithShape(data)) {\n return true;\n }\n }\n return false;\n },\n renderModifiers: function renderModifiers() {\n if (!this.shapeModifiers.length) {\n return;\n }\n var i;\n var len = this.shapes.length;\n for (i = 0; i < len; i += 1) {\n this.shapes[i].sh.reset();\n }\n len = this.shapeModifiers.length;\n var shouldBreakProcess;\n for (i = len - 1; i >= 0; i -= 1) {\n shouldBreakProcess = this.shapeModifiers[i].processShapes(this._isFirstFrame);\n // workaround to fix cases where a repeater resets the shape so the following processes get called twice\n // TODO: find a better solution for this\n if (shouldBreakProcess) {\n break;\n }\n }\n },\n searchProcessedElement: function searchProcessedElement(elem) {\n var elements = this.processedElements;\n var i = 0;\n var len = elements.length;\n while (i < len) {\n if (elements[i].elem === elem) {\n return elements[i].pos;\n }\n i += 1;\n }\n return 0;\n },\n addProcessedElement: function addProcessedElement(elem, pos) {\n var elements = this.processedElements;\n var i = elements.length;\n while (i) {\n i -= 1;\n if (elements[i].elem === elem) {\n elements[i].pos = pos;\n return;\n }\n }\n elements.push(new ProcessedElement(elem, pos));\n },\n prepareFrame: function prepareFrame(num) {\n this.prepareRenderableFrame(num);\n this.prepareProperties(num, this.isInRange);\n }\n };\n\n var lineCapEnum = {\n 1: 'butt',\n 2: 'round',\n 3: 'square'\n };\n var lineJoinEnum = {\n 1: 'miter',\n 2: 'round',\n 3: 'bevel'\n };\n\n function SVGShapeData(transformers, level, shape) {\n this.caches = [];\n this.styles = [];\n this.transformers = transformers;\n this.lStr = '';\n this.sh = shape;\n this.lvl = level;\n // TODO find if there are some cases where _isAnimated can be false.\n // For now, since shapes add up with other shapes. They have to be calculated every time.\n // One way of finding out is checking if all styles associated to this shape depend only of this shape\n this._isAnimated = !!shape.k;\n // TODO: commenting this for now since all shapes are animated\n var i = 0;\n var len = transformers.length;\n while (i < len) {\n if (transformers[i].mProps.dynamicProperties.length) {\n this._isAnimated = true;\n break;\n }\n i += 1;\n }\n }\n SVGShapeData.prototype.setAsAnimated = function () {\n this._isAnimated = true;\n };\n\n function SVGStyleData(data, level) {\n this.data = data;\n this.type = data.ty;\n this.d = '';\n this.lvl = level;\n this._mdf = false;\n this.closed = data.hd === true;\n this.pElem = createNS('path');\n this.msElem = null;\n }\n SVGStyleData.prototype.reset = function () {\n this.d = '';\n this._mdf = false;\n };\n\n function DashProperty(elem, data, renderer, container) {\n this.elem = elem;\n this.frameId = -1;\n this.dataProps = createSizedArray(data.length);\n this.renderer = renderer;\n this.k = false;\n this.dashStr = '';\n this.dashArray = createTypedArray('float32', data.length ? data.length - 1 : 0);\n this.dashoffset = createTypedArray('float32', 1);\n this.initDynamicPropertyContainer(container);\n var i;\n var len = data.length || 0;\n var prop;\n for (i = 0; i < len; i += 1) {\n prop = PropertyFactory.getProp(elem, data[i].v, 0, 0, this);\n this.k = prop.k || this.k;\n this.dataProps[i] = {\n n: data[i].n,\n p: prop\n };\n }\n if (!this.k) {\n this.getValue(true);\n }\n this._isAnimated = this.k;\n }\n DashProperty.prototype.getValue = function (forceRender) {\n if (this.elem.globalData.frameId === this.frameId && !forceRender) {\n return;\n }\n this.frameId = this.elem.globalData.frameId;\n this.iterateDynamicProperties();\n this._mdf = this._mdf || forceRender;\n if (this._mdf) {\n var i = 0;\n var len = this.dataProps.length;\n if (this.renderer === 'svg') {\n this.dashStr = '';\n }\n for (i = 0; i < len; i += 1) {\n if (this.dataProps[i].n !== 'o') {\n if (this.renderer === 'svg') {\n this.dashStr += ' ' + this.dataProps[i].p.v;\n } else {\n this.dashArray[i] = this.dataProps[i].p.v;\n }\n } else {\n this.dashoffset[0] = this.dataProps[i].p.v;\n }\n }\n }\n };\n extendPrototype([DynamicPropertyContainer], DashProperty);\n\n function SVGStrokeStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem);\n this.getValue = this.iterateDynamicProperties;\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);\n this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);\n this.d = new DashProperty(elem, data.d || {}, 'svg', this);\n this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);\n this.style = styleOb;\n this._isAnimated = !!this._isAnimated;\n }\n extendPrototype([DynamicPropertyContainer], SVGStrokeStyleData);\n\n function SVGFillStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem);\n this.getValue = this.iterateDynamicProperties;\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);\n this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);\n this.style = styleOb;\n }\n extendPrototype([DynamicPropertyContainer], SVGFillStyleData);\n\n function SVGNoStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem);\n this.getValue = this.iterateDynamicProperties;\n this.style = styleOb;\n }\n extendPrototype([DynamicPropertyContainer], SVGNoStyleData);\n\n function GradientProperty(elem, data, container) {\n this.data = data;\n this.c = createTypedArray('uint8c', data.p * 4);\n var cLength = data.k.k[0].s ? data.k.k[0].s.length - data.p * 4 : data.k.k.length - data.p * 4;\n this.o = createTypedArray('float32', cLength);\n this._cmdf = false;\n this._omdf = false;\n this._collapsable = this.checkCollapsable();\n this._hasOpacity = cLength;\n this.initDynamicPropertyContainer(container);\n this.prop = PropertyFactory.getProp(elem, data.k, 1, null, this);\n this.k = this.prop.k;\n this.getValue(true);\n }\n GradientProperty.prototype.comparePoints = function (values, points) {\n var i = 0;\n var len = this.o.length / 2;\n var diff;\n while (i < len) {\n diff = Math.abs(values[i * 4] - values[points * 4 + i * 2]);\n if (diff > 0.01) {\n return false;\n }\n i += 1;\n }\n return true;\n };\n GradientProperty.prototype.checkCollapsable = function () {\n if (this.o.length / 2 !== this.c.length / 4) {\n return false;\n }\n if (this.data.k.k[0].s) {\n var i = 0;\n var len = this.data.k.k.length;\n while (i < len) {\n if (!this.comparePoints(this.data.k.k[i].s, this.data.p)) {\n return false;\n }\n i += 1;\n }\n } else if (!this.comparePoints(this.data.k.k, this.data.p)) {\n return false;\n }\n return true;\n };\n GradientProperty.prototype.getValue = function (forceRender) {\n this.prop.getValue();\n this._mdf = false;\n this._cmdf = false;\n this._omdf = false;\n if (this.prop._mdf || forceRender) {\n var i;\n var len = this.data.p * 4;\n var mult;\n var val;\n for (i = 0; i < len; i += 1) {\n mult = i % 4 === 0 ? 100 : 255;\n val = Math.round(this.prop.v[i] * mult);\n if (this.c[i] !== val) {\n this.c[i] = val;\n this._cmdf = !forceRender;\n }\n }\n if (this.o.length) {\n len = this.prop.v.length;\n for (i = this.data.p * 4; i < len; i += 1) {\n mult = i % 2 === 0 ? 100 : 1;\n val = i % 2 === 0 ? Math.round(this.prop.v[i] * 100) : this.prop.v[i];\n if (this.o[i - this.data.p * 4] !== val) {\n this.o[i - this.data.p * 4] = val;\n this._omdf = !forceRender;\n }\n }\n }\n this._mdf = !forceRender;\n }\n };\n extendPrototype([DynamicPropertyContainer], GradientProperty);\n\n function SVGGradientFillStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem);\n this.getValue = this.iterateDynamicProperties;\n this.initGradientData(elem, data, styleOb);\n }\n SVGGradientFillStyleData.prototype.initGradientData = function (elem, data, styleOb) {\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);\n this.s = PropertyFactory.getProp(elem, data.s, 1, null, this);\n this.e = PropertyFactory.getProp(elem, data.e, 1, null, this);\n this.h = PropertyFactory.getProp(elem, data.h || {\n k: 0\n }, 0, 0.01, this);\n this.a = PropertyFactory.getProp(elem, data.a || {\n k: 0\n }, 0, degToRads, this);\n this.g = new GradientProperty(elem, data.g, this);\n this.style = styleOb;\n this.stops = [];\n this.setGradientData(styleOb.pElem, data);\n this.setGradientOpacity(data, styleOb);\n this._isAnimated = !!this._isAnimated;\n };\n SVGGradientFillStyleData.prototype.setGradientData = function (pathElement, data) {\n var gradientId = createElementID();\n var gfill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');\n gfill.setAttribute('id', gradientId);\n gfill.setAttribute('spreadMethod', 'pad');\n gfill.setAttribute('gradientUnits', 'userSpaceOnUse');\n var stops = [];\n var stop;\n var j;\n var jLen;\n jLen = data.g.p * 4;\n for (j = 0; j < jLen; j += 4) {\n stop = createNS('stop');\n gfill.appendChild(stop);\n stops.push(stop);\n }\n pathElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + gradientId + ')');\n this.gf = gfill;\n this.cst = stops;\n };\n SVGGradientFillStyleData.prototype.setGradientOpacity = function (data, styleOb) {\n if (this.g._hasOpacity && !this.g._collapsable) {\n var stop;\n var j;\n var jLen;\n var mask = createNS('mask');\n var maskElement = createNS('path');\n mask.appendChild(maskElement);\n var opacityId = createElementID();\n var maskId = createElementID();\n mask.setAttribute('id', maskId);\n var opFill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');\n opFill.setAttribute('id', opacityId);\n opFill.setAttribute('spreadMethod', 'pad');\n opFill.setAttribute('gradientUnits', 'userSpaceOnUse');\n jLen = data.g.k.k[0].s ? data.g.k.k[0].s.length : data.g.k.k.length;\n var stops = this.stops;\n for (j = data.g.p * 4; j < jLen; j += 2) {\n stop = createNS('stop');\n stop.setAttribute('stop-color', 'rgb(255,255,255)');\n opFill.appendChild(stop);\n stops.push(stop);\n }\n maskElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + opacityId + ')');\n if (data.ty === 'gs') {\n maskElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]);\n maskElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]);\n if (data.lj === 1) {\n maskElement.setAttribute('stroke-miterlimit', data.ml);\n }\n }\n this.of = opFill;\n this.ms = mask;\n this.ost = stops;\n this.maskId = maskId;\n styleOb.msElem = maskElement;\n }\n };\n extendPrototype([DynamicPropertyContainer], SVGGradientFillStyleData);\n\n function SVGGradientStrokeStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem);\n this.getValue = this.iterateDynamicProperties;\n this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);\n this.d = new DashProperty(elem, data.d || {}, 'svg', this);\n this.initGradientData(elem, data, styleOb);\n this._isAnimated = !!this._isAnimated;\n }\n extendPrototype([SVGGradientFillStyleData, DynamicPropertyContainer], SVGGradientStrokeStyleData);\n\n function ShapeGroupData() {\n this.it = [];\n this.prevViewData = [];\n this.gr = createNS('g');\n }\n\n function SVGTransformData(mProps, op, container) {\n this.transform = {\n mProps: mProps,\n op: op,\n container: container\n };\n this.elements = [];\n this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length;\n }\n\n var buildShapeString = function buildShapeString(pathNodes, length, closed, mat) {\n if (length === 0) {\n return '';\n }\n var _o = pathNodes.o;\n var _i = pathNodes.i;\n var _v = pathNodes.v;\n var i;\n var shapeString = ' M' + mat.applyToPointStringified(_v[0][0], _v[0][1]);\n for (i = 1; i < length; i += 1) {\n shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[i][0], _i[i][1]) + ' ' + mat.applyToPointStringified(_v[i][0], _v[i][1]);\n }\n if (closed && length) {\n shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[0][0], _i[0][1]) + ' ' + mat.applyToPointStringified(_v[0][0], _v[0][1]);\n shapeString += 'z';\n }\n return shapeString;\n };\n\n var SVGElementsRenderer = function () {\n var _identityMatrix = new Matrix();\n var _matrixHelper = new Matrix();\n var ob = {\n createRenderFunction: createRenderFunction\n };\n function createRenderFunction(data) {\n switch (data.ty) {\n case 'fl':\n return renderFill;\n case 'gf':\n return renderGradient;\n case 'gs':\n return renderGradientStroke;\n case 'st':\n return renderStroke;\n case 'sh':\n case 'el':\n case 'rc':\n case 'sr':\n return renderPath;\n case 'tr':\n return renderContentTransform;\n case 'no':\n return renderNoop;\n default:\n return null;\n }\n }\n function renderContentTransform(styleData, itemData, isFirstFrame) {\n if (isFirstFrame || itemData.transform.op._mdf) {\n itemData.transform.container.setAttribute('opacity', itemData.transform.op.v);\n }\n if (isFirstFrame || itemData.transform.mProps._mdf) {\n itemData.transform.container.setAttribute('transform', itemData.transform.mProps.v.to2dCSS());\n }\n }\n function renderNoop() {}\n function renderPath(styleData, itemData, isFirstFrame) {\n var j;\n var jLen;\n var pathStringTransformed;\n var redraw;\n var pathNodes;\n var l;\n var lLen = itemData.styles.length;\n var lvl = itemData.lvl;\n var paths;\n var mat;\n var iterations;\n var k;\n for (l = 0; l < lLen; l += 1) {\n redraw = itemData.sh._mdf || isFirstFrame;\n if (itemData.styles[l].lvl < lvl) {\n mat = _matrixHelper.reset();\n iterations = lvl - itemData.styles[l].lvl;\n k = itemData.transformers.length - 1;\n while (!redraw && iterations > 0) {\n redraw = itemData.transformers[k].mProps._mdf || redraw;\n iterations -= 1;\n k -= 1;\n }\n if (redraw) {\n iterations = lvl - itemData.styles[l].lvl;\n k = itemData.transformers.length - 1;\n while (iterations > 0) {\n mat.multiply(itemData.transformers[k].mProps.v);\n iterations -= 1;\n k -= 1;\n }\n }\n } else {\n mat = _identityMatrix;\n }\n paths = itemData.sh.paths;\n jLen = paths._length;\n if (redraw) {\n pathStringTransformed = '';\n for (j = 0; j < jLen; j += 1) {\n pathNodes = paths.shapes[j];\n if (pathNodes && pathNodes._length) {\n pathStringTransformed += buildShapeString(pathNodes, pathNodes._length, pathNodes.c, mat);\n }\n }\n itemData.caches[l] = pathStringTransformed;\n } else {\n pathStringTransformed = itemData.caches[l];\n }\n itemData.styles[l].d += styleData.hd === true ? '' : pathStringTransformed;\n itemData.styles[l]._mdf = redraw || itemData.styles[l]._mdf;\n }\n }\n function renderFill(styleData, itemData, isFirstFrame) {\n var styleElem = itemData.style;\n if (itemData.c._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('fill', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')');\n }\n if (itemData.o._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('fill-opacity', itemData.o.v);\n }\n }\n function renderGradientStroke(styleData, itemData, isFirstFrame) {\n renderGradient(styleData, itemData, isFirstFrame);\n renderStroke(styleData, itemData, isFirstFrame);\n }\n function renderGradient(styleData, itemData, isFirstFrame) {\n var gfill = itemData.gf;\n var hasOpacity = itemData.g._hasOpacity;\n var pt1 = itemData.s.v;\n var pt2 = itemData.e.v;\n if (itemData.o._mdf || isFirstFrame) {\n var attr = styleData.ty === 'gf' ? 'fill-opacity' : 'stroke-opacity';\n itemData.style.pElem.setAttribute(attr, itemData.o.v);\n }\n if (itemData.s._mdf || isFirstFrame) {\n var attr1 = styleData.t === 1 ? 'x1' : 'cx';\n var attr2 = attr1 === 'x1' ? 'y1' : 'cy';\n gfill.setAttribute(attr1, pt1[0]);\n gfill.setAttribute(attr2, pt1[1]);\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute(attr1, pt1[0]);\n itemData.of.setAttribute(attr2, pt1[1]);\n }\n }\n var stops;\n var i;\n var len;\n var stop;\n if (itemData.g._cmdf || isFirstFrame) {\n stops = itemData.cst;\n var cValues = itemData.g.c;\n len = stops.length;\n for (i = 0; i < len; i += 1) {\n stop = stops[i];\n stop.setAttribute('offset', cValues[i * 4] + '%');\n stop.setAttribute('stop-color', 'rgb(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ')');\n }\n }\n if (hasOpacity && (itemData.g._omdf || isFirstFrame)) {\n var oValues = itemData.g.o;\n if (itemData.g._collapsable) {\n stops = itemData.cst;\n } else {\n stops = itemData.ost;\n }\n len = stops.length;\n for (i = 0; i < len; i += 1) {\n stop = stops[i];\n if (!itemData.g._collapsable) {\n stop.setAttribute('offset', oValues[i * 2] + '%');\n }\n stop.setAttribute('stop-opacity', oValues[i * 2 + 1]);\n }\n }\n if (styleData.t === 1) {\n if (itemData.e._mdf || isFirstFrame) {\n gfill.setAttribute('x2', pt2[0]);\n gfill.setAttribute('y2', pt2[1]);\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute('x2', pt2[0]);\n itemData.of.setAttribute('y2', pt2[1]);\n }\n }\n } else {\n var rad;\n if (itemData.s._mdf || itemData.e._mdf || isFirstFrame) {\n rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));\n gfill.setAttribute('r', rad);\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute('r', rad);\n }\n }\n if (itemData.s._mdf || itemData.e._mdf || itemData.h._mdf || itemData.a._mdf || isFirstFrame) {\n if (!rad) {\n rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));\n }\n var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);\n var percent = itemData.h.v;\n if (percent >= 1) {\n percent = 0.99;\n } else if (percent <= -1) {\n percent = -0.99;\n }\n var dist = rad * percent;\n var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];\n var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];\n gfill.setAttribute('fx', x);\n gfill.setAttribute('fy', y);\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute('fx', x);\n itemData.of.setAttribute('fy', y);\n }\n }\n // gfill.setAttribute('fy','200');\n }\n }\n function renderStroke(styleData, itemData, isFirstFrame) {\n var styleElem = itemData.style;\n var d = itemData.d;\n if (d && (d._mdf || isFirstFrame) && d.dashStr) {\n styleElem.pElem.setAttribute('stroke-dasharray', d.dashStr);\n styleElem.pElem.setAttribute('stroke-dashoffset', d.dashoffset[0]);\n }\n if (itemData.c && (itemData.c._mdf || isFirstFrame)) {\n styleElem.pElem.setAttribute('stroke', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')');\n }\n if (itemData.o._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('stroke-opacity', itemData.o.v);\n }\n if (itemData.w._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('stroke-width', itemData.w.v);\n if (styleElem.msElem) {\n styleElem.msElem.setAttribute('stroke-width', itemData.w.v);\n }\n }\n }\n return ob;\n }();\n\n function SVGShapeElement(data, globalData, comp) {\n // List of drawable elements\n this.shapes = [];\n // Full shape data\n this.shapesData = data.shapes;\n // List of styles that will be applied to shapes\n this.stylesList = [];\n // List of modifiers that will be applied to shapes\n this.shapeModifiers = [];\n // List of items in shape tree\n this.itemsData = [];\n // List of items in previous shape tree\n this.processedElements = [];\n // List of animated components\n this.animatedContents = [];\n this.initElement(data, globalData, comp);\n // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\n // List of elements that have been created\n this.prevViewData = [];\n // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\n }\n extendPrototype([BaseElement, TransformElement, SVGBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableDOMElement], SVGShapeElement);\n SVGShapeElement.prototype.initSecondaryElement = function () {};\n SVGShapeElement.prototype.identityMatrix = new Matrix();\n SVGShapeElement.prototype.buildExpressionInterface = function () {};\n SVGShapeElement.prototype.createContent = function () {\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);\n this.filterUniqueShapes();\n };\n\n /*\n This method searches for multiple shapes that affect a single element and one of them is animated\n */\n SVGShapeElement.prototype.filterUniqueShapes = function () {\n var i;\n var len = this.shapes.length;\n var shape;\n var j;\n var jLen = this.stylesList.length;\n var style;\n var tempShapes = [];\n var areAnimated = false;\n for (j = 0; j < jLen; j += 1) {\n style = this.stylesList[j];\n areAnimated = false;\n tempShapes.length = 0;\n for (i = 0; i < len; i += 1) {\n shape = this.shapes[i];\n if (shape.styles.indexOf(style) !== -1) {\n tempShapes.push(shape);\n areAnimated = shape._isAnimated || areAnimated;\n }\n }\n if (tempShapes.length > 1 && areAnimated) {\n this.setShapesAsAnimated(tempShapes);\n }\n }\n };\n SVGShapeElement.prototype.setShapesAsAnimated = function (shapes) {\n var i;\n var len = shapes.length;\n for (i = 0; i < len; i += 1) {\n shapes[i].setAsAnimated();\n }\n };\n SVGShapeElement.prototype.createStyleElement = function (data, level) {\n // TODO: prevent drawing of hidden styles\n var elementData;\n var styleOb = new SVGStyleData(data, level);\n var pathElement = styleOb.pElem;\n if (data.ty === 'st') {\n elementData = new SVGStrokeStyleData(this, data, styleOb);\n } else if (data.ty === 'fl') {\n elementData = new SVGFillStyleData(this, data, styleOb);\n } else if (data.ty === 'gf' || data.ty === 'gs') {\n var GradientConstructor = data.ty === 'gf' ? SVGGradientFillStyleData : SVGGradientStrokeStyleData;\n elementData = new GradientConstructor(this, data, styleOb);\n this.globalData.defs.appendChild(elementData.gf);\n if (elementData.maskId) {\n this.globalData.defs.appendChild(elementData.ms);\n this.globalData.defs.appendChild(elementData.of);\n pathElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + elementData.maskId + ')');\n }\n } else if (data.ty === 'no') {\n elementData = new SVGNoStyleData(this, data, styleOb);\n }\n if (data.ty === 'st' || data.ty === 'gs') {\n pathElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]);\n pathElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]);\n pathElement.setAttribute('fill-opacity', '0');\n if (data.lj === 1) {\n pathElement.setAttribute('stroke-miterlimit', data.ml);\n }\n }\n if (data.r === 2) {\n pathElement.setAttribute('fill-rule', 'evenodd');\n }\n if (data.ln) {\n pathElement.setAttribute('id', data.ln);\n }\n if (data.cl) {\n pathElement.setAttribute('class', data.cl);\n }\n if (data.bm) {\n pathElement.style['mix-blend-mode'] = getBlendMode(data.bm);\n }\n this.stylesList.push(styleOb);\n this.addToAnimatedContents(data, elementData);\n return elementData;\n };\n SVGShapeElement.prototype.createGroupElement = function (data) {\n var elementData = new ShapeGroupData();\n if (data.ln) {\n elementData.gr.setAttribute('id', data.ln);\n }\n if (data.cl) {\n elementData.gr.setAttribute('class', data.cl);\n }\n if (data.bm) {\n elementData.gr.style['mix-blend-mode'] = getBlendMode(data.bm);\n }\n return elementData;\n };\n SVGShapeElement.prototype.createTransformElement = function (data, container) {\n var transformProperty = TransformPropertyFactory.getTransformProperty(this, data, this);\n var elementData = new SVGTransformData(transformProperty, transformProperty.o, container);\n this.addToAnimatedContents(data, elementData);\n return elementData;\n };\n SVGShapeElement.prototype.createShapeElement = function (data, ownTransformers, level) {\n var ty = 4;\n if (data.ty === 'rc') {\n ty = 5;\n } else if (data.ty === 'el') {\n ty = 6;\n } else if (data.ty === 'sr') {\n ty = 7;\n }\n var shapeProperty = ShapePropertyFactory.getShapeProp(this, data, ty, this);\n var elementData = new SVGShapeData(ownTransformers, level, shapeProperty);\n this.shapes.push(elementData);\n this.addShapeToModifiers(elementData);\n this.addToAnimatedContents(data, elementData);\n return elementData;\n };\n SVGShapeElement.prototype.addToAnimatedContents = function (data, element) {\n var i = 0;\n var len = this.animatedContents.length;\n while (i < len) {\n if (this.animatedContents[i].element === element) {\n return;\n }\n i += 1;\n }\n this.animatedContents.push({\n fn: SVGElementsRenderer.createRenderFunction(data),\n element: element,\n data: data\n });\n };\n SVGShapeElement.prototype.setElementStyles = function (elementData) {\n var arr = elementData.styles;\n var j;\n var jLen = this.stylesList.length;\n for (j = 0; j < jLen; j += 1) {\n if (arr.indexOf(this.stylesList[j]) === -1 && !this.stylesList[j].closed) {\n arr.push(this.stylesList[j]);\n }\n }\n };\n SVGShapeElement.prototype.reloadShapes = function () {\n this._isFirstFrame = true;\n var i;\n var len = this.itemsData.length;\n for (i = 0; i < len; i += 1) {\n this.prevViewData[i] = this.itemsData[i];\n }\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);\n this.filterUniqueShapes();\n len = this.dynamicProperties.length;\n for (i = 0; i < len; i += 1) {\n this.dynamicProperties[i].getValue();\n }\n this.renderModifiers();\n };\n SVGShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, container, level, transformers, render) {\n var ownTransformers = [].concat(transformers);\n var i;\n var len = arr.length - 1;\n var j;\n var jLen;\n var ownStyles = [];\n var ownModifiers = [];\n var currentTransform;\n var modifier;\n var processedPos;\n for (i = len; i >= 0; i -= 1) {\n processedPos = this.searchProcessedElement(arr[i]);\n if (!processedPos) {\n arr[i]._render = render;\n } else {\n itemsData[i] = prevViewData[processedPos - 1];\n }\n if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs' || arr[i].ty === 'no') {\n if (!processedPos) {\n itemsData[i] = this.createStyleElement(arr[i], level);\n } else {\n itemsData[i].style.closed = arr[i].hd;\n }\n if (arr[i]._render) {\n if (itemsData[i].style.pElem.parentNode !== container) {\n container.appendChild(itemsData[i].style.pElem);\n }\n }\n ownStyles.push(itemsData[i].style);\n } else if (arr[i].ty === 'gr') {\n if (!processedPos) {\n itemsData[i] = this.createGroupElement(arr[i]);\n } else {\n jLen = itemsData[i].it.length;\n for (j = 0; j < jLen; j += 1) {\n itemsData[i].prevViewData[j] = itemsData[i].it[j];\n }\n }\n this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, itemsData[i].gr, level + 1, ownTransformers, render);\n if (arr[i]._render) {\n if (itemsData[i].gr.parentNode !== container) {\n container.appendChild(itemsData[i].gr);\n }\n }\n } else if (arr[i].ty === 'tr') {\n if (!processedPos) {\n itemsData[i] = this.createTransformElement(arr[i], container);\n }\n currentTransform = itemsData[i].transform;\n ownTransformers.push(currentTransform);\n } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {\n if (!processedPos) {\n itemsData[i] = this.createShapeElement(arr[i], ownTransformers, level);\n }\n this.setElementStyles(itemsData[i]);\n } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'ms' || arr[i].ty === 'pb' || arr[i].ty === 'zz' || arr[i].ty === 'op') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty);\n modifier.init(this, arr[i]);\n itemsData[i] = modifier;\n this.shapeModifiers.push(modifier);\n } else {\n modifier = itemsData[i];\n modifier.closed = false;\n }\n ownModifiers.push(modifier);\n } else if (arr[i].ty === 'rp') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty);\n itemsData[i] = modifier;\n modifier.init(this, arr, i, itemsData);\n this.shapeModifiers.push(modifier);\n render = false;\n } else {\n modifier = itemsData[i];\n modifier.closed = true;\n }\n ownModifiers.push(modifier);\n }\n this.addProcessedElement(arr[i], i + 1);\n }\n len = ownStyles.length;\n for (i = 0; i < len; i += 1) {\n ownStyles[i].closed = true;\n }\n len = ownModifiers.length;\n for (i = 0; i < len; i += 1) {\n ownModifiers[i].closed = true;\n }\n };\n SVGShapeElement.prototype.renderInnerContent = function () {\n this.renderModifiers();\n var i;\n var len = this.stylesList.length;\n for (i = 0; i < len; i += 1) {\n this.stylesList[i].reset();\n }\n this.renderShape();\n for (i = 0; i < len; i += 1) {\n if (this.stylesList[i]._mdf || this._isFirstFrame) {\n if (this.stylesList[i].msElem) {\n this.stylesList[i].msElem.setAttribute('d', this.stylesList[i].d);\n // Adding M0 0 fixes same mask bug on all browsers\n this.stylesList[i].d = 'M0 0' + this.stylesList[i].d;\n }\n this.stylesList[i].pElem.setAttribute('d', this.stylesList[i].d || 'M0 0');\n }\n }\n };\n SVGShapeElement.prototype.renderShape = function () {\n var i;\n var len = this.animatedContents.length;\n var animatedContent;\n for (i = 0; i < len; i += 1) {\n animatedContent = this.animatedContents[i];\n if ((this._isFirstFrame || animatedContent.element._isAnimated) && animatedContent.data !== true) {\n animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame);\n }\n }\n };\n SVGShapeElement.prototype.destroy = function () {\n this.destroyBaseElement();\n this.shapesData = null;\n this.itemsData = null;\n };\n\n function LetterProps(o, sw, sc, fc, m, p) {\n this.o = o;\n this.sw = sw;\n this.sc = sc;\n this.fc = fc;\n this.m = m;\n this.p = p;\n this._mdf = {\n o: true,\n sw: !!sw,\n sc: !!sc,\n fc: !!fc,\n m: true,\n p: true\n };\n }\n LetterProps.prototype.update = function (o, sw, sc, fc, m, p) {\n this._mdf.o = false;\n this._mdf.sw = false;\n this._mdf.sc = false;\n this._mdf.fc = false;\n this._mdf.m = false;\n this._mdf.p = false;\n var updated = false;\n if (this.o !== o) {\n this.o = o;\n this._mdf.o = true;\n updated = true;\n }\n if (this.sw !== sw) {\n this.sw = sw;\n this._mdf.sw = true;\n updated = true;\n }\n if (this.sc !== sc) {\n this.sc = sc;\n this._mdf.sc = true;\n updated = true;\n }\n if (this.fc !== fc) {\n this.fc = fc;\n this._mdf.fc = true;\n updated = true;\n }\n if (this.m !== m) {\n this.m = m;\n this._mdf.m = true;\n updated = true;\n }\n if (p.length && (this.p[0] !== p[0] || this.p[1] !== p[1] || this.p[4] !== p[4] || this.p[5] !== p[5] || this.p[12] !== p[12] || this.p[13] !== p[13])) {\n this.p = p;\n this._mdf.p = true;\n updated = true;\n }\n return updated;\n };\n\n function TextProperty(elem, data) {\n this._frameId = initialDefaultFrame;\n this.pv = '';\n this.v = '';\n this.kf = false;\n this._isFirstFrame = true;\n this._mdf = false;\n if (data.d && data.d.sid) {\n data.d = elem.globalData.slotManager.getProp(data.d);\n }\n this.data = data;\n this.elem = elem;\n this.comp = this.elem.comp;\n this.keysIndex = 0;\n this.canResize = false;\n this.minimumFontSize = 1;\n this.effectsSequence = [];\n this.currentData = {\n ascent: 0,\n boxWidth: this.defaultBoxWidth,\n f: '',\n fStyle: '',\n fWeight: '',\n fc: '',\n j: '',\n justifyOffset: '',\n l: [],\n lh: 0,\n lineWidths: [],\n ls: '',\n of: '',\n s: '',\n sc: '',\n sw: 0,\n t: 0,\n tr: 0,\n sz: 0,\n ps: null,\n fillColorAnim: false,\n strokeColorAnim: false,\n strokeWidthAnim: false,\n yOffset: 0,\n finalSize: 0,\n finalText: [],\n finalLineHeight: 0,\n __complete: false\n };\n this.copyData(this.currentData, this.data.d.k[0].s);\n if (!this.searchProperty()) {\n this.completeTextData(this.currentData);\n }\n }\n TextProperty.prototype.defaultBoxWidth = [0, 0];\n TextProperty.prototype.copyData = function (obj, data) {\n for (var s in data) {\n if (Object.prototype.hasOwnProperty.call(data, s)) {\n obj[s] = data[s];\n }\n }\n return obj;\n };\n TextProperty.prototype.setCurrentData = function (data) {\n if (!data.__complete) {\n this.completeTextData(data);\n }\n this.currentData = data;\n this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth;\n this._mdf = true;\n };\n TextProperty.prototype.searchProperty = function () {\n return this.searchKeyframes();\n };\n TextProperty.prototype.searchKeyframes = function () {\n this.kf = this.data.d.k.length > 1;\n if (this.kf) {\n this.addEffect(this.getKeyframeValue.bind(this));\n }\n return this.kf;\n };\n TextProperty.prototype.addEffect = function (effectFunction) {\n this.effectsSequence.push(effectFunction);\n this.elem.addDynamicProperty(this);\n };\n TextProperty.prototype.getValue = function (_finalValue) {\n if ((this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) && !_finalValue) {\n return;\n }\n this.currentData.t = this.data.d.k[this.keysIndex].s.t;\n var currentValue = this.currentData;\n var currentIndex = this.keysIndex;\n if (this.lock) {\n this.setCurrentData(this.currentData);\n return;\n }\n this.lock = true;\n this._mdf = false;\n var i;\n var len = this.effectsSequence.length;\n var finalValue = _finalValue || this.data.d.k[this.keysIndex].s;\n for (i = 0; i < len; i += 1) {\n // Checking if index changed to prevent creating a new object every time the expression updates.\n if (currentIndex !== this.keysIndex) {\n finalValue = this.effectsSequence[i](finalValue, finalValue.t);\n } else {\n finalValue = this.effectsSequence[i](this.currentData, finalValue.t);\n }\n }\n if (currentValue !== finalValue) {\n this.setCurrentData(finalValue);\n }\n this.v = this.currentData;\n this.pv = this.v;\n this.lock = false;\n this.frameId = this.elem.globalData.frameId;\n };\n TextProperty.prototype.getKeyframeValue = function () {\n var textKeys = this.data.d.k;\n var frameNum = this.elem.comp.renderedFrame;\n var i = 0;\n var len = textKeys.length;\n while (i <= len - 1) {\n if (i === len - 1 || textKeys[i + 1].t > frameNum) {\n break;\n }\n i += 1;\n }\n if (this.keysIndex !== i) {\n this.keysIndex = i;\n }\n return this.data.d.k[this.keysIndex].s;\n };\n TextProperty.prototype.buildFinalText = function (text) {\n var charactersArray = [];\n var i = 0;\n var len = text.length;\n var charCode;\n var secondCharCode;\n var shouldCombine = false;\n var shouldCombineNext = false;\n var currentChars = '';\n while (i < len) {\n shouldCombine = shouldCombineNext;\n shouldCombineNext = false;\n charCode = text.charCodeAt(i);\n currentChars = text.charAt(i);\n if (FontManager.isCombinedCharacter(charCode)) {\n shouldCombine = true;\n // It's a potential surrogate pair (this is the High surrogate)\n } else if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n if (FontManager.isRegionalFlag(text, i)) {\n currentChars = text.substr(i, 14);\n } else {\n secondCharCode = text.charCodeAt(i + 1);\n // It's a surrogate pair (this is the Low surrogate)\n if (secondCharCode >= 0xDC00 && secondCharCode <= 0xDFFF) {\n if (FontManager.isModifier(charCode, secondCharCode)) {\n currentChars = text.substr(i, 2);\n shouldCombine = true;\n } else if (FontManager.isFlagEmoji(text.substr(i, 4))) {\n currentChars = text.substr(i, 4);\n } else {\n currentChars = text.substr(i, 2);\n }\n }\n }\n } else if (charCode > 0xDBFF) {\n secondCharCode = text.charCodeAt(i + 1);\n if (FontManager.isVariationSelector(charCode)) {\n shouldCombine = true;\n }\n } else if (FontManager.isZeroWidthJoiner(charCode)) {\n shouldCombine = true;\n shouldCombineNext = true;\n }\n if (shouldCombine) {\n charactersArray[charactersArray.length - 1] += currentChars;\n shouldCombine = false;\n } else {\n charactersArray.push(currentChars);\n }\n i += currentChars.length;\n }\n return charactersArray;\n };\n TextProperty.prototype.completeTextData = function (documentData) {\n documentData.__complete = true;\n var fontManager = this.elem.globalData.fontManager;\n var data = this.data;\n var letters = [];\n var i;\n var len;\n var newLineFlag;\n var index = 0;\n var val;\n var anchorGrouping = data.m.g;\n var currentSize = 0;\n var currentPos = 0;\n var currentLine = 0;\n var lineWidths = [];\n var lineWidth = 0;\n var maxLineWidth = 0;\n var j;\n var jLen;\n var fontData = fontManager.getFontByName(documentData.f);\n var charData;\n var cLength = 0;\n var fontProps = getFontProperties(fontData);\n documentData.fWeight = fontProps.weight;\n documentData.fStyle = fontProps.style;\n documentData.finalSize = documentData.s;\n documentData.finalText = this.buildFinalText(documentData.t);\n len = documentData.finalText.length;\n documentData.finalLineHeight = documentData.lh;\n var trackingOffset = documentData.tr / 1000 * documentData.finalSize;\n var charCode;\n if (documentData.sz) {\n var flag = true;\n var boxWidth = documentData.sz[0];\n var boxHeight = documentData.sz[1];\n var currentHeight;\n var finalText;\n while (flag) {\n finalText = this.buildFinalText(documentData.t);\n currentHeight = 0;\n lineWidth = 0;\n len = finalText.length;\n trackingOffset = documentData.tr / 1000 * documentData.finalSize;\n var lastSpaceIndex = -1;\n for (i = 0; i < len; i += 1) {\n charCode = finalText[i].charCodeAt(0);\n newLineFlag = false;\n if (finalText[i] === ' ') {\n lastSpaceIndex = i;\n } else if (charCode === 13 || charCode === 3) {\n lineWidth = 0;\n newLineFlag = true;\n currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;\n }\n if (fontManager.chars) {\n charData = fontManager.getCharData(finalText[i], fontData.fStyle, fontData.fFamily);\n cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100;\n } else {\n // tCanvasHelper.font = documentData.s + 'px '+ fontData.fFamily;\n cLength = fontManager.measureText(finalText[i], documentData.f, documentData.finalSize);\n }\n if (lineWidth + cLength > boxWidth && finalText[i] !== ' ') {\n if (lastSpaceIndex === -1) {\n len += 1;\n } else {\n i = lastSpaceIndex;\n }\n currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;\n finalText.splice(i, lastSpaceIndex === i ? 1 : 0, '\\r');\n // finalText = finalText.substr(0,i) + \"\\r\" + finalText.substr(i === lastSpaceIndex ? i + 1 : i);\n lastSpaceIndex = -1;\n lineWidth = 0;\n } else {\n lineWidth += cLength;\n lineWidth += trackingOffset;\n }\n }\n currentHeight += fontData.ascent * documentData.finalSize / 100;\n if (this.canResize && documentData.finalSize > this.minimumFontSize && boxHeight < currentHeight) {\n documentData.finalSize -= 1;\n documentData.finalLineHeight = documentData.finalSize * documentData.lh / documentData.s;\n } else {\n documentData.finalText = finalText;\n len = documentData.finalText.length;\n flag = false;\n }\n }\n }\n lineWidth = -trackingOffset;\n cLength = 0;\n var uncollapsedSpaces = 0;\n var currentChar;\n for (i = 0; i < len; i += 1) {\n newLineFlag = false;\n currentChar = documentData.finalText[i];\n charCode = currentChar.charCodeAt(0);\n if (charCode === 13 || charCode === 3) {\n uncollapsedSpaces = 0;\n lineWidths.push(lineWidth);\n maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;\n lineWidth = -2 * trackingOffset;\n val = '';\n newLineFlag = true;\n currentLine += 1;\n } else {\n val = currentChar;\n }\n if (fontManager.chars) {\n charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(documentData.f).fFamily);\n cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100;\n } else {\n // var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize);\n // tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily;\n cLength = fontManager.measureText(val, documentData.f, documentData.finalSize);\n }\n\n //\n if (currentChar === ' ') {\n uncollapsedSpaces += cLength + trackingOffset;\n } else {\n lineWidth += cLength + trackingOffset + uncollapsedSpaces;\n uncollapsedSpaces = 0;\n }\n letters.push({\n l: cLength,\n an: cLength,\n add: currentSize,\n n: newLineFlag,\n anIndexes: [],\n val: val,\n line: currentLine,\n animatorJustifyOffset: 0\n });\n if (anchorGrouping == 2) {\n // eslint-disable-line eqeqeq\n currentSize += cLength;\n if (val === '' || val === ' ' || i === len - 1) {\n if (val === '' || val === ' ') {\n currentSize -= cLength;\n }\n while (currentPos <= i) {\n letters[currentPos].an = currentSize;\n letters[currentPos].ind = index;\n letters[currentPos].extra = cLength;\n currentPos += 1;\n }\n index += 1;\n currentSize = 0;\n }\n } else if (anchorGrouping == 3) {\n // eslint-disable-line eqeqeq\n currentSize += cLength;\n if (val === '' || i === len - 1) {\n if (val === '') {\n currentSize -= cLength;\n }\n while (currentPos <= i) {\n letters[currentPos].an = currentSize;\n letters[currentPos].ind = index;\n letters[currentPos].extra = cLength;\n currentPos += 1;\n }\n currentSize = 0;\n index += 1;\n }\n } else {\n letters[index].ind = index;\n letters[index].extra = 0;\n index += 1;\n }\n }\n documentData.l = letters;\n maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;\n lineWidths.push(lineWidth);\n if (documentData.sz) {\n documentData.boxWidth = documentData.sz[0];\n documentData.justifyOffset = 0;\n } else {\n documentData.boxWidth = maxLineWidth;\n switch (documentData.j) {\n case 1:\n documentData.justifyOffset = -documentData.boxWidth;\n break;\n case 2:\n documentData.justifyOffset = -documentData.boxWidth / 2;\n break;\n default:\n documentData.justifyOffset = 0;\n }\n }\n documentData.lineWidths = lineWidths;\n var animators = data.a;\n var animatorData;\n var letterData;\n jLen = animators.length;\n var based;\n var ind;\n var indexes = [];\n for (j = 0; j < jLen; j += 1) {\n animatorData = animators[j];\n if (animatorData.a.sc) {\n documentData.strokeColorAnim = true;\n }\n if (animatorData.a.sw) {\n documentData.strokeWidthAnim = true;\n }\n if (animatorData.a.fc || animatorData.a.fh || animatorData.a.fs || animatorData.a.fb) {\n documentData.fillColorAnim = true;\n }\n ind = 0;\n based = animatorData.s.b;\n for (i = 0; i < len; i += 1) {\n letterData = letters[i];\n letterData.anIndexes[j] = ind;\n if (based == 1 && letterData.val !== '' || based == 2 && letterData.val !== '' && letterData.val !== ' ' || based == 3 && (letterData.n || letterData.val == ' ' || i == len - 1) || based == 4 && (letterData.n || i == len - 1)) {\n // eslint-disable-line eqeqeq\n if (animatorData.s.rn === 1) {\n indexes.push(ind);\n }\n ind += 1;\n }\n }\n data.a[j].s.totalChars = ind;\n var currentInd = -1;\n var newInd;\n if (animatorData.s.rn === 1) {\n for (i = 0; i < len; i += 1) {\n letterData = letters[i];\n if (currentInd != letterData.anIndexes[j]) {\n // eslint-disable-line eqeqeq\n currentInd = letterData.anIndexes[j];\n newInd = indexes.splice(Math.floor(Math.random() * indexes.length), 1)[0];\n }\n letterData.anIndexes[j] = newInd;\n }\n }\n }\n documentData.yOffset = documentData.finalLineHeight || documentData.finalSize * 1.2;\n documentData.ls = documentData.ls || 0;\n documentData.ascent = fontData.ascent * documentData.finalSize / 100;\n };\n TextProperty.prototype.updateDocumentData = function (newData, index) {\n index = index === undefined ? this.keysIndex : index;\n var dData = this.copyData({}, this.data.d.k[index].s);\n dData = this.copyData(dData, newData);\n this.data.d.k[index].s = dData;\n this.recalculate(index);\n this.setCurrentData(dData);\n this.elem.addDynamicProperty(this);\n };\n TextProperty.prototype.recalculate = function (index) {\n var dData = this.data.d.k[index].s;\n dData.__complete = false;\n this.keysIndex = 0;\n this._isFirstFrame = true;\n this.getValue(dData);\n };\n TextProperty.prototype.canResizeFont = function (_canResize) {\n this.canResize = _canResize;\n this.recalculate(this.keysIndex);\n this.elem.addDynamicProperty(this);\n };\n TextProperty.prototype.setMinimumFontSize = function (_fontValue) {\n this.minimumFontSize = Math.floor(_fontValue) || 1;\n this.recalculate(this.keysIndex);\n this.elem.addDynamicProperty(this);\n };\n\n var TextSelectorProp = function () {\n var max = Math.max;\n var min = Math.min;\n var floor = Math.floor;\n function TextSelectorPropFactory(elem, data) {\n this._currentTextLength = -1;\n this.k = false;\n this.data = data;\n this.elem = elem;\n this.comp = elem.comp;\n this.finalS = 0;\n this.finalE = 0;\n this.initDynamicPropertyContainer(elem);\n this.s = PropertyFactory.getProp(elem, data.s || {\n k: 0\n }, 0, 0, this);\n if ('e' in data) {\n this.e = PropertyFactory.getProp(elem, data.e, 0, 0, this);\n } else {\n this.e = {\n v: 100\n };\n }\n this.o = PropertyFactory.getProp(elem, data.o || {\n k: 0\n }, 0, 0, this);\n this.xe = PropertyFactory.getProp(elem, data.xe || {\n k: 0\n }, 0, 0, this);\n this.ne = PropertyFactory.getProp(elem, data.ne || {\n k: 0\n }, 0, 0, this);\n this.sm = PropertyFactory.getProp(elem, data.sm || {\n k: 100\n }, 0, 0, this);\n this.a = PropertyFactory.getProp(elem, data.a, 0, 0.01, this);\n if (!this.dynamicProperties.length) {\n this.getValue();\n }\n }\n TextSelectorPropFactory.prototype = {\n getMult: function getMult(ind) {\n if (this._currentTextLength !== this.elem.textProperty.currentData.l.length) {\n this.getValue();\n }\n var x1 = 0;\n var y1 = 0;\n var x2 = 1;\n var y2 = 1;\n if (this.ne.v > 0) {\n x1 = this.ne.v / 100.0;\n } else {\n y1 = -this.ne.v / 100.0;\n }\n if (this.xe.v > 0) {\n x2 = 1.0 - this.xe.v / 100.0;\n } else {\n y2 = 1.0 + this.xe.v / 100.0;\n }\n var easer = BezierFactory.getBezierEasing(x1, y1, x2, y2).get;\n var mult = 0;\n var s = this.finalS;\n var e = this.finalE;\n var type = this.data.sh;\n if (type === 2) {\n if (e === s) {\n mult = ind >= e ? 1 : 0;\n } else {\n mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));\n }\n mult = easer(mult);\n } else if (type === 3) {\n if (e === s) {\n mult = ind >= e ? 0 : 1;\n } else {\n mult = 1 - max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));\n }\n mult = easer(mult);\n } else if (type === 4) {\n if (e === s) {\n mult = 0;\n } else {\n mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));\n if (mult < 0.5) {\n mult *= 2;\n } else {\n mult = 1 - 2 * (mult - 0.5);\n }\n }\n mult = easer(mult);\n } else if (type === 5) {\n if (e === s) {\n mult = 0;\n } else {\n var tot = e - s;\n /* ind += 0.5;\n mult = -4/(tot*tot)*(ind*ind)+(4/tot)*ind; */\n ind = min(max(0, ind + 0.5 - s), e - s);\n var x = -tot / 2 + ind;\n var a = tot / 2;\n mult = Math.sqrt(1 - x * x / (a * a));\n }\n mult = easer(mult);\n } else if (type === 6) {\n if (e === s) {\n mult = 0;\n } else {\n ind = min(max(0, ind + 0.5 - s), e - s);\n mult = (1 + Math.cos(Math.PI + Math.PI * 2 * ind / (e - s))) / 2; // eslint-disable-line\n }\n mult = easer(mult);\n } else {\n if (ind >= floor(s)) {\n if (ind - s < 0) {\n mult = max(0, min(min(e, 1) - (s - ind), 1));\n } else {\n mult = max(0, min(e - ind, 1));\n }\n }\n mult = easer(mult);\n }\n // Smoothness implementation.\n // The smoothness represents a reduced range of the original [0; 1] range.\n // if smoothness is 25%, the new range will be [0.375; 0.625]\n // Steps are:\n // - find the lower value of the new range (threshold)\n // - if multiplier is smaller than that value, floor it to 0\n // - if it is larger,\n // - subtract the threshold\n // - divide it by the smoothness (this will return the range to [0; 1])\n // Note: If it doesn't work on some scenarios, consider applying it before the easer.\n if (this.sm.v !== 100) {\n var smoothness = this.sm.v * 0.01;\n if (smoothness === 0) {\n smoothness = 0.00000001;\n }\n var threshold = 0.5 - smoothness * 0.5;\n if (mult < threshold) {\n mult = 0;\n } else {\n mult = (mult - threshold) / smoothness;\n if (mult > 1) {\n mult = 1;\n }\n }\n }\n return mult * this.a.v;\n },\n getValue: function getValue(newCharsFlag) {\n this.iterateDynamicProperties();\n this._mdf = newCharsFlag || this._mdf;\n this._currentTextLength = this.elem.textProperty.currentData.l.length || 0;\n if (newCharsFlag && this.data.r === 2) {\n this.e.v = this._currentTextLength;\n }\n var divisor = this.data.r === 2 ? 1 : 100 / this.data.totalChars;\n var o = this.o.v / divisor;\n var s = this.s.v / divisor + o;\n var e = this.e.v / divisor + o;\n if (s > e) {\n var _s = s;\n s = e;\n e = _s;\n }\n this.finalS = s;\n this.finalE = e;\n }\n };\n extendPrototype([DynamicPropertyContainer], TextSelectorPropFactory);\n function getTextSelectorProp(elem, data, arr) {\n return new TextSelectorPropFactory(elem, data, arr);\n }\n return {\n getTextSelectorProp: getTextSelectorProp\n };\n }();\n\n function TextAnimatorDataProperty(elem, animatorProps, container) {\n var defaultData = {\n propType: false\n };\n var getProp = PropertyFactory.getProp;\n var textAnimatorAnimatables = animatorProps.a;\n this.a = {\n r: textAnimatorAnimatables.r ? getProp(elem, textAnimatorAnimatables.r, 0, degToRads, container) : defaultData,\n rx: textAnimatorAnimatables.rx ? getProp(elem, textAnimatorAnimatables.rx, 0, degToRads, container) : defaultData,\n ry: textAnimatorAnimatables.ry ? getProp(elem, textAnimatorAnimatables.ry, 0, degToRads, container) : defaultData,\n sk: textAnimatorAnimatables.sk ? getProp(elem, textAnimatorAnimatables.sk, 0, degToRads, container) : defaultData,\n sa: textAnimatorAnimatables.sa ? getProp(elem, textAnimatorAnimatables.sa, 0, degToRads, container) : defaultData,\n s: textAnimatorAnimatables.s ? getProp(elem, textAnimatorAnimatables.s, 1, 0.01, container) : defaultData,\n a: textAnimatorAnimatables.a ? getProp(elem, textAnimatorAnimatables.a, 1, 0, container) : defaultData,\n o: textAnimatorAnimatables.o ? getProp(elem, textAnimatorAnimatables.o, 0, 0.01, container) : defaultData,\n p: textAnimatorAnimatables.p ? getProp(elem, textAnimatorAnimatables.p, 1, 0, container) : defaultData,\n sw: textAnimatorAnimatables.sw ? getProp(elem, textAnimatorAnimatables.sw, 0, 0, container) : defaultData,\n sc: textAnimatorAnimatables.sc ? getProp(elem, textAnimatorAnimatables.sc, 1, 0, container) : defaultData,\n fc: textAnimatorAnimatables.fc ? getProp(elem, textAnimatorAnimatables.fc, 1, 0, container) : defaultData,\n fh: textAnimatorAnimatables.fh ? getProp(elem, textAnimatorAnimatables.fh, 0, 0, container) : defaultData,\n fs: textAnimatorAnimatables.fs ? getProp(elem, textAnimatorAnimatables.fs, 0, 0.01, container) : defaultData,\n fb: textAnimatorAnimatables.fb ? getProp(elem, textAnimatorAnimatables.fb, 0, 0.01, container) : defaultData,\n t: textAnimatorAnimatables.t ? getProp(elem, textAnimatorAnimatables.t, 0, 0, container) : defaultData\n };\n this.s = TextSelectorProp.getTextSelectorProp(elem, animatorProps.s, container);\n this.s.t = animatorProps.s.t;\n }\n\n function TextAnimatorProperty(textData, renderType, elem) {\n this._isFirstFrame = true;\n this._hasMaskedPath = false;\n this._frameId = -1;\n this._textData = textData;\n this._renderType = renderType;\n this._elem = elem;\n this._animatorsData = createSizedArray(this._textData.a.length);\n this._pathData = {};\n this._moreOptions = {\n alignment: {}\n };\n this.renderedLetters = [];\n this.lettersChangedFlag = false;\n this.initDynamicPropertyContainer(elem);\n }\n TextAnimatorProperty.prototype.searchProperties = function () {\n var i;\n var len = this._textData.a.length;\n var animatorProps;\n var getProp = PropertyFactory.getProp;\n for (i = 0; i < len; i += 1) {\n animatorProps = this._textData.a[i];\n this._animatorsData[i] = new TextAnimatorDataProperty(this._elem, animatorProps, this);\n }\n if (this._textData.p && 'm' in this._textData.p) {\n this._pathData = {\n a: getProp(this._elem, this._textData.p.a, 0, 0, this),\n f: getProp(this._elem, this._textData.p.f, 0, 0, this),\n l: getProp(this._elem, this._textData.p.l, 0, 0, this),\n r: getProp(this._elem, this._textData.p.r, 0, 0, this),\n p: getProp(this._elem, this._textData.p.p, 0, 0, this),\n m: this._elem.maskManager.getMaskProperty(this._textData.p.m)\n };\n this._hasMaskedPath = true;\n } else {\n this._hasMaskedPath = false;\n }\n this._moreOptions.alignment = getProp(this._elem, this._textData.m.a, 1, 0, this);\n };\n TextAnimatorProperty.prototype.getMeasures = function (documentData, lettersChangedFlag) {\n this.lettersChangedFlag = lettersChangedFlag;\n if (!this._mdf && !this._isFirstFrame && !lettersChangedFlag && (!this._hasMaskedPath || !this._pathData.m._mdf)) {\n return;\n }\n this._isFirstFrame = false;\n var alignment = this._moreOptions.alignment.v;\n var animators = this._animatorsData;\n var textData = this._textData;\n var matrixHelper = this.mHelper;\n var renderType = this._renderType;\n var renderedLettersCount = this.renderedLetters.length;\n var xPos;\n var yPos;\n var i;\n var len;\n var letters = documentData.l;\n var pathInfo;\n var currentLength;\n var currentPoint;\n var segmentLength;\n var flag;\n var pointInd;\n var segmentInd;\n var prevPoint;\n var points;\n var segments;\n var partialLength;\n var totalLength;\n var perc;\n var tanAngle;\n var mask;\n if (this._hasMaskedPath) {\n mask = this._pathData.m;\n if (!this._pathData.n || this._pathData._mdf) {\n var paths = mask.v;\n if (this._pathData.r.v) {\n paths = paths.reverse();\n }\n // TODO: release bezier data cached from previous pathInfo: this._pathData.pi\n pathInfo = {\n tLength: 0,\n segments: []\n };\n len = paths._length - 1;\n var bezierData;\n totalLength = 0;\n for (i = 0; i < len; i += 1) {\n bezierData = bez.buildBezierData(paths.v[i], paths.v[i + 1], [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]], [paths.i[i + 1][0] - paths.v[i + 1][0], paths.i[i + 1][1] - paths.v[i + 1][1]]);\n pathInfo.tLength += bezierData.segmentLength;\n pathInfo.segments.push(bezierData);\n totalLength += bezierData.segmentLength;\n }\n i = len;\n if (mask.v.c) {\n bezierData = bez.buildBezierData(paths.v[i], paths.v[0], [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]], [paths.i[0][0] - paths.v[0][0], paths.i[0][1] - paths.v[0][1]]);\n pathInfo.tLength += bezierData.segmentLength;\n pathInfo.segments.push(bezierData);\n totalLength += bezierData.segmentLength;\n }\n this._pathData.pi = pathInfo;\n }\n pathInfo = this._pathData.pi;\n currentLength = this._pathData.f.v;\n segmentInd = 0;\n pointInd = 1;\n segmentLength = 0;\n flag = true;\n segments = pathInfo.segments;\n if (currentLength < 0 && mask.v.c) {\n if (pathInfo.tLength < Math.abs(currentLength)) {\n currentLength = -Math.abs(currentLength) % pathInfo.tLength;\n }\n segmentInd = segments.length - 1;\n points = segments[segmentInd].points;\n pointInd = points.length - 1;\n while (currentLength < 0) {\n currentLength += points[pointInd].partialLength;\n pointInd -= 1;\n if (pointInd < 0) {\n segmentInd -= 1;\n points = segments[segmentInd].points;\n pointInd = points.length - 1;\n }\n }\n }\n points = segments[segmentInd].points;\n prevPoint = points[pointInd - 1];\n currentPoint = points[pointInd];\n partialLength = currentPoint.partialLength;\n }\n len = letters.length;\n xPos = 0;\n yPos = 0;\n var yOff = documentData.finalSize * 1.2 * 0.714;\n var firstLine = true;\n var animatorProps;\n var animatorSelector;\n var j;\n var jLen;\n var letterValue;\n jLen = animators.length;\n var mult;\n var ind = -1;\n var offf;\n var xPathPos;\n var yPathPos;\n var initPathPos = currentLength;\n var initSegmentInd = segmentInd;\n var initPointInd = pointInd;\n var currentLine = -1;\n var elemOpacity;\n var sc;\n var sw;\n var fc;\n var k;\n var letterSw;\n var letterSc;\n var letterFc;\n var letterM = '';\n var letterP = this.defaultPropsArray;\n var letterO;\n\n //\n if (documentData.j === 2 || documentData.j === 1) {\n var animatorJustifyOffset = 0;\n var animatorFirstCharOffset = 0;\n var justifyOffsetMult = documentData.j === 2 ? -0.5 : -1;\n var lastIndex = 0;\n var isNewLine = true;\n for (i = 0; i < len; i += 1) {\n if (letters[i].n) {\n if (animatorJustifyOffset) {\n animatorJustifyOffset += animatorFirstCharOffset;\n }\n while (lastIndex < i) {\n letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;\n lastIndex += 1;\n }\n animatorJustifyOffset = 0;\n isNewLine = true;\n } else {\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n if (animatorProps.t.propType) {\n if (isNewLine && documentData.j === 2) {\n animatorFirstCharOffset += animatorProps.t.v * justifyOffsetMult;\n }\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (mult.length) {\n animatorJustifyOffset += animatorProps.t.v * mult[0] * justifyOffsetMult;\n } else {\n animatorJustifyOffset += animatorProps.t.v * mult * justifyOffsetMult;\n }\n }\n }\n isNewLine = false;\n }\n }\n if (animatorJustifyOffset) {\n animatorJustifyOffset += animatorFirstCharOffset;\n }\n while (lastIndex < i) {\n letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;\n lastIndex += 1;\n }\n }\n //\n\n for (i = 0; i < len; i += 1) {\n matrixHelper.reset();\n elemOpacity = 1;\n if (letters[i].n) {\n xPos = 0;\n yPos += documentData.yOffset;\n yPos += firstLine ? 1 : 0;\n currentLength = initPathPos;\n firstLine = false;\n if (this._hasMaskedPath) {\n segmentInd = initSegmentInd;\n pointInd = initPointInd;\n points = segments[segmentInd].points;\n prevPoint = points[pointInd - 1];\n currentPoint = points[pointInd];\n partialLength = currentPoint.partialLength;\n segmentLength = 0;\n }\n letterM = '';\n letterFc = '';\n letterSw = '';\n letterO = '';\n letterP = this.defaultPropsArray;\n } else {\n if (this._hasMaskedPath) {\n if (currentLine !== letters[i].line) {\n switch (documentData.j) {\n case 1:\n currentLength += totalLength - documentData.lineWidths[letters[i].line];\n break;\n case 2:\n currentLength += (totalLength - documentData.lineWidths[letters[i].line]) / 2;\n break;\n default:\n break;\n }\n currentLine = letters[i].line;\n }\n if (ind !== letters[i].ind) {\n if (letters[ind]) {\n currentLength += letters[ind].extra;\n }\n currentLength += letters[i].an / 2;\n ind = letters[i].ind;\n }\n currentLength += alignment[0] * letters[i].an * 0.005;\n var animatorOffset = 0;\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n if (animatorProps.p.propType) {\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (mult.length) {\n animatorOffset += animatorProps.p.v[0] * mult[0];\n } else {\n animatorOffset += animatorProps.p.v[0] * mult;\n }\n }\n if (animatorProps.a.propType) {\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (mult.length) {\n animatorOffset += animatorProps.a.v[0] * mult[0];\n } else {\n animatorOffset += animatorProps.a.v[0] * mult;\n }\n }\n }\n flag = true;\n // Force alignment only works with a single line for now\n if (this._pathData.a.v) {\n currentLength = letters[0].an * 0.5 + (totalLength - this._pathData.f.v - letters[0].an * 0.5 - letters[letters.length - 1].an * 0.5) * ind / (len - 1);\n currentLength += this._pathData.f.v;\n }\n while (flag) {\n if (segmentLength + partialLength >= currentLength + animatorOffset || !points) {\n perc = (currentLength + animatorOffset - segmentLength) / currentPoint.partialLength;\n xPathPos = prevPoint.point[0] + (currentPoint.point[0] - prevPoint.point[0]) * perc;\n yPathPos = prevPoint.point[1] + (currentPoint.point[1] - prevPoint.point[1]) * perc;\n matrixHelper.translate(-alignment[0] * letters[i].an * 0.005, -(alignment[1] * yOff) * 0.01);\n flag = false;\n } else if (points) {\n segmentLength += currentPoint.partialLength;\n pointInd += 1;\n if (pointInd >= points.length) {\n pointInd = 0;\n segmentInd += 1;\n if (!segments[segmentInd]) {\n if (mask.v.c) {\n pointInd = 0;\n segmentInd = 0;\n points = segments[segmentInd].points;\n } else {\n segmentLength -= currentPoint.partialLength;\n points = null;\n }\n } else {\n points = segments[segmentInd].points;\n }\n }\n if (points) {\n prevPoint = currentPoint;\n currentPoint = points[pointInd];\n partialLength = currentPoint.partialLength;\n }\n }\n }\n offf = letters[i].an / 2 - letters[i].add;\n matrixHelper.translate(-offf, 0, 0);\n } else {\n offf = letters[i].an / 2 - letters[i].add;\n matrixHelper.translate(-offf, 0, 0);\n\n // Grouping alignment\n matrixHelper.translate(-alignment[0] * letters[i].an * 0.005, -alignment[1] * yOff * 0.01, 0);\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n if (animatorProps.t.propType) {\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n // This condition is to prevent applying tracking to first character in each line. Might be better to use a boolean \"isNewLine\"\n if (xPos !== 0 || documentData.j !== 0) {\n if (this._hasMaskedPath) {\n if (mult.length) {\n currentLength += animatorProps.t.v * mult[0];\n } else {\n currentLength += animatorProps.t.v * mult;\n }\n } else if (mult.length) {\n xPos += animatorProps.t.v * mult[0];\n } else {\n xPos += animatorProps.t.v * mult;\n }\n }\n }\n }\n if (documentData.strokeWidthAnim) {\n sw = documentData.sw || 0;\n }\n if (documentData.strokeColorAnim) {\n if (documentData.sc) {\n sc = [documentData.sc[0], documentData.sc[1], documentData.sc[2]];\n } else {\n sc = [0, 0, 0];\n }\n }\n if (documentData.fillColorAnim && documentData.fc) {\n fc = [documentData.fc[0], documentData.fc[1], documentData.fc[2]];\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n if (animatorProps.a.propType) {\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (mult.length) {\n matrixHelper.translate(-animatorProps.a.v[0] * mult[0], -animatorProps.a.v[1] * mult[1], animatorProps.a.v[2] * mult[2]);\n } else {\n matrixHelper.translate(-animatorProps.a.v[0] * mult, -animatorProps.a.v[1] * mult, animatorProps.a.v[2] * mult);\n }\n }\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n if (animatorProps.s.propType) {\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (mult.length) {\n matrixHelper.scale(1 + (animatorProps.s.v[0] - 1) * mult[0], 1 + (animatorProps.s.v[1] - 1) * mult[1], 1);\n } else {\n matrixHelper.scale(1 + (animatorProps.s.v[0] - 1) * mult, 1 + (animatorProps.s.v[1] - 1) * mult, 1);\n }\n }\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (animatorProps.sk.propType) {\n if (mult.length) {\n matrixHelper.skewFromAxis(-animatorProps.sk.v * mult[0], animatorProps.sa.v * mult[1]);\n } else {\n matrixHelper.skewFromAxis(-animatorProps.sk.v * mult, animatorProps.sa.v * mult);\n }\n }\n if (animatorProps.r.propType) {\n if (mult.length) {\n matrixHelper.rotateZ(-animatorProps.r.v * mult[2]);\n } else {\n matrixHelper.rotateZ(-animatorProps.r.v * mult);\n }\n }\n if (animatorProps.ry.propType) {\n if (mult.length) {\n matrixHelper.rotateY(animatorProps.ry.v * mult[1]);\n } else {\n matrixHelper.rotateY(animatorProps.ry.v * mult);\n }\n }\n if (animatorProps.rx.propType) {\n if (mult.length) {\n matrixHelper.rotateX(animatorProps.rx.v * mult[0]);\n } else {\n matrixHelper.rotateX(animatorProps.rx.v * mult);\n }\n }\n if (animatorProps.o.propType) {\n if (mult.length) {\n elemOpacity += (animatorProps.o.v * mult[0] - elemOpacity) * mult[0];\n } else {\n elemOpacity += (animatorProps.o.v * mult - elemOpacity) * mult;\n }\n }\n if (documentData.strokeWidthAnim && animatorProps.sw.propType) {\n if (mult.length) {\n sw += animatorProps.sw.v * mult[0];\n } else {\n sw += animatorProps.sw.v * mult;\n }\n }\n if (documentData.strokeColorAnim && animatorProps.sc.propType) {\n for (k = 0; k < 3; k += 1) {\n if (mult.length) {\n sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult[0];\n } else {\n sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult;\n }\n }\n }\n if (documentData.fillColorAnim && documentData.fc) {\n if (animatorProps.fc.propType) {\n for (k = 0; k < 3; k += 1) {\n if (mult.length) {\n fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult[0];\n } else {\n fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult;\n }\n }\n }\n if (animatorProps.fh.propType) {\n if (mult.length) {\n fc = addHueToRGB(fc, animatorProps.fh.v * mult[0]);\n } else {\n fc = addHueToRGB(fc, animatorProps.fh.v * mult);\n }\n }\n if (animatorProps.fs.propType) {\n if (mult.length) {\n fc = addSaturationToRGB(fc, animatorProps.fs.v * mult[0]);\n } else {\n fc = addSaturationToRGB(fc, animatorProps.fs.v * mult);\n }\n }\n if (animatorProps.fb.propType) {\n if (mult.length) {\n fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult[0]);\n } else {\n fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult);\n }\n }\n }\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n if (animatorProps.p.propType) {\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (this._hasMaskedPath) {\n if (mult.length) {\n matrixHelper.translate(0, animatorProps.p.v[1] * mult[0], -animatorProps.p.v[2] * mult[1]);\n } else {\n matrixHelper.translate(0, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);\n }\n } else if (mult.length) {\n matrixHelper.translate(animatorProps.p.v[0] * mult[0], animatorProps.p.v[1] * mult[1], -animatorProps.p.v[2] * mult[2]);\n } else {\n matrixHelper.translate(animatorProps.p.v[0] * mult, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);\n }\n }\n }\n if (documentData.strokeWidthAnim) {\n letterSw = sw < 0 ? 0 : sw;\n }\n if (documentData.strokeColorAnim) {\n letterSc = 'rgb(' + Math.round(sc[0] * 255) + ',' + Math.round(sc[1] * 255) + ',' + Math.round(sc[2] * 255) + ')';\n }\n if (documentData.fillColorAnim && documentData.fc) {\n letterFc = 'rgb(' + Math.round(fc[0] * 255) + ',' + Math.round(fc[1] * 255) + ',' + Math.round(fc[2] * 255) + ')';\n }\n if (this._hasMaskedPath) {\n matrixHelper.translate(0, -documentData.ls);\n matrixHelper.translate(0, alignment[1] * yOff * 0.01 + yPos, 0);\n if (this._pathData.p.v) {\n tanAngle = (currentPoint.point[1] - prevPoint.point[1]) / (currentPoint.point[0] - prevPoint.point[0]);\n var rot = Math.atan(tanAngle) * 180 / Math.PI;\n if (currentPoint.point[0] < prevPoint.point[0]) {\n rot += 180;\n }\n matrixHelper.rotate(-rot * Math.PI / 180);\n }\n matrixHelper.translate(xPathPos, yPathPos, 0);\n currentLength -= alignment[0] * letters[i].an * 0.005;\n if (letters[i + 1] && ind !== letters[i + 1].ind) {\n currentLength += letters[i].an / 2;\n currentLength += documentData.tr * 0.001 * documentData.finalSize;\n }\n } else {\n matrixHelper.translate(xPos, yPos, 0);\n if (documentData.ps) {\n // matrixHelper.translate(documentData.ps[0],documentData.ps[1],0);\n matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);\n }\n switch (documentData.j) {\n case 1:\n matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]), 0, 0);\n break;\n case 2:\n matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]) / 2, 0, 0);\n break;\n default:\n break;\n }\n matrixHelper.translate(0, -documentData.ls);\n matrixHelper.translate(offf, 0, 0);\n matrixHelper.translate(alignment[0] * letters[i].an * 0.005, alignment[1] * yOff * 0.01, 0);\n xPos += letters[i].l + documentData.tr * 0.001 * documentData.finalSize;\n }\n if (renderType === 'html') {\n letterM = matrixHelper.toCSS();\n } else if (renderType === 'svg') {\n letterM = matrixHelper.to2dCSS();\n } else {\n letterP = [matrixHelper.props[0], matrixHelper.props[1], matrixHelper.props[2], matrixHelper.props[3], matrixHelper.props[4], matrixHelper.props[5], matrixHelper.props[6], matrixHelper.props[7], matrixHelper.props[8], matrixHelper.props[9], matrixHelper.props[10], matrixHelper.props[11], matrixHelper.props[12], matrixHelper.props[13], matrixHelper.props[14], matrixHelper.props[15]];\n }\n letterO = elemOpacity;\n }\n if (renderedLettersCount <= i) {\n letterValue = new LetterProps(letterO, letterSw, letterSc, letterFc, letterM, letterP);\n this.renderedLetters.push(letterValue);\n renderedLettersCount += 1;\n this.lettersChangedFlag = true;\n } else {\n letterValue = this.renderedLetters[i];\n this.lettersChangedFlag = letterValue.update(letterO, letterSw, letterSc, letterFc, letterM, letterP) || this.lettersChangedFlag;\n }\n }\n };\n TextAnimatorProperty.prototype.getValue = function () {\n if (this._elem.globalData.frameId === this._frameId) {\n return;\n }\n this._frameId = this._elem.globalData.frameId;\n this.iterateDynamicProperties();\n };\n TextAnimatorProperty.prototype.mHelper = new Matrix();\n TextAnimatorProperty.prototype.defaultPropsArray = [];\n extendPrototype([DynamicPropertyContainer], TextAnimatorProperty);\n\n function ITextElement() {}\n ITextElement.prototype.initElement = function (data, globalData, comp) {\n this.lettersChangedFlag = true;\n this.initFrame();\n this.initBaseData(data, globalData, comp);\n this.textProperty = new TextProperty(this, data.t, this.dynamicProperties);\n this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this);\n this.initTransform(data, globalData, comp);\n this.initHierarchy();\n this.initRenderable();\n this.initRendererElement();\n this.createContainerElements();\n this.createRenderableComponents();\n this.createContent();\n this.hide();\n this.textAnimator.searchProperties(this.dynamicProperties);\n };\n ITextElement.prototype.prepareFrame = function (num) {\n this._mdf = false;\n this.prepareRenderableFrame(num);\n this.prepareProperties(num, this.isInRange);\n };\n ITextElement.prototype.createPathShape = function (matrixHelper, shapes) {\n var j;\n var jLen = shapes.length;\n var pathNodes;\n var shapeStr = '';\n for (j = 0; j < jLen; j += 1) {\n if (shapes[j].ty === 'sh') {\n pathNodes = shapes[j].ks.k;\n shapeStr += buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper);\n }\n }\n return shapeStr;\n };\n ITextElement.prototype.updateDocumentData = function (newData, index) {\n this.textProperty.updateDocumentData(newData, index);\n };\n ITextElement.prototype.canResizeFont = function (_canResize) {\n this.textProperty.canResizeFont(_canResize);\n };\n ITextElement.prototype.setMinimumFontSize = function (_fontSize) {\n this.textProperty.setMinimumFontSize(_fontSize);\n };\n ITextElement.prototype.applyTextPropertiesToMatrix = function (documentData, matrixHelper, lineNumber, xPos, yPos) {\n if (documentData.ps) {\n matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);\n }\n matrixHelper.translate(0, -documentData.ls, 0);\n switch (documentData.j) {\n case 1:\n matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]), 0, 0);\n break;\n case 2:\n matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]) / 2, 0, 0);\n break;\n default:\n break;\n }\n matrixHelper.translate(xPos, yPos, 0);\n };\n ITextElement.prototype.buildColor = function (colorData) {\n return 'rgb(' + Math.round(colorData[0] * 255) + ',' + Math.round(colorData[1] * 255) + ',' + Math.round(colorData[2] * 255) + ')';\n };\n ITextElement.prototype.emptyProp = new LetterProps();\n ITextElement.prototype.destroy = function () {};\n ITextElement.prototype.validateText = function () {\n if (this.textProperty._mdf || this.textProperty._isFirstFrame) {\n this.buildNewText();\n this.textProperty._isFirstFrame = false;\n this.textProperty._mdf = false;\n }\n };\n\n var emptyShapeData = {\n shapes: []\n };\n function SVGTextLottieElement(data, globalData, comp) {\n this.textSpans = [];\n this.renderType = 'svg';\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], SVGTextLottieElement);\n SVGTextLottieElement.prototype.createContent = function () {\n if (this.data.singleShape && !this.globalData.fontManager.chars) {\n this.textContainer = createNS('text');\n }\n };\n SVGTextLottieElement.prototype.buildTextContents = function (textArray) {\n var i = 0;\n var len = textArray.length;\n var textContents = [];\n var currentTextContent = '';\n while (i < len) {\n if (textArray[i] === String.fromCharCode(13) || textArray[i] === String.fromCharCode(3)) {\n textContents.push(currentTextContent);\n currentTextContent = '';\n } else {\n currentTextContent += textArray[i];\n }\n i += 1;\n }\n textContents.push(currentTextContent);\n return textContents;\n };\n SVGTextLottieElement.prototype.buildShapeData = function (data, scale) {\n // data should probably be cloned to apply scale separately to each instance of a text on different layers\n // but since text internal content gets only rendered once and then it's never rerendered,\n // it's probably safe not to clone data and reuse always the same instance even if the object is mutated.\n // Avoiding cloning is preferred since cloning each character shape data is expensive\n if (data.shapes && data.shapes.length) {\n var shape = data.shapes[0];\n if (shape.it) {\n var shapeItem = shape.it[shape.it.length - 1];\n if (shapeItem.s) {\n shapeItem.s.k[0] = scale;\n shapeItem.s.k[1] = scale;\n }\n }\n }\n return data;\n };\n SVGTextLottieElement.prototype.buildNewText = function () {\n this.addDynamicProperty(this);\n var i;\n var len;\n var documentData = this.textProperty.currentData;\n this.renderedLetters = createSizedArray(documentData ? documentData.l.length : 0);\n if (documentData.fc) {\n this.layerElement.setAttribute('fill', this.buildColor(documentData.fc));\n } else {\n this.layerElement.setAttribute('fill', 'rgba(0,0,0,0)');\n }\n if (documentData.sc) {\n this.layerElement.setAttribute('stroke', this.buildColor(documentData.sc));\n this.layerElement.setAttribute('stroke-width', documentData.sw);\n }\n this.layerElement.setAttribute('font-size', documentData.finalSize);\n var fontData = this.globalData.fontManager.getFontByName(documentData.f);\n if (fontData.fClass) {\n this.layerElement.setAttribute('class', fontData.fClass);\n } else {\n this.layerElement.setAttribute('font-family', fontData.fFamily);\n var fWeight = documentData.fWeight;\n var fStyle = documentData.fStyle;\n this.layerElement.setAttribute('font-style', fStyle);\n this.layerElement.setAttribute('font-weight', fWeight);\n }\n this.layerElement.setAttribute('aria-label', documentData.t);\n var letters = documentData.l || [];\n var usesGlyphs = !!this.globalData.fontManager.chars;\n len = letters.length;\n var tSpan;\n var matrixHelper = this.mHelper;\n var shapeStr = '';\n var singleShape = this.data.singleShape;\n var xPos = 0;\n var yPos = 0;\n var firstLine = true;\n var trackingOffset = documentData.tr * 0.001 * documentData.finalSize;\n if (singleShape && !usesGlyphs && !documentData.sz) {\n var tElement = this.textContainer;\n var justify = 'start';\n switch (documentData.j) {\n case 1:\n justify = 'end';\n break;\n case 2:\n justify = 'middle';\n break;\n default:\n justify = 'start';\n break;\n }\n tElement.setAttribute('text-anchor', justify);\n tElement.setAttribute('letter-spacing', trackingOffset);\n var textContent = this.buildTextContents(documentData.finalText);\n len = textContent.length;\n yPos = documentData.ps ? documentData.ps[1] + documentData.ascent : 0;\n for (i = 0; i < len; i += 1) {\n tSpan = this.textSpans[i].span || createNS('tspan');\n tSpan.textContent = textContent[i];\n tSpan.setAttribute('x', 0);\n tSpan.setAttribute('y', yPos);\n tSpan.style.display = 'inherit';\n tElement.appendChild(tSpan);\n if (!this.textSpans[i]) {\n this.textSpans[i] = {\n span: null,\n glyph: null\n };\n }\n this.textSpans[i].span = tSpan;\n yPos += documentData.finalLineHeight;\n }\n this.layerElement.appendChild(tElement);\n } else {\n var cachedSpansLength = this.textSpans.length;\n var charData;\n for (i = 0; i < len; i += 1) {\n if (!this.textSpans[i]) {\n this.textSpans[i] = {\n span: null,\n childSpan: null,\n glyph: null\n };\n }\n if (!usesGlyphs || !singleShape || i === 0) {\n tSpan = cachedSpansLength > i ? this.textSpans[i].span : createNS(usesGlyphs ? 'g' : 'text');\n if (cachedSpansLength <= i) {\n tSpan.setAttribute('stroke-linecap', 'butt');\n tSpan.setAttribute('stroke-linejoin', 'round');\n tSpan.setAttribute('stroke-miterlimit', '4');\n this.textSpans[i].span = tSpan;\n if (usesGlyphs) {\n var childSpan = createNS('g');\n tSpan.appendChild(childSpan);\n this.textSpans[i].childSpan = childSpan;\n }\n this.textSpans[i].span = tSpan;\n this.layerElement.appendChild(tSpan);\n }\n tSpan.style.display = 'inherit';\n }\n matrixHelper.reset();\n if (singleShape) {\n if (letters[i].n) {\n xPos = -trackingOffset;\n yPos += documentData.yOffset;\n yPos += firstLine ? 1 : 0;\n firstLine = false;\n }\n this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);\n xPos += letters[i].l || 0;\n // xPos += letters[i].val === ' ' ? 0 : trackingOffset;\n xPos += trackingOffset;\n }\n if (usesGlyphs) {\n charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);\n var glyphElement;\n // t === 1 means the character has been replaced with an animated shaped\n if (charData.t === 1) {\n glyphElement = new SVGCompElement(charData.data, this.globalData, this);\n } else {\n var data = emptyShapeData;\n if (charData.data && charData.data.shapes) {\n data = this.buildShapeData(charData.data, documentData.finalSize);\n }\n glyphElement = new SVGShapeElement(data, this.globalData, this);\n }\n if (this.textSpans[i].glyph) {\n var glyph = this.textSpans[i].glyph;\n this.textSpans[i].childSpan.removeChild(glyph.layerElement);\n glyph.destroy();\n }\n this.textSpans[i].glyph = glyphElement;\n glyphElement._debug = true;\n glyphElement.prepareFrame(0);\n glyphElement.renderFrame();\n this.textSpans[i].childSpan.appendChild(glyphElement.layerElement);\n // when using animated shapes, the layer will be scaled instead of replacing the internal scale\n // this might have issues with strokes and might need a different solution\n if (charData.t === 1) {\n this.textSpans[i].childSpan.setAttribute('transform', 'scale(' + documentData.finalSize / 100 + ',' + documentData.finalSize / 100 + ')');\n }\n } else {\n if (singleShape) {\n tSpan.setAttribute('transform', 'translate(' + matrixHelper.props[12] + ',' + matrixHelper.props[13] + ')');\n }\n tSpan.textContent = letters[i].val;\n tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');\n }\n //\n }\n if (singleShape && tSpan) {\n tSpan.setAttribute('d', shapeStr);\n }\n }\n while (i < this.textSpans.length) {\n this.textSpans[i].span.style.display = 'none';\n i += 1;\n }\n this._sizeChanged = true;\n };\n SVGTextLottieElement.prototype.sourceRectAtTime = function () {\n this.prepareFrame(this.comp.renderedFrame - this.data.st);\n this.renderInnerContent();\n if (this._sizeChanged) {\n this._sizeChanged = false;\n var textBox = this.layerElement.getBBox();\n this.bbox = {\n top: textBox.y,\n left: textBox.x,\n width: textBox.width,\n height: textBox.height\n };\n }\n return this.bbox;\n };\n SVGTextLottieElement.prototype.getValue = function () {\n var i;\n var len = this.textSpans.length;\n var glyphElement;\n this.renderedFrame = this.comp.renderedFrame;\n for (i = 0; i < len; i += 1) {\n glyphElement = this.textSpans[i].glyph;\n if (glyphElement) {\n glyphElement.prepareFrame(this.comp.renderedFrame - this.data.st);\n if (glyphElement._mdf) {\n this._mdf = true;\n }\n }\n }\n };\n SVGTextLottieElement.prototype.renderInnerContent = function () {\n this.validateText();\n if (!this.data.singleShape || this._mdf) {\n this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);\n if (this.lettersChangedFlag || this.textAnimator.lettersChangedFlag) {\n this._sizeChanged = true;\n var i;\n var len;\n var renderedLetters = this.textAnimator.renderedLetters;\n var letters = this.textProperty.currentData.l;\n len = letters.length;\n var renderedLetter;\n var textSpan;\n var glyphElement;\n for (i = 0; i < len; i += 1) {\n if (!letters[i].n) {\n renderedLetter = renderedLetters[i];\n textSpan = this.textSpans[i].span;\n glyphElement = this.textSpans[i].glyph;\n if (glyphElement) {\n glyphElement.renderFrame();\n }\n if (renderedLetter._mdf.m) {\n textSpan.setAttribute('transform', renderedLetter.m);\n }\n if (renderedLetter._mdf.o) {\n textSpan.setAttribute('opacity', renderedLetter.o);\n }\n if (renderedLetter._mdf.sw) {\n textSpan.setAttribute('stroke-width', renderedLetter.sw);\n }\n if (renderedLetter._mdf.sc) {\n textSpan.setAttribute('stroke', renderedLetter.sc);\n }\n if (renderedLetter._mdf.fc) {\n textSpan.setAttribute('fill', renderedLetter.fc);\n }\n }\n }\n }\n }\n };\n\n function ISolidElement(data, globalData, comp) {\n this.initElement(data, globalData, comp);\n }\n extendPrototype([IImageElement], ISolidElement);\n ISolidElement.prototype.createContent = function () {\n var rect = createNS('rect');\n /// /rect.style.width = this.data.sw;\n /// /rect.style.height = this.data.sh;\n /// /rect.style.fill = this.data.sc;\n rect.setAttribute('width', this.data.sw);\n rect.setAttribute('height', this.data.sh);\n rect.setAttribute('fill', this.data.sc);\n this.layerElement.appendChild(rect);\n };\n\n function NullElement(data, globalData, comp) {\n this.initFrame();\n this.initBaseData(data, globalData, comp);\n this.initFrame();\n this.initTransform(data, globalData, comp);\n this.initHierarchy();\n }\n NullElement.prototype.prepareFrame = function (num) {\n this.prepareProperties(num, true);\n };\n NullElement.prototype.renderFrame = function () {};\n NullElement.prototype.getBaseElement = function () {\n return null;\n };\n NullElement.prototype.destroy = function () {};\n NullElement.prototype.sourceRectAtTime = function () {};\n NullElement.prototype.hide = function () {};\n extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement], NullElement);\n\n function SVGRendererBase() {}\n extendPrototype([BaseRenderer], SVGRendererBase);\n SVGRendererBase.prototype.createNull = function (data) {\n return new NullElement(data, this.globalData, this);\n };\n SVGRendererBase.prototype.createShape = function (data) {\n return new SVGShapeElement(data, this.globalData, this);\n };\n SVGRendererBase.prototype.createText = function (data) {\n return new SVGTextLottieElement(data, this.globalData, this);\n };\n SVGRendererBase.prototype.createImage = function (data) {\n return new IImageElement(data, this.globalData, this);\n };\n SVGRendererBase.prototype.createSolid = function (data) {\n return new ISolidElement(data, this.globalData, this);\n };\n SVGRendererBase.prototype.configAnimation = function (animData) {\n this.svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg');\n this.svgElement.setAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');\n if (this.renderConfig.viewBoxSize) {\n this.svgElement.setAttribute('viewBox', this.renderConfig.viewBoxSize);\n } else {\n this.svgElement.setAttribute('viewBox', '0 0 ' + animData.w + ' ' + animData.h);\n }\n if (!this.renderConfig.viewBoxOnly) {\n this.svgElement.setAttribute('width', animData.w);\n this.svgElement.setAttribute('height', animData.h);\n this.svgElement.style.width = '100%';\n this.svgElement.style.height = '100%';\n this.svgElement.style.transform = 'translate3d(0,0,0)';\n this.svgElement.style.contentVisibility = this.renderConfig.contentVisibility;\n }\n if (this.renderConfig.width) {\n this.svgElement.setAttribute('width', this.renderConfig.width);\n }\n if (this.renderConfig.height) {\n this.svgElement.setAttribute('height', this.renderConfig.height);\n }\n if (this.renderConfig.className) {\n this.svgElement.setAttribute('class', this.renderConfig.className);\n }\n if (this.renderConfig.id) {\n this.svgElement.setAttribute('id', this.renderConfig.id);\n }\n if (this.renderConfig.focusable !== undefined) {\n this.svgElement.setAttribute('focusable', this.renderConfig.focusable);\n }\n this.svgElement.setAttribute('preserveAspectRatio', this.renderConfig.preserveAspectRatio);\n // this.layerElement.style.transform = 'translate3d(0,0,0)';\n // this.layerElement.style.transformOrigin = this.layerElement.style.mozTransformOrigin = this.layerElement.style.webkitTransformOrigin = this.layerElement.style['-webkit-transform'] = \"0px 0px 0px\";\n this.animationItem.wrapper.appendChild(this.svgElement);\n // Mask animation\n var defs = this.globalData.defs;\n this.setupGlobalData(animData, defs);\n this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;\n this.data = animData;\n var maskElement = createNS('clipPath');\n var rect = createNS('rect');\n rect.setAttribute('width', animData.w);\n rect.setAttribute('height', animData.h);\n rect.setAttribute('x', 0);\n rect.setAttribute('y', 0);\n var maskId = createElementID();\n maskElement.setAttribute('id', maskId);\n maskElement.appendChild(rect);\n this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + maskId + ')');\n defs.appendChild(maskElement);\n this.layers = animData.layers;\n this.elements = createSizedArray(animData.layers.length);\n };\n SVGRendererBase.prototype.destroy = function () {\n if (this.animationItem.wrapper) {\n this.animationItem.wrapper.innerText = '';\n }\n this.layerElement = null;\n this.globalData.defs = null;\n var i;\n var len = this.layers ? this.layers.length : 0;\n for (i = 0; i < len; i += 1) {\n if (this.elements[i] && this.elements[i].destroy) {\n this.elements[i].destroy();\n }\n }\n this.elements.length = 0;\n this.destroyed = true;\n this.animationItem = null;\n };\n SVGRendererBase.prototype.updateContainerSize = function () {};\n SVGRendererBase.prototype.findIndexByInd = function (ind) {\n var i = 0;\n var len = this.layers.length;\n for (i = 0; i < len; i += 1) {\n if (this.layers[i].ind === ind) {\n return i;\n }\n }\n return -1;\n };\n SVGRendererBase.prototype.buildItem = function (pos) {\n var elements = this.elements;\n if (elements[pos] || this.layers[pos].ty === 99) {\n return;\n }\n elements[pos] = true;\n var element = this.createItem(this.layers[pos]);\n elements[pos] = element;\n if (getExpressionsPlugin()) {\n if (this.layers[pos].ty === 0) {\n this.globalData.projectInterface.registerComposition(element);\n }\n element.initExpressions();\n }\n this.appendElementInPos(element, pos);\n if (this.layers[pos].tt) {\n var elementIndex = 'tp' in this.layers[pos] ? this.findIndexByInd(this.layers[pos].tp) : pos - 1;\n if (elementIndex === -1) {\n return;\n }\n if (!this.elements[elementIndex] || this.elements[elementIndex] === true) {\n this.buildItem(elementIndex);\n this.addPendingElement(element);\n } else {\n var matteElement = elements[elementIndex];\n var matteMask = matteElement.getMatte(this.layers[pos].tt);\n element.setMatte(matteMask);\n }\n }\n };\n SVGRendererBase.prototype.checkPendingElements = function () {\n while (this.pendingElements.length) {\n var element = this.pendingElements.pop();\n element.checkParenting();\n if (element.data.tt) {\n var i = 0;\n var len = this.elements.length;\n while (i < len) {\n if (this.elements[i] === element) {\n var elementIndex = 'tp' in element.data ? this.findIndexByInd(element.data.tp) : i - 1;\n var matteElement = this.elements[elementIndex];\n var matteMask = matteElement.getMatte(this.layers[i].tt);\n element.setMatte(matteMask);\n break;\n }\n i += 1;\n }\n }\n }\n };\n SVGRendererBase.prototype.renderFrame = function (num) {\n if (this.renderedFrame === num || this.destroyed) {\n return;\n }\n if (num === null) {\n num = this.renderedFrame;\n } else {\n this.renderedFrame = num;\n }\n // console.log('-------');\n // console.log('FRAME ',num);\n this.globalData.frameNum = num;\n this.globalData.frameId += 1;\n this.globalData.projectInterface.currentFrame = num;\n this.globalData._mdf = false;\n var i;\n var len = this.layers.length;\n if (!this.completeLayers) {\n this.checkLayers(num);\n }\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].prepareFrame(num - this.layers[i].st);\n }\n }\n if (this.globalData._mdf) {\n for (i = 0; i < len; i += 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame();\n }\n }\n }\n };\n SVGRendererBase.prototype.appendElementInPos = function (element, pos) {\n var newElement = element.getBaseElement();\n if (!newElement) {\n return;\n }\n var i = 0;\n var nextElement;\n while (i < pos) {\n if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement()) {\n nextElement = this.elements[i].getBaseElement();\n }\n i += 1;\n }\n if (nextElement) {\n this.layerElement.insertBefore(newElement, nextElement);\n } else {\n this.layerElement.appendChild(newElement);\n }\n };\n SVGRendererBase.prototype.hide = function () {\n this.layerElement.style.display = 'none';\n };\n SVGRendererBase.prototype.show = function () {\n this.layerElement.style.display = 'block';\n };\n\n function ICompElement() {}\n extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement], ICompElement);\n ICompElement.prototype.initElement = function (data, globalData, comp) {\n this.initFrame();\n this.initBaseData(data, globalData, comp);\n this.initTransform(data, globalData, comp);\n this.initRenderable();\n this.initHierarchy();\n this.initRendererElement();\n this.createContainerElements();\n this.createRenderableComponents();\n if (this.data.xt || !globalData.progressiveLoad) {\n this.buildAllItems();\n }\n this.hide();\n };\n\n /* ICompElement.prototype.hide = function(){\n if(!this.hidden){\n this.hideElement();\n var i,len = this.elements.length;\n for( i = 0; i < len; i+=1 ){\n if(this.elements[i]){\n this.elements[i].hide();\n }\n }\n }\n }; */\n\n ICompElement.prototype.prepareFrame = function (num) {\n this._mdf = false;\n this.prepareRenderableFrame(num);\n this.prepareProperties(num, this.isInRange);\n if (!this.isInRange && !this.data.xt) {\n return;\n }\n if (!this.tm._placeholder) {\n var timeRemapped = this.tm.v;\n if (timeRemapped === this.data.op) {\n timeRemapped = this.data.op - 1;\n }\n this.renderedFrame = timeRemapped;\n } else {\n this.renderedFrame = num / this.data.sr;\n }\n var i;\n var len = this.elements.length;\n if (!this.completeLayers) {\n this.checkLayers(this.renderedFrame);\n }\n // This iteration needs to be backwards because of how expressions connect between each other\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st);\n if (this.elements[i]._mdf) {\n this._mdf = true;\n }\n }\n }\n };\n ICompElement.prototype.renderInnerContent = function () {\n var i;\n var len = this.layers.length;\n for (i = 0; i < len; i += 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame();\n }\n }\n };\n ICompElement.prototype.setElements = function (elems) {\n this.elements = elems;\n };\n ICompElement.prototype.getElements = function () {\n return this.elements;\n };\n ICompElement.prototype.destroyElements = function () {\n var i;\n var len = this.layers.length;\n for (i = 0; i < len; i += 1) {\n if (this.elements[i]) {\n this.elements[i].destroy();\n }\n }\n };\n ICompElement.prototype.destroy = function () {\n this.destroyElements();\n this.destroyBaseElement();\n };\n\n function SVGCompElement(data, globalData, comp) {\n this.layers = data.layers;\n this.supports3d = true;\n this.completeLayers = false;\n this.pendingElements = [];\n this.elements = this.layers ? createSizedArray(this.layers.length) : [];\n this.initElement(data, globalData, comp);\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {\n _placeholder: true\n };\n }\n extendPrototype([SVGRendererBase, ICompElement, SVGBaseElement], SVGCompElement);\n SVGCompElement.prototype.createComp = function (data) {\n return new SVGCompElement(data, this.globalData, this);\n };\n\n function SVGRenderer(animationItem, config) {\n this.animationItem = animationItem;\n this.layers = null;\n this.renderedFrame = -1;\n this.svgElement = createNS('svg');\n var ariaLabel = '';\n if (config && config.title) {\n var titleElement = createNS('title');\n var titleId = createElementID();\n titleElement.setAttribute('id', titleId);\n titleElement.textContent = config.title;\n this.svgElement.appendChild(titleElement);\n ariaLabel += titleId;\n }\n if (config && config.description) {\n var descElement = createNS('desc');\n var descId = createElementID();\n descElement.setAttribute('id', descId);\n descElement.textContent = config.description;\n this.svgElement.appendChild(descElement);\n ariaLabel += ' ' + descId;\n }\n if (ariaLabel) {\n this.svgElement.setAttribute('aria-labelledby', ariaLabel);\n }\n var defs = createNS('defs');\n this.svgElement.appendChild(defs);\n var maskElement = createNS('g');\n this.svgElement.appendChild(maskElement);\n this.layerElement = maskElement;\n this.renderConfig = {\n preserveAspectRatio: config && config.preserveAspectRatio || 'xMidYMid meet',\n imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice',\n contentVisibility: config && config.contentVisibility || 'visible',\n progressiveLoad: config && config.progressiveLoad || false,\n hideOnTransparent: !(config && config.hideOnTransparent === false),\n viewBoxOnly: config && config.viewBoxOnly || false,\n viewBoxSize: config && config.viewBoxSize || false,\n className: config && config.className || '',\n id: config && config.id || '',\n focusable: config && config.focusable,\n filterSize: {\n width: config && config.filterSize && config.filterSize.width || '100%',\n height: config && config.filterSize && config.filterSize.height || '100%',\n x: config && config.filterSize && config.filterSize.x || '0%',\n y: config && config.filterSize && config.filterSize.y || '0%'\n },\n width: config && config.width,\n height: config && config.height,\n runExpressions: !config || config.runExpressions === undefined || config.runExpressions\n };\n this.globalData = {\n _mdf: false,\n frameNum: -1,\n defs: defs,\n renderConfig: this.renderConfig\n };\n this.elements = [];\n this.pendingElements = [];\n this.destroyed = false;\n this.rendererType = 'svg';\n }\n extendPrototype([SVGRendererBase], SVGRenderer);\n SVGRenderer.prototype.createComp = function (data) {\n return new SVGCompElement(data, this.globalData, this);\n };\n\n function ShapeTransformManager() {\n this.sequences = {};\n this.sequenceList = [];\n this.transform_key_count = 0;\n }\n ShapeTransformManager.prototype = {\n addTransformSequence: function addTransformSequence(transforms) {\n var i;\n var len = transforms.length;\n var key = '_';\n for (i = 0; i < len; i += 1) {\n key += transforms[i].transform.key + '_';\n }\n var sequence = this.sequences[key];\n if (!sequence) {\n sequence = {\n transforms: [].concat(transforms),\n finalTransform: new Matrix(),\n _mdf: false\n };\n this.sequences[key] = sequence;\n this.sequenceList.push(sequence);\n }\n return sequence;\n },\n processSequence: function processSequence(sequence, isFirstFrame) {\n var i = 0;\n var len = sequence.transforms.length;\n var _mdf = isFirstFrame;\n while (i < len && !isFirstFrame) {\n if (sequence.transforms[i].transform.mProps._mdf) {\n _mdf = true;\n break;\n }\n i += 1;\n }\n if (_mdf) {\n sequence.finalTransform.reset();\n for (i = len - 1; i >= 0; i -= 1) {\n sequence.finalTransform.multiply(sequence.transforms[i].transform.mProps.v);\n }\n }\n sequence._mdf = _mdf;\n },\n processSequences: function processSequences(isFirstFrame) {\n var i;\n var len = this.sequenceList.length;\n for (i = 0; i < len; i += 1) {\n this.processSequence(this.sequenceList[i], isFirstFrame);\n }\n },\n getNewKey: function getNewKey() {\n this.transform_key_count += 1;\n return '_' + this.transform_key_count;\n }\n };\n\n var lumaLoader = function lumaLoader() {\n var id = '__lottie_element_luma_buffer';\n var lumaBuffer = null;\n var lumaBufferCtx = null;\n var svg = null;\n\n // This alternate solution has a slight delay before the filter is applied, resulting in a flicker on the first frame.\n // Keeping this here for reference, and in the future, if offscreen canvas supports url filters, this can be used.\n // For now, neither of them work for offscreen canvas, so canvas workers can't support the luma track matte mask.\n // Naming it solution 2 to mark the extra comment lines.\n /*\n var svgString = [\n '',\n '',\n '',\n '',\n '',\n ].join('');\n var blob = new Blob([svgString], { type: 'image/svg+xml' });\n var url = URL.createObjectURL(blob);\n */\n\n function createLumaSvgFilter() {\n var _svg = createNS('svg');\n var fil = createNS('filter');\n var matrix = createNS('feColorMatrix');\n fil.setAttribute('id', id);\n matrix.setAttribute('type', 'matrix');\n matrix.setAttribute('color-interpolation-filters', 'sRGB');\n matrix.setAttribute('values', '0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0');\n fil.appendChild(matrix);\n _svg.appendChild(fil);\n _svg.setAttribute('id', id + '_svg');\n if (featureSupport.svgLumaHidden) {\n _svg.style.display = 'none';\n }\n return _svg;\n }\n function loadLuma() {\n if (!lumaBuffer) {\n svg = createLumaSvgFilter();\n document.body.appendChild(svg);\n lumaBuffer = createTag('canvas');\n lumaBufferCtx = lumaBuffer.getContext('2d');\n // lumaBufferCtx.filter = `url('${url}#__lottie_element_luma_buffer')`; // part of solution 2\n lumaBufferCtx.filter = 'url(#' + id + ')';\n lumaBufferCtx.fillStyle = 'rgba(0,0,0,0)';\n lumaBufferCtx.fillRect(0, 0, 1, 1);\n }\n }\n function getLuma(canvas) {\n if (!lumaBuffer) {\n loadLuma();\n }\n lumaBuffer.width = canvas.width;\n lumaBuffer.height = canvas.height;\n // lumaBufferCtx.filter = `url('${url}#__lottie_element_luma_buffer')`; // part of solution 2\n lumaBufferCtx.filter = 'url(#' + id + ')';\n return lumaBuffer;\n }\n return {\n load: loadLuma,\n get: getLuma\n };\n };\n function createCanvas(width, height) {\n if (featureSupport.offscreenCanvas) {\n return new OffscreenCanvas(width, height);\n }\n var canvas = createTag('canvas');\n canvas.width = width;\n canvas.height = height;\n return canvas;\n }\n var assetLoader = function () {\n return {\n loadLumaCanvas: lumaLoader.load,\n getLumaCanvas: lumaLoader.get,\n createCanvas: createCanvas\n };\n }();\n\n var registeredEffects = {};\n function CVEffects(elem) {\n var i;\n var len = elem.data.ef ? elem.data.ef.length : 0;\n this.filters = [];\n var filterManager;\n for (i = 0; i < len; i += 1) {\n filterManager = null;\n var type = elem.data.ef[i].ty;\n if (registeredEffects[type]) {\n var Effect = registeredEffects[type].effect;\n filterManager = new Effect(elem.effectsManager.effectElements[i], elem);\n }\n if (filterManager) {\n this.filters.push(filterManager);\n }\n }\n if (this.filters.length) {\n elem.addRenderableComponent(this);\n }\n }\n CVEffects.prototype.renderFrame = function (_isFirstFrame) {\n var i;\n var len = this.filters.length;\n for (i = 0; i < len; i += 1) {\n this.filters[i].renderFrame(_isFirstFrame);\n }\n };\n CVEffects.prototype.getEffects = function (type) {\n var i;\n var len = this.filters.length;\n var effects = [];\n for (i = 0; i < len; i += 1) {\n if (this.filters[i].type === type) {\n effects.push(this.filters[i]);\n }\n }\n return effects;\n };\n function registerEffect(id, effect) {\n registeredEffects[id] = {\n effect: effect\n };\n }\n\n function CVMaskElement(data, element) {\n this.data = data;\n this.element = element;\n this.masksProperties = this.data.masksProperties || [];\n this.viewData = createSizedArray(this.masksProperties.length);\n var i;\n var len = this.masksProperties.length;\n var hasMasks = false;\n for (i = 0; i < len; i += 1) {\n if (this.masksProperties[i].mode !== 'n') {\n hasMasks = true;\n }\n this.viewData[i] = ShapePropertyFactory.getShapeProp(this.element, this.masksProperties[i], 3);\n }\n this.hasMasks = hasMasks;\n if (hasMasks) {\n this.element.addRenderableComponent(this);\n }\n }\n CVMaskElement.prototype.renderFrame = function () {\n if (!this.hasMasks) {\n return;\n }\n var transform = this.element.finalTransform.mat;\n var ctx = this.element.canvasContext;\n var i;\n var len = this.masksProperties.length;\n var pt;\n var pts;\n var data;\n ctx.beginPath();\n for (i = 0; i < len; i += 1) {\n if (this.masksProperties[i].mode !== 'n') {\n if (this.masksProperties[i].inv) {\n ctx.moveTo(0, 0);\n ctx.lineTo(this.element.globalData.compSize.w, 0);\n ctx.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h);\n ctx.lineTo(0, this.element.globalData.compSize.h);\n ctx.lineTo(0, 0);\n }\n data = this.viewData[i].v;\n pt = transform.applyToPointArray(data.v[0][0], data.v[0][1], 0);\n ctx.moveTo(pt[0], pt[1]);\n var j;\n var jLen = data._length;\n for (j = 1; j < jLen; j += 1) {\n pts = transform.applyToTriplePoints(data.o[j - 1], data.i[j], data.v[j]);\n ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);\n }\n pts = transform.applyToTriplePoints(data.o[j - 1], data.i[0], data.v[0]);\n ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);\n }\n }\n this.element.globalData.renderer.save(true);\n ctx.clip();\n };\n CVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty;\n CVMaskElement.prototype.destroy = function () {\n this.element = null;\n };\n\n function CVBaseElement() {}\n var operationsMap = {\n 1: 'source-in',\n 2: 'source-out',\n 3: 'source-in',\n 4: 'source-out'\n };\n CVBaseElement.prototype = {\n createElements: function createElements() {},\n initRendererElement: function initRendererElement() {},\n createContainerElements: function createContainerElements() {\n // If the layer is masked we will use two buffers to store each different states of the drawing\n // This solution is not ideal for several reason. But unfortunately, because of the recursive\n // nature of the render tree, it's the only simple way to make sure one inner mask doesn't override an outer mask.\n // TODO: try to reduce the size of these buffers to the size of the composition contaning the layer\n // It might be challenging because the layer most likely is transformed in some way\n if (this.data.tt >= 1) {\n this.buffers = [];\n var canvasContext = this.globalData.canvasContext;\n var bufferCanvas = assetLoader.createCanvas(canvasContext.canvas.width, canvasContext.canvas.height);\n this.buffers.push(bufferCanvas);\n var bufferCanvas2 = assetLoader.createCanvas(canvasContext.canvas.width, canvasContext.canvas.height);\n this.buffers.push(bufferCanvas2);\n if (this.data.tt >= 3 && !document._isProxy) {\n assetLoader.loadLumaCanvas();\n }\n }\n this.canvasContext = this.globalData.canvasContext;\n this.transformCanvas = this.globalData.transformCanvas;\n this.renderableEffectsManager = new CVEffects(this);\n this.searchEffectTransforms();\n },\n createContent: function createContent() {},\n setBlendMode: function setBlendMode() {\n var globalData = this.globalData;\n if (globalData.blendMode !== this.data.bm) {\n globalData.blendMode = this.data.bm;\n var blendModeValue = getBlendMode(this.data.bm);\n globalData.canvasContext.globalCompositeOperation = blendModeValue;\n }\n },\n createRenderableComponents: function createRenderableComponents() {\n this.maskManager = new CVMaskElement(this.data, this);\n this.transformEffects = this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT);\n },\n hideElement: function hideElement() {\n if (!this.hidden && (!this.isInRange || this.isTransparent)) {\n this.hidden = true;\n }\n },\n showElement: function showElement() {\n if (this.isInRange && !this.isTransparent) {\n this.hidden = false;\n this._isFirstFrame = true;\n this.maskManager._isFirstFrame = true;\n }\n },\n clearCanvas: function clearCanvas(canvasContext) {\n canvasContext.clearRect(this.transformCanvas.tx, this.transformCanvas.ty, this.transformCanvas.w * this.transformCanvas.sx, this.transformCanvas.h * this.transformCanvas.sy);\n },\n prepareLayer: function prepareLayer() {\n if (this.data.tt >= 1) {\n var buffer = this.buffers[0];\n var bufferCtx = buffer.getContext('2d');\n this.clearCanvas(bufferCtx);\n // on the first buffer we store the current state of the global drawing\n bufferCtx.drawImage(this.canvasContext.canvas, 0, 0);\n // The next four lines are to clear the canvas\n // TODO: Check if there is a way to clear the canvas without resetting the transform\n this.currentTransform = this.canvasContext.getTransform();\n this.canvasContext.setTransform(1, 0, 0, 1, 0, 0);\n this.clearCanvas(this.canvasContext);\n this.canvasContext.setTransform(this.currentTransform);\n }\n },\n exitLayer: function exitLayer() {\n if (this.data.tt >= 1) {\n var buffer = this.buffers[1];\n // On the second buffer we store the current state of the global drawing\n // that only contains the content of this layer\n // (if it is a composition, it also includes the nested layers)\n var bufferCtx = buffer.getContext('2d');\n this.clearCanvas(bufferCtx);\n bufferCtx.drawImage(this.canvasContext.canvas, 0, 0);\n // We clear the canvas again\n this.canvasContext.setTransform(1, 0, 0, 1, 0, 0);\n this.clearCanvas(this.canvasContext);\n this.canvasContext.setTransform(this.currentTransform);\n // We draw the mask\n var mask = this.comp.getElementById('tp' in this.data ? this.data.tp : this.data.ind - 1);\n mask.renderFrame(true);\n // We draw the second buffer (that contains the content of this layer)\n this.canvasContext.setTransform(1, 0, 0, 1, 0, 0);\n\n // If the mask is a Luma matte, we need to do two extra painting operations\n // the _isProxy check is to avoid drawing a fake canvas in workers that will throw an error\n if (this.data.tt >= 3 && !document._isProxy) {\n // We copy the painted mask to a buffer that has a color matrix filter applied to it\n // that applies the rgb values to the alpha channel\n var lumaBuffer = assetLoader.getLumaCanvas(this.canvasContext.canvas);\n var lumaBufferCtx = lumaBuffer.getContext('2d');\n lumaBufferCtx.drawImage(this.canvasContext.canvas, 0, 0);\n this.clearCanvas(this.canvasContext);\n // we repaint the context with the mask applied to it\n this.canvasContext.drawImage(lumaBuffer, 0, 0);\n }\n this.canvasContext.globalCompositeOperation = operationsMap[this.data.tt];\n this.canvasContext.drawImage(buffer, 0, 0);\n // We finally draw the first buffer (that contains the content of the global drawing)\n // We use destination-over to draw the global drawing below the current layer\n this.canvasContext.globalCompositeOperation = 'destination-over';\n this.canvasContext.drawImage(this.buffers[0], 0, 0);\n this.canvasContext.setTransform(this.currentTransform);\n // We reset the globalCompositeOperation to source-over, the standard type of operation\n this.canvasContext.globalCompositeOperation = 'source-over';\n }\n },\n renderFrame: function renderFrame(forceRender) {\n if (this.hidden || this.data.hd) {\n return;\n }\n if (this.data.td === 1 && !forceRender) {\n return;\n }\n this.renderTransform();\n this.renderRenderable();\n this.renderLocalTransform();\n this.setBlendMode();\n var forceRealStack = this.data.ty === 0;\n this.prepareLayer();\n this.globalData.renderer.save(forceRealStack);\n this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props);\n this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity);\n this.renderInnerContent();\n this.globalData.renderer.restore(forceRealStack);\n this.exitLayer();\n if (this.maskManager.hasMasks) {\n this.globalData.renderer.restore(true);\n }\n if (this._isFirstFrame) {\n this._isFirstFrame = false;\n }\n },\n destroy: function destroy() {\n this.canvasContext = null;\n this.data = null;\n this.globalData = null;\n this.maskManager.destroy();\n },\n mHelper: new Matrix()\n };\n CVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement;\n CVBaseElement.prototype.show = CVBaseElement.prototype.showElement;\n\n function CVShapeData(element, data, styles, transformsManager) {\n this.styledShapes = [];\n this.tr = [0, 0, 0, 0, 0, 0];\n var ty = 4;\n if (data.ty === 'rc') {\n ty = 5;\n } else if (data.ty === 'el') {\n ty = 6;\n } else if (data.ty === 'sr') {\n ty = 7;\n }\n this.sh = ShapePropertyFactory.getShapeProp(element, data, ty, element);\n var i;\n var len = styles.length;\n var styledShape;\n for (i = 0; i < len; i += 1) {\n if (!styles[i].closed) {\n styledShape = {\n transforms: transformsManager.addTransformSequence(styles[i].transforms),\n trNodes: []\n };\n this.styledShapes.push(styledShape);\n styles[i].elements.push(styledShape);\n }\n }\n }\n CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated;\n\n function CVShapeElement(data, globalData, comp) {\n this.shapes = [];\n this.shapesData = data.shapes;\n this.stylesList = [];\n this.itemsData = [];\n this.prevViewData = [];\n this.shapeModifiers = [];\n this.processedElements = [];\n this.transformsManager = new ShapeTransformManager();\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, CVBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableElement], CVShapeElement);\n CVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement;\n CVShapeElement.prototype.transformHelper = {\n opacity: 1,\n _opMdf: false\n };\n CVShapeElement.prototype.dashResetter = [];\n CVShapeElement.prototype.createContent = function () {\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);\n };\n CVShapeElement.prototype.createStyleElement = function (data, transforms) {\n var styleElem = {\n data: data,\n type: data.ty,\n preTransforms: this.transformsManager.addTransformSequence(transforms),\n transforms: [],\n elements: [],\n closed: data.hd === true\n };\n var elementData = {};\n if (data.ty === 'fl' || data.ty === 'st') {\n elementData.c = PropertyFactory.getProp(this, data.c, 1, 255, this);\n if (!elementData.c.k) {\n styleElem.co = 'rgb(' + bmFloor(elementData.c.v[0]) + ',' + bmFloor(elementData.c.v[1]) + ',' + bmFloor(elementData.c.v[2]) + ')';\n }\n } else if (data.ty === 'gf' || data.ty === 'gs') {\n elementData.s = PropertyFactory.getProp(this, data.s, 1, null, this);\n elementData.e = PropertyFactory.getProp(this, data.e, 1, null, this);\n elementData.h = PropertyFactory.getProp(this, data.h || {\n k: 0\n }, 0, 0.01, this);\n elementData.a = PropertyFactory.getProp(this, data.a || {\n k: 0\n }, 0, degToRads, this);\n elementData.g = new GradientProperty(this, data.g, this);\n }\n elementData.o = PropertyFactory.getProp(this, data.o, 0, 0.01, this);\n if (data.ty === 'st' || data.ty === 'gs') {\n styleElem.lc = lineCapEnum[data.lc || 2];\n styleElem.lj = lineJoinEnum[data.lj || 2];\n if (data.lj == 1) {\n // eslint-disable-line eqeqeq\n styleElem.ml = data.ml;\n }\n elementData.w = PropertyFactory.getProp(this, data.w, 0, null, this);\n if (!elementData.w.k) {\n styleElem.wi = elementData.w.v;\n }\n if (data.d) {\n var d = new DashProperty(this, data.d, 'canvas', this);\n elementData.d = d;\n if (!elementData.d.k) {\n styleElem.da = elementData.d.dashArray;\n styleElem[\"do\"] = elementData.d.dashoffset[0];\n }\n }\n } else {\n styleElem.r = data.r === 2 ? 'evenodd' : 'nonzero';\n }\n this.stylesList.push(styleElem);\n elementData.style = styleElem;\n return elementData;\n };\n CVShapeElement.prototype.createGroupElement = function () {\n var elementData = {\n it: [],\n prevViewData: []\n };\n return elementData;\n };\n CVShapeElement.prototype.createTransformElement = function (data) {\n var elementData = {\n transform: {\n opacity: 1,\n _opMdf: false,\n key: this.transformsManager.getNewKey(),\n op: PropertyFactory.getProp(this, data.o, 0, 0.01, this),\n mProps: TransformPropertyFactory.getTransformProperty(this, data, this)\n }\n };\n return elementData;\n };\n CVShapeElement.prototype.createShapeElement = function (data) {\n var elementData = new CVShapeData(this, data, this.stylesList, this.transformsManager);\n this.shapes.push(elementData);\n this.addShapeToModifiers(elementData);\n return elementData;\n };\n CVShapeElement.prototype.reloadShapes = function () {\n this._isFirstFrame = true;\n var i;\n var len = this.itemsData.length;\n for (i = 0; i < len; i += 1) {\n this.prevViewData[i] = this.itemsData[i];\n }\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);\n len = this.dynamicProperties.length;\n for (i = 0; i < len; i += 1) {\n this.dynamicProperties[i].getValue();\n }\n this.renderModifiers();\n this.transformsManager.processSequences(this._isFirstFrame);\n };\n CVShapeElement.prototype.addTransformToStyleList = function (transform) {\n var i;\n var len = this.stylesList.length;\n for (i = 0; i < len; i += 1) {\n if (!this.stylesList[i].closed) {\n this.stylesList[i].transforms.push(transform);\n }\n }\n };\n CVShapeElement.prototype.removeTransformFromStyleList = function () {\n var i;\n var len = this.stylesList.length;\n for (i = 0; i < len; i += 1) {\n if (!this.stylesList[i].closed) {\n this.stylesList[i].transforms.pop();\n }\n }\n };\n CVShapeElement.prototype.closeStyles = function (styles) {\n var i;\n var len = styles.length;\n for (i = 0; i < len; i += 1) {\n styles[i].closed = true;\n }\n };\n CVShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, shouldRender, transforms) {\n var i;\n var len = arr.length - 1;\n var j;\n var jLen;\n var ownStyles = [];\n var ownModifiers = [];\n var processedPos;\n var modifier;\n var currentTransform;\n var ownTransforms = [].concat(transforms);\n for (i = len; i >= 0; i -= 1) {\n processedPos = this.searchProcessedElement(arr[i]);\n if (!processedPos) {\n arr[i]._shouldRender = shouldRender;\n } else {\n itemsData[i] = prevViewData[processedPos - 1];\n }\n if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs') {\n if (!processedPos) {\n itemsData[i] = this.createStyleElement(arr[i], ownTransforms);\n } else {\n itemsData[i].style.closed = false;\n }\n ownStyles.push(itemsData[i].style);\n } else if (arr[i].ty === 'gr') {\n if (!processedPos) {\n itemsData[i] = this.createGroupElement(arr[i]);\n } else {\n jLen = itemsData[i].it.length;\n for (j = 0; j < jLen; j += 1) {\n itemsData[i].prevViewData[j] = itemsData[i].it[j];\n }\n }\n this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, shouldRender, ownTransforms);\n } else if (arr[i].ty === 'tr') {\n if (!processedPos) {\n currentTransform = this.createTransformElement(arr[i]);\n itemsData[i] = currentTransform;\n }\n ownTransforms.push(itemsData[i]);\n this.addTransformToStyleList(itemsData[i]);\n } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {\n if (!processedPos) {\n itemsData[i] = this.createShapeElement(arr[i]);\n }\n } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'pb' || arr[i].ty === 'zz' || arr[i].ty === 'op') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty);\n modifier.init(this, arr[i]);\n itemsData[i] = modifier;\n this.shapeModifiers.push(modifier);\n } else {\n modifier = itemsData[i];\n modifier.closed = false;\n }\n ownModifiers.push(modifier);\n } else if (arr[i].ty === 'rp') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty);\n itemsData[i] = modifier;\n modifier.init(this, arr, i, itemsData);\n this.shapeModifiers.push(modifier);\n shouldRender = false;\n } else {\n modifier = itemsData[i];\n modifier.closed = true;\n }\n ownModifiers.push(modifier);\n }\n this.addProcessedElement(arr[i], i + 1);\n }\n this.removeTransformFromStyleList();\n this.closeStyles(ownStyles);\n len = ownModifiers.length;\n for (i = 0; i < len; i += 1) {\n ownModifiers[i].closed = true;\n }\n };\n CVShapeElement.prototype.renderInnerContent = function () {\n this.transformHelper.opacity = 1;\n this.transformHelper._opMdf = false;\n this.renderModifiers();\n this.transformsManager.processSequences(this._isFirstFrame);\n this.renderShape(this.transformHelper, this.shapesData, this.itemsData, true);\n };\n CVShapeElement.prototype.renderShapeTransform = function (parentTransform, groupTransform) {\n if (parentTransform._opMdf || groupTransform.op._mdf || this._isFirstFrame) {\n groupTransform.opacity = parentTransform.opacity;\n groupTransform.opacity *= groupTransform.op.v;\n groupTransform._opMdf = true;\n }\n };\n CVShapeElement.prototype.drawLayer = function () {\n var i;\n var len = this.stylesList.length;\n var j;\n var jLen;\n var k;\n var kLen;\n var elems;\n var nodes;\n var renderer = this.globalData.renderer;\n var ctx = this.globalData.canvasContext;\n var type;\n var currentStyle;\n for (i = 0; i < len; i += 1) {\n currentStyle = this.stylesList[i];\n type = currentStyle.type;\n\n // Skipping style when\n // Stroke width equals 0\n // style should not be rendered (extra unused repeaters)\n // current opacity equals 0\n // global opacity equals 0\n if (!((type === 'st' || type === 'gs') && currentStyle.wi === 0 || !currentStyle.data._shouldRender || currentStyle.coOp === 0 || this.globalData.currentGlobalAlpha === 0)) {\n renderer.save();\n elems = currentStyle.elements;\n if (type === 'st' || type === 'gs') {\n renderer.ctxStrokeStyle(type === 'st' ? currentStyle.co : currentStyle.grd);\n // ctx.strokeStyle = type === 'st' ? currentStyle.co : currentStyle.grd;\n renderer.ctxLineWidth(currentStyle.wi);\n // ctx.lineWidth = currentStyle.wi;\n renderer.ctxLineCap(currentStyle.lc);\n // ctx.lineCap = currentStyle.lc;\n renderer.ctxLineJoin(currentStyle.lj);\n // ctx.lineJoin = currentStyle.lj;\n renderer.ctxMiterLimit(currentStyle.ml || 0);\n // ctx.miterLimit = currentStyle.ml || 0;\n } else {\n renderer.ctxFillStyle(type === 'fl' ? currentStyle.co : currentStyle.grd);\n // ctx.fillStyle = type === 'fl' ? currentStyle.co : currentStyle.grd;\n }\n renderer.ctxOpacity(currentStyle.coOp);\n if (type !== 'st' && type !== 'gs') {\n ctx.beginPath();\n }\n renderer.ctxTransform(currentStyle.preTransforms.finalTransform.props);\n jLen = elems.length;\n for (j = 0; j < jLen; j += 1) {\n if (type === 'st' || type === 'gs') {\n ctx.beginPath();\n if (currentStyle.da) {\n ctx.setLineDash(currentStyle.da);\n ctx.lineDashOffset = currentStyle[\"do\"];\n }\n }\n nodes = elems[j].trNodes;\n kLen = nodes.length;\n for (k = 0; k < kLen; k += 1) {\n if (nodes[k].t === 'm') {\n ctx.moveTo(nodes[k].p[0], nodes[k].p[1]);\n } else if (nodes[k].t === 'c') {\n ctx.bezierCurveTo(nodes[k].pts[0], nodes[k].pts[1], nodes[k].pts[2], nodes[k].pts[3], nodes[k].pts[4], nodes[k].pts[5]);\n } else {\n ctx.closePath();\n }\n }\n if (type === 'st' || type === 'gs') {\n // ctx.stroke();\n renderer.ctxStroke();\n if (currentStyle.da) {\n ctx.setLineDash(this.dashResetter);\n }\n }\n }\n if (type !== 'st' && type !== 'gs') {\n // ctx.fill(currentStyle.r);\n this.globalData.renderer.ctxFill(currentStyle.r);\n }\n renderer.restore();\n }\n }\n };\n CVShapeElement.prototype.renderShape = function (parentTransform, items, data, isMain) {\n var i;\n var len = items.length - 1;\n var groupTransform;\n groupTransform = parentTransform;\n for (i = len; i >= 0; i -= 1) {\n if (items[i].ty === 'tr') {\n groupTransform = data[i].transform;\n this.renderShapeTransform(parentTransform, groupTransform);\n } else if (items[i].ty === 'sh' || items[i].ty === 'el' || items[i].ty === 'rc' || items[i].ty === 'sr') {\n this.renderPath(items[i], data[i]);\n } else if (items[i].ty === 'fl') {\n this.renderFill(items[i], data[i], groupTransform);\n } else if (items[i].ty === 'st') {\n this.renderStroke(items[i], data[i], groupTransform);\n } else if (items[i].ty === 'gf' || items[i].ty === 'gs') {\n this.renderGradientFill(items[i], data[i], groupTransform);\n } else if (items[i].ty === 'gr') {\n this.renderShape(groupTransform, items[i].it, data[i].it);\n } else if (items[i].ty === 'tm') {\n //\n }\n }\n if (isMain) {\n this.drawLayer();\n }\n };\n CVShapeElement.prototype.renderStyledShape = function (styledShape, shape) {\n if (this._isFirstFrame || shape._mdf || styledShape.transforms._mdf) {\n var shapeNodes = styledShape.trNodes;\n var paths = shape.paths;\n var i;\n var len;\n var j;\n var jLen = paths._length;\n shapeNodes.length = 0;\n var groupTransformMat = styledShape.transforms.finalTransform;\n for (j = 0; j < jLen; j += 1) {\n var pathNodes = paths.shapes[j];\n if (pathNodes && pathNodes.v) {\n len = pathNodes._length;\n for (i = 1; i < len; i += 1) {\n if (i === 1) {\n shapeNodes.push({\n t: 'm',\n p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)\n });\n }\n shapeNodes.push({\n t: 'c',\n pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[i], pathNodes.v[i])\n });\n }\n if (len === 1) {\n shapeNodes.push({\n t: 'm',\n p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)\n });\n }\n if (pathNodes.c && len) {\n shapeNodes.push({\n t: 'c',\n pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[0], pathNodes.v[0])\n });\n shapeNodes.push({\n t: 'z'\n });\n }\n }\n }\n styledShape.trNodes = shapeNodes;\n }\n };\n CVShapeElement.prototype.renderPath = function (pathData, itemData) {\n if (pathData.hd !== true && pathData._shouldRender) {\n var i;\n var len = itemData.styledShapes.length;\n for (i = 0; i < len; i += 1) {\n this.renderStyledShape(itemData.styledShapes[i], itemData.sh);\n }\n }\n };\n CVShapeElement.prototype.renderFill = function (styleData, itemData, groupTransform) {\n var styleElem = itemData.style;\n if (itemData.c._mdf || this._isFirstFrame) {\n styleElem.co = 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')';\n }\n if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {\n styleElem.coOp = itemData.o.v * groupTransform.opacity;\n }\n };\n CVShapeElement.prototype.renderGradientFill = function (styleData, itemData, groupTransform) {\n var styleElem = itemData.style;\n var grd;\n if (!styleElem.grd || itemData.g._mdf || itemData.s._mdf || itemData.e._mdf || styleData.t !== 1 && (itemData.h._mdf || itemData.a._mdf)) {\n var ctx = this.globalData.canvasContext;\n var pt1 = itemData.s.v;\n var pt2 = itemData.e.v;\n if (styleData.t === 1) {\n grd = ctx.createLinearGradient(pt1[0], pt1[1], pt2[0], pt2[1]);\n } else {\n var rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));\n var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);\n var percent = itemData.h.v;\n if (percent >= 1) {\n percent = 0.99;\n } else if (percent <= -1) {\n percent = -0.99;\n }\n var dist = rad * percent;\n var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];\n var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];\n grd = ctx.createRadialGradient(x, y, 0, pt1[0], pt1[1], rad);\n }\n var i;\n var len = styleData.g.p;\n var cValues = itemData.g.c;\n var opacity = 1;\n for (i = 0; i < len; i += 1) {\n if (itemData.g._hasOpacity && itemData.g._collapsable) {\n opacity = itemData.g.o[i * 2 + 1];\n }\n grd.addColorStop(cValues[i * 4] / 100, 'rgba(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ',' + opacity + ')');\n }\n styleElem.grd = grd;\n }\n styleElem.coOp = itemData.o.v * groupTransform.opacity;\n };\n CVShapeElement.prototype.renderStroke = function (styleData, itemData, groupTransform) {\n var styleElem = itemData.style;\n var d = itemData.d;\n if (d && (d._mdf || this._isFirstFrame)) {\n styleElem.da = d.dashArray;\n styleElem[\"do\"] = d.dashoffset[0];\n }\n if (itemData.c._mdf || this._isFirstFrame) {\n styleElem.co = 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')';\n }\n if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {\n styleElem.coOp = itemData.o.v * groupTransform.opacity;\n }\n if (itemData.w._mdf || this._isFirstFrame) {\n styleElem.wi = itemData.w.v;\n }\n };\n CVShapeElement.prototype.destroy = function () {\n this.shapesData = null;\n this.globalData = null;\n this.canvasContext = null;\n this.stylesList.length = 0;\n this.itemsData.length = 0;\n };\n\n function CVTextElement(data, globalData, comp) {\n this.textSpans = [];\n this.yOffset = 0;\n this.fillColorAnim = false;\n this.strokeColorAnim = false;\n this.strokeWidthAnim = false;\n this.stroke = false;\n this.fill = false;\n this.justifyOffset = 0;\n this.currentRender = null;\n this.renderType = 'canvas';\n this.values = {\n fill: 'rgba(0,0,0,0)',\n stroke: 'rgba(0,0,0,0)',\n sWidth: 0,\n fValue: ''\n };\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement, ITextElement], CVTextElement);\n CVTextElement.prototype.tHelper = createTag('canvas').getContext('2d');\n CVTextElement.prototype.buildNewText = function () {\n var documentData = this.textProperty.currentData;\n this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);\n var hasFill = false;\n if (documentData.fc) {\n hasFill = true;\n this.values.fill = this.buildColor(documentData.fc);\n } else {\n this.values.fill = 'rgba(0,0,0,0)';\n }\n this.fill = hasFill;\n var hasStroke = false;\n if (documentData.sc) {\n hasStroke = true;\n this.values.stroke = this.buildColor(documentData.sc);\n this.values.sWidth = documentData.sw;\n }\n var fontData = this.globalData.fontManager.getFontByName(documentData.f);\n var i;\n var len;\n var letters = documentData.l;\n var matrixHelper = this.mHelper;\n this.stroke = hasStroke;\n this.values.fValue = documentData.finalSize + 'px ' + this.globalData.fontManager.getFontByName(documentData.f).fFamily;\n len = documentData.finalText.length;\n // this.tHelper.font = this.values.fValue;\n var charData;\n var shapeData;\n var k;\n var kLen;\n var shapes;\n var j;\n var jLen;\n var pathNodes;\n var commands;\n var pathArr;\n var singleShape = this.data.singleShape;\n var trackingOffset = documentData.tr * 0.001 * documentData.finalSize;\n var xPos = 0;\n var yPos = 0;\n var firstLine = true;\n var cnt = 0;\n for (i = 0; i < len; i += 1) {\n charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);\n shapeData = charData && charData.data || {};\n matrixHelper.reset();\n if (singleShape && letters[i].n) {\n xPos = -trackingOffset;\n yPos += documentData.yOffset;\n yPos += firstLine ? 1 : 0;\n firstLine = false;\n }\n shapes = shapeData.shapes ? shapeData.shapes[0].it : [];\n jLen = shapes.length;\n matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);\n if (singleShape) {\n this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);\n }\n commands = createSizedArray(jLen - 1);\n var commandsCounter = 0;\n for (j = 0; j < jLen; j += 1) {\n if (shapes[j].ty === 'sh') {\n kLen = shapes[j].ks.k.i.length;\n pathNodes = shapes[j].ks.k;\n pathArr = [];\n for (k = 1; k < kLen; k += 1) {\n if (k === 1) {\n pathArr.push(matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));\n }\n pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToY(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToX(pathNodes.v[k][0], pathNodes.v[k][1], 0), matrixHelper.applyToY(pathNodes.v[k][0], pathNodes.v[k][1], 0));\n }\n pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToY(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));\n commands[commandsCounter] = pathArr;\n commandsCounter += 1;\n }\n }\n if (singleShape) {\n xPos += letters[i].l;\n xPos += trackingOffset;\n }\n if (this.textSpans[cnt]) {\n this.textSpans[cnt].elem = commands;\n } else {\n this.textSpans[cnt] = {\n elem: commands\n };\n }\n cnt += 1;\n }\n };\n CVTextElement.prototype.renderInnerContent = function () {\n this.validateText();\n var ctx = this.canvasContext;\n ctx.font = this.values.fValue;\n this.globalData.renderer.ctxLineCap('butt');\n // ctx.lineCap = 'butt';\n this.globalData.renderer.ctxLineJoin('miter');\n // ctx.lineJoin = 'miter';\n this.globalData.renderer.ctxMiterLimit(4);\n // ctx.miterLimit = 4;\n\n if (!this.data.singleShape) {\n this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);\n }\n var i;\n var len;\n var j;\n var jLen;\n var k;\n var kLen;\n var renderedLetters = this.textAnimator.renderedLetters;\n var letters = this.textProperty.currentData.l;\n len = letters.length;\n var renderedLetter;\n var lastFill = null;\n var lastStroke = null;\n var lastStrokeW = null;\n var commands;\n var pathArr;\n var renderer = this.globalData.renderer;\n for (i = 0; i < len; i += 1) {\n if (!letters[i].n) {\n renderedLetter = renderedLetters[i];\n if (renderedLetter) {\n renderer.save();\n renderer.ctxTransform(renderedLetter.p);\n renderer.ctxOpacity(renderedLetter.o);\n }\n if (this.fill) {\n if (renderedLetter && renderedLetter.fc) {\n if (lastFill !== renderedLetter.fc) {\n renderer.ctxFillStyle(renderedLetter.fc);\n lastFill = renderedLetter.fc;\n // ctx.fillStyle = renderedLetter.fc;\n }\n } else if (lastFill !== this.values.fill) {\n lastFill = this.values.fill;\n renderer.ctxFillStyle(this.values.fill);\n // ctx.fillStyle = this.values.fill;\n }\n commands = this.textSpans[i].elem;\n jLen = commands.length;\n this.globalData.canvasContext.beginPath();\n for (j = 0; j < jLen; j += 1) {\n pathArr = commands[j];\n kLen = pathArr.length;\n this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);\n for (k = 2; k < kLen; k += 6) {\n this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);\n }\n }\n this.globalData.canvasContext.closePath();\n renderer.ctxFill();\n // this.globalData.canvasContext.fill();\n /// ctx.fillText(this.textSpans[i].val,0,0);\n }\n if (this.stroke) {\n if (renderedLetter && renderedLetter.sw) {\n if (lastStrokeW !== renderedLetter.sw) {\n lastStrokeW = renderedLetter.sw;\n renderer.ctxLineWidth(renderedLetter.sw);\n // ctx.lineWidth = renderedLetter.sw;\n }\n } else if (lastStrokeW !== this.values.sWidth) {\n lastStrokeW = this.values.sWidth;\n renderer.ctxLineWidth(this.values.sWidth);\n // ctx.lineWidth = this.values.sWidth;\n }\n if (renderedLetter && renderedLetter.sc) {\n if (lastStroke !== renderedLetter.sc) {\n lastStroke = renderedLetter.sc;\n renderer.ctxStrokeStyle(renderedLetter.sc);\n // ctx.strokeStyle = renderedLetter.sc;\n }\n } else if (lastStroke !== this.values.stroke) {\n lastStroke = this.values.stroke;\n renderer.ctxStrokeStyle(this.values.stroke);\n // ctx.strokeStyle = this.values.stroke;\n }\n commands = this.textSpans[i].elem;\n jLen = commands.length;\n this.globalData.canvasContext.beginPath();\n for (j = 0; j < jLen; j += 1) {\n pathArr = commands[j];\n kLen = pathArr.length;\n this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);\n for (k = 2; k < kLen; k += 6) {\n this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);\n }\n }\n this.globalData.canvasContext.closePath();\n renderer.ctxStroke();\n // this.globalData.canvasContext.stroke();\n /// ctx.strokeText(letters[i].val,0,0);\n }\n if (renderedLetter) {\n this.globalData.renderer.restore();\n }\n }\n }\n };\n\n function CVImageElement(data, globalData, comp) {\n this.assetData = globalData.getAssetData(data.refId);\n this.img = globalData.imageLoader.getAsset(this.assetData);\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVImageElement);\n CVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement;\n CVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;\n CVImageElement.prototype.createContent = function () {\n if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) {\n var canvas = createTag('canvas');\n canvas.width = this.assetData.w;\n canvas.height = this.assetData.h;\n var ctx = canvas.getContext('2d');\n var imgW = this.img.width;\n var imgH = this.img.height;\n var imgRel = imgW / imgH;\n var canvasRel = this.assetData.w / this.assetData.h;\n var widthCrop;\n var heightCrop;\n var par = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio;\n if (imgRel > canvasRel && par === 'xMidYMid slice' || imgRel < canvasRel && par !== 'xMidYMid slice') {\n heightCrop = imgH;\n widthCrop = heightCrop * canvasRel;\n } else {\n widthCrop = imgW;\n heightCrop = widthCrop / canvasRel;\n }\n ctx.drawImage(this.img, (imgW - widthCrop) / 2, (imgH - heightCrop) / 2, widthCrop, heightCrop, 0, 0, this.assetData.w, this.assetData.h);\n this.img = canvas;\n }\n };\n CVImageElement.prototype.renderInnerContent = function () {\n this.canvasContext.drawImage(this.img, 0, 0);\n };\n CVImageElement.prototype.destroy = function () {\n this.img = null;\n };\n\n function CVSolidElement(data, globalData, comp) {\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVSolidElement);\n CVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement;\n CVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;\n CVSolidElement.prototype.renderInnerContent = function () {\n // var ctx = this.canvasContext;\n this.globalData.renderer.ctxFillStyle(this.data.sc);\n // ctx.fillStyle = this.data.sc;\n this.globalData.renderer.ctxFillRect(0, 0, this.data.sw, this.data.sh);\n // ctx.fillRect(0, 0, this.data.sw, this.data.sh);\n //\n };\n\n function CanvasRendererBase() {}\n extendPrototype([BaseRenderer], CanvasRendererBase);\n CanvasRendererBase.prototype.createShape = function (data) {\n return new CVShapeElement(data, this.globalData, this);\n };\n CanvasRendererBase.prototype.createText = function (data) {\n return new CVTextElement(data, this.globalData, this);\n };\n CanvasRendererBase.prototype.createImage = function (data) {\n return new CVImageElement(data, this.globalData, this);\n };\n CanvasRendererBase.prototype.createSolid = function (data) {\n return new CVSolidElement(data, this.globalData, this);\n };\n CanvasRendererBase.prototype.createNull = SVGRenderer.prototype.createNull;\n CanvasRendererBase.prototype.ctxTransform = function (props) {\n if (props[0] === 1 && props[1] === 0 && props[4] === 0 && props[5] === 1 && props[12] === 0 && props[13] === 0) {\n return;\n }\n this.canvasContext.transform(props[0], props[1], props[4], props[5], props[12], props[13]);\n };\n CanvasRendererBase.prototype.ctxOpacity = function (op) {\n this.canvasContext.globalAlpha *= op < 0 ? 0 : op;\n };\n CanvasRendererBase.prototype.ctxFillStyle = function (value) {\n this.canvasContext.fillStyle = value;\n };\n CanvasRendererBase.prototype.ctxStrokeStyle = function (value) {\n this.canvasContext.strokeStyle = value;\n };\n CanvasRendererBase.prototype.ctxLineWidth = function (value) {\n this.canvasContext.lineWidth = value;\n };\n CanvasRendererBase.prototype.ctxLineCap = function (value) {\n this.canvasContext.lineCap = value;\n };\n CanvasRendererBase.prototype.ctxLineJoin = function (value) {\n this.canvasContext.lineJoin = value;\n };\n CanvasRendererBase.prototype.ctxMiterLimit = function (value) {\n this.canvasContext.miterLimit = value;\n };\n CanvasRendererBase.prototype.ctxFill = function (rule) {\n this.canvasContext.fill(rule);\n };\n CanvasRendererBase.prototype.ctxFillRect = function (x, y, w, h) {\n this.canvasContext.fillRect(x, y, w, h);\n };\n CanvasRendererBase.prototype.ctxStroke = function () {\n this.canvasContext.stroke();\n };\n CanvasRendererBase.prototype.reset = function () {\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.restore();\n return;\n }\n this.contextData.reset();\n };\n CanvasRendererBase.prototype.save = function () {\n this.canvasContext.save();\n };\n CanvasRendererBase.prototype.restore = function (actionFlag) {\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.restore();\n return;\n }\n if (actionFlag) {\n this.globalData.blendMode = 'source-over';\n }\n this.contextData.restore(actionFlag);\n };\n CanvasRendererBase.prototype.configAnimation = function (animData) {\n if (this.animationItem.wrapper) {\n this.animationItem.container = createTag('canvas');\n var containerStyle = this.animationItem.container.style;\n containerStyle.width = '100%';\n containerStyle.height = '100%';\n var origin = '0px 0px 0px';\n containerStyle.transformOrigin = origin;\n containerStyle.mozTransformOrigin = origin;\n containerStyle.webkitTransformOrigin = origin;\n containerStyle['-webkit-transform'] = origin;\n containerStyle.contentVisibility = this.renderConfig.contentVisibility;\n this.animationItem.wrapper.appendChild(this.animationItem.container);\n this.canvasContext = this.animationItem.container.getContext('2d');\n if (this.renderConfig.className) {\n this.animationItem.container.setAttribute('class', this.renderConfig.className);\n }\n if (this.renderConfig.id) {\n this.animationItem.container.setAttribute('id', this.renderConfig.id);\n }\n } else {\n this.canvasContext = this.renderConfig.context;\n }\n this.contextData.setContext(this.canvasContext);\n this.data = animData;\n this.layers = animData.layers;\n this.transformCanvas = {\n w: animData.w,\n h: animData.h,\n sx: 0,\n sy: 0,\n tx: 0,\n ty: 0\n };\n this.setupGlobalData(animData, document.body);\n this.globalData.canvasContext = this.canvasContext;\n this.globalData.renderer = this;\n this.globalData.isDashed = false;\n this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;\n this.globalData.transformCanvas = this.transformCanvas;\n this.elements = createSizedArray(animData.layers.length);\n this.updateContainerSize();\n };\n CanvasRendererBase.prototype.updateContainerSize = function (width, height) {\n this.reset();\n var elementWidth;\n var elementHeight;\n if (width) {\n elementWidth = width;\n elementHeight = height;\n this.canvasContext.canvas.width = elementWidth;\n this.canvasContext.canvas.height = elementHeight;\n } else {\n if (this.animationItem.wrapper && this.animationItem.container) {\n elementWidth = this.animationItem.wrapper.offsetWidth;\n elementHeight = this.animationItem.wrapper.offsetHeight;\n } else {\n elementWidth = this.canvasContext.canvas.width;\n elementHeight = this.canvasContext.canvas.height;\n }\n this.canvasContext.canvas.width = elementWidth * this.renderConfig.dpr;\n this.canvasContext.canvas.height = elementHeight * this.renderConfig.dpr;\n }\n var elementRel;\n var animationRel;\n if (this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 || this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1) {\n var par = this.renderConfig.preserveAspectRatio.split(' ');\n var fillType = par[1] || 'meet';\n var pos = par[0] || 'xMidYMid';\n var xPos = pos.substr(0, 4);\n var yPos = pos.substr(4);\n elementRel = elementWidth / elementHeight;\n animationRel = this.transformCanvas.w / this.transformCanvas.h;\n if (animationRel > elementRel && fillType === 'meet' || animationRel < elementRel && fillType === 'slice') {\n this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);\n this.transformCanvas.sy = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);\n } else {\n this.transformCanvas.sx = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);\n this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);\n }\n if (xPos === 'xMid' && (animationRel < elementRel && fillType === 'meet' || animationRel > elementRel && fillType === 'slice')) {\n this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) / 2 * this.renderConfig.dpr;\n } else if (xPos === 'xMax' && (animationRel < elementRel && fillType === 'meet' || animationRel > elementRel && fillType === 'slice')) {\n this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) * this.renderConfig.dpr;\n } else {\n this.transformCanvas.tx = 0;\n }\n if (yPos === 'YMid' && (animationRel > elementRel && fillType === 'meet' || animationRel < elementRel && fillType === 'slice')) {\n this.transformCanvas.ty = (elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) / 2 * this.renderConfig.dpr;\n } else if (yPos === 'YMax' && (animationRel > elementRel && fillType === 'meet' || animationRel < elementRel && fillType === 'slice')) {\n this.transformCanvas.ty = (elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) * this.renderConfig.dpr;\n } else {\n this.transformCanvas.ty = 0;\n }\n } else if (this.renderConfig.preserveAspectRatio === 'none') {\n this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);\n this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);\n this.transformCanvas.tx = 0;\n this.transformCanvas.ty = 0;\n } else {\n this.transformCanvas.sx = this.renderConfig.dpr;\n this.transformCanvas.sy = this.renderConfig.dpr;\n this.transformCanvas.tx = 0;\n this.transformCanvas.ty = 0;\n }\n this.transformCanvas.props = [this.transformCanvas.sx, 0, 0, 0, 0, this.transformCanvas.sy, 0, 0, 0, 0, 1, 0, this.transformCanvas.tx, this.transformCanvas.ty, 0, 1];\n /* var i, len = this.elements.length;\n for(i=0;i= 0; i -= 1) {\n if (this.elements[i] && this.elements[i].destroy) {\n this.elements[i].destroy();\n }\n }\n this.elements.length = 0;\n this.globalData.canvasContext = null;\n this.animationItem.container = null;\n this.destroyed = true;\n };\n CanvasRendererBase.prototype.renderFrame = function (num, forceRender) {\n if (this.renderedFrame === num && this.renderConfig.clearCanvas === true && !forceRender || this.destroyed || num === -1) {\n return;\n }\n this.renderedFrame = num;\n this.globalData.frameNum = num - this.animationItem._isFirstFrame;\n this.globalData.frameId += 1;\n this.globalData._mdf = !this.renderConfig.clearCanvas || forceRender;\n this.globalData.projectInterface.currentFrame = num;\n\n // console.log('--------');\n // console.log('NEW: ',num);\n var i;\n var len = this.layers.length;\n if (!this.completeLayers) {\n this.checkLayers(num);\n }\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].prepareFrame(num - this.layers[i].st);\n }\n }\n if (this.globalData._mdf) {\n if (this.renderConfig.clearCanvas === true) {\n this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h);\n } else {\n this.save();\n }\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame();\n }\n }\n if (this.renderConfig.clearCanvas !== true) {\n this.restore();\n }\n }\n };\n CanvasRendererBase.prototype.buildItem = function (pos) {\n var elements = this.elements;\n if (elements[pos] || this.layers[pos].ty === 99) {\n return;\n }\n var element = this.createItem(this.layers[pos], this, this.globalData);\n elements[pos] = element;\n element.initExpressions();\n /* if(this.layers[pos].ty === 0){\n element.resize(this.globalData.transformCanvas);\n } */\n };\n CanvasRendererBase.prototype.checkPendingElements = function () {\n while (this.pendingElements.length) {\n var element = this.pendingElements.pop();\n element.checkParenting();\n }\n };\n CanvasRendererBase.prototype.hide = function () {\n this.animationItem.container.style.display = 'none';\n };\n CanvasRendererBase.prototype.show = function () {\n this.animationItem.container.style.display = 'block';\n };\n\n function CanvasContext() {\n this.opacity = -1;\n this.transform = createTypedArray('float32', 16);\n this.fillStyle = '';\n this.strokeStyle = '';\n this.lineWidth = '';\n this.lineCap = '';\n this.lineJoin = '';\n this.miterLimit = '';\n this.id = Math.random();\n }\n function CVContextData() {\n this.stack = [];\n this.cArrPos = 0;\n this.cTr = new Matrix();\n var i;\n var len = 15;\n for (i = 0; i < len; i += 1) {\n var canvasContext = new CanvasContext();\n this.stack[i] = canvasContext;\n }\n this._length = len;\n this.nativeContext = null;\n this.transformMat = new Matrix();\n this.currentOpacity = 1;\n //\n this.currentFillStyle = '';\n this.appliedFillStyle = '';\n //\n this.currentStrokeStyle = '';\n this.appliedStrokeStyle = '';\n //\n this.currentLineWidth = '';\n this.appliedLineWidth = '';\n //\n this.currentLineCap = '';\n this.appliedLineCap = '';\n //\n this.currentLineJoin = '';\n this.appliedLineJoin = '';\n //\n this.appliedMiterLimit = '';\n this.currentMiterLimit = '';\n }\n CVContextData.prototype.duplicate = function () {\n var newLength = this._length * 2;\n var i = 0;\n for (i = this._length; i < newLength; i += 1) {\n this.stack[i] = new CanvasContext();\n }\n this._length = newLength;\n };\n CVContextData.prototype.reset = function () {\n this.cArrPos = 0;\n this.cTr.reset();\n this.stack[this.cArrPos].opacity = 1;\n };\n CVContextData.prototype.restore = function (forceRestore) {\n this.cArrPos -= 1;\n var currentContext = this.stack[this.cArrPos];\n var transform = currentContext.transform;\n var i;\n var arr = this.cTr.props;\n for (i = 0; i < 16; i += 1) {\n arr[i] = transform[i];\n }\n if (forceRestore) {\n this.nativeContext.restore();\n var prevStack = this.stack[this.cArrPos + 1];\n this.appliedFillStyle = prevStack.fillStyle;\n this.appliedStrokeStyle = prevStack.strokeStyle;\n this.appliedLineWidth = prevStack.lineWidth;\n this.appliedLineCap = prevStack.lineCap;\n this.appliedLineJoin = prevStack.lineJoin;\n this.appliedMiterLimit = prevStack.miterLimit;\n }\n this.nativeContext.setTransform(transform[0], transform[1], transform[4], transform[5], transform[12], transform[13]);\n if (forceRestore || currentContext.opacity !== -1 && this.currentOpacity !== currentContext.opacity) {\n this.nativeContext.globalAlpha = currentContext.opacity;\n this.currentOpacity = currentContext.opacity;\n }\n this.currentFillStyle = currentContext.fillStyle;\n this.currentStrokeStyle = currentContext.strokeStyle;\n this.currentLineWidth = currentContext.lineWidth;\n this.currentLineCap = currentContext.lineCap;\n this.currentLineJoin = currentContext.lineJoin;\n this.currentMiterLimit = currentContext.miterLimit;\n };\n CVContextData.prototype.save = function (saveOnNativeFlag) {\n if (saveOnNativeFlag) {\n this.nativeContext.save();\n }\n var props = this.cTr.props;\n if (this._length <= this.cArrPos) {\n this.duplicate();\n }\n var currentStack = this.stack[this.cArrPos];\n var i;\n for (i = 0; i < 16; i += 1) {\n currentStack.transform[i] = props[i];\n }\n this.cArrPos += 1;\n var newStack = this.stack[this.cArrPos];\n newStack.opacity = currentStack.opacity;\n newStack.fillStyle = currentStack.fillStyle;\n newStack.strokeStyle = currentStack.strokeStyle;\n newStack.lineWidth = currentStack.lineWidth;\n newStack.lineCap = currentStack.lineCap;\n newStack.lineJoin = currentStack.lineJoin;\n newStack.miterLimit = currentStack.miterLimit;\n };\n CVContextData.prototype.setOpacity = function (value) {\n this.stack[this.cArrPos].opacity = value;\n };\n CVContextData.prototype.setContext = function (value) {\n this.nativeContext = value;\n };\n CVContextData.prototype.fillStyle = function (value) {\n if (this.stack[this.cArrPos].fillStyle !== value) {\n this.currentFillStyle = value;\n this.stack[this.cArrPos].fillStyle = value;\n }\n };\n CVContextData.prototype.strokeStyle = function (value) {\n if (this.stack[this.cArrPos].strokeStyle !== value) {\n this.currentStrokeStyle = value;\n this.stack[this.cArrPos].strokeStyle = value;\n }\n };\n CVContextData.prototype.lineWidth = function (value) {\n if (this.stack[this.cArrPos].lineWidth !== value) {\n this.currentLineWidth = value;\n this.stack[this.cArrPos].lineWidth = value;\n }\n };\n CVContextData.prototype.lineCap = function (value) {\n if (this.stack[this.cArrPos].lineCap !== value) {\n this.currentLineCap = value;\n this.stack[this.cArrPos].lineCap = value;\n }\n };\n CVContextData.prototype.lineJoin = function (value) {\n if (this.stack[this.cArrPos].lineJoin !== value) {\n this.currentLineJoin = value;\n this.stack[this.cArrPos].lineJoin = value;\n }\n };\n CVContextData.prototype.miterLimit = function (value) {\n if (this.stack[this.cArrPos].miterLimit !== value) {\n this.currentMiterLimit = value;\n this.stack[this.cArrPos].miterLimit = value;\n }\n };\n CVContextData.prototype.transform = function (props) {\n this.transformMat.cloneFromProps(props);\n // Taking the last transform value from the stored stack of transforms\n var currentTransform = this.cTr;\n // Applying the last transform value after the new transform to respect the order of transformations\n this.transformMat.multiply(currentTransform);\n // Storing the new transformed value in the stored transform\n currentTransform.cloneFromProps(this.transformMat.props);\n var trProps = currentTransform.props;\n // Applying the new transform to the canvas\n this.nativeContext.setTransform(trProps[0], trProps[1], trProps[4], trProps[5], trProps[12], trProps[13]);\n };\n CVContextData.prototype.opacity = function (op) {\n var currentOpacity = this.stack[this.cArrPos].opacity;\n currentOpacity *= op < 0 ? 0 : op;\n if (this.stack[this.cArrPos].opacity !== currentOpacity) {\n if (this.currentOpacity !== op) {\n this.nativeContext.globalAlpha = op;\n this.currentOpacity = op;\n }\n this.stack[this.cArrPos].opacity = currentOpacity;\n }\n };\n CVContextData.prototype.fill = function (rule) {\n if (this.appliedFillStyle !== this.currentFillStyle) {\n this.appliedFillStyle = this.currentFillStyle;\n this.nativeContext.fillStyle = this.appliedFillStyle;\n }\n this.nativeContext.fill(rule);\n };\n CVContextData.prototype.fillRect = function (x, y, w, h) {\n if (this.appliedFillStyle !== this.currentFillStyle) {\n this.appliedFillStyle = this.currentFillStyle;\n this.nativeContext.fillStyle = this.appliedFillStyle;\n }\n this.nativeContext.fillRect(x, y, w, h);\n };\n CVContextData.prototype.stroke = function () {\n if (this.appliedStrokeStyle !== this.currentStrokeStyle) {\n this.appliedStrokeStyle = this.currentStrokeStyle;\n this.nativeContext.strokeStyle = this.appliedStrokeStyle;\n }\n if (this.appliedLineWidth !== this.currentLineWidth) {\n this.appliedLineWidth = this.currentLineWidth;\n this.nativeContext.lineWidth = this.appliedLineWidth;\n }\n if (this.appliedLineCap !== this.currentLineCap) {\n this.appliedLineCap = this.currentLineCap;\n this.nativeContext.lineCap = this.appliedLineCap;\n }\n if (this.appliedLineJoin !== this.currentLineJoin) {\n this.appliedLineJoin = this.currentLineJoin;\n this.nativeContext.lineJoin = this.appliedLineJoin;\n }\n if (this.appliedMiterLimit !== this.currentMiterLimit) {\n this.appliedMiterLimit = this.currentMiterLimit;\n this.nativeContext.miterLimit = this.appliedMiterLimit;\n }\n this.nativeContext.stroke();\n };\n\n function CVCompElement(data, globalData, comp) {\n this.completeLayers = false;\n this.layers = data.layers;\n this.pendingElements = [];\n this.elements = createSizedArray(this.layers.length);\n this.initElement(data, globalData, comp);\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {\n _placeholder: true\n };\n }\n extendPrototype([CanvasRendererBase, ICompElement, CVBaseElement], CVCompElement);\n CVCompElement.prototype.renderInnerContent = function () {\n var ctx = this.canvasContext;\n ctx.beginPath();\n ctx.moveTo(0, 0);\n ctx.lineTo(this.data.w, 0);\n ctx.lineTo(this.data.w, this.data.h);\n ctx.lineTo(0, this.data.h);\n ctx.lineTo(0, 0);\n ctx.clip();\n var i;\n var len = this.layers.length;\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame();\n }\n }\n };\n CVCompElement.prototype.destroy = function () {\n var i;\n var len = this.layers.length;\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.elements[i]) {\n this.elements[i].destroy();\n }\n }\n this.layers = null;\n this.elements = null;\n };\n CVCompElement.prototype.createComp = function (data) {\n return new CVCompElement(data, this.globalData, this);\n };\n\n function CanvasRenderer(animationItem, config) {\n this.animationItem = animationItem;\n this.renderConfig = {\n clearCanvas: config && config.clearCanvas !== undefined ? config.clearCanvas : true,\n context: config && config.context || null,\n progressiveLoad: config && config.progressiveLoad || false,\n preserveAspectRatio: config && config.preserveAspectRatio || 'xMidYMid meet',\n imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice',\n contentVisibility: config && config.contentVisibility || 'visible',\n className: config && config.className || '',\n id: config && config.id || '',\n runExpressions: !config || config.runExpressions === undefined || config.runExpressions\n };\n this.renderConfig.dpr = config && config.dpr || 1;\n if (this.animationItem.wrapper) {\n this.renderConfig.dpr = config && config.dpr || window.devicePixelRatio || 1;\n }\n this.renderedFrame = -1;\n this.globalData = {\n frameNum: -1,\n _mdf: false,\n renderConfig: this.renderConfig,\n currentGlobalAlpha: -1\n };\n this.contextData = new CVContextData();\n this.elements = [];\n this.pendingElements = [];\n this.transformMat = new Matrix();\n this.completeLayers = false;\n this.rendererType = 'canvas';\n if (this.renderConfig.clearCanvas) {\n this.ctxTransform = this.contextData.transform.bind(this.contextData);\n this.ctxOpacity = this.contextData.opacity.bind(this.contextData);\n this.ctxFillStyle = this.contextData.fillStyle.bind(this.contextData);\n this.ctxStrokeStyle = this.contextData.strokeStyle.bind(this.contextData);\n this.ctxLineWidth = this.contextData.lineWidth.bind(this.contextData);\n this.ctxLineCap = this.contextData.lineCap.bind(this.contextData);\n this.ctxLineJoin = this.contextData.lineJoin.bind(this.contextData);\n this.ctxMiterLimit = this.contextData.miterLimit.bind(this.contextData);\n this.ctxFill = this.contextData.fill.bind(this.contextData);\n this.ctxFillRect = this.contextData.fillRect.bind(this.contextData);\n this.ctxStroke = this.contextData.stroke.bind(this.contextData);\n this.save = this.contextData.save.bind(this.contextData);\n }\n }\n extendPrototype([CanvasRendererBase], CanvasRenderer);\n CanvasRenderer.prototype.createComp = function (data) {\n return new CVCompElement(data, this.globalData, this);\n };\n\n function HBaseElement() {}\n HBaseElement.prototype = {\n checkBlendMode: function checkBlendMode() {},\n initRendererElement: function initRendererElement() {\n this.baseElement = createTag(this.data.tg || 'div');\n if (this.data.hasMask) {\n this.svgElement = createNS('svg');\n this.layerElement = createNS('g');\n this.maskedElement = this.layerElement;\n this.svgElement.appendChild(this.layerElement);\n this.baseElement.appendChild(this.svgElement);\n } else {\n this.layerElement = this.baseElement;\n }\n styleDiv(this.baseElement);\n },\n createContainerElements: function createContainerElements() {\n this.renderableEffectsManager = new CVEffects(this);\n this.transformedElement = this.baseElement;\n this.maskedElement = this.layerElement;\n if (this.data.ln) {\n this.layerElement.setAttribute('id', this.data.ln);\n }\n if (this.data.cl) {\n this.layerElement.setAttribute('class', this.data.cl);\n }\n if (this.data.bm !== 0) {\n this.setBlendMode();\n }\n },\n renderElement: function renderElement() {\n var transformedElementStyle = this.transformedElement ? this.transformedElement.style : {};\n if (this.finalTransform._matMdf) {\n var matrixValue = this.finalTransform.mat.toCSS();\n transformedElementStyle.transform = matrixValue;\n transformedElementStyle.webkitTransform = matrixValue;\n }\n if (this.finalTransform._opMdf) {\n transformedElementStyle.opacity = this.finalTransform.mProp.o.v;\n }\n },\n renderFrame: function renderFrame() {\n // If it is exported as hidden (data.hd === true) no need to render\n // If it is not visible no need to render\n if (this.data.hd || this.hidden) {\n return;\n }\n this.renderTransform();\n this.renderRenderable();\n this.renderElement();\n this.renderInnerContent();\n if (this._isFirstFrame) {\n this._isFirstFrame = false;\n }\n },\n destroy: function destroy() {\n this.layerElement = null;\n this.transformedElement = null;\n if (this.matteElement) {\n this.matteElement = null;\n }\n if (this.maskManager) {\n this.maskManager.destroy();\n this.maskManager = null;\n }\n },\n createRenderableComponents: function createRenderableComponents() {\n this.maskManager = new MaskElement(this.data, this, this.globalData);\n },\n addEffects: function addEffects() {},\n setMatte: function setMatte() {}\n };\n HBaseElement.prototype.getBaseElement = SVGBaseElement.prototype.getBaseElement;\n HBaseElement.prototype.destroyBaseElement = HBaseElement.prototype.destroy;\n HBaseElement.prototype.buildElementParenting = BaseRenderer.prototype.buildElementParenting;\n\n function HSolidElement(data, globalData, comp) {\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], HSolidElement);\n HSolidElement.prototype.createContent = function () {\n var rect;\n if (this.data.hasMask) {\n rect = createNS('rect');\n rect.setAttribute('width', this.data.sw);\n rect.setAttribute('height', this.data.sh);\n rect.setAttribute('fill', this.data.sc);\n this.svgElement.setAttribute('width', this.data.sw);\n this.svgElement.setAttribute('height', this.data.sh);\n } else {\n rect = createTag('div');\n rect.style.width = this.data.sw + 'px';\n rect.style.height = this.data.sh + 'px';\n rect.style.backgroundColor = this.data.sc;\n }\n this.layerElement.appendChild(rect);\n };\n\n function HShapeElement(data, globalData, comp) {\n // List of drawable elements\n this.shapes = [];\n // Full shape data\n this.shapesData = data.shapes;\n // List of styles that will be applied to shapes\n this.stylesList = [];\n // List of modifiers that will be applied to shapes\n this.shapeModifiers = [];\n // List of items in shape tree\n this.itemsData = [];\n // List of items in previous shape tree\n this.processedElements = [];\n // List of animated components\n this.animatedContents = [];\n this.shapesContainer = createNS('g');\n this.initElement(data, globalData, comp);\n // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\n // List of elements that have been created\n this.prevViewData = [];\n this.currentBBox = {\n x: 999999,\n y: -999999,\n h: 0,\n w: 0\n };\n }\n extendPrototype([BaseElement, TransformElement, HSolidElement, SVGShapeElement, HBaseElement, HierarchyElement, FrameElement, RenderableElement], HShapeElement);\n HShapeElement.prototype._renderShapeFrame = HShapeElement.prototype.renderInnerContent;\n HShapeElement.prototype.createContent = function () {\n var cont;\n this.baseElement.style.fontSize = 0;\n if (this.data.hasMask) {\n this.layerElement.appendChild(this.shapesContainer);\n cont = this.svgElement;\n } else {\n cont = createNS('svg');\n var size = this.comp.data ? this.comp.data : this.globalData.compSize;\n cont.setAttribute('width', size.w);\n cont.setAttribute('height', size.h);\n cont.appendChild(this.shapesContainer);\n this.layerElement.appendChild(cont);\n }\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.shapesContainer, 0, [], true);\n this.filterUniqueShapes();\n this.shapeCont = cont;\n };\n HShapeElement.prototype.getTransformedPoint = function (transformers, point) {\n var i;\n var len = transformers.length;\n for (i = 0; i < len; i += 1) {\n point = transformers[i].mProps.v.applyToPointArray(point[0], point[1], 0);\n }\n return point;\n };\n HShapeElement.prototype.calculateShapeBoundingBox = function (item, boundingBox) {\n var shape = item.sh.v;\n var transformers = item.transformers;\n var i;\n var len = shape._length;\n var vPoint;\n var oPoint;\n var nextIPoint;\n var nextVPoint;\n if (len <= 1) {\n return;\n }\n for (i = 0; i < len - 1; i += 1) {\n vPoint = this.getTransformedPoint(transformers, shape.v[i]);\n oPoint = this.getTransformedPoint(transformers, shape.o[i]);\n nextIPoint = this.getTransformedPoint(transformers, shape.i[i + 1]);\n nextVPoint = this.getTransformedPoint(transformers, shape.v[i + 1]);\n this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);\n }\n if (shape.c) {\n vPoint = this.getTransformedPoint(transformers, shape.v[i]);\n oPoint = this.getTransformedPoint(transformers, shape.o[i]);\n nextIPoint = this.getTransformedPoint(transformers, shape.i[0]);\n nextVPoint = this.getTransformedPoint(transformers, shape.v[0]);\n this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);\n }\n };\n HShapeElement.prototype.checkBounds = function (vPoint, oPoint, nextIPoint, nextVPoint, boundingBox) {\n this.getBoundsOfCurve(vPoint, oPoint, nextIPoint, nextVPoint);\n var bounds = this.shapeBoundingBox;\n boundingBox.x = bmMin(bounds.left, boundingBox.x);\n boundingBox.xMax = bmMax(bounds.right, boundingBox.xMax);\n boundingBox.y = bmMin(bounds.top, boundingBox.y);\n boundingBox.yMax = bmMax(bounds.bottom, boundingBox.yMax);\n };\n HShapeElement.prototype.shapeBoundingBox = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n };\n HShapeElement.prototype.tempBoundingBox = {\n x: 0,\n xMax: 0,\n y: 0,\n yMax: 0,\n width: 0,\n height: 0\n };\n HShapeElement.prototype.getBoundsOfCurve = function (p0, p1, p2, p3) {\n var bounds = [[p0[0], p3[0]], [p0[1], p3[1]]];\n for (var a, b, c, t, b2ac, t1, t2, i = 0; i < 2; ++i) {\n // eslint-disable-line no-plusplus\n b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];\n a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];\n c = 3 * p1[i] - 3 * p0[i];\n b |= 0; // eslint-disable-line no-bitwise\n a |= 0; // eslint-disable-line no-bitwise\n c |= 0; // eslint-disable-line no-bitwise\n\n if (a === 0 && b === 0) {\n //\n } else if (a === 0) {\n t = -c / b;\n if (t > 0 && t < 1) {\n bounds[i].push(this.calculateF(t, p0, p1, p2, p3, i));\n }\n } else {\n b2ac = b * b - 4 * c * a;\n if (b2ac >= 0) {\n t1 = (-b + bmSqrt(b2ac)) / (2 * a);\n if (t1 > 0 && t1 < 1) bounds[i].push(this.calculateF(t1, p0, p1, p2, p3, i));\n t2 = (-b - bmSqrt(b2ac)) / (2 * a);\n if (t2 > 0 && t2 < 1) bounds[i].push(this.calculateF(t2, p0, p1, p2, p3, i));\n }\n }\n }\n this.shapeBoundingBox.left = bmMin.apply(null, bounds[0]);\n this.shapeBoundingBox.top = bmMin.apply(null, bounds[1]);\n this.shapeBoundingBox.right = bmMax.apply(null, bounds[0]);\n this.shapeBoundingBox.bottom = bmMax.apply(null, bounds[1]);\n };\n HShapeElement.prototype.calculateF = function (t, p0, p1, p2, p3, i) {\n return bmPow(1 - t, 3) * p0[i] + 3 * bmPow(1 - t, 2) * t * p1[i] + 3 * (1 - t) * bmPow(t, 2) * p2[i] + bmPow(t, 3) * p3[i];\n };\n HShapeElement.prototype.calculateBoundingBox = function (itemsData, boundingBox) {\n var i;\n var len = itemsData.length;\n for (i = 0; i < len; i += 1) {\n if (itemsData[i] && itemsData[i].sh) {\n this.calculateShapeBoundingBox(itemsData[i], boundingBox);\n } else if (itemsData[i] && itemsData[i].it) {\n this.calculateBoundingBox(itemsData[i].it, boundingBox);\n } else if (itemsData[i] && itemsData[i].style && itemsData[i].w) {\n this.expandStrokeBoundingBox(itemsData[i].w, boundingBox);\n }\n }\n };\n HShapeElement.prototype.expandStrokeBoundingBox = function (widthProperty, boundingBox) {\n var width = 0;\n if (widthProperty.keyframes) {\n for (var i = 0; i < widthProperty.keyframes.length; i += 1) {\n var kfw = widthProperty.keyframes[i].s;\n if (kfw > width) {\n width = kfw;\n }\n }\n width *= widthProperty.mult;\n } else {\n width = widthProperty.v * widthProperty.mult;\n }\n boundingBox.x -= width;\n boundingBox.xMax += width;\n boundingBox.y -= width;\n boundingBox.yMax += width;\n };\n HShapeElement.prototype.currentBoxContains = function (box) {\n return this.currentBBox.x <= box.x && this.currentBBox.y <= box.y && this.currentBBox.width + this.currentBBox.x >= box.x + box.width && this.currentBBox.height + this.currentBBox.y >= box.y + box.height;\n };\n HShapeElement.prototype.renderInnerContent = function () {\n this._renderShapeFrame();\n if (!this.hidden && (this._isFirstFrame || this._mdf)) {\n var tempBoundingBox = this.tempBoundingBox;\n var max = 999999;\n tempBoundingBox.x = max;\n tempBoundingBox.xMax = -max;\n tempBoundingBox.y = max;\n tempBoundingBox.yMax = -max;\n this.calculateBoundingBox(this.itemsData, tempBoundingBox);\n tempBoundingBox.width = tempBoundingBox.xMax < tempBoundingBox.x ? 0 : tempBoundingBox.xMax - tempBoundingBox.x;\n tempBoundingBox.height = tempBoundingBox.yMax < tempBoundingBox.y ? 0 : tempBoundingBox.yMax - tempBoundingBox.y;\n // var tempBoundingBox = this.shapeCont.getBBox();\n if (this.currentBoxContains(tempBoundingBox)) {\n return;\n }\n var changed = false;\n if (this.currentBBox.w !== tempBoundingBox.width) {\n this.currentBBox.w = tempBoundingBox.width;\n this.shapeCont.setAttribute('width', tempBoundingBox.width);\n changed = true;\n }\n if (this.currentBBox.h !== tempBoundingBox.height) {\n this.currentBBox.h = tempBoundingBox.height;\n this.shapeCont.setAttribute('height', tempBoundingBox.height);\n changed = true;\n }\n if (changed || this.currentBBox.x !== tempBoundingBox.x || this.currentBBox.y !== tempBoundingBox.y) {\n this.currentBBox.w = tempBoundingBox.width;\n this.currentBBox.h = tempBoundingBox.height;\n this.currentBBox.x = tempBoundingBox.x;\n this.currentBBox.y = tempBoundingBox.y;\n this.shapeCont.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);\n var shapeStyle = this.shapeCont.style;\n var shapeTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';\n shapeStyle.transform = shapeTransform;\n shapeStyle.webkitTransform = shapeTransform;\n }\n }\n };\n\n function HTextElement(data, globalData, comp) {\n this.textSpans = [];\n this.textPaths = [];\n this.currentBBox = {\n x: 999999,\n y: -999999,\n h: 0,\n w: 0\n };\n this.renderType = 'svg';\n this.isMasked = false;\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], HTextElement);\n HTextElement.prototype.createContent = function () {\n this.isMasked = this.checkMasks();\n if (this.isMasked) {\n this.renderType = 'svg';\n this.compW = this.comp.data.w;\n this.compH = this.comp.data.h;\n this.svgElement.setAttribute('width', this.compW);\n this.svgElement.setAttribute('height', this.compH);\n var g = createNS('g');\n this.maskedElement.appendChild(g);\n this.innerElem = g;\n } else {\n this.renderType = 'html';\n this.innerElem = this.layerElement;\n }\n this.checkParenting();\n };\n HTextElement.prototype.buildNewText = function () {\n var documentData = this.textProperty.currentData;\n this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);\n var innerElemStyle = this.innerElem.style;\n var textColor = documentData.fc ? this.buildColor(documentData.fc) : 'rgba(0,0,0,0)';\n innerElemStyle.fill = textColor;\n innerElemStyle.color = textColor;\n if (documentData.sc) {\n innerElemStyle.stroke = this.buildColor(documentData.sc);\n innerElemStyle.strokeWidth = documentData.sw + 'px';\n }\n var fontData = this.globalData.fontManager.getFontByName(documentData.f);\n if (!this.globalData.fontManager.chars) {\n innerElemStyle.fontSize = documentData.finalSize + 'px';\n innerElemStyle.lineHeight = documentData.finalSize + 'px';\n if (fontData.fClass) {\n this.innerElem.className = fontData.fClass;\n } else {\n innerElemStyle.fontFamily = fontData.fFamily;\n var fWeight = documentData.fWeight;\n var fStyle = documentData.fStyle;\n innerElemStyle.fontStyle = fStyle;\n innerElemStyle.fontWeight = fWeight;\n }\n }\n var i;\n var len;\n var letters = documentData.l;\n len = letters.length;\n var tSpan;\n var tParent;\n var tCont;\n var matrixHelper = this.mHelper;\n var shapes;\n var shapeStr = '';\n var cnt = 0;\n for (i = 0; i < len; i += 1) {\n if (this.globalData.fontManager.chars) {\n if (!this.textPaths[cnt]) {\n tSpan = createNS('path');\n tSpan.setAttribute('stroke-linecap', lineCapEnum[1]);\n tSpan.setAttribute('stroke-linejoin', lineJoinEnum[2]);\n tSpan.setAttribute('stroke-miterlimit', '4');\n } else {\n tSpan = this.textPaths[cnt];\n }\n if (!this.isMasked) {\n if (this.textSpans[cnt]) {\n tParent = this.textSpans[cnt];\n tCont = tParent.children[0];\n } else {\n tParent = createTag('div');\n tParent.style.lineHeight = 0;\n tCont = createNS('svg');\n tCont.appendChild(tSpan);\n styleDiv(tParent);\n }\n }\n } else if (!this.isMasked) {\n if (this.textSpans[cnt]) {\n tParent = this.textSpans[cnt];\n tSpan = this.textPaths[cnt];\n } else {\n tParent = createTag('span');\n styleDiv(tParent);\n tSpan = createTag('span');\n styleDiv(tSpan);\n tParent.appendChild(tSpan);\n }\n } else {\n tSpan = this.textPaths[cnt] ? this.textPaths[cnt] : createNS('text');\n }\n // tSpan.setAttribute('visibility', 'hidden');\n if (this.globalData.fontManager.chars) {\n var charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);\n var shapeData;\n if (charData) {\n shapeData = charData.data;\n } else {\n shapeData = null;\n }\n matrixHelper.reset();\n if (shapeData && shapeData.shapes && shapeData.shapes.length) {\n shapes = shapeData.shapes[0].it;\n matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);\n shapeStr = this.createPathShape(matrixHelper, shapes);\n tSpan.setAttribute('d', shapeStr);\n }\n if (!this.isMasked) {\n this.innerElem.appendChild(tParent);\n if (shapeData && shapeData.shapes) {\n // document.body.appendChild is needed to get exact measure of shape\n document.body.appendChild(tCont);\n var boundingBox = tCont.getBBox();\n tCont.setAttribute('width', boundingBox.width + 2);\n tCont.setAttribute('height', boundingBox.height + 2);\n tCont.setAttribute('viewBox', boundingBox.x - 1 + ' ' + (boundingBox.y - 1) + ' ' + (boundingBox.width + 2) + ' ' + (boundingBox.height + 2));\n var tContStyle = tCont.style;\n var tContTranslation = 'translate(' + (boundingBox.x - 1) + 'px,' + (boundingBox.y - 1) + 'px)';\n tContStyle.transform = tContTranslation;\n tContStyle.webkitTransform = tContTranslation;\n letters[i].yOffset = boundingBox.y - 1;\n } else {\n tCont.setAttribute('width', 1);\n tCont.setAttribute('height', 1);\n }\n tParent.appendChild(tCont);\n } else {\n this.innerElem.appendChild(tSpan);\n }\n } else {\n tSpan.textContent = letters[i].val;\n tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');\n if (!this.isMasked) {\n this.innerElem.appendChild(tParent);\n //\n var tStyle = tSpan.style;\n var tSpanTranslation = 'translate3d(0,' + -documentData.finalSize / 1.2 + 'px,0)';\n tStyle.transform = tSpanTranslation;\n tStyle.webkitTransform = tSpanTranslation;\n } else {\n this.innerElem.appendChild(tSpan);\n }\n }\n //\n if (!this.isMasked) {\n this.textSpans[cnt] = tParent;\n } else {\n this.textSpans[cnt] = tSpan;\n }\n this.textSpans[cnt].style.display = 'block';\n this.textPaths[cnt] = tSpan;\n cnt += 1;\n }\n while (cnt < this.textSpans.length) {\n this.textSpans[cnt].style.display = 'none';\n cnt += 1;\n }\n };\n HTextElement.prototype.renderInnerContent = function () {\n this.validateText();\n var svgStyle;\n if (this.data.singleShape) {\n if (!this._isFirstFrame && !this.lettersChangedFlag) {\n return;\n }\n if (this.isMasked && this.finalTransform._matMdf) {\n // Todo Benchmark if using this is better than getBBox\n this.svgElement.setAttribute('viewBox', -this.finalTransform.mProp.p.v[0] + ' ' + -this.finalTransform.mProp.p.v[1] + ' ' + this.compW + ' ' + this.compH);\n svgStyle = this.svgElement.style;\n var translation = 'translate(' + -this.finalTransform.mProp.p.v[0] + 'px,' + -this.finalTransform.mProp.p.v[1] + 'px)';\n svgStyle.transform = translation;\n svgStyle.webkitTransform = translation;\n }\n }\n this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);\n if (!this.lettersChangedFlag && !this.textAnimator.lettersChangedFlag) {\n return;\n }\n var i;\n var len;\n var count = 0;\n var renderedLetters = this.textAnimator.renderedLetters;\n var letters = this.textProperty.currentData.l;\n len = letters.length;\n var renderedLetter;\n var textSpan;\n var textPath;\n for (i = 0; i < len; i += 1) {\n if (letters[i].n) {\n count += 1;\n } else {\n textSpan = this.textSpans[i];\n textPath = this.textPaths[i];\n renderedLetter = renderedLetters[count];\n count += 1;\n if (renderedLetter._mdf.m) {\n if (!this.isMasked) {\n textSpan.style.webkitTransform = renderedLetter.m;\n textSpan.style.transform = renderedLetter.m;\n } else {\n textSpan.setAttribute('transform', renderedLetter.m);\n }\n }\n /// /textSpan.setAttribute('opacity',renderedLetter.o);\n textSpan.style.opacity = renderedLetter.o;\n if (renderedLetter.sw && renderedLetter._mdf.sw) {\n textPath.setAttribute('stroke-width', renderedLetter.sw);\n }\n if (renderedLetter.sc && renderedLetter._mdf.sc) {\n textPath.setAttribute('stroke', renderedLetter.sc);\n }\n if (renderedLetter.fc && renderedLetter._mdf.fc) {\n textPath.setAttribute('fill', renderedLetter.fc);\n textPath.style.color = renderedLetter.fc;\n }\n }\n }\n if (this.innerElem.getBBox && !this.hidden && (this._isFirstFrame || this._mdf)) {\n var boundingBox = this.innerElem.getBBox();\n if (this.currentBBox.w !== boundingBox.width) {\n this.currentBBox.w = boundingBox.width;\n this.svgElement.setAttribute('width', boundingBox.width);\n }\n if (this.currentBBox.h !== boundingBox.height) {\n this.currentBBox.h = boundingBox.height;\n this.svgElement.setAttribute('height', boundingBox.height);\n }\n var margin = 1;\n if (this.currentBBox.w !== boundingBox.width + margin * 2 || this.currentBBox.h !== boundingBox.height + margin * 2 || this.currentBBox.x !== boundingBox.x - margin || this.currentBBox.y !== boundingBox.y - margin) {\n this.currentBBox.w = boundingBox.width + margin * 2;\n this.currentBBox.h = boundingBox.height + margin * 2;\n this.currentBBox.x = boundingBox.x - margin;\n this.currentBBox.y = boundingBox.y - margin;\n this.svgElement.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);\n svgStyle = this.svgElement.style;\n var svgTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';\n svgStyle.transform = svgTransform;\n svgStyle.webkitTransform = svgTransform;\n }\n }\n };\n\n function HCameraElement(data, globalData, comp) {\n this.initFrame();\n this.initBaseData(data, globalData, comp);\n this.initHierarchy();\n var getProp = PropertyFactory.getProp;\n this.pe = getProp(this, data.pe, 0, 0, this);\n if (data.ks.p.s) {\n this.px = getProp(this, data.ks.p.x, 1, 0, this);\n this.py = getProp(this, data.ks.p.y, 1, 0, this);\n this.pz = getProp(this, data.ks.p.z, 1, 0, this);\n } else {\n this.p = getProp(this, data.ks.p, 1, 0, this);\n }\n if (data.ks.a) {\n this.a = getProp(this, data.ks.a, 1, 0, this);\n }\n if (data.ks.or.k.length && data.ks.or.k[0].to) {\n var i;\n var len = data.ks.or.k.length;\n for (i = 0; i < len; i += 1) {\n data.ks.or.k[i].to = null;\n data.ks.or.k[i].ti = null;\n }\n }\n this.or = getProp(this, data.ks.or, 1, degToRads, this);\n this.or.sh = true;\n this.rx = getProp(this, data.ks.rx, 0, degToRads, this);\n this.ry = getProp(this, data.ks.ry, 0, degToRads, this);\n this.rz = getProp(this, data.ks.rz, 0, degToRads, this);\n this.mat = new Matrix();\n this._prevMat = new Matrix();\n this._isFirstFrame = true;\n\n // TODO: find a better way to make the HCamera element to be compatible with the LayerInterface and TransformInterface.\n this.finalTransform = {\n mProp: this\n };\n }\n extendPrototype([BaseElement, FrameElement, HierarchyElement], HCameraElement);\n HCameraElement.prototype.setup = function () {\n var i;\n var len = this.comp.threeDElements.length;\n var comp;\n var perspectiveStyle;\n var containerStyle;\n for (i = 0; i < len; i += 1) {\n // [perspectiveElem,container]\n comp = this.comp.threeDElements[i];\n if (comp.type === '3d') {\n perspectiveStyle = comp.perspectiveElem.style;\n containerStyle = comp.container.style;\n var perspective = this.pe.v + 'px';\n var origin = '0px 0px 0px';\n var matrix = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';\n perspectiveStyle.perspective = perspective;\n perspectiveStyle.webkitPerspective = perspective;\n containerStyle.transformOrigin = origin;\n containerStyle.mozTransformOrigin = origin;\n containerStyle.webkitTransformOrigin = origin;\n perspectiveStyle.transform = matrix;\n perspectiveStyle.webkitTransform = matrix;\n }\n }\n };\n HCameraElement.prototype.createElements = function () {};\n HCameraElement.prototype.hide = function () {};\n HCameraElement.prototype.renderFrame = function () {\n var _mdf = this._isFirstFrame;\n var i;\n var len;\n if (this.hierarchy) {\n len = this.hierarchy.length;\n for (i = 0; i < len; i += 1) {\n _mdf = this.hierarchy[i].finalTransform.mProp._mdf || _mdf;\n }\n }\n if (_mdf || this.pe._mdf || this.p && this.p._mdf || this.px && (this.px._mdf || this.py._mdf || this.pz._mdf) || this.rx._mdf || this.ry._mdf || this.rz._mdf || this.or._mdf || this.a && this.a._mdf) {\n this.mat.reset();\n if (this.hierarchy) {\n len = this.hierarchy.length - 1;\n for (i = len; i >= 0; i -= 1) {\n var mTransf = this.hierarchy[i].finalTransform.mProp;\n this.mat.translate(-mTransf.p.v[0], -mTransf.p.v[1], mTransf.p.v[2]);\n this.mat.rotateX(-mTransf.or.v[0]).rotateY(-mTransf.or.v[1]).rotateZ(mTransf.or.v[2]);\n this.mat.rotateX(-mTransf.rx.v).rotateY(-mTransf.ry.v).rotateZ(mTransf.rz.v);\n this.mat.scale(1 / mTransf.s.v[0], 1 / mTransf.s.v[1], 1 / mTransf.s.v[2]);\n this.mat.translate(mTransf.a.v[0], mTransf.a.v[1], mTransf.a.v[2]);\n }\n }\n if (this.p) {\n this.mat.translate(-this.p.v[0], -this.p.v[1], this.p.v[2]);\n } else {\n this.mat.translate(-this.px.v, -this.py.v, this.pz.v);\n }\n if (this.a) {\n var diffVector;\n if (this.p) {\n diffVector = [this.p.v[0] - this.a.v[0], this.p.v[1] - this.a.v[1], this.p.v[2] - this.a.v[2]];\n } else {\n diffVector = [this.px.v - this.a.v[0], this.py.v - this.a.v[1], this.pz.v - this.a.v[2]];\n }\n var mag = Math.sqrt(Math.pow(diffVector[0], 2) + Math.pow(diffVector[1], 2) + Math.pow(diffVector[2], 2));\n // var lookDir = getNormalizedPoint(getDiffVector(this.a.v,this.p.v));\n var lookDir = [diffVector[0] / mag, diffVector[1] / mag, diffVector[2] / mag];\n var lookLengthOnXZ = Math.sqrt(lookDir[2] * lookDir[2] + lookDir[0] * lookDir[0]);\n var mRotationX = Math.atan2(lookDir[1], lookLengthOnXZ);\n var mRotationY = Math.atan2(lookDir[0], -lookDir[2]);\n this.mat.rotateY(mRotationY).rotateX(-mRotationX);\n }\n this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v);\n this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]);\n this.mat.translate(this.globalData.compSize.w / 2, this.globalData.compSize.h / 2, 0);\n this.mat.translate(0, 0, this.pe.v);\n var hasMatrixChanged = !this._prevMat.equals(this.mat);\n if ((hasMatrixChanged || this.pe._mdf) && this.comp.threeDElements) {\n len = this.comp.threeDElements.length;\n var comp;\n var perspectiveStyle;\n var containerStyle;\n for (i = 0; i < len; i += 1) {\n comp = this.comp.threeDElements[i];\n if (comp.type === '3d') {\n if (hasMatrixChanged) {\n var matValue = this.mat.toCSS();\n containerStyle = comp.container.style;\n containerStyle.transform = matValue;\n containerStyle.webkitTransform = matValue;\n }\n if (this.pe._mdf) {\n perspectiveStyle = comp.perspectiveElem.style;\n perspectiveStyle.perspective = this.pe.v + 'px';\n perspectiveStyle.webkitPerspective = this.pe.v + 'px';\n }\n }\n }\n this.mat.clone(this._prevMat);\n }\n }\n this._isFirstFrame = false;\n };\n HCameraElement.prototype.prepareFrame = function (num) {\n this.prepareProperties(num, true);\n };\n HCameraElement.prototype.destroy = function () {};\n HCameraElement.prototype.getBaseElement = function () {\n return null;\n };\n\n function HImageElement(data, globalData, comp) {\n this.assetData = globalData.getAssetData(data.refId);\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, HBaseElement, HSolidElement, HierarchyElement, FrameElement, RenderableElement], HImageElement);\n HImageElement.prototype.createContent = function () {\n var assetPath = this.globalData.getAssetsPath(this.assetData);\n var img = new Image();\n if (this.data.hasMask) {\n this.imageElem = createNS('image');\n this.imageElem.setAttribute('width', this.assetData.w + 'px');\n this.imageElem.setAttribute('height', this.assetData.h + 'px');\n this.imageElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);\n this.layerElement.appendChild(this.imageElem);\n this.baseElement.setAttribute('width', this.assetData.w);\n this.baseElement.setAttribute('height', this.assetData.h);\n } else {\n this.layerElement.appendChild(img);\n }\n img.crossOrigin = 'anonymous';\n img.src = assetPath;\n if (this.data.ln) {\n this.baseElement.setAttribute('id', this.data.ln);\n }\n };\n\n function HybridRendererBase(animationItem, config) {\n this.animationItem = animationItem;\n this.layers = null;\n this.renderedFrame = -1;\n this.renderConfig = {\n className: config && config.className || '',\n imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice',\n hideOnTransparent: !(config && config.hideOnTransparent === false),\n filterSize: {\n width: config && config.filterSize && config.filterSize.width || '400%',\n height: config && config.filterSize && config.filterSize.height || '400%',\n x: config && config.filterSize && config.filterSize.x || '-100%',\n y: config && config.filterSize && config.filterSize.y || '-100%'\n }\n };\n this.globalData = {\n _mdf: false,\n frameNum: -1,\n renderConfig: this.renderConfig\n };\n this.pendingElements = [];\n this.elements = [];\n this.threeDElements = [];\n this.destroyed = false;\n this.camera = null;\n this.supports3d = true;\n this.rendererType = 'html';\n }\n extendPrototype([BaseRenderer], HybridRendererBase);\n HybridRendererBase.prototype.buildItem = SVGRenderer.prototype.buildItem;\n HybridRendererBase.prototype.checkPendingElements = function () {\n while (this.pendingElements.length) {\n var element = this.pendingElements.pop();\n element.checkParenting();\n }\n };\n HybridRendererBase.prototype.appendElementInPos = function (element, pos) {\n var newDOMElement = element.getBaseElement();\n if (!newDOMElement) {\n return;\n }\n var layer = this.layers[pos];\n if (!layer.ddd || !this.supports3d) {\n if (this.threeDElements) {\n this.addTo3dContainer(newDOMElement, pos);\n } else {\n var i = 0;\n var nextDOMElement;\n var nextLayer;\n var tmpDOMElement;\n while (i < pos) {\n if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement) {\n nextLayer = this.elements[i];\n tmpDOMElement = this.layers[i].ddd ? this.getThreeDContainerByPos(i) : nextLayer.getBaseElement();\n nextDOMElement = tmpDOMElement || nextDOMElement;\n }\n i += 1;\n }\n if (nextDOMElement) {\n if (!layer.ddd || !this.supports3d) {\n this.layerElement.insertBefore(newDOMElement, nextDOMElement);\n }\n } else if (!layer.ddd || !this.supports3d) {\n this.layerElement.appendChild(newDOMElement);\n }\n }\n } else {\n this.addTo3dContainer(newDOMElement, pos);\n }\n };\n HybridRendererBase.prototype.createShape = function (data) {\n if (!this.supports3d) {\n return new SVGShapeElement(data, this.globalData, this);\n }\n return new HShapeElement(data, this.globalData, this);\n };\n HybridRendererBase.prototype.createText = function (data) {\n if (!this.supports3d) {\n return new SVGTextLottieElement(data, this.globalData, this);\n }\n return new HTextElement(data, this.globalData, this);\n };\n HybridRendererBase.prototype.createCamera = function (data) {\n this.camera = new HCameraElement(data, this.globalData, this);\n return this.camera;\n };\n HybridRendererBase.prototype.createImage = function (data) {\n if (!this.supports3d) {\n return new IImageElement(data, this.globalData, this);\n }\n return new HImageElement(data, this.globalData, this);\n };\n HybridRendererBase.prototype.createSolid = function (data) {\n if (!this.supports3d) {\n return new ISolidElement(data, this.globalData, this);\n }\n return new HSolidElement(data, this.globalData, this);\n };\n HybridRendererBase.prototype.createNull = SVGRenderer.prototype.createNull;\n HybridRendererBase.prototype.getThreeDContainerByPos = function (pos) {\n var i = 0;\n var len = this.threeDElements.length;\n while (i < len) {\n if (this.threeDElements[i].startPos <= pos && this.threeDElements[i].endPos >= pos) {\n return this.threeDElements[i].perspectiveElem;\n }\n i += 1;\n }\n return null;\n };\n HybridRendererBase.prototype.createThreeDContainer = function (pos, type) {\n var perspectiveElem = createTag('div');\n var style;\n var containerStyle;\n styleDiv(perspectiveElem);\n var container = createTag('div');\n styleDiv(container);\n if (type === '3d') {\n style = perspectiveElem.style;\n style.width = this.globalData.compSize.w + 'px';\n style.height = this.globalData.compSize.h + 'px';\n var center = '50% 50%';\n style.webkitTransformOrigin = center;\n style.mozTransformOrigin = center;\n style.transformOrigin = center;\n containerStyle = container.style;\n var matrix = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';\n containerStyle.transform = matrix;\n containerStyle.webkitTransform = matrix;\n }\n perspectiveElem.appendChild(container);\n // this.resizerElem.appendChild(perspectiveElem);\n var threeDContainerData = {\n container: container,\n perspectiveElem: perspectiveElem,\n startPos: pos,\n endPos: pos,\n type: type\n };\n this.threeDElements.push(threeDContainerData);\n return threeDContainerData;\n };\n HybridRendererBase.prototype.build3dContainers = function () {\n var i;\n var len = this.layers.length;\n var lastThreeDContainerData;\n var currentContainer = '';\n for (i = 0; i < len; i += 1) {\n if (this.layers[i].ddd && this.layers[i].ty !== 3) {\n if (currentContainer !== '3d') {\n currentContainer = '3d';\n lastThreeDContainerData = this.createThreeDContainer(i, '3d');\n }\n lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);\n } else {\n if (currentContainer !== '2d') {\n currentContainer = '2d';\n lastThreeDContainerData = this.createThreeDContainer(i, '2d');\n }\n lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);\n }\n }\n len = this.threeDElements.length;\n for (i = len - 1; i >= 0; i -= 1) {\n this.resizerElem.appendChild(this.threeDElements[i].perspectiveElem);\n }\n };\n HybridRendererBase.prototype.addTo3dContainer = function (elem, pos) {\n var i = 0;\n var len = this.threeDElements.length;\n while (i < len) {\n if (pos <= this.threeDElements[i].endPos) {\n var j = this.threeDElements[i].startPos;\n var nextElement;\n while (j < pos) {\n if (this.elements[j] && this.elements[j].getBaseElement) {\n nextElement = this.elements[j].getBaseElement();\n }\n j += 1;\n }\n if (nextElement) {\n this.threeDElements[i].container.insertBefore(elem, nextElement);\n } else {\n this.threeDElements[i].container.appendChild(elem);\n }\n break;\n }\n i += 1;\n }\n };\n HybridRendererBase.prototype.configAnimation = function (animData) {\n var resizerElem = createTag('div');\n var wrapper = this.animationItem.wrapper;\n var style = resizerElem.style;\n style.width = animData.w + 'px';\n style.height = animData.h + 'px';\n this.resizerElem = resizerElem;\n styleDiv(resizerElem);\n style.transformStyle = 'flat';\n style.mozTransformStyle = 'flat';\n style.webkitTransformStyle = 'flat';\n if (this.renderConfig.className) {\n resizerElem.setAttribute('class', this.renderConfig.className);\n }\n wrapper.appendChild(resizerElem);\n style.overflow = 'hidden';\n var svg = createNS('svg');\n svg.setAttribute('width', '1');\n svg.setAttribute('height', '1');\n styleDiv(svg);\n this.resizerElem.appendChild(svg);\n var defs = createNS('defs');\n svg.appendChild(defs);\n this.data = animData;\n // Mask animation\n this.setupGlobalData(animData, svg);\n this.globalData.defs = defs;\n this.layers = animData.layers;\n this.layerElement = this.resizerElem;\n this.build3dContainers();\n this.updateContainerSize();\n };\n HybridRendererBase.prototype.destroy = function () {\n if (this.animationItem.wrapper) {\n this.animationItem.wrapper.innerText = '';\n }\n this.animationItem.container = null;\n this.globalData.defs = null;\n var i;\n var len = this.layers ? this.layers.length : 0;\n for (i = 0; i < len; i += 1) {\n if (this.elements[i] && this.elements[i].destroy) {\n this.elements[i].destroy();\n }\n }\n this.elements.length = 0;\n this.destroyed = true;\n this.animationItem = null;\n };\n HybridRendererBase.prototype.updateContainerSize = function () {\n var elementWidth = this.animationItem.wrapper.offsetWidth;\n var elementHeight = this.animationItem.wrapper.offsetHeight;\n var elementRel = elementWidth / elementHeight;\n var animationRel = this.globalData.compSize.w / this.globalData.compSize.h;\n var sx;\n var sy;\n var tx;\n var ty;\n if (animationRel > elementRel) {\n sx = elementWidth / this.globalData.compSize.w;\n sy = elementWidth / this.globalData.compSize.w;\n tx = 0;\n ty = (elementHeight - this.globalData.compSize.h * (elementWidth / this.globalData.compSize.w)) / 2;\n } else {\n sx = elementHeight / this.globalData.compSize.h;\n sy = elementHeight / this.globalData.compSize.h;\n tx = (elementWidth - this.globalData.compSize.w * (elementHeight / this.globalData.compSize.h)) / 2;\n ty = 0;\n }\n var style = this.resizerElem.style;\n style.webkitTransform = 'matrix3d(' + sx + ',0,0,0,0,' + sy + ',0,0,0,0,1,0,' + tx + ',' + ty + ',0,1)';\n style.transform = style.webkitTransform;\n };\n HybridRendererBase.prototype.renderFrame = SVGRenderer.prototype.renderFrame;\n HybridRendererBase.prototype.hide = function () {\n this.resizerElem.style.display = 'none';\n };\n HybridRendererBase.prototype.show = function () {\n this.resizerElem.style.display = 'block';\n };\n HybridRendererBase.prototype.initItems = function () {\n this.buildAllItems();\n if (this.camera) {\n this.camera.setup();\n } else {\n var cWidth = this.globalData.compSize.w;\n var cHeight = this.globalData.compSize.h;\n var i;\n var len = this.threeDElements.length;\n for (i = 0; i < len; i += 1) {\n var style = this.threeDElements[i].perspectiveElem.style;\n style.webkitPerspective = Math.sqrt(Math.pow(cWidth, 2) + Math.pow(cHeight, 2)) + 'px';\n style.perspective = style.webkitPerspective;\n }\n }\n };\n HybridRendererBase.prototype.searchExtraCompositions = function (assets) {\n var i;\n var len = assets.length;\n var floatingContainer = createTag('div');\n for (i = 0; i < len; i += 1) {\n if (assets[i].xt) {\n var comp = this.createComp(assets[i], floatingContainer, this.globalData.comp, null);\n comp.initExpressions();\n this.globalData.projectInterface.registerComposition(comp);\n }\n }\n };\n\n function HCompElement(data, globalData, comp) {\n this.layers = data.layers;\n this.supports3d = !data.hasMask;\n this.completeLayers = false;\n this.pendingElements = [];\n this.elements = this.layers ? createSizedArray(this.layers.length) : [];\n this.initElement(data, globalData, comp);\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {\n _placeholder: true\n };\n }\n extendPrototype([HybridRendererBase, ICompElement, HBaseElement], HCompElement);\n HCompElement.prototype._createBaseContainerElements = HCompElement.prototype.createContainerElements;\n HCompElement.prototype.createContainerElements = function () {\n this._createBaseContainerElements();\n // divElement.style.clip = 'rect(0px, '+this.data.w+'px, '+this.data.h+'px, 0px)';\n if (this.data.hasMask) {\n this.svgElement.setAttribute('width', this.data.w);\n this.svgElement.setAttribute('height', this.data.h);\n this.transformedElement = this.baseElement;\n } else {\n this.transformedElement = this.layerElement;\n }\n };\n HCompElement.prototype.addTo3dContainer = function (elem, pos) {\n var j = 0;\n var nextElement;\n while (j < pos) {\n if (this.elements[j] && this.elements[j].getBaseElement) {\n nextElement = this.elements[j].getBaseElement();\n }\n j += 1;\n }\n if (nextElement) {\n this.layerElement.insertBefore(elem, nextElement);\n } else {\n this.layerElement.appendChild(elem);\n }\n };\n HCompElement.prototype.createComp = function (data) {\n if (!this.supports3d) {\n return new SVGCompElement(data, this.globalData, this);\n }\n return new HCompElement(data, this.globalData, this);\n };\n\n function HybridRenderer(animationItem, config) {\n this.animationItem = animationItem;\n this.layers = null;\n this.renderedFrame = -1;\n this.renderConfig = {\n className: config && config.className || '',\n imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice',\n hideOnTransparent: !(config && config.hideOnTransparent === false),\n filterSize: {\n width: config && config.filterSize && config.filterSize.width || '400%',\n height: config && config.filterSize && config.filterSize.height || '400%',\n x: config && config.filterSize && config.filterSize.x || '-100%',\n y: config && config.filterSize && config.filterSize.y || '-100%'\n },\n runExpressions: !config || config.runExpressions === undefined || config.runExpressions\n };\n this.globalData = {\n _mdf: false,\n frameNum: -1,\n renderConfig: this.renderConfig\n };\n this.pendingElements = [];\n this.elements = [];\n this.threeDElements = [];\n this.destroyed = false;\n this.camera = null;\n this.supports3d = true;\n this.rendererType = 'html';\n }\n extendPrototype([HybridRendererBase], HybridRenderer);\n HybridRenderer.prototype.createComp = function (data) {\n if (!this.supports3d) {\n return new SVGCompElement(data, this.globalData, this);\n }\n return new HCompElement(data, this.globalData, this);\n };\n\n var CompExpressionInterface = function () {\n return function (comp) {\n function _thisLayerFunction(name) {\n var i = 0;\n var len = comp.layers.length;\n while (i < len) {\n if (comp.layers[i].nm === name || comp.layers[i].ind === name) {\n return comp.elements[i].layerInterface;\n }\n i += 1;\n }\n return null;\n // return {active:false};\n }\n Object.defineProperty(_thisLayerFunction, '_name', {\n value: comp.data.nm\n });\n _thisLayerFunction.layer = _thisLayerFunction;\n _thisLayerFunction.pixelAspect = 1;\n _thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h;\n _thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w;\n _thisLayerFunction.pixelAspect = 1;\n _thisLayerFunction.frameDuration = 1 / comp.globalData.frameRate;\n _thisLayerFunction.displayStartTime = 0;\n _thisLayerFunction.numLayers = comp.layers.length;\n return _thisLayerFunction;\n };\n }();\n\n function _typeof$2(o) { \"@babel/helpers - typeof\"; return _typeof$2 = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof$2(o); }\n /* eslint-disable */\n /*\n Copyright 2014 David Bau.\n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to\n permit persons to whom the Software is furnished to do so, subject to\n the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n */\n\n function seedRandom(pool, math) {\n //\n // The following constants are related to IEEE 754 limits.\n //\n var global = this,\n width = 256,\n // each RC4 output is 0 <= x < 256\n chunks = 6,\n // at least six RC4 outputs for each double\n digits = 52,\n // there are 52 significant digits in a double\n rngname = 'random',\n // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n\n //\n // seedrandom()\n // This is the seedrandom function described above.\n //\n function seedrandom(seed, options, callback) {\n var key = [];\n options = options === true ? {\n entropy: true\n } : options || {};\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(flatten(options.entropy ? [seed, tostring(pool)] : seed === null ? autoseed() : seed, 3), key);\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key);\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function prng() {\n var n = arc4.g(chunks),\n // Start with a numerator n < 2 ^ 48\n d = startdenom,\n // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n while (n < significance) {\n // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n d *= width; // denominator and generating a\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) {\n // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n d /= 2; // right using integer math until\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n prng.int32 = function () {\n return arc4.g(4) | 0;\n };\n prng.quick = function () {\n return arc4.g(4) / 0x100000000;\n };\n prng[\"double\"] = prng;\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool);\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (options.pass || callback || function (prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) {\n copy(state, arc4);\n }\n // Only provide the .state method if requested via options.state.\n prng.state = function () {\n return copy(arc4, {});\n };\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) {\n math[rngname] = prng;\n return seed;\n }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(prng, shortseed, 'global' in options ? options.global : this == math, options.state);\n }\n math['seed' + rngname] = seedrandom;\n\n //\n // ARC4\n //\n // An ARC4 implementation. The constructor takes a key in the form of\n // an array of at most (width) integers that should be 0 <= x < (width).\n //\n // The g(count) method returns a pseudorandom integer that concatenates\n // the next (count) outputs from ARC4. Its return value is a number x\n // that is in the range 0 <= x < (width ^ count).\n //\n function ARC4(key) {\n var t,\n keylen = key.length,\n me = this,\n i = 0,\n j = me.i = me.j = 0,\n s = me.S = [];\n\n // The empty key [] is treated as [0].\n if (!keylen) {\n key = [keylen++];\n }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & j + key[i % keylen] + (t = s[i])];\n s[j] = t;\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n me.g = function (count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t,\n r = 0,\n i = me.i,\n j = me.j,\n s = me.S;\n while (count--) {\n t = s[i = mask & i + 1];\n r = r * width + s[mask & (s[i] = s[j = mask & j + t]) + (s[j] = t)];\n }\n me.i = i;\n me.j = j;\n return r;\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n };\n }\n\n //\n // copy()\n // Copies internal state of ARC4 to or from a plain object.\n //\n function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n }\n\n //\n // flatten()\n // Converts an object tree to nested arrays of strings.\n //\n function flatten(obj, depth) {\n var result = [],\n typ = _typeof$2(obj),\n prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try {\n result.push(flatten(obj[prop], depth - 1));\n } catch (e) {}\n }\n }\n return result.length ? result : typ == 'string' ? obj : obj + '\\0';\n }\n\n //\n // mixkey()\n // Mixes a string seed into a key that is an array of integers, and\n // returns a shortened string seed that is equivalent to the result key.\n //\n function mixkey(seed, key) {\n var stringseed = seed + '',\n smear,\n j = 0;\n while (j < stringseed.length) {\n key[mask & j] = mask & (smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++);\n }\n return tostring(key);\n }\n\n //\n // autoseed()\n // Returns an object for autoseeding, using window.crypto and Node crypto\n // module if available.\n //\n function autoseed() {\n try {\n if (nodecrypto) {\n return tostring(nodecrypto.randomBytes(width));\n }\n var out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date(), global, plugins, global.screen, tostring(pool)];\n }\n }\n\n //\n // tostring()\n // Converts an array of charcodes to a string\n //\n function tostring(a) {\n return String.fromCharCode.apply(0, a);\n }\n\n //\n // When seedrandom.js is loaded, we immediately mix a few bits\n // from the built-in RNG into the entropy pool. Because we do\n // not want to interfere with deterministic PRNG state later,\n // seedrandom will not call math.random on its own again after\n // initialization.\n //\n mixkey(math.random(), pool);\n\n //\n // Nodejs and AMD support: export the implementation as a module using\n // either convention.\n //\n\n // End anonymous scope, and pass initial values.\n }\n ;\n function initialize$2(BMMath) {\n seedRandom([], BMMath);\n }\n\n var propTypes = {\n SHAPE: 'shape'\n };\n\n function _typeof$1(o) { \"@babel/helpers - typeof\"; return _typeof$1 = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof$1(o); }\n var ExpressionManager = function () {\n 'use strict';\n\n var ob = {};\n var Math = BMMath;\n var window = null;\n var document = null;\n var XMLHttpRequest = null;\n var fetch = null;\n var frames = null;\n var _lottieGlobal = {};\n initialize$2(BMMath);\n function resetFrame() {\n _lottieGlobal = {};\n }\n function $bm_isInstanceOfArray(arr) {\n return arr.constructor === Array || arr.constructor === Float32Array;\n }\n function isNumerable(tOfV, v) {\n return tOfV === 'number' || v instanceof Number || tOfV === 'boolean' || tOfV === 'string';\n }\n function $bm_neg(a) {\n var tOfA = _typeof$1(a);\n if (tOfA === 'number' || a instanceof Number || tOfA === 'boolean') {\n return -a;\n }\n if ($bm_isInstanceOfArray(a)) {\n var i;\n var lenA = a.length;\n var retArr = [];\n for (i = 0; i < lenA; i += 1) {\n retArr[i] = -a[i];\n }\n return retArr;\n }\n if (a.propType) {\n return a.v;\n }\n return -a;\n }\n var easeInBez = BezierFactory.getBezierEasing(0.333, 0, 0.833, 0.833, 'easeIn').get;\n var easeOutBez = BezierFactory.getBezierEasing(0.167, 0.167, 0.667, 1, 'easeOut').get;\n var easeInOutBez = BezierFactory.getBezierEasing(0.33, 0, 0.667, 1, 'easeInOut').get;\n function sum(a, b) {\n var tOfA = _typeof$1(a);\n var tOfB = _typeof$1(b);\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b) || tOfA === 'string' || tOfB === 'string') {\n return a + b;\n }\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n a = a.slice(0);\n a[0] += b;\n return a;\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n b = b.slice(0);\n b[0] = a + b[0];\n return b;\n }\n if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {\n var i = 0;\n var lenA = a.length;\n var lenB = b.length;\n var retArr = [];\n while (i < lenA || i < lenB) {\n if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {\n retArr[i] = a[i] + b[i];\n } else {\n retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];\n }\n i += 1;\n }\n return retArr;\n }\n return 0;\n }\n var add = sum;\n function sub(a, b) {\n var tOfA = _typeof$1(a);\n var tOfB = _typeof$1(b);\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n if (tOfA === 'string') {\n a = parseInt(a, 10);\n }\n if (tOfB === 'string') {\n b = parseInt(b, 10);\n }\n return a - b;\n }\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n a = a.slice(0);\n a[0] -= b;\n return a;\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n b = b.slice(0);\n b[0] = a - b[0];\n return b;\n }\n if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {\n var i = 0;\n var lenA = a.length;\n var lenB = b.length;\n var retArr = [];\n while (i < lenA || i < lenB) {\n if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {\n retArr[i] = a[i] - b[i];\n } else {\n retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];\n }\n i += 1;\n }\n return retArr;\n }\n return 0;\n }\n function mul(a, b) {\n var tOfA = _typeof$1(a);\n var tOfB = _typeof$1(b);\n var arr;\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n return a * b;\n }\n var i;\n var len;\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n len = a.length;\n arr = createTypedArray('float32', len);\n for (i = 0; i < len; i += 1) {\n arr[i] = a[i] * b;\n }\n return arr;\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n len = b.length;\n arr = createTypedArray('float32', len);\n for (i = 0; i < len; i += 1) {\n arr[i] = a * b[i];\n }\n return arr;\n }\n return 0;\n }\n function div(a, b) {\n var tOfA = _typeof$1(a);\n var tOfB = _typeof$1(b);\n var arr;\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n return a / b;\n }\n var i;\n var len;\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n len = a.length;\n arr = createTypedArray('float32', len);\n for (i = 0; i < len; i += 1) {\n arr[i] = a[i] / b;\n }\n return arr;\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n len = b.length;\n arr = createTypedArray('float32', len);\n for (i = 0; i < len; i += 1) {\n arr[i] = a / b[i];\n }\n return arr;\n }\n return 0;\n }\n function mod(a, b) {\n if (typeof a === 'string') {\n a = parseInt(a, 10);\n }\n if (typeof b === 'string') {\n b = parseInt(b, 10);\n }\n return a % b;\n }\n var $bm_sum = sum;\n var $bm_sub = sub;\n var $bm_mul = mul;\n var $bm_div = div;\n var $bm_mod = mod;\n function clamp(num, min, max) {\n if (min > max) {\n var mm = max;\n max = min;\n min = mm;\n }\n return Math.min(Math.max(num, min), max);\n }\n function radiansToDegrees(val) {\n return val / degToRads;\n }\n var radians_to_degrees = radiansToDegrees;\n function degreesToRadians(val) {\n return val * degToRads;\n }\n var degrees_to_radians = radiansToDegrees;\n var helperLengthArray = [0, 0, 0, 0, 0, 0];\n function length(arr1, arr2) {\n if (typeof arr1 === 'number' || arr1 instanceof Number) {\n arr2 = arr2 || 0;\n return Math.abs(arr1 - arr2);\n }\n if (!arr2) {\n arr2 = helperLengthArray;\n }\n var i;\n var len = Math.min(arr1.length, arr2.length);\n var addedLength = 0;\n for (i = 0; i < len; i += 1) {\n addedLength += Math.pow(arr2[i] - arr1[i], 2);\n }\n return Math.sqrt(addedLength);\n }\n function normalize(vec) {\n return div(vec, length(vec));\n }\n function rgbToHsl(val) {\n var r = val[0];\n var g = val[1];\n var b = val[2];\n var max = Math.max(r, g, b);\n var min = Math.min(r, g, b);\n var h;\n var s;\n var l = (max + min) / 2;\n if (max === min) {\n h = 0; // achromatic\n s = 0; // achromatic\n } else {\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n default:\n break;\n }\n h /= 6;\n }\n return [h, s, l, val[3]];\n }\n function hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n }\n function hslToRgb(val) {\n var h = val[0];\n var s = val[1];\n var l = val[2];\n var r;\n var g;\n var b;\n if (s === 0) {\n r = l; // achromatic\n b = l; // achromatic\n g = l; // achromatic\n } else {\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n return [r, g, b, val[3]];\n }\n function linear(t, tMin, tMax, value1, value2) {\n if (value1 === undefined || value2 === undefined) {\n value1 = tMin;\n value2 = tMax;\n tMin = 0;\n tMax = 1;\n }\n if (tMax < tMin) {\n var _tMin = tMax;\n tMax = tMin;\n tMin = _tMin;\n }\n if (t <= tMin) {\n return value1;\n }\n if (t >= tMax) {\n return value2;\n }\n var perc = tMax === tMin ? 0 : (t - tMin) / (tMax - tMin);\n if (!value1.length) {\n return value1 + (value2 - value1) * perc;\n }\n var i;\n var len = value1.length;\n var arr = createTypedArray('float32', len);\n for (i = 0; i < len; i += 1) {\n arr[i] = value1[i] + (value2[i] - value1[i]) * perc;\n }\n return arr;\n }\n function random(min, max) {\n if (max === undefined) {\n if (min === undefined) {\n min = 0;\n max = 1;\n } else {\n max = min;\n min = undefined;\n }\n }\n if (max.length) {\n var i;\n var len = max.length;\n if (!min) {\n min = createTypedArray('float32', len);\n }\n var arr = createTypedArray('float32', len);\n var rnd = BMMath.random();\n for (i = 0; i < len; i += 1) {\n arr[i] = min[i] + rnd * (max[i] - min[i]);\n }\n return arr;\n }\n if (min === undefined) {\n min = 0;\n }\n var rndm = BMMath.random();\n return min + rndm * (max - min);\n }\n function createPath(points, inTangents, outTangents, closed) {\n var i;\n var len = points.length;\n var path = shapePool.newElement();\n path.setPathData(!!closed, len);\n var arrPlaceholder = [0, 0];\n var inVertexPoint;\n var outVertexPoint;\n for (i = 0; i < len; i += 1) {\n inVertexPoint = inTangents && inTangents[i] ? inTangents[i] : arrPlaceholder;\n outVertexPoint = outTangents && outTangents[i] ? outTangents[i] : arrPlaceholder;\n path.setTripleAt(points[i][0], points[i][1], outVertexPoint[0] + points[i][0], outVertexPoint[1] + points[i][1], inVertexPoint[0] + points[i][0], inVertexPoint[1] + points[i][1], i, true);\n }\n return path;\n }\n function initiateExpression(elem, data, property) {\n // Bail out if we don't want expressions\n function noOp(_value) {\n return _value;\n }\n if (!elem.globalData.renderConfig.runExpressions) {\n return noOp;\n }\n var val = data.x;\n var needsVelocity = /velocity(?![\\w\\d])/.test(val);\n var _needsRandom = val.indexOf('random') !== -1;\n var elemType = elem.data.ty;\n var transform;\n var $bm_transform;\n var content;\n var effect;\n var thisProperty = property;\n thisProperty._name = elem.data.nm;\n thisProperty.valueAtTime = thisProperty.getValueAtTime;\n Object.defineProperty(thisProperty, 'value', {\n get: function get() {\n return thisProperty.v;\n }\n });\n elem.comp.frameDuration = 1 / elem.comp.globalData.frameRate;\n elem.comp.displayStartTime = 0;\n var inPoint = elem.data.ip / elem.comp.globalData.frameRate;\n var outPoint = elem.data.op / elem.comp.globalData.frameRate;\n var width = elem.data.sw ? elem.data.sw : 0;\n var height = elem.data.sh ? elem.data.sh : 0;\n var name = elem.data.nm;\n var loopIn;\n var loop_in;\n var loopOut;\n var loop_out;\n var smooth;\n var toWorld;\n var fromWorld;\n var fromComp;\n var toComp;\n var fromCompToSurface;\n var position;\n var rotation;\n var anchorPoint;\n var scale;\n var thisLayer;\n var thisComp;\n var mask;\n var valueAtTime;\n var velocityAtTime;\n var scoped_bm_rt;\n // val = val.replace(/(\\\\?\"|')((http)(s)?(:\\/))?\\/.*?(\\\\?\"|')/g, \"\\\"\\\"\"); // deter potential network calls\n var expression_function = eval('[function _expression_function(){' + val + ';scoped_bm_rt=$bm_rt}]')[0]; // eslint-disable-line no-eval\n var numKeys = property.kf ? data.k.length : 0;\n var active = !this.data || this.data.hd !== true;\n var wiggle = function wiggle(freq, amp) {\n var iWiggle;\n var j;\n var lenWiggle = this.pv.length ? this.pv.length : 1;\n var addedAmps = createTypedArray('float32', lenWiggle);\n freq = 5;\n var iterations = Math.floor(time * freq);\n iWiggle = 0;\n j = 0;\n while (iWiggle < iterations) {\n // var rnd = BMMath.random();\n for (j = 0; j < lenWiggle; j += 1) {\n addedAmps[j] += -amp + amp * 2 * BMMath.random();\n // addedAmps[j] += -amp + amp*2*rnd;\n }\n iWiggle += 1;\n }\n // var rnd2 = BMMath.random();\n var periods = time * freq;\n var perc = periods - Math.floor(periods);\n var arr = createTypedArray('float32', lenWiggle);\n if (lenWiggle > 1) {\n for (j = 0; j < lenWiggle; j += 1) {\n arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp * 2 * BMMath.random()) * perc;\n // arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*rnd)*perc;\n // arr[i] = this.pv[i] + addedAmp + amp1*perc + amp2*(1-perc);\n }\n return arr;\n }\n return this.pv + addedAmps[0] + (-amp + amp * 2 * BMMath.random()) * perc;\n }.bind(this);\n if (thisProperty.loopIn) {\n loopIn = thisProperty.loopIn.bind(thisProperty);\n loop_in = loopIn;\n }\n if (thisProperty.loopOut) {\n loopOut = thisProperty.loopOut.bind(thisProperty);\n loop_out = loopOut;\n }\n if (thisProperty.smooth) {\n smooth = thisProperty.smooth.bind(thisProperty);\n }\n function loopInDuration(type, duration) {\n return loopIn(type, duration, true);\n }\n function loopOutDuration(type, duration) {\n return loopOut(type, duration, true);\n }\n if (this.getValueAtTime) {\n valueAtTime = this.getValueAtTime.bind(this);\n }\n if (this.getVelocityAtTime) {\n velocityAtTime = this.getVelocityAtTime.bind(this);\n }\n var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface);\n function lookAt(elem1, elem2) {\n var fVec = [elem2[0] - elem1[0], elem2[1] - elem1[1], elem2[2] - elem1[2]];\n var pitch = Math.atan2(fVec[0], Math.sqrt(fVec[1] * fVec[1] + fVec[2] * fVec[2])) / degToRads;\n var yaw = -Math.atan2(fVec[1], fVec[2]) / degToRads;\n return [yaw, pitch, 0];\n }\n function easeOut(t, tMin, tMax, val1, val2) {\n return applyEase(easeOutBez, t, tMin, tMax, val1, val2);\n }\n function easeIn(t, tMin, tMax, val1, val2) {\n return applyEase(easeInBez, t, tMin, tMax, val1, val2);\n }\n function ease(t, tMin, tMax, val1, val2) {\n return applyEase(easeInOutBez, t, tMin, tMax, val1, val2);\n }\n function applyEase(fn, t, tMin, tMax, val1, val2) {\n if (val1 === undefined) {\n val1 = tMin;\n val2 = tMax;\n } else {\n t = (t - tMin) / (tMax - tMin);\n }\n if (t > 1) {\n t = 1;\n } else if (t < 0) {\n t = 0;\n }\n var mult = fn(t);\n if ($bm_isInstanceOfArray(val1)) {\n var iKey;\n var lenKey = val1.length;\n var arr = createTypedArray('float32', lenKey);\n for (iKey = 0; iKey < lenKey; iKey += 1) {\n arr[iKey] = (val2[iKey] - val1[iKey]) * mult + val1[iKey];\n }\n return arr;\n }\n return (val2 - val1) * mult + val1;\n }\n function nearestKey(time) {\n var iKey;\n var lenKey = data.k.length;\n var index;\n var keyTime;\n if (!data.k.length || typeof data.k[0] === 'number') {\n index = 0;\n keyTime = 0;\n } else {\n index = -1;\n time *= elem.comp.globalData.frameRate;\n if (time < data.k[0].t) {\n index = 1;\n keyTime = data.k[0].t;\n } else {\n for (iKey = 0; iKey < lenKey - 1; iKey += 1) {\n if (time === data.k[iKey].t) {\n index = iKey + 1;\n keyTime = data.k[iKey].t;\n break;\n } else if (time > data.k[iKey].t && time < data.k[iKey + 1].t) {\n if (time - data.k[iKey].t > data.k[iKey + 1].t - time) {\n index = iKey + 2;\n keyTime = data.k[iKey + 1].t;\n } else {\n index = iKey + 1;\n keyTime = data.k[iKey].t;\n }\n break;\n }\n }\n if (index === -1) {\n index = iKey + 1;\n keyTime = data.k[iKey].t;\n }\n }\n }\n var obKey = {};\n obKey.index = index;\n obKey.time = keyTime / elem.comp.globalData.frameRate;\n return obKey;\n }\n function key(ind) {\n var obKey;\n var iKey;\n var lenKey;\n if (!data.k.length || typeof data.k[0] === 'number') {\n throw new Error('The property has no keyframe at index ' + ind);\n }\n ind -= 1;\n obKey = {\n time: data.k[ind].t / elem.comp.globalData.frameRate,\n value: []\n };\n var arr = Object.prototype.hasOwnProperty.call(data.k[ind], 's') ? data.k[ind].s : data.k[ind - 1].e;\n lenKey = arr.length;\n for (iKey = 0; iKey < lenKey; iKey += 1) {\n obKey[iKey] = arr[iKey];\n obKey.value[iKey] = arr[iKey];\n }\n return obKey;\n }\n function framesToTime(fr, fps) {\n if (!fps) {\n fps = elem.comp.globalData.frameRate;\n }\n return fr / fps;\n }\n function timeToFrames(t, fps) {\n if (!t && t !== 0) {\n t = time;\n }\n if (!fps) {\n fps = elem.comp.globalData.frameRate;\n }\n return t * fps;\n }\n function seedRandom(seed) {\n BMMath.seedrandom(randSeed + seed);\n }\n function sourceRectAtTime() {\n return elem.sourceRectAtTime();\n }\n function substring(init, end) {\n if (typeof value === 'string') {\n if (end === undefined) {\n return value.substring(init);\n }\n return value.substring(init, end);\n }\n return '';\n }\n function substr(init, end) {\n if (typeof value === 'string') {\n if (end === undefined) {\n return value.substr(init);\n }\n return value.substr(init, end);\n }\n return '';\n }\n function posterizeTime(framesPerSecond) {\n time = framesPerSecond === 0 ? 0 : Math.floor(time * framesPerSecond) / framesPerSecond;\n value = valueAtTime(time);\n }\n var time;\n var velocity;\n var value;\n var text;\n var textIndex;\n var textTotal;\n var selectorValue;\n var index = elem.data.ind;\n var hasParent = !!(elem.hierarchy && elem.hierarchy.length);\n var parent;\n var randSeed = Math.floor(Math.random() * 1000000);\n var globalData = elem.globalData;\n function executeExpression(_value) {\n // globalData.pushExpression();\n value = _value;\n if (this.frameExpressionId === elem.globalData.frameId && this.propType !== 'textSelector') {\n return value;\n }\n if (this.propType === 'textSelector') {\n textIndex = this.textIndex;\n textTotal = this.textTotal;\n selectorValue = this.selectorValue;\n }\n if (!thisLayer) {\n text = elem.layerInterface.text;\n thisLayer = elem.layerInterface;\n thisComp = elem.comp.compInterface;\n toWorld = thisLayer.toWorld.bind(thisLayer);\n fromWorld = thisLayer.fromWorld.bind(thisLayer);\n fromComp = thisLayer.fromComp.bind(thisLayer);\n toComp = thisLayer.toComp.bind(thisLayer);\n mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null;\n fromCompToSurface = fromComp;\n }\n if (!transform) {\n transform = elem.layerInterface('ADBE Transform Group');\n $bm_transform = transform;\n if (transform) {\n anchorPoint = transform.anchorPoint;\n /* position = transform.position;\n rotation = transform.rotation;\n scale = transform.scale; */\n }\n }\n if (elemType === 4 && !content) {\n content = thisLayer('ADBE Root Vectors Group');\n }\n if (!effect) {\n effect = thisLayer(4);\n }\n hasParent = !!(elem.hierarchy && elem.hierarchy.length);\n if (hasParent && !parent) {\n parent = elem.hierarchy[0].layerInterface;\n }\n time = this.comp.renderedFrame / this.comp.globalData.frameRate;\n if (_needsRandom) {\n seedRandom(randSeed + time);\n }\n if (needsVelocity) {\n velocity = velocityAtTime(time);\n }\n expression_function();\n this.frameExpressionId = elem.globalData.frameId;\n\n // TODO: Check if it's possible to return on ShapeInterface the .v value\n // Changed this to a ternary operation because Rollup failed compiling it correctly\n scoped_bm_rt = scoped_bm_rt.propType === propTypes.SHAPE ? scoped_bm_rt.v : scoped_bm_rt;\n return scoped_bm_rt;\n }\n // Bundlers will see these as dead code and unless we reference them\n executeExpression.__preventDeadCodeRemoval = [$bm_transform, anchorPoint, time, velocity, inPoint, outPoint, width, height, name, loop_in, loop_out, smooth, toComp, fromCompToSurface, toWorld, fromWorld, mask, position, rotation, scale, thisComp, numKeys, active, wiggle, loopInDuration, loopOutDuration, comp, lookAt, easeOut, easeIn, ease, nearestKey, key, text, textIndex, textTotal, selectorValue, framesToTime, timeToFrames, sourceRectAtTime, substring, substr, posterizeTime, index, globalData];\n return executeExpression;\n }\n ob.initiateExpression = initiateExpression;\n ob.__preventDeadCodeRemoval = [window, document, XMLHttpRequest, fetch, frames, $bm_neg, add, $bm_sum, $bm_sub, $bm_mul, $bm_div, $bm_mod, clamp, radians_to_degrees, degreesToRadians, degrees_to_radians, normalize, rgbToHsl, hslToRgb, linear, random, createPath, _lottieGlobal];\n ob.resetFrame = resetFrame;\n return ob;\n }();\n\n var Expressions = function () {\n var ob = {};\n ob.initExpressions = initExpressions;\n ob.resetFrame = ExpressionManager.resetFrame;\n function initExpressions(animation) {\n var stackCount = 0;\n var registers = [];\n function pushExpression() {\n stackCount += 1;\n }\n function popExpression() {\n stackCount -= 1;\n if (stackCount === 0) {\n releaseInstances();\n }\n }\n function registerExpressionProperty(expression) {\n if (registers.indexOf(expression) === -1) {\n registers.push(expression);\n }\n }\n function releaseInstances() {\n var i;\n var len = registers.length;\n for (i = 0; i < len; i += 1) {\n registers[i].release();\n }\n registers.length = 0;\n }\n animation.renderer.compInterface = CompExpressionInterface(animation.renderer);\n animation.renderer.globalData.projectInterface.registerComposition(animation.renderer);\n animation.renderer.globalData.pushExpression = pushExpression;\n animation.renderer.globalData.popExpression = popExpression;\n animation.renderer.globalData.registerExpressionProperty = registerExpressionProperty;\n }\n return ob;\n }();\n\n var MaskManagerInterface = function () {\n function MaskInterface(mask, data) {\n this._mask = mask;\n this._data = data;\n }\n Object.defineProperty(MaskInterface.prototype, 'maskPath', {\n get: function get() {\n if (this._mask.prop.k) {\n this._mask.prop.getValue();\n }\n return this._mask.prop;\n }\n });\n Object.defineProperty(MaskInterface.prototype, 'maskOpacity', {\n get: function get() {\n if (this._mask.op.k) {\n this._mask.op.getValue();\n }\n return this._mask.op.v * 100;\n }\n });\n var MaskManager = function MaskManager(maskManager) {\n var _masksInterfaces = createSizedArray(maskManager.viewData.length);\n var i;\n var len = maskManager.viewData.length;\n for (i = 0; i < len; i += 1) {\n _masksInterfaces[i] = new MaskInterface(maskManager.viewData[i], maskManager.masksProperties[i]);\n }\n var maskFunction = function maskFunction(name) {\n i = 0;\n while (i < len) {\n if (maskManager.masksProperties[i].nm === name) {\n return _masksInterfaces[i];\n }\n i += 1;\n }\n return null;\n };\n return maskFunction;\n };\n return MaskManager;\n }();\n\n var ExpressionPropertyInterface = function () {\n var defaultUnidimensionalValue = {\n pv: 0,\n v: 0,\n mult: 1\n };\n var defaultMultidimensionalValue = {\n pv: [0, 0, 0],\n v: [0, 0, 0],\n mult: 1\n };\n function completeProperty(expressionValue, property, type) {\n Object.defineProperty(expressionValue, 'velocity', {\n get: function get() {\n return property.getVelocityAtTime(property.comp.currentFrame);\n }\n });\n expressionValue.numKeys = property.keyframes ? property.keyframes.length : 0;\n expressionValue.key = function (pos) {\n if (!expressionValue.numKeys) {\n return 0;\n }\n var value = '';\n if ('s' in property.keyframes[pos - 1]) {\n value = property.keyframes[pos - 1].s;\n } else if ('e' in property.keyframes[pos - 2]) {\n value = property.keyframes[pos - 2].e;\n } else {\n value = property.keyframes[pos - 2].s;\n }\n var valueProp = type === 'unidimensional' ? new Number(value) : Object.assign({}, value); // eslint-disable-line no-new-wrappers\n valueProp.time = property.keyframes[pos - 1].t / property.elem.comp.globalData.frameRate;\n valueProp.value = type === 'unidimensional' ? value[0] : value;\n return valueProp;\n };\n expressionValue.valueAtTime = property.getValueAtTime;\n expressionValue.speedAtTime = property.getSpeedAtTime;\n expressionValue.velocityAtTime = property.getVelocityAtTime;\n expressionValue.propertyGroup = property.propertyGroup;\n }\n function UnidimensionalPropertyInterface(property) {\n if (!property || !('pv' in property)) {\n property = defaultUnidimensionalValue;\n }\n var mult = 1 / property.mult;\n var val = property.pv * mult;\n var expressionValue = new Number(val); // eslint-disable-line no-new-wrappers\n expressionValue.value = val;\n completeProperty(expressionValue, property, 'unidimensional');\n return function () {\n if (property.k) {\n property.getValue();\n }\n val = property.v * mult;\n if (expressionValue.value !== val) {\n expressionValue = new Number(val); // eslint-disable-line no-new-wrappers\n expressionValue.value = val;\n expressionValue[0] = val;\n completeProperty(expressionValue, property, 'unidimensional');\n }\n return expressionValue;\n };\n }\n function MultidimensionalPropertyInterface(property) {\n if (!property || !('pv' in property)) {\n property = defaultMultidimensionalValue;\n }\n var mult = 1 / property.mult;\n var len = property.data && property.data.l || property.pv.length;\n var expressionValue = createTypedArray('float32', len);\n var arrValue = createTypedArray('float32', len);\n expressionValue.value = arrValue;\n completeProperty(expressionValue, property, 'multidimensional');\n return function () {\n if (property.k) {\n property.getValue();\n }\n for (var i = 0; i < len; i += 1) {\n arrValue[i] = property.v[i] * mult;\n expressionValue[i] = arrValue[i];\n }\n return expressionValue;\n };\n }\n\n // TODO: try to avoid using this getter\n function defaultGetter() {\n return defaultUnidimensionalValue;\n }\n return function (property) {\n if (!property) {\n return defaultGetter;\n }\n if (property.propType === 'unidimensional') {\n return UnidimensionalPropertyInterface(property);\n }\n return MultidimensionalPropertyInterface(property);\n };\n }();\n\n var TransformExpressionInterface = function () {\n return function (transform) {\n function _thisFunction(name) {\n switch (name) {\n case 'scale':\n case 'Scale':\n case 'ADBE Scale':\n case 6:\n return _thisFunction.scale;\n case 'rotation':\n case 'Rotation':\n case 'ADBE Rotation':\n case 'ADBE Rotate Z':\n case 10:\n return _thisFunction.rotation;\n case 'ADBE Rotate X':\n return _thisFunction.xRotation;\n case 'ADBE Rotate Y':\n return _thisFunction.yRotation;\n case 'position':\n case 'Position':\n case 'ADBE Position':\n case 2:\n return _thisFunction.position;\n case 'ADBE Position_0':\n return _thisFunction.xPosition;\n case 'ADBE Position_1':\n return _thisFunction.yPosition;\n case 'ADBE Position_2':\n return _thisFunction.zPosition;\n case 'anchorPoint':\n case 'AnchorPoint':\n case 'Anchor Point':\n case 'ADBE AnchorPoint':\n case 1:\n return _thisFunction.anchorPoint;\n case 'opacity':\n case 'Opacity':\n case 11:\n return _thisFunction.opacity;\n default:\n return null;\n }\n }\n Object.defineProperty(_thisFunction, 'rotation', {\n get: ExpressionPropertyInterface(transform.r || transform.rz)\n });\n Object.defineProperty(_thisFunction, 'zRotation', {\n get: ExpressionPropertyInterface(transform.rz || transform.r)\n });\n Object.defineProperty(_thisFunction, 'xRotation', {\n get: ExpressionPropertyInterface(transform.rx)\n });\n Object.defineProperty(_thisFunction, 'yRotation', {\n get: ExpressionPropertyInterface(transform.ry)\n });\n Object.defineProperty(_thisFunction, 'scale', {\n get: ExpressionPropertyInterface(transform.s)\n });\n var _px;\n var _py;\n var _pz;\n var _transformFactory;\n if (transform.p) {\n _transformFactory = ExpressionPropertyInterface(transform.p);\n } else {\n _px = ExpressionPropertyInterface(transform.px);\n _py = ExpressionPropertyInterface(transform.py);\n if (transform.pz) {\n _pz = ExpressionPropertyInterface(transform.pz);\n }\n }\n Object.defineProperty(_thisFunction, 'position', {\n get: function get() {\n if (transform.p) {\n return _transformFactory();\n }\n return [_px(), _py(), _pz ? _pz() : 0];\n }\n });\n Object.defineProperty(_thisFunction, 'xPosition', {\n get: ExpressionPropertyInterface(transform.px)\n });\n Object.defineProperty(_thisFunction, 'yPosition', {\n get: ExpressionPropertyInterface(transform.py)\n });\n Object.defineProperty(_thisFunction, 'zPosition', {\n get: ExpressionPropertyInterface(transform.pz)\n });\n Object.defineProperty(_thisFunction, 'anchorPoint', {\n get: ExpressionPropertyInterface(transform.a)\n });\n Object.defineProperty(_thisFunction, 'opacity', {\n get: ExpressionPropertyInterface(transform.o)\n });\n Object.defineProperty(_thisFunction, 'skew', {\n get: ExpressionPropertyInterface(transform.sk)\n });\n Object.defineProperty(_thisFunction, 'skewAxis', {\n get: ExpressionPropertyInterface(transform.sa)\n });\n Object.defineProperty(_thisFunction, 'orientation', {\n get: ExpressionPropertyInterface(transform.or)\n });\n return _thisFunction;\n };\n }();\n\n var LayerExpressionInterface = function () {\n function getMatrix(time) {\n var toWorldMat = new Matrix();\n if (time !== undefined) {\n var propMatrix = this._elem.finalTransform.mProp.getValueAtTime(time);\n propMatrix.clone(toWorldMat);\n } else {\n var transformMat = this._elem.finalTransform.mProp;\n transformMat.applyToMatrix(toWorldMat);\n }\n return toWorldMat;\n }\n function toWorldVec(arr, time) {\n var toWorldMat = this.getMatrix(time);\n toWorldMat.props[12] = 0;\n toWorldMat.props[13] = 0;\n toWorldMat.props[14] = 0;\n return this.applyPoint(toWorldMat, arr);\n }\n function toWorld(arr, time) {\n var toWorldMat = this.getMatrix(time);\n return this.applyPoint(toWorldMat, arr);\n }\n function fromWorldVec(arr, time) {\n var toWorldMat = this.getMatrix(time);\n toWorldMat.props[12] = 0;\n toWorldMat.props[13] = 0;\n toWorldMat.props[14] = 0;\n return this.invertPoint(toWorldMat, arr);\n }\n function fromWorld(arr, time) {\n var toWorldMat = this.getMatrix(time);\n return this.invertPoint(toWorldMat, arr);\n }\n function applyPoint(matrix, arr) {\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\n var i;\n var len = this._elem.hierarchy.length;\n for (i = 0; i < len; i += 1) {\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix);\n }\n }\n return matrix.applyToPointArray(arr[0], arr[1], arr[2] || 0);\n }\n function invertPoint(matrix, arr) {\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\n var i;\n var len = this._elem.hierarchy.length;\n for (i = 0; i < len; i += 1) {\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix);\n }\n }\n return matrix.inversePoint(arr);\n }\n function fromComp(arr) {\n var toWorldMat = new Matrix();\n toWorldMat.reset();\n this._elem.finalTransform.mProp.applyToMatrix(toWorldMat);\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\n var i;\n var len = this._elem.hierarchy.length;\n for (i = 0; i < len; i += 1) {\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);\n }\n return toWorldMat.inversePoint(arr);\n }\n return toWorldMat.inversePoint(arr);\n }\n function sampleImage() {\n return [1, 1, 1, 1];\n }\n return function (elem) {\n var transformInterface;\n function _registerMaskInterface(maskManager) {\n _thisLayerFunction.mask = new MaskManagerInterface(maskManager, elem);\n }\n function _registerEffectsInterface(effects) {\n _thisLayerFunction.effect = effects;\n }\n function _thisLayerFunction(name) {\n switch (name) {\n case 'ADBE Root Vectors Group':\n case 'Contents':\n case 2:\n return _thisLayerFunction.shapeInterface;\n case 1:\n case 6:\n case 'Transform':\n case 'transform':\n case 'ADBE Transform Group':\n return transformInterface;\n case 4:\n case 'ADBE Effect Parade':\n case 'effects':\n case 'Effects':\n return _thisLayerFunction.effect;\n case 'ADBE Text Properties':\n return _thisLayerFunction.textInterface;\n default:\n return null;\n }\n }\n _thisLayerFunction.getMatrix = getMatrix;\n _thisLayerFunction.invertPoint = invertPoint;\n _thisLayerFunction.applyPoint = applyPoint;\n _thisLayerFunction.toWorld = toWorld;\n _thisLayerFunction.toWorldVec = toWorldVec;\n _thisLayerFunction.fromWorld = fromWorld;\n _thisLayerFunction.fromWorldVec = fromWorldVec;\n _thisLayerFunction.toComp = toWorld;\n _thisLayerFunction.fromComp = fromComp;\n _thisLayerFunction.sampleImage = sampleImage;\n _thisLayerFunction.sourceRectAtTime = elem.sourceRectAtTime.bind(elem);\n _thisLayerFunction._elem = elem;\n transformInterface = TransformExpressionInterface(elem.finalTransform.mProp);\n var anchorPointDescriptor = getDescriptor(transformInterface, 'anchorPoint');\n Object.defineProperties(_thisLayerFunction, {\n hasParent: {\n get: function get() {\n return elem.hierarchy.length;\n }\n },\n parent: {\n get: function get() {\n return elem.hierarchy[0].layerInterface;\n }\n },\n rotation: getDescriptor(transformInterface, 'rotation'),\n scale: getDescriptor(transformInterface, 'scale'),\n position: getDescriptor(transformInterface, 'position'),\n opacity: getDescriptor(transformInterface, 'opacity'),\n anchorPoint: anchorPointDescriptor,\n anchor_point: anchorPointDescriptor,\n transform: {\n get: function get() {\n return transformInterface;\n }\n },\n active: {\n get: function get() {\n return elem.isInRange;\n }\n }\n });\n _thisLayerFunction.startTime = elem.data.st;\n _thisLayerFunction.index = elem.data.ind;\n _thisLayerFunction.source = elem.data.refId;\n _thisLayerFunction.height = elem.data.ty === 0 ? elem.data.h : 100;\n _thisLayerFunction.width = elem.data.ty === 0 ? elem.data.w : 100;\n _thisLayerFunction.inPoint = elem.data.ip / elem.comp.globalData.frameRate;\n _thisLayerFunction.outPoint = elem.data.op / elem.comp.globalData.frameRate;\n _thisLayerFunction._name = elem.data.nm;\n _thisLayerFunction.registerMaskInterface = _registerMaskInterface;\n _thisLayerFunction.registerEffectsInterface = _registerEffectsInterface;\n return _thisLayerFunction;\n };\n }();\n\n var propertyGroupFactory = function () {\n return function (interfaceFunction, parentPropertyGroup) {\n return function (val) {\n val = val === undefined ? 1 : val;\n if (val <= 0) {\n return interfaceFunction;\n }\n return parentPropertyGroup(val - 1);\n };\n };\n }();\n\n var PropertyInterface = function () {\n return function (propertyName, propertyGroup) {\n var interfaceFunction = {\n _name: propertyName\n };\n function _propertyGroup(val) {\n val = val === undefined ? 1 : val;\n if (val <= 0) {\n return interfaceFunction;\n }\n return propertyGroup(val - 1);\n }\n return _propertyGroup;\n };\n }();\n\n var EffectsExpressionInterface = function () {\n var ob = {\n createEffectsInterface: createEffectsInterface\n };\n function createEffectsInterface(elem, propertyGroup) {\n if (elem.effectsManager) {\n var effectElements = [];\n var effectsData = elem.data.ef;\n var i;\n var len = elem.effectsManager.effectElements.length;\n for (i = 0; i < len; i += 1) {\n effectElements.push(createGroupInterface(effectsData[i], elem.effectsManager.effectElements[i], propertyGroup, elem));\n }\n var effects = elem.data.ef || [];\n var groupInterface = function groupInterface(name) {\n i = 0;\n len = effects.length;\n while (i < len) {\n if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {\n return effectElements[i];\n }\n i += 1;\n }\n return null;\n };\n Object.defineProperty(groupInterface, 'numProperties', {\n get: function get() {\n return effects.length;\n }\n });\n return groupInterface;\n }\n return null;\n }\n function createGroupInterface(data, elements, propertyGroup, elem) {\n function groupInterface(name) {\n var effects = data.ef;\n var i = 0;\n var len = effects.length;\n while (i < len) {\n if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {\n if (effects[i].ty === 5) {\n return effectElements[i];\n }\n return effectElements[i]();\n }\n i += 1;\n }\n throw new Error();\n }\n var _propertyGroup = propertyGroupFactory(groupInterface, propertyGroup);\n var effectElements = [];\n var i;\n var len = data.ef.length;\n for (i = 0; i < len; i += 1) {\n if (data.ef[i].ty === 5) {\n effectElements.push(createGroupInterface(data.ef[i], elements.effectElements[i], elements.effectElements[i].propertyGroup, elem));\n } else {\n effectElements.push(createValueInterface(elements.effectElements[i], data.ef[i].ty, elem, _propertyGroup));\n }\n }\n if (data.mn === 'ADBE Color Control') {\n Object.defineProperty(groupInterface, 'color', {\n get: function get() {\n return effectElements[0]();\n }\n });\n }\n Object.defineProperties(groupInterface, {\n numProperties: {\n get: function get() {\n return data.np;\n }\n },\n _name: {\n value: data.nm\n },\n propertyGroup: {\n value: _propertyGroup\n }\n });\n groupInterface.enabled = data.en !== 0;\n groupInterface.active = groupInterface.enabled;\n return groupInterface;\n }\n function createValueInterface(element, type, elem, propertyGroup) {\n var expressionProperty = ExpressionPropertyInterface(element.p);\n function interfaceFunction() {\n if (type === 10) {\n return elem.comp.compInterface(element.p.v);\n }\n return expressionProperty();\n }\n if (element.p.setGroupProperty) {\n element.p.setGroupProperty(PropertyInterface('', propertyGroup));\n }\n return interfaceFunction;\n }\n return ob;\n }();\n\n var ShapePathInterface = function () {\n return function pathInterfaceFactory(shape, view, propertyGroup) {\n var prop = view.sh;\n function interfaceFunction(val) {\n if (val === 'Shape' || val === 'shape' || val === 'Path' || val === 'path' || val === 'ADBE Vector Shape' || val === 2) {\n return interfaceFunction.path;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n prop.setGroupProperty(PropertyInterface('Path', _propertyGroup));\n Object.defineProperties(interfaceFunction, {\n path: {\n get: function get() {\n if (prop.k) {\n prop.getValue();\n }\n return prop;\n }\n },\n shape: {\n get: function get() {\n if (prop.k) {\n prop.getValue();\n }\n return prop;\n }\n },\n _name: {\n value: shape.nm\n },\n ix: {\n value: shape.ix\n },\n propertyIndex: {\n value: shape.ix\n },\n mn: {\n value: shape.mn\n },\n propertyGroup: {\n value: propertyGroup\n }\n });\n return interfaceFunction;\n };\n }();\n\n var ShapeExpressionInterface = function () {\n function iterateElements(shapes, view, propertyGroup) {\n var arr = [];\n var i;\n var len = shapes ? shapes.length : 0;\n for (i = 0; i < len; i += 1) {\n if (shapes[i].ty === 'gr') {\n arr.push(groupInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'fl') {\n arr.push(fillInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'st') {\n arr.push(strokeInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'tm') {\n arr.push(trimInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'tr') {\n // arr.push(transformInterfaceFactory(shapes[i],view[i],propertyGroup));\n } else if (shapes[i].ty === 'el') {\n arr.push(ellipseInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'sr') {\n arr.push(starInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'sh') {\n arr.push(ShapePathInterface(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'rc') {\n arr.push(rectInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'rd') {\n arr.push(roundedInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'rp') {\n arr.push(repeaterInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'gf') {\n arr.push(gradientFillInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else {\n arr.push(defaultInterfaceFactory(shapes[i], view[i], propertyGroup));\n }\n }\n return arr;\n }\n function contentsInterfaceFactory(shape, view, propertyGroup) {\n var interfaces;\n var interfaceFunction = function _interfaceFunction(value) {\n var i = 0;\n var len = interfaces.length;\n while (i < len) {\n if (interfaces[i]._name === value || interfaces[i].mn === value || interfaces[i].propertyIndex === value || interfaces[i].ix === value || interfaces[i].ind === value) {\n return interfaces[i];\n }\n i += 1;\n }\n if (typeof value === 'number') {\n return interfaces[value - 1];\n }\n return null;\n };\n interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup);\n interfaceFunction.numProperties = interfaces.length;\n var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup);\n interfaceFunction.transform = transformInterface;\n interfaceFunction.propertyIndex = shape.cix;\n interfaceFunction._name = shape.nm;\n return interfaceFunction;\n }\n function groupInterfaceFactory(shape, view, propertyGroup) {\n var interfaceFunction = function _interfaceFunction(value) {\n switch (value) {\n case 'ADBE Vectors Group':\n case 'Contents':\n case 2:\n return interfaceFunction.content;\n // Not necessary for now. Keeping them here in case a new case appears\n // case 'ADBE Vector Transform Group':\n // case 3:\n default:\n return interfaceFunction.transform;\n }\n };\n interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n var content = contentsInterfaceFactory(shape, view, interfaceFunction.propertyGroup);\n var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup);\n interfaceFunction.content = content;\n interfaceFunction.transform = transformInterface;\n Object.defineProperty(interfaceFunction, '_name', {\n get: function get() {\n return shape.nm;\n }\n });\n // interfaceFunction.content = interfaceFunction;\n interfaceFunction.numProperties = shape.np;\n interfaceFunction.propertyIndex = shape.ix;\n interfaceFunction.nm = shape.nm;\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n function fillInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(val) {\n if (val === 'Color' || val === 'color') {\n return interfaceFunction.color;\n }\n if (val === 'Opacity' || val === 'opacity') {\n return interfaceFunction.opacity;\n }\n return null;\n }\n Object.defineProperties(interfaceFunction, {\n color: {\n get: ExpressionPropertyInterface(view.c)\n },\n opacity: {\n get: ExpressionPropertyInterface(view.o)\n },\n _name: {\n value: shape.nm\n },\n mn: {\n value: shape.mn\n }\n });\n view.c.setGroupProperty(PropertyInterface('Color', propertyGroup));\n view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup));\n return interfaceFunction;\n }\n function gradientFillInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(val) {\n if (val === 'Start Point' || val === 'start point') {\n return interfaceFunction.startPoint;\n }\n if (val === 'End Point' || val === 'end point') {\n return interfaceFunction.endPoint;\n }\n if (val === 'Opacity' || val === 'opacity') {\n return interfaceFunction.opacity;\n }\n return null;\n }\n Object.defineProperties(interfaceFunction, {\n startPoint: {\n get: ExpressionPropertyInterface(view.s)\n },\n endPoint: {\n get: ExpressionPropertyInterface(view.e)\n },\n opacity: {\n get: ExpressionPropertyInterface(view.o)\n },\n type: {\n get: function get() {\n return 'a';\n }\n },\n _name: {\n value: shape.nm\n },\n mn: {\n value: shape.mn\n }\n });\n view.s.setGroupProperty(PropertyInterface('Start Point', propertyGroup));\n view.e.setGroupProperty(PropertyInterface('End Point', propertyGroup));\n view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup));\n return interfaceFunction;\n }\n function defaultInterfaceFactory() {\n function interfaceFunction() {\n return null;\n }\n return interfaceFunction;\n }\n function strokeInterfaceFactory(shape, view, propertyGroup) {\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n var _dashPropertyGroup = propertyGroupFactory(dashOb, _propertyGroup);\n function addPropertyToDashOb(i) {\n Object.defineProperty(dashOb, shape.d[i].nm, {\n get: ExpressionPropertyInterface(view.d.dataProps[i].p)\n });\n }\n var i;\n var len = shape.d ? shape.d.length : 0;\n var dashOb = {};\n for (i = 0; i < len; i += 1) {\n addPropertyToDashOb(i);\n view.d.dataProps[i].p.setGroupProperty(_dashPropertyGroup);\n }\n function interfaceFunction(val) {\n if (val === 'Color' || val === 'color') {\n return interfaceFunction.color;\n }\n if (val === 'Opacity' || val === 'opacity') {\n return interfaceFunction.opacity;\n }\n if (val === 'Stroke Width' || val === 'stroke width') {\n return interfaceFunction.strokeWidth;\n }\n return null;\n }\n Object.defineProperties(interfaceFunction, {\n color: {\n get: ExpressionPropertyInterface(view.c)\n },\n opacity: {\n get: ExpressionPropertyInterface(view.o)\n },\n strokeWidth: {\n get: ExpressionPropertyInterface(view.w)\n },\n dash: {\n get: function get() {\n return dashOb;\n }\n },\n _name: {\n value: shape.nm\n },\n mn: {\n value: shape.mn\n }\n });\n view.c.setGroupProperty(PropertyInterface('Color', _propertyGroup));\n view.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));\n view.w.setGroupProperty(PropertyInterface('Stroke Width', _propertyGroup));\n return interfaceFunction;\n }\n function trimInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(val) {\n if (val === shape.e.ix || val === 'End' || val === 'end') {\n return interfaceFunction.end;\n }\n if (val === shape.s.ix) {\n return interfaceFunction.start;\n }\n if (val === shape.o.ix) {\n return interfaceFunction.offset;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n interfaceFunction.propertyIndex = shape.ix;\n view.s.setGroupProperty(PropertyInterface('Start', _propertyGroup));\n view.e.setGroupProperty(PropertyInterface('End', _propertyGroup));\n view.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));\n interfaceFunction.propertyIndex = shape.ix;\n interfaceFunction.propertyGroup = propertyGroup;\n Object.defineProperties(interfaceFunction, {\n start: {\n get: ExpressionPropertyInterface(view.s)\n },\n end: {\n get: ExpressionPropertyInterface(view.e)\n },\n offset: {\n get: ExpressionPropertyInterface(view.o)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n function transformInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.a.ix === value || value === 'Anchor Point') {\n return interfaceFunction.anchorPoint;\n }\n if (shape.o.ix === value || value === 'Opacity') {\n return interfaceFunction.opacity;\n }\n if (shape.p.ix === value || value === 'Position') {\n return interfaceFunction.position;\n }\n if (shape.r.ix === value || value === 'Rotation' || value === 'ADBE Vector Rotation') {\n return interfaceFunction.rotation;\n }\n if (shape.s.ix === value || value === 'Scale') {\n return interfaceFunction.scale;\n }\n if (shape.sk && shape.sk.ix === value || value === 'Skew') {\n return interfaceFunction.skew;\n }\n if (shape.sa && shape.sa.ix === value || value === 'Skew Axis') {\n return interfaceFunction.skewAxis;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n view.transform.mProps.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));\n view.transform.mProps.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\n view.transform.mProps.a.setGroupProperty(PropertyInterface('Anchor Point', _propertyGroup));\n view.transform.mProps.s.setGroupProperty(PropertyInterface('Scale', _propertyGroup));\n view.transform.mProps.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));\n if (view.transform.mProps.sk) {\n view.transform.mProps.sk.setGroupProperty(PropertyInterface('Skew', _propertyGroup));\n view.transform.mProps.sa.setGroupProperty(PropertyInterface('Skew Angle', _propertyGroup));\n }\n view.transform.op.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));\n Object.defineProperties(interfaceFunction, {\n opacity: {\n get: ExpressionPropertyInterface(view.transform.mProps.o)\n },\n position: {\n get: ExpressionPropertyInterface(view.transform.mProps.p)\n },\n anchorPoint: {\n get: ExpressionPropertyInterface(view.transform.mProps.a)\n },\n scale: {\n get: ExpressionPropertyInterface(view.transform.mProps.s)\n },\n rotation: {\n get: ExpressionPropertyInterface(view.transform.mProps.r)\n },\n skew: {\n get: ExpressionPropertyInterface(view.transform.mProps.sk)\n },\n skewAxis: {\n get: ExpressionPropertyInterface(view.transform.mProps.sa)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.ty = 'tr';\n interfaceFunction.mn = shape.mn;\n interfaceFunction.propertyGroup = propertyGroup;\n return interfaceFunction;\n }\n function ellipseInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.p.ix === value) {\n return interfaceFunction.position;\n }\n if (shape.s.ix === value) {\n return interfaceFunction.size;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n interfaceFunction.propertyIndex = shape.ix;\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;\n prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\n Object.defineProperties(interfaceFunction, {\n size: {\n get: ExpressionPropertyInterface(prop.s)\n },\n position: {\n get: ExpressionPropertyInterface(prop.p)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n function starInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.p.ix === value) {\n return interfaceFunction.position;\n }\n if (shape.r.ix === value) {\n return interfaceFunction.rotation;\n }\n if (shape.pt.ix === value) {\n return interfaceFunction.points;\n }\n if (shape.or.ix === value || value === 'ADBE Vector Star Outer Radius') {\n return interfaceFunction.outerRadius;\n }\n if (shape.os.ix === value) {\n return interfaceFunction.outerRoundness;\n }\n if (shape.ir && (shape.ir.ix === value || value === 'ADBE Vector Star Inner Radius')) {\n return interfaceFunction.innerRadius;\n }\n if (shape.is && shape.is.ix === value) {\n return interfaceFunction.innerRoundness;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;\n interfaceFunction.propertyIndex = shape.ix;\n prop.or.setGroupProperty(PropertyInterface('Outer Radius', _propertyGroup));\n prop.os.setGroupProperty(PropertyInterface('Outer Roundness', _propertyGroup));\n prop.pt.setGroupProperty(PropertyInterface('Points', _propertyGroup));\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\n prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));\n if (shape.ir) {\n prop.ir.setGroupProperty(PropertyInterface('Inner Radius', _propertyGroup));\n prop.is.setGroupProperty(PropertyInterface('Inner Roundness', _propertyGroup));\n }\n Object.defineProperties(interfaceFunction, {\n position: {\n get: ExpressionPropertyInterface(prop.p)\n },\n rotation: {\n get: ExpressionPropertyInterface(prop.r)\n },\n points: {\n get: ExpressionPropertyInterface(prop.pt)\n },\n outerRadius: {\n get: ExpressionPropertyInterface(prop.or)\n },\n outerRoundness: {\n get: ExpressionPropertyInterface(prop.os)\n },\n innerRadius: {\n get: ExpressionPropertyInterface(prop.ir)\n },\n innerRoundness: {\n get: ExpressionPropertyInterface(prop.is)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n function rectInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.p.ix === value) {\n return interfaceFunction.position;\n }\n if (shape.r.ix === value) {\n return interfaceFunction.roundness;\n }\n if (shape.s.ix === value || value === 'Size' || value === 'ADBE Vector Rect Size') {\n return interfaceFunction.size;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;\n interfaceFunction.propertyIndex = shape.ix;\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\n prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));\n prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));\n Object.defineProperties(interfaceFunction, {\n position: {\n get: ExpressionPropertyInterface(prop.p)\n },\n roundness: {\n get: ExpressionPropertyInterface(prop.r)\n },\n size: {\n get: ExpressionPropertyInterface(prop.s)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n function roundedInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.r.ix === value || value === 'Round Corners 1') {\n return interfaceFunction.radius;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n var prop = view;\n interfaceFunction.propertyIndex = shape.ix;\n prop.rd.setGroupProperty(PropertyInterface('Radius', _propertyGroup));\n Object.defineProperties(interfaceFunction, {\n radius: {\n get: ExpressionPropertyInterface(prop.rd)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n function repeaterInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.c.ix === value || value === 'Copies') {\n return interfaceFunction.copies;\n }\n if (shape.o.ix === value || value === 'Offset') {\n return interfaceFunction.offset;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n var prop = view;\n interfaceFunction.propertyIndex = shape.ix;\n prop.c.setGroupProperty(PropertyInterface('Copies', _propertyGroup));\n prop.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));\n Object.defineProperties(interfaceFunction, {\n copies: {\n get: ExpressionPropertyInterface(prop.c)\n },\n offset: {\n get: ExpressionPropertyInterface(prop.o)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n return function (shapes, view, propertyGroup) {\n var interfaces;\n function _interfaceFunction(value) {\n if (typeof value === 'number') {\n value = value === undefined ? 1 : value;\n if (value === 0) {\n return propertyGroup;\n }\n return interfaces[value - 1];\n }\n var i = 0;\n var len = interfaces.length;\n while (i < len) {\n if (interfaces[i]._name === value) {\n return interfaces[i];\n }\n i += 1;\n }\n return null;\n }\n function parentGroupWrapper() {\n return propertyGroup;\n }\n _interfaceFunction.propertyGroup = propertyGroupFactory(_interfaceFunction, parentGroupWrapper);\n interfaces = iterateElements(shapes, view, _interfaceFunction.propertyGroup);\n _interfaceFunction.numProperties = interfaces.length;\n _interfaceFunction._name = 'Contents';\n return _interfaceFunction;\n };\n }();\n\n var TextExpressionInterface = function () {\n return function (elem) {\n var _sourceText;\n function _thisLayerFunction(name) {\n switch (name) {\n case 'ADBE Text Document':\n return _thisLayerFunction.sourceText;\n default:\n return null;\n }\n }\n Object.defineProperty(_thisLayerFunction, 'sourceText', {\n get: function get() {\n elem.textProperty.getValue();\n var stringValue = elem.textProperty.currentData.t;\n if (!_sourceText || stringValue !== _sourceText.value) {\n _sourceText = new String(stringValue); // eslint-disable-line no-new-wrappers\n // If stringValue is an empty string, eval returns undefined, so it has to be returned as a String primitive\n _sourceText.value = stringValue || new String(stringValue); // eslint-disable-line no-new-wrappers\n Object.defineProperty(_sourceText, 'style', {\n get: function get() {\n return {\n fillColor: elem.textProperty.currentData.fc\n };\n }\n });\n }\n return _sourceText;\n }\n });\n return _thisLayerFunction;\n };\n }();\n\n function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\n var FootageInterface = function () {\n var outlineInterfaceFactory = function outlineInterfaceFactory(elem) {\n var currentPropertyName = '';\n var currentProperty = elem.getFootageData();\n function init() {\n currentPropertyName = '';\n currentProperty = elem.getFootageData();\n return searchProperty;\n }\n function searchProperty(value) {\n if (currentProperty[value]) {\n currentPropertyName = value;\n currentProperty = currentProperty[value];\n if (_typeof(currentProperty) === 'object') {\n return searchProperty;\n }\n return currentProperty;\n }\n var propertyNameIndex = value.indexOf(currentPropertyName);\n if (propertyNameIndex !== -1) {\n var index = parseInt(value.substr(propertyNameIndex + currentPropertyName.length), 10);\n currentProperty = currentProperty[index];\n if (_typeof(currentProperty) === 'object') {\n return searchProperty;\n }\n return currentProperty;\n }\n return '';\n }\n return init;\n };\n var dataInterfaceFactory = function dataInterfaceFactory(elem) {\n function interfaceFunction(value) {\n if (value === 'Outline') {\n return interfaceFunction.outlineInterface();\n }\n return null;\n }\n interfaceFunction._name = 'Outline';\n interfaceFunction.outlineInterface = outlineInterfaceFactory(elem);\n return interfaceFunction;\n };\n return function (elem) {\n function _interfaceFunction(value) {\n if (value === 'Data') {\n return _interfaceFunction.dataInterface;\n }\n return null;\n }\n _interfaceFunction._name = 'Data';\n _interfaceFunction.dataInterface = dataInterfaceFactory(elem);\n return _interfaceFunction;\n };\n }();\n\n var interfaces = {\n layer: LayerExpressionInterface,\n effects: EffectsExpressionInterface,\n comp: CompExpressionInterface,\n shape: ShapeExpressionInterface,\n text: TextExpressionInterface,\n footage: FootageInterface\n };\n function getInterface(type) {\n return interfaces[type] || null;\n }\n\n var expressionHelpers = function () {\n function searchExpressions(elem, data, prop) {\n if (data.x) {\n prop.k = true;\n prop.x = true;\n prop.initiateExpression = ExpressionManager.initiateExpression;\n prop.effectsSequence.push(prop.initiateExpression(elem, data, prop).bind(prop));\n }\n }\n function getValueAtTime(frameNum) {\n frameNum *= this.elem.globalData.frameRate;\n frameNum -= this.offsetTime;\n if (frameNum !== this._cachingAtTime.lastFrame) {\n this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0;\n this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime);\n this._cachingAtTime.lastFrame = frameNum;\n }\n return this._cachingAtTime.value;\n }\n function getSpeedAtTime(frameNum) {\n var delta = -0.01;\n var v1 = this.getValueAtTime(frameNum);\n var v2 = this.getValueAtTime(frameNum + delta);\n var speed = 0;\n if (v1.length) {\n var i;\n for (i = 0; i < v1.length; i += 1) {\n speed += Math.pow(v2[i] - v1[i], 2);\n }\n speed = Math.sqrt(speed) * 100;\n } else {\n speed = 0;\n }\n return speed;\n }\n function getVelocityAtTime(frameNum) {\n if (this.vel !== undefined) {\n return this.vel;\n }\n var delta = -0.001;\n // frameNum += this.elem.data.st;\n var v1 = this.getValueAtTime(frameNum);\n var v2 = this.getValueAtTime(frameNum + delta);\n var velocity;\n if (v1.length) {\n velocity = createTypedArray('float32', v1.length);\n var i;\n for (i = 0; i < v1.length; i += 1) {\n // removing frameRate\n // if needed, don't add it here\n // velocity[i] = this.elem.globalData.frameRate*((v2[i] - v1[i])/delta);\n velocity[i] = (v2[i] - v1[i]) / delta;\n }\n } else {\n velocity = (v2 - v1) / delta;\n }\n return velocity;\n }\n function getStaticValueAtTime() {\n return this.pv;\n }\n function setGroupProperty(propertyGroup) {\n this.propertyGroup = propertyGroup;\n }\n return {\n searchExpressions: searchExpressions,\n getSpeedAtTime: getSpeedAtTime,\n getVelocityAtTime: getVelocityAtTime,\n getValueAtTime: getValueAtTime,\n getStaticValueAtTime: getStaticValueAtTime,\n setGroupProperty: setGroupProperty\n };\n }();\n\n function addPropertyDecorator() {\n function loopOut(type, duration, durationFlag) {\n if (!this.k || !this.keyframes) {\n return this.pv;\n }\n type = type ? type.toLowerCase() : '';\n var currentFrame = this.comp.renderedFrame;\n var keyframes = this.keyframes;\n var lastKeyFrame = keyframes[keyframes.length - 1].t;\n if (currentFrame <= lastKeyFrame) {\n return this.pv;\n }\n var cycleDuration;\n var firstKeyFrame;\n if (!durationFlag) {\n if (!duration || duration > keyframes.length - 1) {\n duration = keyframes.length - 1;\n }\n firstKeyFrame = keyframes[keyframes.length - 1 - duration].t;\n cycleDuration = lastKeyFrame - firstKeyFrame;\n } else {\n if (!duration) {\n cycleDuration = Math.max(0, lastKeyFrame - this.elem.data.ip);\n } else {\n cycleDuration = Math.abs(lastKeyFrame - this.elem.comp.globalData.frameRate * duration);\n }\n firstKeyFrame = lastKeyFrame - cycleDuration;\n }\n var i;\n var len;\n var ret;\n if (type === 'pingpong') {\n var iterations = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);\n if (iterations % 2 !== 0) {\n return this.getValueAtTime((cycleDuration - (currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line\n }\n } else if (type === 'offset') {\n var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);\n var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);\n var current = this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line\n var repeats = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);\n if (this.pv.length) {\n ret = new Array(initV.length);\n len = ret.length;\n for (i = 0; i < len; i += 1) {\n ret[i] = (endV[i] - initV[i]) * repeats + current[i];\n }\n return ret;\n }\n return (endV - initV) * repeats + current;\n } else if (type === 'continue') {\n var lastValue = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);\n var nextLastValue = this.getValueAtTime((lastKeyFrame - 0.001) / this.comp.globalData.frameRate, 0);\n if (this.pv.length) {\n ret = new Array(lastValue.length);\n len = ret.length;\n for (i = 0; i < len; i += 1) {\n ret[i] = lastValue[i] + (lastValue[i] - nextLastValue[i]) * ((currentFrame - lastKeyFrame) / this.comp.globalData.frameRate) / 0.0005; // eslint-disable-line\n }\n return ret;\n }\n return lastValue + (lastValue - nextLastValue) * ((currentFrame - lastKeyFrame) / 0.001);\n }\n return this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line\n }\n function loopIn(type, duration, durationFlag) {\n if (!this.k) {\n return this.pv;\n }\n type = type ? type.toLowerCase() : '';\n var currentFrame = this.comp.renderedFrame;\n var keyframes = this.keyframes;\n var firstKeyFrame = keyframes[0].t;\n if (currentFrame >= firstKeyFrame) {\n return this.pv;\n }\n var cycleDuration;\n var lastKeyFrame;\n if (!durationFlag) {\n if (!duration || duration > keyframes.length - 1) {\n duration = keyframes.length - 1;\n }\n lastKeyFrame = keyframes[duration].t;\n cycleDuration = lastKeyFrame - firstKeyFrame;\n } else {\n if (!duration) {\n cycleDuration = Math.max(0, this.elem.data.op - firstKeyFrame);\n } else {\n cycleDuration = Math.abs(this.elem.comp.globalData.frameRate * duration);\n }\n lastKeyFrame = firstKeyFrame + cycleDuration;\n }\n var i;\n var len;\n var ret;\n if (type === 'pingpong') {\n var iterations = Math.floor((firstKeyFrame - currentFrame) / cycleDuration);\n if (iterations % 2 === 0) {\n return this.getValueAtTime(((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line\n }\n } else if (type === 'offset') {\n var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);\n var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);\n var current = this.getValueAtTime((cycleDuration - (firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0);\n var repeats = Math.floor((firstKeyFrame - currentFrame) / cycleDuration) + 1;\n if (this.pv.length) {\n ret = new Array(initV.length);\n len = ret.length;\n for (i = 0; i < len; i += 1) {\n ret[i] = current[i] - (endV[i] - initV[i]) * repeats;\n }\n return ret;\n }\n return current - (endV - initV) * repeats;\n } else if (type === 'continue') {\n var firstValue = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);\n var nextFirstValue = this.getValueAtTime((firstKeyFrame + 0.001) / this.comp.globalData.frameRate, 0);\n if (this.pv.length) {\n ret = new Array(firstValue.length);\n len = ret.length;\n for (i = 0; i < len; i += 1) {\n ret[i] = firstValue[i] + (firstValue[i] - nextFirstValue[i]) * (firstKeyFrame - currentFrame) / 0.001;\n }\n return ret;\n }\n return firstValue + (firstValue - nextFirstValue) * (firstKeyFrame - currentFrame) / 0.001;\n }\n return this.getValueAtTime((cycleDuration - ((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0); // eslint-disable-line\n }\n function smooth(width, samples) {\n if (!this.k) {\n return this.pv;\n }\n width = (width || 0.4) * 0.5;\n samples = Math.floor(samples || 5);\n if (samples <= 1) {\n return this.pv;\n }\n var currentTime = this.comp.renderedFrame / this.comp.globalData.frameRate;\n var initFrame = currentTime - width;\n var endFrame = currentTime + width;\n var sampleFrequency = samples > 1 ? (endFrame - initFrame) / (samples - 1) : 1;\n var i = 0;\n var j = 0;\n var value;\n if (this.pv.length) {\n value = createTypedArray('float32', this.pv.length);\n } else {\n value = 0;\n }\n var sampleValue;\n while (i < samples) {\n sampleValue = this.getValueAtTime(initFrame + i * sampleFrequency);\n if (this.pv.length) {\n for (j = 0; j < this.pv.length; j += 1) {\n value[j] += sampleValue[j];\n }\n } else {\n value += sampleValue;\n }\n i += 1;\n }\n if (this.pv.length) {\n for (j = 0; j < this.pv.length; j += 1) {\n value[j] /= samples;\n }\n } else {\n value /= samples;\n }\n return value;\n }\n function getTransformValueAtTime(time) {\n if (!this._transformCachingAtTime) {\n this._transformCachingAtTime = {\n v: new Matrix()\n };\n }\n /// /\n var matrix = this._transformCachingAtTime.v;\n matrix.cloneFromProps(this.pre.props);\n if (this.appliedTransformations < 1) {\n var anchor = this.a.getValueAtTime(time);\n matrix.translate(-anchor[0] * this.a.mult, -anchor[1] * this.a.mult, anchor[2] * this.a.mult);\n }\n if (this.appliedTransformations < 2) {\n var scale = this.s.getValueAtTime(time);\n matrix.scale(scale[0] * this.s.mult, scale[1] * this.s.mult, scale[2] * this.s.mult);\n }\n if (this.sk && this.appliedTransformations < 3) {\n var skew = this.sk.getValueAtTime(time);\n var skewAxis = this.sa.getValueAtTime(time);\n matrix.skewFromAxis(-skew * this.sk.mult, skewAxis * this.sa.mult);\n }\n if (this.r && this.appliedTransformations < 4) {\n var rotation = this.r.getValueAtTime(time);\n matrix.rotate(-rotation * this.r.mult);\n } else if (!this.r && this.appliedTransformations < 4) {\n var rotationZ = this.rz.getValueAtTime(time);\n var rotationY = this.ry.getValueAtTime(time);\n var rotationX = this.rx.getValueAtTime(time);\n var orientation = this.or.getValueAtTime(time);\n matrix.rotateZ(-rotationZ * this.rz.mult).rotateY(rotationY * this.ry.mult).rotateX(rotationX * this.rx.mult).rotateZ(-orientation[2] * this.or.mult).rotateY(orientation[1] * this.or.mult).rotateX(orientation[0] * this.or.mult);\n }\n if (this.data.p && this.data.p.s) {\n var positionX = this.px.getValueAtTime(time);\n var positionY = this.py.getValueAtTime(time);\n if (this.data.p.z) {\n var positionZ = this.pz.getValueAtTime(time);\n matrix.translate(positionX * this.px.mult, positionY * this.py.mult, -positionZ * this.pz.mult);\n } else {\n matrix.translate(positionX * this.px.mult, positionY * this.py.mult, 0);\n }\n } else {\n var position = this.p.getValueAtTime(time);\n matrix.translate(position[0] * this.p.mult, position[1] * this.p.mult, -position[2] * this.p.mult);\n }\n return matrix;\n /// /\n }\n function getTransformStaticValueAtTime() {\n return this.v.clone(new Matrix());\n }\n var getTransformProperty = TransformPropertyFactory.getTransformProperty;\n TransformPropertyFactory.getTransformProperty = function (elem, data, container) {\n var prop = getTransformProperty(elem, data, container);\n if (prop.dynamicProperties.length) {\n prop.getValueAtTime = getTransformValueAtTime.bind(prop);\n } else {\n prop.getValueAtTime = getTransformStaticValueAtTime.bind(prop);\n }\n prop.setGroupProperty = expressionHelpers.setGroupProperty;\n return prop;\n };\n var propertyGetProp = PropertyFactory.getProp;\n PropertyFactory.getProp = function (elem, data, type, mult, container) {\n var prop = propertyGetProp(elem, data, type, mult, container);\n // prop.getVelocityAtTime = getVelocityAtTime;\n // prop.loopOut = loopOut;\n // prop.loopIn = loopIn;\n if (prop.kf) {\n prop.getValueAtTime = expressionHelpers.getValueAtTime.bind(prop);\n } else {\n prop.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(prop);\n }\n prop.setGroupProperty = expressionHelpers.setGroupProperty;\n prop.loopOut = loopOut;\n prop.loopIn = loopIn;\n prop.smooth = smooth;\n prop.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(prop);\n prop.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(prop);\n prop.numKeys = data.a === 1 ? data.k.length : 0;\n prop.propertyIndex = data.ix;\n var value = 0;\n if (type !== 0) {\n value = createTypedArray('float32', data.a === 1 ? data.k[0].s.length : data.k.length);\n }\n prop._cachingAtTime = {\n lastFrame: initialDefaultFrame,\n lastIndex: 0,\n value: value\n };\n expressionHelpers.searchExpressions(elem, data, prop);\n if (prop.k) {\n container.addDynamicProperty(prop);\n }\n return prop;\n };\n function getShapeValueAtTime(frameNum) {\n // For now this caching object is created only when needed instead of creating it when the shape is initialized.\n if (!this._cachingAtTime) {\n this._cachingAtTime = {\n shapeValue: shapePool.clone(this.pv),\n lastIndex: 0,\n lastTime: initialDefaultFrame\n };\n }\n frameNum *= this.elem.globalData.frameRate;\n frameNum -= this.offsetTime;\n if (frameNum !== this._cachingAtTime.lastTime) {\n this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < frameNum ? this._caching.lastIndex : 0;\n this._cachingAtTime.lastTime = frameNum;\n this.interpolateShape(frameNum, this._cachingAtTime.shapeValue, this._cachingAtTime);\n }\n return this._cachingAtTime.shapeValue;\n }\n var ShapePropertyConstructorFunction = ShapePropertyFactory.getConstructorFunction();\n var KeyframedShapePropertyConstructorFunction = ShapePropertyFactory.getKeyframedConstructorFunction();\n function ShapeExpressions() {}\n ShapeExpressions.prototype = {\n vertices: function vertices(prop, time) {\n if (this.k) {\n this.getValue();\n }\n var shapePath = this.v;\n if (time !== undefined) {\n shapePath = this.getValueAtTime(time, 0);\n }\n var i;\n var len = shapePath._length;\n var vertices = shapePath[prop];\n var points = shapePath.v;\n var arr = createSizedArray(len);\n for (i = 0; i < len; i += 1) {\n if (prop === 'i' || prop === 'o') {\n arr[i] = [vertices[i][0] - points[i][0], vertices[i][1] - points[i][1]];\n } else {\n arr[i] = [vertices[i][0], vertices[i][1]];\n }\n }\n return arr;\n },\n points: function points(time) {\n return this.vertices('v', time);\n },\n inTangents: function inTangents(time) {\n return this.vertices('i', time);\n },\n outTangents: function outTangents(time) {\n return this.vertices('o', time);\n },\n isClosed: function isClosed() {\n return this.v.c;\n },\n pointOnPath: function pointOnPath(perc, time) {\n var shapePath = this.v;\n if (time !== undefined) {\n shapePath = this.getValueAtTime(time, 0);\n }\n if (!this._segmentsLength) {\n this._segmentsLength = bez.getSegmentsLength(shapePath);\n }\n var segmentsLength = this._segmentsLength;\n var lengths = segmentsLength.lengths;\n var lengthPos = segmentsLength.totalLength * perc;\n var i = 0;\n var len = lengths.length;\n var accumulatedLength = 0;\n var pt;\n while (i < len) {\n if (accumulatedLength + lengths[i].addedLength > lengthPos) {\n var initIndex = i;\n var endIndex = shapePath.c && i === len - 1 ? 0 : i + 1;\n var segmentPerc = (lengthPos - accumulatedLength) / lengths[i].addedLength;\n pt = bez.getPointInSegment(shapePath.v[initIndex], shapePath.v[endIndex], shapePath.o[initIndex], shapePath.i[endIndex], segmentPerc, lengths[i]);\n break;\n } else {\n accumulatedLength += lengths[i].addedLength;\n }\n i += 1;\n }\n if (!pt) {\n pt = shapePath.c ? [shapePath.v[0][0], shapePath.v[0][1]] : [shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1]];\n }\n return pt;\n },\n vectorOnPath: function vectorOnPath(perc, time, vectorType) {\n // perc doesn't use triple equality because it can be a Number object as well as a primitive.\n if (perc == 1) {\n // eslint-disable-line eqeqeq\n perc = this.v.c;\n } else if (perc == 0) {\n // eslint-disable-line eqeqeq\n perc = 0.999;\n }\n var pt1 = this.pointOnPath(perc, time);\n var pt2 = this.pointOnPath(perc + 0.001, time);\n var xLength = pt2[0] - pt1[0];\n var yLength = pt2[1] - pt1[1];\n var magnitude = Math.sqrt(Math.pow(xLength, 2) + Math.pow(yLength, 2));\n if (magnitude === 0) {\n return [0, 0];\n }\n var unitVector = vectorType === 'tangent' ? [xLength / magnitude, yLength / magnitude] : [-yLength / magnitude, xLength / magnitude];\n return unitVector;\n },\n tangentOnPath: function tangentOnPath(perc, time) {\n return this.vectorOnPath(perc, time, 'tangent');\n },\n normalOnPath: function normalOnPath(perc, time) {\n return this.vectorOnPath(perc, time, 'normal');\n },\n setGroupProperty: expressionHelpers.setGroupProperty,\n getValueAtTime: expressionHelpers.getStaticValueAtTime\n };\n extendPrototype([ShapeExpressions], ShapePropertyConstructorFunction);\n extendPrototype([ShapeExpressions], KeyframedShapePropertyConstructorFunction);\n KeyframedShapePropertyConstructorFunction.prototype.getValueAtTime = getShapeValueAtTime;\n KeyframedShapePropertyConstructorFunction.prototype.initiateExpression = ExpressionManager.initiateExpression;\n var propertyGetShapeProp = ShapePropertyFactory.getShapeProp;\n ShapePropertyFactory.getShapeProp = function (elem, data, type, arr, trims) {\n var prop = propertyGetShapeProp(elem, data, type, arr, trims);\n prop.propertyIndex = data.ix;\n prop.lock = false;\n if (type === 3) {\n expressionHelpers.searchExpressions(elem, data.pt, prop);\n } else if (type === 4) {\n expressionHelpers.searchExpressions(elem, data.ks, prop);\n }\n if (prop.k) {\n elem.addDynamicProperty(prop);\n }\n return prop;\n };\n }\n function initialize$1() {\n addPropertyDecorator();\n }\n\n function addDecorator() {\n function searchExpressions() {\n if (this.data.d.x) {\n this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem, this.data.d, this);\n this.addEffect(this.getExpressionValue.bind(this));\n return true;\n }\n return null;\n }\n TextProperty.prototype.getExpressionValue = function (currentValue, text) {\n var newValue = this.calculateExpression(text);\n if (currentValue.t !== newValue) {\n var newData = {};\n this.copyData(newData, currentValue);\n newData.t = newValue.toString();\n newData.__complete = false;\n return newData;\n }\n return currentValue;\n };\n TextProperty.prototype.searchProperty = function () {\n var isKeyframed = this.searchKeyframes();\n var hasExpressions = this.searchExpressions();\n this.kf = isKeyframed || hasExpressions;\n return this.kf;\n };\n TextProperty.prototype.searchExpressions = searchExpressions;\n }\n function initialize() {\n addDecorator();\n }\n\n function SVGComposableEffect() {}\n SVGComposableEffect.prototype = {\n createMergeNode: function createMergeNode(resultId, ins) {\n var feMerge = createNS('feMerge');\n feMerge.setAttribute('result', resultId);\n var feMergeNode;\n var i;\n for (i = 0; i < ins.length; i += 1) {\n feMergeNode = createNS('feMergeNode');\n feMergeNode.setAttribute('in', ins[i]);\n feMerge.appendChild(feMergeNode);\n feMerge.appendChild(feMergeNode);\n }\n return feMerge;\n }\n };\n\n var linearFilterValue = '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0';\n function SVGTintFilter(filter, filterManager, elem, id, source) {\n this.filterManager = filterManager;\n var feColorMatrix = createNS('feColorMatrix');\n feColorMatrix.setAttribute('type', 'matrix');\n feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');\n feColorMatrix.setAttribute('values', linearFilterValue + ' 1 0');\n this.linearFilter = feColorMatrix;\n feColorMatrix.setAttribute('result', id + '_tint_1');\n filter.appendChild(feColorMatrix);\n feColorMatrix = createNS('feColorMatrix');\n feColorMatrix.setAttribute('type', 'matrix');\n feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\n feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');\n feColorMatrix.setAttribute('result', id + '_tint_2');\n filter.appendChild(feColorMatrix);\n this.matrixFilter = feColorMatrix;\n var feMerge = this.createMergeNode(id, [source, id + '_tint_1', id + '_tint_2']);\n filter.appendChild(feMerge);\n }\n extendPrototype([SVGComposableEffect], SVGTintFilter);\n SVGTintFilter.prototype.renderFrame = function (forceRender) {\n if (forceRender || this.filterManager._mdf) {\n var colorBlack = this.filterManager.effectElements[0].p.v;\n var colorWhite = this.filterManager.effectElements[1].p.v;\n var opacity = this.filterManager.effectElements[2].p.v / 100;\n this.linearFilter.setAttribute('values', linearFilterValue + ' ' + opacity + ' 0');\n this.matrixFilter.setAttribute('values', colorWhite[0] - colorBlack[0] + ' 0 0 0 ' + colorBlack[0] + ' ' + (colorWhite[1] - colorBlack[1]) + ' 0 0 0 ' + colorBlack[1] + ' ' + (colorWhite[2] - colorBlack[2]) + ' 0 0 0 ' + colorBlack[2] + ' 0 0 0 1 0');\n }\n };\n\n function SVGFillFilter(filter, filterManager, elem, id) {\n this.filterManager = filterManager;\n var feColorMatrix = createNS('feColorMatrix');\n feColorMatrix.setAttribute('type', 'matrix');\n feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\n feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');\n feColorMatrix.setAttribute('result', id);\n filter.appendChild(feColorMatrix);\n this.matrixFilter = feColorMatrix;\n }\n SVGFillFilter.prototype.renderFrame = function (forceRender) {\n if (forceRender || this.filterManager._mdf) {\n var color = this.filterManager.effectElements[2].p.v;\n var opacity = this.filterManager.effectElements[6].p.v;\n this.matrixFilter.setAttribute('values', '0 0 0 0 ' + color[0] + ' 0 0 0 0 ' + color[1] + ' 0 0 0 0 ' + color[2] + ' 0 0 0 ' + opacity + ' 0');\n }\n };\n\n function SVGStrokeEffect(fil, filterManager, elem) {\n this.initialized = false;\n this.filterManager = filterManager;\n this.elem = elem;\n this.paths = [];\n }\n SVGStrokeEffect.prototype.initialize = function () {\n var elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;\n var path;\n var groupPath;\n var i;\n var len;\n if (this.filterManager.effectElements[1].p.v === 1) {\n len = this.elem.maskManager.masksProperties.length;\n i = 0;\n } else {\n i = this.filterManager.effectElements[0].p.v - 1;\n len = i + 1;\n }\n groupPath = createNS('g');\n groupPath.setAttribute('fill', 'none');\n groupPath.setAttribute('stroke-linecap', 'round');\n groupPath.setAttribute('stroke-dashoffset', 1);\n for (i; i < len; i += 1) {\n path = createNS('path');\n groupPath.appendChild(path);\n this.paths.push({\n p: path,\n m: i\n });\n }\n if (this.filterManager.effectElements[10].p.v === 3) {\n var mask = createNS('mask');\n var id = createElementID();\n mask.setAttribute('id', id);\n mask.setAttribute('mask-type', 'alpha');\n mask.appendChild(groupPath);\n this.elem.globalData.defs.appendChild(mask);\n var g = createNS('g');\n g.setAttribute('mask', 'url(' + getLocationHref() + '#' + id + ')');\n while (elemChildren[0]) {\n g.appendChild(elemChildren[0]);\n }\n this.elem.layerElement.appendChild(g);\n this.masker = mask;\n groupPath.setAttribute('stroke', '#fff');\n } else if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {\n if (this.filterManager.effectElements[10].p.v === 2) {\n elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;\n while (elemChildren.length) {\n this.elem.layerElement.removeChild(elemChildren[0]);\n }\n }\n this.elem.layerElement.appendChild(groupPath);\n this.elem.layerElement.removeAttribute('mask');\n groupPath.setAttribute('stroke', '#fff');\n }\n this.initialized = true;\n this.pathMasker = groupPath;\n };\n SVGStrokeEffect.prototype.renderFrame = function (forceRender) {\n if (!this.initialized) {\n this.initialize();\n }\n var i;\n var len = this.paths.length;\n var mask;\n var path;\n for (i = 0; i < len; i += 1) {\n if (this.paths[i].m !== -1) {\n mask = this.elem.maskManager.viewData[this.paths[i].m];\n path = this.paths[i].p;\n if (forceRender || this.filterManager._mdf || mask.prop._mdf) {\n path.setAttribute('d', mask.lastPath);\n }\n if (forceRender || this.filterManager.effectElements[9].p._mdf || this.filterManager.effectElements[4].p._mdf || this.filterManager.effectElements[7].p._mdf || this.filterManager.effectElements[8].p._mdf || mask.prop._mdf) {\n var dasharrayValue;\n if (this.filterManager.effectElements[7].p.v !== 0 || this.filterManager.effectElements[8].p.v !== 100) {\n var s = Math.min(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) * 0.01;\n var e = Math.max(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) * 0.01;\n var l = path.getTotalLength();\n dasharrayValue = '0 0 0 ' + l * s + ' ';\n var lineLength = l * (e - s);\n var segment = 1 + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01;\n var units = Math.floor(lineLength / segment);\n var j;\n for (j = 0; j < units; j += 1) {\n dasharrayValue += '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01 + ' ';\n }\n dasharrayValue += '0 ' + l * 10 + ' 0 0';\n } else {\n dasharrayValue = '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01;\n }\n path.setAttribute('stroke-dasharray', dasharrayValue);\n }\n }\n }\n if (forceRender || this.filterManager.effectElements[4].p._mdf) {\n this.pathMasker.setAttribute('stroke-width', this.filterManager.effectElements[4].p.v * 2);\n }\n if (forceRender || this.filterManager.effectElements[6].p._mdf) {\n this.pathMasker.setAttribute('opacity', this.filterManager.effectElements[6].p.v);\n }\n if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {\n if (forceRender || this.filterManager.effectElements[3].p._mdf) {\n var color = this.filterManager.effectElements[3].p.v;\n this.pathMasker.setAttribute('stroke', 'rgb(' + bmFloor(color[0] * 255) + ',' + bmFloor(color[1] * 255) + ',' + bmFloor(color[2] * 255) + ')');\n }\n }\n };\n\n function SVGTritoneFilter(filter, filterManager, elem, id) {\n this.filterManager = filterManager;\n var feColorMatrix = createNS('feColorMatrix');\n feColorMatrix.setAttribute('type', 'matrix');\n feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');\n feColorMatrix.setAttribute('values', '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');\n filter.appendChild(feColorMatrix);\n var feComponentTransfer = createNS('feComponentTransfer');\n feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');\n feComponentTransfer.setAttribute('result', id);\n this.matrixFilter = feComponentTransfer;\n var feFuncR = createNS('feFuncR');\n feFuncR.setAttribute('type', 'table');\n feComponentTransfer.appendChild(feFuncR);\n this.feFuncR = feFuncR;\n var feFuncG = createNS('feFuncG');\n feFuncG.setAttribute('type', 'table');\n feComponentTransfer.appendChild(feFuncG);\n this.feFuncG = feFuncG;\n var feFuncB = createNS('feFuncB');\n feFuncB.setAttribute('type', 'table');\n feComponentTransfer.appendChild(feFuncB);\n this.feFuncB = feFuncB;\n filter.appendChild(feComponentTransfer);\n }\n SVGTritoneFilter.prototype.renderFrame = function (forceRender) {\n if (forceRender || this.filterManager._mdf) {\n var color1 = this.filterManager.effectElements[0].p.v;\n var color2 = this.filterManager.effectElements[1].p.v;\n var color3 = this.filterManager.effectElements[2].p.v;\n var tableR = color3[0] + ' ' + color2[0] + ' ' + color1[0];\n var tableG = color3[1] + ' ' + color2[1] + ' ' + color1[1];\n var tableB = color3[2] + ' ' + color2[2] + ' ' + color1[2];\n this.feFuncR.setAttribute('tableValues', tableR);\n this.feFuncG.setAttribute('tableValues', tableG);\n this.feFuncB.setAttribute('tableValues', tableB);\n }\n };\n\n function SVGProLevelsFilter(filter, filterManager, elem, id) {\n this.filterManager = filterManager;\n var effectElements = this.filterManager.effectElements;\n var feComponentTransfer = createNS('feComponentTransfer');\n\n // Red\n if (effectElements[10].p.k || effectElements[10].p.v !== 0 || effectElements[11].p.k || effectElements[11].p.v !== 1 || effectElements[12].p.k || effectElements[12].p.v !== 1 || effectElements[13].p.k || effectElements[13].p.v !== 0 || effectElements[14].p.k || effectElements[14].p.v !== 1) {\n this.feFuncR = this.createFeFunc('feFuncR', feComponentTransfer);\n }\n // Green\n if (effectElements[17].p.k || effectElements[17].p.v !== 0 || effectElements[18].p.k || effectElements[18].p.v !== 1 || effectElements[19].p.k || effectElements[19].p.v !== 1 || effectElements[20].p.k || effectElements[20].p.v !== 0 || effectElements[21].p.k || effectElements[21].p.v !== 1) {\n this.feFuncG = this.createFeFunc('feFuncG', feComponentTransfer);\n }\n // Blue\n if (effectElements[24].p.k || effectElements[24].p.v !== 0 || effectElements[25].p.k || effectElements[25].p.v !== 1 || effectElements[26].p.k || effectElements[26].p.v !== 1 || effectElements[27].p.k || effectElements[27].p.v !== 0 || effectElements[28].p.k || effectElements[28].p.v !== 1) {\n this.feFuncB = this.createFeFunc('feFuncB', feComponentTransfer);\n }\n // Alpha\n if (effectElements[31].p.k || effectElements[31].p.v !== 0 || effectElements[32].p.k || effectElements[32].p.v !== 1 || effectElements[33].p.k || effectElements[33].p.v !== 1 || effectElements[34].p.k || effectElements[34].p.v !== 0 || effectElements[35].p.k || effectElements[35].p.v !== 1) {\n this.feFuncA = this.createFeFunc('feFuncA', feComponentTransfer);\n }\n // RGB\n if (this.feFuncR || this.feFuncG || this.feFuncB || this.feFuncA) {\n feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');\n filter.appendChild(feComponentTransfer);\n }\n if (effectElements[3].p.k || effectElements[3].p.v !== 0 || effectElements[4].p.k || effectElements[4].p.v !== 1 || effectElements[5].p.k || effectElements[5].p.v !== 1 || effectElements[6].p.k || effectElements[6].p.v !== 0 || effectElements[7].p.k || effectElements[7].p.v !== 1) {\n feComponentTransfer = createNS('feComponentTransfer');\n feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');\n feComponentTransfer.setAttribute('result', id);\n filter.appendChild(feComponentTransfer);\n this.feFuncRComposed = this.createFeFunc('feFuncR', feComponentTransfer);\n this.feFuncGComposed = this.createFeFunc('feFuncG', feComponentTransfer);\n this.feFuncBComposed = this.createFeFunc('feFuncB', feComponentTransfer);\n }\n }\n SVGProLevelsFilter.prototype.createFeFunc = function (type, feComponentTransfer) {\n var feFunc = createNS(type);\n feFunc.setAttribute('type', 'table');\n feComponentTransfer.appendChild(feFunc);\n return feFunc;\n };\n SVGProLevelsFilter.prototype.getTableValue = function (inputBlack, inputWhite, gamma, outputBlack, outputWhite) {\n var cnt = 0;\n var segments = 256;\n var perc;\n var min = Math.min(inputBlack, inputWhite);\n var max = Math.max(inputBlack, inputWhite);\n var table = Array.call(null, {\n length: segments\n });\n var colorValue;\n var pos = 0;\n var outputDelta = outputWhite - outputBlack;\n var inputDelta = inputWhite - inputBlack;\n while (cnt <= 256) {\n perc = cnt / 256;\n if (perc <= min) {\n colorValue = inputDelta < 0 ? outputWhite : outputBlack;\n } else if (perc >= max) {\n colorValue = inputDelta < 0 ? outputBlack : outputWhite;\n } else {\n colorValue = outputBlack + outputDelta * Math.pow((perc - inputBlack) / inputDelta, 1 / gamma);\n }\n table[pos] = colorValue;\n pos += 1;\n cnt += 256 / (segments - 1);\n }\n return table.join(' ');\n };\n SVGProLevelsFilter.prototype.renderFrame = function (forceRender) {\n if (forceRender || this.filterManager._mdf) {\n var val;\n var effectElements = this.filterManager.effectElements;\n if (this.feFuncRComposed && (forceRender || effectElements[3].p._mdf || effectElements[4].p._mdf || effectElements[5].p._mdf || effectElements[6].p._mdf || effectElements[7].p._mdf)) {\n val = this.getTableValue(effectElements[3].p.v, effectElements[4].p.v, effectElements[5].p.v, effectElements[6].p.v, effectElements[7].p.v);\n this.feFuncRComposed.setAttribute('tableValues', val);\n this.feFuncGComposed.setAttribute('tableValues', val);\n this.feFuncBComposed.setAttribute('tableValues', val);\n }\n if (this.feFuncR && (forceRender || effectElements[10].p._mdf || effectElements[11].p._mdf || effectElements[12].p._mdf || effectElements[13].p._mdf || effectElements[14].p._mdf)) {\n val = this.getTableValue(effectElements[10].p.v, effectElements[11].p.v, effectElements[12].p.v, effectElements[13].p.v, effectElements[14].p.v);\n this.feFuncR.setAttribute('tableValues', val);\n }\n if (this.feFuncG && (forceRender || effectElements[17].p._mdf || effectElements[18].p._mdf || effectElements[19].p._mdf || effectElements[20].p._mdf || effectElements[21].p._mdf)) {\n val = this.getTableValue(effectElements[17].p.v, effectElements[18].p.v, effectElements[19].p.v, effectElements[20].p.v, effectElements[21].p.v);\n this.feFuncG.setAttribute('tableValues', val);\n }\n if (this.feFuncB && (forceRender || effectElements[24].p._mdf || effectElements[25].p._mdf || effectElements[26].p._mdf || effectElements[27].p._mdf || effectElements[28].p._mdf)) {\n val = this.getTableValue(effectElements[24].p.v, effectElements[25].p.v, effectElements[26].p.v, effectElements[27].p.v, effectElements[28].p.v);\n this.feFuncB.setAttribute('tableValues', val);\n }\n if (this.feFuncA && (forceRender || effectElements[31].p._mdf || effectElements[32].p._mdf || effectElements[33].p._mdf || effectElements[34].p._mdf || effectElements[35].p._mdf)) {\n val = this.getTableValue(effectElements[31].p.v, effectElements[32].p.v, effectElements[33].p.v, effectElements[34].p.v, effectElements[35].p.v);\n this.feFuncA.setAttribute('tableValues', val);\n }\n }\n };\n\n function SVGDropShadowEffect(filter, filterManager, elem, id, source) {\n var globalFilterSize = filterManager.container.globalData.renderConfig.filterSize;\n var filterSize = filterManager.data.fs || globalFilterSize;\n filter.setAttribute('x', filterSize.x || globalFilterSize.x);\n filter.setAttribute('y', filterSize.y || globalFilterSize.y);\n filter.setAttribute('width', filterSize.width || globalFilterSize.width);\n filter.setAttribute('height', filterSize.height || globalFilterSize.height);\n this.filterManager = filterManager;\n var feGaussianBlur = createNS('feGaussianBlur');\n feGaussianBlur.setAttribute('in', 'SourceAlpha');\n feGaussianBlur.setAttribute('result', id + '_drop_shadow_1');\n feGaussianBlur.setAttribute('stdDeviation', '0');\n this.feGaussianBlur = feGaussianBlur;\n filter.appendChild(feGaussianBlur);\n var feOffset = createNS('feOffset');\n feOffset.setAttribute('dx', '25');\n feOffset.setAttribute('dy', '0');\n feOffset.setAttribute('in', id + '_drop_shadow_1');\n feOffset.setAttribute('result', id + '_drop_shadow_2');\n this.feOffset = feOffset;\n filter.appendChild(feOffset);\n var feFlood = createNS('feFlood');\n feFlood.setAttribute('flood-color', '#00ff00');\n feFlood.setAttribute('flood-opacity', '1');\n feFlood.setAttribute('result', id + '_drop_shadow_3');\n this.feFlood = feFlood;\n filter.appendChild(feFlood);\n var feComposite = createNS('feComposite');\n feComposite.setAttribute('in', id + '_drop_shadow_3');\n feComposite.setAttribute('in2', id + '_drop_shadow_2');\n feComposite.setAttribute('operator', 'in');\n feComposite.setAttribute('result', id + '_drop_shadow_4');\n filter.appendChild(feComposite);\n var feMerge = this.createMergeNode(id, [id + '_drop_shadow_4', source]);\n filter.appendChild(feMerge);\n //\n }\n extendPrototype([SVGComposableEffect], SVGDropShadowEffect);\n SVGDropShadowEffect.prototype.renderFrame = function (forceRender) {\n if (forceRender || this.filterManager._mdf) {\n if (forceRender || this.filterManager.effectElements[4].p._mdf) {\n this.feGaussianBlur.setAttribute('stdDeviation', this.filterManager.effectElements[4].p.v / 4);\n }\n if (forceRender || this.filterManager.effectElements[0].p._mdf) {\n var col = this.filterManager.effectElements[0].p.v;\n this.feFlood.setAttribute('flood-color', rgbToHex(Math.round(col[0] * 255), Math.round(col[1] * 255), Math.round(col[2] * 255)));\n }\n if (forceRender || this.filterManager.effectElements[1].p._mdf) {\n this.feFlood.setAttribute('flood-opacity', this.filterManager.effectElements[1].p.v / 255);\n }\n if (forceRender || this.filterManager.effectElements[2].p._mdf || this.filterManager.effectElements[3].p._mdf) {\n var distance = this.filterManager.effectElements[3].p.v;\n var angle = (this.filterManager.effectElements[2].p.v - 90) * degToRads;\n var x = distance * Math.cos(angle);\n var y = distance * Math.sin(angle);\n this.feOffset.setAttribute('dx', x);\n this.feOffset.setAttribute('dy', y);\n }\n }\n };\n\n var _svgMatteSymbols = [];\n function SVGMatte3Effect(filterElem, filterManager, elem) {\n this.initialized = false;\n this.filterManager = filterManager;\n this.filterElem = filterElem;\n this.elem = elem;\n elem.matteElement = createNS('g');\n elem.matteElement.appendChild(elem.layerElement);\n elem.matteElement.appendChild(elem.transformedElement);\n elem.baseElement = elem.matteElement;\n }\n SVGMatte3Effect.prototype.findSymbol = function (mask) {\n var i = 0;\n var len = _svgMatteSymbols.length;\n while (i < len) {\n if (_svgMatteSymbols[i] === mask) {\n return _svgMatteSymbols[i];\n }\n i += 1;\n }\n return null;\n };\n SVGMatte3Effect.prototype.replaceInParent = function (mask, symbolId) {\n var parentNode = mask.layerElement.parentNode;\n if (!parentNode) {\n return;\n }\n var children = parentNode.children;\n var i = 0;\n var len = children.length;\n while (i < len) {\n if (children[i] === mask.layerElement) {\n break;\n }\n i += 1;\n }\n var nextChild;\n if (i <= len - 2) {\n nextChild = children[i + 1];\n }\n var useElem = createNS('use');\n useElem.setAttribute('href', '#' + symbolId);\n if (nextChild) {\n parentNode.insertBefore(useElem, nextChild);\n } else {\n parentNode.appendChild(useElem);\n }\n };\n SVGMatte3Effect.prototype.setElementAsMask = function (elem, mask) {\n if (!this.findSymbol(mask)) {\n var symbolId = createElementID();\n var masker = createNS('mask');\n masker.setAttribute('id', mask.layerId);\n masker.setAttribute('mask-type', 'alpha');\n _svgMatteSymbols.push(mask);\n var defs = elem.globalData.defs;\n defs.appendChild(masker);\n var symbol = createNS('symbol');\n symbol.setAttribute('id', symbolId);\n this.replaceInParent(mask, symbolId);\n symbol.appendChild(mask.layerElement);\n defs.appendChild(symbol);\n var useElem = createNS('use');\n useElem.setAttribute('href', '#' + symbolId);\n masker.appendChild(useElem);\n mask.data.hd = false;\n mask.show();\n }\n elem.setMatte(mask.layerId);\n };\n SVGMatte3Effect.prototype.initialize = function () {\n var ind = this.filterManager.effectElements[0].p.v;\n var elements = this.elem.comp.elements;\n var i = 0;\n var len = elements.length;\n while (i < len) {\n if (elements[i] && elements[i].data.ind === ind) {\n this.setElementAsMask(this.elem, elements[i]);\n }\n i += 1;\n }\n this.initialized = true;\n };\n SVGMatte3Effect.prototype.renderFrame = function () {\n if (!this.initialized) {\n this.initialize();\n }\n };\n\n function SVGGaussianBlurEffect(filter, filterManager, elem, id) {\n // Outset the filter region by 100% on all sides to accommodate blur expansion.\n filter.setAttribute('x', '-100%');\n filter.setAttribute('y', '-100%');\n filter.setAttribute('width', '300%');\n filter.setAttribute('height', '300%');\n this.filterManager = filterManager;\n var feGaussianBlur = createNS('feGaussianBlur');\n feGaussianBlur.setAttribute('result', id);\n filter.appendChild(feGaussianBlur);\n this.feGaussianBlur = feGaussianBlur;\n }\n SVGGaussianBlurEffect.prototype.renderFrame = function (forceRender) {\n if (forceRender || this.filterManager._mdf) {\n // Empirical value, matching AE's blur appearance.\n var kBlurrinessToSigma = 0.3;\n var sigma = this.filterManager.effectElements[0].p.v * kBlurrinessToSigma;\n\n // Dimensions mapping:\n //\n // 1 -> horizontal & vertical\n // 2 -> horizontal only\n // 3 -> vertical only\n //\n var dimensions = this.filterManager.effectElements[1].p.v;\n var sigmaX = dimensions == 3 ? 0 : sigma; // eslint-disable-line eqeqeq\n var sigmaY = dimensions == 2 ? 0 : sigma; // eslint-disable-line eqeqeq\n\n this.feGaussianBlur.setAttribute('stdDeviation', sigmaX + ' ' + sigmaY);\n\n // Repeat edges mapping:\n //\n // 0 -> off -> duplicate\n // 1 -> on -> wrap\n var edgeMode = this.filterManager.effectElements[2].p.v == 1 ? 'wrap' : 'duplicate'; // eslint-disable-line eqeqeq\n this.feGaussianBlur.setAttribute('edgeMode', edgeMode);\n }\n };\n\n function TransformEffect() {}\n TransformEffect.prototype.init = function (effectsManager) {\n this.effectsManager = effectsManager;\n this.type = effectTypes.TRANSFORM_EFFECT;\n this.matrix = new Matrix();\n this.opacity = -1;\n this._mdf = false;\n this._opMdf = false;\n };\n TransformEffect.prototype.renderFrame = function (forceFrame) {\n this._opMdf = false;\n this._mdf = false;\n if (forceFrame || this.effectsManager._mdf) {\n var effectElements = this.effectsManager.effectElements;\n var anchor = effectElements[0].p.v;\n var position = effectElements[1].p.v;\n var isUniformScale = effectElements[2].p.v === 1;\n var scaleHeight = effectElements[3].p.v;\n var scaleWidth = isUniformScale ? scaleHeight : effectElements[4].p.v;\n var skew = effectElements[5].p.v;\n var skewAxis = effectElements[6].p.v;\n var rotation = effectElements[7].p.v;\n this.matrix.reset();\n this.matrix.translate(-anchor[0], -anchor[1], anchor[2]);\n this.matrix.scale(scaleWidth * 0.01, scaleHeight * 0.01, 1);\n this.matrix.rotate(-rotation * degToRads);\n this.matrix.skewFromAxis(-skew * degToRads, (skewAxis + 90) * degToRads);\n this.matrix.translate(position[0], position[1], 0);\n this._mdf = true;\n if (this.opacity !== effectElements[8].p.v) {\n this.opacity = effectElements[8].p.v;\n this._opMdf = true;\n }\n }\n };\n\n function SVGTransformEffect(_, filterManager) {\n this.init(filterManager);\n }\n extendPrototype([TransformEffect], SVGTransformEffect);\n\n function CVTransformEffect(effectsManager) {\n this.init(effectsManager);\n }\n extendPrototype([TransformEffect], CVTransformEffect);\n\n // Registering renderers\n registerRenderer('canvas', CanvasRenderer);\n registerRenderer('html', HybridRenderer);\n registerRenderer('svg', SVGRenderer);\n\n // Registering shape modifiers\n ShapeModifiers.registerModifier('tm', TrimModifier);\n ShapeModifiers.registerModifier('pb', PuckerAndBloatModifier);\n ShapeModifiers.registerModifier('rp', RepeaterModifier);\n ShapeModifiers.registerModifier('rd', RoundCornersModifier);\n ShapeModifiers.registerModifier('zz', ZigZagModifier);\n ShapeModifiers.registerModifier('op', OffsetPathModifier);\n\n // Registering expression plugin\n setExpressionsPlugin(Expressions);\n setExpressionInterfaces(getInterface);\n initialize$1();\n initialize();\n\n // Registering svg effects\n registerEffect$1(20, SVGTintFilter, true);\n registerEffect$1(21, SVGFillFilter, true);\n registerEffect$1(22, SVGStrokeEffect, false);\n registerEffect$1(23, SVGTritoneFilter, true);\n registerEffect$1(24, SVGProLevelsFilter, true);\n registerEffect$1(25, SVGDropShadowEffect, true);\n registerEffect$1(28, SVGMatte3Effect, false);\n registerEffect$1(29, SVGGaussianBlurEffect, true);\n registerEffect$1(35, SVGTransformEffect, false);\n registerEffect(35, CVTransformEffect);\n\n return lottie;\n\n}));\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 static get DEFAULT_SETTINGS() {\n return {\n pasteMode: 'overwrite',\n rowsLimit: Infinity,\n columnsLimit: Infinity,\n copyColumnHeaders: false,\n copyColumnGroupHeaders: false,\n copyColumnHeadersOnly: false\n };\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$getSetting,\n _this$getSetting2,\n _this = this;\n if (this.enabled) {\n return;\n }\n this.pasteMode = (_this$getSetting = this.getSetting('pasteMode')) !== null && _this$getSetting !== void 0 ? _this$getSetting : this.pasteMode;\n this.rowsLimit = isNaN(this.getSetting('rowsLimit')) ? this.rowsLimit : this.getSetting('rowsLimit');\n this.columnsLimit = isNaN(this.getSetting('columnsLimit')) ? this.columnsLimit : this.getSetting('columnsLimit');\n _classPrivateFieldSet(_enableCopyColumnHeaders, this, this.getSetting('copyColumnHeaders'));\n _classPrivateFieldSet(_enableCopyColumnGroupHeaders, this, this.getSetting('copyColumnGroupHeaders'));\n _classPrivateFieldSet(_enableCopyColumnHeadersOnly, this, this.getSetting('copyColumnHeadersOnly'));\n this.uiContainer = (_this$getSetting2 = this.getSetting('uiContainer')) !== null && _this$getSetting2 !== void 0 ? _this$getSetting2 : this.uiContainer;\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() || isHTMLElement(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && !isInternalElement(event.target, this.hot.rootElement))) {\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() || isHTMLElement(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && !isInternalElement(event.target, this.hot.rootElement))) {\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() || isHTMLElement(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && !isInternalElement(event.target, this.hot.rootElement))) {\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 \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.some.js\";\nimport { 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 \"../../core/hooks/index.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 \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.map.js\";\nimport { 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 \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport \"core-js/modules/esnext.iterator.map.js\";\nimport { getComparisonFunction } from \"../../helpers/feature.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}\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 const dataset = new Set(initialData);\n return function (value) {\n return dataset.has(value);\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 return Array.from(new Set(values)).map(value => toEmptyString(value)).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}\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 base.forEach(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 \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.every.js\";\nimport * 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 \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.some.js\";\nimport * 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 \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.some.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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.filter.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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.find.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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.filter.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport \"core-js/modules/esnext.iterator.map.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 themeName: this.hot.getCurrentThemeName(),\n layoutDirection: this.hot.isRtl() ? 'rtl' : 'ltr'\n }));\n _classPrivateFieldGet(_itemsBox, this).init();\n this.hot.addHook('afterSetTheme', (themeName, firstRun) => {\n if (!firstRun) {\n _classPrivateFieldGet(_itemsBox, this).useTheme(themeName);\n }\n });\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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.filter.js\";\nimport \"core-js/modules/esnext.iterator.map.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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport \"core-js/modules/esnext.iterator.map.js\";\nimport \"core-js/modules/esnext.iterator.reduce.js\";\nimport \"core-js/modules/esnext.iterator.some.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 { 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 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 = conditionDefinition.args.map(v => typeof v === 'string' ? v.toLocaleLowerCase(localeForColumn) : v);\n const name = conditionDefinition.name || conditionDefinition.command.key;\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 this.filteringStates.getEntries().reduce((allConditions, _ref2) => {\n let [column, {\n operation,\n conditions\n }] = _ref2;\n allConditions.push({\n column,\n operation,\n conditions: conditions.map(_ref3 => {\n let {\n name,\n args\n } = _ref3;\n return {\n name,\n args: [...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 conditions.forEach(stack => {\n stack.conditions.forEach(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 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 * 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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.filter.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 \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport { 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 let menuInstance;\n const focusNavigator = createFocusNavigator(menuItems);\n const updateNavigatorPosition = element => () => {\n if (menuInstance.isOpened()) {\n menuInstance.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 setMenu(mainMenu);\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 = menuInstance.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 = menuInstance.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 menuInstance.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\n /**\n * Focuses the menu and switches its shortcut context to that one which controls\n * the focus navigation.\n */\n function listen() {\n menuInstance.focus();\n menuInstance.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);\n }\n\n /**\n * Applies the focus controller to the new menu instance.\n *\n * @param {Menu} menu The new menu instance.\n */\n function setMenu(menu) {\n menu.addLocalHook('afterSelectionChange', selectedItem => {\n if (!selectedItem.key.startsWith('filter_')) {\n focusNavigator.clear();\n }\n });\n menu.addLocalHook('afterSubmenuOpen', addKeyboardShortcuts);\n menu.addLocalHook('afterOpen', addKeyboardShortcuts);\n menuInstance = menu;\n }\n\n /**\n * Retrieves the current menu instance.\n *\n * @returns {Menu} The current menu instance.\n */\n function getMenu() {\n return menuInstance;\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 setMenu,\n getMenu,\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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.filter.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport \"core-js/modules/esnext.iterator.map.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 _dropdownMenuTraces = /*#__PURE__*/new WeakMap();\nvar _previousConditionStack = /*#__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 var _this;\n // One listener for the enable/disable functionality\n super(hotInstance);\n _this = this;\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 /**\n * Traces the new menu instances to apply the focus navigation to the latest one.\n *\n * @type {WeakSet}\n */\n _classPrivateFieldInitSpec(this, _dropdownMenuTraces, new WeakSet());\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 {Array}\n */\n _classPrivateFieldInitSpec(this, _previousConditionStack, []);\n this.hot.addHook('afterGetColHeader', 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(_Filters_brand, _this, _onAfterGetColHeader).call(_this, ...args);\n });\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 var _this2 = this;\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', 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(_Filters_brand, _this2, _onAfterDropdownMenuDefaultOptions).call(_this2, ...args);\n });\n this.addHook('beforeDropdownMenuShow', () => _assertClassBrand(_Filters_brand, this, _onBeforeDropdownMenuShow).call(this));\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 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 menu = _classPrivateFieldGet(_menuFocusNavigator, this).getMenu();\n const menuNavigator = menu.getNavigator();\n const lastSelectedMenuItem = _classPrivateFieldGet(_menuFocusNavigator, this).getLastMenuPage();\n menu.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(this.dropdownMenuPlugin.menu, 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 * Imports filter conditions to all columns to the plugin. The method accepts\n * the array of conditions with the same structure as the {@link Filters#exportConditions} method returns.\n * Importing conditions will replace the current conditions. Once replaced, the state of the condition\n * will be reflected in the UI. To apply the changes and filter the table, call\n * the {@link Filters#filter} method eventually.\n *\n * @param {Array} conditions Array of conditions.\n */\n importConditions(conditions) {\n this.conditionCollection.importAllConditions(conditions);\n }\n\n /* eslint-disable jsdoc/require-description-complete-sentence */\n /**\n * Exports filter conditions for all columns from the plugin.\n * The array represents the filter state for each column. For example:\n *\n * ```js\n * [\n * {\n * column: 1,\n * operation: 'conjunction',\n * conditions: [\n * { name: 'gt', args: [95] },\n * ]\n * },\n * {\n * column: 7,\n * operation: 'conjunction',\n * conditions: [\n * { name: 'contains', args: ['mike'] },\n * { name: 'begins_with', args: ['m'] },\n * ]\n * },\n * ]\n * ```\n *\n * @returns {Array}\n */\n exportConditions() {\n return this.conditionCollection.exportAllConditions();\n }\n /* eslint-enable jsdoc/require-description-complete-sentence */\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.exportConditions();\n const allowFiltering = this.hot.runHooks('beforeFilter', conditions, _classPrivateFieldGet(_previousConditionStack, this));\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 _classPrivateFieldSet(_previousConditionStack, this, this.exportConditions());\n this.hot.runHooks('afterFilter', conditions);\n this.hot.view.adjustElementsSize();\n this.hot.render();\n } else {\n this.importConditions(_classPrivateFieldGet(_previousConditionStack, this));\n }\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 * @param {number} headerLevel The index of header level counting from the top (positive\n * values counting from 0 to N).\n *\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 _len3 = arguments.length, components = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n components[_key3] = arguments[_key3];\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 _len4 = arguments.length, components = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n components[_key4 - 1] = arguments[_key4];\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 _len5 = arguments.length, components = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n components[_key5] = arguments[_key5];\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 _len6 = arguments.length, components = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n components[_key6] = arguments[_key6];\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 * Hooks applies the new dropdown menu instance to the focus navigator.\n */\nfunction _onBeforeDropdownMenuShow() {\n const mainMenu = this.dropdownMenuPlugin.menu;\n if (!_classPrivateFieldGet(_dropdownMenuTraces, this).has(mainMenu)) {\n _classPrivateFieldGet(_menuFocusNavigator, this).setMenu(mainMenu);\n }\n _classPrivateFieldGet(_dropdownMenuTraces, this).add(mainMenu);\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.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 const menu = this.dropdownMenuPlugin.menu;\n this.updateDependentComponentsVisibility();\n if (component.constructor === ConditionComponent && !command.inputsCount) {\n this.setListeningDropdownMenu();\n }\n menu.updateMenuDimensions();\n}\n/**\n * On component SelectUI closed listener.\n */\nfunction _onSelectUIClosed() {\n this.setListeningDropdownMenu();\n}\nfunction _onAfterGetColHeader(col, TH, headerLevel) {\n const physicalColumn = this.hot.toPhysicalColumn(col);\n if (this.enabled && this.conditionCollection.hasConditions(physicalColumn) && headerLevel === this.hot.view.getColumnHeadersCount() - 1) {\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 conditionArgsChange\n } = conditionsState;\n if (Array.isArray(conditionArgsChange)) {\n // update the previous condition stack (only for 'by_value' condition) on each dataset\n // change to make the undo/redo work properly\n _classPrivateFieldSet(_previousConditionStack, this, _classPrivateFieldGet(_previousConditionStack, this).map(stack => {\n if (stack.column === column && conditions.length > 0) {\n stack.conditions.forEach(condition => {\n if (condition.name === 'by_value') {\n condition.args = [[...conditionArgsChange]];\n }\n });\n }\n return stack;\n }));\n }\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 \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.reduce.js\";\nimport \"core-js/modules/esnext.iterator.some.js\";\nimport { 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 \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport \"core-js/modules/esnext.iterator.map.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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.filter.js\";\nimport \"core-js/modules/esnext.iterator.for-each.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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport \"core-js/modules/esnext.iterator.map.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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.every.js\";\nimport \"core-js/modules/esnext.iterator.find.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport \"core-js/modules/esnext.iterator.map.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 \"../../core/hooks/index.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 \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.filter.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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.every.js\";\nimport \"core-js/modules/esnext.iterator.map.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 { SEPARATOR } from \"../contextMenu/predefinedItems/index.mjs\";\nimport { Hooks } from \"../../core/hooks/index.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 _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 * 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 static get DEFAULT_SETTINGS() {\n return {\n copyPasteEnabled: true,\n indicators: false,\n columns: []\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 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 _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 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 meta.skipColumnOnPaste = false;\n });\n }\n /**\n * Destroys the plugin instance.\n */\n destroy() {\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 (this.getSetting('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 (this.getSetting('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 (this.getSetting('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 (!this.getSetting('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 const columns = this.getSetting('columns');\n if (Array.isArray(columns)) {\n this.hideColumns(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 \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.filter.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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.every.js\";\nimport \"core-js/modules/esnext.iterator.map.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 { SEPARATOR } from \"../contextMenu/predefinedItems/index.mjs\";\nimport { Hooks } from \"../../core/hooks/index.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 _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 * 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 static get DEFAULT_SETTINGS() {\n return {\n copyPasteEnabled: true,\n indicators: false,\n rows: []\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 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 _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 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 meta.skipRowOnPaste = false;\n });\n }\n /**\n * Destroys the plugin instance.\n */\n destroy() {\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 (this.getSetting('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 (this.getSetting('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 (!this.getSetting('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 const rows = this.getSetting('rows');\n if (Array.isArray(rows)) {\n this.hideRows(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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.some.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 \"../../core/hooks/index.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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.some.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 \"../../core/hooks/index.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 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.getColumnWidth(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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.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 var _this = this;\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', 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(_ManualColumnResize_brand, _this, _onModifyColWidth).call(_this, ...args);\n }, 1);\n this.addHook('beforeStretchingColumnWidth', 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(_ManualColumnResize_brand, _this, _onBeforeStretchingColumnWidth).call(_this, ...args);\n }, 1);\n this.addHook('beforeColumnResize', 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(_ManualColumnResize_brand, _this, _onBeforeColumnResize).call(_this, ...args);\n });\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 this.setManualSize(column, _classPrivateFieldGet(_newSize, this)); // double click sets by auto row size plugin\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 const width = _classPrivateFieldGet(_columnWidthsMap, this).getValueAtIndex(this.hot.toPhysicalColumn(column));\n if (typeof width === 'number') {\n return width;\n }\n return stretchedWidth;\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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.some.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 \"../../core/hooks/index.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) || this.hot.view.getDefaultRowHeight();\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.getFirstFullyVisibleRow();\n const lastVisible = this.hot.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.clientY - TD.getBoundingClientRect().top);\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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.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\"; // 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, this.hot.view.getDefaultRowHeight());\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\";", "'use strict';\n// this method was added to unscopables after implementation\n// in popular engines, so it's moved to a separate module\nvar addToUnscopables = require('../internals/add-to-unscopables');\n\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('flatMap');\n", "'use strict';\nvar call = require('../internals/function-call');\nvar anObject = require('../internals/an-object');\nvar getIteratorDirect = require('../internals/get-iterator-direct');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\nmodule.exports = function (obj, stringHandling) {\n if (!stringHandling || typeof obj !== 'string') anObject(obj);\n var method = getIteratorMethod(obj);\n return getIteratorDirect(anObject(method !== undefined ? call(method, obj) : obj));\n};\n", "'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar getIteratorDirect = require('../internals/get-iterator-direct');\nvar getIteratorFlattenable = require('../internals/get-iterator-flattenable');\nvar createIteratorProxy = require('../internals/iterator-create-proxy');\nvar iteratorClose = require('../internals/iterator-close');\nvar IS_PURE = require('../internals/is-pure');\n\nvar IteratorProxy = createIteratorProxy(function () {\n var iterator = this.iterator;\n var mapper = this.mapper;\n var result, inner;\n\n while (true) {\n if (inner = this.inner) try {\n result = anObject(call(inner.next, inner.iterator));\n if (!result.done) return result.value;\n this.inner = null;\n } catch (error) { iteratorClose(iterator, 'throw', error); }\n\n result = anObject(call(this.next, iterator));\n\n if (this.done = !!result.done) return;\n\n try {\n this.inner = getIteratorFlattenable(mapper(result.value, this.counter++), false);\n } catch (error) { iteratorClose(iterator, 'throw', error); }\n }\n});\n\n// `Iterator.prototype.flatMap` method\n// https://github.com/tc39/proposal-iterator-helpers\n$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {\n flatMap: function flatMap(mapper) {\n anObject(this);\n aCallable(mapper);\n return new IteratorProxy(getIteratorDirect(this), {\n mapper: mapper,\n inner: null\n });\n }\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 _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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.filter.js\";\nimport \"core-js/modules/esnext.iterator.flat-map.js\";\nimport \"core-js/modules/esnext.iterator.for-each.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, clamp } 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} range The range to search merged cells for.\n * @returns {MergedCellCoords | false}\n */\n getByRange(range) {\n const {\n row: rowStart,\n col: columnStart\n } = range.getTopStartCorner();\n const {\n row: rowEnd,\n col: columnEnd\n } = range.getBottomEndCorner();\n const mergedCellsLength = this.mergedCells.length;\n let result = false;\n for (let i = 0; i < mergedCellsLength; i++) {\n const mergedCell = this.mergedCells[i];\n const {\n row,\n col,\n rowspan,\n colspan\n } = mergedCell;\n if (row >= rowStart && row + rowspan - 1 <= rowEnd && col >= columnStart && col + colspan - 1 <= columnEnd) {\n result = mergedCell;\n break;\n }\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 if (isOverlapping) {\n warn(MergedCellsCollection.IS_OVERLAPPING_WARNING(newMergedCell));\n }\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 if (!mergeParent) {\n return false;\n }\n const {\n row: mergeRow,\n col: mergeColumn,\n rowspan,\n colspan\n } = mergeParent;\n const overlayName = this.hot.view.getActiveOverlayName();\n const firstRenderedRow = ['top', 'top_inline_start_corner'].includes(overlayName) ? 0 : this.hot.getFirstRenderedVisibleRow();\n const firstRenderedColumn = ['inline_start', 'top_inline_start_corner', 'bottom_inline_start_corner'].includes(overlayName) ? 0 : this.hot.getFirstRenderedVisibleColumn();\n const mergeCellsTopRow = clamp(firstRenderedRow, mergeRow, mergeRow + rowspan - 1);\n const mergeCellsStartColumn = clamp(firstRenderedColumn, mergeColumn, mergeColumn + colspan - 1);\n return this.hot.rowIndexMapper.getNearestNotHiddenIndex(mergeCellsTopRow, 1) === row && this.hot.columnIndexMapper.getNearestNotHiddenIndex(mergeCellsStartColumn, 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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.every.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 * Get the direction of the autofill process.\n *\n * @param {Array} baseArea The selection area.\n * @param {Array} fullArea The final area (base + drag).\n * @returns {string} `up`, `down`, `left` or `right`.\n */\n getDirection(baseArea, fullArea) {\n let direction = null;\n if (fullArea[0] === baseArea[0] && fullArea[1] === baseArea[1] && fullArea[3] === baseArea[3]) {\n direction = 'down';\n } else if (fullArea[2] === baseArea[2] && fullArea[1] === baseArea[1] && fullArea[3] === baseArea[3]) {\n direction = 'up';\n } else if (fullArea[1] === baseArea[1] && fullArea[2] === baseArea[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} fullArea 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, fullArea, dragDirection, foundMergedCells) {\n const newDragArea = fullArea.slice(0);\n const fillSize = this.getAutofillSize(baseArea, fullArea, 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, fullArea, 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} fullArea 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, fullArea, direction) {\n const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;\n const [dragAreaStartRow, dragAreaStartColumn, dragAreaEndRow, dragAreaEndColumn] = fullArea;\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} fullArea 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, fullArea, direction) {\n const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;\n const [fullAreaStartRow, fullAreaStartColumn, fullAreaEndRow, fullAreaEndColumn] = fullArea;\n switch (direction) {\n case 'up':\n return [fullAreaStartRow, fullAreaStartColumn, baseAreaStartRow - 1, baseAreaEndColumn];\n case 'down':\n {\n const mergedCell = this.mergedCellsCollection.get(fullAreaEndRow, baseAreaEndColumn);\n const rowShift = mergedCell ? mergedCell.rowspan - 1 : 0;\n return [baseAreaEndRow + 1, baseAreaStartColumn, fullAreaEndRow + rowShift, baseAreaEndColumn];\n }\n case 'left':\n return [fullAreaStartRow, fullAreaStartColumn, baseAreaEndRow, baseAreaStartColumn - 1];\n case 'right':\n {\n const mergedCell = this.mergedCellsCollection.get(fullAreaEndRow, baseAreaEndColumn);\n const columnShift = mergedCell ? mergedCell.colspan - 1 : 0;\n return [baseAreaStartRow, baseAreaEndColumn + columnShift, fullAreaEndRow, fullAreaEndColumn];\n }\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} fullArea 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, fullArea, 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, fullArea, 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 }, true);\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 }, true);\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 }, true);\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 }, true);\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 const mergedCellsWithPartials = this.mergedCellsCollection.getWithinRange(dragRange, true);\n if (mergedCellsWithPartials.length === 0) {\n return false;\n }\n const mergedCellsWithoutPartials = this.mergedCellsCollection.getWithinRange(dragRange, false);\n if (mergedCellsWithoutPartials.length === 0) {\n return true;\n }\n if (direction === 'up' || direction === 'down') {\n return !mergedCellsWithoutPartials.every(_ref => {\n let {\n colspan\n } = _ref;\n return colspan === dragRange.getWidth();\n });\n }\n return !mergedCellsWithoutPartials.every(_ref2 => {\n let {\n rowspan\n } = _ref2;\n return rowspan === dragRange.getHeight();\n });\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 Visual 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 isVirtualRenderingEnabled = plugin.getSetting('virtualized');\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 let notHiddenRow = rowMapper.getNearestNotHiddenIndex(origRow, 1);\n let notHiddenColumn = columnMapper.getNearestNotHiddenIndex(origColumn, 1);\n if (isVirtualRenderingEnabled) {\n const overlayName = hot.view.getActiveOverlayName();\n if (!['top', 'top_inline_start_corner'].includes(overlayName)) {\n notHiddenRow = Math.max(notHiddenRow, hot.getFirstRenderedVisibleRow());\n }\n if (!['inline_start', 'top_inline_start_corner', 'bottom_inline_start_corner'].includes(overlayName)) {\n notHiddenColumn = Math.max(notHiddenColumn, hot.getFirstRenderedVisibleColumn());\n }\n }\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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.filter.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport \"core-js/modules/esnext.iterator.map.js\";\nimport \"core-js/modules/esnext.iterator.reduce.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, defaultMainSettingSymbol } from \"../base/index.mjs\";\nimport { Hooks } from \"../../core/hooks/index.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, clamp } 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 static get DEFAULT_SETTINGS() {\n return {\n [defaultMainSettingSymbol]: 'cells',\n virtualized: false,\n cells: []\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 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('modifyGetCoordsElement', 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, _onModifyGetCellCoords).call(_this, ...args);\n });\n this.addHook('afterIsMultipleSelection', 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, _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 _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {\n args[_key14] = arguments[_key14];\n }\n return _assertClassBrand(_MergeCells_brand, _this, _addMergeActionsToContextMenu).call(_this, ...args);\n });\n this.addHook('afterGetCellMeta', 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, _onAfterGetCellMeta).call(_this, ...args);\n });\n this.addHook('afterViewportRowCalculatorOverride', 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, _onAfterViewportRowCalculatorOverride).call(_this, ...args);\n });\n this.addHook('afterViewportColumnCalculatorOverride', 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, _onAfterViewportColumnCalculatorOverride).call(_this, ...args);\n });\n this.addHook('modifyAutofillRange', 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, _onModifyAutofillRange).call(_this, ...args);\n });\n this.addHook('afterCreateCol', 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, _onAfterCreateCol).call(_this, ...args);\n });\n this.addHook('afterRemoveCol', 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, _onAfterRemoveCol).call(_this, ...args);\n });\n this.addHook('afterCreateRow', 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, _onAfterCreateRow).call(_this, ...args);\n });\n this.addHook('afterRemoveRow', 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, _onAfterRemoveRow).call(_this, ...args);\n });\n this.addHook('afterChange', 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, _onAfterChange).call(_this, ...args);\n });\n this.addHook('beforeDrawBorders', 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, _onBeforeDrawAreaBorders).call(_this, ...args);\n });\n this.addHook('afterDrawSelection', 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, _onAfterDrawSelection).call(_this, ...args);\n });\n this.addHook('beforeRemoveCellClassNames', 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, _onBeforeRemoveCellClassNames).call(_this, ...args);\n });\n this.addHook('beforeBeginEditing', 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, _onBeforeBeginEditing).call(_this, ...args);\n });\n this.addHook('modifyRowHeightByOverlayName', function () {\n for (var _len28 = arguments.length, args = new Array(_len28), _key28 = 0; _key28 < _len28; _key28++) {\n args[_key28] = arguments[_key28];\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 this.disablePlugin();\n this.enablePlugin();\n this.generateFromSettings();\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 */\n generateFromSettings() {\n const validSettings = this.getSetting('cells').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} fullArea The drag + base area coordinates.\n * @param {Array} baseArea The selection information.\n * @returns {Array} The new drag area.\n */\n}\nfunction _onAfterInit() {\n this.generateFromSettings();\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 * The `modifyGetCellCoords` hook callback allows forwarding all `getCell` calls that point in-between the merged cells\n * to the root element of the cell.\n *\n * @param {number} row Row index.\n * @param {number} column Visual column index.\n * @param {boolean} topmost Indicates if the requested element belongs to the topmost layer (any overlay) or not.\n * @param {string} [source] String that identifies how this coords change will be processed.\n * @returns {Array|undefined} Visual coordinates of the merge.\n */\nfunction _onModifyGetCellCoords(row, column, topmost, source) {\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 const topStartRow = mergeRow;\n const topStartColumn = mergeColumn;\n const bottomEndRow = mergeRow + rowspan - 1;\n const bottomEndColumn = mergeColumn + colspan - 1;\n if (source === 'render' && this.getSetting('virtualized')) {\n const overlayName = this.hot.view.getActiveOverlayName();\n const firstRenderedRow = ['top', 'top_inline_start_corner'].includes(overlayName) ? 0 : this.hot.getFirstRenderedVisibleRow();\n const firstRenderedColumn = ['inline_start', 'top_inline_start_corner', 'bottom_inline_start_corner'].includes(overlayName) ? 0 : this.hot.getFirstRenderedVisibleColumn();\n return [clamp(firstRenderedRow, topStartRow, bottomEndRow), clamp(firstRenderedColumn, topStartColumn, bottomEndColumn), clamp(this.hot.getLastRenderedVisibleRow(), topStartRow, bottomEndRow), clamp(this.hot.getLastRenderedVisibleColumn(), topStartColumn, bottomEndColumn)];\n }\n return [topStartRow, topStartColumn, bottomEndRow, bottomEndColumn];\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 if (this.getSetting('virtualized')) {\n return;\n }\n const nrOfColumns = this.hot.countCols();\n this.modifyViewportRowStart(calc, nrOfColumns);\n this.modifyViewportRowEnd(calc, nrOfColumns);\n}\nfunction _onAfterViewportColumnCalculatorOverride(calc) {\n if (this.getSetting('virtualized')) {\n return;\n }\n const nrOfRows = this.hot.countRows();\n this.modifyViewportColumnStart(calc, nrOfRows);\n this.modifyViewportColumnEnd(calc, nrOfRows);\n}\nfunction _onModifyAutofillRange(fullArea, baseArea) {\n const dragDirection = this.autofillCalculations.getDirection(baseArea, fullArea);\n if (this.autofillCalculations.dragAreaOverlapsCollections(baseArea, fullArea, dragDirection)) {\n return baseArea;\n }\n const from = this.hot._createCellCoords(baseArea[0], baseArea[1]);\n const to = this.hot._createCellCoords(baseArea[2], baseArea[3]);\n const range = this.hot._createCellRange(from, from, to);\n const mergedCellsWithinSelectionArea = this.mergedCellsCollection.getWithinRange(range);\n if (mergedCellsWithinSelectionArea.length === 0) {\n return fullArea;\n }\n return this.autofillCalculations.snapDragArea(baseArea, fullArea, dragDirection, mergedCellsWithinSelectionArea);\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.getFirstRenderedVisibleColumn();\n lastColumn = this.hot.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, true);\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 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 !== 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 {\n view,\n rowIndexMapper\n } = this.hot;\n const stylesHandler = view.getStylesHandler();\n const defaultHeight = view.getDefaultRowHeight();\n let height = 0;\n for (let i = row; i < row + rowspan; i++) {\n if (!rowIndexMapper.isHidden(i)) {\n var _this$hot$getRowHeigh;\n height += (_this$hot$getRowHeigh = this.hot.getRowHeight(i)) !== null && _this$hot$getRowHeigh !== void 0 ? _this$hot$getRowHeigh : defaultHeight;\n if (i === 0 && !stylesHandler.isClassicTheme()) {\n height += 1; // border-top-width\n }\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 \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.filter.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 { 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 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 !!this.hot.getSettings()[this.pluginKey];\n }\n\n /**\n * Enables the plugin functionality for this Handsontable instance.\n */\n enablePlugin() {\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 * 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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.map.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 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 !== 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 const currentThemeName = this.hot.getCurrentThemeName();\n this.container = this.hot.rootDocument.createElement('div');\n this.container.classList.add('handsontable', 'htGhostTable', 'htAutoSize');\n if (currentThemeName) {\n this.container.classList.add(currentThemeName);\n }\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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.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 _recentlyHighlightCoords = /*#__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 * Keeps the last highlight position made by column selection. The coords are necessary to scroll\n * the viewport to the correct position when the nested header is clicked when the `navigableHeaders`\n * option is disabled.\n *\n * @type {CellCoords | null}\n */\n _classPrivateFieldInitSpec(this, _recentlyHighlightCoords, null);\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 removeClass(TH, 'hiddenHeaderText');\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, _wtOverlays$topOverla;\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 const isTopOverlay = (_wtOverlays$topOverla = wtOverlays.topOverlay) === null || _wtOverlays$topOverla === void 0 ? void 0 : _wtOverlays$topOverla.clone.wtTable.THEAD.contains(TH);\n if (isTopOverlay && visualColumnIndex < fixedColumnsStart) {\n addClass(TH, 'hiddenHeaderText');\n }\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 * @param {{ value: 'auto' | 'start' | 'end' }} snapping If `'start'`, viewport is scrolled to show\n * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of\n * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.\n * @returns {number}\n */\nfunction _onBeforeViewportScrollHorizontally(visualColumn, snapping) {\n var _classPrivateFieldGet4;\n const selection = this.hot.getSelectedRangeLast();\n if (!selection) {\n return visualColumn;\n }\n const {\n highlight\n } = selection;\n const {\n navigableHeaders\n } = this.hot.getSettings();\n const isSelectedByColumnHeader = this.hot.selection.isSelectedByColumnHeader();\n const highlightRow = navigableHeaders ? highlight.row : (_classPrivateFieldGet4 = _classPrivateFieldGet(_recentlyHighlightCoords, this)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.row;\n const highlightColumn = isSelectedByColumnHeader ? visualColumn : highlight.col;\n const isNestedHeadersRange = highlightRow < 0 && highlightColumn >= 0;\n _classPrivateFieldSet(_recentlyHighlightCoords, this, null);\n if (!isNestedHeadersRange) {\n return visualColumn;\n }\n const firstVisibleColumn = this.hot.getFirstFullyVisibleColumn();\n const lastVisibleColumn = this.hot.getLastFullyVisibleColumn();\n const viewportWidth = lastVisibleColumn - firstVisibleColumn + 1;\n const mostLeftColumnIndex = _classPrivateFieldGet(_stateManager, this).findLeftMostColumnIndex(highlightRow, highlightColumn);\n const mostRightColumnIndex = _classPrivateFieldGet(_stateManager, this).findRightMostColumnIndex(highlightRow, highlightColumn);\n const headerWidth = mostRightColumnIndex - mostLeftColumnIndex + 1;\n\n // scroll the viewport always to the left when the header is wider than the viewport\n if (mostLeftColumnIndex < firstVisibleColumn && mostRightColumnIndex > lastVisibleColumn) {\n return mostLeftColumnIndex;\n }\n if (isSelectedByColumnHeader) {\n let scrollColumnIndex = null;\n if (mostLeftColumnIndex >= firstVisibleColumn && mostRightColumnIndex > lastVisibleColumn) {\n if (headerWidth > viewportWidth) {\n snapping.value = 'start';\n scrollColumnIndex = mostLeftColumnIndex;\n } else {\n snapping.value = 'end';\n scrollColumnIndex = mostRightColumnIndex;\n }\n } else if (mostLeftColumnIndex < firstVisibleColumn && mostRightColumnIndex <= lastVisibleColumn) {\n if (headerWidth > viewportWidth) {\n snapping.value = 'end';\n scrollColumnIndex = mostRightColumnIndex;\n } else {\n snapping.value = 'start';\n scrollColumnIndex = mostLeftColumnIndex;\n }\n }\n return scrollColumnIndex;\n }\n return mostLeftColumnIndex <= firstVisibleColumn ? 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 _classPrivateFieldGet5;\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 = (_classPrivateFieldGet5 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.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() || controller.column) {\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 * @param {CellCoords} highlight The coords object where the focus is.\n */\nfunction _onBeforeSelectColumns(from, to, highlight) {\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 _classPrivateFieldSet(_recentlyHighlightCoords, this, highlight.clone());\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 if (_classPrivateFieldGet(_stateManager, this).getLayersCount() > 0) {\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/**\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 _classPrivateFieldGet6;\n const {\n label\n } = (_classPrivateFieldGet6 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet6 !== void 0 ? _classPrivateFieldGet6 : {\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 const stylesHandler = this.hot.view.getStylesHandler();\n let completeVerticalPadding = 11;\n if (!stylesHandler.isClassicTheme()) {\n const verticalPadding = stylesHandler.getCSSVariableValue('cell-horizontal-padding');\n completeVerticalPadding = verticalPadding * 2;\n }\n this.rowHeaderWidthCache = Math.max(50, completeVerticalPadding + 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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport \"core-js/modules/esnext.iterator.map.js\";\nimport \"core-js/modules/esnext.iterator.some.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 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 this.hot.selectCells([[startRow, 0, endRow, this.hot.countCols() - 1]], false);\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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport \"core-js/modules/esnext.iterator.reduce.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 \"../../core/hooks/index.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\";\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 * @typedef StretchStrategyCalcArgs\n * @property {number} viewportWidth The width of the viewport.\n */\n/**\n * The base strategy stretching strategy to extend from.\n *\n * @private\n * @class StretchStrategy\n */\nexport class StretchStrategy {\n constructor(overwriteColumnWidthFn) {\n /**\n * The width of the viewport.\n *\n * @type {number}\n */\n _defineProperty(this, \"viewportWidth\", void 0);\n /**\n * The function to overwrite the column width.\n *\n * @type {function(number, number): number | undefined}\n */\n _defineProperty(this, \"overwriteColumnWidthFn\", void 0);\n /**\n * The map that stores the base column widths.\n *\n * @type {Map}\n */\n _defineProperty(this, \"baseWidths\", new Map());\n /**\n * The map that stores the calculated, stretched column widths.\n *\n * @type {Map}\n */\n _defineProperty(this, \"stretchedWidths\", new Map());\n this.overwriteColumnWidthFn = overwriteColumnWidthFn;\n }\n\n /**\n * Prepares the strategy for the calculation.\n *\n * @param {StretchStrategyCalcArgs} calcArgs The calculation arguments.\n */\n prepare(_ref) {\n let {\n viewportWidth\n } = _ref;\n this.viewportWidth = viewportWidth;\n this.baseWidths.clear();\n this.stretchedWidths.clear();\n }\n\n /**\n * Sets the base widths of the columns with which the strategy will work with.\n *\n * @param {number} columnVisualIndex The visual index of the column.\n * @param {number} columnWidth The width of the column.\n */\n setColumnBaseWidth(columnVisualIndex, columnWidth) {\n this.baseWidths.set(columnVisualIndex, columnWidth);\n }\n\n /**\n * Calculates the width of the column.\n */\n calculate() {}\n\n /**\n * Gets the calculated stretched column widths.\n *\n * @returns {Array}\n */\n getWidths() {\n return Array.from(this.stretchedWidths);\n }\n}", "import \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport \"core-js/modules/esnext.iterator.reduce.js\";\nimport { DEFAULT_COLUMN_WIDTH } from \"../../../3rdparty/walkontable/src/index.mjs\";\nimport { StretchStrategy } from \"./_base.mjs\";\n/**\n * The strategy calculates the column widths by stretching all columns evenly.\n *\n * @private\n * @class StretchAllStrategy\n */\nexport class StretchAllStrategy extends StretchStrategy {\n /**\n * Calculates the columns widths.\n */\n calculate() {\n const allColumnsWidth = Array.from(this.baseWidths).reduce((sum, _ref) => {\n let [, width] = _ref;\n return sum + width;\n }, 0);\n const remainingViewportWidth = this.viewportWidth - allColumnsWidth;\n if (remainingViewportWidth < 0) {\n this.stretchedWidths.clear();\n return;\n }\n const initialStretchRatio = this.viewportWidth / allColumnsWidth;\n const stretchedWidths = [];\n const fixedColumns = [];\n let viewportWidth = this.viewportWidth;\n let allStretchedColumnsWidth = 0;\n this.baseWidths.forEach((columnWidth, columnVisualIndex) => {\n const stretchedWidth = Math.round(columnWidth * initialStretchRatio);\n const finalWidth = this.overwriteColumnWidthFn(stretchedWidth, columnVisualIndex);\n if (stretchedWidth === finalWidth && stretchedWidth >= DEFAULT_COLUMN_WIDTH) {\n stretchedWidths.push([columnVisualIndex, finalWidth]);\n allStretchedColumnsWidth += finalWidth;\n } else if (stretchedWidth !== finalWidth) {\n stretchedWidths.push([columnVisualIndex, finalWidth]);\n fixedColumns.push(columnVisualIndex);\n viewportWidth -= finalWidth;\n }\n });\n if (viewportWidth <= DEFAULT_COLUMN_WIDTH) {\n this.stretchedWidths.clear();\n return;\n }\n const finalStretchRatio = viewportWidth / allStretchedColumnsWidth;\n let lastColumnIndex = -1;\n let sumColumnsWithoutLastOne = 0;\n stretchedWidths.forEach((_ref2, index) => {\n let [columnVisualIndex, columnWidth] = _ref2;\n let newWidth = columnWidth;\n if (!fixedColumns.includes(columnVisualIndex)) {\n newWidth = Math.round(columnWidth * finalStretchRatio);\n }\n this.stretchedWidths.set(columnVisualIndex, newWidth);\n lastColumnIndex = columnVisualIndex;\n if (index < stretchedWidths.length - 1) {\n sumColumnsWithoutLastOne += newWidth;\n }\n });\n if (this.stretchedWidths.size > 1) {\n this.stretchedWidths.set(lastColumnIndex, Math.round(this.viewportWidth - sumColumnsWithoutLastOne));\n }\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.reduce.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 { StretchStrategy } from \"./_base.mjs\";\n/**\n * @typedef StretchStrategyCalcArgs\n * @property {number} viewportWidth The width of the viewport.\n */\n/**\n * The strategy calculates only the last column widths to fill the viewport.\n *\n * @private\n * @class StretchLastStrategy\n */\nvar _lastColumnWidth = /*#__PURE__*/new WeakMap();\nvar _lastColumnIndex = /*#__PURE__*/new WeakMap();\nexport class StretchLastStrategy extends StretchStrategy {\n constructor() {\n super(...arguments);\n /**\n * The width of the last calculated column.\n *\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _lastColumnWidth, 0);\n /**\n * The index of the last calculated column.\n *\n * @type {number}\n */\n _classPrivateFieldInitSpec(this, _lastColumnIndex, -1);\n }\n /**\n * Prepares the strategy for the calculation.\n *\n * @param {StretchStrategyCalcArgs} calcArgs The calculation arguments.\n */\n prepare(calcArgs) {\n super.prepare(calcArgs);\n _classPrivateFieldSet(_lastColumnWidth, this, 0);\n _classPrivateFieldSet(_lastColumnIndex, this, -1);\n }\n\n /**\n * Sets the base widths of the columns with which the strategy will work with.\n *\n * @param {number} columnVisualIndex The visual index of the column.\n * @param {number} columnWidth The width of the column.\n */\n setColumnBaseWidth(columnVisualIndex, columnWidth) {\n super.setColumnBaseWidth(columnVisualIndex, columnWidth);\n _classPrivateFieldSet(_lastColumnIndex, this, columnVisualIndex);\n _classPrivateFieldSet(_lastColumnWidth, this, columnWidth);\n }\n\n /**\n * Calculates the columns widths.\n */\n calculate() {\n if (_classPrivateFieldGet(_lastColumnIndex, this) === -1) {\n return;\n }\n const allColumnsWidth = Array.from(this.baseWidths).reduce((sum, _ref) => {\n let [, width] = _ref;\n return sum + width;\n }, 0);\n const lastColumnWidth = Math.max(this.viewportWidth - allColumnsWidth + _classPrivateFieldGet(_lastColumnWidth, this), 0);\n this.stretchedWidths.set(_classPrivateFieldGet(_lastColumnIndex, this), lastColumnWidth);\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.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 { DEFAULT_COLUMN_WIDTH } from \"../../3rdparty/walkontable/src/index.mjs\";\nimport { getScrollbarWidth } from \"../../helpers/dom/element.mjs\";\nimport { StretchAllStrategy } from \"./strategies/all.mjs\";\nimport { StretchLastStrategy } from \"./strategies/last.mjs\";\nconst STRETCH_WIDTH_MAP_NAME = 'stretchColumns';\n\n/**\n * The class responsible for calculating the column widths based on the specified column stretching strategy.\n *\n * @private\n * @class StretchCalculator\n */\nvar _hot = /*#__PURE__*/new WeakMap();\nvar _widthsMap = /*#__PURE__*/new WeakMap();\nvar _stretchStrategies = /*#__PURE__*/new WeakMap();\nvar _activeStrategy = /*#__PURE__*/new WeakMap();\nvar _StretchCalculator_brand = /*#__PURE__*/new WeakSet();\nexport class StretchCalculator {\n constructor(hotInstance) {\n /**\n * Checks if the vertical scrollbar will appear. Based on the current data and viewport size\n * the method calculates if the vertical scrollbar will appear after the table is rendered.\n * The method is a workaround for the issue in the Walkontable that returns unstable viewport\n * size.\n *\n * @returns {boolean}\n */\n _classPrivateMethodInitSpec(this, _StretchCalculator_brand);\n /**\n * The Handsontable instance.\n *\n * @type {Core}\n */\n _classPrivateFieldInitSpec(this, _hot, void 0);\n /**\n * The map that stores the calculated column widths.\n *\n * @type {IndexToValueMap}\n */\n _classPrivateFieldInitSpec(this, _widthsMap, void 0);\n /**\n * The map that stores the available stretch strategies.\n *\n * @type {Map}\n */\n _classPrivateFieldInitSpec(this, _stretchStrategies, new Map([['all', new StretchAllStrategy(_assertClassBrand(_StretchCalculator_brand, this, _overwriteColumnWidthFn).bind(this))], ['last', new StretchLastStrategy(_assertClassBrand(_StretchCalculator_brand, this, _overwriteColumnWidthFn).bind(this))]]));\n /**\n * The active stretch mode.\n *\n * @type {'all' | 'last' | 'none'}\n */\n _classPrivateFieldInitSpec(this, _activeStrategy, 'none');\n _classPrivateFieldSet(_hot, this, hotInstance);\n _classPrivateFieldSet(_widthsMap, this, _classPrivateFieldGet(_hot, this).columnIndexMapper.createAndRegisterIndexMap(STRETCH_WIDTH_MAP_NAME, 'physicalIndexToValue'));\n }\n\n /**\n * Sets the active stretch strategy.\n *\n * @param {'all' | 'last' | 'none'} strategyName The stretch strategy to use.\n */\n useStrategy(strategyName) {\n _classPrivateFieldSet(_activeStrategy, this, _classPrivateFieldGet(_stretchStrategies, this).has(strategyName) ? strategyName : 'none');\n }\n\n /**\n * Recalculates the column widths.\n */\n refreshStretching() {\n if (_classPrivateFieldGet(_activeStrategy, this) === 'none') {\n _classPrivateFieldGet(_widthsMap, this).clear();\n return;\n }\n _classPrivateFieldGet(_hot, this).batchExecution(() => {\n _classPrivateFieldGet(_widthsMap, this).clear();\n const stretchStrategy = _classPrivateFieldGet(_stretchStrategies, this).get(_classPrivateFieldGet(_activeStrategy, this));\n const view = _classPrivateFieldGet(_hot, this).view;\n let viewportWidth = view.getViewportWidth();\n if (_assertClassBrand(_StretchCalculator_brand, this, _willVerticalScrollAppear).call(this)) {\n viewportWidth -= getScrollbarWidth(_classPrivateFieldGet(_hot, this).rootDocument);\n }\n stretchStrategy.prepare({\n viewportWidth\n });\n for (let columnIndex = 0; columnIndex < _classPrivateFieldGet(_hot, this).countCols(); columnIndex++) {\n if (!_classPrivateFieldGet(_hot, this).columnIndexMapper.isHidden(_classPrivateFieldGet(_hot, this).toPhysicalColumn(columnIndex))) {\n stretchStrategy.setColumnBaseWidth(columnIndex, _assertClassBrand(_StretchCalculator_brand, this, _getWidthWithoutStretching).call(this, columnIndex));\n }\n }\n stretchStrategy.calculate();\n stretchStrategy.getWidths().forEach(_ref => {\n let [columnIndex, width] = _ref;\n _classPrivateFieldGet(_widthsMap, this).setValueAtIndex(_classPrivateFieldGet(_hot, this).toPhysicalColumn(columnIndex), width);\n });\n }, true);\n }\n\n /**\n * Gets the calculated column width.\n *\n * @param {number} columnVisualIndex Column visual index.\n * @returns {number | null}\n */\n getStretchedWidth(columnVisualIndex) {\n return _classPrivateFieldGet(_widthsMap, this).getValueAtIndex(_classPrivateFieldGet(_hot, this).toPhysicalColumn(columnVisualIndex));\n }\n}\nfunction _willVerticalScrollAppear() {\n const {\n view\n } = _classPrivateFieldGet(_hot, this);\n if (view.isVerticallyScrollableByWindow()) {\n return false;\n }\n const viewportHeight = view.getViewportHeight();\n const totalRows = _classPrivateFieldGet(_hot, this).countRows();\n const defaultRowHeight = view.getStylesHandler().getDefaultRowHeight();\n let totalHeight = 0;\n let hasVerticalScroll = false;\n for (let row = 0; row < totalRows; row++) {\n var _classPrivateFieldGet2;\n totalHeight += ((_classPrivateFieldGet2 = _classPrivateFieldGet(_hot, this).getRowHeight(row)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : defaultRowHeight) + (row === 0 ? 1 : 0);\n if (totalHeight > viewportHeight) {\n hasVerticalScroll = true;\n break;\n }\n }\n return hasVerticalScroll;\n}\n/**\n * Gets the column width from the Handsontable API without logic related to stretching.\n *\n * @param {number} columnVisualIndex Column visual index.\n * @returns {number}\n */\nfunction _getWidthWithoutStretching(columnVisualIndex) {\n var _classPrivateFieldGet3;\n return (_classPrivateFieldGet3 = _classPrivateFieldGet(_hot, this).getColWidth(columnVisualIndex, 'StretchColumns')) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : DEFAULT_COLUMN_WIDTH;\n}\n/**\n * Executes the hook that allows to overwrite the column width.\n *\n * @param {number} columnWidth The column width.\n * @param {number} columnVisualIndex Column visual index.\n * @returns {number}\n */\nfunction _overwriteColumnWidthFn(columnWidth, columnVisualIndex) {\n return _classPrivateFieldGet(_hot, this).runHooks('beforeStretchingColumnWidth', columnWidth, columnVisualIndex);\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.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 { StretchCalculator } from \"./calculator.mjs\";\nexport const PLUGIN_KEY = 'stretchColumns';\nexport const PLUGIN_PRIORITY = 155;\n\n/* eslint-disable jsdoc/require-description-complete-sentence */\n/**\n * @plugin StretchColumns\n * @class StretchColumns\n *\n * @description\n * This plugin allows to set column widths based on their widest cells.\n *\n * By default, the plugin is declared as `'none'`, which makes it disabled (same as if it was declared as `false`).\n *\n * The plugin determines what happens when the declared grid width is different from the calculated sum of all column widths.\n *\n * ```js\n * // fit the grid to the container, by stretching only the last column\n * stretchH: 'last',\n *\n * // fit the grid to the container, by stretching all columns evenly\n * stretchH: 'all',\n * ```\n *\n * To configure this plugin see {@link Options#stretchH}.\n *\n * @example\n *\n * ::: only-for javascript\n * ```js\n * const hot = new Handsontable(document.getElementById('example'), {\n * data: getData(),\n * stretchH: 'all',\n * });\n * ```\n * :::\n *\n * ::: only-for react\n * ```jsx\n * const hotRef = useRef(null);\n *\n * ...\n *\n * // First, let's construct Handsontable\n * \n * ```\n * :::\n */\n/* eslint-enable jsdoc/require-description-complete-sentence */\nvar _stretchCalculator = /*#__PURE__*/new WeakMap();\nvar _previousTableWidth = /*#__PURE__*/new WeakMap();\nvar _resizeObserver = /*#__PURE__*/new WeakMap();\nvar _StretchColumns_brand = /*#__PURE__*/new WeakSet();\nexport class StretchColumns extends BasePlugin {\n constructor() {\n super(...arguments);\n /**\n * Hook that modifies the column width - applies by the stretching logic.\n *\n * @param {number} width The column width.\n * @param {number} column The visual column index.\n * @param {string} source The source of the modification.\n * @returns {number}\n */\n _classPrivateMethodInitSpec(this, _StretchColumns_brand);\n /**\n * The stretch calculator.\n *\n * @type {StretchCalculator}\n */\n _classPrivateFieldInitSpec(this, _stretchCalculator, new StretchCalculator(this.hot));\n /**\n * The previous width of the root element. Helps to determine if the width has changed.\n *\n * @type {number | null}\n */\n _classPrivateFieldInitSpec(this, _previousTableWidth, null);\n /**\n * It observes the root element to detect changes in its width, and if detected, then it triggers\n * the table dimension calculations. In a situation where the browser's vertical scrollbar\n * appears - caused by some external UI element, the observer triggers the render.\n *\n * @type {ResizeObserver}\n */\n _classPrivateFieldInitSpec(this, _resizeObserver, new ResizeObserver(entries => {\n requestAnimationFrame(() => {\n var _this$hot;\n if (!((_this$hot = this.hot) !== null && _this$hot !== void 0 && _this$hot.view.isHorizontallyScrollableByWindow())) {\n return;\n }\n entries.forEach(_ref => {\n let {\n contentRect\n } = _ref;\n if (_classPrivateFieldGet(_previousTableWidth, this) !== null && _classPrivateFieldGet(_previousTableWidth, this) !== contentRect.width) {\n this.hot.refreshDimensions();\n this.hot.view.adjustElementsSize();\n }\n _classPrivateFieldSet(_previousTableWidth, this, contentRect.width);\n });\n });\n }));\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 * 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 #enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return ['all', 'last'].includes(this.hot.getSettings().stretchH);\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 _classPrivateFieldGet(_stretchCalculator, this).useStrategy(this.hot.getSettings().stretchH);\n _classPrivateFieldGet(_resizeObserver, this).observe(this.hot.rootElement);\n this.addHook('beforeRender', 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(_StretchColumns_brand, _this, _onBeforeRender).call(_this, ...args);\n });\n this.addHook('modifyColWidth', 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(_StretchColumns_brand, _this, _onModifyColWidth).call(_this, ...args);\n }, 10);\n super.enablePlugin();\n }\n\n /**\n * Updates the plugin's state. This method is executed when {@link Core#updateSettings} is invoked.\n */\n updatePlugin() {\n _classPrivateFieldGet(_stretchCalculator, this).useStrategy(this.hot.getSettings().stretchH);\n super.updatePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n super.disablePlugin();\n _classPrivateFieldGet(_resizeObserver, this).unobserve(this.hot.rootElement);\n }\n\n /**\n * Gets the calculated column width based on the stretching\n * strategy defined by {@link Options#stretchH} option.\n *\n * @param {number} columnVisualIndex The visual index of the column.\n * @returns {number | null}\n */\n getColumnWidth(columnVisualIndex) {\n return _classPrivateFieldGet(_stretchCalculator, this).getStretchedWidth(columnVisualIndex);\n }\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n _classPrivateFieldGet(_resizeObserver, this).disconnect();\n _classPrivateFieldSet(_resizeObserver, this, null);\n _classPrivateFieldSet(_stretchCalculator, this, null);\n super.destroy();\n }\n}\nfunction _onModifyColWidth(width, column, source) {\n if (source === this.pluginName) {\n return;\n }\n const newWidth = this.getColumnWidth(column);\n if (typeof newWidth === 'number') {\n return newWidth;\n }\n return width;\n}\n/**\n * On each before render the plugin recalculates the column widths\n * based on the chosen stretching strategy.\n *\n * @param {boolean} fullRender If `true` then the full render is in progress.\n */\nfunction _onBeforeRender(fullRender) {\n if (fullRender) {\n _classPrivateFieldGet(_stretchCalculator, this).refreshStretching();\n }\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, StretchColumns } from \"./stretchColumns.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\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.every.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\";", "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 * An abstract class that defines the structure of an undo/redo action.\n *\n * @class BaseAction\n * @private\n */\nexport class BaseAction {\n constructor(actionType) {\n /**\n * @param {string} actionType The action type.\n */\n _defineProperty(this, \"actionType\", '');\n this.actionType = actionType;\n }\n undo() {\n throw new Error('Not implemented');\n }\n redo() {\n throw new Error('Not implemented');\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 { BaseAction } from \"./_base.mjs\";\nimport { align } from \"../../contextMenu/utils.mjs\";\nimport { arrayEach } from \"../../../helpers/array.mjs\";\n/**\n * Action that tracks cell alignment changes.\n *\n * @class CellAlignmentAction\n * @private\n */\nexport class CellAlignmentAction extends BaseAction {\n constructor(_ref) {\n let {\n stateBefore,\n range,\n type,\n alignment\n } = _ref;\n super('cell_alignment');\n /**\n * @param {Array} stateBefore The previous state.\n */\n _defineProperty(this, \"stateBefore\", void 0);\n /**\n * @param {object} range The cell range.\n */\n _defineProperty(this, \"range\", void 0);\n /**\n * @param {string} type The type of the alignment (\"top\", \"left\", \"bottom\" or \"right\").\n */\n _defineProperty(this, \"type\", void 0);\n /**\n * @param {string} alignment The alignment CSS class.\n */\n _defineProperty(this, \"alignment\", void 0);\n this.stateBefore = stateBefore;\n this.range = range;\n this.type = type;\n this.alignment = alignment;\n }\n static startRegisteringEvents(hot, undoRedoPlugin) {\n hot.addHook('beforeCellAlignment', (stateBefore, range, type, alignment) => {\n undoRedoPlugin.done(() => new CellAlignmentAction({\n stateBefore,\n range,\n type,\n alignment\n }));\n });\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} undoneCallback The callback to be called after the action is undone.\n */\n undo(hot, 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 hot.setCellMeta(row, col, 'className', this.stateBefore[row][col] || ' htLeft');\n }\n });\n });\n hot.addHookOnce('afterViewRender', undoneCallback);\n hot.render();\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} redoneCallback The callback to be called after the action is redone.\n */\n redo(hot, redoneCallback) {\n align(this.range, this.type, this.alignment, (row, col) => hot.getCellMeta(row, col), (row, col, key, value) => hot.setCellMeta(row, col, key, value));\n hot.addHookOnce('afterViewRender', redoneCallback);\n hot.render();\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.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 { BaseAction } from \"./_base.mjs\";\nimport { getMoves } from \"../../../helpers/moves.mjs\";\n/**\n * Action that tracks column move changes.\n *\n * @class ColumnMoveAction\n * @private\n */\nexport class ColumnMoveAction extends BaseAction {\n constructor(_ref) {\n let {\n columns,\n finalIndex\n } = _ref;\n super('col_move');\n /**\n * @param {number[]} columns An array with moved columns.\n */\n _defineProperty(this, \"columns\", void 0);\n /**\n * @param {number} finalIndex The destination index.\n */\n _defineProperty(this, \"finalColumnIndex\", void 0);\n this.columns = columns.slice();\n this.finalColumnIndex = finalIndex;\n }\n static startRegisteringEvents(hot, undoRedoPlugin) {\n hot.addHook('beforeColumnMove', (columns, finalIndex) => {\n if (columns === false) {\n return;\n }\n undoRedoPlugin.done(() => new ColumnMoveAction({\n columns,\n finalIndex\n }));\n });\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} undoneCallback The callback to be called after the action is undone.\n */\n undo(hot, undoneCallback) {\n const manualColumnMove = hot.getPlugin('manualColumnMove');\n hot.addHookOnce('afterViewRender', undoneCallback);\n const columnMoves = getMoves(this.columns, this.finalColumnIndex, hot.columnIndexMapper.getNumberOfIndexes());\n columnMoves.reverse().forEach(_ref2 => {\n let {\n from,\n to\n } = _ref2;\n if (from < to) {\n to -= 1;\n }\n manualColumnMove.moveColumn(to, from);\n });\n hot.render();\n hot.deselectCell();\n hot.selectColumns(this.columns[0], this.columns[0] + this.columns.length - 1);\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} redoneCallback The callback to be called after the action is redone.\n */\n redo(hot, redoneCallback) {\n const manualColumnMove = hot.getPlugin('manualColumnMove');\n hot.addHookOnce('afterViewRender', redoneCallback);\n manualColumnMove.moveColumns(this.columns.slice(), this.finalColumnIndex);\n hot.render();\n hot.deselectCell();\n hot.selectColumns(this.finalColumnIndex, this.finalColumnIndex + this.columns.length - 1);\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 { BaseAction } from \"./_base.mjs\";\n/**\n * Action that tracks column sort changes.\n *\n * @class ColumnSortAction\n * @private\n */\nexport class ColumnSortAction extends BaseAction {\n constructor(_ref) {\n let {\n currentSortState,\n newSortState\n } = _ref;\n super('col_sort');\n /**\n * @param {Array} currentSortState The current sort state.\n */\n _defineProperty(this, \"previousSortState\", void 0);\n /**\n * @param {Array} newSortState The new sort state.\n */\n _defineProperty(this, \"nextSortState\", void 0);\n this.previousSortState = currentSortState;\n this.nextSortState = newSortState;\n }\n static startRegisteringEvents(hot, undoRedoPlugin) {\n hot.addHook('beforeColumnSort', (currentSortState, newSortState, sortPossible) => {\n if (!sortPossible) {\n return;\n }\n undoRedoPlugin.done(() => new ColumnSortAction({\n currentSortState,\n newSortState\n }));\n });\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} undoneCallback The callback to be called after the action is undone.\n */\n undo(hot, undoneCallback) {\n const sortPlugin = hot.getPlugin('columnSorting');\n const multiSortPlugin = hot.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 }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} redoneCallback The callback to be called after the action is redone.\n */\n redo(hot, redoneCallback) {\n const sortPlugin = hot.getPlugin('columnSorting');\n const multiSortPlugin = hot.getPlugin('multiColumnSorting');\n const enabledSortPlugin = multiSortPlugin.isEnabled() ? multiSortPlugin : sortPlugin;\n enabledSortPlugin.sort(this.nextSortState);\n redoneCallback();\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 { BaseAction } from \"./_base.mjs\";\n/**\n * Action that tracks column creation.\n *\n * @class CreateColumnAction\n * @private\n */\nexport class CreateColumnAction extends BaseAction {\n constructor(_ref) {\n let {\n index,\n amount\n } = _ref;\n super('insert_col');\n /**\n * @param {number} index The visual column index.\n */\n _defineProperty(this, \"index\", void 0);\n /**\n * @param {number} amount The number of created columns.\n */\n _defineProperty(this, \"amount\", void 0);\n this.index = index;\n this.amount = amount;\n }\n static startRegisteringEvents(hot, undoRedoPlugin) {\n hot.addHook('afterCreateCol', (index, amount, source) => {\n undoRedoPlugin.done(() => new CreateColumnAction({\n index,\n amount\n }), source);\n });\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} undoneCallback The callback to be called after the action is undone.\n */\n undo(hot, undoneCallback) {\n hot.addHookOnce('afterRemoveCol', undoneCallback);\n hot.alter('remove_col', this.index, this.amount, 'UndoRedo.undo');\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} redoneCallback The callback to be called after the action is redone.\n */\n redo(hot, redoneCallback) {\n hot.addHookOnce('afterCreateCol', redoneCallback);\n hot.alter('insert_col_start', this.index, this.amount, 'UndoRedo.redo');\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 { BaseAction } from \"./_base.mjs\";\n/**\n * Action that tracks row creation.\n *\n * @class CreateRowAction\n * @private\n */\nexport class CreateRowAction extends BaseAction {\n constructor(_ref) {\n let {\n index,\n amount\n } = _ref;\n super('insert_row');\n /**\n * @param {number} index The visual row index.\n */\n _defineProperty(this, \"index\", void 0);\n /**\n * @param {number} amount The number of created rows.\n */\n _defineProperty(this, \"amount\", void 0);\n this.index = index;\n this.amount = amount;\n }\n static startRegisteringEvents(hot, undoRedoPlugin) {\n hot.addHook('afterCreateRow', (index, amount, source) => {\n undoRedoPlugin.done(() => new CreateRowAction({\n index,\n amount\n }), source);\n });\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} undoneCallback The callback to be called after the action is undone.\n */\n undo(hot, undoneCallback) {\n const rowCount = hot.countRows();\n const minSpareRows = hot.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 hot.addHookOnce('afterRemoveRow', undoneCallback);\n hot.alter('remove_row', this.index, this.amount, 'UndoRedo.undo');\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} redoneCallback The callback to be called after the action is redone.\n */\n redo(hot, redoneCallback) {\n hot.addHookOnce('afterCreateRow', redoneCallback);\n hot.alter('insert_row_above', this.index, this.amount, 'UndoRedo.redo');\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.find.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport \"core-js/modules/esnext.iterator.reduce.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 { BaseAction } from \"./_base.mjs\";\nimport { deepClone } from \"../../../helpers/object.mjs\";\n/**\n * Action that tracks data changes.\n *\n * @class DataChangeAction\n * @private\n */\nexport class DataChangeAction extends BaseAction {\n constructor(_ref) {\n let {\n changes,\n selected,\n countCols,\n countRows\n } = _ref;\n super('change');\n /**\n * @param {Array} changes 2D array containing information about each of the edited cells.\n */\n _defineProperty(this, \"changes\", void 0);\n /**\n * @param {number[]} selected The cell selection.\n */\n _defineProperty(this, \"selected\", void 0);\n /**\n * @param {number} countCols The number of columns before data change.\n */\n _defineProperty(this, \"countCols\", void 0);\n /**\n * @param {number} countRows The number of rows before data change.\n */\n _defineProperty(this, \"countRows\", void 0);\n this.changes = changes;\n this.selected = selected;\n this.countCols = countCols;\n this.countRows = countRows;\n }\n static startRegisteringEvents(hot, undoRedoPlugin) {\n hot.addHook('beforeChange', 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 clonedChanges.forEach(change => {\n change[1] = hot.propToCol(change[1]);\n });\n const selected = changesLen > 1 ? this.getSelected() : [[clonedChanges[0][0], clonedChanges[0][1]]];\n return new DataChangeAction({\n changes: clonedChanges,\n selected,\n countCols: hot.countCols(),\n countRows: hot.countRows()\n });\n };\n undoRedoPlugin.done(wrappedAction, source);\n });\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} undoneCallback The callback to be called after the action is undone.\n */\n undo(hot, undoneCallback) {\n const data = deepClone(this.changes);\n for (let i = 0, len = data.length; i < len; i++) {\n data[i].splice(3, 1);\n }\n hot.addHookOnce('afterChange', undoneCallback);\n hot.setDataAtCell(data, null, null, 'UndoRedo.undo');\n const rowsToRemove = hot.countRows() - this.countRows;\n if (rowsToRemove > 0) {\n hot.alter('remove_row', null, rowsToRemove, 'UndoRedo.undo');\n }\n const columnsToRemove = hot.countCols() - this.countCols;\n if (columnsToRemove > 0 && hot.isColumnModificationAllowed()) {\n hot.alter('remove_col', null, columnsToRemove, 'UndoRedo.undo');\n }\n hot.scrollToFocusedCell();\n hot.selectCells(this.selected, false, false);\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} redoneCallback The callback to be called after the action is redone.\n */\n redo(hot, redoneCallback) {\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 hot.addHookOnce('afterChange', redoneCallback);\n hot.setDataAtCell(data, null, null, 'UndoRedo.redo');\n if (this.selected) {\n hot.selectCells(this.selected, false, false);\n }\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.filter.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 { BaseAction } from \"./_base.mjs\";\n/**\n * Action that tracks filter changes.\n *\n * @class FiltersAction\n * @private\n */\nexport class FiltersAction extends BaseAction {\n constructor(_ref) {\n let {\n conditionsStack,\n previousConditionsStack\n } = _ref;\n super('filter');\n /**\n * @param {Array} previousConditionsStack An array of the previous filter conditions.\n */\n _defineProperty(this, \"conditionsStack\", void 0);\n /**\n * @param {Array} conditionsStack An array of the filter conditions.\n */\n _defineProperty(this, \"previousConditionsStack\", void 0);\n this.conditionsStack = conditionsStack;\n this.previousConditionsStack = previousConditionsStack;\n }\n static startRegisteringEvents(hot, undoRedoPlugin) {\n hot.addHook('beforeFilter', (conditionsStack, previousConditionsStack) => {\n undoRedoPlugin.done(() => new FiltersAction({\n conditionsStack,\n previousConditionsStack\n }));\n });\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} undoneCallback The callback to be called after the action is undone.\n */\n undo(hot, undoneCallback) {\n const filters = hot.getPlugin('filters');\n hot.addHookOnce('afterViewRender', undoneCallback);\n filters.importConditions(this.previousConditionsStack);\n filters.filter();\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} redoneCallback The callback to be called after the action is redone.\n */\n redo(hot, redoneCallback) {\n const filters = hot.getPlugin('filters');\n hot.addHookOnce('afterViewRender', redoneCallback);\n filters.importConditions(this.conditionsStack);\n filters.filter();\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 { BaseAction } from \"./_base.mjs\";\n/**\n * Action that tracks changes in merged cells.\n *\n * @class MergeCellsAction\n * @private\n */\nexport class MergeCellsAction extends BaseAction {\n constructor(_ref) {\n let {\n data,\n cellRange\n } = _ref;\n super('merge_cells');\n /**\n * @param {CellRange} cellRange The merged cell range.\n */\n _defineProperty(this, \"cellRange\", void 0);\n this.cellRange = cellRange;\n this.data = data;\n }\n static startRegisteringEvents(hot, undoRedoPlugin) {\n hot.addHook('beforeMergeCells', (cellRange, auto) => {\n if (auto) {\n return;\n }\n const topStartCorner = cellRange.getTopStartCorner();\n const bottomEndCorner = cellRange.getBottomEndCorner();\n const data = hot.getData(topStartCorner.row, topStartCorner.col, bottomEndCorner.row, bottomEndCorner.col);\n undoRedoPlugin.done(() => new MergeCellsAction({\n data,\n cellRange\n }));\n });\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} undoneCallback The callback to be called after the action is undone.\n */\n undo(hot, undoneCallback) {\n const mergeCellsPlugin = hot.getPlugin('mergeCells');\n hot.addHookOnce('afterViewRender', undoneCallback);\n mergeCellsPlugin.unmergeRange(this.cellRange, true);\n const topStartCorner = this.cellRange.getTopStartCorner();\n hot.populateFromArray(topStartCorner.row, topStartCorner.col, this.data, undefined, undefined, 'MergeCells');\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} redoneCallback The callback to be called after the action is redone.\n */\n redo(hot, redoneCallback) {\n const mergeCellsPlugin = hot.getPlugin('mergeCells');\n hot.addHookOnce('afterViewRender', redoneCallback);\n mergeCellsPlugin.mergeRange(this.cellRange);\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 \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.filter.js\";\nimport { rangeEach } from \"../../helpers/number.mjs\";\n/**\n * Gets all cell metas from the provided range.\n *\n * @param {Core} hot The Handsontable instance.\n * @param {number} fromRow The starting row index.\n * @param {number} toRow The ending row index.\n * @param {number} fromColumn The starting column index.\n * @param {number} toColumn The ending column index.\n * @returns {Array} Returns an array of cell metas.\n */\nexport function getCellMetas(hot, 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 = hot.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}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.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 { BaseAction } from \"./_base.mjs\";\nimport { getCellMetas } from \"../utils.mjs\";\nimport { rangeEach } from \"../../../helpers/number.mjs\";\nimport { arrayMap, arrayEach } from \"../../../helpers/array.mjs\";\n/**\n * Action that tracks changes in column removal.\n *\n * @class RemoveColumnAction\n * @private\n */\nexport class RemoveColumnAction extends BaseAction {\n constructor(_ref) {\n let {\n index,\n indexes,\n data,\n amount,\n headers,\n columnPositions,\n rowPositions,\n fixedColumnsStart,\n removedCellMetas\n } = _ref;\n super('remove_col');\n /**\n * @param {number} index The visual column index.\n */\n _defineProperty(this, \"index\", void 0);\n /**\n * @param {number[]} indexes The visual column indexes.\n */\n _defineProperty(this, \"indexes\", void 0);\n /**\n * @param {Array} data The removed data.\n */\n _defineProperty(this, \"data\", void 0);\n /**\n * @param {number} amount The number of removed columns.\n */\n _defineProperty(this, \"amount\", void 0);\n /**\n * @param {Array} headers The header values.\n */\n _defineProperty(this, \"headers\", void 0);\n /**\n * @param {number[]} columnPositions The column position.\n */\n _defineProperty(this, \"columnPositions\", void 0);\n /**\n * @param {number[]} rowPositions The row position.\n */\n _defineProperty(this, \"rowPositions\", void 0);\n /**\n * @param {number} fixedColumnsStart Number of fixed columns on the left. Remove column action change it sometimes.\n */\n _defineProperty(this, \"fixedColumnsStart\", void 0);\n /**\n * @param {Array} removedCellMetas List of removed cell metas.\n */\n _defineProperty(this, \"removedCellMetas\", void 0);\n this.index = index;\n this.indexes = indexes;\n this.data = data;\n this.amount = amount;\n this.headers = headers;\n this.columnPositions = columnPositions.slice(0);\n this.rowPositions = rowPositions.slice(0);\n this.fixedColumnsStart = fixedColumnsStart;\n this.removedCellMetas = removedCellMetas;\n }\n static startRegisteringEvents(hot, undoRedoPlugin) {\n hot.addHook('beforeRemoveCol', (index, amount, logicColumns, source) => {\n const wrappedAction = () => {\n const originalData = hot.getSourceDataArray();\n const columnIndex = (hot.countCols() + index) % hot.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[hot.toPhysicalColumn(j)]);\n });\n removedData.push(column);\n });\n rangeEach(amount - 1, i => {\n indexes.push(hot.toPhysicalColumn(columnIndex + i));\n });\n if (Array.isArray(hot.getSettings().colHeaders)) {\n rangeEach(amount - 1, i => {\n headers.push(hot.getSettings().colHeaders[hot.toPhysicalColumn(columnIndex + i)] || null);\n });\n }\n const columnsMap = hot.columnIndexMapper.getIndexesSequence();\n const rowsMap = hot.rowIndexMapper.getIndexesSequence();\n return new RemoveColumnAction({\n index: columnIndex,\n indexes,\n data: removedData,\n amount,\n headers,\n columnPositions: columnsMap,\n rowPositions: rowsMap,\n fixedColumnsStart: hot.getSettings().fixedColumnsStart,\n removedCellMetas: getCellMetas(hot, 0, hot.countRows(), columnIndex, lastColumnIndex)\n });\n };\n undoRedoPlugin.done(wrappedAction, source);\n });\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} undoneCallback The callback to be called after the action is undone.\n */\n undo(hot, undoneCallback) {\n const settings = hot.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 hot.alter('insert_col_start', this.indexes[0], this.indexes.length, 'UndoRedo.undo');\n arrayEach(hot.getSourceDataArray(), (rowData, rowIndex) => {\n arrayEach(ascendingIndexes, (changedIndex, contiquesIndex) => {\n rowData[changedIndex] = sortedData[rowIndex][contiquesIndex];\n changes.push([rowIndex, changedIndex, rowData[changedIndex]]);\n });\n });\n hot.setSourceDataAtCell(changes, undefined, undefined, 'UndoRedo.undo');\n if (typeof this.headers !== 'undefined') {\n arrayEach(sortedHeaders, (headerData, columnIndex) => {\n hot.getSettings().colHeaders[ascendingIndexes[columnIndex]] = headerData;\n });\n }\n this.removedCellMetas.forEach(_ref2 => {\n let [rowIndex, columnIndex, cellMeta] = _ref2;\n hot.setCellMetaObject(rowIndex, columnIndex, cellMeta);\n });\n hot.batchExecution(() => {\n // Restore row sequence in a case when all columns are removed. the original\n // row sequence is lost in that case.\n hot.rowIndexMapper.setIndexesSequence(this.rowPositions);\n hot.columnIndexMapper.setIndexesSequence(this.columnPositions);\n }, true);\n hot.addHookOnce('afterViewRender', undoneCallback);\n hot.render();\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} redoneCallback The callback to be called after the action is redone.\n */\n redo(hot, redoneCallback) {\n hot.addHookOnce('afterRemoveCol', redoneCallback);\n hot.alter('remove_col', this.index, this.amount, 'UndoRedo.redo');\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.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 { BaseAction } from \"./_base.mjs\";\nimport { getCellMetas } from \"../utils.mjs\";\nimport { deepClone } from \"../../../helpers/object.mjs\";\n/**\n * Action that tracks changes in row removal.\n *\n * @class RemoveRowAction\n * @private\n */\nexport class RemoveRowAction extends BaseAction {\n constructor(_ref) {\n let {\n index,\n data,\n fixedRowsBottom,\n fixedRowsTop,\n rowIndexesSequence,\n removedCellMetas\n } = _ref;\n super('remove_row');\n /**\n * @param {number} index The visual row index.\n */\n _defineProperty(this, \"index\", void 0);\n /**\n * @param {Array} data The removed data.\n */\n _defineProperty(this, \"data\", void 0);\n /**\n * @param {number} fixedRowsBottom Number of fixed rows on the bottom. Remove row action change it sometimes.\n */\n _defineProperty(this, \"fixedRowsBottom\", void 0);\n /**\n * @param {number} fixedRowsTop Number of fixed rows on the top. Remove row action change it sometimes.\n */\n _defineProperty(this, \"fixedRowsTop\", void 0);\n /**\n * @param {Array} rowIndexesSequence Row index sequence taken from the row index mapper.\n */\n _defineProperty(this, \"rowIndexesSequence\", void 0);\n /**\n * @param {Array} removedCellMetas List of removed cell metas.\n */\n _defineProperty(this, \"removedCellMetas\", void 0);\n this.index = index;\n this.data = data;\n this.fixedRowsBottom = fixedRowsBottom;\n this.fixedRowsTop = fixedRowsTop;\n this.rowIndexesSequence = rowIndexesSequence;\n this.removedCellMetas = removedCellMetas;\n }\n static startRegisteringEvents(hot, undoRedoPlugin) {\n hot.addHook('beforeRemoveRow', (index, amount, logicRows, source) => {\n const wrappedAction = () => {\n const physicalRowIndex = hot.toPhysicalRow(index);\n const lastRowIndex = physicalRowIndex + amount - 1;\n const removedData = deepClone(hot.getSourceData(physicalRowIndex, 0, physicalRowIndex + amount - 1, hot.countSourceCols() - 1));\n return new RemoveRowAction({\n index: physicalRowIndex,\n data: removedData,\n fixedRowsBottom: hot.getSettings().fixedRowsBottom,\n fixedRowsTop: hot.getSettings().fixedRowsTop,\n rowIndexesSequence: hot.rowIndexMapper.getIndexesSequence(),\n removedCellMetas: getCellMetas(hot, physicalRowIndex, lastRowIndex, 0, hot.countCols() - 1)\n });\n };\n undoRedoPlugin.done(wrappedAction, source);\n });\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} undoneCallback The callback to be called after the action is undone.\n */\n undo(hot, undoneCallback) {\n const settings = hot.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 hot.alter('insert_row_above', this.index, this.data.length, 'UndoRedo.undo');\n this.removedCellMetas.forEach(_ref2 => {\n let [rowIndex, columnIndex, cellMeta] = _ref2;\n hot.setCellMetaObject(rowIndex, columnIndex, cellMeta);\n });\n hot.addHookOnce('afterViewRender', undoneCallback);\n hot.setSourceDataAtCell(changes, null, null, 'UndoRedo.undo');\n hot.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} redoneCallback The callback to be called after the action is redone.\n */\n redo(hot, redoneCallback) {\n hot.addHookOnce('afterRemoveRow', redoneCallback);\n hot.alter('remove_row', this.index, this.data.length, 'UndoRedo.redo');\n }\n}", "import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.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 { BaseAction } from \"./_base.mjs\";\nimport { getMoves } from \"../../../helpers/moves.mjs\";\n/**\n * Action that tracks row move changes.\n *\n * @class RowMoveAction\n * @private\n */\nexport class RowMoveAction extends BaseAction {\n constructor(_ref) {\n let {\n rows,\n finalIndex\n } = _ref;\n super('row_move');\n /**\n * @param {number[]} rows An array with moved rows.\n */\n _defineProperty(this, \"rows\", void 0);\n /**\n * @param {number} finalIndex The destination index.\n */\n _defineProperty(this, \"finalRowIndex\", void 0);\n this.rows = rows.slice();\n this.finalRowIndex = finalIndex;\n }\n static startRegisteringEvents(hot, undoRedoPlugin) {\n hot.addHook('beforeRowMove', (rows, finalIndex) => {\n if (rows === false) {\n return;\n }\n undoRedoPlugin.done(() => new RowMoveAction({\n rows,\n finalIndex\n }));\n });\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} undoneCallback The callback to be called after the action is undone.\n */\n undo(hot, undoneCallback) {\n const manualRowMove = hot.getPlugin('manualRowMove');\n hot.addHookOnce('afterViewRender', undoneCallback);\n const rowMoves = getMoves(this.rows, this.finalRowIndex, hot.rowIndexMapper.getNumberOfIndexes());\n rowMoves.reverse().forEach(_ref2 => {\n let {\n from,\n to\n } = _ref2;\n if (from < to) {\n to -= 1;\n }\n manualRowMove.moveRow(to, from);\n });\n hot.render();\n hot.deselectCell();\n hot.selectRows(this.rows[0], this.rows[0] + this.rows.length - 1);\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} redoneCallback The callback to be called after the action is redone.\n */\n redo(hot, redoneCallback) {\n const manualRowMove = hot.getPlugin('manualRowMove');\n hot.addHookOnce('afterViewRender', redoneCallback);\n manualRowMove.moveRows(this.rows.slice(), this.finalRowIndex);\n hot.render();\n hot.deselectCell();\n hot.selectRows(this.finalRowIndex, this.finalRowIndex + this.rows.length - 1);\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 { BaseAction } from \"./_base.mjs\";\n/**\n * Action that tracks changes in merged cells.\n *\n * @class UnmergeCellsAction\n * @private\n */\nexport class UnmergeCellsAction extends BaseAction {\n constructor(_ref) {\n let {\n cellRange\n } = _ref;\n super('unmerge_cells');\n /**\n * @param {CellRange} cellRange The merged cell range.\n */\n _defineProperty(this, \"cellRange\", void 0);\n this.cellRange = cellRange;\n }\n static startRegisteringEvents(hot, undoRedoPlugin) {\n hot.addHook('afterUnmergeCells', (cellRange, auto) => {\n if (auto) {\n return;\n }\n undoRedoPlugin.done(() => new UnmergeCellsAction({\n cellRange\n }));\n });\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} undoneCallback The callback to be called after the action is undone.\n */\n undo(hot, undoneCallback) {\n const mergeCellsPlugin = hot.getPlugin('mergeCells');\n hot.addHookOnce('afterViewRender', undoneCallback);\n mergeCellsPlugin.mergeRange(this.cellRange, true);\n }\n\n /**\n * @param {Core} hot The Handsontable instance.\n * @param {function(): void} redoneCallback The callback to be called after the action is redone.\n */\n redo(hot, redoneCallback) {\n const mergeCellsPlugin = hot.getPlugin('mergeCells');\n hot.addHookOnce('afterViewRender', redoneCallback);\n mergeCellsPlugin.unmergeRange(this.cellRange, true);\n hot.render();\n }\n}", "import \"core-js/modules/esnext.iterator.constructor.js\";\nimport \"core-js/modules/esnext.iterator.for-each.js\";\nimport { CellAlignmentAction } from \"./cellAlignment.mjs\";\nimport { ColumnMoveAction } from \"./columnMove.mjs\";\nimport { ColumnSortAction } from \"./columnSort.mjs\";\nimport { CreateColumnAction } from \"./createColumn.mjs\";\nimport { CreateRowAction } from \"./createRow.mjs\";\nimport { DataChangeAction } from \"./dataChange.mjs\";\nimport { FiltersAction } from \"./filters.mjs\";\nimport { MergeCellsAction } from \"./mergeCells.mjs\";\nimport { RemoveColumnAction } from \"./removeColumn.mjs\";\nimport { RemoveRowAction } from \"./removeRow.mjs\";\nimport { RowMoveAction } from \"./rowMove.mjs\";\nimport { UnmergeCellsAction } from \"./unmergeCells.mjs\";\n/**\n * Register all undo/redo actions.\n *\n * @param {Core} hot The Handsontable instance.\n * @param {UndoRedo} undoRedoPlugin The undoRedo plugin instance.\n */\nexport function registerActions(hot, undoRedoPlugin) {\n [CellAlignmentAction, ColumnMoveAction, ColumnSortAction, CreateColumnAction, CreateRowAction, DataChangeAction, FiltersAction, MergeCellsAction, RemoveColumnAction, RemoveRowAction, RowMoveAction, UnmergeCellsAction].forEach(action => action.startRegisteringEvents(hot, undoRedoPlugin));\n}", "function _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 \"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\";\nimport { BasePlugin } from \"../base/index.mjs\";\nimport { Hooks } from \"../../core/hooks/index.mjs\";\nimport { deepClone } from \"../../helpers/object.mjs\";\nimport { toSingleLine } from \"../../helpers/templateLiteralTag.mjs\";\nimport { warn } from \"../../helpers/console.mjs\";\nimport { registerActions } from \"./actions/index.mjs\";\nconst SHORTCUTS_GROUP = 'undoRedo';\nexport const PLUGIN_KEY = 'undoRedo';\nexport const PLUGIN_PRIORITY = 1000;\nHooks.getSingleton().register('beforeUndo');\nHooks.getSingleton().register('afterUndo');\nHooks.getSingleton().register('beforeRedo');\nHooks.getSingleton().register('afterRedo');\nconst deprecationWarns = new Set();\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 */\nvar _UndoRedo_brand = /*#__PURE__*/new WeakSet();\nexport class UndoRedo 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 SETTING_KEYS() {\n return true;\n }\n\n /**\n * The list of registered action do undo.\n *\n * @private\n * @type {Array}\n */\n\n constructor(hotInstance) {\n super(hotInstance);\n /**\n * Listens to the data change and if the source is `loadData` then clears the undo and redo history.\n *\n * @param {Array} changes The data changes.\n * @param {string} source The source of the change.\n */\n _classPrivateMethodInitSpec(this, _UndoRedo_brand);\n _defineProperty(this, \"doneActions\", []);\n /**\n * The list of registered action do redo.\n *\n * @private\n * @type {Array}\n */\n _defineProperty(this, \"undoneActions\", []);\n /**\n * The flag that determines if new actions should be ignored.\n *\n * @private\n * @type {boolean}\n */\n _defineProperty(this, \"ignoreNewActions\", false);\n registerActions(hotInstance, this);\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 UndoRedo#enablePlugin} method is called.\n *\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.hot.getSettings().undo;\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('afterChange', 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(_UndoRedo_brand, _this, _onAfterChange).call(_this, ...args);\n });\n this.registerShortcuts();\n _assertClassBrand(_UndoRedo_brand, this, _exposeAPIToCore).call(this);\n super.enablePlugin();\n }\n\n /**\n * Disables the plugin functionality for this Handsontable instance.\n */\n disablePlugin() {\n super.disablePlugin();\n this.clear();\n this.unregisterShortcuts();\n _assertClassBrand(_UndoRedo_brand, this, _removeAPIFromCore).call(this);\n }\n\n /**\n * Registers shortcuts responsible for performing undo/redo.\n *\n * @private\n */\n registerShortcuts() {\n const shortcutManager = this.hot.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 */\n unregisterShortcuts() {\n const shortcutManager = this.hot.getShortcutManager();\n const gridContext = shortcutManager.getContext('grid');\n gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);\n }\n\n /**\n * Stash information about performed actions.\n *\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 */\n done(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.hot.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.hot.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());\n this.hot.runHooks('beforeRedoStackChange', undoneActionsCopy);\n this.undoneActions.length = 0;\n this.hot.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());\n }\n\n /**\n * Undo the last action performed to the table.\n *\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 */\n undo() {\n if (!this.isUndoAvailable()) {\n return;\n }\n const doneActionsCopy = this.doneActions.slice();\n this.hot.runHooks('beforeUndoStackChange', doneActionsCopy);\n const action = this.doneActions.pop();\n this.hot.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());\n const actionClone = deepClone(action);\n const continueAction = this.hot.runHooks('beforeUndo', actionClone);\n if (continueAction === false) {\n return;\n }\n this.ignoreNewActions = true;\n const undoneActionsCopy = this.undoneActions.slice();\n this.hot.runHooks('beforeRedoStackChange', undoneActionsCopy);\n action.undo(this.hot, () => {\n this.ignoreNewActions = false;\n this.undoneActions.push(action);\n });\n this.hot.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());\n this.hot.runHooks('afterUndo', actionClone);\n }\n\n /**\n * Redo the previous action performed to the table (used to reverse an undo).\n *\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 */\n redo() {\n if (!this.isRedoAvailable()) {\n return;\n }\n const undoneActionsCopy = this.undoneActions.slice();\n this.hot.runHooks('beforeRedoStackChange', undoneActionsCopy);\n const action = this.undoneActions.pop();\n this.hot.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());\n const actionClone = deepClone(action);\n const continueAction = this.hot.runHooks('beforeRedo', actionClone);\n if (continueAction === false) {\n return;\n }\n this.ignoreNewActions = true;\n const doneActionsCopy = this.doneActions.slice();\n this.hot.runHooks('beforeUndoStackChange', doneActionsCopy);\n action.redo(this.hot, () => {\n this.ignoreNewActions = false;\n this.doneActions.push(action);\n });\n this.hot.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());\n this.hot.runHooks('afterRedo', actionClone);\n }\n\n /**\n * Checks if undo action is available.\n *\n * @returns {boolean} Return `true` if undo can be performed, `false` otherwise.\n */\n isUndoAvailable() {\n return this.doneActions.length > 0;\n }\n\n /**\n * Checks if redo action is available.\n *\n * @returns {boolean} Return `true` if redo can be performed, `false` otherwise.\n */\n isRedoAvailable() {\n return this.undoneActions.length > 0;\n }\n\n /**\n * Clears undo and redo history.\n */\n clear() {\n this.doneActions.length = 0;\n this.undoneActions.length = 0;\n }\n /**\n * Destroys the plugin instance.\n */\n destroy() {\n this.clear();\n this.doneActions = null;\n this.undoneActions = null;\n super.destroy();\n }\n}\nfunction _onAfterChange(changes, source) {\n if (source === 'loadData') {\n this.clear();\n }\n}\n/**\n * Expose the plugin API to the Core. It is for backward compatibility and it should be removed in the future.\n */\nfunction _exposeAPIToCore() {\n const deprecatedWarn = methodName => {\n if (!deprecationWarns.has(methodName)) {\n warn(toSingleLine`The \"${methodName}\" method is deprecated and it will be removed\\x20\n from the Core API in the future. Please use the method from the UndoRedo plugin\\x20\n (e.g. \\`hotInstance.getPlugin(\"undoRedo\").${methodName}()\\`).`);\n deprecationWarns.add(methodName);\n }\n };\n\n /**\n * {@link UndoRedo#undo}.\n *\n * @alias undo\n * @memberof! Core#\n */\n this.hot.undo = () => {\n deprecatedWarn('undo');\n this.undo();\n };\n /**\n * {@link UndoRedo#redo}.\n *\n * @alias redo\n * @memberof! Core#\n */\n this.hot.redo = () => {\n deprecatedWarn('redo');\n this.redo();\n };\n /**\n * {@link UndoRedo#isUndoAvailable}.\n *\n * @alias isUndoAvailable\n * @memberof! Core#\n * @returns {boolean}\n */\n this.hot.isUndoAvailable = () => {\n deprecatedWarn('isUndoAvailable');\n return this.isUndoAvailable();\n };\n /**\n * {@link UndoRedo#isRedoAvailable}.\n *\n * @alias isRedoAvailable\n * @memberof! Core#\n * @returns {boolean}\n */\n this.hot.isRedoAvailable = () => {\n deprecatedWarn('isRedoAvailable');\n return this.isRedoAvailable();\n };\n /**\n * {@link UndoRedo#clear}.\n *\n * @alias clearUndo\n * @memberof! Core#\n */\n this.hot.clearUndo = () => {\n deprecatedWarn('clear');\n this.clear();\n };\n this.hot.undoRedo = this;\n}\n/**\n * Removes the plugin API from the Core. It is for backward compatibility and it should be removed in the future.\n */\nfunction _removeAPIFromCore() {\n delete this.hot.undo;\n delete this.hot.redo;\n delete this.hot.isUndoAvailable;\n delete this.hot.isRedoAvailable;\n delete this.hot.clearUndo;\n delete this.hot.undoRedo;\n}", "export { PLUGIN_KEY, PLUGIN_PRIORITY, UndoRedo } from \"./undoRedo.mjs\";", "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 { StretchColumns } from \"./stretchColumns/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(StretchColumns);\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, StretchColumns, 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