(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else { var a = factory(); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })(window, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 215); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process, global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return $mobx; }); /* unused harmony export FlowCancellationError */ /* unused harmony export IDerivationState */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ObservableMap; }); /* unused harmony export ObservableSet */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return Reaction; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return allowStateChanges; }); /* unused harmony export _allowStateChangesInsideComputed */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return allowStateReadsEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return allowStateReadsStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _endAction; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getAdministration; }); /* unused harmony export _getGlobalState */ /* unused harmony export _interceptReads */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return isComputingDerivation; }); /* unused harmony export _resetGlobalState */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return _startAction; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return action; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return autorun; }); /* unused harmony export comparer */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return computed; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return configure; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return createAtom; }); /* unused harmony export decorate */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return entries; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return extendObservable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return flow; }); /* unused harmony export get */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return getAtom; }); /* unused harmony export getDebugName */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return getDependencyTree; }); /* unused harmony export getObserverTree */ /* unused harmony export has */ /* unused harmony export intercept */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return isAction; }); /* unused harmony export isArrayLike */ /* unused harmony export isBoxedObservable */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return isComputed; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return isComputedProp; }); /* unused harmony export isFlowCancellationError */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return isObservable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return isObservableArray; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return isObservableMap; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return isObservableObject; }); /* unused harmony export isObservableProp */ /* unused harmony export isObservableSet */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return keys; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return observable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return observe; }); /* unused harmony export onBecomeObserved */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return onBecomeUnobserved; }); /* unused harmony export onReactionError */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return reaction; }); /* unused harmony export remove */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return runInAction; }); /* unused harmony export set */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return spy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return toJS; }); /* unused harmony export trace */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return transaction; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return untracked; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return values; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return when; }); /** MobX - (c) Michel Weststrate 2015 - 2020 - MIT Licensed */ var OBFUSCATED_ERROR = "An invariant failed, however the error is obfuscated because this is a production build."; var EMPTY_ARRAY = []; Object.freeze(EMPTY_ARRAY); var EMPTY_OBJECT = {}; Object.freeze(EMPTY_OBJECT); function getNextId() { return ++globalState.mobxGuid; } function fail(message) { invariant(false, message); throw "X"; // unreachable } function invariant(check, message) { if (!check) throw new Error("[mobx] " + (message || OBFUSCATED_ERROR)); } /** * Prints a deprecation message, but only one time. * Returns false if the deprecated message was already printed before */ var deprecatedMessages = []; function deprecated(msg, thing) { if (true) return false; if (thing) { return deprecated("'" + msg + "', use '" + thing + "' instead."); } if (deprecatedMessages.indexOf(msg) !== -1) return false; deprecatedMessages.push(msg); console.error("[mobx] Deprecated: " + msg); return true; } /** * Makes sure that the provided function is invoked at most once. */ function once(func) { var invoked = false; return function () { if (invoked) return; invoked = true; return func.apply(this, arguments); }; } var noop = function () { }; function unique(list) { var res = []; list.forEach(function (item) { if (res.indexOf(item) === -1) res.push(item); }); return res; } function isObject(value) { return value !== null && typeof value === "object"; } function isPlainObject(value) { if (value === null || typeof value !== "object") return false; var proto = Object.getPrototypeOf(value); return proto === Object.prototype || proto === null; } function convertToMap(dataStructure) { if (isES6Map(dataStructure) || isObservableMap(dataStructure)) { return dataStructure; } else if (Array.isArray(dataStructure)) { return new Map(dataStructure); } else if (isPlainObject(dataStructure)) { var map = new Map(); for (var key in dataStructure) { map.set(key, dataStructure[key]); } return map; } else { return fail("Cannot convert to map from '" + dataStructure + "'"); } } function addHiddenProp(object, propName, value) { Object.defineProperty(object, propName, { enumerable: false, writable: true, configurable: true, value: value }); } function addHiddenFinalProp(object, propName, value) { Object.defineProperty(object, propName, { enumerable: false, writable: false, configurable: true, value: value }); } function isPropertyConfigurable(object, prop) { var descriptor = Object.getOwnPropertyDescriptor(object, prop); return !descriptor || (descriptor.configurable !== false && descriptor.writable !== false); } function assertPropertyConfigurable(object, prop) { if (false) {} } function createInstanceofPredicate(name, clazz) { var propName = "isMobX" + name; clazz.prototype[propName] = true; return function (x) { return isObject(x) && x[propName] === true; }; } /** * Returns whether the argument is an array, disregarding observability. */ function isArrayLike(x) { return Array.isArray(x) || isObservableArray(x); } function isES6Map(thing) { return thing instanceof Map; } function isES6Set(thing) { return thing instanceof Set; } /** * Returns the following: own keys, prototype keys & own symbol keys, if they are enumerable. */ function getPlainObjectKeys(object) { var enumerables = new Set(); for (var key in object) enumerables.add(key); // *all* enumerables Object.getOwnPropertySymbols(object).forEach(function (k) { if (Object.getOwnPropertyDescriptor(object, k).enumerable) enumerables.add(k); }); // *own* symbols // Note: this implementation is missing enumerable, inherited, symbolic property names! That would however pretty expensive to add, // as there is no efficient iterator that returns *all* properties return Array.from(enumerables); } function stringifyKey(key) { if (key && key.toString) return key.toString(); else return new String(key).toString(); } function toPrimitive(value) { return value === null ? null : typeof value === "object" ? "" + value : value; } var ownKeys = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : Object.getOwnPropertySymbols ? function (obj) { return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj)); } : /* istanbul ignore next */ Object.getOwnPropertyNames; var $mobx = Symbol("mobx administration"); var Atom = /** @class */ (function () { /** * Create a new atom. For debugging purposes it is recommended to give it a name. * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management. */ function Atom(name) { if (name === void 0) { name = "Atom@" + getNextId(); } this.name = name; this.isPendingUnobservation = false; // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed this.isBeingObserved = false; this.observers = new Set(); this.diffValue = 0; this.lastAccessedBy = 0; this.lowestObserverState = IDerivationState.NOT_TRACKING; } Atom.prototype.onBecomeObserved = function () { if (this.onBecomeObservedListeners) { this.onBecomeObservedListeners.forEach(function (listener) { return listener(); }); } }; Atom.prototype.onBecomeUnobserved = function () { if (this.onBecomeUnobservedListeners) { this.onBecomeUnobservedListeners.forEach(function (listener) { return listener(); }); } }; /** * Invoke this method to notify mobx that your atom has been used somehow. * Returns true if there is currently a reactive context. */ Atom.prototype.reportObserved = function () { return reportObserved(this); }; /** * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate. */ Atom.prototype.reportChanged = function () { startBatch(); propagateChanged(this); endBatch(); }; Atom.prototype.toString = function () { return this.name; }; return Atom; }()); var isAtom = createInstanceofPredicate("Atom", Atom); function createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) { if (onBecomeObservedHandler === void 0) { onBecomeObservedHandler = noop; } if (onBecomeUnobservedHandler === void 0) { onBecomeUnobservedHandler = noop; } var atom = new Atom(name); // default `noop` listener will not initialize the hook Set if (onBecomeObservedHandler !== noop) { onBecomeObserved(atom, onBecomeObservedHandler); } if (onBecomeUnobservedHandler !== noop) { onBecomeUnobserved(atom, onBecomeUnobservedHandler); } return atom; } function identityComparer(a, b) { return a === b; } function structuralComparer(a, b) { return deepEqual(a, b); } function shallowComparer(a, b) { return deepEqual(a, b, 1); } function defaultComparer(a, b) { return Object.is(a, b); } var comparer = { identity: identityComparer, structural: structuralComparer, default: defaultComparer, shallow: shallowComparer }; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __values(o) { var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; if (m) return m.call(o); return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } var mobxDidRunLazyInitializersSymbol = Symbol("mobx did run lazy initializers"); var mobxPendingDecorators = Symbol("mobx pending decorators"); var enumerableDescriptorCache = {}; var nonEnumerableDescriptorCache = {}; function createPropertyInitializerDescriptor(prop, enumerable) { var cache = enumerable ? enumerableDescriptorCache : nonEnumerableDescriptorCache; return (cache[prop] || (cache[prop] = { configurable: true, enumerable: enumerable, get: function () { initializeInstance(this); return this[prop]; }, set: function (value) { initializeInstance(this); this[prop] = value; } })); } function initializeInstance(target) { var e_1, _a; if (target[mobxDidRunLazyInitializersSymbol] === true) return; var decorators = target[mobxPendingDecorators]; if (decorators) { addHiddenProp(target, mobxDidRunLazyInitializersSymbol, true); // Build property key array from both strings and symbols var keys = __spread(Object.getOwnPropertySymbols(decorators), Object.keys(decorators)); try { for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) { var key = keys_1_1.value; var d = decorators[key]; d.propertyCreator(target, d.prop, d.descriptor, d.decoratorTarget, d.decoratorArguments); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1); } finally { if (e_1) throw e_1.error; } } } } function createPropDecorator(propertyInitiallyEnumerable, propertyCreator) { return function decoratorFactory() { var decoratorArguments; var decorator = function decorate(target, prop, descriptor, applyImmediately // This is a special parameter to signal the direct application of a decorator, allow extendObservable to skip the entire type decoration part, // as the instance to apply the decorator to equals the target ) { if (applyImmediately === true) { propertyCreator(target, prop, descriptor, target, decoratorArguments); return null; } if (false) {} if (!Object.prototype.hasOwnProperty.call(target, mobxPendingDecorators)) { var inheritedDecorators = target[mobxPendingDecorators]; addHiddenProp(target, mobxPendingDecorators, __assign({}, inheritedDecorators)); } target[mobxPendingDecorators][prop] = { prop: prop, propertyCreator: propertyCreator, descriptor: descriptor, decoratorTarget: target, decoratorArguments: decoratorArguments }; return createPropertyInitializerDescriptor(prop, propertyInitiallyEnumerable); }; if (quacksLikeADecorator(arguments)) { // @decorator decoratorArguments = EMPTY_ARRAY; return decorator.apply(null, arguments); } else { // @decorator(args) decoratorArguments = Array.prototype.slice.call(arguments); return decorator; } }; } function quacksLikeADecorator(args) { return (((args.length === 2 || args.length === 3) && (typeof args[1] === "string" || typeof args[1] === "symbol")) || (args.length === 4 && args[3] === true)); } function deepEnhancer(v, _, name) { // it is an observable already, done if (isObservable(v)) return v; // something that can be converted and mutated? if (Array.isArray(v)) return observable.array(v, { name: name }); if (isPlainObject(v)) return observable.object(v, undefined, { name: name }); if (isES6Map(v)) return observable.map(v, { name: name }); if (isES6Set(v)) return observable.set(v, { name: name }); return v; } function shallowEnhancer(v, _, name) { if (v === undefined || v === null) return v; if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) return v; if (Array.isArray(v)) return observable.array(v, { name: name, deep: false }); if (isPlainObject(v)) return observable.object(v, undefined, { name: name, deep: false }); if (isES6Map(v)) return observable.map(v, { name: name, deep: false }); if (isES6Set(v)) return observable.set(v, { name: name, deep: false }); return fail( false && false); } function referenceEnhancer(newValue) { // never turn into an observable return newValue; } function refStructEnhancer(v, oldValue, name) { if (false) {} if (deepEqual(v, oldValue)) return oldValue; return v; } function createDecoratorForEnhancer(enhancer) { invariant(enhancer); var decorator = createPropDecorator(true, function (target, propertyName, descriptor, _decoratorTarget, decoratorArgs) { if (false) {} var initialValue = descriptor ? descriptor.initializer ? descriptor.initializer.call(target) : descriptor.value : undefined; asObservableObject(target).addObservableProp(propertyName, initialValue, enhancer); }); var res = // Extra process checks, as this happens during module initialization typeof process !== "undefined" && process.env && "production" !== "production" ? function observableDecorator() { // This wrapper function is just to detect illegal decorator invocations, deprecate in a next version // and simply return the created prop decorator if (arguments.length < 2) return fail("Incorrect decorator invocation. @observable decorator doesn't expect any arguments"); return decorator.apply(null, arguments); } : decorator; res.enhancer = enhancer; return res; } // Predefined bags of create observable options, to avoid allocating temporarily option objects // in the majority of cases var defaultCreateObservableOptions = { deep: true, name: undefined, defaultDecorator: undefined, proxy: true }; Object.freeze(defaultCreateObservableOptions); function assertValidOption(key) { if (!/^(deep|name|equals|defaultDecorator|proxy)$/.test(key)) fail("invalid option for (extend)observable: " + key); } function asCreateObservableOptions(thing) { if (thing === null || thing === undefined) return defaultCreateObservableOptions; if (typeof thing === "string") return { name: thing, deep: true, proxy: true }; if (false) {} return thing; } var deepDecorator = createDecoratorForEnhancer(deepEnhancer); var shallowDecorator = createDecoratorForEnhancer(shallowEnhancer); var refDecorator = createDecoratorForEnhancer(referenceEnhancer); var refStructDecorator = createDecoratorForEnhancer(refStructEnhancer); function getEnhancerFromOptions(options) { return options.defaultDecorator ? options.defaultDecorator.enhancer : options.deep === false ? referenceEnhancer : deepEnhancer; } /** * Turns an object, array or function into a reactive structure. * @param v the value which should become observable. */ function createObservable(v, arg2, arg3) { // @observable someProp; if (typeof arguments[1] === "string" || typeof arguments[1] === "symbol") { return deepDecorator.apply(null, arguments); } // it is an observable already, done if (isObservable(v)) return v; // something that can be converted and mutated? var res = isPlainObject(v) ? observable.object(v, arg2, arg3) : Array.isArray(v) ? observable.array(v, arg2) : isES6Map(v) ? observable.map(v, arg2) : isES6Set(v) ? observable.set(v, arg2) : v; // this value could be converted to a new observable data structure, return it if (res !== v) return res; // otherwise, just box it fail( false && false); } var observableFactories = { box: function (value, options) { if (arguments.length > 2) incorrectlyUsedAsDecorator("box"); var o = asCreateObservableOptions(options); return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals); }, array: function (initialValues, options) { if (arguments.length > 2) incorrectlyUsedAsDecorator("array"); var o = asCreateObservableOptions(options); return createObservableArray(initialValues, getEnhancerFromOptions(o), o.name); }, map: function (initialValues, options) { if (arguments.length > 2) incorrectlyUsedAsDecorator("map"); var o = asCreateObservableOptions(options); return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name); }, set: function (initialValues, options) { if (arguments.length > 2) incorrectlyUsedAsDecorator("set"); var o = asCreateObservableOptions(options); return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name); }, object: function (props, decorators, options) { if (typeof arguments[1] === "string") incorrectlyUsedAsDecorator("object"); var o = asCreateObservableOptions(options); if (o.proxy === false) { return extendObservable({}, props, decorators, o); } else { var defaultDecorator = getDefaultDecoratorFromObjectOptions(o); var base = extendObservable({}, undefined, undefined, o); var proxy = createDynamicObservableObject(base); extendObservableObjectWithProperties(proxy, props, decorators, defaultDecorator); return proxy; } }, ref: refDecorator, shallow: shallowDecorator, deep: deepDecorator, struct: refStructDecorator }; var observable = createObservable; // weird trick to keep our typings nicely with our funcs, and still extend the observable function Object.keys(observableFactories).forEach(function (name) { return (observable[name] = observableFactories[name]); }); function incorrectlyUsedAsDecorator(methodName) { fail( // process.env.NODE_ENV !== "production" && "Expected one or two arguments to observable." + methodName + ". Did you accidentally try to use observable." + methodName + " as decorator?"); } var computedDecorator = createPropDecorator(false, function (instance, propertyName, descriptor, decoratorTarget, decoratorArgs) { if (false) {} var get = descriptor.get, set = descriptor.set; // initialValue is the descriptor for get / set props // Optimization: faster on decorator target or instance? Assuming target // Optimization: find out if declaring on instance isn't just faster. (also makes the property descriptor simpler). But, more memory usage.. // Forcing instance now, fixes hot reloadig issues on React Native: var options = decoratorArgs[0] || {}; asObservableObject(instance).addComputedProp(instance, propertyName, __assign({ get: get, set: set, context: instance }, options)); }); var computedStructDecorator = computedDecorator({ equals: comparer.structural }); /** * Decorator for class properties: @computed get value() { return expr; }. * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`; */ var computed = function computed(arg1, arg2, arg3) { if (typeof arg2 === "string") { // @computed return computedDecorator.apply(null, arguments); } if (arg1 !== null && typeof arg1 === "object" && arguments.length === 1) { // @computed({ options }) return computedDecorator.apply(null, arguments); } // computed(expr, options?) if (false) {} var opts = typeof arg2 === "object" ? arg2 : {}; opts.get = arg1; opts.set = typeof arg2 === "function" ? arg2 : opts.set; opts.name = opts.name || arg1.name || ""; /* for generated name */ return new ComputedValue(opts); }; computed.struct = computedStructDecorator; var IDerivationState; (function (IDerivationState) { // before being run or (outside batch and not being observed) // at this point derivation is not holding any data about dependency tree IDerivationState[IDerivationState["NOT_TRACKING"] = -1] = "NOT_TRACKING"; // no shallow dependency changed since last computation // won't recalculate derivation // this is what makes mobx fast IDerivationState[IDerivationState["UP_TO_DATE"] = 0] = "UP_TO_DATE"; // some deep dependency changed, but don't know if shallow dependency changed // will require to check first if UP_TO_DATE or POSSIBLY_STALE // currently only ComputedValue will propagate POSSIBLY_STALE // // having this state is second big optimization: // don't have to recompute on every dependency change, but only when it's needed IDerivationState[IDerivationState["POSSIBLY_STALE"] = 1] = "POSSIBLY_STALE"; // A shallow dependency has changed since last computation and the derivation // will need to recompute when it's needed next. IDerivationState[IDerivationState["STALE"] = 2] = "STALE"; })(IDerivationState || (IDerivationState = {})); var TraceMode; (function (TraceMode) { TraceMode[TraceMode["NONE"] = 0] = "NONE"; TraceMode[TraceMode["LOG"] = 1] = "LOG"; TraceMode[TraceMode["BREAK"] = 2] = "BREAK"; })(TraceMode || (TraceMode = {})); var CaughtException = /** @class */ (function () { function CaughtException(cause) { this.cause = cause; // Empty } return CaughtException; }()); function isCaughtException(e) { return e instanceof CaughtException; } /** * Finds out whether any dependency of the derivation has actually changed. * If dependenciesState is 1 then it will recalculate dependencies, * if any dependency changed it will propagate it by changing dependenciesState to 2. * * By iterating over the dependencies in the same order that they were reported and * stopping on the first change, all the recalculations are only called for ComputedValues * that will be tracked by derivation. That is because we assume that if the first x * dependencies of the derivation doesn't change then the derivation should run the same way * up until accessing x-th dependency. */ function shouldCompute(derivation) { switch (derivation.dependenciesState) { case IDerivationState.UP_TO_DATE: return false; case IDerivationState.NOT_TRACKING: case IDerivationState.STALE: return true; case IDerivationState.POSSIBLY_STALE: { // state propagation can occur outside of action/reactive context #2195 var prevAllowStateReads = allowStateReadsStart(true); var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction. var obs = derivation.observing, l = obs.length; for (var i = 0; i < l; i++) { var obj = obs[i]; if (isComputedValue(obj)) { if (globalState.disableErrorBoundaries) { obj.get(); } else { try { obj.get(); } catch (e) { // we are not interested in the value *or* exception at this moment, but if there is one, notify all untrackedEnd(prevUntracked); allowStateReadsEnd(prevAllowStateReads); return true; } } // if ComputedValue `obj` actually changed it will be computed and propagated to its observers. // and `derivation` is an observer of `obj` // invariantShouldCompute(derivation) if (derivation.dependenciesState === IDerivationState.STALE) { untrackedEnd(prevUntracked); allowStateReadsEnd(prevAllowStateReads); return true; } } } changeDependenciesStateTo0(derivation); untrackedEnd(prevUntracked); allowStateReadsEnd(prevAllowStateReads); return false; } } } // function invariantShouldCompute(derivation: IDerivation) { // const newDepState = (derivation as any).dependenciesState // if ( // process.env.NODE_ENV === "production" && // (newDepState === IDerivationState.POSSIBLY_STALE || // newDepState === IDerivationState.NOT_TRACKING) // ) // fail("Illegal dependency state") // } function isComputingDerivation() { return globalState.trackingDerivation !== null; // filter out actions inside computations } function checkIfStateModificationsAreAllowed(atom) { var hasObservers = atom.observers.size > 0; // Should never be possible to change an observed observable from inside computed, see #798 if (globalState.computationDepth > 0 && hasObservers) fail( false && false); // Should not be possible to change observed state outside strict mode, except during initialization, see #563 if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === "strict")) fail( false && false); } function checkIfStateReadsAreAllowed(observable) { if (false) {} } /** * Executes the provided function `f` and tracks which observables are being accessed. * The tracking information is stored on the `derivation` object and the derivation is registered * as observer of any of the accessed observables. */ function trackDerivedFunction(derivation, f, context) { var prevAllowStateReads = allowStateReadsStart(true); // pre allocate array allocation + room for variation in deps // array will be trimmed by bindDependencies changeDependenciesStateTo0(derivation); derivation.newObserving = new Array(derivation.observing.length + 100); derivation.unboundDepsCount = 0; derivation.runId = ++globalState.runId; var prevTracking = globalState.trackingDerivation; globalState.trackingDerivation = derivation; var result; if (globalState.disableErrorBoundaries === true) { result = f.call(context); } else { try { result = f.call(context); } catch (e) { result = new CaughtException(e); } } globalState.trackingDerivation = prevTracking; bindDependencies(derivation); warnAboutDerivationWithoutDependencies(derivation); allowStateReadsEnd(prevAllowStateReads); return result; } function warnAboutDerivationWithoutDependencies(derivation) { if (true) return; if (derivation.observing.length !== 0) return; if (globalState.reactionRequiresObservable || derivation.requiresObservable) { console.warn("[mobx] Derivation " + derivation.name + " is created/updated without reading any observable value"); } } /** * diffs newObserving with observing. * update observing to be newObserving with unique observables * notify observers that become observed/unobserved */ function bindDependencies(derivation) { // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, "INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1"); var prevObserving = derivation.observing; var observing = (derivation.observing = derivation.newObserving); var lowestNewObservingDerivationState = IDerivationState.UP_TO_DATE; // Go through all new observables and check diffValue: (this list can contain duplicates): // 0: first occurrence, change to 1 and keep it // 1: extra occurrence, drop it var i0 = 0, l = derivation.unboundDepsCount; for (var i = 0; i < l; i++) { var dep = observing[i]; if (dep.diffValue === 0) { dep.diffValue = 1; if (i0 !== i) observing[i0] = dep; i0++; } // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined, // not hitting the condition if (dep.dependenciesState > lowestNewObservingDerivationState) { lowestNewObservingDerivationState = dep.dependenciesState; } } observing.length = i0; derivation.newObserving = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614) // Go through all old observables and check diffValue: (it is unique after last bindDependencies) // 0: it's not in new observables, unobserve it // 1: it keeps being observed, don't want to notify it. change to 0 l = prevObserving.length; while (l--) { var dep = prevObserving[l]; if (dep.diffValue === 0) { removeObserver(dep, derivation); } dep.diffValue = 0; } // Go through all new observables and check diffValue: (now it should be unique) // 0: it was set to 0 in last loop. don't need to do anything. // 1: it wasn't observed, let's observe it. set back to 0 while (i0--) { var dep = observing[i0]; if (dep.diffValue === 1) { dep.diffValue = 0; addObserver(dep, derivation); } } // Some new observed derivations may become stale during this derivation computation // so they have had no chance to propagate staleness (#916) if (lowestNewObservingDerivationState !== IDerivationState.UP_TO_DATE) { derivation.dependenciesState = lowestNewObservingDerivationState; derivation.onBecomeStale(); } } function clearObserving(derivation) { // invariant(globalState.inBatch > 0, "INTERNAL ERROR clearObserving should be called only inside batch"); var obs = derivation.observing; derivation.observing = []; var i = obs.length; while (i--) removeObserver(obs[i], derivation); derivation.dependenciesState = IDerivationState.NOT_TRACKING; } function untracked(action) { var prev = untrackedStart(); try { return action(); } finally { untrackedEnd(prev); } } function untrackedStart() { var prev = globalState.trackingDerivation; globalState.trackingDerivation = null; return prev; } function untrackedEnd(prev) { globalState.trackingDerivation = prev; } function allowStateReadsStart(allowStateReads) { var prev = globalState.allowStateReads; globalState.allowStateReads = allowStateReads; return prev; } function allowStateReadsEnd(prev) { globalState.allowStateReads = prev; } /** * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0 * */ function changeDependenciesStateTo0(derivation) { if (derivation.dependenciesState === IDerivationState.UP_TO_DATE) return; derivation.dependenciesState = IDerivationState.UP_TO_DATE; var obs = derivation.observing; var i = obs.length; while (i--) obs[i].lowestObserverState = IDerivationState.UP_TO_DATE; } // we don't use globalState for these in order to avoid possible issues with multiple // mobx versions var currentActionId = 0; var nextActionId = 1; var functionNameDescriptor = Object.getOwnPropertyDescriptor(function () { }, "name"); var isFunctionNameConfigurable = functionNameDescriptor && functionNameDescriptor.configurable; function createAction(actionName, fn, ref) { if (false) {} var res = function () { return executeAction(actionName, fn, ref || this, arguments); }; res.isMobxAction = true; if (false) {} return res; } function executeAction(actionName, fn, scope, args) { var runInfo = _startAction(actionName, scope, args); try { return fn.apply(scope, args); } catch (err) { runInfo.error = err; throw err; } finally { _endAction(runInfo); } } function _startAction(actionName, scope, args) { var notifySpy = isSpyEnabled() && !!actionName; var startTime = 0; if (notifySpy && "production" !== "production") { startTime = Date.now(); var l = (args && args.length) || 0; var flattendArgs = new Array(l); if (l > 0) for (var i = 0; i < l; i++) flattendArgs[i] = args[i]; spyReportStart({ type: "action", name: actionName, object: scope, arguments: flattendArgs }); } var prevDerivation = untrackedStart(); startBatch(); var prevAllowStateChanges = allowStateChangesStart(true); var prevAllowStateReads = allowStateReadsStart(true); var runInfo = { prevDerivation: prevDerivation, prevAllowStateChanges: prevAllowStateChanges, prevAllowStateReads: prevAllowStateReads, notifySpy: notifySpy, startTime: startTime, actionId: nextActionId++, parentActionId: currentActionId }; currentActionId = runInfo.actionId; return runInfo; } function _endAction(runInfo) { if (currentActionId !== runInfo.actionId) { fail("invalid action stack. did you forget to finish an action?"); } currentActionId = runInfo.parentActionId; if (runInfo.error !== undefined) { globalState.suppressReactionErrors = true; } allowStateChangesEnd(runInfo.prevAllowStateChanges); allowStateReadsEnd(runInfo.prevAllowStateReads); endBatch(); untrackedEnd(runInfo.prevDerivation); if (runInfo.notifySpy && "production" !== "production") { spyReportEnd({ time: Date.now() - runInfo.startTime }); } globalState.suppressReactionErrors = false; } function allowStateChanges(allowStateChanges, func) { var prev = allowStateChangesStart(allowStateChanges); var res; try { res = func(); } finally { allowStateChangesEnd(prev); } return res; } function allowStateChangesStart(allowStateChanges) { var prev = globalState.allowStateChanges; globalState.allowStateChanges = allowStateChanges; return prev; } function allowStateChangesEnd(prev) { globalState.allowStateChanges = prev; } function allowStateChangesInsideComputed(func) { var prev = globalState.computationDepth; globalState.computationDepth = 0; var res; try { res = func(); } finally { globalState.computationDepth = prev; } return res; } var ObservableValue = /** @class */ (function (_super) { __extends(ObservableValue, _super); function ObservableValue(value, enhancer, name, notifySpy, equals) { if (name === void 0) { name = "ObservableValue@" + getNextId(); } if (notifySpy === void 0) { notifySpy = true; } if (equals === void 0) { equals = comparer.default; } var _this = _super.call(this, name) || this; _this.enhancer = enhancer; _this.name = name; _this.equals = equals; _this.hasUnreportedChange = false; _this.value = enhancer(value, undefined, name); if (notifySpy && isSpyEnabled() && "production" !== "production") { // only notify spy if this is a stand-alone observable spyReport({ type: "create", name: _this.name, newValue: "" + _this.value }); } return _this; } ObservableValue.prototype.dehanceValue = function (value) { if (this.dehancer !== undefined) return this.dehancer(value); return value; }; ObservableValue.prototype.set = function (newValue) { var oldValue = this.value; newValue = this.prepareNewValue(newValue); if (newValue !== globalState.UNCHANGED) { var notifySpy = isSpyEnabled(); if (notifySpy && "production" !== "production") { spyReportStart({ type: "update", name: this.name, newValue: newValue, oldValue: oldValue }); } this.setNewValue(newValue); if (notifySpy && "production" !== "production") spyReportEnd(); } }; ObservableValue.prototype.prepareNewValue = function (newValue) { checkIfStateModificationsAreAllowed(this); if (hasInterceptors(this)) { var change = interceptChange(this, { object: this, type: "update", newValue: newValue }); if (!change) return globalState.UNCHANGED; newValue = change.newValue; } // apply modifier newValue = this.enhancer(newValue, this.value, this.name); return this.equals(this.value, newValue) ? globalState.UNCHANGED : newValue; }; ObservableValue.prototype.setNewValue = function (newValue) { var oldValue = this.value; this.value = newValue; this.reportChanged(); if (hasListeners(this)) { notifyListeners(this, { type: "update", object: this, newValue: newValue, oldValue: oldValue }); } }; ObservableValue.prototype.get = function () { this.reportObserved(); return this.dehanceValue(this.value); }; ObservableValue.prototype.intercept = function (handler) { return registerInterceptor(this, handler); }; ObservableValue.prototype.observe = function (listener, fireImmediately) { if (fireImmediately) listener({ object: this, type: "update", newValue: this.value, oldValue: undefined }); return registerListener(this, listener); }; ObservableValue.prototype.toJSON = function () { return this.get(); }; ObservableValue.prototype.toString = function () { return this.name + "[" + this.value + "]"; }; ObservableValue.prototype.valueOf = function () { return toPrimitive(this.get()); }; ObservableValue.prototype[Symbol.toPrimitive] = function () { return this.valueOf(); }; return ObservableValue; }(Atom)); var isObservableValue = createInstanceofPredicate("ObservableValue", ObservableValue); /** * A node in the state dependency root that observes other nodes, and can be observed itself. * * ComputedValue will remember the result of the computation for the duration of the batch, or * while being observed. * * During this time it will recompute only when one of its direct dependencies changed, * but only when it is being accessed with `ComputedValue.get()`. * * Implementation description: * 1. First time it's being accessed it will compute and remember result * give back remembered result until 2. happens * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3. * 3. When it's being accessed, recompute if any shallow dependency changed. * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step. * go to step 2. either way * * If at any point it's outside batch and it isn't observed: reset everything and go to 1. */ var ComputedValue = /** @class */ (function () { /** * Create a new computed value based on a function expression. * * The `name` property is for debug purposes only. * * The `equals` property specifies the comparer function to use to determine if a newly produced * value differs from the previous value. Two comparers are provided in the library; `defaultComparer` * compares based on identity comparison (===), and `structualComparer` deeply compares the structure. * Structural comparison can be convenient if you always produce a new aggregated object and * don't want to notify observers if it is structurally the same. * This is useful for working with vectors, mouse coordinates etc. */ function ComputedValue(options) { this.dependenciesState = IDerivationState.NOT_TRACKING; this.observing = []; // nodes we are looking at. Our value depends on these nodes this.newObserving = null; // during tracking it's an array with new observed observers this.isBeingObserved = false; this.isPendingUnobservation = false; this.observers = new Set(); this.diffValue = 0; this.runId = 0; this.lastAccessedBy = 0; this.lowestObserverState = IDerivationState.UP_TO_DATE; this.unboundDepsCount = 0; this.__mapid = "#" + getNextId(); this.value = new CaughtException(null); this.isComputing = false; // to check for cycles this.isRunningSetter = false; this.isTracing = TraceMode.NONE; invariant(options.get, "missing option for computed: get"); this.derivation = options.get; this.name = options.name || "ComputedValue@" + getNextId(); if (options.set) this.setter = createAction(this.name + "-setter", options.set); this.equals = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer.default); this.scope = options.context; this.requiresReaction = !!options.requiresReaction; this.keepAlive = !!options.keepAlive; } ComputedValue.prototype.onBecomeStale = function () { propagateMaybeChanged(this); }; ComputedValue.prototype.onBecomeObserved = function () { if (this.onBecomeObservedListeners) { this.onBecomeObservedListeners.forEach(function (listener) { return listener(); }); } }; ComputedValue.prototype.onBecomeUnobserved = function () { if (this.onBecomeUnobservedListeners) { this.onBecomeUnobservedListeners.forEach(function (listener) { return listener(); }); } }; /** * Returns the current value of this computed value. * Will evaluate its computation first if needed. */ ComputedValue.prototype.get = function () { if (this.isComputing) fail("Cycle detected in computation " + this.name + ": " + this.derivation); if (globalState.inBatch === 0 && this.observers.size === 0 && !this.keepAlive) { if (shouldCompute(this)) { this.warnAboutUntrackedRead(); startBatch(); // See perf test 'computed memoization' this.value = this.computeValue(false); endBatch(); } } else { reportObserved(this); if (shouldCompute(this)) if (this.trackAndCompute()) propagateChangeConfirmed(this); } var result = this.value; if (isCaughtException(result)) throw result.cause; return result; }; ComputedValue.prototype.peek = function () { var res = this.computeValue(false); if (isCaughtException(res)) throw res.cause; return res; }; ComputedValue.prototype.set = function (value) { if (this.setter) { invariant(!this.isRunningSetter, "The setter of computed value '" + this.name + "' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"); this.isRunningSetter = true; try { this.setter.call(this.scope, value); } finally { this.isRunningSetter = false; } } else invariant(false, false && false); }; ComputedValue.prototype.trackAndCompute = function () { if (isSpyEnabled() && "production" !== "production") { spyReport({ object: this.scope, type: "compute", name: this.name }); } var oldValue = this.value; var wasSuspended = /* see #1208 */ this.dependenciesState === IDerivationState.NOT_TRACKING; var newValue = this.computeValue(true); var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals(oldValue, newValue); if (changed) { this.value = newValue; } return changed; }; ComputedValue.prototype.computeValue = function (track) { this.isComputing = true; globalState.computationDepth++; var res; if (track) { res = trackDerivedFunction(this, this.derivation, this.scope); } else { if (globalState.disableErrorBoundaries === true) { res = this.derivation.call(this.scope); } else { try { res = this.derivation.call(this.scope); } catch (e) { res = new CaughtException(e); } } } globalState.computationDepth--; this.isComputing = false; return res; }; ComputedValue.prototype.suspend = function () { if (!this.keepAlive) { clearObserving(this); this.value = undefined; // don't hold on to computed value! } }; ComputedValue.prototype.observe = function (listener, fireImmediately) { var _this = this; var firstTime = true; var prevValue = undefined; return autorun(function () { var newValue = _this.get(); if (!firstTime || fireImmediately) { var prevU = untrackedStart(); listener({ type: "update", object: _this, newValue: newValue, oldValue: prevValue }); untrackedEnd(prevU); } firstTime = false; prevValue = newValue; }); }; ComputedValue.prototype.warnAboutUntrackedRead = function () { if (true) return; if (this.requiresReaction === true) { fail("[mobx] Computed value " + this.name + " is read outside a reactive context"); } if (this.isTracing !== TraceMode.NONE) { console.log("[mobx.trace] '" + this.name + "' is being read outside a reactive context. Doing a full recompute"); } if (globalState.computedRequiresReaction) { console.warn("[mobx] Computed value " + this.name + " is being read outside a reactive context. Doing a full recompute"); } }; ComputedValue.prototype.toJSON = function () { return this.get(); }; ComputedValue.prototype.toString = function () { return this.name + "[" + this.derivation.toString() + "]"; }; ComputedValue.prototype.valueOf = function () { return toPrimitive(this.get()); }; ComputedValue.prototype[Symbol.toPrimitive] = function () { return this.valueOf(); }; return ComputedValue; }()); var isComputedValue = createInstanceofPredicate("ComputedValue", ComputedValue); /** * These values will persist if global state is reset */ var persistentKeys = [ "mobxGuid", "spyListeners", "enforceActions", "computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "allowStateReads", "disableErrorBoundaries", "runId", "UNCHANGED" ]; var MobXGlobals = /** @class */ (function () { function MobXGlobals() { /** * MobXGlobals version. * MobX compatiblity with other versions loaded in memory as long as this version matches. * It indicates that the global state still stores similar information * * N.B: this version is unrelated to the package version of MobX, and is only the version of the * internal state storage of MobX, and can be the same across many different package versions */ this.version = 5; /** * globally unique token to signal unchanged */ this.UNCHANGED = {}; /** * Currently running derivation */ this.trackingDerivation = null; /** * Are we running a computation currently? (not a reaction) */ this.computationDepth = 0; /** * Each time a derivation is tracked, it is assigned a unique run-id */ this.runId = 0; /** * 'guid' for general purpose. Will be persisted amongst resets. */ this.mobxGuid = 0; /** * Are we in a batch block? (and how many of them) */ this.inBatch = 0; /** * Observables that don't have observers anymore, and are about to be * suspended, unless somebody else accesses it in the same batch * * @type {IObservable[]} */ this.pendingUnobservations = []; /** * List of scheduled, not yet executed, reactions. */ this.pendingReactions = []; /** * Are we currently processing reactions? */ this.isRunningReactions = false; /** * Is it allowed to change observables at this point? * In general, MobX doesn't allow that when running computations and React.render. * To ensure that those functions stay pure. */ this.allowStateChanges = true; /** * Is it allowed to read observables at this point? * Used to hold the state needed for `observableRequiresReaction` */ this.allowStateReads = true; /** * If strict mode is enabled, state changes are by default not allowed */ this.enforceActions = false; /** * Spy callbacks */ this.spyListeners = []; /** * Globally attached error handlers that react specifically to errors in reactions */ this.globalReactionErrorHandlers = []; /** * Warn if computed values are accessed outside a reactive context */ this.computedRequiresReaction = false; /** * (Experimental) * Warn if you try to create to derivation / reactive context without accessing any observable. */ this.reactionRequiresObservable = false; /** * (Experimental) * Warn if observables are accessed outside a reactive context */ this.observableRequiresReaction = false; /** * Allows overwriting of computed properties, useful in tests but not prod as it can cause * memory leaks. See https://github.com/mobxjs/mobx/issues/1867 */ this.computedConfigurable = false; /* * Don't catch and rethrow exceptions. This is useful for inspecting the state of * the stack when an exception occurs while debugging. */ this.disableErrorBoundaries = false; /* * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836 */ this.suppressReactionErrors = false; } return MobXGlobals; }()); var mockGlobal = {}; function getGlobal() { if (typeof window !== "undefined") { return window; } if (typeof global !== "undefined") { return global; } if (typeof self !== "undefined") { return self; } return mockGlobal; } var canMergeGlobalState = true; var isolateCalled = false; var globalState = (function () { var global = getGlobal(); if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) canMergeGlobalState = false; if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) canMergeGlobalState = false; if (!canMergeGlobalState) { setTimeout(function () { if (!isolateCalled) { fail("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`"); } }, 1); return new MobXGlobals(); } else if (global.__mobxGlobals) { global.__mobxInstanceCount += 1; if (!global.__mobxGlobals.UNCHANGED) global.__mobxGlobals.UNCHANGED = {}; // make merge backward compatible return global.__mobxGlobals; } else { global.__mobxInstanceCount = 1; return (global.__mobxGlobals = new MobXGlobals()); } })(); function isolateGlobalState() { if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) fail("isolateGlobalState should be called before MobX is running any reactions"); isolateCalled = true; if (canMergeGlobalState) { if (--getGlobal().__mobxInstanceCount === 0) getGlobal().__mobxGlobals = undefined; globalState = new MobXGlobals(); } } function getGlobalState() { return globalState; } /** * For testing purposes only; this will break the internal state of existing observables, * but can be used to get back at a stable state after throwing errors */ function resetGlobalState() { var defaultGlobals = new MobXGlobals(); for (var key in defaultGlobals) if (persistentKeys.indexOf(key) === -1) globalState[key] = defaultGlobals[key]; globalState.allowStateChanges = !globalState.enforceActions; } function hasObservers(observable) { return observable.observers && observable.observers.size > 0; } function getObservers(observable) { return observable.observers; } // function invariantObservers(observable: IObservable) { // const list = observable.observers // const map = observable.observersIndexes // const l = list.length // for (let i = 0; i < l; i++) { // const id = list[i].__mapid // if (i) { // invariant(map[id] === i, "INTERNAL ERROR maps derivation.__mapid to index in list") // for performance // } else { // invariant(!(id in map), "INTERNAL ERROR observer on index 0 shouldn't be held in map.") // for performance // } // } // invariant( // list.length === 0 || Object.keys(map).length === list.length - 1, // "INTERNAL ERROR there is no junk in map" // ) // } function addObserver(observable, node) { // invariant(node.dependenciesState !== -1, "INTERNAL ERROR, can add only dependenciesState !== -1"); // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node"); // invariantObservers(observable); observable.observers.add(node); if (observable.lowestObserverState > node.dependenciesState) observable.lowestObserverState = node.dependenciesState; // invariantObservers(observable); // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node"); } function removeObserver(observable, node) { // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch"); // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR remove already removed node"); // invariantObservers(observable); observable.observers.delete(node); if (observable.observers.size === 0) { // deleting last observer queueForUnobservation(observable); } // invariantObservers(observable); // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR remove already removed node2"); } function queueForUnobservation(observable) { if (observable.isPendingUnobservation === false) { // invariant(observable._observers.length === 0, "INTERNAL ERROR, should only queue for unobservation unobserved observables"); observable.isPendingUnobservation = true; globalState.pendingUnobservations.push(observable); } } /** * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does. * During a batch `onBecomeUnobserved` will be called at most once per observable. * Avoids unnecessary recalculations. */ function startBatch() { globalState.inBatch++; } function endBatch() { if (--globalState.inBatch === 0) { runReactions(); // the batch is actually about to finish, all unobserving should happen here. var list = globalState.pendingUnobservations; for (var i = 0; i < list.length; i++) { var observable = list[i]; observable.isPendingUnobservation = false; if (observable.observers.size === 0) { if (observable.isBeingObserved) { // if this observable had reactive observers, trigger the hooks observable.isBeingObserved = false; observable.onBecomeUnobserved(); } if (observable instanceof ComputedValue) { // computed values are automatically teared down when the last observer leaves // this process happens recursively, this computed might be the last observable of another, etc.. observable.suspend(); } } } globalState.pendingUnobservations = []; } } function reportObserved(observable) { checkIfStateReadsAreAllowed(observable); var derivation = globalState.trackingDerivation; if (derivation !== null) { /** * Simple optimization, give each derivation run an unique id (runId) * Check if last time this observable was accessed the same runId is used * if this is the case, the relation is already known */ if (derivation.runId !== observable.lastAccessedBy) { observable.lastAccessedBy = derivation.runId; // Tried storing newObserving, or observing, or both as Set, but performance didn't come close... derivation.newObserving[derivation.unboundDepsCount++] = observable; if (!observable.isBeingObserved) { observable.isBeingObserved = true; observable.onBecomeObserved(); } } return true; } else if (observable.observers.size === 0 && globalState.inBatch > 0) { queueForUnobservation(observable); } return false; } // function invariantLOS(observable: IObservable, msg: string) { // // it's expensive so better not run it in produciton. but temporarily helpful for testing // const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2) // if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState` // throw new Error( // "lowestObserverState is wrong for " + // msg + // " because " + // min + // " < " + // observable.lowestObserverState // ) // } /** * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly * It will propagate changes to observers from previous run * It's hard or maybe impossible (with reasonable perf) to get it right with current approach * Hopefully self reruning autoruns aren't a feature people should depend on * Also most basic use cases should be ok */ // Called by Atom when its value changes function propagateChanged(observable) { // invariantLOS(observable, "changed start"); if (observable.lowestObserverState === IDerivationState.STALE) return; observable.lowestObserverState = IDerivationState.STALE; // Ideally we use for..of here, but the downcompiled version is really slow... observable.observers.forEach(function (d) { if (d.dependenciesState === IDerivationState.UP_TO_DATE) { if (d.isTracing !== TraceMode.NONE) { logTraceInfo(d, observable); } d.onBecomeStale(); } d.dependenciesState = IDerivationState.STALE; }); // invariantLOS(observable, "changed end"); } // Called by ComputedValue when it recalculate and its value changed function propagateChangeConfirmed(observable) { // invariantLOS(observable, "confirmed start"); if (observable.lowestObserverState === IDerivationState.STALE) return; observable.lowestObserverState = IDerivationState.STALE; observable.observers.forEach(function (d) { if (d.dependenciesState === IDerivationState.POSSIBLY_STALE) d.dependenciesState = IDerivationState.STALE; else if (d.dependenciesState === IDerivationState.UP_TO_DATE // this happens during computing of `d`, just keep lowestObserverState up to date. ) observable.lowestObserverState = IDerivationState.UP_TO_DATE; }); // invariantLOS(observable, "confirmed end"); } // Used by computed when its dependency changed, but we don't wan't to immediately recompute. function propagateMaybeChanged(observable) { // invariantLOS(observable, "maybe start"); if (observable.lowestObserverState !== IDerivationState.UP_TO_DATE) return; observable.lowestObserverState = IDerivationState.POSSIBLY_STALE; observable.observers.forEach(function (d) { if (d.dependenciesState === IDerivationState.UP_TO_DATE) { d.dependenciesState = IDerivationState.POSSIBLY_STALE; if (d.isTracing !== TraceMode.NONE) { logTraceInfo(d, observable); } d.onBecomeStale(); } }); // invariantLOS(observable, "maybe end"); } function logTraceInfo(derivation, observable) { console.log("[mobx.trace] '" + derivation.name + "' is invalidated due to a change in: '" + observable.name + "'"); if (derivation.isTracing === TraceMode.BREAK) { var lines = []; printDepTree(getDependencyTree(derivation), lines, 1); // prettier-ignore new Function("debugger;\n/*\nTracing '" + derivation.name + "'\n\nYou are entering this break point because derivation '" + derivation.name + "' is being traced and '" + observable.name + "' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\//g, "/") : "") + "\n\nThe dependencies for this derivation are:\n\n" + lines.join("\n") + "\n*/\n ")(); } } function printDepTree(tree, lines, depth) { if (lines.length >= 1000) { lines.push("(and many more)"); return; } lines.push("" + new Array(depth).join("\t") + tree.name); // MWE: not the fastest, but the easiest way :) if (tree.dependencies) tree.dependencies.forEach(function (child) { return printDepTree(child, lines, depth + 1); }); } var Reaction = /** @class */ (function () { function Reaction(name, onInvalidate, errorHandler, requiresObservable) { if (name === void 0) { name = "Reaction@" + getNextId(); } if (requiresObservable === void 0) { requiresObservable = false; } this.name = name; this.onInvalidate = onInvalidate; this.errorHandler = errorHandler; this.requiresObservable = requiresObservable; this.observing = []; // nodes we are looking at. Our value depends on these nodes this.newObserving = []; this.dependenciesState = IDerivationState.NOT_TRACKING; this.diffValue = 0; this.runId = 0; this.unboundDepsCount = 0; this.__mapid = "#" + getNextId(); this.isDisposed = false; this._isScheduled = false; this._isTrackPending = false; this._isRunning = false; this.isTracing = TraceMode.NONE; } Reaction.prototype.onBecomeStale = function () { this.schedule(); }; Reaction.prototype.schedule = function () { if (!this._isScheduled) { this._isScheduled = true; globalState.pendingReactions.push(this); runReactions(); } }; Reaction.prototype.isScheduled = function () { return this._isScheduled; }; /** * internal, use schedule() if you intend to kick off a reaction */ Reaction.prototype.runReaction = function () { if (!this.isDisposed) { startBatch(); this._isScheduled = false; if (shouldCompute(this)) { this._isTrackPending = true; try { this.onInvalidate(); if (this._isTrackPending && isSpyEnabled() && "production" !== "production") { // onInvalidate didn't trigger track right away.. spyReport({ name: this.name, type: "scheduled-reaction" }); } } catch (e) { this.reportExceptionInDerivation(e); } } endBatch(); } }; Reaction.prototype.track = function (fn) { if (this.isDisposed) { return; // console.warn("Reaction already disposed") // Note: Not a warning / error in mobx 4 either } startBatch(); var notify = isSpyEnabled(); var startTime; if (notify && "production" !== "production") { startTime = Date.now(); spyReportStart({ name: this.name, type: "reaction" }); } this._isRunning = true; var result = trackDerivedFunction(this, fn, undefined); this._isRunning = false; this._isTrackPending = false; if (this.isDisposed) { // disposed during last run. Clean up everything that was bound after the dispose call. clearObserving(this); } if (isCaughtException(result)) this.reportExceptionInDerivation(result.cause); if (notify && "production" !== "production") { spyReportEnd({ time: Date.now() - startTime }); } endBatch(); }; Reaction.prototype.reportExceptionInDerivation = function (error) { var _this = this; if (this.errorHandler) { this.errorHandler(error, this); return; } if (globalState.disableErrorBoundaries) throw error; var message = "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this + "'"; if (globalState.suppressReactionErrors) { console.warn("[mobx] (error in reaction '" + this.name + "' suppressed, fix error of causing action below)"); // prettier-ignore } else { console.error(message, error); /** If debugging brought you here, please, read the above message :-). Tnx! */ } if (isSpyEnabled()) { spyReport({ type: "error", name: this.name, message: message, error: "" + error }); } globalState.globalReactionErrorHandlers.forEach(function (f) { return f(error, _this); }); }; Reaction.prototype.dispose = function () { if (!this.isDisposed) { this.isDisposed = true; if (!this._isRunning) { // if disposed while running, clean up later. Maybe not optimal, but rare case startBatch(); clearObserving(this); endBatch(); } } }; Reaction.prototype.getDisposer = function () { var r = this.dispose.bind(this); r[$mobx] = this; return r; }; Reaction.prototype.toString = function () { return "Reaction[" + this.name + "]"; }; Reaction.prototype.trace = function (enterBreakPoint) { if (enterBreakPoint === void 0) { enterBreakPoint = false; } trace(this, enterBreakPoint); }; return Reaction; }()); function onReactionError(handler) { globalState.globalReactionErrorHandlers.push(handler); return function () { var idx = globalState.globalReactionErrorHandlers.indexOf(handler); if (idx >= 0) globalState.globalReactionErrorHandlers.splice(idx, 1); }; } /** * Magic number alert! * Defines within how many times a reaction is allowed to re-trigger itself * until it is assumed that this is gonna be a never ending loop... */ var MAX_REACTION_ITERATIONS = 100; var reactionScheduler = function (f) { return f(); }; function runReactions() { // Trampolining, if runReactions are already running, new reactions will be picked up if (globalState.inBatch > 0 || globalState.isRunningReactions) return; reactionScheduler(runReactionsHelper); } function runReactionsHelper() { globalState.isRunningReactions = true; var allReactions = globalState.pendingReactions; var iterations = 0; // While running reactions, new reactions might be triggered. // Hence we work with two variables and check whether // we converge to no remaining reactions after a while. while (allReactions.length > 0) { if (++iterations === MAX_REACTION_ITERATIONS) { console.error("Reaction doesn't converge to a stable state after " + MAX_REACTION_ITERATIONS + " iterations." + (" Probably there is a cycle in the reactive function: " + allReactions[0])); allReactions.splice(0); // clear reactions } var remainingReactions = allReactions.splice(0); for (var i = 0, l = remainingReactions.length; i < l; i++) remainingReactions[i].runReaction(); } globalState.isRunningReactions = false; } var isReaction = createInstanceofPredicate("Reaction", Reaction); function setReactionScheduler(fn) { var baseScheduler = reactionScheduler; reactionScheduler = function (f) { return fn(function () { return baseScheduler(f); }); }; } function isSpyEnabled() { return false && false; } function spyReport(event) { if (true) return; // dead code elimination can do the rest if (!globalState.spyListeners.length) return; var listeners = globalState.spyListeners; for (var i = 0, l = listeners.length; i < l; i++) listeners[i](event); } function spyReportStart(event) { if (true) return; var change = __assign(__assign({}, event), { spyReportStart: true }); spyReport(change); } var END_EVENT = { spyReportEnd: true }; function spyReportEnd(change) { if (true) return; if (change) spyReport(__assign(__assign({}, change), { spyReportEnd: true })); else spyReport(END_EVENT); } function spy(listener) { if (true) { console.warn("[mobx.spy] Is a no-op in production builds"); return function () { }; } else {} } function dontReassignFields() { fail( false && false); } function namedActionDecorator(name) { return function (target, prop, descriptor) { if (descriptor) { if (false) {} // babel / typescript // @action method() { } if (descriptor.value) { // typescript return { value: createAction(name, descriptor.value), enumerable: false, configurable: true, writable: true // for typescript, this must be writable, otherwise it cannot inherit :/ (see inheritable actions test) }; } // babel only: @action method = () => {} var initializer_1 = descriptor.initializer; return { enumerable: false, configurable: true, writable: true, initializer: function () { // N.B: we can't immediately invoke initializer; this would be wrong return createAction(name, initializer_1.call(this)); } }; } // bound instance methods return actionFieldDecorator(name).apply(this, arguments); }; } function actionFieldDecorator(name) { // Simple property that writes on first invocation to the current instance return function (target, prop, descriptor) { Object.defineProperty(target, prop, { configurable: true, enumerable: false, get: function () { return undefined; }, set: function (value) { addHiddenProp(this, prop, action(name, value)); } }); }; } function boundActionDecorator(target, propertyName, descriptor, applyToInstance) { if (applyToInstance === true) { defineBoundAction(target, propertyName, descriptor.value); return null; } if (descriptor) { // if (descriptor.value) // Typescript / Babel: @action.bound method() { } // also: babel @action.bound method = () => {} return { configurable: true, enumerable: false, get: function () { defineBoundAction(this, propertyName, descriptor.value || descriptor.initializer.call(this)); return this[propertyName]; }, set: dontReassignFields }; } // field decorator Typescript @action.bound method = () => {} return { enumerable: false, configurable: true, set: function (v) { defineBoundAction(this, propertyName, v); }, get: function () { return undefined; } }; } var action = function action(arg1, arg2, arg3, arg4) { // action(fn() {}) if (arguments.length === 1 && typeof arg1 === "function") return createAction(arg1.name || "", arg1); // action("name", fn() {}) if (arguments.length === 2 && typeof arg2 === "function") return createAction(arg1, arg2); // @action("name") fn() {} if (arguments.length === 1 && typeof arg1 === "string") return namedActionDecorator(arg1); // @action fn() {} if (arg4 === true) { // apply to instance immediately addHiddenProp(arg1, arg2, createAction(arg1.name || arg2, arg3.value, this)); } else { return namedActionDecorator(arg2).apply(null, arguments); } }; action.bound = boundActionDecorator; function runInAction(arg1, arg2) { var actionName = typeof arg1 === "string" ? arg1 : arg1.name || ""; var fn = typeof arg1 === "function" ? arg1 : arg2; if (false) {} return executeAction(actionName, fn, this, undefined); } function isAction(thing) { return typeof thing === "function" && thing.isMobxAction === true; } function defineBoundAction(target, propertyName, fn) { addHiddenProp(target, propertyName, createAction(propertyName, fn.bind(target))); } /** * Creates a named reactive view and keeps it alive, so that the view is always * updated if one of the dependencies changes, even when the view is not further used by something else. * @param view The reactive view * @returns disposer function, which can be used to stop the view from being updated in the future. */ function autorun(view, opts) { if (opts === void 0) { opts = EMPTY_OBJECT; } if (false) {} var name = (opts && opts.name) || view.name || "Autorun@" + getNextId(); var runSync = !opts.scheduler && !opts.delay; var reaction; if (runSync) { // normal autorun reaction = new Reaction(name, function () { this.track(reactionRunner); }, opts.onError, opts.requiresObservable); } else { var scheduler_1 = createSchedulerFromOptions(opts); // debounced autorun var isScheduled_1 = false; reaction = new Reaction(name, function () { if (!isScheduled_1) { isScheduled_1 = true; scheduler_1(function () { isScheduled_1 = false; if (!reaction.isDisposed) reaction.track(reactionRunner); }); } }, opts.onError, opts.requiresObservable); } function reactionRunner() { view(reaction); } reaction.schedule(); return reaction.getDisposer(); } var run = function (f) { return f(); }; function createSchedulerFromOptions(opts) { return opts.scheduler ? opts.scheduler : opts.delay ? function (f) { return setTimeout(f, opts.delay); } : run; } function reaction(expression, effect, opts) { if (opts === void 0) { opts = EMPTY_OBJECT; } if (false) {} var name = opts.name || "Reaction@" + getNextId(); var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect); var runSync = !opts.scheduler && !opts.delay; var scheduler = createSchedulerFromOptions(opts); var firstTime = true; var isScheduled = false; var value; var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer.default; var r = new Reaction(name, function () { if (firstTime || runSync) { reactionRunner(); } else if (!isScheduled) { isScheduled = true; scheduler(reactionRunner); } }, opts.onError, opts.requiresObservable); function reactionRunner() { isScheduled = false; // Q: move into reaction runner? if (r.isDisposed) return; var changed = false; r.track(function () { var nextValue = expression(r); changed = firstTime || !equals(value, nextValue); value = nextValue; }); if (firstTime && opts.fireImmediately) effectAction(value, r); if (!firstTime && changed === true) effectAction(value, r); if (firstTime) firstTime = false; } r.schedule(); return r.getDisposer(); } function wrapErrorHandler(errorHandler, baseFn) { return function () { try { return baseFn.apply(this, arguments); } catch (e) { errorHandler.call(this, e); } }; } function onBecomeObserved(thing, arg2, arg3) { return interceptHook("onBecomeObserved", thing, arg2, arg3); } function onBecomeUnobserved(thing, arg2, arg3) { return interceptHook("onBecomeUnobserved", thing, arg2, arg3); } function interceptHook(hook, thing, arg2, arg3) { var atom = typeof arg3 === "function" ? getAtom(thing, arg2) : getAtom(thing); var cb = typeof arg3 === "function" ? arg3 : arg2; var listenersKey = hook + "Listeners"; if (atom[listenersKey]) { atom[listenersKey].add(cb); } else { atom[listenersKey] = new Set([cb]); } var orig = atom[hook]; if (typeof orig !== "function") return fail( false && false); return function () { var hookListeners = atom[listenersKey]; if (hookListeners) { hookListeners.delete(cb); if (hookListeners.size === 0) { delete atom[listenersKey]; } } }; } function configure(options) { var enforceActions = options.enforceActions, computedRequiresReaction = options.computedRequiresReaction, computedConfigurable = options.computedConfigurable, disableErrorBoundaries = options.disableErrorBoundaries, reactionScheduler = options.reactionScheduler, reactionRequiresObservable = options.reactionRequiresObservable, observableRequiresReaction = options.observableRequiresReaction; if (options.isolateGlobalState === true) { isolateGlobalState(); } if (enforceActions !== undefined) { if (typeof enforceActions === "boolean" || enforceActions === "strict") deprecated("Deprecated value for 'enforceActions', use 'false' => '\"never\"', 'true' => '\"observed\"', '\"strict\"' => \"'always'\" instead"); var ea = void 0; switch (enforceActions) { case true: case "observed": ea = true; break; case false: case "never": ea = false; break; case "strict": case "always": ea = "strict"; break; default: fail("Invalid value for 'enforceActions': '" + enforceActions + "', expected 'never', 'always' or 'observed'"); } globalState.enforceActions = ea; globalState.allowStateChanges = ea === true || ea === "strict" ? false : true; } if (computedRequiresReaction !== undefined) { globalState.computedRequiresReaction = !!computedRequiresReaction; } if (reactionRequiresObservable !== undefined) { globalState.reactionRequiresObservable = !!reactionRequiresObservable; } if (observableRequiresReaction !== undefined) { globalState.observableRequiresReaction = !!observableRequiresReaction; globalState.allowStateReads = !globalState.observableRequiresReaction; } if (computedConfigurable !== undefined) { globalState.computedConfigurable = !!computedConfigurable; } if (disableErrorBoundaries !== undefined) { if (disableErrorBoundaries === true) console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."); globalState.disableErrorBoundaries = !!disableErrorBoundaries; } if (reactionScheduler) { setReactionScheduler(reactionScheduler); } } function decorate(thing, decorators) { false && false; var target = typeof thing === "function" ? thing.prototype : thing; var _loop_1 = function (prop) { var propertyDecorators = decorators[prop]; if (!Array.isArray(propertyDecorators)) { propertyDecorators = [propertyDecorators]; } false && false; var descriptor = Object.getOwnPropertyDescriptor(target, prop); var newDescriptor = propertyDecorators.reduce(function (accDescriptor, decorator) { return decorator(target, prop, accDescriptor); }, descriptor); if (newDescriptor) Object.defineProperty(target, prop, newDescriptor); }; for (var prop in decorators) { _loop_1(prop); } return thing; } function extendObservable(target, properties, decorators, options) { if (false) {} options = asCreateObservableOptions(options); var defaultDecorator = getDefaultDecoratorFromObjectOptions(options); initializeInstance(target); // Fixes #1740 asObservableObject(target, options.name, defaultDecorator.enhancer); // make sure object is observable, even without initial props if (properties) extendObservableObjectWithProperties(target, properties, decorators, defaultDecorator); return target; } function getDefaultDecoratorFromObjectOptions(options) { return options.defaultDecorator || (options.deep === false ? refDecorator : deepDecorator); } function extendObservableObjectWithProperties(target, properties, decorators, defaultDecorator) { var e_1, _a, e_2, _b; if (false) { var key, keys_1, keys_1_1, keys; } startBatch(); try { var keys = ownKeys(properties); try { for (var keys_2 = __values(keys), keys_2_1 = keys_2.next(); !keys_2_1.done; keys_2_1 = keys_2.next()) { var key = keys_2_1.value; var descriptor = Object.getOwnPropertyDescriptor(properties, key); if (false) {} var decorator = decorators && key in decorators ? decorators[key] : descriptor.get ? computedDecorator : defaultDecorator; if (false) {} var resultDescriptor = decorator(target, key, descriptor, true); if (resultDescriptor // otherwise, assume already applied, due to `applyToInstance` ) Object.defineProperty(target, key, resultDescriptor); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (keys_2_1 && !keys_2_1.done && (_b = keys_2.return)) _b.call(keys_2); } finally { if (e_2) throw e_2.error; } } } finally { endBatch(); } } function getDependencyTree(thing, property) { return nodeToDependencyTree(getAtom(thing, property)); } function nodeToDependencyTree(node) { var result = { name: node.name }; if (node.observing && node.observing.length > 0) result.dependencies = unique(node.observing).map(nodeToDependencyTree); return result; } function getObserverTree(thing, property) { return nodeToObserverTree(getAtom(thing, property)); } function nodeToObserverTree(node) { var result = { name: node.name }; if (hasObservers(node)) result.observers = Array.from(getObservers(node)).map(nodeToObserverTree); return result; } var generatorId = 0; function FlowCancellationError() { this.message = "FLOW_CANCELLED"; } FlowCancellationError.prototype = Object.create(Error.prototype); function isFlowCancellationError(error) { return error instanceof FlowCancellationError; } function flow(generator) { if (arguments.length !== 1) fail( true && "Flow expects 1 argument and cannot be used as decorator"); var name = generator.name || ""; // Implementation based on https://github.com/tj/co/blob/master/index.js return function () { var ctx = this; var args = arguments; var runId = ++generatorId; var gen = action(name + " - runid: " + runId + " - init", generator).apply(ctx, args); var rejector; var pendingPromise = undefined; var promise = new Promise(function (resolve, reject) { var stepId = 0; rejector = reject; function onFulfilled(res) { pendingPromise = undefined; var ret; try { ret = action(name + " - runid: " + runId + " - yield " + stepId++, gen.next).call(gen, res); } catch (e) { return reject(e); } next(ret); } function onRejected(err) { pendingPromise = undefined; var ret; try { ret = action(name + " - runid: " + runId + " - yield " + stepId++, gen.throw).call(gen, err); } catch (e) { return reject(e); } next(ret); } function next(ret) { if (ret && typeof ret.then === "function") { // an async iterator ret.then(next, reject); return; } if (ret.done) return resolve(ret.value); pendingPromise = Promise.resolve(ret.value); return pendingPromise.then(onFulfilled, onRejected); } onFulfilled(undefined); // kick off the process }); promise.cancel = action(name + " - runid: " + runId + " - cancel", function () { try { if (pendingPromise) cancelPromise(pendingPromise); // Finally block can return (or yield) stuff.. var res = gen.return(undefined); // eat anything that promise would do, it's cancelled! var yieldedPromise = Promise.resolve(res.value); yieldedPromise.then(noop, noop); cancelPromise(yieldedPromise); // maybe it can be cancelled :) // reject our original promise rejector(new FlowCancellationError()); } catch (e) { rejector(e); // there could be a throwing finally block } }); return promise; }; } function cancelPromise(promise) { if (typeof promise.cancel === "function") promise.cancel(); } function interceptReads(thing, propOrHandler, handler) { var target; if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) { target = getAdministration(thing); } else if (isObservableObject(thing)) { if (typeof propOrHandler !== "string") return fail( false && false); target = getAdministration(thing, propOrHandler); } else { return fail( false && false); } if (target.dehancer !== undefined) return fail( false && false); target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler; return function () { target.dehancer = undefined; }; } function intercept(thing, propOrHandler, handler) { if (typeof handler === "function") return interceptProperty(thing, propOrHandler, handler); else return interceptInterceptable(thing, propOrHandler); } function interceptInterceptable(thing, handler) { return getAdministration(thing).intercept(handler); } function interceptProperty(thing, property, handler) { return getAdministration(thing, property).intercept(handler); } function _isComputed(value, property) { if (value === null || value === undefined) return false; if (property !== undefined) { if (isObservableObject(value) === false) return false; if (!value[$mobx].values.has(property)) return false; var atom = getAtom(value, property); return isComputedValue(atom); } return isComputedValue(value); } function isComputed(value) { if (arguments.length > 1) return fail( false && false); return _isComputed(value); } function isComputedProp(value, propName) { if (typeof propName !== "string") return fail( false && false); return _isComputed(value, propName); } function _isObservable(value, property) { if (value === null || value === undefined) return false; if (property !== undefined) { if (false) {} if (isObservableObject(value)) { return value[$mobx].values.has(property); } return false; } // For first check, see #701 return (isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value)); } function isObservable(value) { if (arguments.length !== 1) fail( false && false); return _isObservable(value); } function isObservableProp(value, propName) { if (typeof propName !== "string") return fail( false && false); return _isObservable(value, propName); } function keys(obj) { if (isObservableObject(obj)) { return obj[$mobx].getKeys(); } if (isObservableMap(obj)) { return Array.from(obj.keys()); } if (isObservableSet(obj)) { return Array.from(obj.keys()); } if (isObservableArray(obj)) { return obj.map(function (_, index) { return index; }); } return fail( false && false); } function values(obj) { if (isObservableObject(obj)) { return keys(obj).map(function (key) { return obj[key]; }); } if (isObservableMap(obj)) { return keys(obj).map(function (key) { return obj.get(key); }); } if (isObservableSet(obj)) { return Array.from(obj.values()); } if (isObservableArray(obj)) { return obj.slice(); } return fail( false && false); } function entries(obj) { if (isObservableObject(obj)) { return keys(obj).map(function (key) { return [key, obj[key]]; }); } if (isObservableMap(obj)) { return keys(obj).map(function (key) { return [key, obj.get(key)]; }); } if (isObservableSet(obj)) { return Array.from(obj.entries()); } if (isObservableArray(obj)) { return obj.map(function (key, index) { return [index, key]; }); } return fail( false && false); } function set(obj, key, value) { if (arguments.length === 2 && !isObservableSet(obj)) { startBatch(); var values_1 = key; try { for (var key_1 in values_1) set(obj, key_1, values_1[key_1]); } finally { endBatch(); } return; } if (isObservableObject(obj)) { var adm = obj[$mobx]; var existingObservable = adm.values.get(key); if (existingObservable) { adm.write(key, value); } else { adm.addObservableProp(key, value, adm.defaultEnhancer); } } else if (isObservableMap(obj)) { obj.set(key, value); } else if (isObservableSet(obj)) { obj.add(key); } else if (isObservableArray(obj)) { if (typeof key !== "number") key = parseInt(key, 10); invariant(key >= 0, "Not a valid index: '" + key + "'"); startBatch(); if (key >= obj.length) obj.length = key + 1; obj[key] = value; endBatch(); } else { return fail( false && false); } } function remove(obj, key) { if (isObservableObject(obj)) { obj[$mobx].remove(key); } else if (isObservableMap(obj)) { obj.delete(key); } else if (isObservableSet(obj)) { obj.delete(key); } else if (isObservableArray(obj)) { if (typeof key !== "number") key = parseInt(key, 10); invariant(key >= 0, "Not a valid index: '" + key + "'"); obj.splice(key, 1); } else { return fail( false && false); } } function has(obj, key) { if (isObservableObject(obj)) { // return keys(obj).indexOf(key) >= 0 var adm = getAdministration(obj); return adm.has(key); } else if (isObservableMap(obj)) { return obj.has(key); } else if (isObservableSet(obj)) { return obj.has(key); } else if (isObservableArray(obj)) { return key >= 0 && key < obj.length; } else { return fail( false && false); } } function get(obj, key) { if (!has(obj, key)) return undefined; if (isObservableObject(obj)) { return obj[key]; } else if (isObservableMap(obj)) { return obj.get(key); } else if (isObservableArray(obj)) { return obj[key]; } else { return fail( false && false); } } function observe(thing, propOrCb, cbOrFire, fireImmediately) { if (typeof cbOrFire === "function") return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately); else return observeObservable(thing, propOrCb, cbOrFire); } function observeObservable(thing, listener, fireImmediately) { return getAdministration(thing).observe(listener, fireImmediately); } function observeObservableProperty(thing, property, listener, fireImmediately) { return getAdministration(thing, property).observe(listener, fireImmediately); } var defaultOptions = { detectCycles: true, exportMapsAsObjects: true, recurseEverything: false }; function cache(map, key, value, options) { if (options.detectCycles) map.set(key, value); return value; } function toJSHelper(source, options, __alreadySeen) { if (!options.recurseEverything && !isObservable(source)) return source; if (typeof source !== "object") return source; // Directly return null if source is null if (source === null) return null; // Directly return the Date object itself if contained in the observable if (source instanceof Date) return source; if (isObservableValue(source)) return toJSHelper(source.get(), options, __alreadySeen); // make sure we track the keys of the object if (isObservable(source)) keys(source); var detectCycles = options.detectCycles === true; if (detectCycles && source !== null && __alreadySeen.has(source)) { return __alreadySeen.get(source); } if (isObservableArray(source) || Array.isArray(source)) { var res_1 = cache(__alreadySeen, source, [], options); var toAdd = source.map(function (value) { return toJSHelper(value, options, __alreadySeen); }); res_1.length = toAdd.length; for (var i = 0, l = toAdd.length; i < l; i++) res_1[i] = toAdd[i]; return res_1; } if (isObservableSet(source) || Object.getPrototypeOf(source) === Set.prototype) { if (options.exportMapsAsObjects === false) { var res_2 = cache(__alreadySeen, source, new Set(), options); source.forEach(function (value) { res_2.add(toJSHelper(value, options, __alreadySeen)); }); return res_2; } else { var res_3 = cache(__alreadySeen, source, [], options); source.forEach(function (value) { res_3.push(toJSHelper(value, options, __alreadySeen)); }); return res_3; } } if (isObservableMap(source) || Object.getPrototypeOf(source) === Map.prototype) { if (options.exportMapsAsObjects === false) { var res_4 = cache(__alreadySeen, source, new Map(), options); source.forEach(function (value, key) { res_4.set(key, toJSHelper(value, options, __alreadySeen)); }); return res_4; } else { var res_5 = cache(__alreadySeen, source, {}, options); source.forEach(function (value, key) { res_5[key] = toJSHelper(value, options, __alreadySeen); }); return res_5; } } // Fallback to the situation that source is an ObservableObject or a plain object var res = cache(__alreadySeen, source, {}, options); getPlainObjectKeys(source).forEach(function (key) { res[key] = toJSHelper(source[key], options, __alreadySeen); }); return res; } function toJS(source, options) { // backward compatibility if (typeof options === "boolean") options = { detectCycles: options }; if (!options) options = defaultOptions; options.detectCycles = options.detectCycles === undefined ? options.recurseEverything === true : options.detectCycles === true; var __alreadySeen; if (options.detectCycles) __alreadySeen = new Map(); return toJSHelper(source, options, __alreadySeen); } function trace() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var enterBreakPoint = false; if (typeof args[args.length - 1] === "boolean") enterBreakPoint = args.pop(); var derivation = getAtomFromArgs(args); if (!derivation) { return fail( false && false); } if (derivation.isTracing === TraceMode.NONE) { console.log("[mobx.trace] '" + derivation.name + "' tracing enabled"); } derivation.isTracing = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG; } function getAtomFromArgs(args) { switch (args.length) { case 0: return globalState.trackingDerivation; case 1: return getAtom(args[0]); case 2: return getAtom(args[0], args[1]); } } /** * During a transaction no views are updated until the end of the transaction. * The transaction will be run synchronously nonetheless. * * @param action a function that updates some reactive state * @returns any value that was returned by the 'action' parameter. */ function transaction(action, thisArg) { if (thisArg === void 0) { thisArg = undefined; } startBatch(); try { return action.apply(thisArg); } finally { endBatch(); } } function when(predicate, arg1, arg2) { if (arguments.length === 1 || (arg1 && typeof arg1 === "object")) return whenPromise(predicate, arg1); return _when(predicate, arg1, arg2 || {}); } function _when(predicate, effect, opts) { var timeoutHandle; if (typeof opts.timeout === "number") { timeoutHandle = setTimeout(function () { if (!disposer[$mobx].isDisposed) { disposer(); var error = new Error("WHEN_TIMEOUT"); if (opts.onError) opts.onError(error); else throw error; } }, opts.timeout); } opts.name = opts.name || "When@" + getNextId(); var effectAction = createAction(opts.name + "-effect", effect); var disposer = autorun(function (r) { if (predicate()) { r.dispose(); if (timeoutHandle) clearTimeout(timeoutHandle); effectAction(); } }, opts); return disposer; } function whenPromise(predicate, opts) { if (false) {} var cancel; var res = new Promise(function (resolve, reject) { var disposer = _when(predicate, resolve, __assign(__assign({}, opts), { onError: reject })); cancel = function () { disposer(); reject("WHEN_CANCELLED"); }; }); res.cancel = cancel; return res; } function getAdm(target) { return target[$mobx]; } function isPropertyKey(val) { return typeof val === "string" || typeof val === "number" || typeof val === "symbol"; } // Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects, // and skip either the internal values map, or the base object with its property descriptors! var objectProxyTraps = { has: function (target, name) { if (name === $mobx || name === "constructor" || name === mobxDidRunLazyInitializersSymbol) return true; var adm = getAdm(target); // MWE: should `in` operator be reactive? If not, below code path will be faster / more memory efficient // TODO: check performance stats! // if (adm.values.get(name as string)) return true if (isPropertyKey(name)) return adm.has(name); return name in target; }, get: function (target, name) { if (name === $mobx || name === "constructor" || name === mobxDidRunLazyInitializersSymbol) return target[name]; var adm = getAdm(target); var observable = adm.values.get(name); if (observable instanceof Atom) { var result = observable.get(); if (result === undefined) { // This fixes #1796, because deleting a prop that has an // undefined value won't retrigger a observer (no visible effect), // the autorun wouldn't subscribe to future key changes (see also next comment) adm.has(name); } return result; } // make sure we start listening to future keys // note that we only do this here for optimization if (isPropertyKey(name)) adm.has(name); return target[name]; }, set: function (target, name, value) { if (!isPropertyKey(name)) return false; set(target, name, value); return true; }, deleteProperty: function (target, name) { if (!isPropertyKey(name)) return false; var adm = getAdm(target); adm.remove(name); return true; }, ownKeys: function (target) { var adm = getAdm(target); adm.keysAtom.reportObserved(); return Reflect.ownKeys(target); }, preventExtensions: function (target) { fail("Dynamic observable objects cannot be frozen"); return false; } }; function createDynamicObservableObject(base) { var proxy = new Proxy(base, objectProxyTraps); base[$mobx].proxy = proxy; return proxy; } function hasInterceptors(interceptable) { return interceptable.interceptors !== undefined && interceptable.interceptors.length > 0; } function registerInterceptor(interceptable, handler) { var interceptors = interceptable.interceptors || (interceptable.interceptors = []); interceptors.push(handler); return once(function () { var idx = interceptors.indexOf(handler); if (idx !== -1) interceptors.splice(idx, 1); }); } function interceptChange(interceptable, change) { var prevU = untrackedStart(); try { // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950 var interceptors = __spread((interceptable.interceptors || [])); for (var i = 0, l = interceptors.length; i < l; i++) { change = interceptors[i](change); invariant(!change || change.type, "Intercept handlers should return nothing or a change object"); if (!change) break; } return change; } finally { untrackedEnd(prevU); } } function hasListeners(listenable) { return listenable.changeListeners !== undefined && listenable.changeListeners.length > 0; } function registerListener(listenable, handler) { var listeners = listenable.changeListeners || (listenable.changeListeners = []); listeners.push(handler); return once(function () { var idx = listeners.indexOf(handler); if (idx !== -1) listeners.splice(idx, 1); }); } function notifyListeners(listenable, change) { var prevU = untrackedStart(); var listeners = listenable.changeListeners; if (!listeners) return; listeners = listeners.slice(); for (var i = 0, l = listeners.length; i < l; i++) { listeners[i](change); } untrackedEnd(prevU); } var MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859 var arrayTraps = { get: function (target, name) { if (name === $mobx) return target[$mobx]; if (name === "length") return target[$mobx].getArrayLength(); if (typeof name === "number") { return arrayExtensions.get.call(target, name); } if (typeof name === "string" && !isNaN(name)) { return arrayExtensions.get.call(target, parseInt(name)); } if (arrayExtensions.hasOwnProperty(name)) { return arrayExtensions[name]; } return target[name]; }, set: function (target, name, value) { if (name === "length") { target[$mobx].setArrayLength(value); } if (typeof name === "number") { arrayExtensions.set.call(target, name, value); } if (typeof name === "symbol" || isNaN(name)) { target[name] = value; } else { // numeric string arrayExtensions.set.call(target, parseInt(name), value); } return true; }, preventExtensions: function (target) { fail("Observable arrays cannot be frozen"); return false; } }; function createObservableArray(initialValues, enhancer, name, owned) { if (name === void 0) { name = "ObservableArray@" + getNextId(); } if (owned === void 0) { owned = false; } var adm = new ObservableArrayAdministration(name, enhancer, owned); addHiddenFinalProp(adm.values, $mobx, adm); var proxy = new Proxy(adm.values, arrayTraps); adm.proxy = proxy; if (initialValues && initialValues.length) { var prev = allowStateChangesStart(true); adm.spliceWithArray(0, 0, initialValues); allowStateChangesEnd(prev); } return proxy; } var ObservableArrayAdministration = /** @class */ (function () { function ObservableArrayAdministration(name, enhancer, owned) { this.owned = owned; this.values = []; this.proxy = undefined; this.lastKnownLength = 0; this.atom = new Atom(name || "ObservableArray@" + getNextId()); this.enhancer = function (newV, oldV) { return enhancer(newV, oldV, name + "[..]"); }; } ObservableArrayAdministration.prototype.dehanceValue = function (value) { if (this.dehancer !== undefined) return this.dehancer(value); return value; }; ObservableArrayAdministration.prototype.dehanceValues = function (values) { if (this.dehancer !== undefined && values.length > 0) return values.map(this.dehancer); return values; }; ObservableArrayAdministration.prototype.intercept = function (handler) { return registerInterceptor(this, handler); }; ObservableArrayAdministration.prototype.observe = function (listener, fireImmediately) { if (fireImmediately === void 0) { fireImmediately = false; } if (fireImmediately) { listener({ object: this.proxy, type: "splice", index: 0, added: this.values.slice(), addedCount: this.values.length, removed: [], removedCount: 0 }); } return registerListener(this, listener); }; ObservableArrayAdministration.prototype.getArrayLength = function () { this.atom.reportObserved(); return this.values.length; }; ObservableArrayAdministration.prototype.setArrayLength = function (newLength) { if (typeof newLength !== "number" || newLength < 0) throw new Error("[mobx.array] Out of range: " + newLength); var currentLength = this.values.length; if (newLength === currentLength) return; else if (newLength > currentLength) { var newItems = new Array(newLength - currentLength); for (var i = 0; i < newLength - currentLength; i++) newItems[i] = undefined; // No Array.fill everywhere... this.spliceWithArray(currentLength, 0, newItems); } else this.spliceWithArray(newLength, currentLength - newLength); }; ObservableArrayAdministration.prototype.updateArrayLength = function (oldLength, delta) { if (oldLength !== this.lastKnownLength) throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed."); this.lastKnownLength += delta; }; ObservableArrayAdministration.prototype.spliceWithArray = function (index, deleteCount, newItems) { var _this = this; checkIfStateModificationsAreAllowed(this.atom); var length = this.values.length; if (index === undefined) index = 0; else if (index > length) index = length; else if (index < 0) index = Math.max(0, length + index); if (arguments.length === 1) deleteCount = length - index; else if (deleteCount === undefined || deleteCount === null) deleteCount = 0; else deleteCount = Math.max(0, Math.min(deleteCount, length - index)); if (newItems === undefined) newItems = EMPTY_ARRAY; if (hasInterceptors(this)) { var change = interceptChange(this, { object: this.proxy, type: "splice", index: index, removedCount: deleteCount, added: newItems }); if (!change) return EMPTY_ARRAY; deleteCount = change.removedCount; newItems = change.added; } newItems = newItems.length === 0 ? newItems : newItems.map(function (v) { return _this.enhancer(v, undefined); }); if (false) { var lengthDelta; } var res = this.spliceItemsIntoValues(index, deleteCount, newItems); if (deleteCount !== 0 || newItems.length !== 0) this.notifyArraySplice(index, newItems, res); return this.dehanceValues(res); }; ObservableArrayAdministration.prototype.spliceItemsIntoValues = function (index, deleteCount, newItems) { var _a; if (newItems.length < MAX_SPLICE_SIZE) { return (_a = this.values).splice.apply(_a, __spread([index, deleteCount], newItems)); } else { var res = this.values.slice(index, index + deleteCount); this.values = this.values .slice(0, index) .concat(newItems, this.values.slice(index + deleteCount)); return res; } }; ObservableArrayAdministration.prototype.notifyArrayChildUpdate = function (index, newValue, oldValue) { var notifySpy = !this.owned && isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { object: this.proxy, type: "update", index: index, newValue: newValue, oldValue: oldValue } : null; // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled if (notifySpy && "production" !== "production") spyReportStart(__assign(__assign({}, change), { name: this.atom.name })); this.atom.reportChanged(); if (notify) notifyListeners(this, change); if (notifySpy && "production" !== "production") spyReportEnd(); }; ObservableArrayAdministration.prototype.notifyArraySplice = function (index, added, removed) { var notifySpy = !this.owned && isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { object: this.proxy, type: "splice", index: index, removed: removed, added: added, removedCount: removed.length, addedCount: added.length } : null; if (notifySpy && "production" !== "production") spyReportStart(__assign(__assign({}, change), { name: this.atom.name })); this.atom.reportChanged(); // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe if (notify) notifyListeners(this, change); if (notifySpy && "production" !== "production") spyReportEnd(); }; return ObservableArrayAdministration; }()); var arrayExtensions = { intercept: function (handler) { return this[$mobx].intercept(handler); }, observe: function (listener, fireImmediately) { if (fireImmediately === void 0) { fireImmediately = false; } var adm = this[$mobx]; return adm.observe(listener, fireImmediately); }, clear: function () { return this.splice(0); }, replace: function (newItems) { var adm = this[$mobx]; return adm.spliceWithArray(0, adm.values.length, newItems); }, /** * Converts this array back to a (shallow) javascript structure. * For a deep clone use mobx.toJS */ toJS: function () { return this.slice(); }, toJSON: function () { // Used by JSON.stringify return this.toJS(); }, /* * functions that do alter the internal structure of the array, (based on lib.es6.d.ts) * since these functions alter the inner structure of the array, the have side effects. * Because the have side effects, they should not be used in computed function, * and for that reason the do not call dependencyState.notifyObserved */ splice: function (index, deleteCount) { var newItems = []; for (var _i = 2; _i < arguments.length; _i++) { newItems[_i - 2] = arguments[_i]; } var adm = this[$mobx]; switch (arguments.length) { case 0: return []; case 1: return adm.spliceWithArray(index); case 2: return adm.spliceWithArray(index, deleteCount); } return adm.spliceWithArray(index, deleteCount, newItems); }, spliceWithArray: function (index, deleteCount, newItems) { var adm = this[$mobx]; return adm.spliceWithArray(index, deleteCount, newItems); }, push: function () { var items = []; for (var _i = 0; _i < arguments.length; _i++) { items[_i] = arguments[_i]; } var adm = this[$mobx]; adm.spliceWithArray(adm.values.length, 0, items); return adm.values.length; }, pop: function () { return this.splice(Math.max(this[$mobx].values.length - 1, 0), 1)[0]; }, shift: function () { return this.splice(0, 1)[0]; }, unshift: function () { var items = []; for (var _i = 0; _i < arguments.length; _i++) { items[_i] = arguments[_i]; } var adm = this[$mobx]; adm.spliceWithArray(0, 0, items); return adm.values.length; }, reverse: function () { // reverse by default mutates in place before returning the result // which makes it both a 'derivation' and a 'mutation'. // so we deviate from the default and just make it an dervitation if (false) {} var clone = this.slice(); return clone.reverse.apply(clone, arguments); }, sort: function (compareFn) { // sort by default mutates in place before returning the result // which goes against all good practices. Let's not change the array in place! if (false) {} var clone = this.slice(); return clone.sort.apply(clone, arguments); }, remove: function (value) { var adm = this[$mobx]; var idx = adm.dehanceValues(adm.values).indexOf(value); if (idx > -1) { this.splice(idx, 1); return true; } return false; }, get: function (index) { var adm = this[$mobx]; if (adm) { if (index < adm.values.length) { adm.atom.reportObserved(); return adm.dehanceValue(adm.values[index]); } console.warn("[mobx.array] Attempt to read an array index (" + index + ") that is out of bounds (" + adm.values.length + "). Please check length first. Out of bound indices will not be tracked by MobX"); } return undefined; }, set: function (index, newValue) { var adm = this[$mobx]; var values = adm.values; if (index < values.length) { // update at index in range checkIfStateModificationsAreAllowed(adm.atom); var oldValue = values[index]; if (hasInterceptors(adm)) { var change = interceptChange(adm, { type: "update", object: adm.proxy, index: index, newValue: newValue }); if (!change) return; newValue = change.newValue; } newValue = adm.enhancer(newValue, oldValue); var changed = newValue !== oldValue; if (changed) { values[index] = newValue; adm.notifyArrayChildUpdate(index, newValue, oldValue); } } else if (index === values.length) { // add a new item adm.spliceWithArray(index, 0, [newValue]); } else { // out of bounds throw new Error("[mobx.array] Index out of bounds, " + index + " is larger than " + values.length); } } }; [ "concat", "flat", "includes", "indexOf", "join", "lastIndexOf", "slice", "toString", "toLocaleString" ].forEach(function (funcName) { // Feature detection (eg flat may not be available) if (typeof Array.prototype[funcName] !== "function") { return; } arrayExtensions[funcName] = function () { var adm = this[$mobx]; adm.atom.reportObserved(); var dehancedValues = adm.dehanceValues(adm.values); return dehancedValues[funcName].apply(dehancedValues, arguments); }; }); ["every", "filter", "find", "findIndex", "flatMap", "forEach", "map", "some"].forEach(function (funcName) { // Feature detection (eg flatMap may not be available) if (typeof Array.prototype[funcName] !== "function") { return; } arrayExtensions[funcName] = function (callback, thisArg) { var _this = this; var adm = this[$mobx]; adm.atom.reportObserved(); var dehancedValues = adm.dehanceValues(adm.values); return dehancedValues[funcName](function (element, index) { return callback.call(thisArg, element, index, _this); }, thisArg); }; }); ["reduce", "reduceRight"].forEach(function (funcName) { arrayExtensions[funcName] = function () { var _this = this; var adm = this[$mobx]; adm.atom.reportObserved(); // #2432 - reduce behavior depends on arguments.length var callback = arguments[0]; arguments[0] = function (accumulator, currentValue, index) { currentValue = adm.dehanceValue(currentValue); return callback(accumulator, currentValue, index, _this); }; return adm.values[funcName].apply(adm.values, arguments); }; }); var isObservableArrayAdministration = createInstanceofPredicate("ObservableArrayAdministration", ObservableArrayAdministration); function isObservableArray(thing) { return isObject(thing) && isObservableArrayAdministration(thing[$mobx]); } var _a; var ObservableMapMarker = {}; // just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54 // But: https://github.com/mobxjs/mobx/issues/1556 var ObservableMap = /** @class */ (function () { function ObservableMap(initialData, enhancer, name) { if (enhancer === void 0) { enhancer = deepEnhancer; } if (name === void 0) { name = "ObservableMap@" + getNextId(); } this.enhancer = enhancer; this.name = name; this[_a] = ObservableMapMarker; this._keysAtom = createAtom(this.name + ".keys()"); this[Symbol.toStringTag] = "Map"; if (typeof Map !== "function") { throw new Error("mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js"); } this._data = new Map(); this._hasMap = new Map(); this.merge(initialData); } ObservableMap.prototype._has = function (key) { return this._data.has(key); }; ObservableMap.prototype.has = function (key) { var _this = this; if (!globalState.trackingDerivation) return this._has(key); var entry = this._hasMap.get(key); if (!entry) { // todo: replace with atom (breaking change) var newEntry = (entry = new ObservableValue(this._has(key), referenceEnhancer, this.name + "." + stringifyKey(key) + "?", false)); this._hasMap.set(key, newEntry); onBecomeUnobserved(newEntry, function () { return _this._hasMap.delete(key); }); } return entry.get(); }; ObservableMap.prototype.set = function (key, value) { var hasKey = this._has(key); if (hasInterceptors(this)) { var change = interceptChange(this, { type: hasKey ? "update" : "add", object: this, newValue: value, name: key }); if (!change) return this; value = change.newValue; } if (hasKey) { this._updateValue(key, value); } else { this._addValue(key, value); } return this; }; ObservableMap.prototype.delete = function (key) { var _this = this; checkIfStateModificationsAreAllowed(this._keysAtom); if (hasInterceptors(this)) { var change = interceptChange(this, { type: "delete", object: this, name: key }); if (!change) return false; } if (this._has(key)) { var notifySpy = isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { type: "delete", object: this, oldValue: this._data.get(key).value, name: key } : null; if (notifySpy && "production" !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name, key: key })); transaction(function () { _this._keysAtom.reportChanged(); _this._updateHasMapEntry(key, false); var observable = _this._data.get(key); observable.setNewValue(undefined); _this._data.delete(key); }); if (notify) notifyListeners(this, change); if (notifySpy && "production" !== "production") spyReportEnd(); return true; } return false; }; ObservableMap.prototype._updateHasMapEntry = function (key, value) { var entry = this._hasMap.get(key); if (entry) { entry.setNewValue(value); } }; ObservableMap.prototype._updateValue = function (key, newValue) { var observable = this._data.get(key); newValue = observable.prepareNewValue(newValue); if (newValue !== globalState.UNCHANGED) { var notifySpy = isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { type: "update", object: this, oldValue: observable.value, name: key, newValue: newValue } : null; if (notifySpy && "production" !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name, key: key })); observable.setNewValue(newValue); if (notify) notifyListeners(this, change); if (notifySpy && "production" !== "production") spyReportEnd(); } }; ObservableMap.prototype._addValue = function (key, newValue) { var _this = this; checkIfStateModificationsAreAllowed(this._keysAtom); transaction(function () { var observable = new ObservableValue(newValue, _this.enhancer, _this.name + "." + stringifyKey(key), false); _this._data.set(key, observable); newValue = observable.value; // value might have been changed _this._updateHasMapEntry(key, true); _this._keysAtom.reportChanged(); }); var notifySpy = isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { type: "add", object: this, name: key, newValue: newValue } : null; if (notifySpy && "production" !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name, key: key })); if (notify) notifyListeners(this, change); if (notifySpy && "production" !== "production") spyReportEnd(); }; ObservableMap.prototype.get = function (key) { if (this.has(key)) return this.dehanceValue(this._data.get(key).get()); return this.dehanceValue(undefined); }; ObservableMap.prototype.dehanceValue = function (value) { if (this.dehancer !== undefined) { return this.dehancer(value); } return value; }; ObservableMap.prototype.keys = function () { this._keysAtom.reportObserved(); return this._data.keys(); }; ObservableMap.prototype.values = function () { var self = this; var keys = this.keys(); return makeIterable({ next: function () { var _b = keys.next(), done = _b.done, value = _b.value; return { done: done, value: done ? undefined : self.get(value) }; } }); }; ObservableMap.prototype.entries = function () { var self = this; var keys = this.keys(); return makeIterable({ next: function () { var _b = keys.next(), done = _b.done, value = _b.value; return { done: done, value: done ? undefined : [value, self.get(value)] }; } }); }; ObservableMap.prototype[(_a = $mobx, Symbol.iterator)] = function () { return this.entries(); }; ObservableMap.prototype.forEach = function (callback, thisArg) { var e_1, _b; try { for (var _c = __values(this), _d = _c.next(); !_d.done; _d = _c.next()) { var _e = __read(_d.value, 2), key = _e[0], value = _e[1]; callback.call(thisArg, value, key, this); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_d && !_d.done && (_b = _c.return)) _b.call(_c); } finally { if (e_1) throw e_1.error; } } }; /** Merge another object into this object, returns this. */ ObservableMap.prototype.merge = function (other) { var _this = this; if (isObservableMap(other)) { other = other.toJS(); } transaction(function () { var prev = allowStateChangesStart(true); try { if (isPlainObject(other)) getPlainObjectKeys(other).forEach(function (key) { return _this.set(key, other[key]); }); else if (Array.isArray(other)) other.forEach(function (_b) { var _c = __read(_b, 2), key = _c[0], value = _c[1]; return _this.set(key, value); }); else if (isES6Map(other)) { if (other.constructor !== Map) fail("Cannot initialize from classes that inherit from Map: " + other.constructor.name); // prettier-ignore other.forEach(function (value, key) { return _this.set(key, value); }); } else if (other !== null && other !== undefined) fail("Cannot initialize map from " + other); } finally { allowStateChangesEnd(prev); } }); return this; }; ObservableMap.prototype.clear = function () { var _this = this; transaction(function () { untracked(function () { var e_2, _b; try { for (var _c = __values(_this.keys()), _d = _c.next(); !_d.done; _d = _c.next()) { var key = _d.value; _this.delete(key); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_d && !_d.done && (_b = _c.return)) _b.call(_c); } finally { if (e_2) throw e_2.error; } } }); }); }; ObservableMap.prototype.replace = function (values) { var _this = this; // Implementation requirements: // - respect ordering of replacement map // - allow interceptors to run and potentially prevent individual operations // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions) // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!) // - note that result map may differ from replacement map due to the interceptors transaction(function () { var e_3, _b, e_4, _c; // Convert to map so we can do quick key lookups var replacementMap = convertToMap(values); var orderedData = new Map(); // Used for optimization var keysReportChangedCalled = false; try { // Delete keys that don't exist in replacement map // if the key deletion is prevented by interceptor // add entry at the beginning of the result map for (var _d = __values(_this._data.keys()), _e = _d.next(); !_e.done; _e = _d.next()) { var key = _e.value; // Concurrently iterating/deleting keys // iterator should handle this correctly if (!replacementMap.has(key)) { var deleted = _this.delete(key); // Was the key removed? if (deleted) { // _keysAtom.reportChanged() was already called keysReportChangedCalled = true; } else { // Delete prevented by interceptor var value = _this._data.get(key); orderedData.set(key, value); } } } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (_e && !_e.done && (_b = _d.return)) _b.call(_d); } finally { if (e_3) throw e_3.error; } } try { // Merge entries for (var _f = __values(replacementMap.entries()), _g = _f.next(); !_g.done; _g = _f.next()) { var _h = __read(_g.value, 2), key = _h[0], value = _h[1]; // We will want to know whether a new key is added var keyExisted = _this._data.has(key); // Add or update value _this.set(key, value); // The addition could have been prevent by interceptor if (_this._data.has(key)) { // The update could have been prevented by interceptor // and also we want to preserve existing values // so use value from _data map (instead of replacement map) var value_1 = _this._data.get(key); orderedData.set(key, value_1); // Was a new key added? if (!keyExisted) { // _keysAtom.reportChanged() was already called keysReportChangedCalled = true; } } } } catch (e_4_1) { e_4 = { error: e_4_1 }; } finally { try { if (_g && !_g.done && (_c = _f.return)) _c.call(_f); } finally { if (e_4) throw e_4.error; } } // Check for possible key order change if (!keysReportChangedCalled) { if (_this._data.size !== orderedData.size) { // If size differs, keys are definitely modified _this._keysAtom.reportChanged(); } else { var iter1 = _this._data.keys(); var iter2 = orderedData.keys(); var next1 = iter1.next(); var next2 = iter2.next(); while (!next1.done) { if (next1.value !== next2.value) { _this._keysAtom.reportChanged(); break; } next1 = iter1.next(); next2 = iter2.next(); } } } // Use correctly ordered map _this._data = orderedData; }); return this; }; Object.defineProperty(ObservableMap.prototype, "size", { get: function () { this._keysAtom.reportObserved(); return this._data.size; }, enumerable: true, configurable: true }); /** * Returns a plain object that represents this map. * Note that all the keys being stringified. * If there are duplicating keys after converting them to strings, behaviour is undetermined. */ ObservableMap.prototype.toPOJO = function () { var e_5, _b; var res = {}; try { for (var _c = __values(this), _d = _c.next(); !_d.done; _d = _c.next()) { var _e = __read(_d.value, 2), key = _e[0], value = _e[1]; // We lie about symbol key types due to https://github.com/Microsoft/TypeScript/issues/1863 res[typeof key === "symbol" ? key : stringifyKey(key)] = value; } } catch (e_5_1) { e_5 = { error: e_5_1 }; } finally { try { if (_d && !_d.done && (_b = _c.return)) _b.call(_c); } finally { if (e_5) throw e_5.error; } } return res; }; /** * Returns a shallow non observable object clone of this map. * Note that the values migth still be observable. For a deep clone use mobx.toJS. */ ObservableMap.prototype.toJS = function () { return new Map(this); }; ObservableMap.prototype.toJSON = function () { // Used by JSON.stringify return this.toPOJO(); }; ObservableMap.prototype.toString = function () { var _this = this; return (this.name + "[{ " + Array.from(this.keys()) .map(function (key) { return stringifyKey(key) + ": " + ("" + _this.get(key)); }) .join(", ") + " }]"); }; /** * Observes this object. Triggers for the events 'add', 'update' and 'delete'. * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe * for callback details */ ObservableMap.prototype.observe = function (listener, fireImmediately) { false && false; return registerListener(this, listener); }; ObservableMap.prototype.intercept = function (handler) { return registerInterceptor(this, handler); }; return ObservableMap; }()); /* 'var' fixes small-build issue */ var isObservableMap = createInstanceofPredicate("ObservableMap", ObservableMap); var _a$1; var ObservableSetMarker = {}; var ObservableSet = /** @class */ (function () { function ObservableSet(initialData, enhancer, name) { if (enhancer === void 0) { enhancer = deepEnhancer; } if (name === void 0) { name = "ObservableSet@" + getNextId(); } this.name = name; this[_a$1] = ObservableSetMarker; this._data = new Set(); this._atom = createAtom(this.name); this[Symbol.toStringTag] = "Set"; if (typeof Set !== "function") { throw new Error("mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js"); } this.enhancer = function (newV, oldV) { return enhancer(newV, oldV, name); }; if (initialData) { this.replace(initialData); } } ObservableSet.prototype.dehanceValue = function (value) { if (this.dehancer !== undefined) { return this.dehancer(value); } return value; }; ObservableSet.prototype.clear = function () { var _this = this; transaction(function () { untracked(function () { var e_1, _b; try { for (var _c = __values(_this._data.values()), _d = _c.next(); !_d.done; _d = _c.next()) { var value = _d.value; _this.delete(value); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_d && !_d.done && (_b = _c.return)) _b.call(_c); } finally { if (e_1) throw e_1.error; } } }); }); }; ObservableSet.prototype.forEach = function (callbackFn, thisArg) { var e_2, _b; try { for (var _c = __values(this), _d = _c.next(); !_d.done; _d = _c.next()) { var value = _d.value; callbackFn.call(thisArg, value, value, this); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_d && !_d.done && (_b = _c.return)) _b.call(_c); } finally { if (e_2) throw e_2.error; } } }; Object.defineProperty(ObservableSet.prototype, "size", { get: function () { this._atom.reportObserved(); return this._data.size; }, enumerable: true, configurable: true }); ObservableSet.prototype.add = function (value) { var _this = this; checkIfStateModificationsAreAllowed(this._atom); if (hasInterceptors(this)) { var change = interceptChange(this, { type: "add", object: this, newValue: value }); if (!change) return this; // TODO: ideally, value = change.value would be done here, so that values can be // changed by interceptor. Same applies for other Set and Map api's. } if (!this.has(value)) { transaction(function () { _this._data.add(_this.enhancer(value, undefined)); _this._atom.reportChanged(); }); var notifySpy = isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { type: "add", object: this, newValue: value } : null; if (notifySpy && "production" !== "production") spyReportStart(change); if (notify) notifyListeners(this, change); if (notifySpy && "production" !== "production") spyReportEnd(); } return this; }; ObservableSet.prototype.delete = function (value) { var _this = this; if (hasInterceptors(this)) { var change = interceptChange(this, { type: "delete", object: this, oldValue: value }); if (!change) return false; } if (this.has(value)) { var notifySpy = isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { type: "delete", object: this, oldValue: value } : null; if (notifySpy && "production" !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name })); transaction(function () { _this._atom.reportChanged(); _this._data.delete(value); }); if (notify) notifyListeners(this, change); if (notifySpy && "production" !== "production") spyReportEnd(); return true; } return false; }; ObservableSet.prototype.has = function (value) { this._atom.reportObserved(); return this._data.has(this.dehanceValue(value)); }; ObservableSet.prototype.entries = function () { var nextIndex = 0; var keys = Array.from(this.keys()); var values = Array.from(this.values()); return makeIterable({ next: function () { var index = nextIndex; nextIndex += 1; return index < values.length ? { value: [keys[index], values[index]], done: false } : { done: true }; } }); }; ObservableSet.prototype.keys = function () { return this.values(); }; ObservableSet.prototype.values = function () { this._atom.reportObserved(); var self = this; var nextIndex = 0; var observableValues = Array.from(this._data.values()); return makeIterable({ next: function () { return nextIndex < observableValues.length ? { value: self.dehanceValue(observableValues[nextIndex++]), done: false } : { done: true }; } }); }; ObservableSet.prototype.replace = function (other) { var _this = this; if (isObservableSet(other)) { other = other.toJS(); } transaction(function () { var prev = allowStateChangesStart(true); try { if (Array.isArray(other)) { _this.clear(); other.forEach(function (value) { return _this.add(value); }); } else if (isES6Set(other)) { _this.clear(); other.forEach(function (value) { return _this.add(value); }); } else if (other !== null && other !== undefined) { fail("Cannot initialize set from " + other); } } finally { allowStateChangesEnd(prev); } }); return this; }; ObservableSet.prototype.observe = function (listener, fireImmediately) { // TODO 'fireImmediately' can be true? false && false; return registerListener(this, listener); }; ObservableSet.prototype.intercept = function (handler) { return registerInterceptor(this, handler); }; ObservableSet.prototype.toJS = function () { return new Set(this); }; ObservableSet.prototype.toString = function () { return this.name + "[ " + Array.from(this).join(", ") + " ]"; }; ObservableSet.prototype[(_a$1 = $mobx, Symbol.iterator)] = function () { return this.values(); }; return ObservableSet; }()); var isObservableSet = createInstanceofPredicate("ObservableSet", ObservableSet); var ObservableObjectAdministration = /** @class */ (function () { function ObservableObjectAdministration(target, values, name, defaultEnhancer) { if (values === void 0) { values = new Map(); } this.target = target; this.values = values; this.name = name; this.defaultEnhancer = defaultEnhancer; this.keysAtom = new Atom(name + ".keys"); } ObservableObjectAdministration.prototype.read = function (key) { return this.values.get(key).get(); }; ObservableObjectAdministration.prototype.write = function (key, newValue) { var instance = this.target; var observable = this.values.get(key); if (observable instanceof ComputedValue) { observable.set(newValue); return; } // intercept if (hasInterceptors(this)) { var change = interceptChange(this, { type: "update", object: this.proxy || instance, name: key, newValue: newValue }); if (!change) return; newValue = change.newValue; } newValue = observable.prepareNewValue(newValue); // notify spy & observers if (newValue !== globalState.UNCHANGED) { var notify = hasListeners(this); var notifySpy = isSpyEnabled(); var change = notify || notifySpy ? { type: "update", object: this.proxy || instance, oldValue: observable.value, name: key, newValue: newValue } : null; if (notifySpy && "production" !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name, key: key })); observable.setNewValue(newValue); if (notify) notifyListeners(this, change); if (notifySpy && "production" !== "production") spyReportEnd(); } }; ObservableObjectAdministration.prototype.has = function (key) { var map = this.pendingKeys || (this.pendingKeys = new Map()); var entry = map.get(key); if (entry) return entry.get(); else { var exists = !!this.values.get(key); // Possible optimization: Don't have a separate map for non existing keys, // but store them in the values map instead, using a special symbol to denote "not existing" entry = new ObservableValue(exists, referenceEnhancer, this.name + "." + stringifyKey(key) + "?", false); map.set(key, entry); return entry.get(); // read to subscribe } }; ObservableObjectAdministration.prototype.addObservableProp = function (propName, newValue, enhancer) { if (enhancer === void 0) { enhancer = this.defaultEnhancer; } var target = this.target; assertPropertyConfigurable(target, propName); if (hasInterceptors(this)) { var change = interceptChange(this, { object: this.proxy || target, name: propName, type: "add", newValue: newValue }); if (!change) return; newValue = change.newValue; } var observable = new ObservableValue(newValue, enhancer, this.name + "." + stringifyKey(propName), false); this.values.set(propName, observable); newValue = observable.value; // observableValue might have changed it Object.defineProperty(target, propName, generateObservablePropConfig(propName)); this.notifyPropertyAddition(propName, newValue); }; ObservableObjectAdministration.prototype.addComputedProp = function (propertyOwner, // where is the property declared? propName, options) { var target = this.target; options.name = options.name || this.name + "." + stringifyKey(propName); this.values.set(propName, new ComputedValue(options)); if (propertyOwner === target || isPropertyConfigurable(propertyOwner, propName)) Object.defineProperty(propertyOwner, propName, generateComputedPropConfig(propName)); }; ObservableObjectAdministration.prototype.remove = function (key) { if (!this.values.has(key)) return; var target = this.target; if (hasInterceptors(this)) { var change = interceptChange(this, { object: this.proxy || target, name: key, type: "remove" }); if (!change) return; } try { startBatch(); var notify = hasListeners(this); var notifySpy = isSpyEnabled(); var oldObservable = this.values.get(key); var oldValue = oldObservable && oldObservable.get(); oldObservable && oldObservable.set(undefined); // notify key and keyset listeners this.keysAtom.reportChanged(); this.values.delete(key); if (this.pendingKeys) { var entry = this.pendingKeys.get(key); if (entry) entry.set(false); } // delete the prop delete this.target[key]; var change = notify || notifySpy ? { type: "remove", object: this.proxy || target, oldValue: oldValue, name: key } : null; if (notifySpy && "production" !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name, key: key })); if (notify) notifyListeners(this, change); if (notifySpy && "production" !== "production") spyReportEnd(); } finally { endBatch(); } }; ObservableObjectAdministration.prototype.illegalAccess = function (owner, propName) { /** * This happens if a property is accessed through the prototype chain, but the property was * declared directly as own property on the prototype. * * E.g.: * class A { * } * extendObservable(A.prototype, { x: 1 }) * * classB extens A { * } * console.log(new B().x) * * It is unclear whether the property should be considered 'static' or inherited. * Either use `console.log(A.x)` * or: decorate(A, { x: observable }) * * When using decorate, the property will always be redeclared as own property on the actual instance */ console.warn("Property '" + propName + "' of '" + owner + "' was accessed through the prototype chain. Use 'decorate' instead to declare the prop or access it statically through it's owner"); }; /** * Observes this object. Triggers for the events 'add', 'update' and 'delete'. * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe * for callback details */ ObservableObjectAdministration.prototype.observe = function (callback, fireImmediately) { false && false; return registerListener(this, callback); }; ObservableObjectAdministration.prototype.intercept = function (handler) { return registerInterceptor(this, handler); }; ObservableObjectAdministration.prototype.notifyPropertyAddition = function (key, newValue) { var notify = hasListeners(this); var notifySpy = isSpyEnabled(); var change = notify || notifySpy ? { type: "add", object: this.proxy || this.target, name: key, newValue: newValue } : null; if (notifySpy && "production" !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name, key: key })); if (notify) notifyListeners(this, change); if (notifySpy && "production" !== "production") spyReportEnd(); if (this.pendingKeys) { var entry = this.pendingKeys.get(key); if (entry) entry.set(true); } this.keysAtom.reportChanged(); }; ObservableObjectAdministration.prototype.getKeys = function () { var e_1, _a; this.keysAtom.reportObserved(); // return Reflect.ownKeys(this.values) as any var res = []; try { for (var _b = __values(this.values), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = __read(_c.value, 2), key = _d[0], value = _d[1]; if (value instanceof ObservableValue) res.push(key); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } return res; }; return ObservableObjectAdministration; }()); function asObservableObject(target, name, defaultEnhancer) { if (name === void 0) { name = ""; } if (defaultEnhancer === void 0) { defaultEnhancer = deepEnhancer; } if (Object.prototype.hasOwnProperty.call(target, $mobx)) return target[$mobx]; false && false; if (!isPlainObject(target)) name = (target.constructor.name || "ObservableObject") + "@" + getNextId(); if (!name) name = "ObservableObject@" + getNextId(); var adm = new ObservableObjectAdministration(target, new Map(), stringifyKey(name), defaultEnhancer); addHiddenProp(target, $mobx, adm); return adm; } var observablePropertyConfigs = Object.create(null); var computedPropertyConfigs = Object.create(null); function generateObservablePropConfig(propName) { return (observablePropertyConfigs[propName] || (observablePropertyConfigs[propName] = { configurable: true, enumerable: true, get: function () { return this[$mobx].read(propName); }, set: function (v) { this[$mobx].write(propName, v); } })); } function getAdministrationForComputedPropOwner(owner) { var adm = owner[$mobx]; if (!adm) { // because computed props are declared on proty, // the current instance might not have been initialized yet initializeInstance(owner); return owner[$mobx]; } return adm; } function generateComputedPropConfig(propName) { return (computedPropertyConfigs[propName] || (computedPropertyConfigs[propName] = { configurable: globalState.computedConfigurable, enumerable: false, get: function () { return getAdministrationForComputedPropOwner(this).read(propName); }, set: function (v) { getAdministrationForComputedPropOwner(this).write(propName, v); } })); } var isObservableObjectAdministration = createInstanceofPredicate("ObservableObjectAdministration", ObservableObjectAdministration); function isObservableObject(thing) { if (isObject(thing)) { // Initializers run lazily when transpiling to babel, so make sure they are run... initializeInstance(thing); return isObservableObjectAdministration(thing[$mobx]); } return false; } function getAtom(thing, property) { if (typeof thing === "object" && thing !== null) { if (isObservableArray(thing)) { if (property !== undefined) fail( false && false); return thing[$mobx].atom; } if (isObservableSet(thing)) { return thing[$mobx]; } if (isObservableMap(thing)) { var anyThing = thing; if (property === undefined) return anyThing._keysAtom; var observable = anyThing._data.get(property) || anyThing._hasMap.get(property); if (!observable) fail( false && false); return observable; } // Initializers run lazily when transpiling to babel, so make sure they are run... initializeInstance(thing); if (property && !thing[$mobx]) thing[property]; // See #1072 if (isObservableObject(thing)) { if (!property) return fail( false && false); var observable = thing[$mobx].values.get(property); if (!observable) fail( false && false); return observable; } if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) { return thing; } } else if (typeof thing === "function") { if (isReaction(thing[$mobx])) { // disposer function return thing[$mobx]; } } return fail( false && false); } function getAdministration(thing, property) { if (!thing) fail("Expecting some object"); if (property !== undefined) return getAdministration(getAtom(thing, property)); if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) return thing; if (isObservableMap(thing) || isObservableSet(thing)) return thing; // Initializers run lazily when transpiling to babel, so make sure they are run... initializeInstance(thing); if (thing[$mobx]) return thing[$mobx]; fail( false && false); } function getDebugName(thing, property) { var named; if (property !== undefined) named = getAtom(thing, property); else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) named = getAdministration(thing); else named = getAtom(thing); // valid for arrays as well return named.name; } var toString = Object.prototype.toString; function deepEqual(a, b, depth) { if (depth === void 0) { depth = -1; } return eq(a, b, depth); } // Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289 // Internal recursive comparison function for `isEqual`. function eq(a, b, depth, aStack, bStack) { // Identical objects are equal. `0 === -0`, but they aren't identical. // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). if (a === b) return a !== 0 || 1 / a === 1 / b; // `null` or `undefined` only equal to itself (strict comparison). if (a == null || b == null) return false; // `NaN`s are equivalent, but non-reflexive. if (a !== a) return b !== b; // Exhaust primitive checks var type = typeof a; if (type !== "function" && type !== "object" && typeof b != "object") return false; // Compare `[[Class]]` names. var className = toString.call(a); if (className !== toString.call(b)) return false; switch (className) { // Strings, numbers, regular expressions, dates, and booleans are compared by value. case "[object RegExp]": // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') case "[object String]": // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is // equivalent to `new String("5")`. return "" + a === "" + b; case "[object Number]": // `NaN`s are equivalent, but non-reflexive. // Object(NaN) is equivalent to NaN. if (+a !== +a) return +b !== +b; // An `egal` comparison is performed for other numeric values. return +a === 0 ? 1 / +a === 1 / b : +a === +b; case "[object Date]": case "[object Boolean]": // Coerce dates and booleans to numeric primitive values. Dates are compared by their // millisecond representations. Note that invalid dates with millisecond representations // of `NaN` are not equivalent. return +a === +b; case "[object Symbol]": return (typeof Symbol !== "undefined" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b)); case "[object Map]": case "[object Set]": // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level. // Hide this extra level by increasing the depth. if (depth >= 0) { depth++; } break; } // Unwrap any wrapped objects. a = unwrap(a); b = unwrap(b); var areArrays = className === "[object Array]"; if (!areArrays) { if (typeof a != "object" || typeof b != "object") return false; // Objects with different constructors are not equivalent, but `Object`s or `Array`s // from different frames are. var aCtor = a.constructor, bCtor = b.constructor; if (aCtor !== bCtor && !(typeof aCtor === "function" && aCtor instanceof aCtor && typeof bCtor === "function" && bCtor instanceof bCtor) && ("constructor" in a && "constructor" in b)) { return false; } } if (depth === 0) { return false; } else if (depth < 0) { depth = -1; } // Assume equality for cyclic structures. The algorithm for detecting cyclic // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. // Initializing stack of traversed objects. // It's done here since we only need them for objects and arrays comparison. aStack = aStack || []; bStack = bStack || []; var length = aStack.length; while (length--) { // Linear search. Performance is inversely proportional to the number of // unique nested structures. if (aStack[length] === a) return bStack[length] === b; } // Add the first object to the stack of traversed objects. aStack.push(a); bStack.push(b); // Recursively compare objects and arrays. if (areArrays) { // Compare array lengths to determine if a deep comparison is necessary. length = a.length; if (length !== b.length) return false; // Deep compare the contents, ignoring non-numeric properties. while (length--) { if (!eq(a[length], b[length], depth - 1, aStack, bStack)) return false; } } else { // Deep compare objects. var keys = Object.keys(a); var key = void 0; length = keys.length; // Ensure that both objects contain the same number of properties before comparing deep equality. if (Object.keys(b).length !== length) return false; while (length--) { // Deep compare each member key = keys[length]; if (!(has$1(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) return false; } } // Remove the first object from the stack of traversed objects. aStack.pop(); bStack.pop(); return true; } function unwrap(a) { if (isObservableArray(a)) return a.slice(); if (isES6Map(a) || isObservableMap(a)) return Array.from(a.entries()); if (isES6Set(a) || isObservableSet(a)) return Array.from(a.entries()); return a; } function has$1(a, key) { return Object.prototype.hasOwnProperty.call(a, key); } function makeIterable(iterator) { iterator[Symbol.iterator] = getSelf; return iterator; } function getSelf() { return this; } /** * (c) Michel Weststrate 2015 - 2018 * MIT Licensed * * Welcome to the mobx sources! To get an global overview of how MobX internally works, * this is a good place to start: * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74 * * Source folders: * =============== * * - api/ Most of the public static methods exposed by the module can be found here. * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here. * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`. * - utils/ Utility stuff. * */ if (typeof Proxy === "undefined" || typeof Symbol === "undefined") { throw new Error("[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore."); } try { // define process.env if needed // if this is not a production build in the first place // (in which case the expression below would be substituted with 'production') "production"; } catch (e) { var g = getGlobal(); if (typeof process === "undefined") g.process = {}; g.process.env = {}; } (function () { function testCodeMinification() { } if (testCodeMinification.name !== "testCodeMinification" && "production" !== "production" && typeof process !== 'undefined' && process.env.IGNORE_MOBX_MINIFY_WARNING !== "true") { // trick so it doesn't get replaced var varName = ["process", "env", "NODE_ENV"].join("."); console.warn("[mobx] you are running a minified build, but '" + varName + "' was not set to 'production' in your bundler. This results in an unnecessarily large and slow bundle"); } })(); if (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "object") { // See: https://github.com/andykog/mobx-devtools/ __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({ spy: spy, extras: { getDebugName: getDebugName }, $mobx: $mobx }); } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(155), __webpack_require__(82))) /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return d; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return B; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return D; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return v; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return p; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return v; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return q; }); /* unused harmony export isValidElement */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return l; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return S; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return A; }); var n,l,u,i,t,r,o,f,e={},c=[],s=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function a(n,l){for(var u in l)n[u]=l[u];return n}function h(n){var l=n.parentNode;l&&l.removeChild(n)}function v(l,u,i){var t,r,o,f={};for(o in u)"key"==o?t=u[o]:"ref"==o?r=u[o]:f[o]=u[o];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps)void 0===f[o]&&(f[o]=l.defaultProps[o]);return y(l,f,t,r,null)}function y(n,i,t,r,o){var f={type:n,props:i,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++u:o};return null==o&&null!=l.vnode&&l.vnode(f),f}function p(){return{current:null}}function d(n){return n.children}function _(n,l){this.props=n,this.context=l}function k(n,l){if(null==l)return n.__?k(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l0?y(_.type,_.props,_.key,null,_.__v):_)){if(_.__=u,_.__b=u.__b+1,null===(p=w[h])||p&&_.key==p.key&&_.type===p.type)w[h]=void 0;else for(v=0;v2&&(f.children=arguments.length>3?n.call(arguments,2):i),y(l.type,f,t||l.key,r||l.ref,null)}function D(n,l){var u={__c:l="__cC"+f++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(m)},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=c.slice,l={__e:function(n,l){for(var u,i,t;l=l.__;)if((u=l.__c)&&!u.__)try{if((i=u.constructor)&&null!=i.getDerivedStateFromError&&(u.setState(i.getDerivedStateFromError(n)),t=u.__d),null!=u.componentDidCatch&&(u.componentDidCatch(n),t=u.__d),t)return u.__E=u}catch(l){n=l}throw n}},u=0,i=function(n){return null!=n&&void 0===n.constructor},_.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=a({},this.state),"function"==typeof n&&(n=n(a({},u),this.props)),n&&a(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),m(this))},_.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),m(this))},_.prototype.render=d,t=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,g.__r=0,f=0; //# sourceMappingURL=preact.module.js.map /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { var TO_STRING_TAG_SUPPORT = __webpack_require__(116); var redefine = __webpack_require__(44); var toString = __webpack_require__(178); // `Object.prototype.toString` method // https://tc39.es/ecma262/#sec-object.prototype.tostring if (!TO_STRING_TAG_SUPPORT) { redefine(Object.prototype, 'toString', toString, { unsafe: true }); } /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toIndexedObject = __webpack_require__(39); var addToUnscopables = __webpack_require__(83); var Iterators = __webpack_require__(71); var InternalStateModule = __webpack_require__(56); var defineIterator = __webpack_require__(111); var ARRAY_ITERATOR = 'Array Iterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR); // `Array.prototype.entries` method // https://tc39.es/ecma262/#sec-array.prototype.entries // `Array.prototype.keys` method // https://tc39.es/ecma262/#sec-array.prototype.keys // `Array.prototype.values` method // https://tc39.es/ecma262/#sec-array.prototype.values // `Array.prototype[@@iterator]` method // https://tc39.es/ecma262/#sec-array.prototype-@@iterator // `CreateArrayIterator` internal method // https://tc39.es/ecma262/#sec-createarrayiterator module.exports = defineIterator(Array, 'Array', function (iterated, kind) { setInternalState(this, { type: ARRAY_ITERATOR, target: toIndexedObject(iterated), // target index: 0, // next index kind: kind // kind }); // `%ArrayIteratorPrototype%.next` method // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next }, function () { var state = getInternalState(this); var target = state.target; var kind = state.kind; var index = state.index++; if (!target || index >= target.length) { state.target = undefined; return { value: undefined, done: true }; } if (kind == 'keys') return { value: index, done: false }; if (kind == 'values') return { value: target[index], done: false }; return { value: [index, target[index]], done: false }; }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% // https://tc39.es/ecma262/#sec-createunmappedargumentsobject // https://tc39.es/ecma262/#sec-createmappedargumentsobject Iterators.Arguments = Iterators.Array; // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var DOMIterables = __webpack_require__(147); var DOMTokenListPrototype = __webpack_require__(148); var ArrayIteratorMethods = __webpack_require__(3); var createNonEnumerableProperty = __webpack_require__(57); var wellKnownSymbol = __webpack_require__(27); var ITERATOR = wellKnownSymbol('iterator'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var ArrayValues = ArrayIteratorMethods.values; var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) { if (CollectionPrototype) { // some Chrome versions have non-configurable methods on DOMTokenList if (CollectionPrototype[ITERATOR] !== ArrayValues) try { createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues); } catch (error) { CollectionPrototype[ITERATOR] = ArrayValues; } if (!CollectionPrototype[TO_STRING_TAG]) { createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME); } if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) { // some Chrome versions have non-configurable methods on DOMTokenList if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try { createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]); } catch (error) { CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME]; } } } }; for (var COLLECTION_NAME in DOMIterables) { handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype, COLLECTION_NAME); } handlePrototype(DOMTokenListPrototype, 'DOMTokenList'); /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var global = __webpack_require__(7); var getBuiltIn = __webpack_require__(46); var apply = __webpack_require__(77); var call = __webpack_require__(35); var uncurryThis = __webpack_require__(15); var IS_PURE = __webpack_require__(65); var DESCRIPTORS = __webpack_require__(36); var NATIVE_SYMBOL = __webpack_require__(109); var fails = __webpack_require__(18); var hasOwn = __webpack_require__(34); var isArray = __webpack_require__(99); var isCallable = __webpack_require__(28); var isObject = __webpack_require__(33); var isPrototypeOf = __webpack_require__(58); var isSymbol = __webpack_require__(88); var anObject = __webpack_require__(32); var toObject = __webpack_require__(38); var toIndexedObject = __webpack_require__(39); var toPropertyKey = __webpack_require__(87); var $toString = __webpack_require__(40); var createPropertyDescriptor = __webpack_require__(72); var nativeObjectCreate = __webpack_require__(54); var objectKeys = __webpack_require__(67); var getOwnPropertyNamesModule = __webpack_require__(73); var getOwnPropertyNamesExternal = __webpack_require__(139); var getOwnPropertySymbolsModule = __webpack_require__(112); var getOwnPropertyDescriptorModule = __webpack_require__(51); var definePropertyModule = __webpack_require__(37); var propertyIsEnumerableModule = __webpack_require__(93); var arraySlice = __webpack_require__(101); var redefine = __webpack_require__(44); var shared = __webpack_require__(84); var sharedKey = __webpack_require__(91); var hiddenKeys = __webpack_require__(70); var uid = __webpack_require__(85); var wellKnownSymbol = __webpack_require__(27); var wrappedWellKnownSymbolModule = __webpack_require__(149); var defineWellKnownSymbol = __webpack_require__(150); var setToStringTag = __webpack_require__(74); var InternalStateModule = __webpack_require__(56); var $forEach = __webpack_require__(75).forEach; var HIDDEN = sharedKey('hidden'); var SYMBOL = 'Symbol'; var PROTOTYPE = 'prototype'; var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(SYMBOL); var ObjectPrototype = Object[PROTOTYPE]; var $Symbol = global.Symbol; var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE]; var TypeError = global.TypeError; var QObject = global.QObject; var $stringify = getBuiltIn('JSON', 'stringify'); var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var nativeDefineProperty = definePropertyModule.f; var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f; var nativePropertyIsEnumerable = propertyIsEnumerableModule.f; var push = uncurryThis([].push); var AllSymbols = shared('symbols'); var ObjectPrototypeSymbols = shared('op-symbols'); var StringToSymbolRegistry = shared('string-to-symbol-registry'); var SymbolToStringRegistry = shared('symbol-to-string-registry'); var WellKnownSymbolsStore = shared('wks'); // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 var setSymbolDescriptor = DESCRIPTORS && fails(function () { return nativeObjectCreate(nativeDefineProperty({}, 'a', { get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; } })).a != 7; }) ? function (O, P, Attributes) { var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P); if (ObjectPrototypeDescriptor) delete ObjectPrototype[P]; nativeDefineProperty(O, P, Attributes); if (ObjectPrototypeDescriptor && O !== ObjectPrototype) { nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor); } } : nativeDefineProperty; var wrap = function (tag, description) { var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype); setInternalState(symbol, { type: SYMBOL, tag: tag, description: description }); if (!DESCRIPTORS) symbol.description = description; return symbol; }; var $defineProperty = function defineProperty(O, P, Attributes) { if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes); anObject(O); var key = toPropertyKey(P); anObject(Attributes); if (hasOwn(AllSymbols, key)) { if (!Attributes.enumerable) { if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {})); O[HIDDEN][key] = true; } else { if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false; Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) }); } return setSymbolDescriptor(O, key, Attributes); } return nativeDefineProperty(O, key, Attributes); }; var $defineProperties = function defineProperties(O, Properties) { anObject(O); var properties = toIndexedObject(Properties); var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties)); $forEach(keys, function (key) { if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]); }); return O; }; var $create = function create(O, Properties) { return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties); }; var $propertyIsEnumerable = function propertyIsEnumerable(V) { var P = toPropertyKey(V); var enumerable = call(nativePropertyIsEnumerable, this, P); if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false; return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) { var it = toIndexedObject(O); var key = toPropertyKey(P); if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return; var descriptor = nativeGetOwnPropertyDescriptor(it, key); if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) { descriptor.enumerable = true; } return descriptor; }; var $getOwnPropertyNames = function getOwnPropertyNames(O) { var names = nativeGetOwnPropertyNames(toIndexedObject(O)); var result = []; $forEach(names, function (key) { if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key); }); return result; }; var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { var IS_OBJECT_PROTOTYPE = O === ObjectPrototype; var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O)); var result = []; $forEach(names, function (key) { if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) { push(result, AllSymbols[key]); } }); return result; }; // `Symbol` constructor // https://tc39.es/ecma262/#sec-symbol-constructor if (!NATIVE_SYMBOL) { $Symbol = function Symbol() { if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor'); var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]); var tag = uid(description); var setter = function (value) { if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value); if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false; setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value)); }; if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter }); return wrap(tag, description); }; SymbolPrototype = $Symbol[PROTOTYPE]; redefine(SymbolPrototype, 'toString', function toString() { return getInternalState(this).tag; }); redefine($Symbol, 'withoutSetter', function (description) { return wrap(uid(description), description); }); propertyIsEnumerableModule.f = $propertyIsEnumerable; definePropertyModule.f = $defineProperty; getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor; getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames; getOwnPropertySymbolsModule.f = $getOwnPropertySymbols; wrappedWellKnownSymbolModule.f = function (name) { return wrap(wellKnownSymbol(name), name); }; if (DESCRIPTORS) { // https://github.com/tc39/proposal-Symbol-description nativeDefineProperty(SymbolPrototype, 'description', { configurable: true, get: function description() { return getInternalState(this).description; } }); if (!IS_PURE) { redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true }); } } } $({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, { Symbol: $Symbol }); $forEach(objectKeys(WellKnownSymbolsStore), function (name) { defineWellKnownSymbol(name); }); $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, { // `Symbol.for` method // https://tc39.es/ecma262/#sec-symbol.for 'for': function (key) { var string = $toString(key); if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; var symbol = $Symbol(string); StringToSymbolRegistry[string] = symbol; SymbolToStringRegistry[symbol] = string; return symbol; }, // `Symbol.keyFor` method // https://tc39.es/ecma262/#sec-symbol.keyfor keyFor: function keyFor(sym) { if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol'); if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; }, useSetter: function () { USE_SETTER = true; }, useSimple: function () { USE_SETTER = false; } }); $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, { // `Object.create` method // https://tc39.es/ecma262/#sec-object.create create: $create, // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty defineProperty: $defineProperty, // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties defineProperties: $defineProperties, // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors getOwnPropertyDescriptor: $getOwnPropertyDescriptor }); $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, { // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames getOwnPropertyNames: $getOwnPropertyNames, // `Object.getOwnPropertySymbols` method // https://tc39.es/ecma262/#sec-object.getownpropertysymbols getOwnPropertySymbols: $getOwnPropertySymbols }); // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives // https://bugs.chromium.org/p/v8/issues/detail?id=3443 $({ target: 'Object', stat: true, forced: fails(function () { getOwnPropertySymbolsModule.f(1); }) }, { getOwnPropertySymbols: function getOwnPropertySymbols(it) { return getOwnPropertySymbolsModule.f(toObject(it)); } }); // `JSON.stringify` method behavior with symbols // https://tc39.es/ecma262/#sec-json.stringify if ($stringify) { var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () { var symbol = $Symbol(); // MS Edge converts symbol values to JSON as {} return $stringify([symbol]) != '[null]' // WebKit converts symbol values to JSON as null || $stringify({ a: symbol }) != '{}' // V8 throws on boxed symbols || $stringify(Object(symbol)) != '{}'; }); $({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, { // eslint-disable-next-line no-unused-vars -- required for `.length` stringify: function stringify(it, replacer, space) { var args = arraySlice(arguments); var $replacer = replacer; if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined if (!isArray(replacer)) replacer = function (key, value) { if (isCallable($replacer)) value = call($replacer, this, key, value); if (!isSymbol(value)) return value; }; args[1] = replacer; return apply($stringify, null, args); } }); } // `Symbol.prototype[@@toPrimitive]` method // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive if (!SymbolPrototype[TO_PRIMITIVE]) { var valueOf = SymbolPrototype.valueOf; // eslint-disable-next-line no-unused-vars -- required for .length redefine(SymbolPrototype, TO_PRIMITIVE, function (hint) { // TODO: improve hint logic return call(valueOf, this); }); } // `Symbol.prototype[@@toStringTag]` property // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag setToStringTag($Symbol, SYMBOL); hiddenKeys[HIDDEN] = true; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var charAt = __webpack_require__(146).charAt; var toString = __webpack_require__(40); var InternalStateModule = __webpack_require__(56); var defineIterator = __webpack_require__(111); var STRING_ITERATOR = 'String Iterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); // `String.prototype[@@iterator]` method // https://tc39.es/ecma262/#sec-string.prototype-@@iterator defineIterator(String, 'String', function (iterated) { setInternalState(this, { type: STRING_ITERATOR, string: toString(iterated), index: 0 }); // `%StringIteratorPrototype%.next` method // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next }, function next() { var state = getInternalState(this); var string = state.string; var index = state.index; var point; if (index >= string.length) return { value: undefined, done: true }; point = charAt(string, index); state.index += point.length; return { value: point, done: false }; }); /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {var check = function (it) { return it && it.Math == Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 module.exports = // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || // eslint-disable-next-line no-new-func -- fallback (function () { return this; })() || Function('return this')(); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(82))) /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // `Symbol.prototype.description` getter // https://tc39.es/ecma262/#sec-symbol.prototype.description var $ = __webpack_require__(16); var DESCRIPTORS = __webpack_require__(36); var global = __webpack_require__(7); var uncurryThis = __webpack_require__(15); var hasOwn = __webpack_require__(34); var isCallable = __webpack_require__(28); var isPrototypeOf = __webpack_require__(58); var toString = __webpack_require__(40); var defineProperty = __webpack_require__(37).f; var copyConstructorProperties = __webpack_require__(134); var NativeSymbol = global.Symbol; var SymbolPrototype = NativeSymbol && NativeSymbol.prototype; if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) || // Safari 12 bug NativeSymbol().description !== undefined )) { var EmptyStringDescriptionStore = {}; // wrap Symbol constructor for correct work with undefined description var SymbolWrapper = function Symbol() { var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]); var result = isPrototypeOf(SymbolPrototype, this) ? new NativeSymbol(description) // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)' : description === undefined ? NativeSymbol() : NativeSymbol(description); if (description === '') EmptyStringDescriptionStore[result] = true; return result; }; copyConstructorProperties(SymbolWrapper, NativeSymbol); SymbolWrapper.prototype = SymbolPrototype; SymbolPrototype.constructor = SymbolWrapper; var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)'; var symbolToString = uncurryThis(SymbolPrototype.toString); var symbolValueOf = uncurryThis(SymbolPrototype.valueOf); var regexp = /^Symbol\((.*)\)[^)]+$/; var replace = uncurryThis(''.replace); var stringSlice = uncurryThis(''.slice); defineProperty(SymbolPrototype, 'description', { configurable: true, get: function description() { var symbol = symbolValueOf(this); var string = symbolToString(symbol); if (hasOwn(EmptyStringDescriptionStore, symbol)) return ''; var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1'); return desc === '' ? undefined : desc; } }); $({ global: true, forced: true }, { Symbol: SymbolWrapper }); } /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(150); // `Symbol.iterator` well-known symbol // https://tc39.es/ecma262/#sec-symbol.iterator defineWellKnownSymbol('iterator'); /***/ }), /* 10 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ preact_module["a" /* Component */]; }); __webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ preact_module["e" /* createElement */]; }); __webpack_require__.d(__webpack_exports__, "h", function() { return /* reexport */ A; }); __webpack_require__.d(__webpack_exports__, "i", function() { return /* reexport */ y; }); __webpack_require__.d(__webpack_exports__, "j", function() { return /* reexport */ hooks_module_l; }); __webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ E; }); __webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ compat_module_x; }); __webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ compat_module_g; }); __webpack_require__.d(__webpack_exports__, "g", function() { return /* binding */ fn; }); // UNUSED EXPORTS: Fragment, createContext, createRef, useContext, useDebugValue, useErrorBoundary, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, Children, StrictMode, Suspense, SuspenseList, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createFactory, createPortal, findDOMNode, flushSync, hydrate, isValidElement, lazy, render, unmountComponentAtNode, version // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/preact/dist/preact.module.js var preact_module = __webpack_require__(1); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/preact/hooks/dist/hooks.module.js var hooks_module_t,hooks_module_u,hooks_module_r,hooks_module_o=0,hooks_module_i=[],c=preact_module["i" /* options */].__b,f=preact_module["i" /* options */].__r,hooks_module_e=preact_module["i" /* options */].diffed,a=preact_module["i" /* options */].__c,v=preact_module["i" /* options */].unmount;function m(t,r){preact_module["i" /* options */].__h&&preact_module["i" /* options */].__h(hooks_module_u,t,hooks_module_o||r),hooks_module_o=0;var i=hooks_module_u.__H||(hooks_module_u.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function hooks_module_l(n){return hooks_module_o=1,p(z,n)}function p(n,r,o){var i=m(hooks_module_t++,2);return i.t=n,i.__c||(i.__=[o?o(r):z(void 0,r),function(n){var t=i.t(i.__[0],n);i.__[0]!==t&&(i.__=[t,i.__[1]],i.__c.setState({}))}],i.__c=hooks_module_u),i.__}function y(r,o){var i=m(hooks_module_t++,3);!preact_module["i" /* options */].__s&&w(i.__H,o)&&(i.__=r,i.__H=o,hooks_module_u.__H.__h.push(i))}function h(r,o){var i=m(hooks_module_t++,4);!preact_module["i" /* options */].__s&&w(i.__H,o)&&(i.__=r,i.__H=o,hooks_module_u.__h.push(i))}function s(n){return hooks_module_o=5,d(function(){return{current:n}},[])}function _(n,t,u){hooks_module_o=6,h(function(){"function"==typeof n?n(t()):n&&(n.current=t())},null==u?u:u.concat(n))}function d(n,u){var r=m(hooks_module_t++,7);return w(r.__H,u)&&(r.__=n(),r.__H=u,r.__h=n),r.__}function A(n,t){return hooks_module_o=8,d(function(){return n},t)}function F(n){var r=hooks_module_u.context[n.__c],o=m(hooks_module_t++,9);return o.c=n,r?(null==o.__&&(o.__=!0,r.sub(hooks_module_u)),r.props.value):n.__}function T(t,u){preact_module["i" /* options */].useDebugValue&&preact_module["i" /* options */].useDebugValue(u?u(t):t)}function q(n){var r=m(hooks_module_t++,10),o=hooks_module_l();return r.__=n,hooks_module_u.componentDidCatch||(hooks_module_u.componentDidCatch=function(n){r.__&&r.__(n),o[1](n)}),[o[0],function(){o[1](void 0)}]}function x(){var t;for(hooks_module_i.sort(function(n,t){return n.__v.__b-t.__v.__b});t=hooks_module_i.pop();)if(t.__P)try{t.__H.__h.forEach(j),t.__H.__h.forEach(k),t.__H.__h=[]}catch(u){t.__H.__h=[],preact_module["i" /* options */].__e(u,t.__v)}}preact_module["i" /* options */].__b=function(n){hooks_module_u=null,c&&c(n)},preact_module["i" /* options */].__r=function(n){f&&f(n),hooks_module_t=0;var r=(hooks_module_u=n.__c).__H;r&&(r.__h.forEach(j),r.__h.forEach(k),r.__h=[])},preact_module["i" /* options */].diffed=function(t){hooks_module_e&&hooks_module_e(t);var o=t.__c;o&&o.__H&&o.__H.__h.length&&(1!==hooks_module_i.push(o)&&hooks_module_r===preact_module["i" /* options */].requestAnimationFrame||((hooks_module_r=preact_module["i" /* options */].requestAnimationFrame)||g)(x)),hooks_module_u=null},preact_module["i" /* options */].__c=function(t,u){u.some(function(t){try{t.__h.forEach(j),t.__h=t.__h.filter(function(n){return!n.__||k(n)})}catch(r){u.some(function(n){n.__h&&(n.__h=[])}),u=[],preact_module["i" /* options */].__e(r,t.__v)}}),a&&a(t,u)},preact_module["i" /* options */].unmount=function(t){v&&v(t);var u,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{j(n)}catch(n){u=n}}),u&&preact_module["i" /* options */].__e(u,r.__v))};var b="function"==typeof requestAnimationFrame;function g(n){var t,u=function(){clearTimeout(r),b&&cancelAnimationFrame(t),setTimeout(n)},r=setTimeout(u,100);b&&(t=requestAnimationFrame(u))}function j(n){var t=hooks_module_u,r=n.__c;"function"==typeof r&&(n.__c=void 0,r()),hooks_module_u=t}function k(n){var t=hooks_module_u;n.__c=n.__(),hooks_module_u=t}function w(n,t){return!n||n.length!==t.length||t.some(function(t,u){return t!==n[u]})}function z(n,t){return"function"==typeof t?t(n):t} //# sourceMappingURL=hooks.module.js.map // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/preact/compat/dist/compat.module.js function S(n,t){for(var e in t)n[e]=t[e];return n}function C(n,t){for(var e in n)if("__source"!==e&&!(e in t))return!0;for(var r in t)if("__source"!==r&&n[r]!==t[r])return!0;return!1}function E(n){this.props=n}function compat_module_g(n,e){function r(n){var t=this.props.ref,r=t==n.ref;return!r&&t&&(t.call?t(null):t.current=null),e?!e(this.props,n)||!r:C(this.props,n)}function u(e){return this.shouldComponentUpdate=r,Object(preact_module["e" /* createElement */])(n,e)}return u.displayName="Memo("+(n.displayName||n.name)+")",u.prototype.isReactComponent=!0,u.__f=!0,u}(E.prototype=new preact_module["a" /* Component */]).isPureReactComponent=!0,E.prototype.shouldComponentUpdate=function(n,t){return C(this.props,n)||C(this.state,t)};var compat_module_w=preact_module["i" /* options */].__b;preact_module["i" /* options */].__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),compat_module_w&&compat_module_w(n)};var R="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function compat_module_x(n){function t(t,e){var r=S({},t);return delete r.ref,n(r,!(e=t.ref||e)||"object"==typeof e&&!("current"in e)?null:e)}return t.$$typeof=R,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(n.displayName||n.name)+")",t}var N=function(n,t){return null==n?null:Object(preact_module["k" /* toChildArray */])(Object(preact_module["k" /* toChildArray */])(n).map(t))},compat_module_k={map:N,forEach:N,count:function(n){return n?Object(preact_module["k" /* toChildArray */])(n).length:0},only:function(n){var t=Object(preact_module["k" /* toChildArray */])(n);if(1!==t.length)throw"Children.only";return t[0]},toArray:preact_module["k" /* toChildArray */]},compat_module_A=preact_module["i" /* options */].__e;preact_module["i" /* options */].__e=function(n,t,e){if(n.then)for(var r,u=t;u=u.__;)if((r=u.__c)&&r.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k),r.__c(n,t);compat_module_A(n,t,e)};var O=preact_module["i" /* options */].unmount;function L(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c()}),n.__c.__H=null),null!=(n=S({},n)).__c&&(n.__c.__P===e&&(n.__c.__P=t),n.__c=null),n.__k=n.__k&&n.__k.map(function(n){return L(n,t,e)})),n}function U(n,t,e){return n&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(n){return U(n,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.insertBefore(n.__e,n.__d),n.__c.__e=!0,n.__c.__P=e)),n}function compat_module_F(){this.__u=0,this.t=null,this.__b=null}function M(n){var t=n.__.__c;return t&&t.__e&&t.__e(n)}function compat_module_T(n){var e,r,u;function o(o){if(e||(e=n()).then(function(n){r=n.default||n},function(n){u=n}),u)throw u;if(!r)throw e;return Object(preact_module["e" /* createElement */])(r,o)}return o.displayName="Lazy",o.__f=!0,o}function D(){this.u=null,this.o=null}preact_module["i" /* options */].unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&!0===n.__h&&(n.type=null),O&&O(n)},(compat_module_F.prototype=new preact_module["a" /* Component */]).__c=function(n,t){var e=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(e);var u=M(r.__v),o=!1,i=function(){o||(o=!0,e.__R=null,u?u(l):l())};e.__R=i;var l=function(){if(!--r.__u){if(r.state.__e){var n=r.state.__e;r.__v.__k[0]=U(n,n.__c.__P,n.__c.__O)}var t;for(r.setState({__e:r.__b=null});t=r.t.pop();)t.forceUpdate()}},c=!0===t.__h;r.__u++||c||r.setState({__e:r.__b=r.__v.__k[0]}),n.then(i,i)},compat_module_F.prototype.componentWillUnmount=function(){this.t=[]},compat_module_F.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=L(this.__b,r,o.__O=o.__P)}this.__b=null}var i=e.__e&&Object(preact_module["e" /* createElement */])(preact_module["b" /* Fragment */],null,n.fallback);return i&&(i.__h=null),[Object(preact_module["e" /* createElement */])(preact_module["b" /* Fragment */],null,e.__e?null:n.children),i]};var I=function(n,t,e){if(++e[1]===e[0]&&n.o.delete(t),n.props.revealOrder&&("t"!==n.props.revealOrder[0]||!n.o.size))for(e=n.u;e;){for(;e.length>3;)e.pop()();if(e[1]>>1,1),e.i.removeChild(n)}}),Object(preact_module["j" /* render */])(Object(preact_module["e" /* createElement */])(W,{context:e.context},n.__v),e.l)):e.l&&e.componentWillUnmount()}function P(n,e){return Object(preact_module["e" /* createElement */])(compat_module_j,{__v:n,i:e})}(D.prototype=new preact_module["a" /* Component */]).__e=function(n){var t=this,e=M(t.__v),r=t.o.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),I(t,n,r)):u()};e?e(o):o()}},D.prototype.render=function(n){this.u=null,this.o=new Map;var t=Object(preact_module["k" /* toChildArray */])(n.children);n.revealOrder&&"b"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.o.set(t[e],this.u=[1,0,this.u]);return n.children},D.prototype.componentDidUpdate=D.prototype.componentDidMount=function(){var n=this;this.o.forEach(function(t,e){I(n,e,t)})};var V="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,compat_module_z=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,B="undefined"!=typeof document,$=function(n){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(n)};function H(n,t,e){return null==t.__k&&(t.textContent=""),Object(preact_module["j" /* render */])(n,t),"function"==typeof e&&e(),n?n.__c:null}function Z(n,t,e){return Object(preact_module["h" /* hydrate */])(n,t),"function"==typeof e&&e(),n?n.__c:null}preact_module["a" /* Component */].prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(preact_module["a" /* Component */].prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})});var Y=preact_module["i" /* options */].event;function compat_module_q(){}function G(){return this.cancelBubble}function J(){return this.defaultPrevented}preact_module["i" /* options */].event=function(n){return Y&&(n=Y(n)),n.persist=compat_module_q,n.isPropagationStopped=G,n.isDefaultPrevented=J,n.nativeEvent=n};var K,Q={configurable:!0,get:function(){return this.class}},X=preact_module["i" /* options */].vnode;preact_module["i" /* options */].vnode=function(n){var t=n.type,e=n.props,u=e;if("string"==typeof t){var o=-1===t.indexOf("-");for(var i in u={},e){var l=e[i];B&&"children"===i&&"noscript"===t||"value"===i&&"defaultValue"in e&&null==l||("defaultValue"===i&&"value"in e&&null==e.value?i="value":"download"===i&&!0===l?l="":/ondoubleclick/i.test(i)?i="ondblclick":/^onchange(textarea|input)/i.test(i+t)&&!$(e.type)?i="oninput":/^onfocus$/i.test(i)?i="onfocusin":/^onblur$/i.test(i)?i="onfocusout":/^on(Ani|Tra|Tou|BeforeInp)/.test(i)?i=i.toLowerCase():o&&compat_module_z.test(i)?i=i.replace(/[A-Z0-9]/,"-$&").toLowerCase():null===l&&(l=void 0),u[i]=l)}"select"==t&&u.multiple&&Array.isArray(u.value)&&(u.value=Object(preact_module["k" /* toChildArray */])(e.children).forEach(function(n){n.props.selected=-1!=u.value.indexOf(n.props.value)})),"select"==t&&null!=u.defaultValue&&(u.value=Object(preact_module["k" /* toChildArray */])(e.children).forEach(function(n){n.props.selected=u.multiple?-1!=u.defaultValue.indexOf(n.props.value):u.defaultValue==n.props.value})),n.props=u,e.class!=e.className&&(Q.enumerable="className"in e,null!=e.className&&(u.class=e.className),Object.defineProperty(u,"className",Q))}n.$$typeof=V,X&&X(n)};var nn=preact_module["i" /* options */].__r;preact_module["i" /* options */].__r=function(n){nn&&nn(n),K=n.__c};var tn={ReactCurrentDispatcher:{current:{readContext:function(n){return K.__n[n.__c].props.value}}}},en="17.0.2";function rn(n){return preact_module["e" /* createElement */].bind(null,n)}function un(n){return!!n&&n.$$typeof===V}function on(n){return un(n)?preact_module["c" /* cloneElement */].apply(null,arguments):n}function ln(n){return!!n.__k&&(Object(preact_module["j" /* render */])(null,n),!0)}function cn(n){return n&&(n.base||1===n.nodeType&&n)||null}var fn=function(n,t){return n(t)},an=function(n,t){return n(t)},sn=preact_module["b" /* Fragment */],hn={useState:hooks_module_l,useReducer:p,useEffect:y,useLayoutEffect:h,useRef:s,useImperativeHandle:_,useMemo:d,useCallback:A,useContext:F,useDebugValue:T,version:"17.0.2",Children:compat_module_k,render:H,hydrate:Z,unmountComponentAtNode:ln,createPortal:P,createElement:preact_module["e" /* createElement */],createContext:preact_module["d" /* createContext */],createFactory:rn,cloneElement:on,createRef:preact_module["f" /* createRef */],Fragment:preact_module["b" /* Fragment */],isValidElement:un,findDOMNode:cn,Component:preact_module["a" /* Component */],PureComponent:E,memo:compat_module_g,forwardRef:compat_module_x,flushSync:an,unstable_batchedUpdates:fn,StrictMode:sn,Suspense:compat_module_F,SuspenseList:D,lazy:compat_module_T,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:tn};/* harmony default export */ var compat_module = __webpack_exports__["d"] = (hn); //# sourceMappingURL=compat.module.js.map /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var DOMIterables = __webpack_require__(147); var DOMTokenListPrototype = __webpack_require__(148); var forEach = __webpack_require__(179); var createNonEnumerableProperty = __webpack_require__(57); var handlePrototype = function (CollectionPrototype) { // some Chrome versions have non-configurable methods on DOMTokenList if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try { createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach); } catch (error) { CollectionPrototype.forEach = forEach; } }; for (var COLLECTION_NAME in DOMIterables) { if (DOMIterables[COLLECTION_NAME]) { handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype); } } handlePrototype(DOMTokenListPrototype); /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); var setPrototypeOf = __webpack_require__(97); // `Object.setPrototypeOf` method // https://tc39.es/ecma262/#sec-object.setprototypeof $({ target: 'Object', stat: true }, { setPrototypeOf: setPrototypeOf }); /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); var fails = __webpack_require__(18); var toObject = __webpack_require__(38); var nativeGetPrototypeOf = __webpack_require__(96); var CORRECT_PROTOTYPE_GETTER = __webpack_require__(137); var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); }); // `Object.getPrototypeOf` method // https://tc39.es/ecma262/#sec-object.getprototypeof $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, { getPrototypeOf: function getPrototypeOf(it) { return nativeGetPrototypeOf(toObject(it)); } }); /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); var getBuiltIn = __webpack_require__(46); var apply = __webpack_require__(77); var bind = __webpack_require__(199); var aConstructor = __webpack_require__(157); var anObject = __webpack_require__(32); var isObject = __webpack_require__(33); var create = __webpack_require__(54); var fails = __webpack_require__(18); var nativeConstruct = getBuiltIn('Reflect', 'construct'); var ObjectPrototype = Object.prototype; var push = [].push; // `Reflect.construct` method // https://tc39.es/ecma262/#sec-reflect.construct // MS Edge supports only 2 arguments and argumentsList argument is optional // FF Nightly sets third argument as `new.target`, but does not create `this` from it var NEW_TARGET_BUG = fails(function () { function F() { /* empty */ } return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F); }); var ARGS_BUG = !fails(function () { nativeConstruct(function () { /* empty */ }); }); var FORCED = NEW_TARGET_BUG || ARGS_BUG; $({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, { construct: function construct(Target, args /* , newTarget */) { aConstructor(Target); anObject(args); var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]); if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget); if (Target == newTarget) { // w/o altered newTarget, optimization for 0-4 arguments switch (args.length) { case 0: return new Target(); case 1: return new Target(args[0]); case 2: return new Target(args[0], args[1]); case 3: return new Target(args[0], args[1], args[2]); case 4: return new Target(args[0], args[1], args[2], args[3]); } // w/o altered newTarget, lot of arguments case var $args = [null]; apply(push, $args, args); return new (apply(bind, Target, $args))(); } // with altered newTarget, not support built-in constructors var proto = newTarget.prototype; var instance = create(isObject(proto) ? proto : ObjectPrototype); var result = apply(Target, instance, args); return isObject(result) ? result : instance; } }); /***/ }), /* 15 */ /***/ (function(module, exports) { var FunctionPrototype = Function.prototype; var bind = FunctionPrototype.bind; var call = FunctionPrototype.call; var callBind = bind && bind.bind(call); module.exports = bind ? function (fn) { return fn && callBind(call, fn); } : function (fn) { return fn && function () { return call.apply(fn, arguments); }; }; /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var getOwnPropertyDescriptor = __webpack_require__(51).f; var createNonEnumerableProperty = __webpack_require__(57); var redefine = __webpack_require__(44); var setGlobal = __webpack_require__(108); var copyConstructorProperties = __webpack_require__(134); var isForced = __webpack_require__(95); /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.noTargetGet - prevent calling a getter on target options.name - the .name of the function if it does not match the key */ module.exports = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var FORCED, target, key, targetProperty, sourceProperty, descriptor; if (GLOBAL) { target = global; } else if (STATIC) { target = global[TARGET] || setGlobal(TARGET, {}); } else { target = (global[TARGET] || {}).prototype; } if (target) for (key in source) { sourceProperty = source[key]; if (options.noTargetGet) { descriptor = getOwnPropertyDescriptor(target, key); targetProperty = descriptor && descriptor.value; } else targetProperty = target[key]; FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target if (!FORCED && targetProperty !== undefined) { if (typeof sourceProperty == typeof targetProperty) continue; copyConstructorProperties(sourceProperty, targetProperty); } // add a flag to not completely full polyfills if (options.sham || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty(sourceProperty, 'sham', true); } // extend global redefine(target, key, sourceProperty, options); } }; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var global = __webpack_require__(7); var isArray = __webpack_require__(99); var isConstructor = __webpack_require__(100); var isObject = __webpack_require__(33); var toAbsoluteIndex = __webpack_require__(68); var lengthOfArrayLike = __webpack_require__(43); var toIndexedObject = __webpack_require__(39); var createProperty = __webpack_require__(61); var wellKnownSymbol = __webpack_require__(27); var arrayMethodHasSpeciesSupport = __webpack_require__(76); var un$Slice = __webpack_require__(101); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice'); var SPECIES = wellKnownSymbol('species'); var Array = global.Array; var max = Math.max; // `Array.prototype.slice` method // https://tc39.es/ecma262/#sec-array.prototype.slice // fallback for not array-like ES3 strings and DOM objects $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { slice: function slice(start, end) { var O = toIndexedObject(this); var length = lengthOfArrayLike(O); var k = toAbsoluteIndex(start, length); var fin = toAbsoluteIndex(end === undefined ? length : end, length); // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible var Constructor, result, n; if (isArray(O)) { Constructor = O.constructor; // cross-realm fallback if (isConstructor(Constructor) && (Constructor === Array || isArray(Constructor.prototype))) { Constructor = undefined; } else if (isObject(Constructor)) { Constructor = Constructor[SPECIES]; if (Constructor === null) Constructor = undefined; } if (Constructor === Array || Constructor === undefined) { return un$Slice(O, k, fin); } } result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0)); for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]); result.length = n; return result; } }); /***/ }), /* 18 */ /***/ (function(module, exports) { module.exports = function (exec) { try { return !!exec(); } catch (error) { return true; } }; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var exec = __webpack_require__(102); // `RegExp.prototype.exec` method // https://tc39.es/ecma262/#sec-regexp.prototype.exec $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, { exec: exec }); /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); var toObject = __webpack_require__(38); var nativeKeys = __webpack_require__(67); var fails = __webpack_require__(18); var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); }); // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { keys: function keys(it) { return nativeKeys(toObject(it)); } }); /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); var fails = __webpack_require__(18); var toIndexedObject = __webpack_require__(39); var nativeGetOwnPropertyDescriptor = __webpack_require__(51).f; var DESCRIPTORS = __webpack_require__(36); var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); }); var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor $({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, { getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key); } }); /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var $filter = __webpack_require__(75).filter; var arrayMethodHasSpeciesSupport = __webpack_require__(76); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter'); // `Array.prototype.filter` method // https://tc39.es/ecma262/#sec-array.prototype.filter // with adding support of @@species $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { filter: function filter(callbackfn /* , thisArg */) { return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(36); var FUNCTION_NAME_EXISTS = __webpack_require__(94).EXISTS; var uncurryThis = __webpack_require__(15); var defineProperty = __webpack_require__(37).f; var FunctionPrototype = Function.prototype; var functionToString = uncurryThis(FunctionPrototype.toString); var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/; var regExpExec = uncurryThis(nameRE.exec); var NAME = 'name'; // Function instances `.name` property // https://tc39.es/ecma262/#sec-function-instances-name if (DESCRIPTORS && !FUNCTION_NAME_EXISTS) { defineProperty(FunctionPrototype, NAME, { configurable: true, get: function () { try { return regExpExec(nameRE, functionToString(this))[1]; } catch (error) { return ''; } } }); } /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); var DESCRIPTORS = __webpack_require__(36); var ownKeys = __webpack_require__(135); var toIndexedObject = __webpack_require__(39); var getOwnPropertyDescriptorModule = __webpack_require__(51); var createProperty = __webpack_require__(61); // `Object.getOwnPropertyDescriptors` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, { getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { var O = toIndexedObject(object); var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var keys = ownKeys(O); var result = {}; var index = 0; var key, descriptor; while (keys.length > index) { descriptor = getOwnPropertyDescriptor(O, key = keys[index++]); if (descriptor !== undefined) createProperty(result, key, descriptor); } return result; } }); /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); var from = __webpack_require__(182); var checkCorrectnessOfIteration = __webpack_require__(118); var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) { // eslint-disable-next-line es/no-array-from -- required for testing Array.from(iterable); }); // `Array.from` method // https://tc39.es/ecma262/#sec-array.from $({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, { from: from }); /***/ }), /* 26 */, /* 27 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var shared = __webpack_require__(84); var hasOwn = __webpack_require__(34); var uid = __webpack_require__(85); var NATIVE_SYMBOL = __webpack_require__(109); var USE_SYMBOL_AS_UID = __webpack_require__(128); var WellKnownSymbolsStore = shared('wks'); var Symbol = global.Symbol; var symbolFor = Symbol && Symbol['for']; var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid; module.exports = function (name) { if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) { var description = 'Symbol.' + name; if (NATIVE_SYMBOL && hasOwn(Symbol, name)) { WellKnownSymbolsStore[name] = Symbol[name]; } else if (USE_SYMBOL_AS_UID && symbolFor) { WellKnownSymbolsStore[name] = symbolFor(description); } else { WellKnownSymbolsStore[name] = createWellKnownSymbol(description); } } return WellKnownSymbolsStore[name]; }; /***/ }), /* 28 */ /***/ (function(module, exports) { // `IsCallable` abstract operation // https://tc39.es/ecma262/#sec-iscallable module.exports = function (argument) { return typeof argument == 'function'; }; /***/ }), /* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var global = __webpack_require__(7); var fails = __webpack_require__(18); var isArray = __webpack_require__(99); var isObject = __webpack_require__(33); var toObject = __webpack_require__(38); var lengthOfArrayLike = __webpack_require__(43); var createProperty = __webpack_require__(61); var arraySpeciesCreate = __webpack_require__(119); var arrayMethodHasSpeciesSupport = __webpack_require__(76); var wellKnownSymbol = __webpack_require__(27); var V8_VERSION = __webpack_require__(66); var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; var TypeError = global.TypeError; // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation // https://github.com/zloirock/core-js/issues/679 var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () { var array = []; array[IS_CONCAT_SPREADABLE] = false; return array.concat()[0] !== array; }); var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat'); var isConcatSpreadable = function (O) { if (!isObject(O)) return false; var spreadable = O[IS_CONCAT_SPREADABLE]; return spreadable !== undefined ? !!spreadable : isArray(O); }; var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; // `Array.prototype.concat` method // https://tc39.es/ecma262/#sec-array.prototype.concat // with adding support of @@isConcatSpreadable and @@species $({ target: 'Array', proto: true, forced: FORCED }, { // eslint-disable-next-line no-unused-vars -- required for `.length` concat: function concat(arg) { var O = toObject(this); var A = arraySpeciesCreate(O, 0); var n = 0; var i, k, length, len, E; for (i = -1, length = arguments.length; i < length; i++) { E = i === -1 ? O : arguments[i]; if (isConcatSpreadable(E)) { len = lengthOfArrayLike(E); if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]); } else { if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); createProperty(A, n++, E); } } A.length = n; return A; } }); /***/ }), /* 30 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); var assign = __webpack_require__(198); // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign // eslint-disable-next-line es/no-object-assign -- required for testing $({ target: 'Object', stat: true, forced: Object.assign !== assign }, { assign: assign }); /***/ }), /* 31 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _freeGlobal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(105); /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = _freeGlobal_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"] || freeSelf || Function('return this')(); /* harmony default export */ __webpack_exports__["a"] = (root); /***/ }), /* 32 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var isObject = __webpack_require__(33); var String = global.String; var TypeError = global.TypeError; // `Assert: Type(argument) is Object` module.exports = function (argument) { if (isObject(argument)) return argument; throw TypeError(String(argument) + ' is not an object'); }; /***/ }), /* 33 */ /***/ (function(module, exports, __webpack_require__) { var isCallable = __webpack_require__(28); module.exports = function (it) { return typeof it == 'object' ? it !== null : isCallable(it); }; /***/ }), /* 34 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); var toObject = __webpack_require__(38); var hasOwnProperty = uncurryThis({}.hasOwnProperty); // `HasOwnProperty` abstract operation // https://tc39.es/ecma262/#sec-hasownproperty module.exports = Object.hasOwn || function hasOwn(it, key) { return hasOwnProperty(toObject(it), key); }; /***/ }), /* 35 */ /***/ (function(module, exports) { var call = Function.prototype.call; module.exports = call.bind ? call.bind(call) : function () { return call.apply(call, arguments); }; /***/ }), /* 36 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(18); // Detect IE8's incomplete defineProperty implementation module.exports = !fails(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); /***/ }), /* 37 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var DESCRIPTORS = __webpack_require__(36); var IE8_DOM_DEFINE = __webpack_require__(129); var anObject = __webpack_require__(32); var toPropertyKey = __webpack_require__(87); var TypeError = global.TypeError; // eslint-disable-next-line es/no-object-defineproperty -- safe var $defineProperty = Object.defineProperty; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty exports.f = DESCRIPTORS ? $defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPropertyKey(P); anObject(Attributes); if (IE8_DOM_DEFINE) try { return $defineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; /***/ }), /* 38 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var requireObjectCoercible = __webpack_require__(45); var Object = global.Object; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject module.exports = function (argument) { return Object(requireObjectCoercible(argument)); }; /***/ }), /* 39 */ /***/ (function(module, exports, __webpack_require__) { // toObject with fallback for non-array-like ES3 strings var IndexedObject = __webpack_require__(81); var requireObjectCoercible = __webpack_require__(45); module.exports = function (it) { return IndexedObject(requireObjectCoercible(it)); }; /***/ }), /* 40 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var classof = __webpack_require__(98); var String = global.String; module.exports = function (argument) { if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string'); return String(argument); }; /***/ }), /* 41 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var $map = __webpack_require__(75).map; var arrayMethodHasSpeciesSupport = __webpack_require__(76); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map'); // `Array.prototype.map` method // https://tc39.es/ecma262/#sec-array.prototype.map // with adding support of @@species $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { map: function map(callbackfn /* , thisArg */) { return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); /***/ }), /* 42 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/* unused harmony export useUnmount */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return useForceUpdate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isPlainObject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getSymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getGlobal; }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10); var __read = (undefined && undefined.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var EMPTY_ARRAY = []; function useUnmount(fn) { Object(react__WEBPACK_IMPORTED_MODULE_0__[/* useEffect */ "i"])(function () { return fn; }, EMPTY_ARRAY); } function useForceUpdate() { var _a = __read(Object(react__WEBPACK_IMPORTED_MODULE_0__[/* useState */ "j"])(0), 2), setTick = _a[1]; var update = Object(react__WEBPACK_IMPORTED_MODULE_0__[/* useCallback */ "h"])(function () { setTick(function (tick) { return tick + 1; }); }, []); return update; } function isPlainObject(value) { if (!value || typeof value !== "object") { return false; } var proto = Object.getPrototypeOf(value); return !proto || proto === Object.prototype; } function getSymbol(name) { if (typeof Symbol === "function") { return Symbol.for(name); } return "__$mobx-react " + name + "__"; } var mockGlobal = {}; function getGlobal() { if (typeof window !== "undefined") { return window; } if (typeof global !== "undefined") { return global; } if (typeof self !== "undefined") { return self; } return mockGlobal; } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(82))) /***/ }), /* 43 */ /***/ (function(module, exports, __webpack_require__) { var toLength = __webpack_require__(90); // `LengthOfArrayLike` abstract operation // https://tc39.es/ecma262/#sec-lengthofarraylike module.exports = function (obj) { return toLength(obj.length); }; /***/ }), /* 44 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var isCallable = __webpack_require__(28); var hasOwn = __webpack_require__(34); var createNonEnumerableProperty = __webpack_require__(57); var setGlobal = __webpack_require__(108); var inspectSource = __webpack_require__(92); var InternalStateModule = __webpack_require__(56); var CONFIGURABLE_FUNCTION_NAME = __webpack_require__(94).CONFIGURABLE; var getInternalState = InternalStateModule.get; var enforceInternalState = InternalStateModule.enforce; var TEMPLATE = String(String).split('String'); (module.exports = function (O, key, value, options) { var unsafe = options ? !!options.unsafe : false; var simple = options ? !!options.enumerable : false; var noTargetGet = options ? !!options.noTargetGet : false; var name = options && options.name !== undefined ? options.name : key; var state; if (isCallable(value)) { if (String(name).slice(0, 7) === 'Symbol(') { name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']'; } if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) { createNonEnumerableProperty(value, 'name', name); } state = enforceInternalState(value); if (!state.source) { state.source = TEMPLATE.join(typeof name == 'string' ? name : ''); } } if (O === global) { if (simple) O[key] = value; else setGlobal(key, value); return; } else if (!unsafe) { delete O[key]; } else if (!noTargetGet && O[key]) { simple = true; } if (simple) O[key] = value; else createNonEnumerableProperty(O, key, value); // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, 'toString', function toString() { return isCallable(this) && getInternalState(this).source || inspectSource(this); }); /***/ }), /* 45 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var TypeError = global.TypeError; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible module.exports = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; /***/ }), /* 46 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var isCallable = __webpack_require__(28); var aFunction = function (argument) { return isCallable(argument) ? argument : undefined; }; module.exports = function (namespace, method) { return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method]; }; /***/ }), /* 47 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); var call = __webpack_require__(35); var isObject = __webpack_require__(33); var anObject = __webpack_require__(32); var isDataDescriptor = __webpack_require__(200); var getOwnPropertyDescriptorModule = __webpack_require__(51); var getPrototypeOf = __webpack_require__(96); // `Reflect.get` method // https://tc39.es/ecma262/#sec-reflect.get function get(target, propertyKey /* , receiver */) { var receiver = arguments.length < 3 ? target : arguments[2]; var descriptor, prototype; if (anObject(target) === receiver) return target[propertyKey]; descriptor = getOwnPropertyDescriptorModule.f(target, propertyKey); if (descriptor) return isDataDescriptor(descriptor) ? descriptor.value : descriptor.get === undefined ? undefined : call(descriptor.get, receiver); if (isObject(prototype = getPrototypeOf(target))) return get(prototype, propertyKey, receiver); } $({ target: 'Reflect', stat: true }, { get: get }); /***/ }), /* 48 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(module) {/* harmony import */ var _root_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31); /* harmony import */ var _stubFalse_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(165); /** Detect free variable `exports`. */ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Built-in value references. */ var Buffer = moduleExports ? _root_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].Buffer : undefined; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; /** * Checks if `value` is a buffer. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * * _.isBuffer(new Buffer(2)); * // => true * * _.isBuffer(new Uint8Array(2)); * // => false */ var isBuffer = nativeIsBuffer || _stubFalse_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]; /* harmony default export */ __webpack_exports__["a"] = (isBuffer); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(121)(module))) /***/ }), /* 49 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(module) {/* harmony import */ var _freeGlobal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(105); /** Detect free variable `exports`. */ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && _freeGlobal_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].process; /** Used to access faster Node.js helpers. */ var nodeUtil = (function() { try { // Use `util.types` for Node.js 10+. var types = freeModule && freeModule.require && freeModule.require('util').types; if (types) { return types; } // Legacy `process.binding('util')` for Node.js < 10. return freeProcess && freeProcess.binding && freeProcess.binding('util'); } catch (e) {} }()); /* harmony default export */ __webpack_exports__["a"] = (nodeUtil); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(121)(module))) /***/ }), /* 50 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); var toString = uncurryThis({}.toString); var stringSlice = uncurryThis(''.slice); module.exports = function (it) { return stringSlice(toString(it), 8, -1); }; /***/ }), /* 51 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(36); var call = __webpack_require__(35); var propertyIsEnumerableModule = __webpack_require__(93); var createPropertyDescriptor = __webpack_require__(72); var toIndexedObject = __webpack_require__(39); var toPropertyKey = __webpack_require__(87); var hasOwn = __webpack_require__(34); var IE8_DOM_DEFINE = __webpack_require__(129); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPropertyKey(P); if (IE8_DOM_DEFINE) try { return $getOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]); }; /***/ }), /* 52 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); var $entries = __webpack_require__(213).entries; // `Object.entries` method // https://tc39.es/ecma262/#sec-object.entries $({ target: 'Object', stat: true }, { entries: function entries(O) { return $entries(O); } }); /***/ }), /* 53 */ /***/ (function(module, exports, __webpack_require__) { var getBuiltIn = __webpack_require__(46); module.exports = getBuiltIn('navigator', 'userAgent') || ''; /***/ }), /* 54 */ /***/ (function(module, exports, __webpack_require__) { /* global ActiveXObject -- old IE, WSH */ var anObject = __webpack_require__(32); var defineProperties = __webpack_require__(168); var enumBugKeys = __webpack_require__(110); var hiddenKeys = __webpack_require__(70); var html = __webpack_require__(133); var documentCreateElement = __webpack_require__(86); var sharedKey = __webpack_require__(91); var GT = '>'; var LT = '<'; var PROTOTYPE = 'prototype'; var SCRIPT = 'script'; var IE_PROTO = sharedKey('IE_PROTO'); var EmptyConstructor = function () { /* empty */ }; var scriptTag = function (content) { return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; }; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype var NullProtoObjectViaActiveX = function (activeXDocument) { activeXDocument.write(scriptTag('')); activeXDocument.close(); var temp = activeXDocument.parentWindow.Object; activeXDocument = null; // avoid memory leak return temp; }; // Create object with fake `null` prototype: use iframe Object with cleared prototype var NullProtoObjectViaIFrame = function () { // Thrash, waste and sodomy: IE GC bug var iframe = documentCreateElement('iframe'); var JS = 'java' + SCRIPT + ':'; var iframeDocument; iframe.style.display = 'none'; html.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475 iframe.src = String(JS); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(scriptTag('document.F=Object')); iframeDocument.close(); return iframeDocument.F; }; // Check for document.domain and active x support // No need to use active x approach when document.domain is not set // see https://github.com/es-shims/es5-shim/issues/150 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 // avoid IE GC bug var activeXDocument; var NullProtoObject = function () { try { activeXDocument = new ActiveXObject('htmlfile'); } catch (error) { /* ignore */ } NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) // old IE : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument); // WSH var length = enumBugKeys.length; while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; return NullProtoObject(); }; hiddenKeys[IE_PROTO] = true; // `Object.create` method // https://tc39.es/ecma262/#sec-object.create module.exports = Object.create || function create(O, Properties) { var result; if (O !== null) { EmptyConstructor[PROTOTYPE] = anObject(O); result = new EmptyConstructor(); EmptyConstructor[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = NullProtoObject(); return Properties === undefined ? result : defineProperties(result, Properties); }; /***/ }), /* 55 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var isCallable = __webpack_require__(28); var tryToString = __webpack_require__(89); var TypeError = global.TypeError; // `Assert: IsCallable(argument) is true` module.exports = function (argument) { if (isCallable(argument)) return argument; throw TypeError(tryToString(argument) + ' is not a function'); }; /***/ }), /* 56 */ /***/ (function(module, exports, __webpack_require__) { var NATIVE_WEAK_MAP = __webpack_require__(170); var global = __webpack_require__(7); var uncurryThis = __webpack_require__(15); var isObject = __webpack_require__(33); var createNonEnumerableProperty = __webpack_require__(57); var hasOwn = __webpack_require__(34); var shared = __webpack_require__(107); var sharedKey = __webpack_require__(91); var hiddenKeys = __webpack_require__(70); var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; var TypeError = global.TypeError; var WeakMap = global.WeakMap; var set, get, has; var enforce = function (it) { return has(it) ? get(it) : set(it, {}); }; var getterFor = function (TYPE) { return function (it) { var state; if (!isObject(it) || (state = get(it)).type !== TYPE) { throw TypeError('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; if (NATIVE_WEAK_MAP || shared.state) { var store = shared.state || (shared.state = new WeakMap()); var wmget = uncurryThis(store.get); var wmhas = uncurryThis(store.has); var wmset = uncurryThis(store.set); set = function (it, metadata) { if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; wmset(store, it, metadata); return metadata; }; get = function (it) { return wmget(store, it) || {}; }; has = function (it) { return wmhas(store, it); }; } else { var STATE = sharedKey('state'); hiddenKeys[STATE] = true; set = function (it, metadata) { if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; createNonEnumerableProperty(it, STATE, metadata); return metadata; }; get = function (it) { return hasOwn(it, STATE) ? it[STATE] : {}; }; has = function (it) { return hasOwn(it, STATE); }; } module.exports = { set: set, get: get, has: has, enforce: enforce, getterFor: getterFor }; /***/ }), /* 57 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(36); var definePropertyModule = __webpack_require__(37); var createPropertyDescriptor = __webpack_require__(72); module.exports = DESCRIPTORS ? function (object, key, value) { return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); } : function (object, key, value) { object[key] = value; return object; }; /***/ }), /* 58 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); module.exports = uncurryThis({}.isPrototypeOf); /***/ }), /* 59 */ /***/ (function(module, exports, __webpack_require__) { var aCallable = __webpack_require__(55); // `GetMethod` abstract operation // https://tc39.es/ecma262/#sec-getmethod module.exports = function (V, P) { var func = V[P]; return func == null ? undefined : aCallable(func); }; /***/ }), /* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var collection = __webpack_require__(173); var collectionStrong = __webpack_require__(177); // `Map` constructor // https://tc39.es/ecma262/#sec-map-objects collection('Map', function (init) { return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); /***/ }), /* 61 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toPropertyKey = __webpack_require__(87); var definePropertyModule = __webpack_require__(37); var createPropertyDescriptor = __webpack_require__(72); module.exports = function (object, key, value) { var propertyKey = toPropertyKey(key); if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value)); else object[propertyKey] = value; }; /***/ }), /* 62 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); var aCallable = __webpack_require__(55); var bind = uncurryThis(uncurryThis.bind); // optional / simple context binding module.exports = function (fn, that) { aCallable(fn); return that === undefined ? fn : bind ? bind(fn, that) : function (/* ...args */) { return fn.apply(that, arguments); }; }; /***/ }), /* 63 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var uncurryThis = __webpack_require__(15); var IndexedObject = __webpack_require__(81); var toIndexedObject = __webpack_require__(39); var arrayMethodIsStrict = __webpack_require__(120); var un$Join = uncurryThis([].join); var ES3_STRINGS = IndexedObject != Object; var STRICT_METHOD = arrayMethodIsStrict('join', ','); // `Array.prototype.join` method // https://tc39.es/ecma262/#sec-array.prototype.join $({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, { join: function join(separator) { return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator); } }); /***/ }), /* 64 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); var fill = __webpack_require__(214); var addToUnscopables = __webpack_require__(83); // `Array.prototype.fill` method // https://tc39.es/ecma262/#sec-array.prototype.fill $({ target: 'Array', proto: true }, { fill: fill }); // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('fill'); /***/ }), /* 65 */ /***/ (function(module, exports) { module.exports = false; /***/ }), /* 66 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var userAgent = __webpack_require__(53); var process = global.process; var Deno = global.Deno; var versions = process && process.versions || Deno && Deno.version; var v8 = versions && versions.v8; var match, version; if (v8) { match = v8.split('.'); // in old Chrome, versions of V8 isn't V8 = Chrome / 10 // but their correct versions are not interesting for us version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); } // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` // so check `userAgent` even if `.v8` exists, but 0 if (!version && userAgent) { match = userAgent.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = userAgent.match(/Chrome\/(\d+)/); if (match) version = +match[1]; } } module.exports = version; /***/ }), /* 67 */ /***/ (function(module, exports, __webpack_require__) { var internalObjectKeys = __webpack_require__(131); var enumBugKeys = __webpack_require__(110); // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys // eslint-disable-next-line es/no-object-keys -- safe module.exports = Object.keys || function keys(O) { return internalObjectKeys(O, enumBugKeys); }; /***/ }), /* 68 */ /***/ (function(module, exports, __webpack_require__) { var toIntegerOrInfinity = __webpack_require__(69); var max = Math.max; var min = Math.min; // Helper for a popular repeating case of the spec: // Let integer be ? ToInteger(index). // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). module.exports = function (index, length) { var integer = toIntegerOrInfinity(index); return integer < 0 ? max(integer + length, 0) : min(integer, length); }; /***/ }), /* 69 */ /***/ (function(module, exports) { var ceil = Math.ceil; var floor = Math.floor; // `ToIntegerOrInfinity` abstract operation // https://tc39.es/ecma262/#sec-tointegerorinfinity module.exports = function (argument) { var number = +argument; // eslint-disable-next-line no-self-compare -- safe return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number); }; /***/ }), /* 70 */ /***/ (function(module, exports) { module.exports = {}; /***/ }), /* 71 */ /***/ (function(module, exports) { module.exports = {}; /***/ }), /* 72 */ /***/ (function(module, exports) { module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; /***/ }), /* 73 */ /***/ (function(module, exports, __webpack_require__) { var internalObjectKeys = __webpack_require__(131); var enumBugKeys = __webpack_require__(110); var hiddenKeys = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames // eslint-disable-next-line es/no-object-getownpropertynames -- safe exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return internalObjectKeys(O, hiddenKeys); }; /***/ }), /* 74 */ /***/ (function(module, exports, __webpack_require__) { var defineProperty = __webpack_require__(37).f; var hasOwn = __webpack_require__(34); var wellKnownSymbol = __webpack_require__(27); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); module.exports = function (it, TAG, STATIC) { if (it && !hasOwn(it = STATIC ? it : it.prototype, TO_STRING_TAG)) { defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG }); } }; /***/ }), /* 75 */ /***/ (function(module, exports, __webpack_require__) { var bind = __webpack_require__(62); var uncurryThis = __webpack_require__(15); var IndexedObject = __webpack_require__(81); var toObject = __webpack_require__(38); var lengthOfArrayLike = __webpack_require__(43); var arraySpeciesCreate = __webpack_require__(119); var push = uncurryThis([].push); // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation var createMethod = function (TYPE) { var IS_MAP = TYPE == 1; var IS_FILTER = TYPE == 2; var IS_SOME = TYPE == 3; var IS_EVERY = TYPE == 4; var IS_FIND_INDEX = TYPE == 6; var IS_FILTER_REJECT = TYPE == 7; var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; return function ($this, callbackfn, that, specificCreate) { var O = toObject($this); var self = IndexedObject(O); var boundFunction = bind(callbackfn, that); var length = lengthOfArrayLike(self); var index = 0; var create = specificCreate || arraySpeciesCreate; var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined; var value, result; for (;length > index; index++) if (NO_HOLES || index in self) { value = self[index]; result = boundFunction(value, index, O); if (TYPE) { if (IS_MAP) target[index] = result; // map else if (result) switch (TYPE) { case 3: return true; // some case 5: return value; // find case 6: return index; // findIndex case 2: push(target, value); // filter } else switch (TYPE) { case 4: return false; // every case 7: push(target, value); // filterReject } } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; }; }; module.exports = { // `Array.prototype.forEach` method // https://tc39.es/ecma262/#sec-array.prototype.foreach forEach: createMethod(0), // `Array.prototype.map` method // https://tc39.es/ecma262/#sec-array.prototype.map map: createMethod(1), // `Array.prototype.filter` method // https://tc39.es/ecma262/#sec-array.prototype.filter filter: createMethod(2), // `Array.prototype.some` method // https://tc39.es/ecma262/#sec-array.prototype.some some: createMethod(3), // `Array.prototype.every` method // https://tc39.es/ecma262/#sec-array.prototype.every every: createMethod(4), // `Array.prototype.find` method // https://tc39.es/ecma262/#sec-array.prototype.find find: createMethod(5), // `Array.prototype.findIndex` method // https://tc39.es/ecma262/#sec-array.prototype.findIndex findIndex: createMethod(6), // `Array.prototype.filterReject` method // https://github.com/tc39/proposal-array-filtering filterReject: createMethod(7) }; /***/ }), /* 76 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(18); var wellKnownSymbol = __webpack_require__(27); var V8_VERSION = __webpack_require__(66); var SPECIES = wellKnownSymbol('species'); module.exports = function (METHOD_NAME) { // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation // https://github.com/zloirock/core-js/issues/677 return V8_VERSION >= 51 || !fails(function () { var array = []; var constructor = array.constructor = {}; constructor[SPECIES] = function () { return { foo: 1 }; }; return array[METHOD_NAME](Boolean).foo !== 1; }); }; /***/ }), /* 77 */ /***/ (function(module, exports) { var FunctionPrototype = Function.prototype; var apply = FunctionPrototype.apply; var bind = FunctionPrototype.bind; var call = FunctionPrototype.call; // eslint-disable-next-line es/no-reflect -- safe module.exports = typeof Reflect == 'object' && Reflect.apply || (bind ? call.bind(apply) : function () { return call.apply(apply, arguments); }); /***/ }), /* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var apply = __webpack_require__(77); var call = __webpack_require__(35); var uncurryThis = __webpack_require__(15); var fixRegExpWellKnownSymbolLogic = __webpack_require__(122); var isRegExp = __webpack_require__(154); var anObject = __webpack_require__(32); var requireObjectCoercible = __webpack_require__(45); var speciesConstructor = __webpack_require__(156); var advanceStringIndex = __webpack_require__(123); var toLength = __webpack_require__(90); var toString = __webpack_require__(40); var getMethod = __webpack_require__(59); var arraySlice = __webpack_require__(113); var callRegExpExec = __webpack_require__(124); var regexpExec = __webpack_require__(102); var stickyHelpers = __webpack_require__(151); var fails = __webpack_require__(18); var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; var MAX_UINT32 = 0xFFFFFFFF; var min = Math.min; var $push = [].push; var exec = uncurryThis(/./.exec); var push = uncurryThis($push); var stringSlice = uncurryThis(''.slice); // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec // Weex JS has frozen built-in prototypes, so use try / catch wrapper var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () { // eslint-disable-next-line regexp/no-empty-group -- required for testing var re = /(?:)/; var originalExec = re.exec; re.exec = function () { return originalExec.apply(this, arguments); }; var result = 'ab'.split(re); return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b'; }); // @@split logic fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) { var internalSplit; if ( 'abbc'.split(/(b)*/)[1] == 'c' || // eslint-disable-next-line regexp/no-empty-group -- required for testing 'test'.split(/(?:)/, -1).length != 4 || 'ab'.split(/(?:ab)*/).length != 2 || '.'.split(/(.?)(.?)/).length != 4 || // eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing '.'.split(/()()/).length > 1 || ''.split(/.?/).length ) { // based on es5-shim implementation, need to rework it internalSplit = function (separator, limit) { var string = toString(requireObjectCoercible(this)); var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; if (lim === 0) return []; if (separator === undefined) return [string]; // If `separator` is not a regex, use native split if (!isRegExp(separator)) { return call(nativeSplit, string, separator, lim); } var output = []; var flags = (separator.ignoreCase ? 'i' : '') + (separator.multiline ? 'm' : '') + (separator.unicode ? 'u' : '') + (separator.sticky ? 'y' : ''); var lastLastIndex = 0; // Make `global` and avoid `lastIndex` issues by working with a copy var separatorCopy = new RegExp(separator.source, flags + 'g'); var match, lastIndex, lastLength; while (match = call(regexpExec, separatorCopy, string)) { lastIndex = separatorCopy.lastIndex; if (lastIndex > lastLastIndex) { push(output, stringSlice(string, lastLastIndex, match.index)); if (match.length > 1 && match.index < string.length) apply($push, output, arraySlice(match, 1)); lastLength = match[0].length; lastLastIndex = lastIndex; if (output.length >= lim) break; } if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop } if (lastLastIndex === string.length) { if (lastLength || !exec(separatorCopy, '')) push(output, ''); } else push(output, stringSlice(string, lastLastIndex)); return output.length > lim ? arraySlice(output, 0, lim) : output; }; // Chakra, V8 } else if ('0'.split(undefined, 0).length) { internalSplit = function (separator, limit) { return separator === undefined && limit === 0 ? [] : call(nativeSplit, this, separator, limit); }; } else internalSplit = nativeSplit; return [ // `String.prototype.split` method // https://tc39.es/ecma262/#sec-string.prototype.split function split(separator, limit) { var O = requireObjectCoercible(this); var splitter = separator == undefined ? undefined : getMethod(separator, SPLIT); return splitter ? call(splitter, separator, O, limit) : call(internalSplit, toString(O), separator, limit); }, // `RegExp.prototype[@@split]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@split // // NOTE: This cannot be properly polyfilled in engines that don't support // the 'y' flag. function (string, limit) { var rx = anObject(this); var S = toString(string); var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit); if (res.done) return res.value; var C = speciesConstructor(rx, RegExp); var unicodeMatching = rx.unicode; var flags = (rx.ignoreCase ? 'i' : '') + (rx.multiline ? 'm' : '') + (rx.unicode ? 'u' : '') + (UNSUPPORTED_Y ? 'g' : 'y'); // ^(? + rx + ) is needed, in combination with some S slicing, to // simulate the 'y' flag. var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, flags); var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; if (lim === 0) return []; if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : []; var p = 0; var q = 0; var A = []; while (q < S.length) { splitter.lastIndex = UNSUPPORTED_Y ? 0 : q; var z = callRegExpExec(splitter, UNSUPPORTED_Y ? stringSlice(S, q) : S); var e; if ( z === null || (e = min(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p ) { q = advanceStringIndex(S, q, unicodeMatching); } else { push(A, stringSlice(S, p, q)); if (A.length === lim) return A; for (var i = 1; i <= z.length - 1; i++) { push(A, z[i]); if (A.length === lim) return A; } q = p = e; } } push(A, stringSlice(S, p)); return A; } ]; }, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y); /***/ }), /* 79 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(36); var global = __webpack_require__(7); var uncurryThis = __webpack_require__(15); var isForced = __webpack_require__(95); var redefine = __webpack_require__(44); var hasOwn = __webpack_require__(34); var inheritIfRequired = __webpack_require__(143); var isPrototypeOf = __webpack_require__(58); var isSymbol = __webpack_require__(88); var toPrimitive = __webpack_require__(130); var fails = __webpack_require__(18); var getOwnPropertyNames = __webpack_require__(73).f; var getOwnPropertyDescriptor = __webpack_require__(51).f; var defineProperty = __webpack_require__(37).f; var thisNumberValue = __webpack_require__(196); var trim = __webpack_require__(159).trim; var NUMBER = 'Number'; var NativeNumber = global[NUMBER]; var NumberPrototype = NativeNumber.prototype; var TypeError = global.TypeError; var arraySlice = uncurryThis(''.slice); var charCodeAt = uncurryThis(''.charCodeAt); // `ToNumeric` abstract operation // https://tc39.es/ecma262/#sec-tonumeric var toNumeric = function (value) { var primValue = toPrimitive(value, 'number'); return typeof primValue == 'bigint' ? primValue : toNumber(primValue); }; // `ToNumber` abstract operation // https://tc39.es/ecma262/#sec-tonumber var toNumber = function (argument) { var it = toPrimitive(argument, 'number'); var first, third, radix, maxCode, digits, length, index, code; if (isSymbol(it)) throw TypeError('Cannot convert a Symbol value to a number'); if (typeof it == 'string' && it.length > 2) { it = trim(it); first = charCodeAt(it, 0); if (first === 43 || first === 45) { third = charCodeAt(it, 2); if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix } else if (first === 48) { switch (charCodeAt(it, 1)) { case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i default: return +it; } digits = arraySlice(it, 2); length = digits.length; for (index = 0; index < length; index++) { code = charCodeAt(digits, index); // parseInt parses a string to a first unavailable symbol // but ToNumber should return NaN if a string contains unavailable symbols if (code < 48 || code > maxCode) return NaN; } return parseInt(digits, radix); } } return +it; }; // `Number` constructor // https://tc39.es/ecma262/#sec-number-constructor if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) { var NumberWrapper = function Number(value) { var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value)); var dummy = this; // check on 1..constructor(foo) case return isPrototypeOf(NumberPrototype, dummy) && fails(function () { thisNumberValue(dummy); }) ? inheritIfRequired(Object(n), dummy, NumberWrapper) : n; }; for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : ( // ES3: 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + // ES2015 (in case, if modules with ES2015 Number statics required before): 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' + // ESNext 'fromString,range' ).split(','), j = 0, key; keys.length > j; j++) { if (hasOwn(NativeNumber, key = keys[j]) && !hasOwn(NumberWrapper, key)) { defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key)); } } NumberWrapper.prototype = NumberPrototype; NumberPrototype.constructor = NumberWrapper; redefine(global, NUMBER, NumberWrapper); } /***/ }), /* 80 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); // `Number.MAX_SAFE_INTEGER` constant // https://tc39.es/ecma262/#sec-number.max_safe_integer $({ target: 'Number', stat: true }, { MAX_SAFE_INTEGER: 0x1FFFFFFFFFFFFF }); /***/ }), /* 81 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var uncurryThis = __webpack_require__(15); var fails = __webpack_require__(18); var classof = __webpack_require__(50); var Object = global.Object; var split = uncurryThis(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings module.exports = fails(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe return !Object('z').propertyIsEnumerable(0); }) ? function (it) { return classof(it) == 'String' ? split(it, '') : Object(it); } : Object; /***/ }), /* 82 */ /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || new Function("return this")(); } catch (e) { // This works if the window reference is available if (typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /* 83 */ /***/ (function(module, exports, __webpack_require__) { var wellKnownSymbol = __webpack_require__(27); var create = __webpack_require__(54); var definePropertyModule = __webpack_require__(37); var UNSCOPABLES = wellKnownSymbol('unscopables'); var ArrayPrototype = Array.prototype; // Array.prototype[@@unscopables] // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables if (ArrayPrototype[UNSCOPABLES] == undefined) { definePropertyModule.f(ArrayPrototype, UNSCOPABLES, { configurable: true, value: create(null) }); } // add a key to Array.prototype[@@unscopables] module.exports = function (key) { ArrayPrototype[UNSCOPABLES][key] = true; }; /***/ }), /* 84 */ /***/ (function(module, exports, __webpack_require__) { var IS_PURE = __webpack_require__(65); var store = __webpack_require__(107); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ version: '3.19.3', mode: IS_PURE ? 'pure' : 'global', copyright: '© 2021 Denis Pushkarev (zloirock.ru)' }); /***/ }), /* 85 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); var id = 0; var postfix = Math.random(); var toString = uncurryThis(1.0.toString); module.exports = function (key) { return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36); }; /***/ }), /* 86 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var isObject = __webpack_require__(33); var document = global.document; // typeof document.createElement is 'object' in old IE var EXISTS = isObject(document) && isObject(document.createElement); module.exports = function (it) { return EXISTS ? document.createElement(it) : {}; }; /***/ }), /* 87 */ /***/ (function(module, exports, __webpack_require__) { var toPrimitive = __webpack_require__(130); var isSymbol = __webpack_require__(88); // `ToPropertyKey` abstract operation // https://tc39.es/ecma262/#sec-topropertykey module.exports = function (argument) { var key = toPrimitive(argument, 'string'); return isSymbol(key) ? key : key + ''; }; /***/ }), /* 88 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var getBuiltIn = __webpack_require__(46); var isCallable = __webpack_require__(28); var isPrototypeOf = __webpack_require__(58); var USE_SYMBOL_AS_UID = __webpack_require__(128); var Object = global.Object; module.exports = USE_SYMBOL_AS_UID ? function (it) { return typeof it == 'symbol'; } : function (it) { var $Symbol = getBuiltIn('Symbol'); return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, Object(it)); }; /***/ }), /* 89 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var String = global.String; module.exports = function (argument) { try { return String(argument); } catch (error) { return 'Object'; } }; /***/ }), /* 90 */ /***/ (function(module, exports, __webpack_require__) { var toIntegerOrInfinity = __webpack_require__(69); var min = Math.min; // `ToLength` abstract operation // https://tc39.es/ecma262/#sec-tolength module.exports = function (argument) { return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; /***/ }), /* 91 */ /***/ (function(module, exports, __webpack_require__) { var shared = __webpack_require__(84); var uid = __webpack_require__(85); var keys = shared('keys'); module.exports = function (key) { return keys[key] || (keys[key] = uid(key)); }; /***/ }), /* 92 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); var isCallable = __webpack_require__(28); var store = __webpack_require__(107); var functionToString = uncurryThis(Function.toString); // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper if (!isCallable(store.inspectSource)) { store.inspectSource = function (it) { return functionToString(it); }; } module.exports = store.inspectSource; /***/ }), /* 93 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $propertyIsEnumerable = {}.propertyIsEnumerable; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor(this, V); return !!descriptor && descriptor.enumerable; } : $propertyIsEnumerable; /***/ }), /* 94 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(36); var hasOwn = __webpack_require__(34); var FunctionPrototype = Function.prototype; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor; var EXISTS = hasOwn(FunctionPrototype, 'name'); // additional protection from minified / mangled / dropped function names var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something'; var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable)); module.exports = { EXISTS: EXISTS, PROPER: PROPER, CONFIGURABLE: CONFIGURABLE }; /***/ }), /* 95 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(18); var isCallable = __webpack_require__(28); var replacement = /#|\.prototype\./; var isForced = function (feature, detection) { var value = data[normalize(feature)]; return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection; }; var normalize = isForced.normalize = function (string) { return String(string).replace(replacement, '.').toLowerCase(); }; var data = isForced.data = {}; var NATIVE = isForced.NATIVE = 'N'; var POLYFILL = isForced.POLYFILL = 'P'; module.exports = isForced; /***/ }), /* 96 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var hasOwn = __webpack_require__(34); var isCallable = __webpack_require__(28); var toObject = __webpack_require__(38); var sharedKey = __webpack_require__(91); var CORRECT_PROTOTYPE_GETTER = __webpack_require__(137); var IE_PROTO = sharedKey('IE_PROTO'); var Object = global.Object; var ObjectPrototype = Object.prototype; // `Object.getPrototypeOf` method // https://tc39.es/ecma262/#sec-object.getprototypeof module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) { var object = toObject(O); if (hasOwn(object, IE_PROTO)) return object[IE_PROTO]; var constructor = object.constructor; if (isCallable(constructor) && object instanceof constructor) { return constructor.prototype; } return object instanceof Object ? ObjectPrototype : null; }; /***/ }), /* 97 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable no-proto -- safe */ var uncurryThis = __webpack_require__(15); var anObject = __webpack_require__(32); var aPossiblePrototype = __webpack_require__(172); // `Object.setPrototypeOf` method // https://tc39.es/ecma262/#sec-object.setprototypeof // Works with __proto__ only. Old v8 can't work with null proto objects. // eslint-disable-next-line es/no-object-setprototypeof -- safe module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { var CORRECT_SETTER = false; var test = {}; var setter; try { // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set); setter(test, []); CORRECT_SETTER = test instanceof Array; } catch (error) { /* empty */ } return function setPrototypeOf(O, proto) { anObject(O); aPossiblePrototype(proto); if (CORRECT_SETTER) setter(O, proto); else O.__proto__ = proto; return O; }; }() : undefined); /***/ }), /* 98 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var TO_STRING_TAG_SUPPORT = __webpack_require__(116); var isCallable = __webpack_require__(28); var classofRaw = __webpack_require__(50); var wellKnownSymbol = __webpack_require__(27); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var Object = global.Object; // ES3 wrong here var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (error) { /* empty */ } }; // getting tag from ES6+ `Object.prototype.toString` module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) { var O, tag, result; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result; }; /***/ }), /* 99 */ /***/ (function(module, exports, __webpack_require__) { var classof = __webpack_require__(50); // `IsArray` abstract operation // https://tc39.es/ecma262/#sec-isarray // eslint-disable-next-line es/no-array-isarray -- safe module.exports = Array.isArray || function isArray(argument) { return classof(argument) == 'Array'; }; /***/ }), /* 100 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); var fails = __webpack_require__(18); var isCallable = __webpack_require__(28); var classof = __webpack_require__(98); var getBuiltIn = __webpack_require__(46); var inspectSource = __webpack_require__(92); var noop = function () { /* empty */ }; var empty = []; var construct = getBuiltIn('Reflect', 'construct'); var constructorRegExp = /^\s*(?:class|function)\b/; var exec = uncurryThis(constructorRegExp.exec); var INCORRECT_TO_STRING = !constructorRegExp.exec(noop); var isConstructorModern = function (argument) { if (!isCallable(argument)) return false; try { construct(noop, empty, argument); return true; } catch (error) { return false; } }; var isConstructorLegacy = function (argument) { if (!isCallable(argument)) return false; switch (classof(argument)) { case 'AsyncFunction': case 'GeneratorFunction': case 'AsyncGeneratorFunction': return false; // we can't check .prototype since constructors produced by .bind haven't it } return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument)); }; // `IsConstructor` abstract operation // https://tc39.es/ecma262/#sec-isconstructor module.exports = !construct || fails(function () { var called; return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () { called = true; }) || called; }) ? isConstructorLegacy : isConstructorModern; /***/ }), /* 101 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); module.exports = uncurryThis([].slice); /***/ }), /* 102 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */ /* eslint-disable regexp/no-useless-quantifier -- testing */ var call = __webpack_require__(35); var uncurryThis = __webpack_require__(15); var toString = __webpack_require__(40); var regexpFlags = __webpack_require__(184); var stickyHelpers = __webpack_require__(151); var shared = __webpack_require__(84); var create = __webpack_require__(54); var getInternalState = __webpack_require__(56).get; var UNSUPPORTED_DOT_ALL = __webpack_require__(185); var UNSUPPORTED_NCG = __webpack_require__(186); var nativeReplace = shared('native-string-replace', String.prototype.replace); var nativeExec = RegExp.prototype.exec; var patchedExec = nativeExec; var charAt = uncurryThis(''.charAt); var indexOf = uncurryThis(''.indexOf); var replace = uncurryThis(''.replace); var stringSlice = uncurryThis(''.slice); var UPDATES_LAST_INDEX_WRONG = (function () { var re1 = /a/; var re2 = /b*/g; call(nativeExec, re1, 'a'); call(nativeExec, re2, 'a'); return re1.lastIndex !== 0 || re2.lastIndex !== 0; })(); var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET; // nonparticipating capturing group, copied from es5-shim's String#split patch. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG; if (PATCH) { patchedExec = function exec(string) { var re = this; var state = getInternalState(re); var str = toString(string); var raw = state.raw; var result, reCopy, lastIndex, match, i, object, group; if (raw) { raw.lastIndex = re.lastIndex; result = call(patchedExec, raw, str); re.lastIndex = raw.lastIndex; return result; } var groups = state.groups; var sticky = UNSUPPORTED_Y && re.sticky; var flags = call(regexpFlags, re); var source = re.source; var charsAdded = 0; var strCopy = str; if (sticky) { flags = replace(flags, 'y', ''); if (indexOf(flags, 'g') === -1) { flags += 'g'; } strCopy = stringSlice(str, re.lastIndex); // Support anchored sticky behavior. if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt(str, re.lastIndex - 1) !== '\n')) { source = '(?: ' + source + ')'; strCopy = ' ' + strCopy; charsAdded++; } // ^(? + rx + ) is needed, in combination with some str slicing, to // simulate the 'y' flag. reCopy = new RegExp('^(?:' + source + ')', flags); } if (NPCG_INCLUDED) { reCopy = new RegExp('^' + source + '$(?!\\s)', flags); } if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex; match = call(nativeExec, sticky ? reCopy : re, strCopy); if (sticky) { if (match) { match.input = stringSlice(match.input, charsAdded); match[0] = stringSlice(match[0], charsAdded); match.index = re.lastIndex; re.lastIndex += match[0].length; } else re.lastIndex = 0; } else if (UPDATES_LAST_INDEX_WRONG && match) { re.lastIndex = re.global ? match.index + match[0].length : lastIndex; } if (NPCG_INCLUDED && match && match.length > 1) { // Fix browsers whose `exec` methods don't consistently return `undefined` // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ call(nativeReplace, match[0], reCopy, function () { for (i = 1; i < arguments.length - 2; i++) { if (arguments[i] === undefined) match[i] = undefined; } }); } if (match && groups) { match.groups = object = create(null); for (i = 0; i < groups.length; i++) { group = groups[i]; object[group[0]] = match[group[1]]; } } return match; }; } module.exports = patchedExec; /***/ }), /* 103 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var global = __webpack_require__(7); var toAbsoluteIndex = __webpack_require__(68); var toIntegerOrInfinity = __webpack_require__(69); var lengthOfArrayLike = __webpack_require__(43); var toObject = __webpack_require__(38); var arraySpeciesCreate = __webpack_require__(119); var createProperty = __webpack_require__(61); var arrayMethodHasSpeciesSupport = __webpack_require__(76); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice'); var TypeError = global.TypeError; var max = Math.max; var min = Math.min; var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; // `Array.prototype.splice` method // https://tc39.es/ecma262/#sec-array.prototype.splice // with adding support of @@species $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { splice: function splice(start, deleteCount /* , ...items */) { var O = toObject(this); var len = lengthOfArrayLike(O); var actualStart = toAbsoluteIndex(start, len); var argumentsLength = arguments.length; var insertCount, actualDeleteCount, A, k, from, to; if (argumentsLength === 0) { insertCount = actualDeleteCount = 0; } else if (argumentsLength === 1) { insertCount = 0; actualDeleteCount = len - actualStart; } else { insertCount = argumentsLength - 2; actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart); } if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) { throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); } A = arraySpeciesCreate(O, actualDeleteCount); for (k = 0; k < actualDeleteCount; k++) { from = actualStart + k; if (from in O) createProperty(A, k, O[from]); } A.length = actualDeleteCount; if (insertCount < actualDeleteCount) { for (k = actualStart; k < len - actualDeleteCount; k++) { from = k + actualDeleteCount; to = k + insertCount; if (from in O) O[to] = O[from]; else delete O[to]; } for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1]; } else if (insertCount > actualDeleteCount) { for (k = len - actualDeleteCount; k > actualStart; k--) { from = k + actualDeleteCount - 1; to = k + insertCount - 1; if (from in O) O[to] = O[from]; else delete O[to]; } } for (k = 0; k < insertCount; k++) { O[k + actualStart] = arguments[k + 2]; } O.length = len - actualDeleteCount + insertCount; return A; } }); /***/ }), /* 104 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var createHTML = __webpack_require__(201); var forcedStringHTMLMethod = __webpack_require__(202); // `String.prototype.anchor` method // https://tc39.es/ecma262/#sec-string.prototype.anchor $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('anchor') }, { anchor: function anchor(name) { return createHTML(this, 'a', 'name', name); } }); /***/ }), /* 105 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; /* harmony default export */ __webpack_exports__["a"] = (freeGlobal); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(82))) /***/ }), /* 106 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(module) {/* harmony import */ var _root_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31); /** Detect free variable `exports`. */ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Built-in value references. */ var Buffer = moduleExports ? _root_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].Buffer : undefined, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined; /** * Creates a clone of `buffer`. * * @private * @param {Buffer} buffer The buffer to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Buffer} Returns the cloned buffer. */ function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); buffer.copy(result); return result; } /* harmony default export */ __webpack_exports__["a"] = (cloneBuffer); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(121)(module))) /***/ }), /* 107 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var setGlobal = __webpack_require__(108); var SHARED = '__core-js_shared__'; var store = global[SHARED] || setGlobal(SHARED, {}); module.exports = store; /***/ }), /* 108 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty = Object.defineProperty; module.exports = function (key, value) { try { defineProperty(global, key, { value: value, configurable: true, writable: true }); } catch (error) { global[key] = value; } return value; }; /***/ }), /* 109 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable es/no-symbol -- required for testing */ var V8_VERSION = __webpack_require__(66); var fails = __webpack_require__(18); // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing module.exports = !!Object.getOwnPropertySymbols && !fails(function () { var symbol = Symbol(); // Chrome 38 Symbol has incorrect toString conversion // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances return !String(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances !Symbol.sham && V8_VERSION && V8_VERSION < 41; }); /***/ }), /* 110 */ /***/ (function(module, exports) { // IE8- don't enum bug keys module.exports = [ 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf' ]; /***/ }), /* 111 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var call = __webpack_require__(35); var IS_PURE = __webpack_require__(65); var FunctionName = __webpack_require__(94); var isCallable = __webpack_require__(28); var createIteratorConstructor = __webpack_require__(171); var getPrototypeOf = __webpack_require__(96); var setPrototypeOf = __webpack_require__(97); var setToStringTag = __webpack_require__(74); var createNonEnumerableProperty = __webpack_require__(57); var redefine = __webpack_require__(44); var wellKnownSymbol = __webpack_require__(27); var Iterators = __webpack_require__(71); var IteratorsCore = __webpack_require__(136); var PROPER_FUNCTION_NAME = FunctionName.PROPER; var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE; var IteratorPrototype = IteratorsCore.IteratorPrototype; var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; var ITERATOR = wellKnownSymbol('iterator'); var KEYS = 'keys'; var VALUES = 'values'; var ENTRIES = 'entries'; var returnThis = function () { return this; }; module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { createIteratorConstructor(IteratorConstructor, NAME, next); var getIterationMethod = function (KIND) { if (KIND === DEFAULT && defaultIterator) return defaultIterator; if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND]; switch (KIND) { case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; } return function () { return new IteratorConstructor(this); }; }; var TO_STRING_TAG = NAME + ' Iterator'; var INCORRECT_VALUES_NAME = false; var IterablePrototype = Iterable.prototype; var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT]; var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; var CurrentIteratorPrototype, methods, KEY; // fix native if (anyNativeIterator) { CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { if (setPrototypeOf) { setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) { redefine(CurrentIteratorPrototype, ITERATOR, returnThis); } } // Set @@toStringTag to native iterators setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true); if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis; } } // fix Array.prototype.{ values, @@iterator }.name in V8 / FF if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) { createNonEnumerableProperty(IterablePrototype, 'name', VALUES); } else { INCORRECT_VALUES_NAME = true; defaultIterator = function values() { return call(nativeIterator, this); }; } } // export additional methods if (DEFAULT) { methods = { values: getIterationMethod(VALUES), keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), entries: getIterationMethod(ENTRIES) }; if (FORCED) for (KEY in methods) { if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { redefine(IterablePrototype, KEY, methods[KEY]); } } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); } // define iterator if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) { redefine(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT }); } Iterators[NAME] = defaultIterator; return methods; }; /***/ }), /* 112 */ /***/ (function(module, exports) { // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe exports.f = Object.getOwnPropertySymbols; /***/ }), /* 113 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var toAbsoluteIndex = __webpack_require__(68); var lengthOfArrayLike = __webpack_require__(43); var createProperty = __webpack_require__(61); var Array = global.Array; var max = Math.max; module.exports = function (O, start, end) { var length = lengthOfArrayLike(O); var k = toAbsoluteIndex(start, length); var fin = toAbsoluteIndex(end === undefined ? length : end, length); var result = Array(max(fin - k, 0)); for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]); result.length = n; return result; }; /***/ }), /* 114 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var bind = __webpack_require__(62); var call = __webpack_require__(35); var anObject = __webpack_require__(32); var tryToString = __webpack_require__(89); var isArrayIteratorMethod = __webpack_require__(140); var lengthOfArrayLike = __webpack_require__(43); var isPrototypeOf = __webpack_require__(58); var getIterator = __webpack_require__(141); var getIteratorMethod = __webpack_require__(115); var iteratorClose = __webpack_require__(142); var TypeError = global.TypeError; var Result = function (stopped, result) { this.stopped = stopped; this.result = result; }; var ResultPrototype = Result.prototype; module.exports = function (iterable, unboundFunction, options) { var that = options && options.that; var AS_ENTRIES = !!(options && options.AS_ENTRIES); var IS_ITERATOR = !!(options && options.IS_ITERATOR); var INTERRUPTED = !!(options && options.INTERRUPTED); var fn = bind(unboundFunction, that); var iterator, iterFn, index, length, result, next, step; var stop = function (condition) { if (iterator) iteratorClose(iterator, 'normal', condition); return new Result(true, condition); }; var callFn = function (value) { if (AS_ENTRIES) { anObject(value); return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); } return INTERRUPTED ? fn(value, stop) : fn(value); }; if (IS_ITERATOR) { iterator = iterable; } else { iterFn = getIteratorMethod(iterable); if (!iterFn) throw TypeError(tryToString(iterable) + ' is not iterable'); // optimisation for array iterators if (isArrayIteratorMethod(iterFn)) { for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) { result = callFn(iterable[index]); if (result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); } iterator = getIterator(iterable, iterFn); } next = iterator.next; while (!(step = call(next, iterator)).done) { try { result = callFn(step.value); } catch (error) { iteratorClose(iterator, 'throw', error); } if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); }; /***/ }), /* 115 */ /***/ (function(module, exports, __webpack_require__) { var classof = __webpack_require__(98); var getMethod = __webpack_require__(59); var Iterators = __webpack_require__(71); var wellKnownSymbol = __webpack_require__(27); var ITERATOR = wellKnownSymbol('iterator'); module.exports = function (it) { if (it != undefined) return getMethod(it, ITERATOR) || getMethod(it, '@@iterator') || Iterators[classof(it)]; }; /***/ }), /* 116 */ /***/ (function(module, exports, __webpack_require__) { var wellKnownSymbol = __webpack_require__(27); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var test = {}; test[TO_STRING_TAG] = 'z'; module.exports = String(test) === '[object z]'; /***/ }), /* 117 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var isPrototypeOf = __webpack_require__(58); var TypeError = global.TypeError; module.exports = function (it, Prototype) { if (isPrototypeOf(Prototype, it)) return it; throw TypeError('Incorrect invocation'); }; /***/ }), /* 118 */ /***/ (function(module, exports, __webpack_require__) { var wellKnownSymbol = __webpack_require__(27); var ITERATOR = wellKnownSymbol('iterator'); var SAFE_CLOSING = false; try { var called = 0; var iteratorWithReturn = { next: function () { return { done: !!called++ }; }, 'return': function () { SAFE_CLOSING = true; } }; iteratorWithReturn[ITERATOR] = function () { return this; }; // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing Array.from(iteratorWithReturn, function () { throw 2; }); } catch (error) { /* empty */ } module.exports = function (exec, SKIP_CLOSING) { if (!SKIP_CLOSING && !SAFE_CLOSING) return false; var ITERATION_SUPPORT = false; try { var object = {}; object[ITERATOR] = function () { return { next: function () { return { done: ITERATION_SUPPORT = true }; } }; }; exec(object); } catch (error) { /* empty */ } return ITERATION_SUPPORT; }; /***/ }), /* 119 */ /***/ (function(module, exports, __webpack_require__) { var arraySpeciesConstructor = __webpack_require__(180); // `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate module.exports = function (originalArray, length) { return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length); }; /***/ }), /* 120 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(18); module.exports = function (METHOD_NAME, argument) { var method = [][METHOD_NAME]; return !!method && fails(function () { // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing method.call(null, argument || function () { throw 1; }, 1); }); }; /***/ }), /* 121 */ /***/ (function(module, exports) { module.exports = function(originalModule) { if (!originalModule.webpackPolyfill) { var module = Object.create(originalModule); // module.parent = undefined by default if (!module.children) module.children = []; Object.defineProperty(module, "loaded", { enumerable: true, get: function() { return module.l; } }); Object.defineProperty(module, "id", { enumerable: true, get: function() { return module.i; } }); Object.defineProperty(module, "exports", { enumerable: true }); module.webpackPolyfill = 1; } return module; }; /***/ }), /* 122 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` since it's moved to entry points __webpack_require__(19); var uncurryThis = __webpack_require__(15); var redefine = __webpack_require__(44); var regexpExec = __webpack_require__(102); var fails = __webpack_require__(18); var wellKnownSymbol = __webpack_require__(27); var createNonEnumerableProperty = __webpack_require__(57); var SPECIES = wellKnownSymbol('species'); var RegExpPrototype = RegExp.prototype; module.exports = function (KEY, exec, FORCED, SHAM) { var SYMBOL = wellKnownSymbol(KEY); var DELEGATES_TO_SYMBOL = !fails(function () { // String methods call symbol-named RegEp methods var O = {}; O[SYMBOL] = function () { return 7; }; return ''[KEY](O) != 7; }); var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () { // Symbol-named RegExp methods call .exec var execCalled = false; var re = /a/; if (KEY === 'split') { // We can't use real regex here since it causes deoptimization // and serious performance degradation in V8 // https://github.com/zloirock/core-js/issues/306 re = {}; // RegExp[@@split] doesn't call the regex's exec method, but first creates // a new one. We need to return the patched regex when creating the new one. re.constructor = {}; re.constructor[SPECIES] = function () { return re; }; re.flags = ''; re[SYMBOL] = /./[SYMBOL]; } re.exec = function () { execCalled = true; return null; }; re[SYMBOL](''); return !execCalled; }); if ( !DELEGATES_TO_SYMBOL || !DELEGATES_TO_EXEC || FORCED ) { var uncurriedNativeRegExpMethod = uncurryThis(/./[SYMBOL]); var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { var uncurriedNativeMethod = uncurryThis(nativeMethod); var $exec = regexp.exec; if ($exec === regexpExec || $exec === RegExpPrototype.exec) { if (DELEGATES_TO_SYMBOL && !forceStringMethod) { // The native String method already delegates to @@method (this // polyfilled function), leasing to infinite recursion. // We avoid it by directly calling the native @@method method. return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) }; } return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) }; } return { done: false }; }); redefine(String.prototype, KEY, methods[0]); redefine(RegExpPrototype, SYMBOL, methods[1]); } if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true); }; /***/ }), /* 123 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var charAt = __webpack_require__(146).charAt; // `AdvanceStringIndex` abstract operation // https://tc39.es/ecma262/#sec-advancestringindex module.exports = function (S, index, unicode) { return index + (unicode ? charAt(S, index).length : 1); }; /***/ }), /* 124 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var call = __webpack_require__(35); var anObject = __webpack_require__(32); var isCallable = __webpack_require__(28); var classof = __webpack_require__(50); var regexpExec = __webpack_require__(102); var TypeError = global.TypeError; // `RegExpExec` abstract operation // https://tc39.es/ecma262/#sec-regexpexec module.exports = function (R, S) { var exec = R.exec; if (isCallable(exec)) { var result = call(exec, R, S); if (result !== null) anObject(result); return result; } if (classof(R) === 'RegExp') return call(regexpExec, R, S); throw TypeError('RegExp#exec called on incompatible receiver'); }; /***/ }), /* 125 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var apply = __webpack_require__(77); var call = __webpack_require__(35); var uncurryThis = __webpack_require__(15); var fixRegExpWellKnownSymbolLogic = __webpack_require__(122); var fails = __webpack_require__(18); var anObject = __webpack_require__(32); var isCallable = __webpack_require__(28); var toIntegerOrInfinity = __webpack_require__(69); var toLength = __webpack_require__(90); var toString = __webpack_require__(40); var requireObjectCoercible = __webpack_require__(45); var advanceStringIndex = __webpack_require__(123); var getMethod = __webpack_require__(59); var getSubstitution = __webpack_require__(197); var regExpExec = __webpack_require__(124); var wellKnownSymbol = __webpack_require__(27); var REPLACE = wellKnownSymbol('replace'); var max = Math.max; var min = Math.min; var concat = uncurryThis([].concat); var push = uncurryThis([].push); var stringIndexOf = uncurryThis(''.indexOf); var stringSlice = uncurryThis(''.slice); var maybeToString = function (it) { return it === undefined ? it : String(it); }; // IE <= 11 replaces $0 with the whole match, as if it was $& // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 var REPLACE_KEEPS_$0 = (function () { // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing return 'a'.replace(/./, '$0') === '$0'; })(); // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () { if (/./[REPLACE]) { return /./[REPLACE]('a', '$0') === ''; } return false; })(); var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { var re = /./; re.exec = function () { var result = []; result.groups = { a: '7' }; return result; }; // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive return ''.replace(re, '$') !== '7'; }); // @@replace logic fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) { var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0'; return [ // `String.prototype.replace` method // https://tc39.es/ecma262/#sec-string.prototype.replace function replace(searchValue, replaceValue) { var O = requireObjectCoercible(this); var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE); return replacer ? call(replacer, searchValue, O, replaceValue) : call(nativeReplace, toString(O), searchValue, replaceValue); }, // `RegExp.prototype[@@replace]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace function (string, replaceValue) { var rx = anObject(this); var S = toString(string); if ( typeof replaceValue == 'string' && stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 && stringIndexOf(replaceValue, '$<') === -1 ) { var res = maybeCallNative(nativeReplace, rx, S, replaceValue); if (res.done) return res.value; } var functionalReplace = isCallable(replaceValue); if (!functionalReplace) replaceValue = toString(replaceValue); var global = rx.global; if (global) { var fullUnicode = rx.unicode; rx.lastIndex = 0; } var results = []; while (true) { var result = regExpExec(rx, S); if (result === null) break; push(results, result); if (!global) break; var matchStr = toString(result[0]); if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); } var accumulatedResult = ''; var nextSourcePosition = 0; for (var i = 0; i < results.length; i++) { result = results[i]; var matched = toString(result[0]); var position = max(min(toIntegerOrInfinity(result.index), S.length), 0); var captures = []; // NOTE: This is equivalent to // captures = result.slice(1).map(maybeToString) // but for some reason `nativeSlice.call(result, 1, result.length)` (called in // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j])); var namedCaptures = result.groups; if (functionalReplace) { var replacerArgs = concat([matched], captures, position, S); if (namedCaptures !== undefined) push(replacerArgs, namedCaptures); var replacement = toString(apply(replaceValue, undefined, replacerArgs)); } else { replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); } if (position >= nextSourcePosition) { accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement; nextSourcePosition = position + matched.length; } } return accumulatedResult + stringSlice(S, nextSourcePosition); } ]; }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE); /***/ }), /* 126 */ /***/ (function(module, exports, __webpack_require__) { var classof = __webpack_require__(50); var global = __webpack_require__(7); module.exports = classof(global.process) == 'process'; /***/ }), /* 127 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); // `Number.MIN_SAFE_INTEGER` constant // https://tc39.es/ecma262/#sec-number.min_safe_integer $({ target: 'Number', stat: true }, { MIN_SAFE_INTEGER: -0x1FFFFFFFFFFFFF }); /***/ }), /* 128 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable es/no-symbol -- required for testing */ var NATIVE_SYMBOL = __webpack_require__(109); module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol'; /***/ }), /* 129 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(36); var fails = __webpack_require__(18); var createElement = __webpack_require__(86); // Thank's IE8 for his funny defineProperty module.exports = !DESCRIPTORS && !fails(function () { // eslint-disable-next-line es/no-object-defineproperty -- requied for testing return Object.defineProperty(createElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), /* 130 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var call = __webpack_require__(35); var isObject = __webpack_require__(33); var isSymbol = __webpack_require__(88); var getMethod = __webpack_require__(59); var ordinaryToPrimitive = __webpack_require__(169); var wellKnownSymbol = __webpack_require__(27); var TypeError = global.TypeError; var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive module.exports = function (input, pref) { if (!isObject(input) || isSymbol(input)) return input; var exoticToPrim = getMethod(input, TO_PRIMITIVE); var result; if (exoticToPrim) { if (pref === undefined) pref = 'default'; result = call(exoticToPrim, input, pref); if (!isObject(result) || isSymbol(result)) return result; throw TypeError("Can't convert object to primitive value"); } if (pref === undefined) pref = 'number'; return ordinaryToPrimitive(input, pref); }; /***/ }), /* 131 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); var hasOwn = __webpack_require__(34); var toIndexedObject = __webpack_require__(39); var indexOf = __webpack_require__(132).indexOf; var hiddenKeys = __webpack_require__(70); var push = uncurryThis([].push); module.exports = function (object, names) { var O = toIndexedObject(object); var i = 0; var result = []; var key; for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key); // Don't enum bug & hidden keys while (names.length > i) if (hasOwn(O, key = names[i++])) { ~indexOf(result, key) || push(result, key); } return result; }; /***/ }), /* 132 */ /***/ (function(module, exports, __webpack_require__) { var toIndexedObject = __webpack_require__(39); var toAbsoluteIndex = __webpack_require__(68); var lengthOfArrayLike = __webpack_require__(43); // `Array.prototype.{ indexOf, includes }` methods implementation var createMethod = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIndexedObject($this); var length = lengthOfArrayLike(O); var index = toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare -- NaN check if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare -- NaN check if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) { if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; module.exports = { // `Array.prototype.includes` method // https://tc39.es/ecma262/#sec-array.prototype.includes includes: createMethod(true), // `Array.prototype.indexOf` method // https://tc39.es/ecma262/#sec-array.prototype.indexof indexOf: createMethod(false) }; /***/ }), /* 133 */ /***/ (function(module, exports, __webpack_require__) { var getBuiltIn = __webpack_require__(46); module.exports = getBuiltIn('document', 'documentElement'); /***/ }), /* 134 */ /***/ (function(module, exports, __webpack_require__) { var hasOwn = __webpack_require__(34); var ownKeys = __webpack_require__(135); var getOwnPropertyDescriptorModule = __webpack_require__(51); var definePropertyModule = __webpack_require__(37); module.exports = function (target, source) { var keys = ownKeys(source); var defineProperty = definePropertyModule.f; var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (!hasOwn(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } }; /***/ }), /* 135 */ /***/ (function(module, exports, __webpack_require__) { var getBuiltIn = __webpack_require__(46); var uncurryThis = __webpack_require__(15); var getOwnPropertyNamesModule = __webpack_require__(73); var getOwnPropertySymbolsModule = __webpack_require__(112); var anObject = __webpack_require__(32); var concat = uncurryThis([].concat); // all object keys, includes non-enumerable and symbols module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { var keys = getOwnPropertyNamesModule.f(anObject(it)); var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys; }; /***/ }), /* 136 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(18); var isCallable = __webpack_require__(28); var create = __webpack_require__(54); var getPrototypeOf = __webpack_require__(96); var redefine = __webpack_require__(44); var wellKnownSymbol = __webpack_require__(27); var IS_PURE = __webpack_require__(65); var ITERATOR = wellKnownSymbol('iterator'); var BUGGY_SAFARI_ITERATORS = false; // `%IteratorPrototype%` object // https://tc39.es/ecma262/#sec-%iteratorprototype%-object var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; /* eslint-disable es/no-array-prototype-keys -- safe */ if ([].keys) { arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next` if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; else { PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator)); if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; } } var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () { var test = {}; // FF44- legacy iterators case return IteratorPrototype[ITERATOR].call(test) !== test; }); if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {}; else if (IS_PURE) IteratorPrototype = create(IteratorPrototype); // `%IteratorPrototype%[@@iterator]()` method // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator if (!isCallable(IteratorPrototype[ITERATOR])) { redefine(IteratorPrototype, ITERATOR, function () { return this; }); } module.exports = { IteratorPrototype: IteratorPrototype, BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS }; /***/ }), /* 137 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(18); module.exports = !fails(function () { function F() { /* empty */ } F.prototype.constructor = null; // eslint-disable-next-line es/no-object-getprototypeof -- required for testing return Object.getPrototypeOf(new F()) !== F.prototype; }); /***/ }), /* 138 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); var uncurryThis = __webpack_require__(15); var hiddenKeys = __webpack_require__(70); var isObject = __webpack_require__(33); var hasOwn = __webpack_require__(34); var defineProperty = __webpack_require__(37).f; var getOwnPropertyNamesModule = __webpack_require__(73); var getOwnPropertyNamesExternalModule = __webpack_require__(139); var isExtensible = __webpack_require__(174); var uid = __webpack_require__(85); var FREEZING = __webpack_require__(176); var REQUIRED = false; var METADATA = uid('meta'); var id = 0; var setMetadata = function (it) { defineProperty(it, METADATA, { value: { objectID: 'O' + id++, // object ID weakData: {} // weak collections IDs } }); }; var fastKey = function (it, create) { // return a primitive with prefix if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if (!hasOwn(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return 'F'; // not necessary to add metadata if (!create) return 'E'; // add missing metadata setMetadata(it); // return object ID } return it[METADATA].objectID; }; var getWeakData = function (it, create) { if (!hasOwn(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return true; // not necessary to add metadata if (!create) return false; // add missing metadata setMetadata(it); // return the store of weak collections IDs } return it[METADATA].weakData; }; // add metadata on freeze-family methods calling var onFreeze = function (it) { if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it); return it; }; var enable = function () { meta.enable = function () { /* empty */ }; REQUIRED = true; var getOwnPropertyNames = getOwnPropertyNamesModule.f; var splice = uncurryThis([].splice); var test = {}; test[METADATA] = 1; // prevent exposing of metadata key if (getOwnPropertyNames(test).length) { getOwnPropertyNamesModule.f = function (it) { var result = getOwnPropertyNames(it); for (var i = 0, length = result.length; i < length; i++) { if (result[i] === METADATA) { splice(result, i, 1); break; } } return result; }; $({ target: 'Object', stat: true, forced: true }, { getOwnPropertyNames: getOwnPropertyNamesExternalModule.f }); } }; var meta = module.exports = { enable: enable, fastKey: fastKey, getWeakData: getWeakData, onFreeze: onFreeze }; hiddenKeys[METADATA] = true; /***/ }), /* 139 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable es/no-object-getownpropertynames -- safe */ var classof = __webpack_require__(50); var toIndexedObject = __webpack_require__(39); var $getOwnPropertyNames = __webpack_require__(73).f; var arraySlice = __webpack_require__(113); var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function (it) { try { return $getOwnPropertyNames(it); } catch (error) { return arraySlice(windowNames); } }; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window module.exports.f = function getOwnPropertyNames(it) { return windowNames && classof(it) == 'Window' ? getWindowNames(it) : $getOwnPropertyNames(toIndexedObject(it)); }; /***/ }), /* 140 */ /***/ (function(module, exports, __webpack_require__) { var wellKnownSymbol = __webpack_require__(27); var Iterators = __webpack_require__(71); var ITERATOR = wellKnownSymbol('iterator'); var ArrayPrototype = Array.prototype; // check on default Array iterator module.exports = function (it) { return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it); }; /***/ }), /* 141 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var call = __webpack_require__(35); var aCallable = __webpack_require__(55); var anObject = __webpack_require__(32); var tryToString = __webpack_require__(89); var getIteratorMethod = __webpack_require__(115); var TypeError = global.TypeError; module.exports = function (argument, usingIterator) { var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument)); throw TypeError(tryToString(argument) + ' is not iterable'); }; /***/ }), /* 142 */ /***/ (function(module, exports, __webpack_require__) { var call = __webpack_require__(35); var anObject = __webpack_require__(32); var getMethod = __webpack_require__(59); module.exports = function (iterator, kind, value) { var innerResult, innerError; anObject(iterator); try { innerResult = getMethod(iterator, 'return'); if (!innerResult) { if (kind === 'throw') throw value; return value; } innerResult = call(innerResult, iterator); } catch (error) { innerError = true; innerResult = error; } if (kind === 'throw') throw value; if (innerError) throw innerResult; anObject(innerResult); return value; }; /***/ }), /* 143 */ /***/ (function(module, exports, __webpack_require__) { var isCallable = __webpack_require__(28); var isObject = __webpack_require__(33); var setPrototypeOf = __webpack_require__(97); // makes subclassing work correct for wrapped built-ins module.exports = function ($this, dummy, Wrapper) { var NewTarget, NewTargetPrototype; if ( // it can work only with native `setPrototypeOf` setPrototypeOf && // we haven't completely correct pre-ES6 way for getting `new.target`, so use this isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype ) setPrototypeOf($this, NewTargetPrototype); return $this; }; /***/ }), /* 144 */ /***/ (function(module, exports, __webpack_require__) { var redefine = __webpack_require__(44); module.exports = function (target, src, options) { for (var key in src) redefine(target, key, src[key], options); return target; }; /***/ }), /* 145 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(46); var definePropertyModule = __webpack_require__(37); var wellKnownSymbol = __webpack_require__(27); var DESCRIPTORS = __webpack_require__(36); var SPECIES = wellKnownSymbol('species'); module.exports = function (CONSTRUCTOR_NAME) { var Constructor = getBuiltIn(CONSTRUCTOR_NAME); var defineProperty = definePropertyModule.f; if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) { defineProperty(Constructor, SPECIES, { configurable: true, get: function () { return this; } }); } }; /***/ }), /* 146 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); var toIntegerOrInfinity = __webpack_require__(69); var toString = __webpack_require__(40); var requireObjectCoercible = __webpack_require__(45); var charAt = uncurryThis(''.charAt); var charCodeAt = uncurryThis(''.charCodeAt); var stringSlice = uncurryThis(''.slice); var createMethod = function (CONVERT_TO_STRING) { return function ($this, pos) { var S = toString(requireObjectCoercible($this)); var position = toIntegerOrInfinity(pos); var size = S.length; var first, second; if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; first = charCodeAt(S, position); return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? charAt(S, position) : first : CONVERT_TO_STRING ? stringSlice(S, position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; }; }; module.exports = { // `String.prototype.codePointAt` method // https://tc39.es/ecma262/#sec-string.prototype.codepointat codeAt: createMethod(false), // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at charAt: createMethod(true) }; /***/ }), /* 147 */ /***/ (function(module, exports) { // iterable DOM collections // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods module.exports = { CSSRuleList: 0, CSSStyleDeclaration: 0, CSSValueList: 0, ClientRectList: 0, DOMRectList: 0, DOMStringList: 0, DOMTokenList: 1, DataTransferItemList: 0, FileList: 0, HTMLAllCollection: 0, HTMLCollection: 0, HTMLFormElement: 0, HTMLSelectElement: 0, MediaList: 0, MimeTypeArray: 0, NamedNodeMap: 0, NodeList: 1, PaintRequestList: 0, Plugin: 0, PluginArray: 0, SVGLengthList: 0, SVGNumberList: 0, SVGPathSegList: 0, SVGPointList: 0, SVGStringList: 0, SVGTransformList: 0, SourceBufferList: 0, StyleSheetList: 0, TextTrackCueList: 0, TextTrackList: 0, TouchList: 0 }; /***/ }), /* 148 */ /***/ (function(module, exports, __webpack_require__) { // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList` var documentCreateElement = __webpack_require__(86); var classList = documentCreateElement('span').classList; var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype; module.exports = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype; /***/ }), /* 149 */ /***/ (function(module, exports, __webpack_require__) { var wellKnownSymbol = __webpack_require__(27); exports.f = wellKnownSymbol; /***/ }), /* 150 */ /***/ (function(module, exports, __webpack_require__) { var path = __webpack_require__(181); var hasOwn = __webpack_require__(34); var wrappedWellKnownSymbolModule = __webpack_require__(149); var defineProperty = __webpack_require__(37).f; module.exports = function (NAME) { var Symbol = path.Symbol || (path.Symbol = {}); if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, { value: wrappedWellKnownSymbolModule.f(NAME) }); }; /***/ }), /* 151 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(18); var global = __webpack_require__(7); // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError var $RegExp = global.RegExp; var UNSUPPORTED_Y = fails(function () { var re = $RegExp('a', 'y'); re.lastIndex = 2; return re.exec('abcd') != null; }); // UC Browser bug // https://github.com/zloirock/core-js/issues/1008 var MISSED_STICKY = UNSUPPORTED_Y || fails(function () { return !$RegExp('a', 'y').sticky; }); var BROKEN_CARET = UNSUPPORTED_Y || fails(function () { // https://bugzilla.mozilla.org/show_bug.cgi?id=773687 var re = $RegExp('^r', 'gy'); re.lastIndex = 2; return re.exec('str') != null; }); module.exports = { BROKEN_CARET: BROKEN_CARET, MISSED_STICKY: MISSED_STICKY, UNSUPPORTED_Y: UNSUPPORTED_Y }; /***/ }), /* 152 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var $includes = __webpack_require__(132).includes; var addToUnscopables = __webpack_require__(83); // `Array.prototype.includes` method // https://tc39.es/ecma262/#sec-array.prototype.includes $({ target: 'Array', proto: true }, { includes: function includes(el /* , fromIndex = 0 */) { return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } }); // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('includes'); /***/ }), /* 153 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var uncurryThis = __webpack_require__(15); var notARegExp = __webpack_require__(193); var requireObjectCoercible = __webpack_require__(45); var toString = __webpack_require__(40); var correctIsRegExpLogic = __webpack_require__(194); var stringIndexOf = uncurryThis(''.indexOf); // `String.prototype.includes` method // https://tc39.es/ecma262/#sec-string.prototype.includes $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, { includes: function includes(searchString /* , position = 0 */) { return !!~stringIndexOf( toString(requireObjectCoercible(this)), toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : undefined ); } }); /***/ }), /* 154 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(33); var classof = __webpack_require__(50); var wellKnownSymbol = __webpack_require__(27); var MATCH = wellKnownSymbol('match'); // `IsRegExp` abstract operation // https://tc39.es/ecma262/#sec-isregexp module.exports = function (it) { var isRegExp; return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp'); }; /***/ }), /* 155 */ /***/ (function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }), /* 156 */ /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(32); var aConstructor = __webpack_require__(157); var wellKnownSymbol = __webpack_require__(27); var SPECIES = wellKnownSymbol('species'); // `SpeciesConstructor` abstract operation // https://tc39.es/ecma262/#sec-speciesconstructor module.exports = function (O, defaultConstructor) { var C = anObject(O).constructor; var S; return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S); }; /***/ }), /* 157 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var isConstructor = __webpack_require__(100); var tryToString = __webpack_require__(89); var TypeError = global.TypeError; // `Assert: IsConstructor(argument) is true` module.exports = function (argument) { if (isConstructor(argument)) return argument; throw TypeError(tryToString(argument) + ' is not a constructor'); }; /***/ }), /* 158 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var $trim = __webpack_require__(159).trim; var forcedStringTrimMethod = __webpack_require__(195); // `String.prototype.trim` method // https://tc39.es/ecma262/#sec-string.prototype.trim $({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, { trim: function trim() { return $trim(this); } }); /***/ }), /* 159 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); var requireObjectCoercible = __webpack_require__(45); var toString = __webpack_require__(40); var whitespaces = __webpack_require__(160); var replace = uncurryThis(''.replace); var whitespace = '[' + whitespaces + ']'; var ltrim = RegExp('^' + whitespace + whitespace + '*'); var rtrim = RegExp(whitespace + whitespace + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation var createMethod = function (TYPE) { return function ($this) { var string = toString(requireObjectCoercible($this)); if (TYPE & 1) string = replace(string, ltrim, ''); if (TYPE & 2) string = replace(string, rtrim, ''); return string; }; }; module.exports = { // `String.prototype.{ trimLeft, trimStart }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimstart start: createMethod(1), // `String.prototype.{ trimRight, trimEnd }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimend end: createMethod(2), // `String.prototype.trim` method // https://tc39.es/ecma262/#sec-string.prototype.trim trim: createMethod(3) }; /***/ }), /* 160 */ /***/ (function(module, exports) { // a string of all valid unicode whitespaces module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; /***/ }), /* 161 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(35); var fixRegExpWellKnownSymbolLogic = __webpack_require__(122); var anObject = __webpack_require__(32); var toLength = __webpack_require__(90); var toString = __webpack_require__(40); var requireObjectCoercible = __webpack_require__(45); var getMethod = __webpack_require__(59); var advanceStringIndex = __webpack_require__(123); var regExpExec = __webpack_require__(124); // @@match logic fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) { return [ // `String.prototype.match` method // https://tc39.es/ecma262/#sec-string.prototype.match function match(regexp) { var O = requireObjectCoercible(this); var matcher = regexp == undefined ? undefined : getMethod(regexp, MATCH); return matcher ? call(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString(O)); }, // `RegExp.prototype[@@match]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@match function (string) { var rx = anObject(this); var S = toString(string); var res = maybeCallNative(nativeMatch, rx, S); if (res.done) return res.value; if (!rx.global) return regExpExec(rx, S); var fullUnicode = rx.unicode; rx.lastIndex = 0; var A = []; var n = 0; var result; while ((result = regExpExec(rx, S)) !== null) { var matchStr = toString(result[0]); A[n] = matchStr; if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); n++; } return n === 0 ? null : A; } ]; }); /***/ }), /* 162 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var apply = __webpack_require__(77); var bind = __webpack_require__(62); var isCallable = __webpack_require__(28); var hasOwn = __webpack_require__(34); var fails = __webpack_require__(18); var html = __webpack_require__(133); var arraySlice = __webpack_require__(101); var createElement = __webpack_require__(86); var IS_IOS = __webpack_require__(163); var IS_NODE = __webpack_require__(126); var set = global.setImmediate; var clear = global.clearImmediate; var process = global.process; var Dispatch = global.Dispatch; var Function = global.Function; var MessageChannel = global.MessageChannel; var String = global.String; var counter = 0; var queue = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; var location, defer, channel, port; try { // Deno throws a ReferenceError on `location` access without `--location` flag location = global.location; } catch (error) { /* empty */ } var run = function (id) { if (hasOwn(queue, id)) { var fn = queue[id]; delete queue[id]; fn(); } }; var runner = function (id) { return function () { run(id); }; }; var listener = function (event) { run(event.data); }; var post = function (id) { // old engines have not location.origin global.postMessage(String(id), location.protocol + '//' + location.host); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if (!set || !clear) { set = function setImmediate(fn) { var args = arraySlice(arguments, 1); queue[++counter] = function () { apply(isCallable(fn) ? fn : Function(fn), undefined, args); }; defer(counter); return counter; }; clear = function clearImmediate(id) { delete queue[id]; }; // Node.js 0.8- if (IS_NODE) { defer = function (id) { process.nextTick(runner(id)); }; // Sphere (JS game engine) Dispatch API } else if (Dispatch && Dispatch.now) { defer = function (id) { Dispatch.now(runner(id)); }; // Browsers with MessageChannel, includes WebWorkers // except iOS - https://github.com/zloirock/core-js/issues/624 } else if (MessageChannel && !IS_IOS) { channel = new MessageChannel(); port = channel.port2; channel.port1.onmessage = listener; defer = bind(port.postMessage, port); // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' } else if ( global.addEventListener && isCallable(global.postMessage) && !global.importScripts && location && location.protocol !== 'file:' && !fails(post) ) { defer = post; global.addEventListener('message', listener, false); // IE8- } else if (ONREADYSTATECHANGE in createElement('script')) { defer = function (id) { html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () { html.removeChild(this); run(id); }; }; // Rest old browsers } else { defer = function (id) { setTimeout(runner(id), 0); }; } } module.exports = { set: set, clear: clear }; /***/ }), /* 163 */ /***/ (function(module, exports, __webpack_require__) { var userAgent = __webpack_require__(53); module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent); /***/ }), /* 164 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aCallable = __webpack_require__(55); var PromiseCapability = function (C) { var resolve, reject; this.promise = new C(function ($$resolve, $$reject) { if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); resolve = $$resolve; reject = $$reject; }); this.resolve = aCallable(resolve); this.reject = aCallable(reject); }; // `NewPromiseCapability` abstract operation // https://tc39.es/ecma262/#sec-newpromisecapability module.exports.f = function (C) { return new PromiseCapability(C); }; /***/ }), /* 165 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /** * This method returns `false`. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {boolean} Returns `false`. * @example * * _.times(2, _.stubFalse); * // => [false, false] */ function stubFalse() { return false; } /* harmony default export */ __webpack_exports__["a"] = (stubFalse); /***/ }), /* 166 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/* unused harmony export FULFILLED */ /* unused harmony export IDENTITY */ /* unused harmony export NOOP */ /* unused harmony export ObservableGroupMap */ /* unused harmony export PENDING */ /* unused harmony export REJECTED */ /* unused harmony export ViewModel */ /* unused harmony export actionAsync */ /* unused harmony export addHiddenProp */ /* unused harmony export asyncAction */ /* unused harmony export chunkProcessor */ /* unused harmony export computedFn */ /* unused harmony export createTransformer */ /* unused harmony export createViewModel */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return deepObserve; }); /* unused harmony export deprecated */ /* unused harmony export expr */ /* unused harmony export fail */ /* unused harmony export fromPromise */ /* unused harmony export fromResource */ /* unused harmony export fromStream */ /* unused harmony export getAllMethodsAndProperties */ /* unused harmony export invariant */ /* unused harmony export isPromiseBasedObservable */ /* unused harmony export keepAlive */ /* unused harmony export lazyObservable */ /* unused harmony export moveItem */ /* unused harmony export now */ /* unused harmony export queueProcessor */ /* unused harmony export task */ /* unused harmony export toStream */ /* unused harmony export whenAsync */ /* unused harmony export whenWithTimeout */ /* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); var NOOP = function () { }; var IDENTITY = function (_) { return _; }; function fail$1(message) { throw new Error("[mobx-utils] " + message); } function invariant(cond, message) { if (message === void 0) { message = "Illegal state"; } if (!cond) fail$1(message); } var deprecatedMessages = []; function deprecated(msg) { if (deprecatedMessages.indexOf(msg) !== -1) return; deprecatedMessages.push(msg); console.error("[mobx-utils] Deprecated: " + msg); } function addHiddenProp(object, propName, value) { Object.defineProperty(object, propName, { enumerable: false, writable: true, configurable: true, value: value, }); } var deepFields = function (x) { return (x && x !== Object.prototype && Object.getOwnPropertyNames(x).concat(deepFields(Object.getPrototypeOf(x)) || [])); }; var distinctDeepFields = function (x) { var deepFieldsIndistinct = deepFields(x); var deepFieldsDistinct = deepFieldsIndistinct.filter(function (item, index) { return deepFieldsIndistinct.indexOf(item) === index; }); return deepFieldsDistinct; }; var getAllMethodsAndProperties = function (x) { return distinctDeepFields(x).filter(function (name) { return name !== "constructor" && !~name.indexOf("__"); }); }; var PENDING = "pending"; var FULFILLED = "fulfilled"; var REJECTED = "rejected"; function caseImpl(handlers) { switch (this.state) { case PENDING: return handlers.pending && handlers.pending(this.value); case REJECTED: return handlers.rejected && handlers.rejected(this.value); case FULFILLED: return handlers.fulfilled ? handlers.fulfilled(this.value) : this.value; } } /** * `fromPromise` takes a Promise, extends it with 2 observable properties that track * the status of the promise and returns it. The returned object has the following observable properties: * - `value`: either the initial value, the value the Promise resolved to, or the value the Promise was rejected with. use `.state` if you need to be able to tell the difference. * - `state`: one of `"pending"`, `"fulfilled"` or `"rejected"` * * And the following methods: * - `case({fulfilled, rejected, pending})`: maps over the result using the provided handlers, or returns `undefined` if a handler isn't available for the current promise state. * - `then((value: TValue) => TResult1 | PromiseLike, [(rejectReason: any) => any])`: chains additional handlers to the provided promise. * * The returned object implements `PromiseLike`, so you can chain additional `Promise` handlers using `then`. You may also use it with `await` in `async` functions. * * Note that the status strings are available as constants: * `mobxUtils.PENDING`, `mobxUtils.REJECTED`, `mobxUtil.FULFILLED` * * fromPromise takes an optional second argument, a previously created `fromPromise` based observable. * This is useful to replace one promise based observable with another, without going back to an intermediate * "pending" promise state while fetching data. For example: * * @example * \@observer * class SearchResults extends React.Component { * \@observable.ref searchResults * * componentDidUpdate(nextProps) { * if (nextProps.query !== this.props.query) * this.searchResults = fromPromise( * window.fetch("/search?q=" + nextProps.query), * // by passing, we won't render a pending state if we had a successful search query before * // rather, we will keep showing the previous search results, until the new promise resolves (or rejects) * this.searchResults * ) * } * * render() { * return this.searchResults.case({ * pending: (staleValue) => { * return staleValue || "searching" // <- value might set to previous results while the promise is still pending * }, * fulfilled: (value) => { * return value // the fresh results * }, * rejected: (error) => { * return "Oops: " + error * } * }) * } * } * * Observable promises can be created immediately in a certain state using * `fromPromise.reject(reason)` or `fromPromise.resolve(value?)`. * The main advantage of `fromPromise.resolve(value)` over `fromPromise(Promise.resolve(value))` is that the first _synchronously_ starts in the desired state. * * It is possible to directly create a promise using a resolve, reject function: * `fromPromise((resolve, reject) => setTimeout(() => resolve(true), 1000))` * * @example * const fetchResult = fromPromise(fetch("http://someurl")) * * // combine with when.. * when( * () => fetchResult.state !== "pending", * () => { * console.log("Got ", fetchResult.value) * } * ) * * // or a mobx-react component.. * const myComponent = observer(({ fetchResult }) => { * switch(fetchResult.state) { * case "pending": return
Loading...
* case "rejected": return
Ooops... {fetchResult.value}
* case "fulfilled": return
Gotcha: {fetchResult.value}
* } * }) * * // or using the case method instead of switch: * * const myComponent = observer(({ fetchResult }) => * fetchResult.case({ * pending: () =>
Loading...
, * rejected: error =>
Ooops.. {error}
, * fulfilled: value =>
Gotcha: {value}
, * })) * * // chain additional handler(s) to the resolve/reject: * * fetchResult.then( * (result) => doSomeTransformation(result), * (rejectReason) => console.error('fetchResult was rejected, reason: ' + rejectReason) * ).then( * (transformedResult) => console.log('transformed fetchResult: ' + transformedResult) * ) * * @param {IThenable} promise The promise which will be observed * @param {IThenable} oldPromise? The previously observed promise * @returns {IPromiseBasedObservable} */ function fromPromise(origPromise, oldPromise) { invariant(arguments.length <= 2, "fromPromise expects up to two arguments"); invariant(typeof origPromise === "function" || (typeof origPromise === "object" && origPromise && typeof origPromise.then === "function"), "Please pass a promise or function to fromPromise"); if (origPromise.isPromiseBasedObservable === true) return origPromise; if (typeof origPromise === "function") { // If it is a (reject, resolve function, wrap it) origPromise = new Promise(origPromise); } var promise = origPromise; origPromise.then(Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"])("observableFromPromise-resolve", function (value) { promise.value = value; promise.state = FULFILLED; }), Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"])("observableFromPromise-reject", function (reason) { promise.value = reason; promise.state = REJECTED; })); promise.isPromiseBasedObservable = true; promise.case = caseImpl; var oldData = oldPromise && oldPromise.state === FULFILLED ? oldPromise.value : undefined; Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* extendObservable */ "q"])(promise, { value: oldData, state: PENDING, }, {}, { deep: false }); return promise; } (function (fromPromise) { fromPromise.reject = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"])("fromPromise.reject", function (reason) { var p = fromPromise(Promise.reject(reason)); p.state = REJECTED; p.value = reason; return p; }); function resolveBase(value) { if (value === void 0) { value = undefined; } var p = fromPromise(Promise.resolve(value)); p.state = FULFILLED; p.value = value; return p; } fromPromise.resolve = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"])("fromPromise.resolve", resolveBase); })(fromPromise || (fromPromise = {})); /** * Returns true if the provided value is a promise-based observable. * @param value any * @returns {boolean} */ function isPromiseBasedObservable(value) { return value && value.isPromiseBasedObservable === true; } var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; /** * Moves an item from one position to another, checking that the indexes given are within bounds. * * @example * const source = observable([1, 2, 3]) * moveItem(source, 0, 1) * console.log(source.map(x => x)) // [2, 1, 3] * * @export * @param {ObservableArray} target * @param {number} fromIndex * @param {number} toIndex * @returns {ObservableArray} */ function moveItem(target, fromIndex, toIndex) { checkIndex(target, fromIndex); checkIndex(target, toIndex); if (fromIndex === toIndex) { return; } var oldItems = target[mobx__WEBPACK_IMPORTED_MODULE_0__[/* $mobx */ "a"]].values; var newItems; if (fromIndex < toIndex) { newItems = __spreadArrays(oldItems.slice(0, fromIndex), oldItems.slice(fromIndex + 1, toIndex + 1), [ oldItems[fromIndex] ], oldItems.slice(toIndex + 1)); } else { // toIndex < fromIndex newItems = __spreadArrays(oldItems.slice(0, toIndex), [ oldItems[fromIndex] ], oldItems.slice(toIndex, fromIndex), oldItems.slice(fromIndex + 1)); } target.replace(newItems); return target; } /** * Checks whether the specified index is within bounds. Throws if not. * * @private * @param {ObservableArray} target * @param {number }index */ function checkIndex(target, index) { if (index < 0) { throw new Error("[mobx.array] Index out of bounds: " + index + " is negative"); } var length = target[mobx__WEBPACK_IMPORTED_MODULE_0__[/* $mobx */ "a"]].values.length; if (index >= length) { throw new Error("[mobx.array] Index out of bounds: " + index + " is not smaller than " + length); } } /** * `lazyObservable` creates an observable around a `fetch` method that will not be invoked * until the observable is needed the first time. * The fetch method receives a `sink` callback which can be used to replace the * current value of the lazyObservable. It is allowed to call `sink` multiple times * to keep the lazyObservable up to date with some external resource. * * Note that it is the `current()` call itself which is being tracked by MobX, * so make sure that you don't dereference to early. * * @example * const userProfile = lazyObservable( * sink => fetch("/myprofile").then(profile => sink(profile)) * ) * * // use the userProfile in a React component: * const Profile = observer(({ userProfile }) => * userProfile.current() === undefined * ?
Loading user profile...
* :
{userProfile.current().displayName}
* ) * * // triggers refresh the userProfile * userProfile.refresh() * * @param {(sink: (newValue: T) => void) => void} fetch method that will be called the first time the value of this observable is accessed. The provided sink can be used to produce a new value, synchronously or asynchronously * @param {T} [initialValue=undefined] optional initialValue that will be returned from `current` as long as the `sink` has not been called at least once * @returns {{ * current(): T, * refresh(): T, * reset(): T * pending: boolean * }} */ function lazyObservable(fetch, initialValue) { if (initialValue === void 0) { initialValue = undefined; } var started = false; var value = mobx__WEBPACK_IMPORTED_MODULE_0__[/* observable */ "C"].box(initialValue, { deep: false }); var pending = mobx__WEBPACK_IMPORTED_MODULE_0__[/* observable */ "C"].box(false); var currentFnc = function () { if (!started) { started = true; Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* _allowStateChanges */ "d"])(true, function () { pending.set(true); }); fetch(function (newValue) { Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* _allowStateChanges */ "d"])(true, function () { value.set(newValue); pending.set(false); }); }); } return value.get(); }; var resetFnc = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"])("lazyObservable-reset", function () { started = false; value.set(initialValue); return value.get(); }); return { current: currentFnc, refresh: function () { if (started) { started = false; return currentFnc(); } else { return value.get(); } }, reset: function () { return resetFnc(); }, get pending() { return pending.get(); }, }; } /** * `fromResource` creates an observable whose current state can be inspected using `.current()`, * and which can be kept in sync with some external datasource that can be subscribed to. * * The created observable will only subscribe to the datasource if it is in use somewhere, * (un)subscribing when needed. To enable `fromResource` to do that two callbacks need to be provided, * one to subscribe, and one to unsubscribe. The subscribe callback itself will receive a `sink` callback, which can be used * to update the current state of the observable, allowing observes to react. * * Whatever is passed to `sink` will be returned by `current()`. The values passed to the sink will not be converted to * observables automatically, but feel free to do so. * It is the `current()` call itself which is being tracked, * so make sure that you don't dereference to early. * * For inspiration, an example integration with the apollo-client on [github](https://github.com/apollostack/apollo-client/issues/503#issuecomment-241101379), * or the [implementation](https://github.com/mobxjs/mobx-utils/blob/1d17cf7f7f5200937f68cc0b5e7ec7f3f71dccba/src/now.ts#L43-L57) of `mobxUtils.now` * * The following example code creates an observable that connects to a `dbUserRecord`, * which comes from an imaginary database and notifies when it has changed. * * @example * function createObservableUser(dbUserRecord) { * let currentSubscription; * return fromResource( * (sink) => { * // sink the current state * sink(dbUserRecord.fields) * // subscribe to the record, invoke the sink callback whenever new data arrives * currentSubscription = dbUserRecord.onUpdated(() => { * sink(dbUserRecord.fields) * }) * }, * () => { * // the user observable is not in use at the moment, unsubscribe (for now) * dbUserRecord.unsubscribe(currentSubscription) * } * ) * } * * // usage: * const myUserObservable = createObservableUser(myDatabaseConnector.query("name = 'Michel'")) * * // use the observable in autorun * autorun(() => { * // printed everytime the database updates its records * console.log(myUserObservable.current().displayName) * }) * * // ... or a component * const userComponent = observer(({ user }) => *
{user.current().displayName}
* ) * * @export * @template T * @param {(sink: (newValue: T) => void) => void} subscriber * @param {IDisposer} [unsubscriber=NOOP] * @param {T} [initialValue=undefined] the data that will be returned by `get()` until the `sink` has emitted its first data * @returns {{ * current(): T; * dispose(): void; * isAlive(): boolean; * }} */ function fromResource(subscriber, unsubscriber, initialValue) { if (unsubscriber === void 0) { unsubscriber = NOOP; } if (initialValue === void 0) { initialValue = undefined; } var isActive = false; var isDisposed = false; var value = initialValue; var suspender = function () { if (isActive) { isActive = false; unsubscriber(); } }; var atom = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* createAtom */ "o"])("ResourceBasedObservable", function () { invariant(!isActive && !isDisposed); isActive = true; subscriber(function (newValue) { Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* _allowStateChanges */ "d"])(true, function () { value = newValue; atom.reportChanged(); }); }); }, suspender); return { current: function () { invariant(!isDisposed, "subscribingObservable has already been disposed"); var isBeingTracked = atom.reportObserved(); if (!isBeingTracked && !isActive) console.warn("Called `get` of a subscribingObservable outside a reaction. Current value will be returned but no new subscription has started"); return value; }, dispose: function () { isDisposed = true; suspender(); }, isAlive: function () { return isActive; }, }; } var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; function observableSymbol() { return (typeof Symbol === "function" && Symbol.observable) || "@@observable"; } /** * Converts an expression to an observable stream (a.k.a. TC 39 Observable / RxJS observable). * The provided expression is tracked by mobx as long as there are subscribers, automatically * emitting when new values become available. The expressions respect (trans)actions. * * @example * * const user = observable({ * firstName: "C.S", * lastName: "Lewis" * }) * * Rx.Observable * .from(mobxUtils.toStream(() => user.firstname + user.lastName)) * .scan(nameChanges => nameChanges + 1, 0) * .subscribe(nameChanges => console.log("Changed name ", nameChanges, "times")) * * @export * @template T * @param {() => T} expression * @param {boolean} fireImmediately (by default false) * @returns {IObservableStream} */ function toStream(expression, fireImmediately) { var _a; if (fireImmediately === void 0) { fireImmediately = false; } var computedValue = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* computed */ "m"])(expression); return _a = { subscribe: function (observer) { if ("function" === typeof observer) { return { unsubscribe: computedValue.observe(function (_a) { var newValue = _a.newValue; return observer(newValue); }, fireImmediately), }; } if (observer && "object" === typeof observer && observer.next) { return { unsubscribe: computedValue.observe(function (_a) { var newValue = _a.newValue; return observer.next(newValue); }, fireImmediately), }; } return { unsubscribe: function () { }, }; } }, _a[observableSymbol()] = function () { return this; }, _a; } var StreamListener = /** @class */ (function () { function StreamListener(observable, initialValue) { var _this = this; Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* runInAction */ "G"])(function () { _this.current = initialValue; _this.subscription = observable.subscribe(_this); }); } StreamListener.prototype.dispose = function () { if (this.subscription) { this.subscription.unsubscribe(); } }; StreamListener.prototype.next = function (value) { this.current = value; }; StreamListener.prototype.complete = function () { this.dispose(); }; StreamListener.prototype.error = function (value) { this.current = value; this.dispose(); }; __decorate([ mobx__WEBPACK_IMPORTED_MODULE_0__[/* observable */ "C"].ref ], StreamListener.prototype, "current", void 0); __decorate([ mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"].bound ], StreamListener.prototype, "next", null); __decorate([ mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"].bound ], StreamListener.prototype, "complete", null); __decorate([ mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"].bound ], StreamListener.prototype, "error", null); return StreamListener; }()); function fromStream(observable, initialValue) { if (initialValue === void 0) { initialValue = undefined; } return new StreamListener(observable, initialValue); } var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var RESERVED_NAMES = ["model", "reset", "submit", "isDirty", "isPropertyDirty", "resetProperty"]; var ViewModel = /** @class */ (function () { function ViewModel(model) { var _this = this; this.model = model; this.localValues = mobx__WEBPACK_IMPORTED_MODULE_0__[/* observable */ "C"].map({}); this.localComputedValues = mobx__WEBPACK_IMPORTED_MODULE_0__[/* observable */ "C"].map({}); this.isPropertyDirty = function (key) { return _this.localValues.has(key); }; invariant(Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isObservableObject */ "A"])(model), "createViewModel expects an observable object"); // use this helper as Object.getOwnPropertyNames doesn't return getters getAllMethodsAndProperties(model).forEach(function (key) { if (key === mobx__WEBPACK_IMPORTED_MODULE_0__[/* $mobx */ "a"] || key === "__mobxDidRunLazyInitializers") { return; } invariant(RESERVED_NAMES.indexOf(key) === -1, "The propertyname " + key + " is reserved and cannot be used with viewModels"); if (Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isComputedProp */ "w"])(model, key)) { var derivation = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* _getAdministration */ "h"])(model, key).derivation; // Fixme: there is no clear api to get the derivation _this.localComputedValues.set(key, Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* computed */ "m"])(derivation.bind(_this))); } var descriptor = Object.getOwnPropertyDescriptor(model, key); var additionalDescriptor = descriptor ? { enumerable: descriptor.enumerable } : {}; Object.defineProperty(_this, key, __assign(__assign({}, additionalDescriptor), { configurable: true, get: function () { if (Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isComputedProp */ "w"])(model, key)) return _this.localComputedValues.get(key).get(); if (_this.isPropertyDirty(key)) return _this.localValues.get(key); else return _this.model[key]; }, set: Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"])(function (value) { if (value !== _this.model[key]) { _this.localValues.set(key, value); } else { _this.localValues.delete(key); } }) })); }); } Object.defineProperty(ViewModel.prototype, "isDirty", { get: function () { return this.localValues.size > 0; }, enumerable: false, configurable: true }); Object.defineProperty(ViewModel.prototype, "changedValues", { get: function () { return this.localValues.toJS(); }, enumerable: false, configurable: true }); ViewModel.prototype.submit = function () { var _this = this; Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* keys */ "B"])(this.localValues).forEach(function (key) { var source = _this.localValues.get(key); var destination = _this.model[key]; if (Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isObservableArray */ "y"])(destination)) { destination.replace(source); } else if (Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isObservableMap */ "z"])(destination)) { destination.clear(); destination.merge(source); } else if (!Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isComputed */ "v"])(source)) { _this.model[key] = source; } }); this.localValues.clear(); }; ViewModel.prototype.reset = function () { this.localValues.clear(); }; ViewModel.prototype.resetProperty = function (key) { this.localValues.delete(key); }; __decorate$1([ mobx__WEBPACK_IMPORTED_MODULE_0__[/* computed */ "m"] ], ViewModel.prototype, "isDirty", null); __decorate$1([ mobx__WEBPACK_IMPORTED_MODULE_0__[/* computed */ "m"] ], ViewModel.prototype, "changedValues", null); __decorate$1([ mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"].bound ], ViewModel.prototype, "submit", null); __decorate$1([ mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"].bound ], ViewModel.prototype, "reset", null); __decorate$1([ mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"].bound ], ViewModel.prototype, "resetProperty", null); return ViewModel; }()); /** * `createViewModel` takes an object with observable properties (model) * and wraps a viewmodel around it. The viewmodel proxies all enumerable properties of the original model with the following behavior: * - as long as no new value has been assigned to the viewmodel property, the original property will be returned. * - any future change in the model will be visible in the viewmodel as well unless the viewmodel property was dirty at the time of the attempted change. * - once a new value has been assigned to a property of the viewmodel, that value will be returned during a read of that property in the future. However, the original model remain untouched until `submit()` is called. * * The viewmodel exposes the following additional methods, besides all the enumerable properties of the model: * - `submit()`: copies all the values of the viewmodel to the model and resets the state * - `reset()`: resets the state of the viewmodel, abandoning all local modifications * - `resetProperty(propName)`: resets the specified property of the viewmodel * - `isDirty`: observable property indicating if the viewModel contains any modifications * - `isPropertyDirty(propName)`: returns true if the specified property is dirty * - `changedValues`: returns a key / value map with the properties that have been changed in the model so far * - `model`: The original model object for which this viewModel was created * * You may use observable arrays, maps and objects with `createViewModel` but keep in mind to assign fresh instances of those to the viewmodel's properties, otherwise you would end up modifying the properties of the original model. * Note that if you read a non-dirty property, viewmodel only proxies the read to the model. You therefore need to assign a fresh instance not only the first time you make the assignment but also after calling `reset()` or `submit()`. * * @example * class Todo { * \@observable title = "Test" * } * * const model = new Todo() * const viewModel = createViewModel(model); * * autorun(() => console.log(viewModel.model.title, ",", viewModel.title)) * // prints "Test, Test" * model.title = "Get coffee" * // prints "Get coffee, Get coffee", viewModel just proxies to model * viewModel.title = "Get tea" * // prints "Get coffee, Get tea", viewModel's title is now dirty, and the local value will be printed * viewModel.submit() * // prints "Get tea, Get tea", changes submitted from the viewModel to the model, viewModel is proxying again * viewModel.title = "Get cookie" * // prints "Get tea, Get cookie" // viewModel has diverged again * viewModel.reset() * // prints "Get tea, Get tea", changes of the viewModel have been abandoned * * @param {T} model * @returns {(T & IViewModel)} * ``` */ function createViewModel(model) { return new ViewModel(model); } /** * Like normal `when`, except that this `when` will automatically dispose if the condition isn't met within a certain amount of time. * * @example * test("expect store to load", t => { * const store = { * items: [], * loaded: false * } * fetchDataForStore((data) => { * store.items = data; * store.loaded = true; * }) * whenWithTimeout( * () => store.loaded * () => t.end() * 2000, * () => t.fail("store didn't load with 2 secs") * ) * }) * * * @export * @param {() => boolean} expr see when, the expression to await * @param {() => void} action see when, the action to execut when expr returns truthy * @param {number} [timeout=10000] maximum amount when spends waiting before giving up * @param {any} [onTimeout=() => {}] the ontimeout handler will be called if the condition wasn't met within the given time * @returns {IDisposer} disposer function that can be used to cancel the when prematurely. Neither action or onTimeout will be fired if disposed */ function whenWithTimeout(expr, action, timeout, onTimeout) { if (timeout === void 0) { timeout = 10000; } if (onTimeout === void 0) { onTimeout = function () { }; } deprecated("whenWithTimeout is deprecated, use mobx.when with timeout option instead"); return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* when */ "M"])(expr, action, { timeout: timeout, onError: onTimeout, }); } /** * MobX normally suspends any computed value that is not in use by any reaction, * and lazily re-evaluates the expression if needed outside a reaction while not in use. * `keepAlive` marks a computed value as always in use, meaning that it will always fresh, but never disposed automatically. * * @example * const obj = observable({ * number: 3, * doubler: function() { return this.number * 2 } * }) * const stop = keepAlive(obj, "doubler") * * @param {Object} target an object that has a computed property, created by `@computed` or `extendObservable` * @param {string} property the name of the property to keep alive * @returns {IDisposer} stops this keep alive so that the computed value goes back to normal behavior */ /** * @example * const number = observable(3) * const doubler = computed(() => number.get() * 2) * const stop = keepAlive(doubler) * // doubler will now stay in sync reactively even when there are no further observers * stop() * // normal behavior, doubler results will be recomputed if not observed but needed, but lazily * * @param {IComputedValue} computedValue created using the `computed` function * @returns {IDisposer} stops this keep alive so that the computed value goes back to normal behavior */ function keepAlive(_1, _2) { var computed = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* getAtom */ "s"])(_1, _2); if (!computed) throw new Error("No computed provided, please provide an object created with `computed(() => expr)` or an object + property name"); return computed.observe(function () { }); } /** * `queueProcessor` takes an observable array, observes it and calls `processor` * once for each item added to the observable array, optionally debouncing the action * * @example * const pendingNotifications = observable([]) * const stop = queueProcessor(pendingNotifications, msg => { * // show Desktop notification * new Notification(msg); * }) * * // usage: * pendingNotifications.push("test!") * * @param {T[]} observableArray observable array instance to track * @param {(item: T) => void} processor action to call per item * @param {number} [debounce=0] optional debounce time in ms. With debounce 0 the processor will run synchronously * @returns {IDisposer} stops the processor */ function queueProcessor(observableArray, processor, debounce) { if (debounce === void 0) { debounce = 0; } if (!Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isObservableArray */ "y"])(observableArray)) throw new Error("Expected observable array as first argument"); if (!Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isAction */ "u"])(processor)) processor = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"])("queueProcessor", processor); var runner = function () { // construct a final set var items = observableArray.slice(0); // clear the queue for next iteration Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* runInAction */ "G"])(function () { return observableArray.splice(0); }); // fire processor items.forEach(processor); }; if (debounce > 0) return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* autorun */ "l"])(runner, { delay: debounce }); else return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* autorun */ "l"])(runner); } /** * `chunkProcessor` takes an observable array, observes it and calls `processor` * once for a chunk of items added to the observable array, optionally deboucing the action. * The maximum chunk size can be limited by number. * This allows both, splitting larger into smaller chunks or (when debounced) combining smaller * chunks and/or single items into reasonable chunks of work. * * @example * const trackedActions = observable([]) * const stop = chunkProcessor(trackedActions, chunkOfMax10Items => { * sendTrackedActionsToServer(chunkOfMax10Items); * }, 100, 10) * * // usage: * trackedActions.push("scrolled") * trackedActions.push("hoveredButton") * // when both pushes happen within 100ms, there will be only one call to server * * @param {T[]} observableArray observable array instance to track * @param {(item: T[]) => void} processor action to call per item * @param {number} [debounce=0] optional debounce time in ms. With debounce 0 the processor will run synchronously * @param {number} [maxChunkSize=0] optionally do not call on full array but smaller chunks. With 0 it will process the full array. * @returns {IDisposer} stops the processor */ function chunkProcessor(observableArray, processor, debounce, maxChunkSize) { if (debounce === void 0) { debounce = 0; } if (maxChunkSize === void 0) { maxChunkSize = 0; } if (!Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isObservableArray */ "y"])(observableArray)) throw new Error("Expected observable array as first argument"); if (!Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isAction */ "u"])(processor)) processor = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* action */ "k"])("chunkProcessor", processor); var runner = function () { var _loop_1 = function () { var chunkSize = maxChunkSize === 0 ? observableArray.length : Math.min(observableArray.length, maxChunkSize); // construct a final set var items = observableArray.slice(0, chunkSize); // clear the slice for next iteration Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* runInAction */ "G"])(function () { return observableArray.splice(0, chunkSize); }); // fire processor processor(items); }; while (observableArray.length > 0) { _loop_1(); } }; if (debounce > 0) return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* autorun */ "l"])(runner, { delay: debounce }); else return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* autorun */ "l"])(runner); } var tickers = {}; /** * Returns the current date time as epoch number. * The date time is read from an observable which is updated automatically after the given interval. * So basically it treats time as an observable. * * The function takes an interval as parameter, which indicates how often `now()` will return a new value. * If no interval is given, it will update each second. If "frame" is specified, it will update each time a * `requestAnimationFrame` is available. * * Multiple clocks with the same interval will automatically be synchronized. * * Countdown example: https://jsfiddle.net/mweststrate/na0qdmkw/ * * @example * * const start = Date.now() * * autorun(() => { * console.log("Seconds elapsed: ", (mobxUtils.now() - start) / 1000) * }) * * * @export * @param {(number | "frame")} [interval=1000] interval in milliseconds about how often the interval should update * @returns */ function now(interval) { if (interval === void 0) { interval = 1000; } if (!Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* _isComputingDerivation */ "i"])()) { // See #40 return Date.now(); } if (!tickers[interval]) { if (typeof interval === "number") tickers[interval] = createIntervalTicker(interval); else tickers[interval] = createAnimationFrameTicker(); } return tickers[interval].current(); } function createIntervalTicker(interval) { var subscriptionHandle; return fromResource(function (sink) { sink(Date.now()); subscriptionHandle = setInterval(function () { return sink(Date.now()); }, interval); }, function () { clearInterval(subscriptionHandle); }, Date.now()); } function createAnimationFrameTicker() { var frameBasedTicker = fromResource(function (sink) { sink(Date.now()); function scheduleTick() { window.requestAnimationFrame(function () { sink(Date.now()); if (frameBasedTicker.isAlive()) scheduleTick(); }); } scheduleTick(); }, function () { }, Date.now()); return frameBasedTicker; } var __assign$1 = (undefined && undefined.__assign) || function () { __assign$1 = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign$1.apply(this, arguments); }; /** * _deprecated_ this functionality can now be found as `flow` in the mobx package. However, `flow` is not applicable as decorator, where `asyncAction` still is. * * * * `asyncAction` takes a generator function and automatically wraps all parts of the process in actions. See the examples below. * `asyncAction` can be used both as decorator or to wrap functions. * * - It is important that `asyncAction should always be used with a generator function (recognizable as `function*` or `*name` syntax) * - Each yield statement should return a Promise. The generator function will continue as soon as the promise settles, with the settled value * - When the generator function finishes, you can return a normal value. The `asyncAction` wrapped function will always produce a promise delivering that value. * * When using the mobx devTools, an asyncAction will emit `action` events with names like: * * `"fetchUsers - runid: 6 - init"` * * `"fetchUsers - runid: 6 - yield 0"` * * `"fetchUsers - runid: 6 - yield 1"` * * The `runId` represents the generator instance. In other words, if `fetchUsers` is invoked multiple times concurrently, the events with the same `runid` belong together. * The `yield` number indicates the progress of the generator. `init` indicates spawning (it won't do anything, but you can find the original arguments of the `asyncAction` here). * `yield 0` ... `yield n` indicates the code block that is now being executed. `yield 0` is before the first `yield`, `yield 1` after the first one etc. Note that yield numbers are not determined lexically but by the runtime flow. * * `asyncActions` requires `Promise` and `generators` to be available on the target environment. Polyfill `Promise` if needed. Both TypeScript and Babel can compile generator functions down to ES5. * * N.B. due to a [babel limitation](https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy/issues/26), in Babel generatos cannot be combined with decorators. See also [#70](https://github.com/mobxjs/mobx-utils/issues/70) * * * @example * import {asyncAction} from "mobx-utils" * * let users = [] * * const fetchUsers = asyncAction("fetchUsers", function* (url) { * const start = Date.now() * const data = yield window.fetch(url) * users = yield data.json() * return start - Date.now() * }) * * fetchUsers("http://users.com").then(time => { * console.dir("Got users", users, "in ", time, "ms") * }) * * @example * import {asyncAction} from "mobx-utils" * * mobx.configure({ enforceActions: "observed" }) // don't allow state modifications outside actions * * class Store { * \@observable githubProjects = [] * \@observable = "pending" // "pending" / "done" / "error" * * \@asyncAction * *fetchProjects() { // <- note the star, this a generator function! * this.githubProjects = [] * this.state = "pending" * try { * const projects = yield fetchGithubProjectsSomehow() // yield instead of await * const filteredProjects = somePreprocessing(projects) * // the asynchronous blocks will automatically be wrapped actions * this.state = "done" * this.githubProjects = filteredProjects * } catch (error) { * this.state = "error" * } * } * } * * @export * @returns {Promise} */ function asyncAction(arg1, arg2) { // decorator if (typeof arguments[1] === "string") { var name_1 = arguments[1]; var descriptor_1 = arguments[2]; if (descriptor_1 && descriptor_1.value) { return Object.assign({}, descriptor_1, { value: Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* flow */ "r"])(descriptor_1.value), }); } else { return Object.assign({}, descriptor_1, { set: function (v) { Object.defineProperty(this, name_1, __assign$1(__assign$1({}, descriptor_1), { value: Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* flow */ "r"])(v) })); }, }); } } // direct invocation var generator = typeof arg1 === "string" ? arg2 : arg1; var name = typeof arg1 === "string" ? arg1 : generator.name || ""; deprecated("asyncAction is deprecated. use mobx.flow instead"); return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* flow */ "r"])(generator); // name get's dropped.. } /** * _deprecated_ whenAsync is deprecated, use mobx.when without effect instead. * * Like normal `when`, except that this `when` will return a promise that resolves when the expression becomes truthy * * @example * await whenAsync(() => !state.someBoolean) * * @export * @param {() => boolean} fn see when, the expression to await * @param {number} timeout maximum amount of time to wait, before the promise rejects * @returns Promise for when an observable eventually matches some condition. Rejects if timeout is provided and has expired */ function whenAsync(fn, timeout) { if (timeout === void 0) { timeout = 0; } deprecated("whenAsync is deprecated, use mobx.when without effect instead"); return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* when */ "M"])(fn, { timeout: timeout, }); } /** * expr can be used to create temporarily views inside views. * This can be improved to improve performance if a value changes often, but usually doesn't affect the outcome of an expression. * * In the following example the expression prevents that a component is rerender _each time_ the selection changes; * instead it will only rerenders when the current todo is (de)selected. * * @example * const Todo = observer((props) => { * const todo = props.todo; * const isSelected = mobxUtils.expr(() => props.viewState.selection === todo); * return
{todo.title}
* }); * */ function expr(expr) { if (!Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* _isComputingDerivation */ "i"])()) console.warn("'expr' should only be used inside other reactive functions."); // optimization: would be more efficient if the expr itself wouldn't be evaluated first on the next change, but just a 'changed' signal would be fired return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* computed */ "m"])(expr).get(); } var __assign$2 = (undefined && undefined.__assign) || function () { __assign$2 = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign$2.apply(this, arguments); }; var memoizationId = 0; function createTransformer(transformer, arg2) { invariant(typeof transformer === "function" && transformer.length < 2, "createTransformer expects a function that accepts one argument"); // Memoizes: object id -> reactive view that applies transformer to the object var views = {}; var onCleanup = undefined; var keepAlive = false; var debugNameGenerator = undefined; if (typeof arg2 === "object") { onCleanup = arg2.onCleanup; keepAlive = arg2.keepAlive !== undefined ? arg2.keepAlive : false; debugNameGenerator = arg2.debugNameGenerator; } else if (typeof arg2 === "function") { onCleanup = arg2; } function createView(sourceIdentifier, sourceObject) { var latestValue; var computedValueOptions = {}; if (typeof arg2 === "object") { onCleanup = arg2.onCleanup; debugNameGenerator = arg2.debugNameGenerator; computedValueOptions = arg2; } else if (typeof arg2 === "function") { onCleanup = arg2; } else { onCleanup = undefined; debugNameGenerator = undefined; } var prettifiedName = debugNameGenerator ? debugNameGenerator(sourceObject) : "Transformer-" + transformer.name + "-" + sourceIdentifier; var expr = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* computed */ "m"])(function () { return (latestValue = transformer(sourceObject)); }, __assign$2(__assign$2({}, computedValueOptions), { name: prettifiedName })); if (!keepAlive) { var disposer_1 = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* onBecomeUnobserved */ "E"])(expr, function () { delete views[sourceIdentifier]; disposer_1(); if (onCleanup) onCleanup(latestValue, sourceObject); }); } return expr; } var memoWarned = false; return function (object) { var identifier = getMemoizationId(object); var reactiveView = views[identifier]; if (reactiveView) return reactiveView.get(); if (!keepAlive && !Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* _isComputingDerivation */ "i"])()) { if (!memoWarned) { console.warn("invoking a transformer from outside a reactive context won't memorized " + "and is cleaned up immediately, unless keepAlive is set"); memoWarned = true; } var value = transformer(object); if (onCleanup) onCleanup(value, object); return value; } // Not in cache; create a reactive view reactiveView = views[identifier] = createView(identifier, object); return reactiveView.get(); }; } function getMemoizationId(object) { var objectType = typeof object; if (objectType === "string") return "string:" + object; if (objectType === "number") return "number:" + object; if (object === null || (objectType !== "object" && objectType !== "function")) throw new Error("[mobx-utils] transform expected an object, function, string or number, got: " + String(object)); var tid = object.$transformId; if (tid === undefined) { tid = "memoizationId:" + ++memoizationId; addHiddenProp(object, "$transformId", tid); } return tid; } function buildPath(entry) { if (!entry) return "ROOT"; var res = []; while (entry.parent) { res.push(entry.path); entry = entry.parent; } return res.reverse().join("/"); } function isRecursivelyObservable(thing) { return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isObservableObject */ "A"])(thing) || Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isObservableArray */ "y"])(thing) || Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isObservableMap */ "z"])(thing); } /** * Given an object, deeply observes the given object. * It is like `observe` from mobx, but applied recursively, including all future children. * * Note that the given object cannot ever contain cycles and should be a tree. * * As benefit: path and root will be provided in the callback, so the signature of the listener is * (change, path, root) => void * * The returned disposer can be invoked to clean up the listener * * deepObserve cannot be used on computed values. * * @example * const disposer = deepObserve(target, (change, path) => { * console.dir(change) * }) */ function deepObserve(target, listener) { var entrySet = new WeakMap(); function genericListener(change) { var entry = entrySet.get(change.object); processChange(change, entry); listener(change, buildPath(entry), target); } function processChange(change, parent) { switch (change.type) { // Object changes case "add": // also for map observeRecursively(change.newValue, parent, change.name); break; case "update": // also for array and map unobserveRecursively(change.oldValue); observeRecursively(change.newValue, parent, change.name || "" + change.index); break; case "remove": // object case "delete": // map unobserveRecursively(change.oldValue); break; // Array changes case "splice": change.removed.map(unobserveRecursively); change.added.forEach(function (value, idx) { return observeRecursively(value, parent, "" + (change.index + idx)); }); // update paths for (var i = change.index + change.addedCount; i < change.object.length; i++) { if (isRecursivelyObservable(change.object[i])) { var entry = entrySet.get(change.object[i]); if (entry) entry.path = "" + i; } } break; } } function observeRecursively(thing, parent, path) { if (isRecursivelyObservable(thing)) { var entry = entrySet.get(thing); if (entry) { if (entry.parent !== parent || entry.path !== path) // MWE: this constraint is artificial, and this tool could be made to work with cycles, // but it increases administration complexity, has tricky edge cases and the meaning of 'path' // would become less clear. So doesn't seem to be needed for now throw new Error("The same observable object cannot appear twice in the same tree," + (" trying to assign it to '" + buildPath(parent) + "/" + path + "',") + (" but it already exists at '" + buildPath(entry.parent) + "/" + entry.path + "'")); } else { var entry_1 = { parent: parent, path: path, dispose: Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* observe */ "D"])(thing, genericListener), }; entrySet.set(thing, entry_1); Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* entries */ "p"])(thing).forEach(function (_a) { var key = _a[0], value = _a[1]; return observeRecursively(value, entry_1, key); }); } } } function unobserveRecursively(thing) { if (isRecursivelyObservable(thing)) { var entry = entrySet.get(thing); if (!entry) return; entrySet.delete(thing); entry.dispose(); Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* values */ "L"])(thing).forEach(unobserveRecursively); } } observeRecursively(target, undefined, ""); return function () { unobserveRecursively(target); }; } var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Reactively sorts a base observable array into multiple observable arrays based on the value of a * `groupBy: (item: T) => G` function. * * This observes the individual computed groupBy values and only updates the source and dest arrays * when there is an actual change, so this is far more efficient than, for example * `base.filter(i => groupBy(i) === 'we')`. Call #dispose() to stop tracking. * * No guarantees are made about the order of items in the grouped arrays. * * The resulting map of arrays is read-only. clear(), set(), delete() are not supported and * modifying the group arrays will lead to undefined behavior. * * NB: ObservableGroupMap relies on `Symbol`s. If you are targeting a platform which doesn't * support these natively, you will need to provide a polyfill. * * @param {array} base The array to sort into groups. * @param {function} groupBy The function used for grouping. * @param options Object with properties: * `name`: Debug name of this ObservableGroupMap. * `keyToName`: Function to create the debug names of the observable group arrays. * * @example * const slices = observable([ * { day: "mo", hours: 12 }, * { day: "tu", hours: 2 }, * ]) * const slicesByDay = new ObservableGroupMap(slices, (slice) => slice.day) * autorun(() => console.log( * slicesByDay.get("mo")?.length ?? 0, * slicesByDay.get("we"))) // outputs 1, undefined * slices[0].day = "we" // outputs 0, [{ day: "we", hours: 12 }] */ var ObservableGroupMap = /** @class */ (function (_super) { __extends(ObservableGroupMap, _super); function ObservableGroupMap(base, groupBy, _a) { var _b = _a === void 0 ? {} : _a, _c = _b.name, name = _c === void 0 ? "ogm" + ((Math.random() * 1000) | 0) : _c, _d = _b.keyToName, keyToName = _d === void 0 ? function (x) { return "" + x; } : _d; var _this = _super.call(this) || this; _this._keyToName = keyToName; _this._groupBy = groupBy; _this._ogmInfoKey = Symbol("ogmInfo" + name); _this._base = base; for (var i = 0; i < base.length; i++) { _this._addItem(base[i]); } _this._disposeBaseObserver = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* observe */ "D"])(_this._base, function (change) { if ("splice" === change.type) { Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* transaction */ "J"])(function () { for (var _i = 0, _a = change.removed; _i < _a.length; _i++) { var removed = _a[_i]; _this._removeItem(removed); } for (var _b = 0, _c = change.added; _b < _c.length; _b++) { var added = _c[_b]; _this._addItem(added); } }); } else if ("update" === change.type) { Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* transaction */ "J"])(function () { _this._removeItem(change.oldValue); _this._addItem(change.newValue); }); } else { throw new Error("illegal state"); } }); return _this; } ObservableGroupMap.prototype.clear = function () { throw new Error("not supported"); }; ObservableGroupMap.prototype.delete = function (_key) { throw new Error("not supported"); }; ObservableGroupMap.prototype.set = function (_key, _value) { throw new Error("not supported"); }; /** * Disposes all observers created during construction and removes state added to base array * items. */ ObservableGroupMap.prototype.dispose = function () { this._disposeBaseObserver(); for (var i = 0; i < this._base.length; i++) { var item = this._base[i]; var grouperItemInfo = item[this._ogmInfoKey]; grouperItemInfo.reaction(); delete item[this._ogmInfoKey]; } }; ObservableGroupMap.prototype._getGroupArr = function (key) { var result = _super.prototype.get.call(this, key); if (undefined === result) { result = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* observable */ "C"])([], { name: "GroupArray[" + this._keyToName(key) + "]", deep: false }); _super.prototype.set.call(this, key, result); } return result; }; ObservableGroupMap.prototype._removeFromGroupArr = function (key, itemIndex) { var arr = _super.prototype.get.call(this, key); if (1 === arr.length) { _super.prototype.delete.call(this, key); } else if (itemIndex === arr.length - 1) { // last position in array arr.length--; } else { arr[itemIndex] = arr[arr.length - 1]; arr[itemIndex][this._ogmInfoKey].groupArrIndex = itemIndex; arr.length--; } }; ObservableGroupMap.prototype._addItem = function (item) { var _this = this; var groupByValue = this._groupBy(item); var groupArr = this._getGroupArr(groupByValue); var value = { groupByValue: groupByValue, groupArrIndex: groupArr.length, reaction: Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* reaction */ "F"])(function () { return _this._groupBy(item); }, function (newGroupByValue, _r) { var grouperItemInfo = item[_this._ogmInfoKey]; _this._removeFromGroupArr(grouperItemInfo.groupByValue, grouperItemInfo.groupArrIndex); var newGroupArr = _this._getGroupArr(newGroupByValue); var newGroupArrIndex = newGroupArr.length; newGroupArr.push(item); grouperItemInfo.groupByValue = newGroupByValue; grouperItemInfo.groupArrIndex = newGroupArrIndex; }), }; Object.defineProperty(item, this._ogmInfoKey, { configurable: true, enumerable: false, value: value, }); groupArr.push(item); }; ObservableGroupMap.prototype._removeItem = function (item) { var grouperItemInfo = item[this._ogmInfoKey]; this._removeFromGroupArr(grouperItemInfo.groupByValue, grouperItemInfo.groupArrIndex); grouperItemInfo.reaction(); delete item[this._ogmInfoKey]; }; return ObservableGroupMap; }(mobx__WEBPACK_IMPORTED_MODULE_0__[/* ObservableMap */ "b"])); /** * @private */ var DeepMapEntry = /** @class */ (function () { function DeepMapEntry(base, args) { this.base = base; this.args = args; this.closestIdx = 0; this.isDisposed = false; var current = (this.closest = this.root = base); var i = 0; for (; i < this.args.length - 1; i++) { current = current.get(args[i]); if (current) this.closest = current; else break; } this.closestIdx = i; } DeepMapEntry.prototype.exists = function () { this.assertNotDisposed(); var l = this.args.length; return this.closestIdx >= l - 1 && this.closest.has(this.args[l - 1]); }; DeepMapEntry.prototype.get = function () { this.assertNotDisposed(); if (!this.exists()) throw new Error("Entry doesn't exist"); return this.closest.get(this.args[this.args.length - 1]); }; DeepMapEntry.prototype.set = function (value) { this.assertNotDisposed(); var l = this.args.length; var current = this.closest; // create remaining maps for (var i = this.closestIdx; i < l - 1; i++) { var m = new Map(); current.set(this.args[i], m); current = m; } this.closestIdx = l - 1; this.closest = current; current.set(this.args[l - 1], value); }; DeepMapEntry.prototype.delete = function () { this.assertNotDisposed(); if (!this.exists()) throw new Error("Entry doesn't exist"); var l = this.args.length; this.closest.delete(this.args[l - 1]); // clean up remaining maps if needed (reconstruct stack first) var c = this.root; var maps = [c]; for (var i = 0; i < l - 1; i++) { c = c.get(this.args[i]); maps.push(c); } for (var i = maps.length - 1; i > 0; i--) { if (maps[i].size === 0) maps[i - 1].delete(this.args[i - 1]); } this.isDisposed = true; }; DeepMapEntry.prototype.assertNotDisposed = function () { // TODO: once this becomes annoying, we should introduce a reset method to re-run the constructor logic if (this.isDisposed) throw new Error("Concurrent modification exception"); }; return DeepMapEntry; }()); /** * @private */ var DeepMap = /** @class */ (function () { function DeepMap() { this.store = new Map(); this.argsLength = -1; } DeepMap.prototype.entry = function (args) { if (this.argsLength === -1) this.argsLength = args.length; else if (this.argsLength !== args.length) throw new Error("DeepMap should be used with functions with a consistent length, expected: " + this.argsLength + ", got: " + args.length); if (this.last) this.last.isDisposed = true; return (this.last = new DeepMapEntry(this.store, args)); }; return DeepMap; }()); var __assign$3 = (undefined && undefined.__assign) || function () { __assign$3 = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign$3.apply(this, arguments); }; /** * computedFn takes a function with an arbitrary amount of arguments, * and memoizes the output of the function based on the arguments passed in. * * computedFn(fn) returns a function with the very same signature. There is no limit on the amount of arguments * that is accepted. However, the amount of arguments must be constant and default arguments are not supported. * * By default the output of a function call will only be memoized as long as the * output is being observed. * * The function passes into `computedFn` should be pure, not be an action and only be relying on * observables. * * Setting `keepAlive` to `true` will cause the output to be forcefully cached forever. * Note that this might introduce memory leaks! * * @example * const store = observable({ a: 1, b: 2, c: 3, m: computedFn(function(x) { return this.a * this.b * x }) }) const d = autorun(() => { // store.m(3) will be cached as long as this autorun is running console.log(store.m(3) * store.c) }) * * @param fn * @param keepAliveOrOptions */ function computedFn(fn, keepAliveOrOptions) { if (keepAliveOrOptions === void 0) { keepAliveOrOptions = false; } if (Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* isAction */ "u"])(fn)) throw new Error("computedFn shouldn't be used on actions"); var memoWarned = false; var i = 0; var opts = typeof keepAliveOrOptions === "boolean" ? { keepAlive: keepAliveOrOptions } : keepAliveOrOptions; var d = new DeepMap(); return function () { var _this = this; var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var entry = d.entry(args); // cache hit, return if (entry.exists()) return entry.get().get(); // if function is invoked, and its a cache miss without reactive, there is no point in caching... if (!opts.keepAlive && !Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* _isComputingDerivation */ "i"])()) { if (!memoWarned) { console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"); memoWarned = true; } return fn.apply(this, args); } // create new entry var c = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* computed */ "m"])(function () { return fn.apply(_this, args); }, __assign$3(__assign$3({}, opts), { name: "computedFn(" + fn.name + "#" + ++i + ")" })); entry.set(c); // clean up if no longer observed if (!opts.keepAlive) Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* onBecomeUnobserved */ "E"])(c, function () { d.entry(args).delete(); }); // return current val return c.get(); }; } function decorateMethodOrField(decoratorName, decorateFn, target, prop, descriptor) { if (descriptor) { return decorateMethod(decoratorName, decorateFn, prop, descriptor); } else { decorateField(decorateFn, target, prop); } } function decorateMethod(decoratorName, decorateFn, prop, descriptor) { if (descriptor.get !== undefined) { return fail(decoratorName + " cannot be used with getters"); } // babel / typescript // @action method() { } if (descriptor.value) { // typescript return { value: decorateFn(prop, descriptor.value), enumerable: false, configurable: true, writable: true, }; } // babel only: @action method = () => {} var initializer = descriptor.initializer; return { enumerable: false, configurable: true, writable: true, initializer: function () { // N.B: we can't immediately invoke initializer; this would be wrong return decorateFn(prop, initializer.call(this)); }, }; } function decorateField(decorateFn, target, prop) { // Simple property that writes on first invocation to the current instance Object.defineProperty(target, prop, { configurable: true, enumerable: false, get: function () { return undefined; }, set: function (value) { addHiddenProp(this, prop, decorateFn(prop, value)); }, }); } var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var runId = 0; var unfinishedIds = new Set(); var currentlyActiveIds = new Set(); var inOrderExecution; { var taskOrderPromise_1 = Promise.resolve(); var queueMicrotaskPolyfill_1; if (typeof queueMicrotask !== "undefined") { // use real implementation if possible in modern browsers/node queueMicrotaskPolyfill_1 = queueMicrotask; } else if (typeof process !== "undefined" && process.nextTick) { // fallback to node's process.nextTick in node <= 10 queueMicrotaskPolyfill_1 = function (cb) { process.nextTick(cb); }; } else { // use setTimeout for old browsers queueMicrotaskPolyfill_1 = function (cb) { setTimeout(cb, 0); }; } var idle_1 = function () { return new Promise(function (r) { queueMicrotaskPolyfill_1(r); }); }; // we use this trick to force a proper order of execution // even for immediately resolved promises inOrderExecution = function () { taskOrderPromise_1 = taskOrderPromise_1.then(idle_1); return taskOrderPromise_1; }; } var actionAsyncContextStack = []; function task(value) { return __awaiter(this, void 0, void 0, function () { var ctx, runId, actionName, args, scope, actionRunInfo, step, nextStep, ret, err_1, actionRunInfo_1; return __generator(this, function (_a) { switch (_a.label) { case 0: ctx = actionAsyncContextStack[actionAsyncContextStack.length - 1]; if (!ctx) { fail$1("'actionAsync' context not present when running 'task'. did you await inside an 'actionAsync' without using 'task(promise)'? did you forget to await the task?"); } runId = ctx.runId, actionName = ctx.actionName, args = ctx.args, scope = ctx.scope, actionRunInfo = ctx.actionRunInfo, step = ctx.step; nextStep = step + 1; actionAsyncContextStack.pop(); Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* _endAction */ "g"])(actionRunInfo); currentlyActiveIds.delete(runId); _a.label = 1; case 1: _a.trys.push([1, 4, 6, 7]); return [4 /*yield*/, value]; case 2: ret = _a.sent(); return [4 /*yield*/, inOrderExecution()]; case 3: _a.sent(); return [2 /*return*/, ret]; case 4: err_1 = _a.sent(); return [4 /*yield*/, inOrderExecution()]; case 5: _a.sent(); throw err_1; case 6: // only restart if it not a dangling promise (the action is not yet finished) if (unfinishedIds.has(runId)) { actionRunInfo_1 = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* _startAction */ "j"])(getActionAsyncName(actionName, runId, nextStep), this, args); actionAsyncContextStack.push({ runId: runId, step: nextStep, actionRunInfo: actionRunInfo_1, actionName: actionName, args: args, scope: scope, }); currentlyActiveIds.add(runId); } return [7 /*endfinally*/]; case 7: return [2 /*return*/]; } }); }); } // base /** * Alternative syntax for async actions, similar to `flow` but more compatible with * Typescript typings. Not to be confused with `asyncAction`, which is deprecated. * * `actionAsync` can be used either as a decorator or as a function. * It takes an async function that internally must use `await task(promise)` rather than * the standard `await promise`. * * When using the mobx devTools, an asyncAction will emit `action` events with names like: * * `"fetchUsers - runid 6 - step 0"` * * `"fetchUsers - runid 6 - step 1"` * * `"fetchUsers - runid 6 - step 2"` * * The `runId` represents the action instance. In other words, if `fetchUsers` is invoked * multiple times concurrently, the events with the same `runid` belong together. * The `step` number indicates the code block that is now being executed. * * @example * import {actionAsync, task} from "mobx-utils" * * let users = [] * * const fetchUsers = actionAsync("fetchUsers", async (url) => { * const start = Date.now() * // note the use of task when awaiting! * const data = await task(window.fetch(url)) * users = await task(data.json()) * return start - Date.now() * }) * * const time = await fetchUsers("http://users.com") * console.log("Got users", users, "in ", time, "ms") * * @example * import {actionAsync, task} from "mobx-utils" * * mobx.configure({ enforceActions: "observed" }) // don't allow state modifications outside actions * * class Store { * \@observable githubProjects = [] * \@observable = "pending" // "pending" / "done" / "error" * * \@actionAsync * async fetchProjects() { * this.githubProjects = [] * this.state = "pending" * try { * // note the use of task when awaiting! * const projects = await task(fetchGithubProjectsSomehow()) * const filteredProjects = somePreprocessing(projects) * // the asynchronous blocks will automatically be wrapped actions * this.state = "done" * this.githubProjects = filteredProjects * } catch (error) { * this.state = "error" * } * } * } */ function actionAsync(arg1, arg2, arg3) { // decorator if (typeof arguments[1] === "string") { return decorateMethodOrField("@actionAsync", function (prop, v) { return actionAsyncFn(prop, v); }, arg1, arg2, arg3); } // direct invocation var actionName = typeof arg1 === "string" ? arg1 : arg1.name || ""; var fn = typeof arg1 === "function" ? arg1 : arg2; return actionAsyncFn(actionName, fn); } function actionAsyncFn(actionName, fn) { if (!mobx__WEBPACK_IMPORTED_MODULE_0__[/* _startAction */ "j"] || !mobx__WEBPACK_IMPORTED_MODULE_0__[/* _endAction */ "g"]) { fail$1("'actionAsync' requires mobx >=5.13.1 or >=4.13.1"); } invariant(typeof fn === "function", "'asyncAction' expects a function"); if (typeof actionName !== "string" || !actionName) fail$1("actions should have valid names, got: '" + actionName + "'"); return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return __awaiter(this, void 0, void 0, function () { var nextRunId, actionRunInfo, finish, promise, ret, err_2; return __generator(this, function (_a) { switch (_a.label) { case 0: nextRunId = runId++; unfinishedIds.add(nextRunId); actionRunInfo = Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* _startAction */ "j"])(getActionAsyncName(actionName, nextRunId, 0), this, args); actionAsyncContextStack.push({ runId: nextRunId, step: 0, actionRunInfo: actionRunInfo, actionName: actionName, args: args, scope: this, }); currentlyActiveIds.add(nextRunId); finish = function (err) { unfinishedIds.delete(nextRunId); var ctx = actionAsyncContextStack.pop(); if (!ctx || ctx.runId !== nextRunId) { // push it back if invalid if (ctx) { actionAsyncContextStack.push(ctx); } var msg = "invalid 'actionAsync' context when finishing action '" + actionName + "'."; if (!ctx) { msg += " no action context could be found instead."; } else { msg += " an action context for '" + ctx.actionName + "' was found instead."; } msg += " did you await inside an 'actionAsync' without using 'task(promise)'? did you forget to await the task?"; fail$1(msg); } ctx.actionRunInfo.error = err; Object(mobx__WEBPACK_IMPORTED_MODULE_0__[/* _endAction */ "g"])(ctx.actionRunInfo); currentlyActiveIds.delete(nextRunId); if (err) { throw err; } }; try { promise = fn.apply(this, args); } catch (err) { finish(err); } // are we done sync? (no task run) if (currentlyActiveIds.has(nextRunId)) { finish(undefined); return [2 /*return*/, promise]; } _a.label = 1; case 1: _a.trys.push([1, 3, , 4]); return [4 /*yield*/, promise]; case 2: ret = _a.sent(); return [3 /*break*/, 4]; case 3: err_2 = _a.sent(); finish(err_2); return [3 /*break*/, 4]; case 4: finish(undefined); return [2 /*return*/, ret]; } }); }); }; } function getActionAsyncName(actionName, runId, step) { return actionName + " - runid " + runId + " - step " + step; } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(155))) /***/ }), /* 167 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/*global define:false */ /** * Copyright 2012-2017 Craig Campbell * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Mousetrap is a simple keyboard shortcut library for Javascript with * no external dependencies * * @version 1.6.5 * @url craig.is/killing/mice */ (function(window, document, undefined) { // Check if mousetrap is used inside browser, if not, return if (!window) { return; } /** * mapping of special keycodes to their corresponding keys * * everything in this dictionary cannot use keypress events * so it has to be here to map to the correct keycodes for * keyup/keydown events * * @type {Object} */ var _MAP = { 8: 'backspace', 9: 'tab', 13: 'enter', 16: 'shift', 17: 'ctrl', 18: 'alt', 20: 'capslock', 27: 'esc', 32: 'space', 33: 'pageup', 34: 'pagedown', 35: 'end', 36: 'home', 37: 'left', 38: 'up', 39: 'right', 40: 'down', 45: 'ins', 46: 'del', 91: 'meta', 93: 'meta', 224: 'meta' }; /** * mapping for special characters so they can support * * this dictionary is only used incase you want to bind a * keyup or keydown event to one of these keys * * @type {Object} */ var _KEYCODE_MAP = { 106: '*', 107: '+', 109: '-', 110: '.', 111 : '/', 186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\', 221: ']', 222: '\'' }; /** * this is a mapping of keys that require shift on a US keypad * back to the non shift equivelents * * this is so you can use keyup events with these keys * * note that this will only work reliably on US keyboards * * @type {Object} */ var _SHIFT_MAP = { '~': '`', '!': '1', '@': '2', '#': '3', '$': '4', '%': '5', '^': '6', '&': '7', '*': '8', '(': '9', ')': '0', '_': '-', '+': '=', ':': ';', '\"': '\'', '<': ',', '>': '.', '?': '/', '|': '\\' }; /** * this is a list of special strings you can use to map * to modifier keys when you specify your keyboard shortcuts * * @type {Object} */ var _SPECIAL_ALIASES = { 'option': 'alt', 'command': 'meta', 'return': 'enter', 'escape': 'esc', 'plus': '+', 'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl' }; /** * variable to store the flipped version of _MAP from above * needed to check if we should use keypress or not when no action * is specified * * @type {Object|undefined} */ var _REVERSE_MAP; /** * loop through the f keys, f1 to f19 and add them to the map * programatically */ for (var i = 1; i < 20; ++i) { _MAP[111 + i] = 'f' + i; } /** * loop through to map numbers on the numeric keypad */ for (i = 0; i <= 9; ++i) { // This needs to use a string cause otherwise since 0 is falsey // mousetrap will never fire for numpad 0 pressed as part of a keydown // event. // // @see https://github.com/ccampbell/mousetrap/pull/258 _MAP[i + 96] = i.toString(); } /** * cross browser add event method * * @param {Element|HTMLDocument} object * @param {string} type * @param {Function} callback * @returns void */ function _addEvent(object, type, callback) { if (object.addEventListener) { object.addEventListener(type, callback, false); return; } object.attachEvent('on' + type, callback); } /** * takes the event and returns the key character * * @param {Event} e * @return {string} */ function _characterFromEvent(e) { // for keypress events we should return the character as is if (e.type == 'keypress') { var character = String.fromCharCode(e.which); // if the shift key is not pressed then it is safe to assume // that we want the character to be lowercase. this means if // you accidentally have caps lock on then your key bindings // will continue to work // // the only side effect that might not be desired is if you // bind something like 'A' cause you want to trigger an // event when capital A is pressed caps lock will no longer // trigger the event. shift+a will though. if (!e.shiftKey) { character = character.toLowerCase(); } return character; } // for non keypress events the special maps are needed if (_MAP[e.which]) { return _MAP[e.which]; } if (_KEYCODE_MAP[e.which]) { return _KEYCODE_MAP[e.which]; } // if it is not in the special map // with keydown and keyup events the character seems to always // come in as an uppercase character whether you are pressing shift // or not. we should make sure it is always lowercase for comparisons return String.fromCharCode(e.which).toLowerCase(); } /** * checks if two arrays are equal * * @param {Array} modifiers1 * @param {Array} modifiers2 * @returns {boolean} */ function _modifiersMatch(modifiers1, modifiers2) { return modifiers1.sort().join(',') === modifiers2.sort().join(','); } /** * takes a key event and figures out what the modifiers are * * @param {Event} e * @returns {Array} */ function _eventModifiers(e) { var modifiers = []; if (e.shiftKey) { modifiers.push('shift'); } if (e.altKey) { modifiers.push('alt'); } if (e.ctrlKey) { modifiers.push('ctrl'); } if (e.metaKey) { modifiers.push('meta'); } return modifiers; } /** * prevents default for this event * * @param {Event} e * @returns void */ function _preventDefault(e) { if (e.preventDefault) { e.preventDefault(); return; } e.returnValue = false; } /** * stops propogation for this event * * @param {Event} e * @returns void */ function _stopPropagation(e) { if (e.stopPropagation) { e.stopPropagation(); return; } e.cancelBubble = true; } /** * determines if the keycode specified is a modifier key or not * * @param {string} key * @returns {boolean} */ function _isModifier(key) { return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta'; } /** * reverses the map lookup so that we can look for specific keys * to see what can and can't use keypress * * @return {Object} */ function _getReverseMap() { if (!_REVERSE_MAP) { _REVERSE_MAP = {}; for (var key in _MAP) { // pull out the numeric keypad from here cause keypress should // be able to detect the keys from the character if (key > 95 && key < 112) { continue; } if (_MAP.hasOwnProperty(key)) { _REVERSE_MAP[_MAP[key]] = key; } } } return _REVERSE_MAP; } /** * picks the best action based on the key combination * * @param {string} key - character for key * @param {Array} modifiers * @param {string=} action passed in */ function _pickBestAction(key, modifiers, action) { // if no action was picked in we should try to pick the one // that we think would work best for this key if (!action) { action = _getReverseMap()[key] ? 'keydown' : 'keypress'; } // modifier keys don't work as expected with keypress, // switch to keydown if (action == 'keypress' && modifiers.length) { action = 'keydown'; } return action; } /** * Converts from a string key combination to an array * * @param {string} combination like "command+shift+l" * @return {Array} */ function _keysFromString(combination) { if (combination === '+') { return ['+']; } combination = combination.replace(/\+{2}/g, '+plus'); return combination.split('+'); } /** * Gets info for a specific key combination * * @param {string} combination key combination ("command+s" or "a" or "*") * @param {string=} action * @returns {Object} */ function _getKeyInfo(combination, action) { var keys; var key; var i; var modifiers = []; // take the keys from this pattern and figure out what the actual // pattern is all about keys = _keysFromString(combination); for (i = 0; i < keys.length; ++i) { key = keys[i]; // normalize key names if (_SPECIAL_ALIASES[key]) { key = _SPECIAL_ALIASES[key]; } // if this is not a keypress event then we should // be smart about using shift keys // this will only work for US keyboards however if (action && action != 'keypress' && _SHIFT_MAP[key]) { key = _SHIFT_MAP[key]; modifiers.push('shift'); } // if this key is a modifier then add it to the list of modifiers if (_isModifier(key)) { modifiers.push(key); } } // depending on what the key combination is // we will try to pick the best event for it action = _pickBestAction(key, modifiers, action); return { key: key, modifiers: modifiers, action: action }; } function _belongsTo(element, ancestor) { if (element === null || element === document) { return false; } if (element === ancestor) { return true; } return _belongsTo(element.parentNode, ancestor); } function Mousetrap(targetElement) { var self = this; targetElement = targetElement || document; if (!(self instanceof Mousetrap)) { return new Mousetrap(targetElement); } /** * element to attach key events to * * @type {Element} */ self.target = targetElement; /** * a list of all the callbacks setup via Mousetrap.bind() * * @type {Object} */ self._callbacks = {}; /** * direct map of string combinations to callbacks used for trigger() * * @type {Object} */ self._directMap = {}; /** * keeps track of what level each sequence is at since multiple * sequences can start out with the same sequence * * @type {Object} */ var _sequenceLevels = {}; /** * variable to store the setTimeout call * * @type {null|number} */ var _resetTimer; /** * temporary state where we will ignore the next keyup * * @type {boolean|string} */ var _ignoreNextKeyup = false; /** * temporary state where we will ignore the next keypress * * @type {boolean} */ var _ignoreNextKeypress = false; /** * are we currently inside of a sequence? * type of action ("keyup" or "keydown" or "keypress") or false * * @type {boolean|string} */ var _nextExpectedAction = false; /** * resets all sequence counters except for the ones passed in * * @param {Object} doNotReset * @returns void */ function _resetSequences(doNotReset) { doNotReset = doNotReset || {}; var activeSequences = false, key; for (key in _sequenceLevels) { if (doNotReset[key]) { activeSequences = true; continue; } _sequenceLevels[key] = 0; } if (!activeSequences) { _nextExpectedAction = false; } } /** * finds all callbacks that match based on the keycode, modifiers, * and action * * @param {string} character * @param {Array} modifiers * @param {Event|Object} e * @param {string=} sequenceName - name of the sequence we are looking for * @param {string=} combination * @param {number=} level * @returns {Array} */ function _getMatches(character, modifiers, e, sequenceName, combination, level) { var i; var callback; var matches = []; var action = e.type; // if there are no events related to this keycode if (!self._callbacks[character]) { return []; } // if a modifier key is coming up on its own we should allow it if (action == 'keyup' && _isModifier(character)) { modifiers = [character]; } // loop through all callbacks for the key that was pressed // and see if any of them match for (i = 0; i < self._callbacks[character].length; ++i) { callback = self._callbacks[character][i]; // if a sequence name is not specified, but this is a sequence at // the wrong level then move onto the next match if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) { continue; } // if the action we are looking for doesn't match the action we got // then we should keep going if (action != callback.action) { continue; } // if this is a keypress event and the meta key and control key // are not pressed that means that we need to only look at the // character, otherwise check the modifiers as well // // chrome will not fire a keypress if meta or control is down // safari will fire a keypress if meta or meta+shift is down // firefox will fire a keypress if meta or control is down if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) { // when you bind a combination or sequence a second time it // should overwrite the first one. if a sequenceName or // combination is specified in this call it does just that // // @todo make deleting its own method? var deleteCombo = !sequenceName && callback.combo == combination; var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level; if (deleteCombo || deleteSequence) { self._callbacks[character].splice(i, 1); } matches.push(callback); } } return matches; } /** * actually calls the callback function * * if your callback function returns false this will use the jquery * convention - prevent default and stop propogation on the event * * @param {Function} callback * @param {Event} e * @returns void */ function _fireCallback(callback, e, combo, sequence) { // if this event should not happen stop here if (self.stopCallback(e, e.target || e.srcElement, combo, sequence)) { return; } if (callback(e, combo) === false) { _preventDefault(e); _stopPropagation(e); } } /** * handles a character key event * * @param {string} character * @param {Array} modifiers * @param {Event} e * @returns void */ self._handleKey = function(character, modifiers, e) { var callbacks = _getMatches(character, modifiers, e); var i; var doNotReset = {}; var maxLevel = 0; var processedSequenceCallback = false; // Calculate the maxLevel for sequences so we can only execute the longest callback sequence for (i = 0; i < callbacks.length; ++i) { if (callbacks[i].seq) { maxLevel = Math.max(maxLevel, callbacks[i].level); } } // loop through matching callbacks for this key event for (i = 0; i < callbacks.length; ++i) { // fire for all sequence callbacks // this is because if for example you have multiple sequences // bound such as "g i" and "g t" they both need to fire the // callback for matching g cause otherwise you can only ever // match the first one if (callbacks[i].seq) { // only fire callbacks for the maxLevel to prevent // subsequences from also firing // // for example 'a option b' should not cause 'option b' to fire // even though 'option b' is part of the other sequence // // any sequences that do not match here will be discarded // below by the _resetSequences call if (callbacks[i].level != maxLevel) { continue; } processedSequenceCallback = true; // keep a list of which sequences were matches for later doNotReset[callbacks[i].seq] = 1; _fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq); continue; } // if there were no sequence matches but we are still here // that means this is a regular match so we should fire that if (!processedSequenceCallback) { _fireCallback(callbacks[i].callback, e, callbacks[i].combo); } } // if the key you pressed matches the type of sequence without // being a modifier (ie "keyup" or "keypress") then we should // reset all sequences that were not matched by this event // // this is so, for example, if you have the sequence "h a t" and you // type "h e a r t" it does not match. in this case the "e" will // cause the sequence to reset // // modifier keys are ignored because you can have a sequence // that contains modifiers such as "enter ctrl+space" and in most // cases the modifier key will be pressed before the next key // // also if you have a sequence such as "ctrl+b a" then pressing the // "b" key will trigger a "keypress" and a "keydown" // // the "keydown" is expected when there is a modifier, but the // "keypress" ends up matching the _nextExpectedAction since it occurs // after and that causes the sequence to reset // // we ignore keypresses in a sequence that directly follow a keydown // for the same character var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress; if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) { _resetSequences(doNotReset); } _ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown'; }; /** * handles a keydown event * * @param {Event} e * @returns void */ function _handleKeyEvent(e) { // normalize e.which for key events // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion if (typeof e.which !== 'number') { e.which = e.keyCode; } var character = _characterFromEvent(e); // no character found then stop if (!character) { return; } // need to use === for the character check because the character can be 0 if (e.type == 'keyup' && _ignoreNextKeyup === character) { _ignoreNextKeyup = false; return; } self.handleKey(character, _eventModifiers(e), e); } /** * called to set a 1 second timeout on the specified sequence * * this is so after each key press in the sequence you have 1 second * to press the next key before you have to start over * * @returns void */ function _resetSequenceTimer() { clearTimeout(_resetTimer); _resetTimer = setTimeout(_resetSequences, 1000); } /** * binds a key sequence to an event * * @param {string} combo - combo specified in bind call * @param {Array} keys * @param {Function} callback * @param {string=} action * @returns void */ function _bindSequence(combo, keys, callback, action) { // start off by adding a sequence level record for this combination // and setting the level to 0 _sequenceLevels[combo] = 0; /** * callback to increase the sequence level for this sequence and reset * all other sequences that were active * * @param {string} nextAction * @returns {Function} */ function _increaseSequence(nextAction) { return function() { _nextExpectedAction = nextAction; ++_sequenceLevels[combo]; _resetSequenceTimer(); }; } /** * wraps the specified callback inside of another function in order * to reset all sequence counters as soon as this sequence is done * * @param {Event} e * @returns void */ function _callbackAndReset(e) { _fireCallback(callback, e, combo); // we should ignore the next key up if the action is key down // or keypress. this is so if you finish a sequence and // release the key the final key will not trigger a keyup if (action !== 'keyup') { _ignoreNextKeyup = _characterFromEvent(e); } // weird race condition if a sequence ends with the key // another sequence begins with setTimeout(_resetSequences, 10); } // loop through keys one at a time and bind the appropriate callback // function. for any key leading up to the final one it should // increase the sequence. after the final, it should reset all sequences // // if an action is specified in the original bind call then that will // be used throughout. otherwise we will pass the action that the // next key in the sequence should match. this allows a sequence // to mix and match keypress and keydown events depending on which // ones are better suited to the key provided for (var i = 0; i < keys.length; ++i) { var isFinal = i + 1 === keys.length; var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action); _bindSingle(keys[i], wrappedCallback, action, combo, i); } } /** * binds a single keyboard combination * * @param {string} combination * @param {Function} callback * @param {string=} action * @param {string=} sequenceName - name of sequence if part of sequence * @param {number=} level - what part of the sequence the command is * @returns void */ function _bindSingle(combination, callback, action, sequenceName, level) { // store a direct mapped reference for use with Mousetrap.trigger self._directMap[combination + ':' + action] = callback; // make sure multiple spaces in a row become a single space combination = combination.replace(/\s+/g, ' '); var sequence = combination.split(' '); var info; // if this pattern is a sequence of keys then run through this method // to reprocess each pattern one key at a time if (sequence.length > 1) { _bindSequence(combination, sequence, callback, action); return; } info = _getKeyInfo(combination, action); // make sure to initialize array if this is the first time // a callback is added for this key self._callbacks[info.key] = self._callbacks[info.key] || []; // remove an existing match if there is one _getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level); // add this call back to the array // if it is a sequence put it at the beginning // if not put it at the end // // this is important because the way these are processed expects // the sequence ones to come first self._callbacks[info.key][sequenceName ? 'unshift' : 'push']({ callback: callback, modifiers: info.modifiers, action: info.action, seq: sequenceName, level: level, combo: combination }); } /** * binds multiple combinations to the same callback * * @param {Array} combinations * @param {Function} callback * @param {string|undefined} action * @returns void */ self._bindMultiple = function(combinations, callback, action) { for (var i = 0; i < combinations.length; ++i) { _bindSingle(combinations[i], callback, action); } }; // start! _addEvent(targetElement, 'keypress', _handleKeyEvent); _addEvent(targetElement, 'keydown', _handleKeyEvent); _addEvent(targetElement, 'keyup', _handleKeyEvent); } /** * binds an event to mousetrap * * can be a single key, a combination of keys separated with +, * an array of keys, or a sequence of keys separated by spaces * * be sure to list the modifier keys first to make sure that the * correct key ends up getting bound (the last key in the pattern) * * @param {string|Array} keys * @param {Function} callback * @param {string=} action - 'keypress', 'keydown', or 'keyup' * @returns void */ Mousetrap.prototype.bind = function(keys, callback, action) { var self = this; keys = keys instanceof Array ? keys : [keys]; self._bindMultiple.call(self, keys, callback, action); return self; }; /** * unbinds an event to mousetrap * * the unbinding sets the callback function of the specified key combo * to an empty function and deletes the corresponding key in the * _directMap dict. * * TODO: actually remove this from the _callbacks dictionary instead * of binding an empty function * * the keycombo+action has to be exactly the same as * it was defined in the bind method * * @param {string|Array} keys * @param {string} action * @returns void */ Mousetrap.prototype.unbind = function(keys, action) { var self = this; return self.bind.call(self, keys, function() {}, action); }; /** * triggers an event that has already been bound * * @param {string} keys * @param {string=} action * @returns void */ Mousetrap.prototype.trigger = function(keys, action) { var self = this; if (self._directMap[keys + ':' + action]) { self._directMap[keys + ':' + action]({}, keys); } return self; }; /** * resets the library back to its initial state. this is useful * if you want to clear out the current keyboard shortcuts and bind * new ones - for example if you switch to another page * * @returns void */ Mousetrap.prototype.reset = function() { var self = this; self._callbacks = {}; self._directMap = {}; return self; }; /** * should we stop this event before firing off callbacks * * @param {Event} e * @param {Element} element * @return {boolean} */ Mousetrap.prototype.stopCallback = function(e, element) { var self = this; // if the element has the class "mousetrap" then no need to stop if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) { return false; } if (_belongsTo(element, self.target)) { return false; } // Events originating from a shadow DOM are re-targetted and `e.target` is the shadow host, // not the initial event target in the shadow tree. Note that not all events cross the // shadow boundary. // For shadow trees with `mode: 'open'`, the initial event target is the first element in // the event’s composed path. For shadow trees with `mode: 'closed'`, the initial event // target cannot be obtained. if ('composedPath' in e && typeof e.composedPath === 'function') { // For open shadow trees, update `element` so that the following check works. var initialEventTarget = e.composedPath()[0]; if (initialEventTarget !== e.target) { element = initialEventTarget; } } // stop for input, select, and textarea return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable; }; /** * exposes _handleKey publicly so it can be overwritten by extensions */ Mousetrap.prototype.handleKey = function() { var self = this; return self._handleKey.apply(self, arguments); }; /** * allow custom key mappings */ Mousetrap.addKeycodes = function(object) { for (var key in object) { if (object.hasOwnProperty(key)) { _MAP[key] = object[key]; } } _REVERSE_MAP = null; }; /** * Init the global mousetrap functions * * This method is needed to allow the global mousetrap functions to work * now that mousetrap is a constructor function. */ Mousetrap.init = function() { var documentMousetrap = Mousetrap(document); for (var method in documentMousetrap) { if (method.charAt(0) !== '_') { Mousetrap[method] = (function(method) { return function() { return documentMousetrap[method].apply(documentMousetrap, arguments); }; } (method)); } } }; Mousetrap.init(); // expose mousetrap to the global object window.Mousetrap = Mousetrap; // expose as a common js module if ( true && module.exports) { module.exports = Mousetrap; } // expose mousetrap as an AMD module if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return Mousetrap; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } }) (typeof window !== 'undefined' ? window : null, typeof window !== 'undefined' ? document : null); /***/ }), /* 168 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(36); var definePropertyModule = __webpack_require__(37); var anObject = __webpack_require__(32); var toIndexedObject = __webpack_require__(39); var objectKeys = __webpack_require__(67); // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties // eslint-disable-next-line es/no-object-defineproperties -- safe module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var props = toIndexedObject(Properties); var keys = objectKeys(Properties); var length = keys.length; var index = 0; var key; while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]); return O; }; /***/ }), /* 169 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var call = __webpack_require__(35); var isCallable = __webpack_require__(28); var isObject = __webpack_require__(33); var TypeError = global.TypeError; // `OrdinaryToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-ordinarytoprimitive module.exports = function (input, pref) { var fn, val; if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val; if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; throw TypeError("Can't convert object to primitive value"); }; /***/ }), /* 170 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var isCallable = __webpack_require__(28); var inspectSource = __webpack_require__(92); var WeakMap = global.WeakMap; module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap)); /***/ }), /* 171 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var IteratorPrototype = __webpack_require__(136).IteratorPrototype; var create = __webpack_require__(54); var createPropertyDescriptor = __webpack_require__(72); var setToStringTag = __webpack_require__(74); var Iterators = __webpack_require__(71); var returnThis = function () { return this; }; module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) { var TO_STRING_TAG = NAME + ' Iterator'; IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) }); setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true); Iterators[TO_STRING_TAG] = returnThis; return IteratorConstructor; }; /***/ }), /* 172 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var isCallable = __webpack_require__(28); var String = global.String; var TypeError = global.TypeError; module.exports = function (argument) { if (typeof argument == 'object' || isCallable(argument)) return argument; throw TypeError("Can't set " + String(argument) + ' as a prototype'); }; /***/ }), /* 173 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var global = __webpack_require__(7); var uncurryThis = __webpack_require__(15); var isForced = __webpack_require__(95); var redefine = __webpack_require__(44); var InternalMetadataModule = __webpack_require__(138); var iterate = __webpack_require__(114); var anInstance = __webpack_require__(117); var isCallable = __webpack_require__(28); var isObject = __webpack_require__(33); var fails = __webpack_require__(18); var checkCorrectnessOfIteration = __webpack_require__(118); var setToStringTag = __webpack_require__(74); var inheritIfRequired = __webpack_require__(143); module.exports = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; var ADDER = IS_MAP ? 'set' : 'add'; var NativeConstructor = global[CONSTRUCTOR_NAME]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; var Constructor = NativeConstructor; var exported = {}; var fixMethod = function (KEY) { var uncurriedNativeMethod = uncurryThis(NativePrototype[KEY]); redefine(NativePrototype, KEY, KEY == 'add' ? function add(value) { uncurriedNativeMethod(this, value === 0 ? 0 : value); return this; } : KEY == 'delete' ? function (key) { return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key); } : KEY == 'get' ? function get(key) { return IS_WEAK && !isObject(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key); } : KEY == 'has' ? function has(key) { return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key); } : function set(key, value) { uncurriedNativeMethod(this, key === 0 ? 0 : key, value); return this; } ); }; var REPLACE = isForced( CONSTRUCTOR_NAME, !isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); })) ); if (REPLACE) { // create collection constructor Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); InternalMetadataModule.enable(); } else if (isForced(CONSTRUCTOR_NAME, true)) { var instance = new Constructor(); // early implementations not supports chaining var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); }); // most early implementations doesn't supports iterables, most modern - not close it correctly // eslint-disable-next-line no-new -- required for testing var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); }); // for early implementations -0 and +0 not the same var BUGGY_ZERO = !IS_WEAK && fails(function () { // V8 ~ Chromium 42- fails only with 5+ elements var $instance = new NativeConstructor(); var index = 5; while (index--) $instance[ADDER](index, index); return !$instance.has(-0); }); if (!ACCEPT_ITERABLES) { Constructor = wrapper(function (dummy, iterable) { anInstance(dummy, NativePrototype); var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor); if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); return that; }); Constructor.prototype = NativePrototype; NativePrototype.constructor = Constructor; } if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { fixMethod('delete'); fixMethod('has'); IS_MAP && fixMethod('get'); } if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); // weak collections should not contains .clear method if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear; } exported[CONSTRUCTOR_NAME] = Constructor; $({ global: true, forced: Constructor != NativeConstructor }, exported); setToStringTag(Constructor, CONSTRUCTOR_NAME); if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); return Constructor; }; /***/ }), /* 174 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(18); var isObject = __webpack_require__(33); var classof = __webpack_require__(50); var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(175); // eslint-disable-next-line es/no-object-isextensible -- safe var $isExtensible = Object.isExtensible; var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); }); // `Object.isExtensible` method // https://tc39.es/ecma262/#sec-object.isextensible module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) { if (!isObject(it)) return false; if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false; return $isExtensible ? $isExtensible(it) : true; } : $isExtensible; /***/ }), /* 175 */ /***/ (function(module, exports, __webpack_require__) { // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it var fails = __webpack_require__(18); module.exports = fails(function () { if (typeof ArrayBuffer == 'function') { var buffer = new ArrayBuffer(8); // eslint-disable-next-line es/no-object-isextensible, es/no-object-defineproperty -- safe if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 }); } }); /***/ }), /* 176 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(18); module.exports = !fails(function () { // eslint-disable-next-line es/no-object-isextensible, es/no-object-preventextensions -- required for testing return Object.isExtensible(Object.preventExtensions({})); }); /***/ }), /* 177 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var defineProperty = __webpack_require__(37).f; var create = __webpack_require__(54); var redefineAll = __webpack_require__(144); var bind = __webpack_require__(62); var anInstance = __webpack_require__(117); var iterate = __webpack_require__(114); var defineIterator = __webpack_require__(111); var setSpecies = __webpack_require__(145); var DESCRIPTORS = __webpack_require__(36); var fastKey = __webpack_require__(138).fastKey; var InternalStateModule = __webpack_require__(56); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; module.exports = { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function (that, iterable) { anInstance(that, Prototype); setInternalState(that, { type: CONSTRUCTOR_NAME, index: create(null), first: undefined, last: undefined, size: 0 }); if (!DESCRIPTORS) that.size = 0; if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); }); var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); var define = function (that, key, value) { var state = getInternalState(that); var entry = getEntry(that, key); var previous, index; // change existing entry if (entry) { entry.value = value; // create new entry } else { state.last = entry = { index: index = fastKey(key, true), key: key, value: value, previous: previous = state.last, next: undefined, removed: false }; if (!state.first) state.first = entry; if (previous) previous.next = entry; if (DESCRIPTORS) state.size++; else that.size++; // add to index if (index !== 'F') state.index[index] = entry; } return that; }; var getEntry = function (that, key) { var state = getInternalState(that); // fast case var index = fastKey(key); var entry; if (index !== 'F') return state.index[index]; // frozen object case for (entry = state.first; entry; entry = entry.next) { if (entry.key == key) return entry; } }; redefineAll(Prototype, { // `{ Map, Set }.prototype.clear()` methods // https://tc39.es/ecma262/#sec-map.prototype.clear // https://tc39.es/ecma262/#sec-set.prototype.clear clear: function clear() { var that = this; var state = getInternalState(that); var data = state.index; var entry = state.first; while (entry) { entry.removed = true; if (entry.previous) entry.previous = entry.previous.next = undefined; delete data[entry.index]; entry = entry.next; } state.first = state.last = undefined; if (DESCRIPTORS) state.size = 0; else that.size = 0; }, // `{ Map, Set }.prototype.delete(key)` methods // https://tc39.es/ecma262/#sec-map.prototype.delete // https://tc39.es/ecma262/#sec-set.prototype.delete 'delete': function (key) { var that = this; var state = getInternalState(that); var entry = getEntry(that, key); if (entry) { var next = entry.next; var prev = entry.previous; delete state.index[entry.index]; entry.removed = true; if (prev) prev.next = next; if (next) next.previous = prev; if (state.first == entry) state.first = next; if (state.last == entry) state.last = prev; if (DESCRIPTORS) state.size--; else that.size--; } return !!entry; }, // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods // https://tc39.es/ecma262/#sec-map.prototype.foreach // https://tc39.es/ecma262/#sec-set.prototype.foreach forEach: function forEach(callbackfn /* , that = undefined */) { var state = getInternalState(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var entry; while (entry = entry ? entry.next : state.first) { boundFunction(entry.value, entry.key, this); // revert to the last existing entry while (entry && entry.removed) entry = entry.previous; } }, // `{ Map, Set}.prototype.has(key)` methods // https://tc39.es/ecma262/#sec-map.prototype.has // https://tc39.es/ecma262/#sec-set.prototype.has has: function has(key) { return !!getEntry(this, key); } }); redefineAll(Prototype, IS_MAP ? { // `Map.prototype.get(key)` method // https://tc39.es/ecma262/#sec-map.prototype.get get: function get(key) { var entry = getEntry(this, key); return entry && entry.value; }, // `Map.prototype.set(key, value)` method // https://tc39.es/ecma262/#sec-map.prototype.set set: function set(key, value) { return define(this, key === 0 ? 0 : key, value); } } : { // `Set.prototype.add(value)` method // https://tc39.es/ecma262/#sec-set.prototype.add add: function add(value) { return define(this, value = value === 0 ? 0 : value, value); } }); if (DESCRIPTORS) defineProperty(Prototype, 'size', { get: function () { return getInternalState(this).size; } }); return Constructor; }, setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) { var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator'; var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME); var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME); // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods // https://tc39.es/ecma262/#sec-map.prototype.entries // https://tc39.es/ecma262/#sec-map.prototype.keys // https://tc39.es/ecma262/#sec-map.prototype.values // https://tc39.es/ecma262/#sec-map.prototype-@@iterator // https://tc39.es/ecma262/#sec-set.prototype.entries // https://tc39.es/ecma262/#sec-set.prototype.keys // https://tc39.es/ecma262/#sec-set.prototype.values // https://tc39.es/ecma262/#sec-set.prototype-@@iterator defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) { setInternalState(this, { type: ITERATOR_NAME, target: iterated, state: getInternalCollectionState(iterated), kind: kind, last: undefined }); }, function () { var state = getInternalIteratorState(this); var kind = state.kind; var entry = state.last; // revert to the last existing entry while (entry && entry.removed) entry = entry.previous; // get next entry if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) { // or finish the iteration state.target = undefined; return { value: undefined, done: true }; } // return step by kind if (kind == 'keys') return { value: entry.key, done: false }; if (kind == 'values') return { value: entry.value, done: false }; return { value: [entry.key, entry.value], done: false }; }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); // `{ Map, Set }.prototype[@@species]` accessors // https://tc39.es/ecma262/#sec-get-map-@@species // https://tc39.es/ecma262/#sec-get-set-@@species setSpecies(CONSTRUCTOR_NAME); } }; /***/ }), /* 178 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var TO_STRING_TAG_SUPPORT = __webpack_require__(116); var classof = __webpack_require__(98); // `Object.prototype.toString` method implementation // https://tc39.es/ecma262/#sec-object.prototype.tostring module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() { return '[object ' + classof(this) + ']'; }; /***/ }), /* 179 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $forEach = __webpack_require__(75).forEach; var arrayMethodIsStrict = __webpack_require__(120); var STRICT_METHOD = arrayMethodIsStrict('forEach'); // `Array.prototype.forEach` method implementation // https://tc39.es/ecma262/#sec-array.prototype.foreach module.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) { return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); // eslint-disable-next-line es/no-array-prototype-foreach -- safe } : [].forEach; /***/ }), /* 180 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var isArray = __webpack_require__(99); var isConstructor = __webpack_require__(100); var isObject = __webpack_require__(33); var wellKnownSymbol = __webpack_require__(27); var SPECIES = wellKnownSymbol('species'); var Array = global.Array; // a part of `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate module.exports = function (originalArray) { var C; if (isArray(originalArray)) { C = originalArray.constructor; // cross-realm fallback if (isConstructor(C) && (C === Array || isArray(C.prototype))) C = undefined; else if (isObject(C)) { C = C[SPECIES]; if (C === null) C = undefined; } } return C === undefined ? Array : C; }; /***/ }), /* 181 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); module.exports = global; /***/ }), /* 182 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(7); var bind = __webpack_require__(62); var call = __webpack_require__(35); var toObject = __webpack_require__(38); var callWithSafeIterationClosing = __webpack_require__(183); var isArrayIteratorMethod = __webpack_require__(140); var isConstructor = __webpack_require__(100); var lengthOfArrayLike = __webpack_require__(43); var createProperty = __webpack_require__(61); var getIterator = __webpack_require__(141); var getIteratorMethod = __webpack_require__(115); var Array = global.Array; // `Array.from` method implementation // https://tc39.es/ecma262/#sec-array.from module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { var O = toObject(arrayLike); var IS_CONSTRUCTOR = isConstructor(this); var argumentsLength = arguments.length; var mapfn = argumentsLength > 1 ? arguments[1] : undefined; var mapping = mapfn !== undefined; if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined); var iteratorMethod = getIteratorMethod(O); var index = 0; var length, result, step, iterator, next, value; // if the target is not iterable or it's an array with the default iterator - use a simple case if (iteratorMethod && !(this == Array && isArrayIteratorMethod(iteratorMethod))) { iterator = getIterator(O, iteratorMethod); next = iterator.next; result = IS_CONSTRUCTOR ? new this() : []; for (;!(step = call(next, iterator)).done; index++) { value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; createProperty(result, index, value); } } else { length = lengthOfArrayLike(O); result = IS_CONSTRUCTOR ? new this(length) : Array(length); for (;length > index; index++) { value = mapping ? mapfn(O[index], index) : O[index]; createProperty(result, index, value); } } result.length = index; return result; }; /***/ }), /* 183 */ /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(32); var iteratorClose = __webpack_require__(142); // call something on iterator step with safe closing on error module.exports = function (iterator, fn, value, ENTRIES) { try { return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); } catch (error) { iteratorClose(iterator, 'throw', error); } }; /***/ }), /* 184 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var anObject = __webpack_require__(32); // `RegExp.prototype.flags` getter implementation // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags module.exports = function () { var that = anObject(this); var result = ''; if (that.global) result += 'g'; if (that.ignoreCase) result += 'i'; if (that.multiline) result += 'm'; if (that.dotAll) result += 's'; if (that.unicode) result += 'u'; if (that.sticky) result += 'y'; return result; }; /***/ }), /* 185 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(18); var global = __webpack_require__(7); // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError var $RegExp = global.RegExp; module.exports = fails(function () { var re = $RegExp('.', 's'); return !(re.dotAll && re.exec('\n') && re.flags === 's'); }); /***/ }), /* 186 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(18); var global = __webpack_require__(7); // babel-minify and Closure Compiler transpiles RegExp('(?
b)', 'g') -> /(?b)/g and it causes SyntaxError var $RegExp = global.RegExp; module.exports = fails(function () { var re = $RegExp('(?b)', 'g'); return re.exec('b').groups.a !== 'b' || 'b'.replace(re, '$c') !== 'bc'; }); /***/ }), /* 187 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var uncurryThis = __webpack_require__(15); var aCallable = __webpack_require__(55); var toObject = __webpack_require__(38); var lengthOfArrayLike = __webpack_require__(43); var toString = __webpack_require__(40); var fails = __webpack_require__(18); var internalSort = __webpack_require__(188); var arrayMethodIsStrict = __webpack_require__(120); var FF = __webpack_require__(189); var IE_OR_EDGE = __webpack_require__(190); var V8 = __webpack_require__(66); var WEBKIT = __webpack_require__(191); var test = []; var un$Sort = uncurryThis(test.sort); var push = uncurryThis(test.push); // IE8- var FAILS_ON_UNDEFINED = fails(function () { test.sort(undefined); }); // V8 bug var FAILS_ON_NULL = fails(function () { test.sort(null); }); // Old WebKit var STRICT_METHOD = arrayMethodIsStrict('sort'); var STABLE_SORT = !fails(function () { // feature detection can be too slow, so check engines versions if (V8) return V8 < 70; if (FF && FF > 3) return; if (IE_OR_EDGE) return true; if (WEBKIT) return WEBKIT < 603; var result = ''; var code, chr, value, index; // generate an array with more 512 elements (Chakra and old V8 fails only in this case) for (code = 65; code < 76; code++) { chr = String.fromCharCode(code); switch (code) { case 66: case 69: case 70: case 72: value = 3; break; case 68: case 71: value = 4; break; default: value = 2; } for (index = 0; index < 47; index++) { test.push({ k: chr + index, v: value }); } } test.sort(function (a, b) { return b.v - a.v; }); for (index = 0; index < test.length; index++) { chr = test[index].k.charAt(0); if (result.charAt(result.length - 1) !== chr) result += chr; } return result !== 'DGBEFHACIJK'; }); var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT; var getSortCompare = function (comparefn) { return function (x, y) { if (y === undefined) return -1; if (x === undefined) return 1; if (comparefn !== undefined) return +comparefn(x, y) || 0; return toString(x) > toString(y) ? 1 : -1; }; }; // `Array.prototype.sort` method // https://tc39.es/ecma262/#sec-array.prototype.sort $({ target: 'Array', proto: true, forced: FORCED }, { sort: function sort(comparefn) { if (comparefn !== undefined) aCallable(comparefn); var array = toObject(this); if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn); var items = []; var arrayLength = lengthOfArrayLike(array); var itemsLength, index; for (index = 0; index < arrayLength; index++) { if (index in array) push(items, array[index]); } internalSort(items, getSortCompare(comparefn)); itemsLength = items.length; index = 0; while (index < itemsLength) array[index] = items[index++]; while (index < arrayLength) delete array[index++]; return array; } }); /***/ }), /* 188 */ /***/ (function(module, exports, __webpack_require__) { var arraySlice = __webpack_require__(113); var floor = Math.floor; var mergeSort = function (array, comparefn) { var length = array.length; var middle = floor(length / 2); return length < 8 ? insertionSort(array, comparefn) : merge( array, mergeSort(arraySlice(array, 0, middle), comparefn), mergeSort(arraySlice(array, middle), comparefn), comparefn ); }; var insertionSort = function (array, comparefn) { var length = array.length; var i = 1; var element, j; while (i < length) { j = i; element = array[i]; while (j && comparefn(array[j - 1], element) > 0) { array[j] = array[--j]; } if (j !== i++) array[j] = element; } return array; }; var merge = function (array, left, right, comparefn) { var llength = left.length; var rlength = right.length; var lindex = 0; var rindex = 0; while (lindex < llength || rindex < rlength) { array[lindex + rindex] = (lindex < llength && rindex < rlength) ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++] : lindex < llength ? left[lindex++] : right[rindex++]; } return array; }; module.exports = mergeSort; /***/ }), /* 189 */ /***/ (function(module, exports, __webpack_require__) { var userAgent = __webpack_require__(53); var firefox = userAgent.match(/firefox\/(\d+)/i); module.exports = !!firefox && +firefox[1]; /***/ }), /* 190 */ /***/ (function(module, exports, __webpack_require__) { var UA = __webpack_require__(53); module.exports = /MSIE|Trident/.test(UA); /***/ }), /* 191 */ /***/ (function(module, exports, __webpack_require__) { var userAgent = __webpack_require__(53); var webkit = userAgent.match(/AppleWebKit\/(\d+)\./); module.exports = !!webkit && +webkit[1]; /***/ }), /* 192 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var $find = __webpack_require__(75).find; var addToUnscopables = __webpack_require__(83); var FIND = 'find'; var SKIPS_HOLES = true; // Shouldn't skip holes if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; }); // `Array.prototype.find` method // https://tc39.es/ecma262/#sec-array.prototype.find $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { find: function find(callbackfn /* , that = undefined */) { return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables(FIND); /***/ }), /* 193 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var isRegExp = __webpack_require__(154); var TypeError = global.TypeError; module.exports = function (it) { if (isRegExp(it)) { throw TypeError("The method doesn't accept regular expressions"); } return it; }; /***/ }), /* 194 */ /***/ (function(module, exports, __webpack_require__) { var wellKnownSymbol = __webpack_require__(27); var MATCH = wellKnownSymbol('match'); module.exports = function (METHOD_NAME) { var regexp = /./; try { '/./'[METHOD_NAME](regexp); } catch (error1) { try { regexp[MATCH] = false; return '/./'[METHOD_NAME](regexp); } catch (error2) { /* empty */ } } return false; }; /***/ }), /* 195 */ /***/ (function(module, exports, __webpack_require__) { var PROPER_FUNCTION_NAME = __webpack_require__(94).PROPER; var fails = __webpack_require__(18); var whitespaces = __webpack_require__(160); var non = '\u200B\u0085\u180E'; // check that a method works with the correct list // of whitespaces and has a correct name module.exports = function (METHOD_NAME) { return fails(function () { return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() !== non || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME); }); }; /***/ }), /* 196 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); // `thisNumberValue` abstract operation // https://tc39.es/ecma262/#sec-thisnumbervalue module.exports = uncurryThis(1.0.valueOf); /***/ }), /* 197 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); var toObject = __webpack_require__(38); var floor = Math.floor; var charAt = uncurryThis(''.charAt); var replace = uncurryThis(''.replace); var stringSlice = uncurryThis(''.slice); var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g; var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g; // `GetSubstitution` abstract operation // https://tc39.es/ecma262/#sec-getsubstitution module.exports = function (matched, str, position, captures, namedCaptures, replacement) { var tailPos = position + matched.length; var m = captures.length; var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; if (namedCaptures !== undefined) { namedCaptures = toObject(namedCaptures); symbols = SUBSTITUTION_SYMBOLS; } return replace(replacement, symbols, function (match, ch) { var capture; switch (charAt(ch, 0)) { case '$': return '$'; case '&': return matched; case '`': return stringSlice(str, 0, position); case "'": return stringSlice(str, tailPos); case '<': capture = namedCaptures[stringSlice(ch, 1, -1)]; break; default: // \d\d? var n = +ch; if (n === 0) return match; if (n > m) { var f = floor(n / 10); if (f === 0) return match; if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1); return match; } capture = captures[n - 1]; } return capture === undefined ? '' : capture; }); }; /***/ }), /* 198 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(36); var uncurryThis = __webpack_require__(15); var call = __webpack_require__(35); var fails = __webpack_require__(18); var objectKeys = __webpack_require__(67); var getOwnPropertySymbolsModule = __webpack_require__(112); var propertyIsEnumerableModule = __webpack_require__(93); var toObject = __webpack_require__(38); var IndexedObject = __webpack_require__(81); // eslint-disable-next-line es/no-object-assign -- safe var $assign = Object.assign; // eslint-disable-next-line es/no-object-defineproperty -- required for testing var defineProperty = Object.defineProperty; var concat = uncurryThis([].concat); // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign module.exports = !$assign || fails(function () { // should have correct order of operations (Edge bug) if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', { enumerable: true, get: function () { defineProperty(this, 'b', { value: 3, enumerable: false }); } }), { b: 2 })).b !== 1) return true; // should work with symbols and should have deterministic property order (V8 bug) var A = {}; var B = {}; // eslint-disable-next-line es/no-symbol -- safe var symbol = Symbol(); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet; }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length` var T = toObject(target); var argumentsLength = arguments.length; var index = 1; var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; var propertyIsEnumerable = propertyIsEnumerableModule.f; while (argumentsLength > index) { var S = IndexedObject(arguments[index++]); var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S); var length = keys.length; var j = 0; var key; while (length > j) { key = keys[j++]; if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key]; } } return T; } : $assign; /***/ }), /* 199 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(7); var uncurryThis = __webpack_require__(15); var aCallable = __webpack_require__(55); var isObject = __webpack_require__(33); var hasOwn = __webpack_require__(34); var arraySlice = __webpack_require__(101); var Function = global.Function; var concat = uncurryThis([].concat); var join = uncurryThis([].join); var factories = {}; var construct = function (C, argsLength, args) { if (!hasOwn(factories, argsLength)) { for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; factories[argsLength] = Function('C,a', 'return new C(' + join(list, ',') + ')'); } return factories[argsLength](C, args); }; // `Function.prototype.bind` method implementation // https://tc39.es/ecma262/#sec-function.prototype.bind module.exports = Function.bind || function bind(that /* , ...args */) { var F = aCallable(this); var Prototype = F.prototype; var partArgs = arraySlice(arguments, 1); var boundFunction = function bound(/* args... */) { var args = concat(partArgs, arraySlice(arguments)); return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args); }; if (isObject(Prototype)) boundFunction.prototype = Prototype; return boundFunction; }; /***/ }), /* 200 */ /***/ (function(module, exports, __webpack_require__) { var hasOwn = __webpack_require__(34); module.exports = function (descriptor) { return descriptor !== undefined && (hasOwn(descriptor, 'value') || hasOwn(descriptor, 'writable')); }; /***/ }), /* 201 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(15); var requireObjectCoercible = __webpack_require__(45); var toString = __webpack_require__(40); var quot = /"/g; var replace = uncurryThis(''.replace); // `CreateHTML` abstract operation // https://tc39.es/ecma262/#sec-createhtml module.exports = function (string, tag, attribute, value) { var S = toString(requireObjectCoercible(string)); var p1 = '<' + tag; if (attribute !== '') p1 += ' ' + attribute + '="' + replace(toString(value), quot, '"') + '"'; return p1 + '>' + S + ''; }; /***/ }), /* 202 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(18); // check the existence of a method, lowercase // of a tag and escaping quotes in arguments module.exports = function (METHOD_NAME) { return fails(function () { var test = ''[METHOD_NAME]('"'); return test !== test.toLowerCase() || test.split('"').length > 3; }); }; /***/ }), /* 203 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(16); // eslint-disable-next-line es/no-math-hypot -- required for testing var $hypot = Math.hypot; var abs = Math.abs; var sqrt = Math.sqrt; // Chrome 77 bug // https://bugs.chromium.org/p/v8/issues/detail?id=9546 var BUGGY = !!$hypot && $hypot(Infinity, NaN) !== Infinity; // `Math.hypot` method // https://tc39.es/ecma262/#sec-math.hypot $({ target: 'Math', stat: true, forced: BUGGY }, { // eslint-disable-next-line no-unused-vars -- required for `.length` hypot: function hypot(value1, value2) { var sum = 0; var i = 0; var aLen = arguments.length; var larg = 0; var arg, div; while (i < aLen) { arg = abs(arguments[i++]); if (larg < arg) { div = larg / arg; sum = sum * div * div + 1; larg = arg; } else if (arg > 0) { div = arg / larg; sum += div * div; } else sum += arg; } return larg === Infinity ? Infinity : larg * sqrt(sum); } }); /***/ }), /* 204 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(16); var IS_PURE = __webpack_require__(65); var global = __webpack_require__(7); var getBuiltIn = __webpack_require__(46); var call = __webpack_require__(35); var NativePromise = __webpack_require__(205); var redefine = __webpack_require__(44); var redefineAll = __webpack_require__(144); var setPrototypeOf = __webpack_require__(97); var setToStringTag = __webpack_require__(74); var setSpecies = __webpack_require__(145); var aCallable = __webpack_require__(55); var isCallable = __webpack_require__(28); var isObject = __webpack_require__(33); var anInstance = __webpack_require__(117); var inspectSource = __webpack_require__(92); var iterate = __webpack_require__(114); var checkCorrectnessOfIteration = __webpack_require__(118); var speciesConstructor = __webpack_require__(156); var task = __webpack_require__(162).set; var microtask = __webpack_require__(206); var promiseResolve = __webpack_require__(209); var hostReportErrors = __webpack_require__(210); var newPromiseCapabilityModule = __webpack_require__(164); var perform = __webpack_require__(211); var InternalStateModule = __webpack_require__(56); var isForced = __webpack_require__(95); var wellKnownSymbol = __webpack_require__(27); var IS_BROWSER = __webpack_require__(212); var IS_NODE = __webpack_require__(126); var V8_VERSION = __webpack_require__(66); var SPECIES = wellKnownSymbol('species'); var PROMISE = 'Promise'; var getInternalState = InternalStateModule.getterFor(PROMISE); var setInternalState = InternalStateModule.set; var getInternalPromiseState = InternalStateModule.getterFor(PROMISE); var NativePromisePrototype = NativePromise && NativePromise.prototype; var PromiseConstructor = NativePromise; var PromisePrototype = NativePromisePrototype; var TypeError = global.TypeError; var document = global.document; var process = global.process; var newPromiseCapability = newPromiseCapabilityModule.f; var newGenericPromiseCapability = newPromiseCapability; var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent); var NATIVE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent); var UNHANDLED_REJECTION = 'unhandledrejection'; var REJECTION_HANDLED = 'rejectionhandled'; var PENDING = 0; var FULFILLED = 1; var REJECTED = 2; var HANDLED = 1; var UNHANDLED = 2; var SUBCLASSING = false; var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen; var FORCED = isForced(PROMISE, function () { var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor); var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor); // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 // We can't detect it synchronously, so just check versions if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true; // We need Promise#finally in the pure version for preventing prototype pollution if (IS_PURE && !PromisePrototype['finally']) return true; // We can't use @@species feature detection in V8 since it causes // deoptimization and performance degradation // https://github.com/zloirock/core-js/issues/679 if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false; // Detect correctness of subclassing with @@species support var promise = new PromiseConstructor(function (resolve) { resolve(1); }); var FakePromise = function (exec) { exec(function () { /* empty */ }, function () { /* empty */ }); }; var constructor = promise.constructor = {}; constructor[SPECIES] = FakePromise; SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise; if (!SUBCLASSING) return true; // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_REJECTION_EVENT; }); var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) { PromiseConstructor.all(iterable)['catch'](function () { /* empty */ }); }); // helpers var isThenable = function (it) { var then; return isObject(it) && isCallable(then = it.then) ? then : false; }; var notify = function (state, isReject) { if (state.notified) return; state.notified = true; var chain = state.reactions; microtask(function () { var value = state.value; var ok = state.state == FULFILLED; var index = 0; // variable length - can't use forEach while (chain.length > index) { var reaction = chain[index++]; var handler = ok ? reaction.ok : reaction.fail; var resolve = reaction.resolve; var reject = reaction.reject; var domain = reaction.domain; var result, then, exited; try { if (handler) { if (!ok) { if (state.rejection === UNHANDLED) onHandleUnhandled(state); state.rejection = HANDLED; } if (handler === true) result = value; else { if (domain) domain.enter(); result = handler(value); // can throw if (domain) { domain.exit(); exited = true; } } if (result === reaction.promise) { reject(TypeError('Promise-chain cycle')); } else if (then = isThenable(result)) { call(then, result, resolve, reject); } else resolve(result); } else reject(value); } catch (error) { if (domain && !exited) domain.exit(); reject(error); } } state.reactions = []; state.notified = false; if (isReject && !state.rejection) onUnhandled(state); }); }; var dispatchEvent = function (name, promise, reason) { var event, handler; if (DISPATCH_EVENT) { event = document.createEvent('Event'); event.promise = promise; event.reason = reason; event.initEvent(name, false, true); global.dispatchEvent(event); } else event = { promise: promise, reason: reason }; if (!NATIVE_REJECTION_EVENT && (handler = global['on' + name])) handler(event); else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason); }; var onUnhandled = function (state) { call(task, global, function () { var promise = state.facade; var value = state.value; var IS_UNHANDLED = isUnhandled(state); var result; if (IS_UNHANDLED) { result = perform(function () { if (IS_NODE) { process.emit('unhandledRejection', value, promise); } else dispatchEvent(UNHANDLED_REJECTION, promise, value); }); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED; if (result.error) throw result.value; } }); }; var isUnhandled = function (state) { return state.rejection !== HANDLED && !state.parent; }; var onHandleUnhandled = function (state) { call(task, global, function () { var promise = state.facade; if (IS_NODE) { process.emit('rejectionHandled', promise); } else dispatchEvent(REJECTION_HANDLED, promise, state.value); }); }; var bind = function (fn, state, unwrap) { return function (value) { fn(state, value, unwrap); }; }; var internalReject = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; state.value = value; state.state = REJECTED; notify(state, true); }; var internalResolve = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; try { if (state.facade === value) throw TypeError("Promise can't be resolved itself"); var then = isThenable(value); if (then) { microtask(function () { var wrapper = { done: false }; try { call(then, value, bind(internalResolve, wrapper, state), bind(internalReject, wrapper, state) ); } catch (error) { internalReject(wrapper, error, state); } }); } else { state.value = value; state.state = FULFILLED; notify(state, false); } } catch (error) { internalReject({ done: false }, error, state); } }; // constructor polyfill if (FORCED) { // 25.4.3.1 Promise(executor) PromiseConstructor = function Promise(executor) { anInstance(this, PromisePrototype); aCallable(executor); call(Internal, this); var state = getInternalState(this); try { executor(bind(internalResolve, state), bind(internalReject, state)); } catch (error) { internalReject(state, error); } }; PromisePrototype = PromiseConstructor.prototype; // eslint-disable-next-line no-unused-vars -- required for `.length` Internal = function Promise(executor) { setInternalState(this, { type: PROMISE, done: false, notified: false, parent: false, reactions: [], rejection: false, state: PENDING, value: undefined }); }; Internal.prototype = redefineAll(PromisePrototype, { // `Promise.prototype.then` method // https://tc39.es/ecma262/#sec-promise.prototype.then then: function then(onFulfilled, onRejected) { var state = getInternalPromiseState(this); var reactions = state.reactions; var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor)); reaction.ok = isCallable(onFulfilled) ? onFulfilled : true; reaction.fail = isCallable(onRejected) && onRejected; reaction.domain = IS_NODE ? process.domain : undefined; state.parent = true; reactions[reactions.length] = reaction; if (state.state != PENDING) notify(state, false); return reaction.promise; }, // `Promise.prototype.catch` method // https://tc39.es/ecma262/#sec-promise.prototype.catch 'catch': function (onRejected) { return this.then(undefined, onRejected); } }); OwnPromiseCapability = function () { var promise = new Internal(); var state = getInternalState(promise); this.promise = promise; this.resolve = bind(internalResolve, state); this.reject = bind(internalReject, state); }; newPromiseCapabilityModule.f = newPromiseCapability = function (C) { return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); }; if (!IS_PURE && isCallable(NativePromise) && NativePromisePrototype !== Object.prototype) { nativeThen = NativePromisePrototype.then; if (!SUBCLASSING) { // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) { var that = this; return new PromiseConstructor(function (resolve, reject) { call(nativeThen, that, resolve, reject); }).then(onFulfilled, onRejected); // https://github.com/zloirock/core-js/issues/640 }, { unsafe: true }); // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then` redefine(NativePromisePrototype, 'catch', PromisePrototype['catch'], { unsafe: true }); } // make `.constructor === Promise` work for native promise-based APIs try { delete NativePromisePrototype.constructor; } catch (error) { /* empty */ } // make `instanceof Promise` work for native promise-based APIs if (setPrototypeOf) { setPrototypeOf(NativePromisePrototype, PromisePrototype); } } } $({ global: true, wrap: true, forced: FORCED }, { Promise: PromiseConstructor }); setToStringTag(PromiseConstructor, PROMISE, false, true); setSpecies(PROMISE); PromiseWrapper = getBuiltIn(PROMISE); // statics $({ target: PROMISE, stat: true, forced: FORCED }, { // `Promise.reject` method // https://tc39.es/ecma262/#sec-promise.reject reject: function reject(r) { var capability = newPromiseCapability(this); call(capability.reject, undefined, r); return capability.promise; } }); $({ target: PROMISE, stat: true, forced: IS_PURE || FORCED }, { // `Promise.resolve` method // https://tc39.es/ecma262/#sec-promise.resolve resolve: function resolve(x) { return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x); } }); $({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, { // `Promise.all` method // https://tc39.es/ecma262/#sec-promise.all all: function all(iterable) { var C = this; var capability = newPromiseCapability(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { var $promiseResolve = aCallable(C.resolve); var values = []; var counter = 0; var remaining = 1; iterate(iterable, function (promise) { var index = counter++; var alreadyCalled = false; remaining++; call($promiseResolve, C, promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[index] = value; --remaining || resolve(values); }, reject); }); --remaining || resolve(values); }); if (result.error) reject(result.value); return capability.promise; }, // `Promise.race` method // https://tc39.es/ecma262/#sec-promise.race race: function race(iterable) { var C = this; var capability = newPromiseCapability(C); var reject = capability.reject; var result = perform(function () { var $promiseResolve = aCallable(C.resolve); iterate(iterable, function (promise) { call($promiseResolve, C, promise).then(capability.resolve, reject); }); }); if (result.error) reject(result.value); return capability.promise; } }); /***/ }), /* 205 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); module.exports = global.Promise; /***/ }), /* 206 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var bind = __webpack_require__(62); var getOwnPropertyDescriptor = __webpack_require__(51).f; var macrotask = __webpack_require__(162).set; var IS_IOS = __webpack_require__(163); var IS_IOS_PEBBLE = __webpack_require__(207); var IS_WEBOS_WEBKIT = __webpack_require__(208); var IS_NODE = __webpack_require__(126); var MutationObserver = global.MutationObserver || global.WebKitMutationObserver; var document = global.document; var process = global.process; var Promise = global.Promise; // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask'); var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; var flush, head, last, notify, toggle, node, promise, then; // modern engines have queueMicrotask method if (!queueMicrotask) { flush = function () { var parent, fn; if (IS_NODE && (parent = process.domain)) parent.exit(); while (head) { fn = head.fn; head = head.next; try { fn(); } catch (error) { if (head) notify(); else last = undefined; throw error; } } last = undefined; if (parent) parent.enter(); }; // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339 // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898 if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) { toggle = true; node = document.createTextNode(''); new MutationObserver(flush).observe(node, { characterData: true }); notify = function () { node.data = toggle = !toggle; }; // environments with maybe non-completely correct, but existent Promise } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) { // Promise.resolve without an argument throws an error in LG WebOS 2 promise = Promise.resolve(undefined); // workaround of WebKit ~ iOS Safari 10.1 bug promise.constructor = Promise; then = bind(promise.then, promise); notify = function () { then(flush); }; // Node.js without promises } else if (IS_NODE) { notify = function () { process.nextTick(flush); }; // for other environments - macrotask based on: // - setImmediate // - MessageChannel // - window.postMessag // - onreadystatechange // - setTimeout } else { // strange IE + webpack dev server bug - use .bind(global) macrotask = bind(macrotask, global); notify = function () { macrotask(flush); }; } } module.exports = queueMicrotask || function (fn) { var task = { fn: fn, next: undefined }; if (last) last.next = task; if (!head) { head = task; notify(); } last = task; }; /***/ }), /* 207 */ /***/ (function(module, exports, __webpack_require__) { var userAgent = __webpack_require__(53); var global = __webpack_require__(7); module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined; /***/ }), /* 208 */ /***/ (function(module, exports, __webpack_require__) { var userAgent = __webpack_require__(53); module.exports = /web0s(?!.*chrome)/i.test(userAgent); /***/ }), /* 209 */ /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(32); var isObject = __webpack_require__(33); var newPromiseCapability = __webpack_require__(164); module.exports = function (C, x) { anObject(C); if (isObject(x) && x.constructor === C) return x; var promiseCapability = newPromiseCapability.f(C); var resolve = promiseCapability.resolve; resolve(x); return promiseCapability.promise; }; /***/ }), /* 210 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); module.exports = function (a, b) { var console = global.console; if (console && console.error) { arguments.length == 1 ? console.error(a) : console.error(a, b); } }; /***/ }), /* 211 */ /***/ (function(module, exports) { module.exports = function (exec) { try { return { error: false, value: exec() }; } catch (error) { return { error: true, value: error }; } }; /***/ }), /* 212 */ /***/ (function(module, exports) { module.exports = typeof window == 'object'; /***/ }), /* 213 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(36); var uncurryThis = __webpack_require__(15); var objectKeys = __webpack_require__(67); var toIndexedObject = __webpack_require__(39); var $propertyIsEnumerable = __webpack_require__(93).f; var propertyIsEnumerable = uncurryThis($propertyIsEnumerable); var push = uncurryThis([].push); // `Object.{ entries, values }` methods implementation var createMethod = function (TO_ENTRIES) { return function (it) { var O = toIndexedObject(it); var keys = objectKeys(O); var length = keys.length; var i = 0; var result = []; var key; while (length > i) { key = keys[i++]; if (!DESCRIPTORS || propertyIsEnumerable(O, key)) { push(result, TO_ENTRIES ? [key, O[key]] : O[key]); } } return result; }; }; module.exports = { // `Object.entries` method // https://tc39.es/ecma262/#sec-object.entries entries: createMethod(true), // `Object.values` method // https://tc39.es/ecma262/#sec-object.values values: createMethod(false) }; /***/ }), /* 214 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toObject = __webpack_require__(38); var toAbsoluteIndex = __webpack_require__(68); var lengthOfArrayLike = __webpack_require__(43); // `Array.prototype.fill` method implementation // https://tc39.es/ecma262/#sec-array.prototype.fill module.exports = function fill(value /* , start = 0, end = @length */) { var O = toObject(this); var length = lengthOfArrayLike(O); var argumentsLength = arguments.length; var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length); var end = argumentsLength > 2 ? arguments[2] : undefined; var endPos = end === undefined ? length : toAbsoluteIndex(end, length); while (endPos > index) O[index++] = value; return O; }; /***/ }), /* 215 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, "observer", function() { return /* binding */ src_observer; }); __webpack_require__.d(__webpack_exports__, "LogicFlow", function() { return /* reexport */ LogicFlow_LogicFlow; }); __webpack_require__.d(__webpack_exports__, "h", function() { return /* reexport */ preact_module["g" /* h */]; }); __webpack_require__.d(__webpack_exports__, "LogicFlowUtil", function() { return /* reexport */ util_namespaceObject; }); __webpack_require__.d(__webpack_exports__, "BaseNode", function() { return /* reexport */ BaseNode_BaseNode; }); __webpack_require__.d(__webpack_exports__, "RectNode", function() { return /* reexport */ RectNode_RectNode; }); __webpack_require__.d(__webpack_exports__, "CircleNode", function() { return /* reexport */ CircleNode_CircleNode; }); __webpack_require__.d(__webpack_exports__, "PolygonNode", function() { return /* reexport */ PolygonNode_PolygonNode; }); __webpack_require__.d(__webpack_exports__, "DiamondNode", function() { return /* reexport */ DiamondNode_DiamondNode; }); __webpack_require__.d(__webpack_exports__, "EllipseNode", function() { return /* reexport */ EllipseNode_EllipseNode; }); __webpack_require__.d(__webpack_exports__, "TextNode", function() { return /* reexport */ TextNode_TextNode; }); __webpack_require__.d(__webpack_exports__, "HtmlNode", function() { return /* reexport */ HtmlNode_HtmlNode; }); __webpack_require__.d(__webpack_exports__, "BaseEdge", function() { return /* reexport */ BaseEdge_BaseEdge; }); __webpack_require__.d(__webpack_exports__, "LineEdge", function() { return /* reexport */ LineEdge_LineEdge; }); __webpack_require__.d(__webpack_exports__, "PolylineEdge", function() { return /* reexport */ PolylineEdge_PolylineEdge; }); __webpack_require__.d(__webpack_exports__, "BezierEdge", function() { return /* reexport */ BezierEdge_BezierEdge; }); __webpack_require__.d(__webpack_exports__, "Arrow", function() { return /* reexport */ Arrow_Arrow; }); __webpack_require__.d(__webpack_exports__, "BaseEdgeModel", function() { return /* reexport */ BaseEdgeModel_BaseEdgeModel; }); __webpack_require__.d(__webpack_exports__, "BezierEdgeModel", function() { return /* reexport */ BezierEdgeModel_BezierEdgeModel; }); __webpack_require__.d(__webpack_exports__, "LineEdgeModel", function() { return /* reexport */ LineEdgeModel_LineEdgeModel; }); __webpack_require__.d(__webpack_exports__, "PolylineEdgeModel", function() { return /* reexport */ PolylineEdgeModel_PolylineEdgeModel; }); __webpack_require__.d(__webpack_exports__, "BaseNodeModel", function() { return /* reexport */ BaseNodeModel_BaseNodeModel; }); __webpack_require__.d(__webpack_exports__, "CircleNodeModel", function() { return /* reexport */ CircleNodeModel_CircleNodeModel; }); __webpack_require__.d(__webpack_exports__, "DiamondNodeModel", function() { return /* reexport */ DiamondNodeModel_DiamondNodeModel; }); __webpack_require__.d(__webpack_exports__, "EllipseNodeModel", function() { return /* reexport */ EllipseNodeModel_EllipseNodeModel; }); __webpack_require__.d(__webpack_exports__, "PolygonNodeModel", function() { return /* reexport */ PolygonNodeModel_PolygonNodeModel; }); __webpack_require__.d(__webpack_exports__, "RectNodeModel", function() { return /* reexport */ RectNodeModel_RectNodeModel; }); __webpack_require__.d(__webpack_exports__, "TextNodeModel", function() { return /* reexport */ TextNodeModel_TextNodeModel; }); __webpack_require__.d(__webpack_exports__, "HtmlNodeModel", function() { return /* reexport */ HtmlNodeModel_HtmlNodeModel; }); __webpack_require__.d(__webpack_exports__, "EditConfigModel", function() { return /* reexport */ EditConfigModel_EditConfigModel; }); __webpack_require__.d(__webpack_exports__, "GraphModel", function() { return /* reexport */ GraphModel_GraphModel; }); __webpack_require__.d(__webpack_exports__, "SnaplineModel", function() { return /* reexport */ SnaplineModel_SnaplineModel; }); __webpack_require__.d(__webpack_exports__, "Keyboard", function() { return /* reexport */ keyboard_Keyboard; }); __webpack_require__.d(__webpack_exports__, "get", function() { return /* reexport */ options_get; }); __webpack_require__.d(__webpack_exports__, "defaults", function() { return /* reexport */ defaults; }); __webpack_require__.d(__webpack_exports__, "ElementState", function() { return /* reexport */ ElementState; }); __webpack_require__.d(__webpack_exports__, "ModelType", function() { return /* reexport */ ModelType; }); __webpack_require__.d(__webpack_exports__, "ElementType", function() { return /* reexport */ ElementType; }); __webpack_require__.d(__webpack_exports__, "EventType", function() { return /* reexport */ EventType; }); // NAMESPACE OBJECT: ./src/util/index.ts var util_namespaceObject = {}; __webpack_require__.r(util_namespaceObject); __webpack_require__.d(util_namespaceObject, "createUuid", function() { return uuid_createUuid; }); __webpack_require__.d(util_namespaceObject, "refreshGraphId", function() { return uuid_refreshGraphId; }); __webpack_require__.d(util_namespaceObject, "createDrag", function() { return createDrag; }); __webpack_require__.d(util_namespaceObject, "StepDrag", function() { return drag_StepDrag; }); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx/lib/mobx.module.js var mobx_module = __webpack_require__(0); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/preact/compat/dist/compat.module.js + 1 modules var compat_module = __webpack_require__(10); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/assertEnvironment.js if (!compat_module["j" /* useState */]) { throw new Error("mobx-react-lite requires React with Hooks support"); } if (!mobx_module["H" /* spy */]) { throw new Error("mobx-react-lite requires mobx at least version 4 to be available"); } // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/utils/reactBatchedUpdates.js // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/utils.js var utils = __webpack_require__(42); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/observerBatching.js var observerBatchingConfiguredSymbol = Object(utils["b" /* getSymbol */])("observerBatching"); function defaultNoopBatch(callback) { callback(); } function observerBatching(reactionScheduler) { if (!reactionScheduler) { reactionScheduler = defaultNoopBatch; if (false) {} } Object(mobx_module["n" /* configure */])({ reactionScheduler: reactionScheduler }); Object(utils["a" /* getGlobal */])()[observerBatchingConfiguredSymbol] = true; } var isObserverBatched = function () { return !!Object(utils["a" /* getGlobal */])()[observerBatchingConfiguredSymbol]; }; // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/staticRendering.js var globalIsUsingStaticRendering = false; function useStaticRendering(enable) { globalIsUsingStaticRendering = enable; } function isUsingStaticRendering() { return globalIsUsingStaticRendering; } // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/printDebugValue.js function printDebugValue(v) { return Object(mobx_module["t" /* getDependencyTree */])(v); } // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/reactionCleanupTracking.js function createTrackingData(reaction) { var trackingData = { cleanAt: Date.now() + CLEANUP_LEAKED_REACTIONS_AFTER_MILLIS, reaction: reaction }; return trackingData; } /** * The minimum time before we'll clean up a Reaction created in a render * for a component that hasn't managed to run its effects. This needs to * be big enough to ensure that a component won't turn up and have its * effects run without being re-rendered. */ var CLEANUP_LEAKED_REACTIONS_AFTER_MILLIS = 10000; /** * The frequency with which we'll check for leaked reactions. */ var CLEANUP_TIMER_LOOP_MILLIS = 10000; /** * Reactions created by components that have yet to be fully mounted. */ var uncommittedReactionRefs = new Set(); /** * Latest 'uncommitted reactions' cleanup timer handle. */ var reactionCleanupHandle; function ensureCleanupTimerRunning() { if (reactionCleanupHandle === undefined) { reactionCleanupHandle = setTimeout(cleanUncommittedReactions, CLEANUP_TIMER_LOOP_MILLIS); } } function scheduleCleanupOfReactionIfLeaked(ref) { uncommittedReactionRefs.add(ref); ensureCleanupTimerRunning(); } function recordReactionAsCommitted(reactionRef) { uncommittedReactionRefs.delete(reactionRef); } /** * Run by the cleanup timer to dispose any outstanding reactions */ function cleanUncommittedReactions() { reactionCleanupHandle = undefined; // Loop through all the candidate leaked reactions; those older // than CLEANUP_LEAKED_REACTIONS_AFTER_MILLIS get tidied. var now = Date.now(); uncommittedReactionRefs.forEach(function (ref) { var tracking = ref.current; if (tracking) { if (now >= tracking.cleanAt) { // It's time to tidy up this leaked reaction. tracking.reaction.dispose(); ref.current = null; uncommittedReactionRefs.delete(ref); } } }); if (uncommittedReactionRefs.size > 0) { // We've just finished a round of cleanups but there are still // some leak candidates outstanding. ensureCleanupTimerRunning(); } } /* istanbul ignore next */ /** * Only to be used by test functions; do not export outside of mobx-react-lite */ function forceCleanupTimerToRunNowForTests() { // This allows us to control the execution of the cleanup timer // to force it to run at awkward times in unit tests. if (reactionCleanupHandle) { clearTimeout(reactionCleanupHandle); cleanUncommittedReactions(); } } /* istanbul ignore next */ function resetCleanupScheduleForTests() { if (reactionCleanupHandle) { clearTimeout(reactionCleanupHandle); reactionCleanupHandle = undefined; } uncommittedReactionRefs.clear(); } // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/useQueuedForceUpdate.js var insideRender = false; var forceUpdateQueue = []; function useQueuedForceUpdate(forceUpdate) { return function () { if (insideRender) { forceUpdateQueue.push(forceUpdate); } else { forceUpdate(); } }; } function useQueuedForceUpdateBlock(callback) { // start intercepting force-update calls insideRender = true; forceUpdateQueue = []; try { var result = callback(); // stop intercepting force-update insideRender = false; // store queue or nothing if it was empty to execute useLayoutEffect only when necessary var queue_1 = forceUpdateQueue.length > 0 ? forceUpdateQueue : undefined; // run force-update queue in useLayoutEffect compat_module["d" /* default */].useLayoutEffect(function () { if (queue_1) { queue_1.forEach(function (x) { return x(); }); } }, [queue_1]); return result; } finally { insideRender = false; } } // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/useObserver.js var EMPTY_OBJECT = {}; function observerComponentNameFor(baseComponentName) { return "observer" + baseComponentName; } function useObserver(fn, baseComponentName, options) { if (baseComponentName === void 0) { baseComponentName = "observed"; } if (options === void 0) { options = EMPTY_OBJECT; } if (isUsingStaticRendering()) { return fn(); } var wantedForceUpdateHook = options.useForceUpdate || utils["d" /* useForceUpdate */]; var forceUpdate = wantedForceUpdateHook(); var queuedForceUpdate = useQueuedForceUpdate(forceUpdate); // StrictMode/ConcurrentMode/Suspense may mean that our component is // rendered and abandoned multiple times, so we need to track leaked // Reactions. var reactionTrackingRef = compat_module["d" /* default */].useRef(null); if (!reactionTrackingRef.current) { // First render for this component (or first time since a previous // reaction from an abandoned render was disposed). var newReaction_1 = new mobx_module["c" /* Reaction */](observerComponentNameFor(baseComponentName), function () { // Observable has changed, meaning we want to re-render // BUT if we're a component that hasn't yet got to the useEffect() // stage, we might be a component that _started_ to render, but // got dropped, and we don't want to make state changes then. // (It triggers warnings in StrictMode, for a start.) if (trackingData_1.mounted) { // We have reached useEffect(), so we're mounted, and can trigger an update queuedForceUpdate(); } else { // We haven't yet reached useEffect(), so we'll need to trigger a re-render // when (and if) useEffect() arrives. The easiest way to do that is just to // drop our current reaction and allow useEffect() to recreate it. newReaction_1.dispose(); reactionTrackingRef.current = null; } }); var trackingData_1 = createTrackingData(newReaction_1); reactionTrackingRef.current = trackingData_1; scheduleCleanupOfReactionIfLeaked(reactionTrackingRef); } var reaction = reactionTrackingRef.current.reaction; compat_module["d" /* default */].useDebugValue(reaction, printDebugValue); compat_module["d" /* default */].useEffect(function () { // Called on first mount only recordReactionAsCommitted(reactionTrackingRef); if (reactionTrackingRef.current) { // Great. We've already got our reaction from our render; // all we need to do is to record that it's now mounted, // to allow future observable changes to trigger re-renders reactionTrackingRef.current.mounted = true; } else { // The reaction we set up in our render has been disposed. // This is either due to bad timings of renderings, e.g. our // component was paused for a _very_ long time, and our // reaction got cleaned up, or we got a observable change // between render and useEffect // Re-create the reaction reactionTrackingRef.current = { reaction: new mobx_module["c" /* Reaction */](observerComponentNameFor(baseComponentName), function () { // We've definitely already been mounted at this point queuedForceUpdate(); }), cleanAt: Infinity }; queuedForceUpdate(); } return function () { reactionTrackingRef.current.reaction.dispose(); reactionTrackingRef.current = null; }; }, []); // delay all force-update calls after rendering of this component return useQueuedForceUpdateBlock(function () { // render the original component, but have the // reaction track the observables, so that rendering // can be invalidated (see above) once a dependency changes var rendering; var exception; reaction.track(function () { try { rendering = fn(); } catch (e) { exception = e; } }); if (exception) { throw exception; // re-throw any exceptions caught during rendering } return rendering; }); } // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/observer.js var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; // n.b. base case is not used for actual typings or exported in the typing files function observer(baseComponent, options) { // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307 if (isUsingStaticRendering()) { return baseComponent; } var realOptions = __assign({ forwardRef: false }, options); var baseComponentName = baseComponent.displayName || baseComponent.name; var wrappedComponent = function (props, ref) { return useObserver(function () { return baseComponent(props, ref); }, baseComponentName); }; wrappedComponent.displayName = baseComponentName; // memo; we are not interested in deep updates // in props; we assume that if deep objects are changed, // this is in observables, which would have been tracked anyway var memoComponent; if (realOptions.forwardRef) { // we have to use forwardRef here because: // 1. it cannot go before memo, only after it // 2. forwardRef converts the function into an actual component, so we can't let the baseComponent do it // since it wouldn't be a callable function anymore memoComponent = Object(compat_module["f" /* memo */])(Object(compat_module["e" /* forwardRef */])(wrappedComponent)); } else { memoComponent = Object(compat_module["f" /* memo */])(wrappedComponent); } copyStaticProperties(baseComponent, memoComponent); memoComponent.displayName = baseComponentName; return memoComponent; } // based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js var hoistBlackList = { $$typeof: true, render: true, compare: true, type: true }; function copyStaticProperties(base, target) { Object.keys(base).forEach(function (key) { if (!hoistBlackList[key]) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)); } }); } // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/ObserverComponent.js function ObserverComponent(_a) { var children = _a.children, render = _a.render; var component = children || render; if (typeof component !== "function") { return null; } return useObserver(component); } ObserverComponent.propTypes = { children: ObserverPropsCheck, render: ObserverPropsCheck }; ObserverComponent.displayName = "Observer"; function ObserverPropsCheck(props, key, componentName, location, propFullName) { var extraKey = key === "children" ? "render" : "children"; var hasProp = typeof props[key] === "function"; var hasExtraProp = typeof props[extraKey] === "function"; if (hasProp && hasExtraProp) { return new Error("MobX Observer: Do not use children and render in the same time in`" + componentName); } if (hasProp || hasExtraProp) { return null; } return new Error("Invalid prop `" + propFullName + "` of type `" + typeof props[key] + "` supplied to" + " `" + componentName + "`, expected `function`."); } // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/useAsObservableSource.js var __read = (undefined && undefined.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; function useAsObservableSourceInternal(current, usedByLocalStore) { var culprit = usedByLocalStore ? "useLocalStore" : "useAsObservableSource"; if (false) { var _a, initialSource; } if (usedByLocalStore && current === undefined) { return undefined; } if (false) {} var _b = __read(compat_module["d" /* default */].useState(function () { return Object(mobx_module["C" /* observable */])(current, {}, { deep: false }); }), 1), res = _b[0]; if (false) {} Object(mobx_module["G" /* runInAction */])(function () { Object.assign(res, current); }); return res; } function useAsObservableSource(current) { return useAsObservableSourceInternal(current, false); } // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/useLocalStore.js function useLocalStore(initializer, current) { var source = useAsObservableSourceInternal(current, true); return compat_module["d" /* default */].useState(function () { var local = Object(mobx_module["C" /* observable */])(initializer(source)); if (Object(utils["c" /* isPlainObject */])(local)) { Object(mobx_module["G" /* runInAction */])(function () { Object.keys(local).forEach(function (key) { var value = local[key]; if (typeof value === "function") { // @ts-ignore No idea why ts2536 is popping out here local[key] = wrapInTransaction(value, local); } }); }); } return local; })[0]; } // tslint:disable-next-line: ban-types function wrapInTransaction(fn, context) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return Object(mobx_module["J" /* transaction */])(function () { return fn.apply(context, args); }); }; } // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react-lite/es/index.js observerBatching(compat_module["g" /* unstable_batchedUpdates */]); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-react/dist/mobxreact.esm.js var symbolId = 0; function createSymbol(name) { if (typeof Symbol === "function") { return Symbol(name); } var symbol = "__$mobx-react " + name + " (" + symbolId + ")"; symbolId++; return symbol; } var createdSymbols = {}; function newSymbol(name) { if (!createdSymbols[name]) { createdSymbols[name] = createSymbol(name); } return createdSymbols[name]; } function shallowEqual(objA, objB) { //From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js if (is(objA, objB)) return true; if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) return false; for (var i = 0; i < keysA.length; i++) { if (!Object.hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { return false; } } return true; } function is(x, y) { // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js if (x === y) { return x !== 0 || 1 / x === 1 / y; } else { return x !== x && y !== y; } } // based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js var mobxreact_esm_hoistBlackList = { $$typeof: 1, render: 1, compare: 1, type: 1, childContextTypes: 1, contextType: 1, contextTypes: 1, defaultProps: 1, getDefaultProps: 1, getDerivedStateFromError: 1, getDerivedStateFromProps: 1, mixins: 1, propTypes: 1 }; function mobxreact_esm_copyStaticProperties(base, target) { var protoProps = Object.getOwnPropertyNames(Object.getPrototypeOf(base)); Object.getOwnPropertyNames(base).forEach(function (key) { if (!mobxreact_esm_hoistBlackList[key] && protoProps.indexOf(key) === -1) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)); } }); } /** * Helper to set `prop` to `this` as non-enumerable (hidden prop) * @param target * @param prop * @param value */ function setHiddenProp(target, prop, value) { if (!Object.hasOwnProperty.call(target, prop)) { Object.defineProperty(target, prop, { enumerable: false, configurable: true, writable: true, value: value }); } else { target[prop] = value; } } /** * Utilities for patching componentWillUnmount, to make sure @disposeOnUnmount works correctly icm with user defined hooks * and the handler provided by mobx-react */ var mobxMixins = /*#__PURE__*/ newSymbol("patchMixins"); var mobxPatchedDefinition = /*#__PURE__*/ newSymbol("patchedDefinition"); function getMixins(target, methodName) { var mixins = target[mobxMixins] = target[mobxMixins] || {}; var methodMixins = mixins[methodName] = mixins[methodName] || {}; methodMixins.locks = methodMixins.locks || 0; methodMixins.methods = methodMixins.methods || []; return methodMixins; } function wrapper(realMethod, mixins) { var _this = this; for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } // locks are used to ensure that mixins are invoked only once per invocation, even on recursive calls mixins.locks++; try { var retVal; if (realMethod !== undefined && realMethod !== null) { retVal = realMethod.apply(this, args); } return retVal; } finally { mixins.locks--; if (mixins.locks === 0) { mixins.methods.forEach(function (mx) { mx.apply(_this, args); }); } } } function wrapFunction(realMethod, mixins) { var fn = function fn() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } wrapper.call.apply(wrapper, [this, realMethod, mixins].concat(args)); }; return fn; } function patch(target, methodName, mixinMethod) { var mixins = getMixins(target, methodName); if (mixins.methods.indexOf(mixinMethod) < 0) { mixins.methods.push(mixinMethod); } var oldDefinition = Object.getOwnPropertyDescriptor(target, methodName); if (oldDefinition && oldDefinition[mobxPatchedDefinition]) { // already patched definition, do not repatch return; } var originalMethod = target[methodName]; var newDefinition = createDefinition(target, methodName, oldDefinition ? oldDefinition.enumerable : undefined, mixins, originalMethod); Object.defineProperty(target, methodName, newDefinition); } function createDefinition(target, methodName, enumerable, mixins, originalMethod) { var _ref; var wrappedFunc = wrapFunction(originalMethod, mixins); return _ref = {}, _ref[mobxPatchedDefinition] = true, _ref.get = function get() { return wrappedFunc; }, _ref.set = function set(value) { if (this === target) { wrappedFunc = wrapFunction(value, mixins); } else { // when it is an instance of the prototype/a child prototype patch that particular case again separately // since we need to store separate values depending on wether it is the actual instance, the prototype, etc // e.g. the method for super might not be the same as the method for the prototype which might be not the same // as the method for the instance var newDefinition = createDefinition(this, methodName, enumerable, mixins, value); Object.defineProperty(this, methodName, newDefinition); } }, _ref.configurable = true, _ref.enumerable = enumerable, _ref; } var mobxAdminProperty = mobx_module["a" /* $mobx */] || "$mobx"; var mobxObserverProperty = /*#__PURE__*/ newSymbol("isMobXReactObserver"); var mobxIsUnmounted = /*#__PURE__*/ newSymbol("isUnmounted"); var skipRenderKey = /*#__PURE__*/ newSymbol("skipRender"); var isForcingUpdateKey = /*#__PURE__*/ newSymbol("isForcingUpdate"); function makeClassComponentObserver(componentClass) { var target = componentClass.prototype; if (componentClass[mobxObserverProperty]) { var displayName = getDisplayName(target); console.warn("The provided component class (" + displayName + ") \n has already been declared as an observer component."); } else { componentClass[mobxObserverProperty] = true; } if (target.componentWillReact) throw new Error("The componentWillReact life-cycle event is no longer supported"); if (componentClass["__proto__"] !== compat_module["b" /* PureComponent */]) { if (!target.shouldComponentUpdate) target.shouldComponentUpdate = observerSCU;else if (target.shouldComponentUpdate !== observerSCU) // n.b. unequal check, instead of existence check, as @observer might be on superclass as well throw new Error("It is not allowed to use shouldComponentUpdate in observer based components."); } // this.props and this.state are made observable, just to make sure @computed fields that // are defined inside the component, and which rely on state or props, re-compute if state or props change // (otherwise the computed wouldn't update and become stale on props change, since props are not observable) // However, this solution is not without it's own problems: https://github.com/mobxjs/mobx-react/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3Aobservable-props-or-not+ makeObservableProp(target, "props"); makeObservableProp(target, "state"); var baseRender = target.render; target.render = function () { return makeComponentReactive.call(this, baseRender); }; patch(target, "componentWillUnmount", function () { var _this$render$mobxAdmi; if (isUsingStaticRendering() === true) return; (_this$render$mobxAdmi = this.render[mobxAdminProperty]) === null || _this$render$mobxAdmi === void 0 ? void 0 : _this$render$mobxAdmi.dispose(); this[mobxIsUnmounted] = true; if (!this.render[mobxAdminProperty]) { // Render may have been hot-swapped and/or overriden by a subclass. var _displayName = getDisplayName(this); console.warn("The reactive render of an observer class component (" + _displayName + ") \n was overriden after MobX attached. This may result in a memory leak if the \n overriden reactive render was not properly disposed."); } }); return componentClass; } // Generates a friendly name for debugging function getDisplayName(comp) { return comp.displayName || comp.name || comp.constructor && (comp.constructor.displayName || comp.constructor.name) || ""; } function makeComponentReactive(render) { var _this = this; if (isUsingStaticRendering() === true) return render.call(this); /** * If props are shallowly modified, react will render anyway, * so atom.reportChanged() should not result in yet another re-render */ setHiddenProp(this, skipRenderKey, false); /** * forceUpdate will re-assign this.props. We don't want that to cause a loop, * so detect these changes */ setHiddenProp(this, isForcingUpdateKey, false); var initialName = getDisplayName(this); var baseRender = render.bind(this); var isRenderingPending = false; var reaction = new mobx_module["c" /* Reaction */](initialName + ".render()", function () { if (!isRenderingPending) { // N.B. Getting here *before mounting* means that a component constructor has side effects (see the relevant test in misc.js) // This unidiomatic React usage but React will correctly warn about this so we continue as usual // See #85 / Pull #44 isRenderingPending = true; if (_this[mobxIsUnmounted] !== true) { var hasError = true; try { setHiddenProp(_this, isForcingUpdateKey, true); if (!_this[skipRenderKey]) compat_module["a" /* Component */].prototype.forceUpdate.call(_this); hasError = false; } finally { setHiddenProp(_this, isForcingUpdateKey, false); if (hasError) reaction.dispose(); } } } }); reaction["reactComponent"] = this; reactiveRender[mobxAdminProperty] = reaction; this.render = reactiveRender; function reactiveRender() { isRenderingPending = false; var exception = undefined; var rendering = undefined; reaction.track(function () { try { rendering = Object(mobx_module["d" /* _allowStateChanges */])(false, baseRender); } catch (e) { exception = e; } }); if (exception) { throw exception; } return rendering; } return reactiveRender.call(this); } function observerSCU(nextProps, nextState) { if (isUsingStaticRendering()) { console.warn("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side."); } // update on any state changes (as is the default) if (this.state !== nextState) { return true; } // update if props are shallowly not equal, inspired by PureRenderMixin // we could return just 'false' here, and avoid the `skipRender` checks etc // however, it is nicer if lifecycle events are triggered like usually, // so we return true here if props are shallowly modified. return !shallowEqual(this.props, nextProps); } function makeObservableProp(target, propName) { var valueHolderKey = newSymbol("reactProp_" + propName + "_valueHolder"); var atomHolderKey = newSymbol("reactProp_" + propName + "_atomHolder"); function getAtom() { if (!this[atomHolderKey]) { setHiddenProp(this, atomHolderKey, Object(mobx_module["o" /* createAtom */])("reactive " + propName)); } return this[atomHolderKey]; } Object.defineProperty(target, propName, { configurable: true, enumerable: true, get: function get() { var prevReadState = false; if (mobx_module["f" /* _allowStateReadsStart */] && mobx_module["e" /* _allowStateReadsEnd */]) { prevReadState = Object(mobx_module["f" /* _allowStateReadsStart */])(true); } getAtom.call(this).reportObserved(); if (mobx_module["f" /* _allowStateReadsStart */] && mobx_module["e" /* _allowStateReadsEnd */]) { Object(mobx_module["e" /* _allowStateReadsEnd */])(prevReadState); } return this[valueHolderKey]; }, set: function set(v) { if (!this[isForcingUpdateKey] && !shallowEqual(this[valueHolderKey], v)) { setHiddenProp(this, valueHolderKey, v); setHiddenProp(this, skipRenderKey, true); getAtom.call(this).reportChanged(); setHiddenProp(this, skipRenderKey, false); } else { setHiddenProp(this, valueHolderKey, v); } } }); } var hasSymbol = typeof Symbol === "function" && Symbol.for; // Using react-is had some issues (and operates on elements, not on types), see #608 / #609 var ReactForwardRefSymbol = hasSymbol ? /*#__PURE__*/ Symbol.for("react.forward_ref") : typeof compat_module["e" /* forwardRef */] === "function" && /*#__PURE__*/ Object(compat_module["e" /* forwardRef */])(function (props) { return null; })["$$typeof"]; var ReactMemoSymbol = hasSymbol ? /*#__PURE__*/ Symbol.for("react.memo") : typeof compat_module["f" /* memo */] === "function" && /*#__PURE__*/ Object(compat_module["f" /* memo */])(function (props) { return null; })["$$typeof"]; /** * Observer function / decorator */ function mobxreact_esm_observer(component) { if (component["isMobxInjector"] === true) { console.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"); } if (ReactMemoSymbol && component["$$typeof"] === ReactMemoSymbol) { throw new Error("Mobx observer: You are trying to use 'observer' on a function component wrapped in either another observer or 'React.memo'. The observer already applies 'React.memo' for you."); } // Unwrap forward refs into `` component // we need to unwrap the render, because it is the inner render that needs to be tracked, // not the ForwardRef HoC if (ReactForwardRefSymbol && component["$$typeof"] === ReactForwardRefSymbol) { var baseRender = component["render"]; if (typeof baseRender !== "function") throw new Error("render property of ForwardRef was not a function"); return Object(compat_module["e" /* forwardRef */])(function ObserverForwardRef() { var args = arguments; return Object(compat_module["c" /* createElement */])(ObserverComponent, null, function () { return baseRender.apply(undefined, args); }); }); } // Function component if (typeof component === "function" && (!component.prototype || !component.prototype.render) && !component["isReactClass"] && !Object.prototype.isPrototypeOf.call(compat_module["a" /* Component */], component)) { return observer(component); } return makeClassComponentObserver(component); } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } var MobXProviderContext = /*#__PURE__*/ compat_module["d" /* default */].createContext({}); function Provider(props) { var children = props.children, stores = _objectWithoutPropertiesLoose(props, ["children"]); var parentValue = compat_module["d" /* default */].useContext(MobXProviderContext); var mutableProviderRef = compat_module["d" /* default */].useRef(_extends({}, parentValue, stores)); var value = mutableProviderRef.current; if (false) { var newValue; } return compat_module["d" /* default */].createElement(MobXProviderContext.Provider, { value: value }, children); } Provider.displayName = "MobXProvider"; /** * Store Injection */ function createStoreInjector(grabStoresFn, component, injectNames, makeReactive) { // Support forward refs var Injector = compat_module["d" /* default */].forwardRef(function (props, ref) { var newProps = _extends({}, props); var context = compat_module["d" /* default */].useContext(MobXProviderContext); Object.assign(newProps, grabStoresFn(context || {}, newProps) || {}); if (ref) { newProps.ref = ref; } return compat_module["d" /* default */].createElement(component, newProps); }); if (makeReactive) Injector = mobxreact_esm_observer(Injector); Injector["isMobxInjector"] = true; // assigned late to suppress observer warning // Static fields from component should be visible on the generated Injector mobxreact_esm_copyStaticProperties(component, Injector); Injector["wrappedComponent"] = component; Injector.displayName = getInjectName(component, injectNames); return Injector; } function getInjectName(component, injectNames) { var displayName; var componentName = component.displayName || component.name || component.constructor && component.constructor.name || "Component"; if (injectNames) displayName = "inject-with-" + injectNames + "(" + componentName + ")";else displayName = "inject(" + componentName + ")"; return displayName; } function grabStoresByName(storeNames) { return function (baseStores, nextProps) { storeNames.forEach(function (storeName) { if (storeName in nextProps // prefer props over stores ) return; if (!(storeName in baseStores)) throw new Error("MobX injector: Store '" + storeName + "' is not available! Make sure it is provided by some Provider"); nextProps[storeName] = baseStores[storeName]; }); return nextProps; }; } /** * higher order component that injects stores to a child. * takes either a varargs list of strings, which are stores read from the context, * or a function that manually maps the available stores from the context to props: * storesToProps(mobxStores, props, context) => newProps */ function inject() { for (var _len = arguments.length, storeNames = new Array(_len), _key = 0; _key < _len; _key++) { storeNames[_key] = arguments[_key]; } if (typeof arguments[0] === "function") { var grabStoresFn = arguments[0]; return function (componentClass) { return createStoreInjector(grabStoresFn, componentClass, grabStoresFn.name, true); }; } else { return function (componentClass) { return createStoreInjector(grabStoresByName(storeNames), componentClass, storeNames.join("-"), false); }; } } var protoStoreKey = /*#__PURE__*/ newSymbol("disposeOnUnmountProto"); var instStoreKey = /*#__PURE__*/ newSymbol("disposeOnUnmountInst"); function runDisposersOnWillUnmount() { var _this = this; [].concat(this[protoStoreKey] || [], this[instStoreKey] || []).forEach(function (propKeyOrFunction) { var prop = typeof propKeyOrFunction === "string" ? _this[propKeyOrFunction] : propKeyOrFunction; if (prop !== undefined && prop !== null) { if (Array.isArray(prop)) prop.map(function (f) { return f(); });else prop(); } }); } function disposeOnUnmount(target, propertyKeyOrFunction) { if (Array.isArray(propertyKeyOrFunction)) { return propertyKeyOrFunction.map(function (fn) { return disposeOnUnmount(target, fn); }); } var c = Object.getPrototypeOf(target).constructor; var c2 = Object.getPrototypeOf(target.constructor); // Special case for react-hot-loader var c3 = Object.getPrototypeOf(Object.getPrototypeOf(target)); if (!(c === compat_module["d" /* default */].Component || c === compat_module["d" /* default */].PureComponent || c2 === compat_module["d" /* default */].Component || c2 === compat_module["d" /* default */].PureComponent || c3 === compat_module["d" /* default */].Component || c3 === compat_module["d" /* default */].PureComponent)) { throw new Error("[mobx-react] disposeOnUnmount only supports direct subclasses of React.Component or React.PureComponent."); } if (typeof propertyKeyOrFunction !== "string" && typeof propertyKeyOrFunction !== "function" && !Array.isArray(propertyKeyOrFunction)) { throw new Error("[mobx-react] disposeOnUnmount only works if the parameter is either a property key or a function."); } // decorator's target is the prototype, so it doesn't have any instance properties like props var isDecorator = typeof propertyKeyOrFunction === "string"; // add property key / function we want run (disposed) to the store var componentWasAlreadyModified = !!target[protoStoreKey] || !!target[instStoreKey]; var store = isDecorator ? // decorators are added to the prototype store target[protoStoreKey] || (target[protoStoreKey] = []) : // functions are added to the instance store target[instStoreKey] || (target[instStoreKey] = []); store.push(propertyKeyOrFunction); // tweak the component class componentWillUnmount if not done already if (!componentWasAlreadyModified) { patch(target, "componentWillUnmount", runDisposersOnWillUnmount); } // return the disposer as is if invoked as a non decorator if (typeof propertyKeyOrFunction !== "string") { return propertyKeyOrFunction; } } function createChainableTypeChecker(validator) { function checkType(isRequired, props, propName, componentName, location, propFullName) { for (var _len = arguments.length, rest = new Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) { rest[_key - 6] = arguments[_key]; } return Object(mobx_module["K" /* untracked */])(function () { componentName = componentName || "<>"; propFullName = propFullName || propName; if (props[propName] == null) { if (isRequired) { var actual = props[propName] === null ? "null" : "undefined"; return new Error("The " + location + " `" + propFullName + "` is marked as required " + "in `" + componentName + "`, but its value is `" + actual + "`."); } return null; } else { // @ts-ignore rest arg is necessary for some React internals - fails tests otherwise return validator.apply(void 0, [props, propName, componentName, location, propFullName].concat(rest)); } }); } var chainedCheckType = checkType.bind(null, false); // Add isRequired to satisfy Requirable chainedCheckType.isRequired = checkType.bind(null, true); return chainedCheckType; } // Copied from React.PropTypes function isSymbol(propType, propValue) { // Native Symbol. if (propType === "symbol") { return true; } // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' if (propValue["@@toStringTag"] === "Symbol") { return true; } // Fallback for non-spec compliant Symbols which are polyfilled. if (typeof Symbol === "function" && propValue instanceof Symbol) { return true; } return false; } // Copied from React.PropTypes function getPropType(propValue) { var propType = typeof propValue; if (Array.isArray(propValue)) { return "array"; } if (propValue instanceof RegExp) { // Old webkits (at least until Android 4.0) return 'function' rather than // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ // passes PropTypes.object. return "object"; } if (isSymbol(propType, propValue)) { return "symbol"; } return propType; } // This handles more types than `getPropType`. Only used for error messages. // Copied from React.PropTypes function getPreciseType(propValue) { var propType = getPropType(propValue); if (propType === "object") { if (propValue instanceof Date) { return "date"; } else if (propValue instanceof RegExp) { return "regexp"; } } return propType; } function createObservableTypeCheckerCreator(allowNativeType, mobxType) { return createChainableTypeChecker(function (props, propName, componentName, location, propFullName) { return Object(mobx_module["K" /* untracked */])(function () { if (allowNativeType) { if (getPropType(props[propName]) === mobxType.toLowerCase()) return null; } var mobxChecker; switch (mobxType) { case "Array": mobxChecker = mobx_module["y" /* isObservableArray */]; break; case "Object": mobxChecker = mobx_module["A" /* isObservableObject */]; break; case "Map": mobxChecker = mobx_module["z" /* isObservableMap */]; break; default: throw new Error("Unexpected mobxType: " + mobxType); } var propValue = props[propName]; if (!mobxChecker(propValue)) { var preciseType = getPreciseType(propValue); var nativeTypeExpectationMessage = allowNativeType ? " or javascript `" + mobxType.toLowerCase() + "`" : ""; return new Error("Invalid prop `" + propFullName + "` of type `" + preciseType + "` supplied to" + " `" + componentName + "`, expected `mobx.Observable" + mobxType + "`" + nativeTypeExpectationMessage + "."); } return null; }); }); } function createObservableArrayOfTypeChecker(allowNativeType, typeChecker) { return createChainableTypeChecker(function (props, propName, componentName, location, propFullName) { for (var _len2 = arguments.length, rest = new Array(_len2 > 5 ? _len2 - 5 : 0), _key2 = 5; _key2 < _len2; _key2++) { rest[_key2 - 5] = arguments[_key2]; } return Object(mobx_module["K" /* untracked */])(function () { if (typeof typeChecker !== "function") { return new Error("Property `" + propFullName + "` of component `" + componentName + "` has " + "invalid PropType notation."); } else { var error = createObservableTypeCheckerCreator(allowNativeType, "Array")(props, propName, componentName, location, propFullName); if (error instanceof Error) return error; var propValue = props[propName]; for (var i = 0; i < propValue.length; i++) { error = typeChecker.apply(void 0, [propValue, i, componentName, location, propFullName + "[" + i + "]"].concat(rest)); if (error instanceof Error) return error; } return null; } }); }); } var observableArray = /*#__PURE__*/ createObservableTypeCheckerCreator(false, "Array"); var observableArrayOf = /*#__PURE__*/ createObservableArrayOfTypeChecker.bind(null, false); var observableMap = /*#__PURE__*/ createObservableTypeCheckerCreator(false, "Map"); var observableObject = /*#__PURE__*/ createObservableTypeCheckerCreator(false, "Object"); var arrayOrObservableArray = /*#__PURE__*/ createObservableTypeCheckerCreator(true, "Array"); var arrayOrObservableArrayOf = /*#__PURE__*/ createObservableArrayOfTypeChecker.bind(null, true); var objectOrObservableObject = /*#__PURE__*/ createObservableTypeCheckerCreator(true, "Object"); var PropTypes = { observableArray: observableArray, observableArrayOf: observableArrayOf, observableMap: observableMap, observableObject: observableObject, arrayOrObservableArray: arrayOrObservableArray, arrayOrObservableArrayOf: arrayOrObservableArrayOf, objectOrObservableObject: objectOrObservableObject }; if (!compat_module["a" /* Component */]) throw new Error("mobx-react requires React to be available"); if (!mobx_module["C" /* observable */]) throw new Error("mobx-react requires mobx to be available"); //# sourceMappingURL=mobxreact.esm.js.map // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/preact/dist/preact.module.js var preact_module = __webpack_require__(1); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.array.iterator.js var es_array_iterator = __webpack_require__(3); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.map.js var es_map = __webpack_require__(60); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.object.to-string.js var es_object_to_string = __webpack_require__(2); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.string.iterator.js var es_string_iterator = __webpack_require__(6); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/web.dom-collections.iterator.js var web_dom_collections_iterator = __webpack_require__(4); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/web.dom-collections.for-each.js var web_dom_collections_for_each = __webpack_require__(11); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.array.map.js var es_array_map = __webpack_require__(41); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.function.name.js var es_function_name = __webpack_require__(23); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.object.keys.js var es_object_keys = __webpack_require__(20); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.symbol.js var es_symbol = __webpack_require__(5); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.array.filter.js var es_array_filter = __webpack_require__(22); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.object.get-own-property-descriptor.js var es_object_get_own_property_descriptor = __webpack_require__(21); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.object.get-own-property-descriptors.js var es_object_get_own_property_descriptors = __webpack_require__(24); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.symbol.description.js var es_symbol_description = __webpack_require__(8); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.symbol.iterator.js var es_symbol_iterator = __webpack_require__(9); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.array.slice.js var es_array_slice = __webpack_require__(17); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.array.from.js var es_array_from = __webpack_require__(25); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.regexp.exec.js var es_regexp_exec = __webpack_require__(19); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.array.concat.js var es_array_concat = __webpack_require__(29); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.array.sort.js var es_array_sort = __webpack_require__(187); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.array.find.js var es_array_find = __webpack_require__(192); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.array.splice.js var es_array_splice = __webpack_require__(103); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.array.includes.js var es_array_includes = __webpack_require__(152); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.string.includes.js var es_string_includes = __webpack_require__(153); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_arrayMap.js /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = array == null ? 0 : array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } /* harmony default export */ var _arrayMap = (arrayMap); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_listCacheClear.js /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; this.size = 0; } /* harmony default export */ var _listCacheClear = (listCacheClear); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/eq.js /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } /* harmony default export */ var lodash_es_eq = (eq); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_assocIndexOf.js /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (lodash_es_eq(array[length][0], key)) { return length; } } return -1; } /* harmony default export */ var _assocIndexOf = (assocIndexOf); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_listCacheDelete.js /** Used for built-in method references. */ var arrayProto = Array.prototype; /** Built-in value references. */ var splice = arrayProto.splice; /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = _assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } --this.size; return true; } /* harmony default export */ var _listCacheDelete = (listCacheDelete); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_listCacheGet.js /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = _assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } /* harmony default export */ var _listCacheGet = (listCacheGet); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_listCacheHas.js /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return _assocIndexOf(this.__data__, key) > -1; } /* harmony default export */ var _listCacheHas = (listCacheHas); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_listCacheSet.js /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = _assocIndexOf(data, key); if (index < 0) { ++this.size; data.push([key, value]); } else { data[index][1] = value; } return this; } /* harmony default export */ var _listCacheSet = (listCacheSet); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_ListCache.js /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `ListCache`. ListCache.prototype.clear = _listCacheClear; ListCache.prototype['delete'] = _listCacheDelete; ListCache.prototype.get = _listCacheGet; ListCache.prototype.has = _listCacheHas; ListCache.prototype.set = _listCacheSet; /* harmony default export */ var _ListCache = (ListCache); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_stackClear.js /** * Removes all key-value entries from the stack. * * @private * @name clear * @memberOf Stack */ function stackClear() { this.__data__ = new _ListCache; this.size = 0; } /* harmony default export */ var _stackClear = (stackClear); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_stackDelete.js /** * Removes `key` and its value from the stack. * * @private * @name delete * @memberOf Stack * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { var data = this.__data__, result = data['delete'](key); this.size = data.size; return result; } /* harmony default export */ var _stackDelete = (stackDelete); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_stackGet.js /** * Gets the stack value for `key`. * * @private * @name get * @memberOf Stack * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function stackGet(key) { return this.__data__.get(key); } /* harmony default export */ var _stackGet = (stackGet); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_stackHas.js /** * Checks if a stack value for `key` exists. * * @private * @name has * @memberOf Stack * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { return this.__data__.has(key); } /* harmony default export */ var _stackHas = (stackHas); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_root.js var _root = __webpack_require__(31); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_Symbol.js /** Built-in value references. */ var _Symbol_Symbol = _root["a" /* default */].Symbol; /* harmony default export */ var _Symbol = (_Symbol_Symbol); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_getRawTag.js /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var _getRawTag_hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** Built-in value references. */ var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined; /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = _getRawTag_hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } /* harmony default export */ var _getRawTag = (getRawTag); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_objectToString.js /** Used for built-in method references. */ var _objectToString_objectProto = Object.prototype; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var _objectToString_nativeObjectToString = _objectToString_objectProto.toString; /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return _objectToString_nativeObjectToString.call(value); } /* harmony default export */ var _objectToString = (objectToString); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseGetTag.js /** `Object#toString` result references. */ var nullTag = '[object Null]', undefinedTag = '[object Undefined]'; /** Built-in value references. */ var _baseGetTag_symToStringTag = _Symbol ? _Symbol.toStringTag : undefined; /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } return (_baseGetTag_symToStringTag && _baseGetTag_symToStringTag in Object(value)) ? _getRawTag(value) : _objectToString(value); } /* harmony default export */ var _baseGetTag = (baseGetTag); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isObject.js /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } /* harmony default export */ var lodash_es_isObject = (isObject); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isFunction.js /** `Object#toString` result references. */ var asyncTag = '[object AsyncFunction]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', proxyTag = '[object Proxy]'; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { if (!lodash_es_isObject(value)) { return false; } // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 9 which returns 'object' for typed arrays and other constructors. var tag = _baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } /* harmony default export */ var lodash_es_isFunction = (isFunction); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_coreJsData.js /** Used to detect overreaching core-js shims. */ var coreJsData = _root["a" /* default */]['__core-js_shared__']; /* harmony default export */ var _coreJsData = (coreJsData); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_isMasked.js /** Used to detect methods masquerading as native. */ var maskSrcKey = (function() { var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } /* harmony default export */ var _isMasked = (isMasked); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_toSource.js /** Used for built-in method references. */ var funcProto = Function.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** * Converts `func` to its source code. * * @private * @param {Function} func The function to convert. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } /* harmony default export */ var _toSource = (toSource); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseIsNative.js /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used for built-in method references. */ var _baseIsNative_funcProto = Function.prototype, _baseIsNative_objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var _baseIsNative_funcToString = _baseIsNative_funcProto.toString; /** Used to check objects for own properties. */ var _baseIsNative_hasOwnProperty = _baseIsNative_objectProto.hasOwnProperty; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + _baseIsNative_funcToString.call(_baseIsNative_hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!lodash_es_isObject(value) || _isMasked(value)) { return false; } var pattern = lodash_es_isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(_toSource(value)); } /* harmony default export */ var _baseIsNative = (baseIsNative); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_getValue.js /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } /* harmony default export */ var _getValue = (getValue); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_getNative.js /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = _getValue(object, key); return _baseIsNative(value) ? value : undefined; } /* harmony default export */ var _getNative = (getNative); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_Map.js /* Built-in method references that are verified to be native. */ var _Map_Map = _getNative(_root["a" /* default */], 'Map'); /* harmony default export */ var _Map = (_Map_Map); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_nativeCreate.js /* Built-in method references that are verified to be native. */ var nativeCreate = _getNative(Object, 'create'); /* harmony default export */ var _nativeCreate = (nativeCreate); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_hashClear.js /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = _nativeCreate ? _nativeCreate(null) : {}; this.size = 0; } /* harmony default export */ var _hashClear = (hashClear); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_hashDelete.js /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { var result = this.has(key) && delete this.__data__[key]; this.size -= result ? 1 : 0; return result; } /* harmony default export */ var _hashDelete = (hashDelete); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_hashGet.js /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used for built-in method references. */ var _hashGet_objectProto = Object.prototype; /** Used to check objects for own properties. */ var _hashGet_hasOwnProperty = _hashGet_objectProto.hasOwnProperty; /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (_nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return _hashGet_hasOwnProperty.call(data, key) ? data[key] : undefined; } /* harmony default export */ var _hashGet = (hashGet); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_hashHas.js /** Used for built-in method references. */ var _hashHas_objectProto = Object.prototype; /** Used to check objects for own properties. */ var _hashHas_hasOwnProperty = _hashHas_objectProto.hasOwnProperty; /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return _nativeCreate ? (data[key] !== undefined) : _hashHas_hasOwnProperty.call(data, key); } /* harmony default export */ var _hashHas = (hashHas); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_hashSet.js /** Used to stand-in for `undefined` hash values. */ var _hashSet_HASH_UNDEFINED = '__lodash_hash_undefined__'; /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = (_nativeCreate && value === undefined) ? _hashSet_HASH_UNDEFINED : value; return this; } /* harmony default export */ var _hashSet = (hashSet); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_Hash.js /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `Hash`. Hash.prototype.clear = _hashClear; Hash.prototype['delete'] = _hashDelete; Hash.prototype.get = _hashGet; Hash.prototype.has = _hashHas; Hash.prototype.set = _hashSet; /* harmony default export */ var _Hash = (Hash); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_mapCacheClear.js /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.size = 0; this.__data__ = { 'hash': new _Hash, 'map': new (_Map || _ListCache), 'string': new _Hash }; } /* harmony default export */ var _mapCacheClear = (mapCacheClear); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_isKeyable.js /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } /* harmony default export */ var _isKeyable = (isKeyable); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_getMapData.js /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return _isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } /* harmony default export */ var _getMapData = (getMapData); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_mapCacheDelete.js /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { var result = _getMapData(this, key)['delete'](key); this.size -= result ? 1 : 0; return result; } /* harmony default export */ var _mapCacheDelete = (mapCacheDelete); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_mapCacheGet.js /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return _getMapData(this, key).get(key); } /* harmony default export */ var _mapCacheGet = (mapCacheGet); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_mapCacheHas.js /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return _getMapData(this, key).has(key); } /* harmony default export */ var _mapCacheHas = (mapCacheHas); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_mapCacheSet.js /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { var data = _getMapData(this, key), size = data.size; data.set(key, value); this.size += data.size == size ? 0 : 1; return this; } /* harmony default export */ var _mapCacheSet = (mapCacheSet); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_MapCache.js /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `MapCache`. MapCache.prototype.clear = _mapCacheClear; MapCache.prototype['delete'] = _mapCacheDelete; MapCache.prototype.get = _mapCacheGet; MapCache.prototype.has = _mapCacheHas; MapCache.prototype.set = _mapCacheSet; /* harmony default export */ var _MapCache = (MapCache); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_stackSet.js /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** * Sets the stack `key` to `value`. * * @private * @name set * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { var data = this.__data__; if (data instanceof _ListCache) { var pairs = data.__data__; if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { pairs.push([key, value]); this.size = ++data.size; return this; } data = this.__data__ = new _MapCache(pairs); } data.set(key, value); this.size = data.size; return this; } /* harmony default export */ var _stackSet = (stackSet); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_Stack.js /** * Creates a stack cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { var data = this.__data__ = new _ListCache(entries); this.size = data.size; } // Add methods to `Stack`. Stack.prototype.clear = _stackClear; Stack.prototype['delete'] = _stackDelete; Stack.prototype.get = _stackGet; Stack.prototype.has = _stackHas; Stack.prototype.set = _stackSet; /* harmony default export */ var _Stack = (Stack); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_setCacheAdd.js /** Used to stand-in for `undefined` hash values. */ var _setCacheAdd_HASH_UNDEFINED = '__lodash_hash_undefined__'; /** * Adds `value` to the array cache. * * @private * @name add * @memberOf SetCache * @alias push * @param {*} value The value to cache. * @returns {Object} Returns the cache instance. */ function setCacheAdd(value) { this.__data__.set(value, _setCacheAdd_HASH_UNDEFINED); return this; } /* harmony default export */ var _setCacheAdd = (setCacheAdd); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_setCacheHas.js /** * Checks if `value` is in the array cache. * * @private * @name has * @memberOf SetCache * @param {*} value The value to search for. * @returns {number} Returns `true` if `value` is found, else `false`. */ function setCacheHas(value) { return this.__data__.has(value); } /* harmony default export */ var _setCacheHas = (setCacheHas); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_SetCache.js /** * * Creates an array cache object to store unique values. * * @private * @constructor * @param {Array} [values] The values to cache. */ function SetCache(values) { var index = -1, length = values == null ? 0 : values.length; this.__data__ = new _MapCache; while (++index < length) { this.add(values[index]); } } // Add methods to `SetCache`. SetCache.prototype.add = SetCache.prototype.push = _setCacheAdd; SetCache.prototype.has = _setCacheHas; /* harmony default export */ var _SetCache = (SetCache); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_arraySome.js /** * A specialized version of `_.some` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function arraySome(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } /* harmony default export */ var _arraySome = (arraySome); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_cacheHas.js /** * Checks if a `cache` value for `key` exists. * * @private * @param {Object} cache The cache to query. * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function cacheHas(cache, key) { return cache.has(key); } /* harmony default export */ var _cacheHas = (cacheHas); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_equalArrays.js /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } // Check that cyclic values are equal. var arrStacked = stack.get(array); var othStacked = stack.get(other); if (arrStacked && othStacked) { return arrStacked == other && othStacked == array; } var index = -1, result = true, seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new _SetCache : undefined; stack.set(array, other); stack.set(other, array); // Ignore non-index properties. while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { continue; } result = false; break; } // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!_arraySome(other, function(othValue, othIndex) { if (!_cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { result = false; break; } } else if (!( arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack) )) { result = false; break; } } stack['delete'](array); stack['delete'](other); return result; } /* harmony default export */ var _equalArrays = (equalArrays); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_Uint8Array.js /** Built-in value references. */ var _Uint8Array_Uint8Array = _root["a" /* default */].Uint8Array; /* harmony default export */ var _Uint8Array = (_Uint8Array_Uint8Array); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_mapToArray.js /** * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } /* harmony default export */ var _mapToArray = (mapToArray); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_setToArray.js /** * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } /* harmony default export */ var _setToArray = (setToArray); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_equalByTag.js /** Used to compose bitmasks for value comparisons. */ var _equalByTag_COMPARE_PARTIAL_FLAG = 1, _equalByTag_COMPARE_UNORDERED_FLAG = 2; /** `Object#toString` result references. */ var boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', mapTag = '[object Map]', numberTag = '[object Number]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]'; /** Used to convert symbols to primitives and strings. */ var symbolProto = _Symbol ? _Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; /** * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * * **Note:** This function only supports comparing values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case dataViewTag: if ((object.byteLength != other.byteLength) || (object.byteOffset != other.byteOffset)) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if ((object.byteLength != other.byteLength) || !equalFunc(new _Uint8Array(object), new _Uint8Array(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: // Coerce booleans to `1` or `0` and dates to milliseconds. // Invalid dates are coerced to `NaN`. return lodash_es_eq(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: // Coerce regexes to strings and treat strings, primitives and objects, // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring // for more details. return object == (other + ''); case mapTag: var convert = _mapToArray; case setTag: var isPartial = bitmask & _equalByTag_COMPARE_PARTIAL_FLAG; convert || (convert = _setToArray); if (object.size != other.size && !isPartial) { return false; } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= _equalByTag_COMPARE_UNORDERED_FLAG; // Recursively compare objects (susceptible to call stack limits). stack.set(object, other); var result = _equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); stack['delete'](object); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } /* harmony default export */ var _equalByTag = (equalByTag); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_arrayPush.js /** * Appends the elements of `values` to `array`. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to append. * @returns {Array} Returns `array`. */ function arrayPush(array, values) { var index = -1, length = values.length, offset = array.length; while (++index < length) { array[offset + index] = values[index]; } return array; } /* harmony default export */ var _arrayPush = (arrayPush); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isArray.js /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; /* harmony default export */ var lodash_es_isArray = (isArray); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseGetAllKeys.js /** * The base implementation of `getAllKeys` and `getAllKeysIn` which uses * `keysFunc` and `symbolsFunc` to get the enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @param {Function} keysFunc The function to get the keys of `object`. * @param {Function} symbolsFunc The function to get the symbols of `object`. * @returns {Array} Returns the array of property names and symbols. */ function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result = keysFunc(object); return lodash_es_isArray(object) ? result : _arrayPush(result, symbolsFunc(object)); } /* harmony default export */ var _baseGetAllKeys = (baseGetAllKeys); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_arrayFilter.js /** * A specialized version of `_.filter` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[resIndex++] = value; } } return result; } /* harmony default export */ var _arrayFilter = (arrayFilter); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/stubArray.js /** * This method returns a new empty array. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {Array} Returns the new empty array. * @example * * var arrays = _.times(2, _.stubArray); * * console.log(arrays); * // => [[], []] * * console.log(arrays[0] === arrays[1]); * // => false */ function stubArray() { return []; } /* harmony default export */ var lodash_es_stubArray = (stubArray); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_getSymbols.js /** Used for built-in method references. */ var _getSymbols_objectProto = Object.prototype; /** Built-in value references. */ var propertyIsEnumerable = _getSymbols_objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetSymbols = Object.getOwnPropertySymbols; /** * Creates an array of the own enumerable symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbols = !nativeGetSymbols ? lodash_es_stubArray : function(object) { if (object == null) { return []; } object = Object(object); return _arrayFilter(nativeGetSymbols(object), function(symbol) { return propertyIsEnumerable.call(object, symbol); }); }; /* harmony default export */ var _getSymbols = (getSymbols); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseTimes.js /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } /* harmony default export */ var _baseTimes = (baseTimes); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isObjectLike.js /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return value != null && typeof value == 'object'; } /* harmony default export */ var lodash_es_isObjectLike = (isObjectLike); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseIsArguments.js /** `Object#toString` result references. */ var argsTag = '[object Arguments]'; /** * The base implementation of `_.isArguments`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, */ function baseIsArguments(value) { return lodash_es_isObjectLike(value) && _baseGetTag(value) == argsTag; } /* harmony default export */ var _baseIsArguments = (baseIsArguments); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isArguments.js /** Used for built-in method references. */ var isArguments_objectProto = Object.prototype; /** Used to check objects for own properties. */ var isArguments_hasOwnProperty = isArguments_objectProto.hasOwnProperty; /** Built-in value references. */ var isArguments_propertyIsEnumerable = isArguments_objectProto.propertyIsEnumerable; /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) { return lodash_es_isObjectLike(value) && isArguments_hasOwnProperty.call(value, 'callee') && !isArguments_propertyIsEnumerable.call(value, 'callee'); }; /* harmony default export */ var lodash_es_isArguments = (isArguments); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isBuffer.js var isBuffer = __webpack_require__(48); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_isIndex.js /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { var type = typeof value; length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (type == 'number' || (type != 'symbol' && reIsUint.test(value))) && (value > -1 && value % 1 == 0 && value < length); } /* harmony default export */ var _isIndex = (isIndex); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isLength.js /** Used as references for various `Number` constants. */ var isLength_MAX_SAFE_INTEGER = 9007199254740991; /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= isLength_MAX_SAFE_INTEGER; } /* harmony default export */ var lodash_es_isLength = (isLength); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseIsTypedArray.js /** `Object#toString` result references. */ var _baseIsTypedArray_argsTag = '[object Arguments]', arrayTag = '[object Array]', _baseIsTypedArray_boolTag = '[object Boolean]', _baseIsTypedArray_dateTag = '[object Date]', _baseIsTypedArray_errorTag = '[object Error]', _baseIsTypedArray_funcTag = '[object Function]', _baseIsTypedArray_mapTag = '[object Map]', _baseIsTypedArray_numberTag = '[object Number]', objectTag = '[object Object]', _baseIsTypedArray_regexpTag = '[object RegExp]', _baseIsTypedArray_setTag = '[object Set]', _baseIsTypedArray_stringTag = '[object String]', weakMapTag = '[object WeakMap]'; var _baseIsTypedArray_arrayBufferTag = '[object ArrayBuffer]', _baseIsTypedArray_dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[_baseIsTypedArray_argsTag] = typedArrayTags[arrayTag] = typedArrayTags[_baseIsTypedArray_arrayBufferTag] = typedArrayTags[_baseIsTypedArray_boolTag] = typedArrayTags[_baseIsTypedArray_dataViewTag] = typedArrayTags[_baseIsTypedArray_dateTag] = typedArrayTags[_baseIsTypedArray_errorTag] = typedArrayTags[_baseIsTypedArray_funcTag] = typedArrayTags[_baseIsTypedArray_mapTag] = typedArrayTags[_baseIsTypedArray_numberTag] = typedArrayTags[objectTag] = typedArrayTags[_baseIsTypedArray_regexpTag] = typedArrayTags[_baseIsTypedArray_setTag] = typedArrayTags[_baseIsTypedArray_stringTag] = typedArrayTags[weakMapTag] = false; /** * The base implementation of `_.isTypedArray` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. */ function baseIsTypedArray(value) { return lodash_es_isObjectLike(value) && lodash_es_isLength(value.length) && !!typedArrayTags[_baseGetTag(value)]; } /* harmony default export */ var _baseIsTypedArray = (baseIsTypedArray); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseUnary.js /** * The base implementation of `_.unary` without support for storing metadata. * * @private * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new capped function. */ function baseUnary(func) { return function(value) { return func(value); }; } /* harmony default export */ var _baseUnary = (baseUnary); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_nodeUtil.js var _nodeUtil = __webpack_require__(49); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isTypedArray.js /* Node.js helper references. */ var nodeIsTypedArray = _nodeUtil["a" /* default */] && _nodeUtil["a" /* default */].isTypedArray; /** * Checks if `value` is classified as a typed array. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. * @example * * _.isTypedArray(new Uint8Array); * // => true * * _.isTypedArray([]); * // => false */ var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray; /* harmony default export */ var lodash_es_isTypedArray = (isTypedArray); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_arrayLikeKeys.js /** Used for built-in method references. */ var _arrayLikeKeys_objectProto = Object.prototype; /** Used to check objects for own properties. */ var _arrayLikeKeys_hasOwnProperty = _arrayLikeKeys_objectProto.hasOwnProperty; /** * Creates an array of the enumerable property names of the array-like `value`. * * @private * @param {*} value The value to query. * @param {boolean} inherited Specify returning inherited property names. * @returns {Array} Returns the array of property names. */ function arrayLikeKeys(value, inherited) { var isArr = lodash_es_isArray(value), isArg = !isArr && lodash_es_isArguments(value), isBuff = !isArr && !isArg && Object(isBuffer["a" /* default */])(value), isType = !isArr && !isArg && !isBuff && lodash_es_isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? _baseTimes(value.length, String) : [], length = result.length; for (var key in value) { if ((inherited || _arrayLikeKeys_hasOwnProperty.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode. key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers. (isBuff && (key == 'offset' || key == 'parent')) || // PhantomJS 2 has enumerable non-index properties on typed arrays. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || // Skip index properties. _isIndex(key, length) ))) { result.push(key); } } return result; } /* harmony default export */ var _arrayLikeKeys = (arrayLikeKeys); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_isPrototype.js /** Used for built-in method references. */ var _isPrototype_objectProto = Object.prototype; /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || _isPrototype_objectProto; return value === proto; } /* harmony default export */ var _isPrototype = (isPrototype); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_overArg.js /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } /* harmony default export */ var _overArg = (overArg); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_nativeKeys.js /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeKeys = _overArg(Object.keys, Object); /* harmony default export */ var _nativeKeys = (nativeKeys); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseKeys.js /** Used for built-in method references. */ var _baseKeys_objectProto = Object.prototype; /** Used to check objects for own properties. */ var _baseKeys_hasOwnProperty = _baseKeys_objectProto.hasOwnProperty; /** * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { if (!_isPrototype(object)) { return _nativeKeys(object); } var result = []; for (var key in Object(object)) { if (_baseKeys_hasOwnProperty.call(object, key) && key != 'constructor') { result.push(key); } } return result; } /* harmony default export */ var _baseKeys = (baseKeys); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isArrayLike.js /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && lodash_es_isLength(value.length) && !lodash_es_isFunction(value); } /* harmony default export */ var lodash_es_isArrayLike = (isArrayLike); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/keys.js /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys_keys(object) { return lodash_es_isArrayLike(object) ? _arrayLikeKeys(object) : _baseKeys(object); } /* harmony default export */ var lodash_es_keys = (keys_keys); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_getAllKeys.js /** * Creates an array of own enumerable property names and symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeys(object) { return _baseGetAllKeys(object, lodash_es_keys, _getSymbols); } /* harmony default export */ var _getAllKeys = (getAllKeys); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_equalObjects.js /** Used to compose bitmasks for value comparisons. */ var _equalObjects_COMPARE_PARTIAL_FLAG = 1; /** Used for built-in method references. */ var _equalObjects_objectProto = Object.prototype; /** Used to check objects for own properties. */ var _equalObjects_hasOwnProperty = _equalObjects_objectProto.hasOwnProperty; /** * A specialized version of `baseIsEqualDeep` for objects with support for * partial deep comparisons. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & _equalObjects_COMPARE_PARTIAL_FLAG, objProps = _getAllKeys(object), objLength = objProps.length, othProps = _getAllKeys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : _equalObjects_hasOwnProperty.call(other, key))) { return false; } } // Check that cyclic values are equal. var objStacked = stack.get(object); var othStacked = stack.get(other); if (objStacked && othStacked) { return objStacked == other && othStacked == object; } var result = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) : compared )) { result = false; break; } skipCtor || (skipCtor = key == 'constructor'); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } stack['delete'](object); stack['delete'](other); return result; } /* harmony default export */ var _equalObjects = (equalObjects); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_DataView.js /* Built-in method references that are verified to be native. */ var DataView = _getNative(_root["a" /* default */], 'DataView'); /* harmony default export */ var _DataView = (DataView); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_Promise.js /* Built-in method references that are verified to be native. */ var _Promise_Promise = _getNative(_root["a" /* default */], 'Promise'); /* harmony default export */ var _Promise = (_Promise_Promise); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_Set.js /* Built-in method references that are verified to be native. */ var _Set_Set = _getNative(_root["a" /* default */], 'Set'); /* harmony default export */ var _Set = (_Set_Set); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_WeakMap.js /* Built-in method references that are verified to be native. */ var WeakMap = _getNative(_root["a" /* default */], 'WeakMap'); /* harmony default export */ var _WeakMap = (WeakMap); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_getTag.js /** `Object#toString` result references. */ var _getTag_mapTag = '[object Map]', _getTag_objectTag = '[object Object]', promiseTag = '[object Promise]', _getTag_setTag = '[object Set]', _getTag_weakMapTag = '[object WeakMap]'; var _getTag_dataViewTag = '[object DataView]'; /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = _toSource(_DataView), mapCtorString = _toSource(_Map), promiseCtorString = _toSource(_Promise), setCtorString = _toSource(_Set), weakMapCtorString = _toSource(_WeakMap); /** * Gets the `toStringTag` of `value`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ var getTag = _baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != _getTag_dataViewTag) || (_Map && getTag(new _Map) != _getTag_mapTag) || (_Promise && getTag(_Promise.resolve()) != promiseTag) || (_Set && getTag(new _Set) != _getTag_setTag) || (_WeakMap && getTag(new _WeakMap) != _getTag_weakMapTag)) { getTag = function(value) { var result = _baseGetTag(value), Ctor = result == _getTag_objectTag ? value.constructor : undefined, ctorString = Ctor ? _toSource(Ctor) : ''; if (ctorString) { switch (ctorString) { case dataViewCtorString: return _getTag_dataViewTag; case mapCtorString: return _getTag_mapTag; case promiseCtorString: return promiseTag; case setCtorString: return _getTag_setTag; case weakMapCtorString: return _getTag_weakMapTag; } } return result; }; } /* harmony default export */ var _getTag = (getTag); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseIsEqualDeep.js /** Used to compose bitmasks for value comparisons. */ var _baseIsEqualDeep_COMPARE_PARTIAL_FLAG = 1; /** `Object#toString` result references. */ var _baseIsEqualDeep_argsTag = '[object Arguments]', _baseIsEqualDeep_arrayTag = '[object Array]', _baseIsEqualDeep_objectTag = '[object Object]'; /** Used for built-in method references. */ var _baseIsEqualDeep_objectProto = Object.prototype; /** Used to check objects for own properties. */ var _baseIsEqualDeep_hasOwnProperty = _baseIsEqualDeep_objectProto.hasOwnProperty; /** * A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular * references to be compared. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { var objIsArr = lodash_es_isArray(object), othIsArr = lodash_es_isArray(other), objTag = objIsArr ? _baseIsEqualDeep_arrayTag : _getTag(object), othTag = othIsArr ? _baseIsEqualDeep_arrayTag : _getTag(other); objTag = objTag == _baseIsEqualDeep_argsTag ? _baseIsEqualDeep_objectTag : objTag; othTag = othTag == _baseIsEqualDeep_argsTag ? _baseIsEqualDeep_objectTag : othTag; var objIsObj = objTag == _baseIsEqualDeep_objectTag, othIsObj = othTag == _baseIsEqualDeep_objectTag, isSameTag = objTag == othTag; if (isSameTag && Object(isBuffer["a" /* default */])(object)) { if (!Object(isBuffer["a" /* default */])(other)) { return false; } objIsArr = true; objIsObj = false; } if (isSameTag && !objIsObj) { stack || (stack = new _Stack); return (objIsArr || lodash_es_isTypedArray(object)) ? _equalArrays(object, other, bitmask, customizer, equalFunc, stack) : _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & _baseIsEqualDeep_COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && _baseIsEqualDeep_hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && _baseIsEqualDeep_hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new _Stack); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } stack || (stack = new _Stack); return _equalObjects(object, other, bitmask, customizer, equalFunc, stack); } /* harmony default export */ var _baseIsEqualDeep = (baseIsEqualDeep); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseIsEqual.js /** * The base implementation of `_.isEqual` which supports partial comparisons * and tracks traversed objects. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {boolean} bitmask The bitmask flags. * 1 - Unordered comparison * 2 - Partial comparison * @param {Function} [customizer] The function to customize comparisons. * @param {Object} [stack] Tracks traversed `value` and `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, bitmask, customizer, stack) { if (value === other) { return true; } if (value == null || other == null || (!lodash_es_isObjectLike(value) && !lodash_es_isObjectLike(other))) { return value !== value && other !== other; } return _baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); } /* harmony default export */ var _baseIsEqual = (baseIsEqual); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseIsMatch.js /** Used to compose bitmasks for value comparisons. */ var _baseIsMatch_COMPARE_PARTIAL_FLAG = 1, _baseIsMatch_COMPARE_UNORDERED_FLAG = 2; /** * The base implementation of `_.isMatch` without support for iteratee shorthands. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Array} matchData The property names, values, and compare flags to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index, noCustomizer = !customizer; if (object == null) { return !length; } object = Object(object); while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) ? data[1] !== object[data[0]] : !(data[0] in object) ) { return false; } } while (++index < length) { data = matchData[index]; var key = data[0], objValue = object[key], srcValue = data[1]; if (noCustomizer && data[2]) { if (objValue === undefined && !(key in object)) { return false; } } else { var stack = new _Stack; if (customizer) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined ? _baseIsEqual(srcValue, objValue, _baseIsMatch_COMPARE_PARTIAL_FLAG | _baseIsMatch_COMPARE_UNORDERED_FLAG, customizer, stack) : result )) { return false; } } } return true; } /* harmony default export */ var _baseIsMatch = (baseIsMatch); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_isStrictComparable.js /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` if suitable for strict * equality comparisons, else `false`. */ function isStrictComparable(value) { return value === value && !lodash_es_isObject(value); } /* harmony default export */ var _isStrictComparable = (isStrictComparable); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_getMatchData.js /** * Gets the property names, values, and compare flags of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the match data of `object`. */ function getMatchData(object) { var result = lodash_es_keys(object), length = result.length; while (length--) { var key = result[length], value = object[key]; result[length] = [key, value, _isStrictComparable(value)]; } return result; } /* harmony default export */ var _getMatchData = (getMatchData); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_matchesStrictComparable.js /** * A specialized version of `matchesProperty` for source values suitable * for strict equality comparisons, i.e. `===`. * * @private * @param {string} key The key of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function matchesStrictComparable(key, srcValue) { return function(object) { if (object == null) { return false; } return object[key] === srcValue && (srcValue !== undefined || (key in Object(object))); }; } /* harmony default export */ var _matchesStrictComparable = (matchesStrictComparable); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseMatches.js /** * The base implementation of `_.matches` which doesn't clone `source`. * * @private * @param {Object} source The object of property values to match. * @returns {Function} Returns the new spec function. */ function baseMatches(source) { var matchData = _getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { return _matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function(object) { return object === source || _baseIsMatch(object, source, matchData); }; } /* harmony default export */ var _baseMatches = (baseMatches); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isSymbol.js /** `Object#toString` result references. */ var isSymbol_symbolTag = '[object Symbol]'; /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol_isSymbol(value) { return typeof value == 'symbol' || (lodash_es_isObjectLike(value) && _baseGetTag(value) == isSymbol_symbolTag); } /* harmony default export */ var lodash_es_isSymbol = (isSymbol_isSymbol); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_isKey.js /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/; /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (lodash_es_isArray(value)) { return false; } var type = typeof value; if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || lodash_es_isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object)); } /* harmony default export */ var _isKey = (isKey); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/memoize.js /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `clear`, `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoized function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result) || cache; return result; }; memoized.cache = new (memoize.Cache || _MapCache); return memoized; } // Expose `MapCache`. memoize.Cache = _MapCache; /* harmony default export */ var lodash_es_memoize = (memoize); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_memoizeCapped.js /** Used as the maximum memoize cache size. */ var MAX_MEMOIZE_SIZE = 500; /** * A specialized version of `_.memoize` which clears the memoized function's * cache when it exceeds `MAX_MEMOIZE_SIZE`. * * @private * @param {Function} func The function to have its output memoized. * @returns {Function} Returns the new memoized function. */ function memoizeCapped(func) { var result = lodash_es_memoize(func, function(key) { if (cache.size === MAX_MEMOIZE_SIZE) { cache.clear(); } return key; }); var cache = result.cache; return result; } /* harmony default export */ var _memoizeCapped = (memoizeCapped); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_stringToPath.js /** Used to match property names within property paths. */ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ var stringToPath = _memoizeCapped(function(string) { var result = []; if (string.charCodeAt(0) === 46 /* . */) { result.push(''); } string.replace(rePropName, function(match, number, quote, subString) { result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); }); return result; }); /* harmony default export */ var _stringToPath = (stringToPath); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseToString.js /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** Used to convert symbols to primitives and strings. */ var _baseToString_symbolProto = _Symbol ? _Symbol.prototype : undefined, symbolToString = _baseToString_symbolProto ? _baseToString_symbolProto.toString : undefined; /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (lodash_es_isArray(value)) { // Recursively convert values (susceptible to call stack limits). return _arrayMap(value, baseToString) + ''; } if (lodash_es_isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /* harmony default export */ var _baseToString = (baseToString); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/toString.js /** * Converts `value` to a string. An empty string is returned for `null` * and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {string} Returns the converted string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString_toString(value) { return value == null ? '' : _baseToString(value); } /* harmony default export */ var lodash_es_toString = (toString_toString); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_castPath.js /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @param {Object} [object] The object to query keys on. * @returns {Array} Returns the cast property path array. */ function castPath(value, object) { if (lodash_es_isArray(value)) { return value; } return _isKey(value, object) ? [value] : _stringToPath(lodash_es_toString(value)); } /* harmony default export */ var _castPath = (castPath); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_toKey.js /** Used as references for various `Number` constants. */ var _toKey_INFINITY = 1 / 0; /** * Converts `value` to a string key if it's not a string or symbol. * * @private * @param {*} value The value to inspect. * @returns {string|symbol} Returns the key. */ function toKey(value) { if (typeof value == 'string' || lodash_es_isSymbol(value)) { return value; } var result = (value + ''); return (result == '0' && (1 / value) == -_toKey_INFINITY) ? '-0' : result; } /* harmony default export */ var _toKey = (toKey); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseGet.js /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = _castPath(path, object); var index = 0, length = path.length; while (object != null && index < length) { object = object[_toKey(path[index++])]; } return (index && index == length) ? object : undefined; } /* harmony default export */ var _baseGet = (baseGet); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/get.js /** * Gets the value at `path` of `object`. If the resolved value is * `undefined`, the `defaultValue` is returned in its place. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.get(object, 'a[0].b.c'); * // => 3 * * _.get(object, ['a', '0', 'b', 'c']); * // => 3 * * _.get(object, 'a.b.c', 'default'); * // => 'default' */ function get_get(object, path, defaultValue) { var result = object == null ? undefined : _baseGet(object, path); return result === undefined ? defaultValue : result; } /* harmony default export */ var lodash_es_get = (get_get); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseHasIn.js /** * The base implementation of `_.hasIn` without support for deep paths. * * @private * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { return object != null && key in Object(object); } /* harmony default export */ var _baseHasIn = (baseHasIn); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_hasPath.js /** * Checks if `path` exists on `object`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @param {Function} hasFunc The function to check properties. * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { path = _castPath(path, object); var index = -1, length = path.length, result = false; while (++index < length) { var key = _toKey(path[index]); if (!(result = object != null && hasFunc(object, key))) { break; } object = object[key]; } if (result || ++index != length) { return result; } length = object == null ? 0 : object.length; return !!length && lodash_es_isLength(length) && _isIndex(key, length) && (lodash_es_isArray(object) || lodash_es_isArguments(object)); } /* harmony default export */ var _hasPath = (hasPath); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/hasIn.js /** * Checks if `path` is a direct or inherited property of `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.hasIn(object, 'a'); * // => true * * _.hasIn(object, 'a.b'); * // => true * * _.hasIn(object, ['a', 'b']); * // => true * * _.hasIn(object, 'b'); * // => false */ function hasIn(object, path) { return object != null && _hasPath(object, path, _baseHasIn); } /* harmony default export */ var lodash_es_hasIn = (hasIn); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseMatchesProperty.js /** Used to compose bitmasks for value comparisons. */ var _baseMatchesProperty_COMPARE_PARTIAL_FLAG = 1, _baseMatchesProperty_COMPARE_UNORDERED_FLAG = 2; /** * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. * * @private * @param {string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function baseMatchesProperty(path, srcValue) { if (_isKey(path) && _isStrictComparable(srcValue)) { return _matchesStrictComparable(_toKey(path), srcValue); } return function(object) { var objValue = lodash_es_get(object, path); return (objValue === undefined && objValue === srcValue) ? lodash_es_hasIn(object, path) : _baseIsEqual(srcValue, objValue, _baseMatchesProperty_COMPARE_PARTIAL_FLAG | _baseMatchesProperty_COMPARE_UNORDERED_FLAG); }; } /* harmony default export */ var _baseMatchesProperty = (baseMatchesProperty); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/identity.js /** * This method returns the first argument it receives. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'a': 1 }; * * console.log(_.identity(object) === object); * // => true */ function identity(value) { return value; } /* harmony default export */ var lodash_es_identity = (identity); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseProperty.js /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } /* harmony default export */ var _baseProperty = (baseProperty); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_basePropertyDeep.js /** * A specialized version of `baseProperty` which supports deep paths. * * @private * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. */ function basePropertyDeep(path) { return function(object) { return _baseGet(object, path); }; } /* harmony default export */ var _basePropertyDeep = (basePropertyDeep); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/property.js /** * Creates a function that returns the value at `path` of a given object. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. * @example * * var objects = [ * { 'a': { 'b': 2 } }, * { 'a': { 'b': 1 } } * ]; * * _.map(objects, _.property('a.b')); * // => [2, 1] * * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); * // => [1, 2] */ function property(path) { return _isKey(path) ? _baseProperty(_toKey(path)) : _basePropertyDeep(path); } /* harmony default export */ var lodash_es_property = (property); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseIteratee.js /** * The base implementation of `_.iteratee`. * * @private * @param {*} [value=_.identity] The value to convert to an iteratee. * @returns {Function} Returns the iteratee. */ function baseIteratee(value) { // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. if (typeof value == 'function') { return value; } if (value == null) { return lodash_es_identity; } if (typeof value == 'object') { return lodash_es_isArray(value) ? _baseMatchesProperty(value[0], value[1]) : _baseMatches(value); } return lodash_es_property(value); } /* harmony default export */ var _baseIteratee = (baseIteratee); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_createBaseFor.js /** * Creates a base function for methods like `_.forIn` and `_.forOwn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseFor(fromRight) { return function(object, iteratee, keysFunc) { var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; while (length--) { var key = props[fromRight ? length : ++index]; if (iteratee(iterable[key], key, iterable) === false) { break; } } return object; }; } /* harmony default export */ var _createBaseFor = (createBaseFor); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseFor.js /** * The base implementation of `baseForOwn` which iterates over `object` * properties returned by `keysFunc` and invokes `iteratee` for each property. * Iteratee functions may exit iteration early by explicitly returning `false`. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseFor = _createBaseFor(); /* harmony default export */ var _baseFor = (baseFor); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseForOwn.js /** * The base implementation of `_.forOwn` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwn(object, iteratee) { return object && _baseFor(object, iteratee, lodash_es_keys); } /* harmony default export */ var _baseForOwn = (baseForOwn); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_createBaseEach.js /** * Creates a `baseEach` or `baseEachRight` function. * * @private * @param {Function} eachFunc The function to iterate over a collection. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { if (collection == null) { return collection; } if (!lodash_es_isArrayLike(collection)) { return eachFunc(collection, iteratee); } var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection); while ((fromRight ? index-- : ++index < length)) { if (iteratee(iterable[index], index, iterable) === false) { break; } } return collection; }; } /* harmony default export */ var _createBaseEach = (createBaseEach); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseEach.js /** * The base implementation of `_.forEach` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ var baseEach = _createBaseEach(_baseForOwn); /* harmony default export */ var _baseEach = (baseEach); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseMap.js /** * The base implementation of `_.map` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function baseMap(collection, iteratee) { var index = -1, result = lodash_es_isArrayLike(collection) ? Array(collection.length) : []; _baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); }); return result; } /* harmony default export */ var _baseMap = (baseMap); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/map.js /** * Creates an array of values by running each element in `collection` thru * `iteratee`. The iteratee is invoked with three arguments: * (value, index|key, collection). * * Many lodash methods are guarded to work as iteratees for methods like * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, * `template`, `trim`, `trimEnd`, `trimStart`, and `words` * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new mapped array. * @example * * function square(n) { * return n * n; * } * * _.map([4, 8], square); * // => [16, 64] * * _.map({ 'a': 4, 'b': 8 }, square); * // => [16, 64] (iteration order is not guaranteed) * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * // The `_.property` iteratee shorthand. * _.map(users, 'user'); * // => ['barney', 'fred'] */ function map_map(collection, iteratee) { var func = lodash_es_isArray(collection) ? _arrayMap : _baseMap; return func(collection, _baseIteratee(iteratee, 3)); } /* harmony default export */ var lodash_es_map = (map_map); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_defineProperty.js var defineProperty = (function() { try { var func = _getNative(Object, 'defineProperty'); func({}, '', {}); return func; } catch (e) {} }()); /* harmony default export */ var _defineProperty = (defineProperty); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseAssignValue.js /** * The base implementation of `assignValue` and `assignMergeValue` without * value checks. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function baseAssignValue(object, key, value) { if (key == '__proto__' && _defineProperty) { _defineProperty(object, key, { 'configurable': true, 'enumerable': true, 'value': value, 'writable': true }); } else { object[key] = value; } } /* harmony default export */ var _baseAssignValue = (baseAssignValue); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_assignValue.js /** Used for built-in method references. */ var _assignValue_objectProto = Object.prototype; /** Used to check objects for own properties. */ var _assignValue_hasOwnProperty = _assignValue_objectProto.hasOwnProperty; /** * Assigns `value` to `key` of `object` if the existing value is not equivalent * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignValue(object, key, value) { var objValue = object[key]; if (!(_assignValue_hasOwnProperty.call(object, key) && lodash_es_eq(objValue, value)) || (value === undefined && !(key in object))) { _baseAssignValue(object, key, value); } } /* harmony default export */ var _assignValue = (assignValue); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_copyObject.js /** * Copies properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. */ function copyObject(source, props, object, customizer) { var isNew = !object; object || (object = {}); var index = -1, length = props.length; while (++index < length) { var key = props[index]; var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; if (newValue === undefined) { newValue = source[key]; } if (isNew) { _baseAssignValue(object, key, newValue); } else { _assignValue(object, key, newValue); } } return object; } /* harmony default export */ var _copyObject = (copyObject); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_apply.js /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. * * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. * @param {Array} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); case 3: return func.call(thisArg, args[0], args[1], args[2]); } return func.apply(thisArg, args); } /* harmony default export */ var _apply = (apply); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_overRest.js /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; /** * A specialized version of `baseRest` which transforms the rest array. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @param {Function} transform The rest array transform. * @returns {Function} Returns the new function. */ function overRest(func, start, transform) { start = nativeMax(start === undefined ? (func.length - 1) : start, 0); return function() { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); while (++index < length) { array[index] = args[start + index]; } index = -1; var otherArgs = Array(start + 1); while (++index < start) { otherArgs[index] = args[index]; } otherArgs[start] = transform(array); return _apply(func, this, otherArgs); }; } /* harmony default export */ var _overRest = (overRest); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/constant.js /** * Creates a function that returns `value`. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {*} value The value to return from the new function. * @returns {Function} Returns the new constant function. * @example * * var objects = _.times(2, _.constant({ 'a': 1 })); * * console.log(objects); * // => [{ 'a': 1 }, { 'a': 1 }] * * console.log(objects[0] === objects[1]); * // => true */ function constant(value) { return function() { return value; }; } /* harmony default export */ var lodash_es_constant = (constant); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseSetToString.js /** * The base implementation of `setToString` without support for hot loop shorting. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var baseSetToString = !_defineProperty ? lodash_es_identity : function(func, string) { return _defineProperty(func, 'toString', { 'configurable': true, 'enumerable': false, 'value': lodash_es_constant(string), 'writable': true }); }; /* harmony default export */ var _baseSetToString = (baseSetToString); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_shortOut.js /** Used to detect hot functions by number of calls within a span of milliseconds. */ var HOT_COUNT = 800, HOT_SPAN = 16; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeNow = Date.now; /** * Creates a function that'll short out and invoke `identity` instead * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` * milliseconds. * * @private * @param {Function} func The function to restrict. * @returns {Function} Returns the new shortable function. */ function shortOut(func) { var count = 0, lastCalled = 0; return function() { var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); lastCalled = stamp; if (remaining > 0) { if (++count >= HOT_COUNT) { return arguments[0]; } } else { count = 0; } return func.apply(undefined, arguments); }; } /* harmony default export */ var _shortOut = (shortOut); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_setToString.js /** * Sets the `toString` method of `func` to return `string`. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var setToString = _shortOut(_baseSetToString); /* harmony default export */ var _setToString = (setToString); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseRest.js /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @returns {Function} Returns the new function. */ function baseRest(func, start) { return _setToString(_overRest(func, start, lodash_es_identity), func + ''); } /* harmony default export */ var _baseRest = (baseRest); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_isIterateeCall.js /** * Checks if the given arguments are from an iteratee call. * * @private * @param {*} value The potential iteratee value argument. * @param {*} index The potential iteratee index or key argument. * @param {*} object The potential iteratee object argument. * @returns {boolean} Returns `true` if the arguments are from an iteratee call, * else `false`. */ function isIterateeCall(value, index, object) { if (!lodash_es_isObject(object)) { return false; } var type = typeof index; if (type == 'number' ? (lodash_es_isArrayLike(object) && _isIndex(index, object.length)) : (type == 'string' && index in object) ) { return lodash_es_eq(object[index], value); } return false; } /* harmony default export */ var _isIterateeCall = (isIterateeCall); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_createAssigner.js /** * Creates a function like `_.assign`. * * @private * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { return _baseRest(function(object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') ? (length--, customizer) : undefined; if (guard && _isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; } object = Object(object); while (++index < length) { var source = sources[index]; if (source) { assigner(object, source, index, customizer); } } return object; }); } /* harmony default export */ var _createAssigner = (createAssigner); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/assign.js /** Used for built-in method references. */ var assign_objectProto = Object.prototype; /** Used to check objects for own properties. */ var assign_hasOwnProperty = assign_objectProto.hasOwnProperty; /** * Assigns own enumerable string keyed properties of source objects to the * destination object. Source objects are applied from left to right. * Subsequent sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object` and is loosely based on * [`Object.assign`](https://mdn.io/Object/assign). * * @static * @memberOf _ * @since 0.10.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @see _.assignIn * @example * * function Foo() { * this.a = 1; * } * * function Bar() { * this.c = 3; * } * * Foo.prototype.b = 2; * Bar.prototype.d = 4; * * _.assign({ 'a': 0 }, new Foo, new Bar); * // => { 'a': 1, 'c': 3 } */ var assign_assign = _createAssigner(function(object, source) { if (_isPrototype(source) || lodash_es_isArrayLike(source)) { _copyObject(source, lodash_es_keys(source), object); return; } for (var key in source) { if (assign_hasOwnProperty.call(source, key)) { _assignValue(object, key, source[key]); } } }); /* harmony default export */ var lodash_es_assign = (assign_assign); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseSet.js /** * The base implementation of `_.set`. * * @private * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize path creation. * @returns {Object} Returns `object`. */ function baseSet(object, path, value, customizer) { if (!lodash_es_isObject(object)) { return object; } path = _castPath(path, object); var index = -1, length = path.length, lastIndex = length - 1, nested = object; while (nested != null && ++index < length) { var key = _toKey(path[index]), newValue = value; if (key === '__proto__' || key === 'constructor' || key === 'prototype') { return object; } if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = lodash_es_isObject(objValue) ? objValue : (_isIndex(path[index + 1]) ? [] : {}); } } _assignValue(nested, key, newValue); nested = nested[key]; } return object; } /* harmony default export */ var _baseSet = (baseSet); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_basePickBy.js /** * The base implementation of `_.pickBy` without support for iteratee shorthands. * * @private * @param {Object} object The source object. * @param {string[]} paths The property paths to pick. * @param {Function} predicate The function invoked per property. * @returns {Object} Returns the new object. */ function basePickBy(object, paths, predicate) { var index = -1, length = paths.length, result = {}; while (++index < length) { var path = paths[index], value = _baseGet(object, path); if (predicate(value, path)) { _baseSet(result, _castPath(path, object), value); } } return result; } /* harmony default export */ var _basePickBy = (basePickBy); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_basePick.js /** * The base implementation of `_.pick` without support for individual * property identifiers. * * @private * @param {Object} object The source object. * @param {string[]} paths The property paths to pick. * @returns {Object} Returns the new object. */ function basePick(object, paths) { return _basePickBy(object, paths, function(value, path) { return lodash_es_hasIn(object, path); }); } /* harmony default export */ var _basePick = (basePick); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_isFlattenable.js /** Built-in value references. */ var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined; /** * Checks if `value` is a flattenable `arguments` object or array. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. */ function isFlattenable(value) { return lodash_es_isArray(value) || lodash_es_isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); } /* harmony default export */ var _isFlattenable = (isFlattenable); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseFlatten.js /** * The base implementation of `_.flatten` with support for restricting flattening. * * @private * @param {Array} array The array to flatten. * @param {number} depth The maximum recursion depth. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. * @param {Array} [result=[]] The initial result value. * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, depth, predicate, isStrict, result) { var index = -1, length = array.length; predicate || (predicate = _isFlattenable); result || (result = []); while (++index < length) { var value = array[index]; if (depth > 0 && predicate(value)) { if (depth > 1) { // Recursively flatten arrays (susceptible to call stack limits). baseFlatten(value, depth - 1, predicate, isStrict, result); } else { _arrayPush(result, value); } } else if (!isStrict) { result[result.length] = value; } } return result; } /* harmony default export */ var _baseFlatten = (baseFlatten); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/flatten.js /** * Flattens `array` a single level deep. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * * _.flatten([1, [2, [3, [4]], 5]]); * // => [1, 2, [3, [4]], 5] */ function flatten(array) { var length = array == null ? 0 : array.length; return length ? _baseFlatten(array, 1) : []; } /* harmony default export */ var lodash_es_flatten = (flatten); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_flatRest.js /** * A specialized version of `baseRest` which flattens the rest array. * * @private * @param {Function} func The function to apply a rest parameter to. * @returns {Function} Returns the new function. */ function flatRest(func) { return _setToString(_overRest(func, undefined, lodash_es_flatten), func + ''); } /* harmony default export */ var _flatRest = (flatRest); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/pick.js /** * Creates an object composed of the picked `object` properties. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The source object. * @param {...(string|string[])} [paths] The property paths to pick. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } */ var pick = _flatRest(function(object, paths) { return object == null ? {} : _basePick(object, paths); }); /* harmony default export */ var lodash_es_pick = (pick); // CONCATENATED MODULE: ./src/model/EditConfigModel.ts var _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15, _descriptor16, _descriptor17; function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function EditConfigModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } var SilentConfig = { stopZoomGraph: false, stopScrollGraph: false, stopMoveGraph: false, adjustEdge: false, adjustEdgeStartAndEnd: false, adjustNodePosition: false, hideAnchors: true, nodeSelectedOutline: true, nodeTextEdit: false, edgeTextEdit: false, nodeTextDraggable: false, edgeTextDraggable: false }; var EditConfigModel_keys = ['isSilentMode', 'stopZoomGraph', 'stopScrollGraph', 'stopMoveGraph', 'adjustEdge', 'adjustEdgeMiddle', 'adjustEdgeStartAndEnd', 'adjustNodePosition', 'hideAnchors', 'hoverOutline', 'nodeSelectedOutline', 'edgeSelectedOutline', 'nodeTextEdit', 'edgeTextEdit', 'nodeTextDraggable', 'edgeTextDraggable', 'multipleSelectKey', 'autoExpand']; /** * 页面编辑配置 */ var EditConfigModel_EditConfigModel = (_class = /*#__PURE__*/function () { // 设置为静默模式之前的配置,在取消静默模式后恢复 function EditConfigModel(config) { _classCallCheck(this, EditConfigModel); _initializerDefineProperty(this, "isSilentMode", _descriptor, this); _initializerDefineProperty(this, "stopZoomGraph", _descriptor2, this); _initializerDefineProperty(this, "stopScrollGraph", _descriptor3, this); _initializerDefineProperty(this, "stopMoveGraph", _descriptor4, this); _initializerDefineProperty(this, "adjustEdge", _descriptor5, this); _initializerDefineProperty(this, "adjustEdgeMiddle", _descriptor6, this); _initializerDefineProperty(this, "adjustEdgeStartAndEnd", _descriptor7, this); _initializerDefineProperty(this, "adjustNodePosition", _descriptor8, this); _initializerDefineProperty(this, "hideAnchors", _descriptor9, this); _initializerDefineProperty(this, "hoverOutline", _descriptor10, this); _initializerDefineProperty(this, "nodeSelectedOutline", _descriptor11, this); _initializerDefineProperty(this, "edgeSelectedOutline", _descriptor12, this); _initializerDefineProperty(this, "nodeTextEdit", _descriptor13, this); _initializerDefineProperty(this, "edgeTextEdit", _descriptor14, this); _initializerDefineProperty(this, "nodeTextDraggable", _descriptor15, this); _initializerDefineProperty(this, "edgeTextDraggable", _descriptor16, this); _initializerDefineProperty(this, "autoExpand", _descriptor17, this); EditConfigModel_defineProperty(this, "multipleSelectKey", ''); EditConfigModel_defineProperty(this, "defaultConfig", {}); lodash_es_assign(this, this.getConfigDetail(config)); } _createClass(EditConfigModel, [{ key: "updateEditConfig", value: function updateEditConfig(config) { var newConfig = this.getConfigDetail(config); lodash_es_assign(this, newConfig); } }, { key: "getConfigDetail", value: function getConfigDetail(config) { var isSilentMode = config.isSilentMode, textEdit = config.textEdit; var conf = {}; // false表示从静默模式恢复 if (isSilentMode === false) { lodash_es_assign(conf, this.defaultConfig); } // 如果不传,默认undefined表示非静默模式 if (isSilentMode === true) { var silentConfig = lodash_es_pick(SilentConfig, EditConfigModel_keys); // 在修改之前, this.defaultConfig = { stopZoomGraph: this.stopZoomGraph, stopScrollGraph: this.stopScrollGraph, stopMoveGraph: this.stopMoveGraph, adjustEdge: this.adjustEdge, adjustEdgeMiddle: this.adjustEdgeMiddle, adjustEdgeStartAndEnd: this.adjustEdgeStartAndEnd, adjustNodePosition: this.adjustNodePosition, hideAnchors: this.hideAnchors, hoverOutline: this.hoverOutline, nodeSelectedOutline: this.nodeSelectedOutline, edgeSelectedOutline: this.edgeSelectedOutline, nodeTextEdit: this.nodeTextEdit, edgeTextEdit: this.edgeTextEdit, nodeTextDraggable: this.nodeTextDraggable, edgeTextDraggable: this.edgeTextDraggable, autoExpand: this.autoExpand }; lodash_es_assign(conf, silentConfig); } // 如果不传,默认undefined表示允许文本编辑 if (textEdit === false) { lodash_es_assign(conf, { nodeTextEdit: false, edgeTextEdit: false }); } var userConfig = lodash_es_pick(config, EditConfigModel_keys); return lodash_es_assign(conf, userConfig); } }, { key: "getConfig", value: function getConfig() { return lodash_es_pick(this, EditConfigModel_keys); } }]); return EditConfigModel; }(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "isSilentMode", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "stopZoomGraph", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "stopScrollGraph", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "stopMoveGraph", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, "adjustEdge", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, "adjustEdgeMiddle", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor7 = _applyDecoratedDescriptor(_class.prototype, "adjustEdgeStartAndEnd", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor8 = _applyDecoratedDescriptor(_class.prototype, "adjustNodePosition", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), _descriptor9 = _applyDecoratedDescriptor(_class.prototype, "hideAnchors", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor10 = _applyDecoratedDescriptor(_class.prototype, "hoverOutline", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), _descriptor11 = _applyDecoratedDescriptor(_class.prototype, "nodeSelectedOutline", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), _descriptor12 = _applyDecoratedDescriptor(_class.prototype, "edgeSelectedOutline", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), _descriptor13 = _applyDecoratedDescriptor(_class.prototype, "nodeTextEdit", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), _descriptor14 = _applyDecoratedDescriptor(_class.prototype, "edgeTextEdit", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), _descriptor15 = _applyDecoratedDescriptor(_class.prototype, "nodeTextDraggable", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor16 = _applyDecoratedDescriptor(_class.prototype, "edgeTextDraggable", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor17 = _applyDecoratedDescriptor(_class.prototype, "autoExpand", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _applyDecoratedDescriptor(_class.prototype, "updateEditConfig", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(_class.prototype, "updateEditConfig"), _class.prototype)), _class); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.array.join.js var es_array_join = __webpack_require__(63); // CONCATENATED MODULE: ./src/constant/constant.ts var ElementState; (function (ElementState) { ElementState[ElementState["DEFAULT"] = 1] = "DEFAULT"; ElementState[ElementState["TEXT_EDIT"] = 2] = "TEXT_EDIT"; ElementState[ElementState["SHOW_MENU"] = 3] = "SHOW_MENU"; ElementState[ElementState["ALLOW_CONNECT"] = 4] = "ALLOW_CONNECT"; ElementState[ElementState["NOT_ALLOW_CONNECT"] = 5] = "NOT_ALLOW_CONNECT"; })(ElementState || (ElementState = {})); var ClipBoardInfo; (function (ClipBoardInfo) { ClipBoardInfo["KEY"] = "logic-flow"; ClipBoardInfo["NODE_NAME"] = "lf-node"; ClipBoardInfo["EDGE_NAME"] = "lf-edge"; })(ClipBoardInfo || (ClipBoardInfo = {})); var ModelType; // 区分节点还是边 (function (ModelType) { ModelType["NODE"] = "node"; ModelType["CIRCLE_NODE"] = "circle-node"; ModelType["POLYGON_NODE"] = "polygon-node"; ModelType["RECT_NODE"] = "rect-node"; ModelType["TEXT_NODE"] = "text-node"; ModelType["ELLIPSE_NODE"] = "ellipse-node"; ModelType["DIAMOND_NODE"] = "diamond-node"; ModelType["HTML_NODE"] = "html-node"; ModelType["EDGE"] = "edge"; ModelType["LINE_EDGE"] = "line-edge"; ModelType["POLYLINE_EDGE"] = "polyline-edge"; ModelType["BEZIER_EDGE"] = "bezier-edge"; ModelType["GRAPH"] = "graph"; })(ModelType || (ModelType = {})); var ElementType; (function (ElementType) { ElementType["NODE"] = "node"; ElementType["EDGE"] = "edge"; ElementType["GRAPH"] = "graph"; })(ElementType || (ElementType = {})); var EventType; (function (EventType) { EventType["ELEMENT_CLICK"] = "element:click"; EventType["NODE_CLICK"] = "node:click"; EventType["NODE_DBCLICK"] = "node:dbclick"; EventType["NODE_DELETE"] = "node:delete"; EventType["NODE_ADD"] = "node:add"; EventType["NODE_DND_ADD"] = "node:dnd-add"; EventType["NODE_DND_DRAG"] = "node:dnd-drag"; EventType["NODE_MOUSEDOWN"] = "node:mousedown"; EventType["NODE_DRAGSTART"] = "node:dragstart"; EventType["NODE_DRAG"] = "node:drag"; EventType["NODE_DROP"] = "node:drop"; EventType["NODE_MOUSEUP"] = "node:mouseup"; EventType["NODE_MOUSEMOVE"] = "node:mousemove"; EventType["NODE_MOUSEENTER"] = "node:mouseenter"; EventType["NODE_MOUSELEAVE"] = "node:mouseleave"; EventType["NODE_CONTEXTMENU"] = "node:contextmenu"; EventType["EDGE_DELETE"] = "edge:delete"; EventType["EDGE_ADD"] = "edge:add"; EventType["EDGE_CLICK"] = "edge:click"; EventType["EDGE_DBCLICK"] = "edge:dbclick"; EventType["EDGE_MOUSEENTER"] = "edge:mouseenter"; EventType["EDGE_MOUSELEAVE"] = "edge:mouseleave"; EventType["EDGE_CONTEXTMENU"] = "edge:contextmenu"; EventType["EDGE_ADJUST"] = "edge:adjust"; EventType["EDGE_EXCHANGE_NODE"] = "edge:exchange-node"; EventType["ANCHOR_DRAGSTART"] = "anchor:dragstart"; EventType["ANCHOR_DRAG"] = "anchor:drag"; EventType["ANCHOR_DROP"] = "anchor:drop"; EventType["ANCHOR_DRAGEND"] = "anchor:dragend"; EventType["ADJUST_POINT_MOUSEDOWN"] = "adjustPoint:mousedown"; EventType["ADJUST_POINT_MOUSEUP"] = "adjustPoint:mouseup"; EventType["ADJUST_POINT_MOUSEMOVE"] = "adjustPoint:mousemove"; EventType["ADJUST_POINT_DRAGSTART"] = "adjustPoint:dragstart"; EventType["ADJUST_POINT_DRAG"] = "adjustPoint:drag"; EventType["ADJUST_POINT_DROP"] = "adjustPoint:drop"; EventType["ADJUST_POINT_DRAGEND"] = "adjustPoint:dragend"; EventType["BLANK_MOUSEDOWN"] = "blank:mousedown"; EventType["BLANK_DRAGSTART"] = "blank:dragstart"; EventType["BLANK_DRAG"] = "blank:drag"; EventType["BLANK_DROP"] = "blank:drop"; EventType["BLANK_MOUSEMOVE"] = "blank:mousemove"; EventType["BLANK_MOUSEUP"] = "blank:mouseup"; EventType["BLANK_CLICK"] = "blank:click"; EventType["BLANK_CONTEXTMENU"] = "blank:contextmenu"; EventType["SELECTION_MOUSEDOWN"] = "selection:mousedown"; EventType["SELECTION_DRAGSTART"] = "selection:dragstart"; EventType["SELECTION_DRAG"] = "selection:drag"; EventType["SELECTION_DROP"] = "selection:drop"; EventType["SELECTION_MOUSEMOVE"] = "selection:mousemove"; EventType["SELECTION_MOUSEUP"] = "selection:mouseup"; EventType["SELECTION_CONTEXTMENU"] = "selection:contextmenu"; EventType["CONNECTION_NOT_ALLOWED"] = "connection:not-allowed"; EventType["HISTORY_CHANGE"] = "history:change"; EventType["TEXT_UPDATE"] = "text:update"; EventType["GRAPH_TRANSFORM"] = "graph:transform"; EventType["GRAPH_RENDERED"] = "graph:rendered"; })(EventType || (EventType = {})); var SegmentDirection; (function (SegmentDirection) { SegmentDirection["HORIZONTAL"] = "horizontal"; SegmentDirection["VERTICAL"] = "vertical"; })(SegmentDirection || (SegmentDirection = {})); var ElementMaxZIndex = 9999; var OverlapMode; (function (OverlapMode) { OverlapMode[OverlapMode["DEFAULT"] = 0] = "DEFAULT"; OverlapMode[OverlapMode["INCREASE"] = 1] = "INCREASE"; })(OverlapMode || (OverlapMode = {})); // CONCATENATED MODULE: ./src/model/TransformModel.ts var TransformModel_class, TransformModel_descriptor, TransformModel_descriptor2, TransformModel_descriptor3, TransformModel_descriptor4, TransformModel_descriptor5, TransformModel_descriptor6, TransformModel_descriptor7; function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function TransformModel_initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function TransformModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function TransformModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function TransformModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) TransformModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) TransformModel_defineProperties(Constructor, staticProps); return Constructor; } function TransformModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function TransformModel_applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function TransformModel_initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } var TransformModel_TransformModel = (TransformModel_class = /*#__PURE__*/function () { function TransformModel(eventCenter) { TransformModel_classCallCheck(this, TransformModel); TransformModel_defineProperty(this, "MINI_SCALE_SIZE", 0.2); TransformModel_defineProperty(this, "MAX_SCALE_SIZE", 16); TransformModel_initializerDefineProperty(this, "SCALE_X", TransformModel_descriptor, this); TransformModel_initializerDefineProperty(this, "SKEW_Y", TransformModel_descriptor2, this); TransformModel_initializerDefineProperty(this, "SKEW_X", TransformModel_descriptor3, this); TransformModel_initializerDefineProperty(this, "SCALE_Y", TransformModel_descriptor4, this); TransformModel_initializerDefineProperty(this, "TRANSLATE_X", TransformModel_descriptor5, this); TransformModel_initializerDefineProperty(this, "TRANSLATE_Y", TransformModel_descriptor6, this); TransformModel_initializerDefineProperty(this, "ZOOM_SIZE", TransformModel_descriptor7, this); TransformModel_defineProperty(this, "eventCenter", void 0); this.eventCenter = eventCenter; } TransformModel_createClass(TransformModel, [{ key: "setZoomMiniSize", value: function setZoomMiniSize(size) { this.MINI_SCALE_SIZE = size; } }, { key: "setZoomMaxSize", value: function setZoomMaxSize(size) { this.MAX_SCALE_SIZE = size; } /** * 将最外层graph上的点基于缩放转换为canvasOverlay层上的点。 * @param param0 HTML点 */ }, { key: "HtmlPointToCanvasPoint", value: function HtmlPointToCanvasPoint(_ref) { var _ref2 = _slicedToArray(_ref, 2), x = _ref2[0], y = _ref2[1]; return [(x - this.TRANSLATE_X) / this.SCALE_X, (y - this.TRANSLATE_Y) / this.SCALE_Y]; } /** * 将最外层canvasOverlay层上的点基于缩放转换为graph上的点。 * @param param0 HTML点 */ }, { key: "CanvasPointToHtmlPoint", value: function CanvasPointToHtmlPoint(_ref3) { var _ref4 = _slicedToArray(_ref3, 2), x = _ref4[0], y = _ref4[1]; return [x * this.SCALE_X + this.TRANSLATE_X, y * this.SCALE_Y + this.TRANSLATE_Y]; } /** * 将一个在canvas上的点,向x轴方向移动directionX距离,向y轴方向移动directionY距离。 * 因为canvas可能被缩小或者放大了,所以其在canvas层移动的距离需要计算上缩放的量。 * @param point 点 * @param directionX x轴距离 * @param directionY y轴距离 */ }, { key: "moveCanvasPointByHtml", value: function moveCanvasPointByHtml(_ref5, directionX, directionY) { var _ref6 = _slicedToArray(_ref5, 2), x = _ref6[0], y = _ref6[1]; return [x + directionX / this.SCALE_X, y + directionY / this.SCALE_Y]; } /** * 根据缩放情况,获取缩放后的delta距离 * @param deltaX x轴距离变化 * @param deltaY y轴距离变化 */ }, { key: "fixDeltaXY", value: function fixDeltaXY(deltaX, deltaY) { return [deltaX / this.SCALE_X, deltaY / this.SCALE_Y]; } /** * 基于当前的缩放,获取画布渲染样式transform值 */ }, { key: "getTransformStyle", value: function getTransformStyle() { var matrixString = [this.SCALE_X, this.SKEW_Y, this.SKEW_X, this.SCALE_Y, this.TRANSLATE_X, this.TRANSLATE_Y].join(','); return { transform: "matrix(".concat(matrixString, ")") }; } /** * 放大缩小图形 * @param zoomSize 放大缩小的值,支持传入0-n之间的数字。小于1表示缩小,大于1表示放大。也支持传入true和false按照内置的刻度放大缩小 * @param point 缩放的原点 * @returns {string} -放大缩小的比例 */ }, { key: "zoom", value: function zoom() { var zoomSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var point = arguments.length > 1 ? arguments[1] : undefined; var newScaleX = this.SCALE_X; var newScaleY = this.SCALE_Y; if (zoomSize === true) { newScaleX += this.ZOOM_SIZE; newScaleY += this.ZOOM_SIZE; } else if (zoomSize === false) { newScaleX -= this.ZOOM_SIZE; newScaleY -= this.ZOOM_SIZE; } else if (typeof zoomSize === 'number') { newScaleX = zoomSize; newScaleY = zoomSize; } if (newScaleX < this.MINI_SCALE_SIZE || newScaleX > this.MAX_SCALE_SIZE) { return "".concat(this.SCALE_X * 100, "%"); } if (point) { this.TRANSLATE_X -= (newScaleX - this.SCALE_X) * point[0]; this.TRANSLATE_Y -= (newScaleY - this.SCALE_Y) * point[1]; } this.SCALE_X = newScaleX; this.SCALE_Y = newScaleY; this.emitGraphTransform('zoom'); return "".concat(this.SCALE_X * 100, "%"); } }, { key: "emitGraphTransform", value: function emitGraphTransform(type) { this.eventCenter.emit(EventType.GRAPH_TRANSFORM, { type: type, transform: { SCALE_X: this.SCALE_X, SKEW_Y: this.SKEW_Y, SKEW_X: this.SKEW_X, SCALE_Y: this.SCALE_Y, TRANSLATE_X: this.TRANSLATE_X, TRANSLATE_Y: this.TRANSLATE_Y } }); } }, { key: "resetZoom", value: function resetZoom() { this.SCALE_X = 1; this.SCALE_Y = 1; this.emitGraphTransform('resetZoom'); } }, { key: "translate", value: function translate(x, y) { this.TRANSLATE_X += x; this.TRANSLATE_Y += y; this.emitGraphTransform('translate'); } /** * 将图形定位到画布中心 * @param targetX 图形当前x坐标 * @param targetY 图形当前y坐标 * @param width 画布宽 * @param height 画布高 */ }, { key: "focusOn", value: function focusOn(targetX, targetY, width, height) { var _this$CanvasPointToHt = this.CanvasPointToHtmlPoint([targetX, targetY]), _this$CanvasPointToHt2 = _slicedToArray(_this$CanvasPointToHt, 2), x = _this$CanvasPointToHt2[0], y = _this$CanvasPointToHt2[1]; var deltaX = width / 2 - x, deltaY = height / 2 - y; this.TRANSLATE_X += deltaX; this.TRANSLATE_Y += deltaY; this.emitGraphTransform('focusOn'); } }]); return TransformModel; }(), (TransformModel_descriptor = TransformModel_applyDecoratedDescriptor(TransformModel_class.prototype, "SCALE_X", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 1; } }), TransformModel_descriptor2 = TransformModel_applyDecoratedDescriptor(TransformModel_class.prototype, "SKEW_Y", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 0; } }), TransformModel_descriptor3 = TransformModel_applyDecoratedDescriptor(TransformModel_class.prototype, "SKEW_X", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 0; } }), TransformModel_descriptor4 = TransformModel_applyDecoratedDescriptor(TransformModel_class.prototype, "SCALE_Y", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 1; } }), TransformModel_descriptor5 = TransformModel_applyDecoratedDescriptor(TransformModel_class.prototype, "TRANSLATE_X", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 0; } }), TransformModel_descriptor6 = TransformModel_applyDecoratedDescriptor(TransformModel_class.prototype, "TRANSLATE_Y", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 0; } }), TransformModel_descriptor7 = TransformModel_applyDecoratedDescriptor(TransformModel_class.prototype, "ZOOM_SIZE", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 0.04; } }), TransformModel_applyDecoratedDescriptor(TransformModel_class.prototype, "zoom", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(TransformModel_class.prototype, "zoom"), TransformModel_class.prototype), TransformModel_applyDecoratedDescriptor(TransformModel_class.prototype, "resetZoom", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(TransformModel_class.prototype, "resetZoom"), TransformModel_class.prototype), TransformModel_applyDecoratedDescriptor(TransformModel_class.prototype, "translate", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(TransformModel_class.prototype, "translate"), TransformModel_class.prototype), TransformModel_applyDecoratedDescriptor(TransformModel_class.prototype, "focusOn", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(TransformModel_class.prototype, "focusOn"), TransformModel_class.prototype)), TransformModel_class); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_arrayEach.js /** * A specialized version of `_.forEach` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (iteratee(array[index], index, array) === false) { break; } } return array; } /* harmony default export */ var _arrayEach = (arrayEach); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseAssign.js /** * The base implementation of `_.assign` without support for multiple sources * or `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @returns {Object} Returns `object`. */ function baseAssign(object, source) { return object && _copyObject(source, lodash_es_keys(source), object); } /* harmony default export */ var _baseAssign = (baseAssign); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_nativeKeysIn.js /** * This function is like * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * except that it includes inherited enumerable properties. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function nativeKeysIn(object) { var result = []; if (object != null) { for (var key in Object(object)) { result.push(key); } } return result; } /* harmony default export */ var _nativeKeysIn = (nativeKeysIn); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseKeysIn.js /** Used for built-in method references. */ var _baseKeysIn_objectProto = Object.prototype; /** Used to check objects for own properties. */ var _baseKeysIn_hasOwnProperty = _baseKeysIn_objectProto.hasOwnProperty; /** * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { if (!lodash_es_isObject(object)) { return _nativeKeysIn(object); } var isProto = _isPrototype(object), result = []; for (var key in object) { if (!(key == 'constructor' && (isProto || !_baseKeysIn_hasOwnProperty.call(object, key)))) { result.push(key); } } return result; } /* harmony default export */ var _baseKeysIn = (baseKeysIn); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/keysIn.js /** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { return lodash_es_isArrayLike(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object); } /* harmony default export */ var lodash_es_keysIn = (keysIn); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseAssignIn.js /** * The base implementation of `_.assignIn` without support for multiple sources * or `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @returns {Object} Returns `object`. */ function baseAssignIn(object, source) { return object && _copyObject(source, lodash_es_keysIn(source), object); } /* harmony default export */ var _baseAssignIn = (baseAssignIn); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_cloneBuffer.js var _cloneBuffer = __webpack_require__(106); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_copyArray.js /** * Copies the values of `source` to `array`. * * @private * @param {Array} source The array to copy values from. * @param {Array} [array=[]] The array to copy values to. * @returns {Array} Returns `array`. */ function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; } /* harmony default export */ var _copyArray = (copyArray); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_copySymbols.js /** * Copies own symbols of `source` to `object`. * * @private * @param {Object} source The object to copy symbols from. * @param {Object} [object={}] The object to copy symbols to. * @returns {Object} Returns `object`. */ function copySymbols(source, object) { return _copyObject(source, _getSymbols(source), object); } /* harmony default export */ var _copySymbols = (copySymbols); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_getPrototype.js /** Built-in value references. */ var getPrototype = _overArg(Object.getPrototypeOf, Object); /* harmony default export */ var _getPrototype = (getPrototype); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_getSymbolsIn.js /* Built-in method references for those with the same name as other `lodash` methods. */ var _getSymbolsIn_nativeGetSymbols = Object.getOwnPropertySymbols; /** * Creates an array of the own and inherited enumerable symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbolsIn = !_getSymbolsIn_nativeGetSymbols ? lodash_es_stubArray : function(object) { var result = []; while (object) { _arrayPush(result, _getSymbols(object)); object = _getPrototype(object); } return result; }; /* harmony default export */ var _getSymbolsIn = (getSymbolsIn); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_copySymbolsIn.js /** * Copies own and inherited symbols of `source` to `object`. * * @private * @param {Object} source The object to copy symbols from. * @param {Object} [object={}] The object to copy symbols to. * @returns {Object} Returns `object`. */ function copySymbolsIn(source, object) { return _copyObject(source, _getSymbolsIn(source), object); } /* harmony default export */ var _copySymbolsIn = (copySymbolsIn); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_getAllKeysIn.js /** * Creates an array of own and inherited enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeysIn(object) { return _baseGetAllKeys(object, lodash_es_keysIn, _getSymbolsIn); } /* harmony default export */ var _getAllKeysIn = (getAllKeysIn); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_initCloneArray.js /** Used for built-in method references. */ var _initCloneArray_objectProto = Object.prototype; /** Used to check objects for own properties. */ var _initCloneArray_hasOwnProperty = _initCloneArray_objectProto.hasOwnProperty; /** * Initializes an array clone. * * @private * @param {Array} array The array to clone. * @returns {Array} Returns the initialized clone. */ function initCloneArray(array) { var length = array.length, result = new array.constructor(length); // Add properties assigned by `RegExp#exec`. if (length && typeof array[0] == 'string' && _initCloneArray_hasOwnProperty.call(array, 'index')) { result.index = array.index; result.input = array.input; } return result; } /* harmony default export */ var _initCloneArray = (initCloneArray); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_cloneArrayBuffer.js /** * Creates a clone of `arrayBuffer`. * * @private * @param {ArrayBuffer} arrayBuffer The array buffer to clone. * @returns {ArrayBuffer} Returns the cloned array buffer. */ function cloneArrayBuffer(arrayBuffer) { var result = new arrayBuffer.constructor(arrayBuffer.byteLength); new _Uint8Array(result).set(new _Uint8Array(arrayBuffer)); return result; } /* harmony default export */ var _cloneArrayBuffer = (cloneArrayBuffer); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_cloneDataView.js /** * Creates a clone of `dataView`. * * @private * @param {Object} dataView The data view to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned data view. */ function cloneDataView(dataView, isDeep) { var buffer = isDeep ? _cloneArrayBuffer(dataView.buffer) : dataView.buffer; return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); } /* harmony default export */ var _cloneDataView = (cloneDataView); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_cloneRegExp.js /** Used to match `RegExp` flags from their coerced string values. */ var reFlags = /\w*$/; /** * Creates a clone of `regexp`. * * @private * @param {Object} regexp The regexp to clone. * @returns {Object} Returns the cloned regexp. */ function cloneRegExp(regexp) { var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); result.lastIndex = regexp.lastIndex; return result; } /* harmony default export */ var _cloneRegExp = (cloneRegExp); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_cloneSymbol.js /** Used to convert symbols to primitives and strings. */ var _cloneSymbol_symbolProto = _Symbol ? _Symbol.prototype : undefined, _cloneSymbol_symbolValueOf = _cloneSymbol_symbolProto ? _cloneSymbol_symbolProto.valueOf : undefined; /** * Creates a clone of the `symbol` object. * * @private * @param {Object} symbol The symbol object to clone. * @returns {Object} Returns the cloned symbol object. */ function cloneSymbol(symbol) { return _cloneSymbol_symbolValueOf ? Object(_cloneSymbol_symbolValueOf.call(symbol)) : {}; } /* harmony default export */ var _cloneSymbol = (cloneSymbol); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_cloneTypedArray.js /** * Creates a clone of `typedArray`. * * @private * @param {Object} typedArray The typed array to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); } /* harmony default export */ var _cloneTypedArray = (cloneTypedArray); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_initCloneByTag.js /** `Object#toString` result references. */ var _initCloneByTag_boolTag = '[object Boolean]', _initCloneByTag_dateTag = '[object Date]', _initCloneByTag_mapTag = '[object Map]', _initCloneByTag_numberTag = '[object Number]', _initCloneByTag_regexpTag = '[object RegExp]', _initCloneByTag_setTag = '[object Set]', _initCloneByTag_stringTag = '[object String]', _initCloneByTag_symbolTag = '[object Symbol]'; var _initCloneByTag_arrayBufferTag = '[object ArrayBuffer]', _initCloneByTag_dataViewTag = '[object DataView]', _initCloneByTag_float32Tag = '[object Float32Array]', _initCloneByTag_float64Tag = '[object Float64Array]', _initCloneByTag_int8Tag = '[object Int8Array]', _initCloneByTag_int16Tag = '[object Int16Array]', _initCloneByTag_int32Tag = '[object Int32Array]', _initCloneByTag_uint8Tag = '[object Uint8Array]', _initCloneByTag_uint8ClampedTag = '[object Uint8ClampedArray]', _initCloneByTag_uint16Tag = '[object Uint16Array]', _initCloneByTag_uint32Tag = '[object Uint32Array]'; /** * Initializes an object clone based on its `toStringTag`. * * **Note:** This function only supports cloning values with tags of * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. * * @private * @param {Object} object The object to clone. * @param {string} tag The `toStringTag` of the object to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the initialized clone. */ function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { case _initCloneByTag_arrayBufferTag: return _cloneArrayBuffer(object); case _initCloneByTag_boolTag: case _initCloneByTag_dateTag: return new Ctor(+object); case _initCloneByTag_dataViewTag: return _cloneDataView(object, isDeep); case _initCloneByTag_float32Tag: case _initCloneByTag_float64Tag: case _initCloneByTag_int8Tag: case _initCloneByTag_int16Tag: case _initCloneByTag_int32Tag: case _initCloneByTag_uint8Tag: case _initCloneByTag_uint8ClampedTag: case _initCloneByTag_uint16Tag: case _initCloneByTag_uint32Tag: return _cloneTypedArray(object, isDeep); case _initCloneByTag_mapTag: return new Ctor; case _initCloneByTag_numberTag: case _initCloneByTag_stringTag: return new Ctor(object); case _initCloneByTag_regexpTag: return _cloneRegExp(object); case _initCloneByTag_setTag: return new Ctor; case _initCloneByTag_symbolTag: return _cloneSymbol(object); } } /* harmony default export */ var _initCloneByTag = (initCloneByTag); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseCreate.js /** Built-in value references. */ var objectCreate = Object.create; /** * The base implementation of `_.create` without support for assigning * properties to the created object. * * @private * @param {Object} proto The object to inherit from. * @returns {Object} Returns the new object. */ var baseCreate = (function() { function object() {} return function(proto) { if (!lodash_es_isObject(proto)) { return {}; } if (objectCreate) { return objectCreate(proto); } object.prototype = proto; var result = new object; object.prototype = undefined; return result; }; }()); /* harmony default export */ var _baseCreate = (baseCreate); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_initCloneObject.js /** * Initializes an object clone. * * @private * @param {Object} object The object to clone. * @returns {Object} Returns the initialized clone. */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !_isPrototype(object)) ? _baseCreate(_getPrototype(object)) : {}; } /* harmony default export */ var _initCloneObject = (initCloneObject); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseIsMap.js /** `Object#toString` result references. */ var _baseIsMap_mapTag = '[object Map]'; /** * The base implementation of `_.isMap` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a map, else `false`. */ function baseIsMap(value) { return lodash_es_isObjectLike(value) && _getTag(value) == _baseIsMap_mapTag; } /* harmony default export */ var _baseIsMap = (baseIsMap); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isMap.js /* Node.js helper references. */ var nodeIsMap = _nodeUtil["a" /* default */] && _nodeUtil["a" /* default */].isMap; /** * Checks if `value` is classified as a `Map` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a map, else `false`. * @example * * _.isMap(new Map); * // => true * * _.isMap(new WeakMap); * // => false */ var isMap = nodeIsMap ? _baseUnary(nodeIsMap) : _baseIsMap; /* harmony default export */ var lodash_es_isMap = (isMap); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseIsSet.js /** `Object#toString` result references. */ var _baseIsSet_setTag = '[object Set]'; /** * The base implementation of `_.isSet` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a set, else `false`. */ function baseIsSet(value) { return lodash_es_isObjectLike(value) && _getTag(value) == _baseIsSet_setTag; } /* harmony default export */ var _baseIsSet = (baseIsSet); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isSet.js /* Node.js helper references. */ var nodeIsSet = _nodeUtil["a" /* default */] && _nodeUtil["a" /* default */].isSet; /** * Checks if `value` is classified as a `Set` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a set, else `false`. * @example * * _.isSet(new Set); * // => true * * _.isSet(new WeakSet); * // => false */ var isSet = nodeIsSet ? _baseUnary(nodeIsSet) : _baseIsSet; /* harmony default export */ var lodash_es_isSet = (isSet); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseClone.js /** Used to compose bitmasks for cloning. */ var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; /** `Object#toString` result references. */ var _baseClone_argsTag = '[object Arguments]', _baseClone_arrayTag = '[object Array]', _baseClone_boolTag = '[object Boolean]', _baseClone_dateTag = '[object Date]', _baseClone_errorTag = '[object Error]', _baseClone_funcTag = '[object Function]', _baseClone_genTag = '[object GeneratorFunction]', _baseClone_mapTag = '[object Map]', _baseClone_numberTag = '[object Number]', _baseClone_objectTag = '[object Object]', _baseClone_regexpTag = '[object RegExp]', _baseClone_setTag = '[object Set]', _baseClone_stringTag = '[object String]', _baseClone_symbolTag = '[object Symbol]', _baseClone_weakMapTag = '[object WeakMap]'; var _baseClone_arrayBufferTag = '[object ArrayBuffer]', _baseClone_dataViewTag = '[object DataView]', _baseClone_float32Tag = '[object Float32Array]', _baseClone_float64Tag = '[object Float64Array]', _baseClone_int8Tag = '[object Int8Array]', _baseClone_int16Tag = '[object Int16Array]', _baseClone_int32Tag = '[object Int32Array]', _baseClone_uint8Tag = '[object Uint8Array]', _baseClone_uint8ClampedTag = '[object Uint8ClampedArray]', _baseClone_uint16Tag = '[object Uint16Array]', _baseClone_uint32Tag = '[object Uint32Array]'; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[_baseClone_argsTag] = cloneableTags[_baseClone_arrayTag] = cloneableTags[_baseClone_arrayBufferTag] = cloneableTags[_baseClone_dataViewTag] = cloneableTags[_baseClone_boolTag] = cloneableTags[_baseClone_dateTag] = cloneableTags[_baseClone_float32Tag] = cloneableTags[_baseClone_float64Tag] = cloneableTags[_baseClone_int8Tag] = cloneableTags[_baseClone_int16Tag] = cloneableTags[_baseClone_int32Tag] = cloneableTags[_baseClone_mapTag] = cloneableTags[_baseClone_numberTag] = cloneableTags[_baseClone_objectTag] = cloneableTags[_baseClone_regexpTag] = cloneableTags[_baseClone_setTag] = cloneableTags[_baseClone_stringTag] = cloneableTags[_baseClone_symbolTag] = cloneableTags[_baseClone_uint8Tag] = cloneableTags[_baseClone_uint8ClampedTag] = cloneableTags[_baseClone_uint16Tag] = cloneableTags[_baseClone_uint32Tag] = true; cloneableTags[_baseClone_errorTag] = cloneableTags[_baseClone_funcTag] = cloneableTags[_baseClone_weakMapTag] = false; /** * The base implementation of `_.clone` and `_.cloneDeep` which tracks * traversed objects. * * @private * @param {*} value The value to clone. * @param {boolean} bitmask The bitmask flags. * 1 - Deep clone * 2 - Flatten inherited properties * 4 - Clone symbols * @param {Function} [customizer] The function to customize cloning. * @param {string} [key] The key of `value`. * @param {Object} [object] The parent object of `value`. * @param {Object} [stack] Tracks traversed objects and their clone counterparts. * @returns {*} Returns the cloned value. */ function baseClone(value, bitmask, customizer, key, object, stack) { var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; if (customizer) { result = object ? customizer(value, key, object, stack) : customizer(value); } if (result !== undefined) { return result; } if (!lodash_es_isObject(value)) { return value; } var isArr = lodash_es_isArray(value); if (isArr) { result = _initCloneArray(value); if (!isDeep) { return _copyArray(value, result); } } else { var tag = _getTag(value), isFunc = tag == _baseClone_funcTag || tag == _baseClone_genTag; if (Object(isBuffer["a" /* default */])(value)) { return Object(_cloneBuffer["a" /* default */])(value, isDeep); } if (tag == _baseClone_objectTag || tag == _baseClone_argsTag || (isFunc && !object)) { result = (isFlat || isFunc) ? {} : _initCloneObject(value); if (!isDeep) { return isFlat ? _copySymbolsIn(value, _baseAssignIn(result, value)) : _copySymbols(value, _baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { return object ? value : {}; } result = _initCloneByTag(value, tag, isDeep); } } // Check for circular references and return its corresponding clone. stack || (stack = new _Stack); var stacked = stack.get(value); if (stacked) { return stacked; } stack.set(value, result); if (lodash_es_isSet(value)) { value.forEach(function(subValue) { result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); }); } else if (lodash_es_isMap(value)) { value.forEach(function(subValue, key) { result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); }); } var keysFunc = isFull ? (isFlat ? _getAllKeysIn : _getAllKeys) : (isFlat ? lodash_es_keysIn : lodash_es_keys); var props = isArr ? undefined : keysFunc(value); _arrayEach(props || value, function(subValue, key) { if (props) { key = subValue; subValue = value[key]; } // Recursively populate clone (susceptible to call stack limits). _assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); }); return result; } /* harmony default export */ var _baseClone = (baseClone); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/cloneDeep.js /** Used to compose bitmasks for cloning. */ var cloneDeep_CLONE_DEEP_FLAG = 1, cloneDeep_CLONE_SYMBOLS_FLAG = 4; /** * This method is like `_.clone` except that it recursively clones `value`. * * @static * @memberOf _ * @since 1.0.0 * @category Lang * @param {*} value The value to recursively clone. * @returns {*} Returns the deep cloned value. * @see _.clone * @example * * var objects = [{ 'a': 1 }, { 'b': 2 }]; * * var deep = _.cloneDeep(objects); * console.log(deep[0] === objects[0]); * // => false */ function cloneDeep(value) { return _baseClone(value, cloneDeep_CLONE_DEEP_FLAG | cloneDeep_CLONE_SYMBOLS_FLAG); } /* harmony default export */ var lodash_es_cloneDeep = (cloneDeep); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_assignMergeValue.js /** * This function is like `assignValue` except that it doesn't assign * `undefined` values. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignMergeValue(object, key, value) { if ((value !== undefined && !lodash_es_eq(object[key], value)) || (value === undefined && !(key in object))) { _baseAssignValue(object, key, value); } } /* harmony default export */ var _assignMergeValue = (assignMergeValue); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isArrayLikeObject.js /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return lodash_es_isObjectLike(value) && lodash_es_isArrayLike(value); } /* harmony default export */ var lodash_es_isArrayLikeObject = (isArrayLikeObject); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isPlainObject.js /** `Object#toString` result references. */ var isPlainObject_objectTag = '[object Object]'; /** Used for built-in method references. */ var isPlainObject_funcProto = Function.prototype, isPlainObject_objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var isPlainObject_funcToString = isPlainObject_funcProto.toString; /** Used to check objects for own properties. */ var isPlainObject_hasOwnProperty = isPlainObject_objectProto.hasOwnProperty; /** Used to infer the `Object` constructor. */ var objectCtorString = isPlainObject_funcToString.call(Object); /** * Checks if `value` is a plain object, that is, an object created by the * `Object` constructor or one with a `[[Prototype]]` of `null`. * * @static * @memberOf _ * @since 0.8.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Foo() { * this.a = 1; * } * * _.isPlainObject(new Foo); * // => false * * _.isPlainObject([1, 2, 3]); * // => false * * _.isPlainObject({ 'x': 0, 'y': 0 }); * // => true * * _.isPlainObject(Object.create(null)); * // => true */ function isPlainObject(value) { if (!lodash_es_isObjectLike(value) || _baseGetTag(value) != isPlainObject_objectTag) { return false; } var proto = _getPrototype(value); if (proto === null) { return true; } var Ctor = isPlainObject_hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && isPlainObject_funcToString.call(Ctor) == objectCtorString; } /* harmony default export */ var lodash_es_isPlainObject = (isPlainObject); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_safeGet.js /** * Gets the value at `key`, unless `key` is "__proto__" or "constructor". * * @private * @param {Object} object The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function safeGet(object, key) { if (key === 'constructor' && typeof object[key] === 'function') { return; } if (key == '__proto__') { return; } return object[key]; } /* harmony default export */ var _safeGet = (safeGet); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/toPlainObject.js /** * Converts `value` to a plain object flattening inherited enumerable string * keyed properties of `value` to own properties of the plain object. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to convert. * @returns {Object} Returns the converted plain object. * @example * * function Foo() { * this.b = 2; * } * * Foo.prototype.c = 3; * * _.assign({ 'a': 1 }, new Foo); * // => { 'a': 1, 'b': 2 } * * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); * // => { 'a': 1, 'b': 2, 'c': 3 } */ function toPlainObject(value) { return _copyObject(value, lodash_es_keysIn(value)); } /* harmony default export */ var lodash_es_toPlainObject = (toPlainObject); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseMergeDeep.js /** * A specialized version of `baseMerge` for arrays and objects which performs * deep merges and tracks traversed objects enabling objects with circular * references to be merged. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {string} key The key of the value to merge. * @param {number} srcIndex The index of `source`. * @param {Function} mergeFunc The function to merge values. * @param {Function} [customizer] The function to customize assigned values. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. */ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { var objValue = _safeGet(object, key), srcValue = _safeGet(source, key), stacked = stack.get(srcValue); if (stacked) { _assignMergeValue(object, key, stacked); return; } var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined; var isCommon = newValue === undefined; if (isCommon) { var isArr = lodash_es_isArray(srcValue), isBuff = !isArr && Object(isBuffer["a" /* default */])(srcValue), isTyped = !isArr && !isBuff && lodash_es_isTypedArray(srcValue); newValue = srcValue; if (isArr || isBuff || isTyped) { if (lodash_es_isArray(objValue)) { newValue = objValue; } else if (lodash_es_isArrayLikeObject(objValue)) { newValue = _copyArray(objValue); } else if (isBuff) { isCommon = false; newValue = Object(_cloneBuffer["a" /* default */])(srcValue, true); } else if (isTyped) { isCommon = false; newValue = _cloneTypedArray(srcValue, true); } else { newValue = []; } } else if (lodash_es_isPlainObject(srcValue) || lodash_es_isArguments(srcValue)) { newValue = objValue; if (lodash_es_isArguments(objValue)) { newValue = lodash_es_toPlainObject(objValue); } else if (!lodash_es_isObject(objValue) || lodash_es_isFunction(objValue)) { newValue = _initCloneObject(srcValue); } } else { isCommon = false; } } if (isCommon) { // Recursively merge objects and arrays (susceptible to call stack limits). stack.set(srcValue, newValue); mergeFunc(newValue, srcValue, srcIndex, customizer, stack); stack['delete'](srcValue); } _assignMergeValue(object, key, newValue); } /* harmony default export */ var _baseMergeDeep = (baseMergeDeep); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseMerge.js /** * The base implementation of `_.merge` without support for multiple sources. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {number} srcIndex The index of `source`. * @param {Function} [customizer] The function to customize merged values. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. */ function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } _baseFor(source, function(srcValue, key) { stack || (stack = new _Stack); if (lodash_es_isObject(srcValue)) { _baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { var newValue = customizer ? customizer(_safeGet(object, key), srcValue, (key + ''), object, source, stack) : undefined; if (newValue === undefined) { newValue = srcValue; } _assignMergeValue(object, key, newValue); } }, lodash_es_keysIn); } /* harmony default export */ var _baseMerge = (baseMerge); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/merge.js /** * This method is like `_.assign` except that it recursively merges own and * inherited enumerable string keyed properties of source objects into the * destination object. Source properties that resolve to `undefined` are * skipped if a destination value exists. Array and plain object properties * are merged recursively. Other objects and value types are overridden by * assignment. Source objects are applied from left to right. Subsequent * sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 0.5.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * var object = { * 'a': [{ 'b': 2 }, { 'd': 4 }] * }; * * var other = { * 'a': [{ 'c': 3 }, { 'e': 5 }] * }; * * _.merge(object, other); * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } */ var merge = _createAssigner(function(object, source, srcIndex) { _baseMerge(object, source, srcIndex); }); /* harmony default export */ var lodash_es_merge = (merge); // CONCATENATED MODULE: ./src/constant/DefaultTheme.ts /** * 颜色 * CSS属性用颜色 * 如#000000,reg(0,0,0,0) * 如果是透明,可以传'none' */ /** * svg虚线 * 格式为逗号分割字符串,如 * @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/stroke-dasharray */ /** * rect主题样式 * svg基础图形-矩形 * https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/rect */ /** * circle主题样式 * svg基础图形-圆形 * https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/circle */ /** * polygon主题样式 * svg基础图形-多边形 * https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/polygon */ /** * ellipse主题样式 * svg基础图形-椭圆 * https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/ellipse */ /** * 锚点样式 * svg基础图形-圆 */ /** * 文本样式 * svg文本 * https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/text */ /** * 文本节点样式 */ /** * 节点上文本样式 */ /** * 边上文本样式 */ /** * 箭头主题 */ /** * 边动画主题 */ var defaultTheme = { baseNode: { fill: '#FFFFFF', stroke: '#000000', strokeWidth: 2 }, baseEdge: { stroke: '#000000', strokeWidth: 2 }, rect: {}, circle: {}, diamond: {}, ellipse: {}, polygon: {}, text: { color: '#000000', stroke: 'none', fontSize: 12, background: { fill: 'transparent' } }, anchor: { stroke: '#000000', fill: '#FFFFFF', r: 4, hover: { fill: '#949494', fillOpacity: 0.5, stroke: '#949494', r: 10 } }, nodeText: { color: '#000000', overflowMode: 'default', lineHeight: 1.2, fontSize: 12 }, edgeText: { textWidth: 100, overflowMode: 'default', fontSize: 12, background: { fill: '#FFFFFF' } }, line: {}, polyline: {}, bezier: { fill: 'none', adjustLine: { stroke: '#949494' }, adjustAnchor: { r: 4, fill: '#949494', stroke: '#949494', fillOpacity: 1 } }, arrow: { offset: 10, // 箭头长度 verticalLength: 5 // 箭头垂直于边的距离 }, anchorLine: { stroke: '#000000', strokeWidth: 2, strokeDasharray: '3,2' }, snapline: { stroke: '#949494', strokeWidth: 1 }, edgeAdjust: { r: 4, fill: '#FFFFFF', stroke: '#949494', strokeWidth: 2 }, outline: { fill: 'transparent', stroke: '#949494', strokeDasharray: '3,3', hover: { stroke: '#949494' } }, edgeAnimation: { stroke: 'red', strokeDasharray: '10 10', strokeDashoffset: '100%', animationName: 'lf_animate_dash', animationDuration: '20s', animationIterationCount: 'infinite', animationTimingFunction: 'linear', animationDirection: 'normal' } }; // CONCATENATED MODULE: ./src/util/theme.ts /* 主题(全局样式)相关方法 */ var theme_updateTheme = function updateTheme(style) { var defaultStyle = lodash_es_cloneDeep(defaultTheme); if (style) { /** * 为了不让默认样式被覆盖,改用merge * 例如:锚点主题hover * 用户传入 * lf.setTheme({ * anchor: { * hover: { * fill: 'red' * } * } * }) */ defaultStyle = lodash_es_merge(defaultStyle, style); // Object.keys(style).forEach((key) => { // defaultStyle[key] = { ...defaultStyle[key], ...style[key] }; // }); } return defaultStyle; }; // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.string.split.js var es_string_split = __webpack_require__(78); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.string.trim.js var es_string_trim = __webpack_require__(158); // CONCATENATED MODULE: ./src/event/eventEmitter.ts function eventEmitter_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function eventEmitter_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function eventEmitter_createClass(Constructor, protoProps, staticProps) { if (protoProps) eventEmitter_defineProperties(Constructor.prototype, protoProps); if (staticProps) eventEmitter_defineProperties(Constructor, staticProps); return Constructor; } function eventEmitter_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var WILDCARD = '*'; /* event-emitter */ var EventEmitter = /*#__PURE__*/function () { function EventEmitter() { eventEmitter_classCallCheck(this, EventEmitter); eventEmitter_defineProperty(this, "_events", {}); } eventEmitter_createClass(EventEmitter, [{ key: "on", value: /** * 监听一个事件 * @param evt 事件名称 * @param callback * @param once */ function on(evt, callback, once) { var _this = this; evt === null || evt === void 0 ? void 0 : evt.split(',').forEach(function (evKey) { evKey = evKey.trim(); if (!_this._events[evKey]) { _this._events[evKey] = []; } _this._events[evKey].push({ callback: callback, once: !!once }); }); return this; } /** * 监听一个事件一次 * @param evt * @param callback */ }, { key: "once", value: function once(evt, callback) { var _this2 = this; evt === null || evt === void 0 ? void 0 : evt.split(',').forEach(function (evKey) { evKey = evKey.trim(); return _this2.on(evKey, callback, true); }); } /** * 触发一个事件 * @param evt * @param args */ }, { key: "emit", value: function emit(evts, eventArgs) { var _this3 = this; evts === null || evts === void 0 ? void 0 : evts.split(',').forEach(function (evt) { var events = _this3._events[evt] || []; var wildcardEvents = _this3._events[WILDCARD] || []; // 实际的处理 emit 方法 var doEmit = function doEmit(es) { var length = es.length; for (var i = 0; i < length; i++) { if (!es[i]) { // eslint-disable-next-line no-continue continue; } var _es$i = es[i], callback = _es$i.callback, once = _es$i.once; if (once) { es.splice(i, 1); if (es.length === 0) { delete _this3._events[evt]; } length--; i--; } callback.apply(_this3, [eventArgs]); } }; doEmit(events); doEmit(wildcardEvents); }); } /** * 取消监听一个事件,或者一个channel * @param evt * @param callback */ }, { key: "off", value: function off(evts, callback) { var _this4 = this; if (!evts) { // evt 为空全部清除 this._events = {}; } evts.split(',').forEach(function (evt) { if (!callback) { // evt 存在,callback 为空,清除事件所有方法 delete _this4._events[evt]; } else { // evt 存在,callback 存在,清除匹配的 var events = _this4._events[evt] || []; var length = events.length; for (var i = 0; i < length; i++) { if (events[i].callback === callback) { events.splice(i, 1); length--; i--; } } if (events.length === 0) { delete _this4._events[evt]; } } }); return this; } /* 当前所有的事件 */ }, { key: "getEvents", value: function getEvents() { return this._events; } }]); return EventEmitter; }(); // CONCATENATED MODULE: ./src/util/geometry.ts function snapToGrid(point, gridSize) { // 保证 x, y 的值为 gridSize 的整数倍 return gridSize * Math.round(point / gridSize) || point; } // 获取节点偏移时,产生的偏移量。当节点基于gridSize进行了偏移后, // 节点上的文本可以基于此方法移动对应的距离来保持与节点相对位置不变。 function getGridOffset(distance, gridSize) { return distance % gridSize; } // CONCATENATED MODULE: ./src/util/graph.ts function graph_slicedToArray(arr, i) { return graph_arrayWithHoles(arr) || graph_iterableToArrayLimit(arr, i) || graph_unsupportedIterableToArray(arr, i) || graph_nonIterableRest(); } function graph_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function graph_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return graph_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return graph_arrayLikeToArray(o, minLen); } function graph_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function graph_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function graph_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } var getById = function getById(id, data) { var result; for (var i = 0; i < data.length; i++) { if (data[i].id === id) { result = data[i]; } } return result; }; /** * 判断一个点是否在指定区域 * @param point 当前点 * @param leftTopPoint 区域左上角点 * @param rightBottomPoint 区域的右下角点 */ var isPointInArea = function isPointInArea(_ref, _ref2, _ref3) { var _ref4 = graph_slicedToArray(_ref, 2), x = _ref4[0], y = _ref4[1]; var _ref5 = graph_slicedToArray(_ref2, 2), leftTopX = _ref5[0], leftTopY = _ref5[1]; var _ref6 = graph_slicedToArray(_ref3, 2), rightBottomX = _ref6[0], rightBottomY = _ref6[1]; return x > leftTopX && x < rightBottomX && y > leftTopY && y < rightBottomY; }; /** * 判断鼠标点击选中元素的时候,是否为多选 */ var isMultipleSelect = function isMultipleSelect(e, editConfigModel) { var multipleSelectKey = editConfigModel.multipleSelectKey; var isMultiple = false; switch (multipleSelectKey) { case 'meta': isMultiple = e.metaKey; break; case 'alt': isMultiple = e.altKey; break; case 'shift': isMultiple = e.shiftKey; break; case 'ctrl': isMultiple = e.ctrlKey; // Mac上ctrl + 点击节点会触发上下文菜单,所以ctrl尽量用在非Mac系统 break; default: isMultiple = false; break; } return isMultiple; }; // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.number.constructor.js var es_number_constructor = __webpack_require__(79); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.string.match.js var es_string_match = __webpack_require__(161); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.string.replace.js var es_string_replace = __webpack_require__(125); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.number.max-safe-integer.js var es_number_max_safe_integer = __webpack_require__(80); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.object.assign.js var es_object_assign = __webpack_require__(30); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.object.set-prototype-of.js var es_object_set_prototype_of = __webpack_require__(12); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.object.get-prototype-of.js var es_object_get_prototype_of = __webpack_require__(13); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.reflect.construct.js var es_reflect_construct = __webpack_require__(14); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.reflect.get.js var es_reflect_get = __webpack_require__(47); // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js // Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). var getRandomValues; var rnds8 = new Uint8Array(16); function rng() { // lazy load so that environments that need to polyfill have a chance to do so if (!getRandomValues) { // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also, // find the complete implementation of crypto (msCrypto) on IE11. getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto); if (!getRandomValues) { throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); } } return getRandomValues(rnds8); } // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/regex.js /* harmony default export */ var regex = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i); // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/validate.js function validate(uuid) { return typeof uuid === 'string' && regex.test(uuid); } /* harmony default export */ var esm_browser_validate = (validate); // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ var byteToHex = []; for (var stringify_i = 0; stringify_i < 256; ++stringify_i) { byteToHex.push((stringify_i + 0x100).toString(16).substr(1)); } function stringify(arr) { var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one // of the following: // - One or more input array values don't map to a hex octet (leading to // "undefined" in the uuid) // - Invalid input values for the RFC `version` or `variant` fields if (!esm_browser_validate(uuid)) { throw TypeError('Stringified UUID is invalid'); } return uuid; } /* harmony default export */ var esm_browser_stringify = (stringify); // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js function v4(options, buf, offset) { options = options || {}; var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = rnds[6] & 0x0f | 0x40; rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided if (buf) { offset = offset || 0; for (var i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return esm_browser_stringify(rnds); } /* harmony default export */ var esm_browser_v4 = (v4); // CONCATENATED MODULE: ./src/util/uuid.ts var uuid_createUuid = function createUuid() { var uuid = esm_browser_v4(); return uuid; }; /** * 重新刷新流程图的所有id */ var uuid_refreshGraphId = function refreshGraphId(graphData) { var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var nodeIdMap = graphData.nodes.reduce(function (nMap, node) { nMap[node.id] = prefix + esm_browser_v4(); node.id = nMap[node.id]; return nMap; }, {}); graphData.edges.forEach(function (edge) { edge.id = prefix + esm_browser_v4(); edge.sourceNodeId = nodeIdMap[edge.sourceNodeId]; edge.targetNodeId = nodeIdMap[edge.targetNodeId]; }); return graphData; }; // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.string.anchor.js var es_string_anchor = __webpack_require__(104); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.math.hypot.js var es_math_hypot = __webpack_require__(203); // CONCATENATED MODULE: ./src/algorithm/edge.ts /* 求两个线段交点 入参:线段1端点: ab, 线段2端点: cd, 返回值:有交点返回交点,无交点返回false */ var getCrossPointOfLine = function getCrossPointOfLine(a, b, c, d) { /** 1 解线性方程组, 求线段交点. * */ // 如果分母为0 则平行或共线, 不相交 var denominator = (b.y - a.y) * (d.x - c.x) - (a.x - b.x) * (c.y - d.y); if (denominator === 0) { return false; } // 线段所在直线的交点坐标 (x , y) var x = ((b.x - a.x) * (d.x - c.x) * (c.y - a.y) + (b.y - a.y) * (d.x - c.x) * a.x - (d.y - c.y) * (b.x - a.x) * c.x) / denominator; var y = -((b.y - a.y) * (d.y - c.y) * (c.x - a.x) + (b.x - a.x) * (d.y - c.y) * a.y - (d.x - c.x) * (b.y - a.y) * c.y) / denominator; /** 2 判断交点是否在两条线段上 * */ if ( // 交点在线段1上 (x - a.x) * (x - b.x) <= 0 && (y - a.y) * (y - b.y) <= 0 // 且交点也在线段2上 && (x - c.x) * (x - d.x) <= 0 && (y - c.y) * (y - d.y) <= 0) { // 返回交点p return { x: x, y: y }; } // 否则不相交 return false; }; /* 判断一个点是否在线段中 入参点:point, 线段起终点,start,end, 返回值: 在线段中true,否则false */ var isInSegment = function isInSegment(point, start, end) { var x = point.x, y = point.y; return (x - start.x) * (x - end.x) <= 0 && (y - start.y) * (y - end.y) <= 0; }; // CONCATENATED MODULE: ./src/util/node.ts function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { node_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function node_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /* 获取所有锚点 */ var node_getAnchors = function getAnchors(data) { var anchors = data.anchors; return anchors; }; /* 手动边时获取目标节点的信息:目标节点,目标节点的锚点index以及坐标 */ var targetNodeInfo = function targetNodeInfo(position, graphModel) { var nodes = graphModel.nodes; var nodeInfo; for (var i = nodes.length - 1; i >= 0; i--) { var targetNode = nodes[i]; var inNode = isInNodeBbox(position, targetNode); if (inNode) { var anchorInfo = targetNode.getTargetAnchor(position); if (anchorInfo) { // 不能连接到没有锚点的节点 var currentNodeInfo = { node: targetNode, anchorIndex: anchorInfo.index, anchor: anchorInfo.anchor }; // fix: 489; 多个节点重合时,连线连接上面的那一个。 if (!nodeInfo || isNodeHigher(targetNode, nodeInfo.node, graphModel)) { nodeInfo = currentNodeInfo; } } } } return nodeInfo; }; /** * 比较两个节点 */ var isNodeHigher = function isNodeHigher(node1, node2, graphModel) { if (node1.zIndex > node2.zIndex) { return true; } if (graphModel.nodesMap[node1.id].index > graphModel.nodesMap[node2.id].index) { return true; } return false; }; /* 手动边时获取目标节点上,距离目标位置最近的锚点 */ var getClosestAnchor = function getClosestAnchor(position, node) { var anchors = node_getAnchors(node); var closest; var minDistance = Number.MAX_SAFE_INTEGER; for (var i = 0; i < anchors.length; i++) { var len = node_distance(position.x, position.y, anchors[i].x, anchors[i].y); if (len < minDistance) { minDistance = len; closest = { index: i, anchor: _objectSpread(_objectSpread({}, anchors[i]), {}, { x: anchors[i].x, y: anchors[i].y, id: anchors[i].id }) }; } } return closest; }; /* 两点之间距离 */ var node_distance = function distance(x1, y1, x2, y2) { return Math.hypot(x1 - x2, y1 - y2); }; /* 是否在某个节点内,手否进行连接,有offset控制粒度,与outline有关,可以优化 */ var isInNode = function isInNode(position, node) { var inNode = false; var offset = 0; var bBox = getNodeBBox(node); if (position.x >= bBox.minX - offset && position.x <= bBox.maxX + offset && position.y >= bBox.minY - offset && position.y <= bBox.maxY + offset) { inNode = true; } return inNode; }; var isInNodeBbox = function isInNodeBbox(position, node) { var inNode = false; var offset = 5; var bBox = getNodeBBox(node); if (position.x >= bBox.minX - offset && position.x <= bBox.maxX + offset && position.y >= bBox.minY - offset && position.y <= bBox.maxY + offset) { inNode = true; } return inNode; }; /* 获取节点bbox */ var getNodeBBox = function getNodeBBox(node) { var x = node.x, y = node.y, width = node.width, height = node.height; var bBox = { minX: x - width / 2, minY: y - height / 2, maxX: x + width / 2, maxY: y + height / 2, x: x, y: y, width: width, height: height, centerX: x, centerY: y }; return bBox; }; var getRectRadiusCircle = function getRectRadiusCircle(node) { var _ref = node, x = _ref.x, y = _ref.y, width = _ref.width, height = _ref.height, radius = _ref.radius; var radiusCenter = [{ x: x - width / 2 + radius, y: y - height / 2 + radius, r: radius }, { x: x + width / 2 - radius, y: y - height / 2 + radius, r: radius }, { x: x - width / 2 + radius, y: y + height / 2 - radius, r: radius }, { x: x + width / 2 - radius, y: y + height / 2 - radius, r: radius }]; return radiusCenter; }; var getClosestRadiusCenter = function getClosestRadiusCenter(point, direction, node) { var radiusCenter = getRectRadiusCircle(node); var closestRadiusPoint; var minDistance = Number.MAX_SAFE_INTEGER; radiusCenter.forEach(function (item) { var radiusDistance = node_distance(point.x, point.y, item.x, item.y); if (radiusDistance < minDistance) { minDistance = radiusDistance; closestRadiusPoint = item; } }); var crossPoint = node_getCrossPointWithCircle(point, direction, closestRadiusPoint); return crossPoint; }; /* 求点在垂直或者水平方向上与圆形的交点 */ var node_getCrossPointWithCircle = function getCrossPointWithCircle(point, direction, node) { var crossPoint; var _ref2 = node, x = _ref2.x, y = _ref2.y, r = _ref2.r; if (direction === SegmentDirection.HORIZONTAL) { // 水平,x轴 var crossLeft = x - Math.sqrt(r * r - (point.y - y) * (point.y - y)); var crossRight = x + Math.sqrt(r * r - (point.y - y) * (point.y - y)); var crossX = Math.abs(crossLeft - point.x) < Math.abs(crossRight - point.x) ? crossLeft : crossRight; crossPoint = { x: crossX, y: point.y }; } else if (direction === SegmentDirection.VERTICAL) { // 垂直,y轴 var crossTop = y - Math.sqrt(r * r - (point.x - x) * (point.x - x)); var crossBottom = y + Math.sqrt(r * r - (point.x - x) * (point.x - x)); var crossY = Math.abs(crossTop - point.y) < Math.abs(crossBottom - point.y) ? crossTop : crossBottom; crossPoint = { x: point.x, y: crossY }; } return crossPoint; }; /* 判断点所在边的方向 */ var node_pointEdgeDirection = function pointEdgeDirection(point, node) { var dx = Math.abs(point.x - node.x); var dy = Math.abs(point.y - node.y); return dx / node.width > dy / node.height ? SegmentDirection.VERTICAL : SegmentDirection.HORIZONTAL; }; // 判断矩形外框上一点是否在矩形直行线上 var inStraightLineOfRect = function inStraightLineOfRect(point, node) { var rect = node; var isInStraight = false; var rectBox = { minX: rect.x - rect.width / 2 + rect.radius, maxX: rect.x + rect.width / 2 - rect.radius, minY: rect.y - rect.height / 2 + rect.radius, maxY: rect.y + rect.height / 2 - rect.radius }; var x = rect.x, y = rect.y, width = rect.width, height = rect.height; if (point.y === y + height / 2 || point.y === y - height / 2) { isInStraight = point.x > rectBox.minX && point.x < rectBox.maxX; } else if (point.x === x + width / 2 || point.x === x - width / 2) { isInStraight = point.y > rectBox.minY && point.y < rectBox.maxY; } return isInStraight; }; /* 求点在垂直或者水平方向上与椭圆的交点 */ var node_getCrossPointWithEllipse = function getCrossPointWithEllipse(point, direction, node) { var crossPoint; var _ref3 = node, x = _ref3.x, y = _ref3.y, rx = _ref3.rx, ry = _ref3.ry; if (direction === SegmentDirection.HORIZONTAL) { // 水平 var crossLeft = x - Math.sqrt(rx * rx - (point.y - y) * (point.y - y) * rx * rx / (ry * ry)); var crossRight = x + Math.sqrt(rx * rx - (point.y - y) * (point.y - y) * rx * rx / (ry * ry)); var crossX = Math.abs(crossLeft - point.x) < Math.abs(crossRight - point.x) ? crossLeft : crossRight; crossPoint = { x: crossX, y: point.y }; } else if (direction === SegmentDirection.VERTICAL) { // 垂直 var crossTop = y - Math.sqrt(ry * ry - (point.x - x) * (point.x - x) * ry * ry / (rx * rx)); var crossBottom = y + Math.sqrt(ry * ry - (point.x - x) * (point.x - x) * ry * ry / (rx * rx)); var crossY = Math.abs(crossTop - point.y) < Math.abs(crossBottom - point.y) ? crossTop : crossBottom; crossPoint = { x: point.x, y: crossY }; } return crossPoint; }; /* 求点在垂直或者水平方向上与多边形的交点 */ var node_getCrossPointWithPolygon = function getCrossPointWithPolygon(point, direction, node) { var _ref4 = node, pointsPosition = _ref4.pointsPosition; var minDistance = Number.MAX_SAFE_INTEGER; var crossPoint; var segments = []; for (var i = 0; i < pointsPosition.length; i++) { segments.push({ start: pointsPosition[i], end: pointsPosition[(i + 1) % pointsPosition.length] }); } segments.forEach(function (item) { var start = item.start, end = item.end; var a = start; var b = end; if (start.x > end.x) { a = end; b = start; } var pointXY = { x: point.x, y: point.y }; // 如果多边形当前线段是垂直,求交点 if (a.x === b.x && direction === SegmentDirection.HORIZONTAL) { pointXY = { x: a.x, y: point.y }; } // 如果多边形当前线段是水平,求交点 if (a.y === b.y && direction === SegmentDirection.VERTICAL) { pointXY = { x: point.x, y: a.y }; } // 如果线段不是水平或者垂直, 使用向量方程进行计算 if (a.x !== b.x && a.y !== b.y) { var k = (b.y - a.y) / (b.x - a.x); var m = (a.x * b.y - b.x * a.y) / (a.x - b.x); if (direction === SegmentDirection.HORIZONTAL) { pointXY = { x: (point.y - m) / k, y: point.y }; } else if (direction === SegmentDirection.VERTICAL) { pointXY = { x: point.x, y: k * point.x + m }; } } // 如果交点在线段上 var inSegment = isInSegment(pointXY, start, end); if (inSegment) { var currentDistance = node_distance(pointXY.x, pointXY.y, point.x, point.y); if (currentDistance < minDistance) { minDistance = currentDistance; crossPoint = pointXY; } } }); return crossPoint; }; // 规范节点初始化数据 var node_pickNodeConfig = function pickNodeConfig(data) { var nodeData = lodash_es_pick(data, ['id', 'type', 'x', 'y', 'text', 'properties', 'virtual' // 区域节点是否为dnd添加的虚拟节点 ]); return nodeData; }; /** * 基于节点的边,重新获取新的节点 */ var getNodeAnchorPosition = function getNodeAnchorPosition(center, point, width, height) { var x = center.x, y = center.y; if (point.x > center.x) { x = center.x + width / 2; } else if (point.x < center.x) { x = center.x - width / 2; } if (point.y > center.y) { y = center.y + height / 2; } else if (point.y < center.y) { y = center.y - height / 2; } return { x: x, y: y }; }; // 获取文案高度,自动换行,利用dom计算高度 var getHtmlTextHeight = function getHtmlTextHeight(_ref5) { var rows = _ref5.rows, style = _ref5.style, rowsLength = _ref5.rowsLength, className = _ref5.className; var dom = document.createElement('div'); dom.style.fontSize = style.fontSize; dom.style.width = style.width; dom.className = className; dom.style.lineHeight = style.lineHeight; dom.style.padding = style.padding; if (style.fontFamily) { dom.style.fontFamily = style.fontFamily; } if (rowsLength > 1) { rows.forEach(function (row) { var rowDom = document.createElement('div'); rowDom.textContent = row; dom.appendChild(rowDom); }); } else { dom.textContent = rows; } document.body.appendChild(dom); var height = dom.clientHeight; document.body.removeChild(dom); return height; }; // 获取文案高度,自动换行,利用dom计算高度 var node_getSvgTextWidthHeight = function getSvgTextWidthHeight(_ref6) { var rows = _ref6.rows, rowsLength = _ref6.rowsLength, fontSize = _ref6.fontSize; var longestBytes = 0; rows && rows.forEach(function (item) { var rowByteLength = getBytesLength(item); longestBytes = rowByteLength > longestBytes ? rowByteLength : longestBytes; }); // 背景框宽度,最长一行字节数/2 * fontsize + 2 // 背景框宽度, 行数 * fontsize + 2 return { width: Math.ceil(longestBytes / 2) * fontSize + fontSize / 4, height: rowsLength * (fontSize + 2) + fontSize / 4 }; }; /** * @description 格式化边校验信息 */ var formateAnchorConnectValidateData = function formateAnchorConnectValidateData(data) { if (_typeof(data) !== 'object') { return { isAllPass: !!data, msg: data ? '' : '不允许连接' }; } return data; }; // CONCATENATED MODULE: ./src/util/compatible.ts // 需要进行兼容操作,提供的方法 // vue中data会进行Observe, 深拷贝的原始数据对象。 var formatData = function formatData(data) { try { return JSON.parse(JSON.stringify(data)); } catch (_unused) { return data; } }; // CONCATENATED MODULE: ./src/util/zIndex.ts var maxIndex = 1000; var minIndex = 999; var getZIndex = function getZIndex() { return ++maxIndex; }; var getMinIndex = function getMinIndex() { return --minIndex; }; // CONCATENATED MODULE: ./src/model/edge/BaseEdgeModel.ts var BaseEdgeModel_class, BaseEdgeModel_descriptor, BaseEdgeModel_descriptor2, BaseEdgeModel_descriptor3, BaseEdgeModel_descriptor4, BaseEdgeModel_descriptor5, BaseEdgeModel_descriptor6, BaseEdgeModel_descriptor7, BaseEdgeModel_descriptor8, BaseEdgeModel_descriptor9, BaseEdgeModel_descriptor10, BaseEdgeModel_descriptor11, BaseEdgeModel_descriptor12, BaseEdgeModel_descriptor13, BaseEdgeModel_descriptor14, BaseEdgeModel_descriptor15, BaseEdgeModel_descriptor16, BaseEdgeModel_descriptor17, _descriptor18, _descriptor19, _descriptor20; function BaseEdgeModel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function BaseEdgeModel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { BaseEdgeModel_ownKeys(Object(source), true).forEach(function (key) { BaseEdgeModel_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { BaseEdgeModel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function BaseEdgeModel_initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function BaseEdgeModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function BaseEdgeModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function BaseEdgeModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) BaseEdgeModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) BaseEdgeModel_defineProperties(Constructor, staticProps); return Constructor; } function BaseEdgeModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function BaseEdgeModel_applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function BaseEdgeModel_initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } var BaseEdgeModel_BaseEdgeModel = (BaseEdgeModel_class = /*#__PURE__*/function () { // 支持自定义 function BaseEdgeModel(data, graphModel) { BaseEdgeModel_classCallCheck(this, BaseEdgeModel); BaseEdgeModel_defineProperty(this, "id", ''); BaseEdgeModel_initializerDefineProperty(this, "type", BaseEdgeModel_descriptor, this); BaseEdgeModel_initializerDefineProperty(this, "sourceNodeId", BaseEdgeModel_descriptor2, this); BaseEdgeModel_initializerDefineProperty(this, "targetNodeId", BaseEdgeModel_descriptor3, this); BaseEdgeModel_initializerDefineProperty(this, "startPoint", BaseEdgeModel_descriptor4, this); BaseEdgeModel_initializerDefineProperty(this, "endPoint", BaseEdgeModel_descriptor5, this); BaseEdgeModel_initializerDefineProperty(this, "text", BaseEdgeModel_descriptor6, this); BaseEdgeModel_initializerDefineProperty(this, "properties", BaseEdgeModel_descriptor7, this); BaseEdgeModel_initializerDefineProperty(this, "points", BaseEdgeModel_descriptor8, this); BaseEdgeModel_initializerDefineProperty(this, "pointsList", BaseEdgeModel_descriptor9, this); BaseEdgeModel_initializerDefineProperty(this, "isSelected", BaseEdgeModel_descriptor10, this); BaseEdgeModel_initializerDefineProperty(this, "isHovered", BaseEdgeModel_descriptor11, this); BaseEdgeModel_initializerDefineProperty(this, "isHitable", BaseEdgeModel_descriptor12, this); BaseEdgeModel_initializerDefineProperty(this, "draggable", BaseEdgeModel_descriptor13, this); BaseEdgeModel_initializerDefineProperty(this, "visible", BaseEdgeModel_descriptor14, this); BaseEdgeModel_defineProperty(this, "virtual", false); BaseEdgeModel_initializerDefineProperty(this, "isAnimation", BaseEdgeModel_descriptor15, this); BaseEdgeModel_initializerDefineProperty(this, "isShowAdjustPoint", BaseEdgeModel_descriptor16, this); BaseEdgeModel_defineProperty(this, "graphModel", void 0); BaseEdgeModel_initializerDefineProperty(this, "zIndex", BaseEdgeModel_descriptor17, this); BaseEdgeModel_defineProperty(this, "BaseType", ElementType.EDGE); BaseEdgeModel_defineProperty(this, "modelType", ModelType.EDGE); BaseEdgeModel_initializerDefineProperty(this, "state", _descriptor18, this); BaseEdgeModel_defineProperty(this, "additionStateData", void 0); BaseEdgeModel_defineProperty(this, "sourceAnchorId", ''); BaseEdgeModel_defineProperty(this, "targetAnchorId", ''); BaseEdgeModel_defineProperty(this, "menu", void 0); BaseEdgeModel_defineProperty(this, "customTextPosition", false); BaseEdgeModel_initializerDefineProperty(this, "style", _descriptor19, this); BaseEdgeModel_initializerDefineProperty(this, "arrowConfig", _descriptor20, this); this.graphModel = graphModel; this.initEdgeData(data); this.setAttributes(); } /** * 初始化边数据 * @overridable 支持重写 * initNodeData和setAttributes的区别在于 * initNodeData只在节点初始化的时候调用,用于初始化节点的所有属性。 * setAttributes除了初始化调用外,还会在properties发生变化后调用。 */ BaseEdgeModel_createClass(BaseEdgeModel, [{ key: "initEdgeData", value: function initEdgeData(data) { if (!data.properties) { data.properties = {}; } if (!data.id) { // 自定义边id > 全局定义边id > 内置 var idGenerator = this.graphModel.idGenerator; var globalId = idGenerator && idGenerator(data.type); var nodeId = this.createId(); data.id = nodeId || globalId || uuid_createUuid(); } this.arrowConfig.markerEnd = "url(#marker-end-".concat(data.id, ")"); var adjustEdgeStartAndEnd = this.graphModel.editConfigModel.adjustEdgeStartAndEnd; this.isShowAdjustPoint = adjustEdgeStartAndEnd; lodash_es_assign(this, edge_pickEdgeConfig(data)); var overlapMode = this.graphModel.overlapMode; if (overlapMode === OverlapMode.INCREASE) { this.zIndex = data.zIndex || getZIndex(); } // 设置边的 anchors,也就是边的两个端点 // 端点依赖于 edgeData 的 sourceNode 和 targetNode this.setAnchors(); // 边的拐点依赖于两个端点 this.initPoints(); // 文本位置依赖于边上的所有拐点 this.formatText(data); } /** * 设置model属性 * @overridable 支持重写 * 每次properties发生变化会触发 */ }, { key: "setAttributes", value: function setAttributes() {} }, { key: "createId", value: function createId() { return null; } /** * 自定义边样式 * * @overridable 支持重写 * @returns 自定义边样式 */ }, { key: "getEdgeStyle", value: function getEdgeStyle() { return BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, this.graphModel.theme.baseEdge), this.style); } /** * 自定义边调整点样式 * * @overridable 支持重写 * 在isShowAdjustPoint为true时会显示调整点。 */ }, { key: "getAdjustPointStyle", value: function getAdjustPointStyle() { return BaseEdgeModel_objectSpread({}, this.graphModel.theme.edgeAdjust); } /** * 自定义边文本样式 * * @overridable 支持重写 */ }, { key: "getTextStyle", value: function getTextStyle() { // 透传 edgeText var edgeText = this.graphModel.theme.edgeText; return lodash_es_cloneDeep(edgeText); } /** * 自定义边动画样式 * * @overridable 支持重写 * @example * getEdgeAnimationStyle() { * const style = super.getEdgeAnimationStyle(); * style.stroke = 'blue' * style.animationDuration = '30s' * style.animationDirection = 'reverse' * return style * } */ }, { key: "getEdgeAnimationStyle", value: function getEdgeAnimationStyle() { var edgeAnimation = this.graphModel.theme.edgeAnimation; return lodash_es_cloneDeep(edgeAnimation); } /** * 自定义边箭头样式 * * @overridable 支持重写 * @example * getArrowStyle() { * const style = super.getArrowStyle(); * style.stroke = 'green'; * return style; * } */ }, { key: "getArrowStyle", value: function getArrowStyle() { var edgeStyle = this.getEdgeStyle(); var edgeAnimationStyle = this.getEdgeAnimationStyle(); var arrow = this.graphModel.theme.arrow; var stroke = this.isAnimation ? edgeAnimationStyle.stroke : edgeStyle.stroke; return BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, edgeStyle), {}, { fill: stroke, stroke: stroke }, arrow); } /** * 自定义边被选中时展示其范围的矩形框样式 * * @overridable 支持重写 * @example * // 隐藏outline * getOutlineStyle() { * const style = super.getOutlineStyle(); * style.stroke = "none"; * style.hover.stroke = "none"; * return style; * } */ }, { key: "getOutlineStyle", value: function getOutlineStyle() { var graphModel = this.graphModel; var outline = graphModel.theme.outline; return lodash_es_cloneDeep(outline); } /** * 重新自定义文本位置 * * @overridable 支持重写 */ }, { key: "getTextPosition", value: function getTextPosition() { return { x: 0, y: 0 }; } /** * 边的前一个节点 */ }, { key: "sourceNode", get: function get() { var _this$graphModel, _this$graphModel$node; return (_this$graphModel = this.graphModel) === null || _this$graphModel === void 0 ? void 0 : (_this$graphModel$node = _this$graphModel.nodesMap[this.sourceNodeId]) === null || _this$graphModel$node === void 0 ? void 0 : _this$graphModel$node.model; } /** * 边的后一个节点 */ }, { key: "targetNode", get: function get() { var _this$graphModel2, _this$graphModel2$nod; return (_this$graphModel2 = this.graphModel) === null || _this$graphModel2 === void 0 ? void 0 : (_this$graphModel2$nod = _this$graphModel2.nodesMap[this.targetNodeId]) === null || _this$graphModel2$nod === void 0 ? void 0 : _this$graphModel2$nod.model; } }, { key: "textPosition", get: function get() { return this.getTextPosition(); } /** * 内部方法,计算两个节点相连是起点位置 */ }, { key: "getBeginAnchor", value: function getBeginAnchor(sourceNode, targetNode) { var position; var minDistance; var sourceAnchors = node_getAnchors(sourceNode); sourceAnchors.forEach(function (anchor) { var distance = twoPointDistance(anchor, targetNode); if (minDistance === undefined) { minDistance = distance; position = anchor; } else if (distance < minDistance) { minDistance = distance; position = anchor; } }); return position; } /** * 内部方法,计算两个节点相连是终点位置 */ }, { key: "getEndAnchor", value: function getEndAnchor(targetNode) { var _this = this; var position; var minDistance; var targetAnchors = node_getAnchors(targetNode); targetAnchors.forEach(function (anchor) { var distance = twoPointDistance(anchor, _this.startPoint); if (minDistance === undefined) { minDistance = distance; position = anchor; } else if (distance < minDistance) { minDistance = distance; position = anchor; } }); return position; } /** * 获取当前边的properties */ }, { key: "getProperties", value: function getProperties() { return Object(mobx_module["I" /* toJS */])(this.properties); } /** * 获取被保存时返回的数据 * * @overridable 支持重写 */ }, { key: "getData", value: function getData() { var _this$text = this.text, x = _this$text.x, y = _this$text.y, value = _this$text.value; var data = { id: this.id, type: this.type, sourceNodeId: this.sourceNode.id, targetNodeId: this.targetNode.id, startPoint: Object.assign({}, this.startPoint), endPoint: Object.assign({}, this.endPoint), properties: Object(mobx_module["I" /* toJS */])(this.properties) }; if (value) { data.text = { x: x, y: y, value: value }; } if (this.graphModel.overlapMode === OverlapMode.INCREASE) { data.zIndex = this.zIndex; } return data; } /** * 获取边的数据 * * @overridable 支持重写 * 用于在历史记录时获取节点数据。 * 在某些情况下,如果希望某个属性变化不引起history的变化, * 可以重写此方法。 */ }, { key: "getHistoryData", value: function getHistoryData() { return this.getData(); } /** * 设置边的属性,会触发重新渲染 * @param key 属性名 * @param val 属性值 */ }, { key: "setProperty", value: function setProperty(key, val) { this.properties[key] = formatData(val); this.setAttributes(); } /** * 删除边的属性,会触发重新渲染 * @param key 属性名 */ }, { key: "deleteProperty", value: function deleteProperty(key) { delete this.properties[key]; this.setAttributes(); } /** * 设置边的属性,会触发重新渲染 * @param key 属性名 * @param val 属性值 */ }, { key: "setProperties", value: function setProperties(properties) { this.properties = BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, this.properties), formatData(properties)); this.setAttributes(); } /** * 修改边的id */ }, { key: "changeEdgeId", value: function changeEdgeId(id) { var _this$arrowConfig = this.arrowConfig, markerEnd = _this$arrowConfig.markerEnd, markerStart = _this$arrowConfig.markerStart; if (markerStart && markerStart === "url(#marker-start-".concat(this.id, ")")) { this.arrowConfig.markerStart = "url(#marker-start-".concat(id, ")"); } if (markerEnd && markerEnd === "url(#marker-end-".concat(this.id, ")")) { this.arrowConfig.markerEnd = "url(#marker-end-".concat(id, ")"); } this.id = id; } /** * 设置边样式,用于插件开发时跳过自定义边的渲染。大多数情况下,不需要使用此方法。 * 如果需要设置边的样式,请使用 getEdgeStyle 方法自定义边样式。 */ }, { key: "setStyle", value: function setStyle(key, val) { this.style = BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, this.style), {}, BaseEdgeModel_defineProperty({}, key, formatData(val))); } /** * 设置边样式,用于插件开发时跳过自定义边的渲染。大多数情况下,不需要使用此方法。 * 如果需要设置边的样式,请使用 getEdgeStyle 方法自定义边样式。 */ }, { key: "setStyles", value: function setStyles(styles) { this.style = BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, this.style), formatData(styles)); } /** * 设置边样式,用于插件开发时跳过自定义边的渲染。大多数情况下,不需要使用此方法。 * 如果需要设置边的样式,请使用 getEdgeStyle 方法自定义边样式。 */ }, { key: "updateStyles", value: function updateStyles(styles) { this.style = BaseEdgeModel_objectSpread({}, formatData(styles)); } /** * 内部方法,处理初始化文本格式 */ }, { key: "formatText", value: function formatText(data) { // 暂时处理,只传入text的情况 var _this$textPosition = this.textPosition, x = _this$textPosition.x, y = _this$textPosition.y; if (!data.text || typeof data.text === 'string') { this.text = { value: data.text || '', x: x, y: y, draggable: this.text.draggable, editable: this.text.editable }; return; } if (Object.prototype.toString.call(data.text) === '[object Object]') { this.text = { x: data.text.x || x, y: data.text.y || y, value: data.text.value || '', draggable: this.text.draggable, editable: this.text.editable }; } } /** * 重置文本位置 */ }, { key: "resetTextPosition", value: function resetTextPosition() { var _this$textPosition2 = this.textPosition, x = _this$textPosition2.x, y = _this$textPosition2.y; this.text.x = x; this.text.y = y; } /** * 移动边上的文本 */ }, { key: "moveText", value: function moveText(deltaX, deltaY) { if (this.text) { var _this$text2 = this.text, x = _this$text2.x, y = _this$text2.y, value = _this$text2.value, draggable = _this$text2.draggable, editable = _this$text2.editable; this.text = { value: value, draggable: draggable, x: x + deltaX, y: y + deltaY, editable: editable }; } } /** * 设置文本位置和值 */ }, { key: "setText", value: function setText(textConfig) { if (textConfig) { lodash_es_assign(this.text, textConfig); } } /** * 更新文本的值 */ }, { key: "updateText", value: function updateText(value) { this.text = BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, this.text), {}, { value: value }); } /** * 内部方法,计算边的起点和终点和其对于的锚点Id */ }, { key: "setAnchors", value: function setAnchors() { if (!this.sourceAnchorId || !this.startPoint) { var anchor = this.getBeginAnchor(this.sourceNode, this.targetNode); if (!this.startPoint) { this.startPoint = { x: anchor.x, y: anchor.y }; } if (!this.sourceAnchorId) { this.sourceAnchorId = anchor.id; } } if (!this.targetAnchorId || !this.endPoint) { var _anchor = this.getEndAnchor(this.targetNode); if (!this.endPoint) { this.endPoint = { x: _anchor.x, y: _anchor.y }; } if (!this.targetAnchorId) { this.targetAnchorId = _anchor.id; } } } }, { key: "setSelected", value: function setSelected() { var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.isSelected = flag; } }, { key: "setHovered", value: function setHovered() { var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.isHovered = flag; } }, { key: "setHitable", value: function setHitable() { var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.isHitable = flag; } }, { key: "openEdgeAnimation", value: function openEdgeAnimation() { this.isAnimation = true; } }, { key: "closeEdgeAnimation", value: function closeEdgeAnimation() { this.isAnimation = false; } }, { key: "setElementState", value: function setElementState(state, additionStateData) { this.state = state; this.additionStateData = additionStateData; } }, { key: "updateStartPoint", value: function updateStartPoint(anchor) { this.startPoint = anchor; } }, { key: "moveStartPoint", value: function moveStartPoint(deltaX, deltaY) { this.startPoint.x += deltaX; this.startPoint.y += deltaY; } }, { key: "updateEndPoint", value: function updateEndPoint(anchor) { this.endPoint = anchor; } }, { key: "moveEndPoint", value: function moveEndPoint(deltaX, deltaY) { this.endPoint.x += deltaX; this.endPoint.y += deltaY; } }, { key: "setZIndex", value: function setZIndex() { var zIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; this.zIndex = zIndex; } }, { key: "initPoints", value: function initPoints() {} }, { key: "updateAttributes", value: function updateAttributes(attributes) { lodash_es_assign(this, attributes); } // 获取边调整的起点 }, { key: "getAdjustStart", value: function getAdjustStart() { return this.startPoint; } // 获取边调整的终点 }, { key: "getAdjustEnd", value: function getAdjustEnd() { return this.endPoint; } // 起终点拖拽调整过程中,进行直线路径更新 }, { key: "updateAfterAdjustStartAndEnd", value: function updateAfterAdjustStartAndEnd(_ref) { var startPoint = _ref.startPoint, endPoint = _ref.endPoint; this.updateStartPoint({ x: startPoint.x, y: startPoint.y }); this.updateEndPoint({ x: endPoint.x, y: endPoint.y }); } }]); return BaseEdgeModel; }(), (BaseEdgeModel_descriptor = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "type", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return ''; } }), BaseEdgeModel_descriptor2 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "sourceNodeId", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return ''; } }), BaseEdgeModel_descriptor3 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "targetNodeId", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return ''; } }), BaseEdgeModel_descriptor4 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "startPoint", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), BaseEdgeModel_descriptor5 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "endPoint", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), BaseEdgeModel_descriptor6 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "text", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return { value: '', x: 0, y: 0, draggable: false, editable: true }; } }), BaseEdgeModel_descriptor7 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "properties", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return {}; } }), BaseEdgeModel_descriptor8 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "points", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return ''; } }), BaseEdgeModel_descriptor9 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "pointsList", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), BaseEdgeModel_descriptor10 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "isSelected", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), BaseEdgeModel_descriptor11 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "isHovered", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), BaseEdgeModel_descriptor12 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "isHitable", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), BaseEdgeModel_descriptor13 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "draggable", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), BaseEdgeModel_descriptor14 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "visible", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), BaseEdgeModel_descriptor15 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "isAnimation", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), BaseEdgeModel_descriptor16 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "isShowAdjustPoint", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), BaseEdgeModel_descriptor17 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "zIndex", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 0; } }), _descriptor18 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "state", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 1; } }), _descriptor19 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "style", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return {}; } }), _descriptor20 = BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "arrowConfig", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return { markerEnd: "url(#marker-end-".concat(this.id, ")"), markerStart: '' }; } }), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "sourceNode", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "sourceNode"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "targetNode", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "targetNode"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "textPosition", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "textPosition"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "setProperty", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "setProperty"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "deleteProperty", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "deleteProperty"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "setProperties", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "setProperties"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "changeEdgeId", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "changeEdgeId"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "setStyle", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "setStyle"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "setStyles", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "setStyles"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "updateStyles", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "updateStyles"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "formatText", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "formatText"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "resetTextPosition", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "resetTextPosition"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "moveText", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "moveText"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "setText", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "setText"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "updateText", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "updateText"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "setAnchors", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "setAnchors"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "setSelected", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "setSelected"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "setHovered", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "setHovered"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "setHitable", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "setHitable"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "openEdgeAnimation", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "openEdgeAnimation"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "closeEdgeAnimation", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "closeEdgeAnimation"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "setElementState", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "setElementState"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "updateStartPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "updateStartPoint"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "moveStartPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "moveStartPoint"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "updateEndPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "updateEndPoint"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "moveEndPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "moveEndPoint"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "setZIndex", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "setZIndex"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "initPoints", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "initPoints"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "updateAttributes", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "updateAttributes"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "getAdjustStart", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "getAdjustStart"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "getAdjustEnd", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "getAdjustEnd"), BaseEdgeModel_class.prototype), BaseEdgeModel_applyDecoratedDescriptor(BaseEdgeModel_class.prototype, "updateAfterAdjustStartAndEnd", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseEdgeModel_class.prototype, "updateAfterAdjustStartAndEnd"), BaseEdgeModel_class.prototype)), BaseEdgeModel_class); /* harmony default export */ var edge_BaseEdgeModel = (BaseEdgeModel_BaseEdgeModel); // CONCATENATED MODULE: ./src/model/edge/LineEdgeModel.ts function LineEdgeModel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { LineEdgeModel_typeof = function _typeof(obj) { return typeof obj; }; } else { LineEdgeModel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return LineEdgeModel_typeof(obj); } function LineEdgeModel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function LineEdgeModel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { LineEdgeModel_ownKeys(Object(source), true).forEach(function (key) { LineEdgeModel_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { LineEdgeModel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function LineEdgeModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function LineEdgeModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function LineEdgeModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) LineEdgeModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) LineEdgeModel_defineProperties(Constructor, staticProps); return Constructor; } function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (LineEdgeModel_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function LineEdgeModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var LineEdgeModel_LineEdgeModel = /*#__PURE__*/function (_BaseEdgeModel) { _inherits(LineEdgeModel, _BaseEdgeModel); var _super = _createSuper(LineEdgeModel); function LineEdgeModel() { var _this; LineEdgeModel_classCallCheck(this, LineEdgeModel); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); LineEdgeModel_defineProperty(_assertThisInitialized(_this), "modelType", ModelType.LINE_EDGE); return _this; } LineEdgeModel_createClass(LineEdgeModel, [{ key: "getEdgeStyle", value: function getEdgeStyle() { var line = this.graphModel.theme.line; var style = _get(_getPrototypeOf(LineEdgeModel.prototype), "getEdgeStyle", this).call(this); return LineEdgeModel_objectSpread(LineEdgeModel_objectSpread({}, style), lodash_es_cloneDeep(line)); } }, { key: "getTextPosition", value: function getTextPosition() { return { x: (this.startPoint.x + this.endPoint.x) / 2, y: (this.startPoint.y + this.endPoint.y) / 2 }; } }]); return LineEdgeModel; }(edge_BaseEdgeModel); // CONCATENATED MODULE: ./src/model/edge/PolylineEdgeModel.ts function PolylineEdgeModel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { PolylineEdgeModel_typeof = function _typeof(obj) { return typeof obj; }; } else { PolylineEdgeModel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return PolylineEdgeModel_typeof(obj); } var PolylineEdgeModel_class, PolylineEdgeModel_descriptor; function PolylineEdgeModel_slicedToArray(arr, i) { return PolylineEdgeModel_arrayWithHoles(arr) || PolylineEdgeModel_iterableToArrayLimit(arr, i) || PolylineEdgeModel_unsupportedIterableToArray(arr, i) || PolylineEdgeModel_nonIterableRest(); } function PolylineEdgeModel_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function PolylineEdgeModel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return PolylineEdgeModel_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return PolylineEdgeModel_arrayLikeToArray(o, minLen); } function PolylineEdgeModel_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function PolylineEdgeModel_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function PolylineEdgeModel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function PolylineEdgeModel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function PolylineEdgeModel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { PolylineEdgeModel_ownKeys(Object(source), true).forEach(function (key) { PolylineEdgeModel_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { PolylineEdgeModel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function PolylineEdgeModel_initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function PolylineEdgeModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function PolylineEdgeModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function PolylineEdgeModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) PolylineEdgeModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) PolylineEdgeModel_defineProperties(Constructor, staticProps); return Constructor; } function PolylineEdgeModel_get() { if (typeof Reflect !== "undefined" && Reflect.get) { PolylineEdgeModel_get = Reflect.get; } else { PolylineEdgeModel_get = function _get(target, property, receiver) { var base = PolylineEdgeModel_superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return PolylineEdgeModel_get.apply(this, arguments); } function PolylineEdgeModel_superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = PolylineEdgeModel_getPrototypeOf(object); if (object === null) break; } return object; } function PolylineEdgeModel_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) PolylineEdgeModel_setPrototypeOf(subClass, superClass); } function PolylineEdgeModel_setPrototypeOf(o, p) { PolylineEdgeModel_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return PolylineEdgeModel_setPrototypeOf(o, p); } function PolylineEdgeModel_createSuper(Derived) { var hasNativeReflectConstruct = PolylineEdgeModel_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = PolylineEdgeModel_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = PolylineEdgeModel_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return PolylineEdgeModel_possibleConstructorReturn(this, result); }; } function PolylineEdgeModel_possibleConstructorReturn(self, call) { if (call && (PolylineEdgeModel_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return PolylineEdgeModel_assertThisInitialized(self); } function PolylineEdgeModel_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function PolylineEdgeModel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function PolylineEdgeModel_getPrototypeOf(o) { PolylineEdgeModel_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return PolylineEdgeModel_getPrototypeOf(o); } function PolylineEdgeModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function PolylineEdgeModel_applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function PolylineEdgeModel_initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } // import { defaultTheme } from '../../constant/DefaultTheme'; var PolylineEdgeModel_PolylineEdgeModel = (PolylineEdgeModel_class = /*#__PURE__*/function (_BaseEdgeModel) { PolylineEdgeModel_inherits(PolylineEdgeModel, _BaseEdgeModel); var _super = PolylineEdgeModel_createSuper(PolylineEdgeModel); function PolylineEdgeModel() { var _this; PolylineEdgeModel_classCallCheck(this, PolylineEdgeModel); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); PolylineEdgeModel_defineProperty(PolylineEdgeModel_assertThisInitialized(_this), "modelType", ModelType.POLYLINE_EDGE); PolylineEdgeModel_defineProperty(PolylineEdgeModel_assertThisInitialized(_this), "draggingPointList", void 0); PolylineEdgeModel_initializerDefineProperty(PolylineEdgeModel_assertThisInitialized(_this), "dbClickPosition", PolylineEdgeModel_descriptor, PolylineEdgeModel_assertThisInitialized(_this)); return _this; } PolylineEdgeModel_createClass(PolylineEdgeModel, [{ key: "initEdgeData", value: function initEdgeData(data) { this.offset = 30; PolylineEdgeModel_get(PolylineEdgeModel_getPrototypeOf(PolylineEdgeModel.prototype), "initEdgeData", this).call(this, data); } }, { key: "getEdgeStyle", value: function getEdgeStyle() { var polyline = this.graphModel.theme.polyline; var style = PolylineEdgeModel_get(PolylineEdgeModel_getPrototypeOf(PolylineEdgeModel.prototype), "getEdgeStyle", this).call(this); return PolylineEdgeModel_objectSpread(PolylineEdgeModel_objectSpread({}, style), lodash_es_cloneDeep(polyline)); } }, { key: "getTextPosition", value: function getTextPosition() { var _this$text; // 在文案为空的情况下,文案位置为双击位置 var textValue = (_this$text = this.text) === null || _this$text === void 0 ? void 0 : _this$text.value; if (this.dbClickPosition && !textValue) { var _this$dbClickPosition = this.dbClickPosition, x = _this$dbClickPosition.x, y = _this$dbClickPosition.y; return { x: x, y: y }; } var currentPositionList = points2PointsList(this.points); var _getLongestEdge = edge_getLongestEdge(currentPositionList), _getLongestEdge2 = PolylineEdgeModel_slicedToArray(_getLongestEdge, 2), p1 = _getLongestEdge2[0], p2 = _getLongestEdge2[1]; return { x: (p1.x + p2.x) / 2, y: (p1.y + p2.y) / 2 }; } // 获取下一个锚点 }, { key: "getAfterAnchor", value: function getAfterAnchor(direction, position, anchorList) { var anchor; var minDistance; anchorList.forEach(function (item) { var distanceX; if (direction === SegmentDirection.HORIZONTAL) { distanceX = Math.abs(position.y - item.y); } else if (direction === SegmentDirection.VERTICAL) { distanceX = Math.abs(position.x - item.x); } if (!minDistance || minDistance > distanceX) { minDistance = distanceX; anchor = item; } }); return anchor; } /* 获取拖拽过程中产生的交点 */ }, { key: "getCrossPoint", value: function getCrossPoint(direction, start, end) { var position; if (direction === SegmentDirection.HORIZONTAL) { position = { x: end.x, y: start.y }; } else if (direction === SegmentDirection.VERTICAL) { position = { x: start.x, y: end.y }; } return position; } // 删除在图形内的过个交点 }, { key: "removeCrossPoints", value: function removeCrossPoints(startIndex, endIndex, pointList) { var list = pointList.map(function (i) { return i; }); if (startIndex === 1) { var start = list[startIndex]; var end = list[endIndex]; var pre = list[startIndex - 1]; var isInStartNode = edge_isSegmentsInNode(pre, start, this.sourceNode); if (isInStartNode) { var isSegmentsCrossStartNode = edge_isSegmentsCrossNode(start, end, this.sourceNode); if (isSegmentsCrossStartNode) { var point = edge_getCrossPointInRect(start, end, this.sourceNode); if (point) { list[startIndex] = point; list.splice(startIndex - 1, 1); startIndex--; endIndex--; } } } else { var anchorList = this.sourceNode.anchors; anchorList.forEach(function (item) { if (item.x === pre.x && item.x === start.x || item.y === pre.y && item.y === start.y) { var distance1 = node_distance(item.x, item.y, start.x, start.y); var distance2 = node_distance(pre.x, pre.y, start.x, start.y); if (distance1 < distance2) { list[startIndex - 1] = item; } } }); } } if (endIndex === pointList.length - 2) { var _start = list[startIndex]; var _end = list[endIndex]; var next = list[endIndex + 1]; var isInEndNode = edge_isSegmentsInNode(_end, next, this.targetNode); if (isInEndNode) { var _isSegmentsCrossStartNode = edge_isSegmentsCrossNode(_start, _end, this.targetNode); if (_isSegmentsCrossStartNode) { var _point = edge_getCrossPointInRect(_start, _end, this.targetNode); if (_point) { list[endIndex] = _point; list.splice(endIndex + 1, 1); } } } else { var _anchorList = this.targetNode.anchors; _anchorList.forEach(function (item) { if (item.x === next.x && item.x === _end.x || item.y === next.y && item.y === _end.y) { var distance1 = node_distance(item.x, item.y, _end.x, _end.y); var distance2 = node_distance(next.x, next.y, _end.x, _end.y); if (distance1 < distance2) { list[endIndex + 1] = item; } } }); } } return list; } // 获取在拖拽过程中可能产生的点 }, { key: "getDraggingPoints", value: function getDraggingPoints(direction, positionType, position, anchorList, draggingPointList) { var pointList = draggingPointList.map(function (i) { return i; }); var anchor = this.getAfterAnchor(direction, position, anchorList); var crossPoint = this.getCrossPoint(direction, position, anchor); if (positionType === 'start') { pointList.unshift(crossPoint); pointList.unshift(anchor); } else { pointList.push(crossPoint); pointList.push(anchor); } return pointList; } // 更新相交点[起点,终点],更加贴近图形, 未修改observable不作为action }, { key: "updateCrossPoints", value: function updateCrossPoints(pointList) { var list = pointList.map(function (i) { return i; }); var start = pointList[0]; var next = pointList[1]; var pre = pointList[list.length - 2]; var end = pointList[list.length - 1]; var sourceNode = this.sourceNode, targetNode = this.targetNode; var sourceModelType = sourceNode.modelType; var targetModelType = targetNode.modelType; var startPointDirection = edge_segmentDirection(start, next); var startCrossPoint = list[0]; switch (sourceModelType) { case ModelType.RECT_NODE: if (sourceNode.radius !== 0) { var inInnerNode = inStraightLineOfRect(start, sourceNode); if (!inInnerNode) { startCrossPoint = getClosestRadiusCenter(start, startPointDirection, sourceNode); } } break; case ModelType.CIRCLE_NODE: startCrossPoint = node_getCrossPointWithCircle(start, startPointDirection, sourceNode); break; case ModelType.ELLIPSE_NODE: startCrossPoint = node_getCrossPointWithEllipse(start, startPointDirection, sourceNode); break; case ModelType.DIAMOND_NODE: startCrossPoint = node_getCrossPointWithPolygon(start, startPointDirection, sourceNode); break; case ModelType.POLYGON_NODE: startCrossPoint = node_getCrossPointWithPolygon(start, startPointDirection, sourceNode); break; default: break; } list[0] = startCrossPoint; var endPointDirection = edge_segmentDirection(pre, end); var endCrossPoint = list[list.length - 1]; switch (targetModelType) { case ModelType.RECT_NODE: if (targetNode.radius !== 0) { var _inInnerNode = inStraightLineOfRect(end, targetNode); if (!_inInnerNode) { endCrossPoint = getClosestRadiusCenter(end, endPointDirection, targetNode); } } break; case ModelType.CIRCLE_NODE: endCrossPoint = node_getCrossPointWithCircle(end, endPointDirection, targetNode); break; case ModelType.ELLIPSE_NODE: endCrossPoint = node_getCrossPointWithEllipse(end, endPointDirection, targetNode); break; case ModelType.DIAMOND_NODE: endCrossPoint = node_getCrossPointWithPolygon(end, endPointDirection, targetNode); break; case ModelType.POLYGON_NODE: endCrossPoint = node_getCrossPointWithPolygon(end, endPointDirection, targetNode); break; default: break; } list[list.length - 1] = endCrossPoint; return list; } }, { key: "getData", value: function getData() { var data = PolylineEdgeModel_get(PolylineEdgeModel_getPrototypeOf(PolylineEdgeModel.prototype), "getData", this).call(this); var pointsList = this.pointsList.map(function (_ref) { var x = _ref.x, y = _ref.y; return { x: x, y: y }; }); return Object.assign({}, data, { pointsList: pointsList }); } }, { key: "initPoints", value: function initPoints() { if (this.pointsList.length > 0) { this.points = this.pointsList.map(function (point) { return "".concat(point.x, ",").concat(point.y); }).join(' '); } else { this.updatePoints(); } } }, { key: "updatePoints", value: function updatePoints() { var pointsList = getPolylinePoints({ x: this.startPoint.x, y: this.startPoint.y }, { x: this.endPoint.x, y: this.endPoint.y }, this.sourceNode, this.targetNode, this.offset || 0); this.pointsList = pointsList; this.points = pointsList.map(function (point) { return "".concat(point.x, ",").concat(point.y); }).join(' '); } }, { key: "updateStartPoint", value: function updateStartPoint(anchor) { this.startPoint = anchor; this.updatePoints(); } }, { key: "moveStartPoint", value: function moveStartPoint(deltaX, deltaY) { this.startPoint.x += deltaX; this.startPoint.y += deltaY; this.updatePoints(); // todo: 尽量保持边的整体轮廓, 通过deltaX和deltaY更新pointsList,而不是重新计算。 } }, { key: "updateEndPoint", value: function updateEndPoint(anchor) { this.endPoint = anchor; this.updatePoints(); } }, { key: "moveEndPoint", value: function moveEndPoint(deltaX, deltaY) { this.endPoint.x += deltaX; this.endPoint.y += deltaY; this.updatePoints(); } }, { key: "dragAppendStart", value: function dragAppendStart() { // mobx observer 对象被iterator处理会有问题 this.draggingPointList = this.pointsList.map(function (i) { return i; }); } }, { key: "dragAppendSimple", value: function dragAppendSimple(appendInfo, dragInfo) { // 因为drag事件是mouseDown事件触发的,因此当真实拖拽之后再设置isDragging // 避免因为点击事件造成,在dragStart触发之后,没有触发dragEnd错误设置了isDragging状态,对history计算造成错误 this.isDragging = true; var start = appendInfo.start, end = appendInfo.end, startIndex = appendInfo.startIndex, endIndex = appendInfo.endIndex, direction = appendInfo.direction; var pointsList = this.pointsList; var draggingPointList = pointsList; if (direction === SegmentDirection.HORIZONTAL) { // 水平,仅调整y坐标,拿到当前线段两个端点移动后的坐标 pointsList[startIndex] = { x: start.x, y: start.y + dragInfo.y }; pointsList[endIndex] = { x: end.x, y: end.y + dragInfo.y }; draggingPointList = this.pointsList.map(function (i) { return i; }); } else if (direction === SegmentDirection.VERTICAL) { // 垂直,仅调整x坐标, 与水平调整同理 pointsList[startIndex] = { x: start.x + dragInfo.x, y: start.y }; pointsList[endIndex] = { x: end.x + dragInfo.x, y: end.y }; draggingPointList = this.pointsList.map(function (i) { return i; }); } this.updatePointsAfterDrag(draggingPointList); this.draggingPointList = draggingPointList; this.setText(Object.assign({}, this.text, this.textPosition)); return { start: Object.assign({}, pointsList[startIndex]), end: Object.assign({}, pointsList[endIndex]), startIndex: startIndex, endIndex: endIndex, direction: direction }; } }, { key: "dragAppend", value: function dragAppend(appendInfo, dragInfo) { this.isDragging = true; var start = appendInfo.start, end = appendInfo.end, startIndex = appendInfo.startIndex, endIndex = appendInfo.endIndex, direction = appendInfo.direction; var pointsList = this.pointsList; if (direction === SegmentDirection.HORIZONTAL) { // 水平,仅调整y坐标 // step1: 拿到当前线段两个端点移动后的坐标 pointsList[startIndex] = { x: start.x, y: start.y + dragInfo.y }; pointsList[endIndex] = { x: end.x, y: end.y + dragInfo.y }; // step2: 计算拖拽后,两个端点与节点外框的交点 // 定义一个拖住中节点list var draggingPointList = this.pointsList.map(function (i) { return i; }); if (startIndex !== 0 && endIndex !== this.pointsList.length - 1) { // 2.1)如果线段没有连接起终点,过滤会穿插在图形内部的线段,取整个图形离线段最近的点 draggingPointList = this.removeCrossPoints(startIndex, endIndex, draggingPointList); } if (startIndex === 0) { // 2.2)如果线段连接了起点, 判断起点是否在节点内部 var startPosition = { x: start.x, y: start.y + dragInfo.y }; var inNode = isInNode(startPosition, this.sourceNode); if (!inNode) { // 如果不在节点内部,更换起点为线段与节点的交点 var anchorList = this.sourceNode.anchors; draggingPointList = this.getDraggingPoints(direction, 'start', startPosition, anchorList, draggingPointList); } } if (endIndex === this.pointsList.length - 1) { // 2.2)如果线段连接了终点, 判断起点是否在节点内部 var endPosition = { x: end.x, y: end.y + dragInfo.y }; var _inNode = isInNode(endPosition, this.targetNode); if (!_inNode) { // 如果不在节点内部,更换终点为线段与节点的交点 var _anchorList2 = this.targetNode.anchors; draggingPointList = this.getDraggingPoints(direction, 'end', endPosition, _anchorList2, draggingPointList); } } this.updatePointsAfterDrag(draggingPointList); // step3: 调整到对应外框的位置后,执行updatePointsAfterDrag,找到当前线段和图形的准确交点 this.draggingPointList = draggingPointList; } else if (direction === SegmentDirection.VERTICAL) { // 垂直,仅调整x坐标, 与水平调整同理 pointsList[startIndex] = { x: start.x + dragInfo.x, y: start.y }; pointsList[endIndex] = { x: end.x + dragInfo.x, y: end.y }; var _draggingPointList = this.pointsList.map(function (i) { return i; }); if (startIndex !== 0 && endIndex !== this.pointsList.length - 1) { _draggingPointList = this.removeCrossPoints(startIndex, endIndex, _draggingPointList); } if (startIndex === 0) { var _startPosition = { x: start.x + dragInfo.x, y: start.y }; var _inNode2 = isInNode(_startPosition, this.sourceNode); if (!_inNode2) { var _anchorList3 = this.sourceNode.anchors; _draggingPointList = this.getDraggingPoints(direction, 'start', _startPosition, _anchorList3, _draggingPointList); } } if (endIndex === this.pointsList.length - 1) { var _endPosition = { x: end.x + dragInfo.x, y: end.y }; var _inNode3 = isInNode(_endPosition, this.targetNode); if (!_inNode3) { var _anchorList4 = this.targetNode.anchors; _draggingPointList = this.getDraggingPoints(direction, 'end', _endPosition, _anchorList4, _draggingPointList); } } this.updatePointsAfterDrag(_draggingPointList); this.draggingPointList = _draggingPointList; } this.setText(Object.assign({}, this.text, this.textPosition)); return { start: Object.assign({}, pointsList[startIndex]), end: Object.assign({}, pointsList[endIndex]), startIndex: startIndex, endIndex: endIndex, direction: direction }; } }, { key: "dragAppendEnd", value: function dragAppendEnd() { if (this.draggingPointList) { var pointsList = pointFilter(points2PointsList(this.points)); // 更新pointsList,重新渲染appendWidth this.pointsList = pointsList.map(function (i) { return i; }); // draggingPointList清空 this.draggingPointList = []; // 更新起终点 var startPoint = pointsList[0]; this.startPoint = Object.assign({}, startPoint); var endPoint = pointsList[pointsList.length - 1]; this.endPoint = Object.assign({}, endPoint); } this.isDragging = false; } /* 拖拽之后个更新points,仅更新边,不更新pointsList, appendWidth会依赖pointsList,更新pointsList会重新渲染appendWidth,从而导致不能继续拖拽 在拖拽结束后再进行pointsList的更新 */ }, { key: "updatePointsAfterDrag", value: function updatePointsAfterDrag(pointsList) { // 找到准确的连接点后,更新points, 更新边,同时更新依赖points的箭头 var list = this.updateCrossPoints(pointsList); this.points = list.map(function (point) { return "".concat(point.x, ",").concat(point.y); }).join(' '); } // 获取边调整的起点 }, { key: "getAdjustStart", value: function getAdjustStart() { return this.pointsList[0] || this.startPoint; } // 获取边调整的终点 }, { key: "getAdjustEnd", value: function getAdjustEnd() { var pointsList = this.pointsList; return pointsList[pointsList.length - 1] || this.endPoint; } // 起终点拖拽调整过程中,进行折线路径更新 }, { key: "updateAfterAdjustStartAndEnd", value: function updateAfterAdjustStartAndEnd(_ref2) { var startPoint = _ref2.startPoint, endPoint = _ref2.endPoint, sourceNode = _ref2.sourceNode, targetNode = _ref2.targetNode; var pointsList = getPolylinePoints({ x: startPoint.x, y: startPoint.y }, { x: endPoint.x, y: endPoint.y }, sourceNode, targetNode, this.offset || 0); this.pointsList = pointsList; this.initPoints(); } }]); return PolylineEdgeModel; }(edge_BaseEdgeModel), (PolylineEdgeModel_descriptor = PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "dbClickPosition", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: null }), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "initPoints", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "initPoints"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updatePoints", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updatePoints"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updateStartPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updateStartPoint"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "moveStartPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "moveStartPoint"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updateEndPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updateEndPoint"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "moveEndPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "moveEndPoint"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "dragAppendStart", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "dragAppendStart"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "dragAppendSimple", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "dragAppendSimple"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "dragAppend", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "dragAppend"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "dragAppendEnd", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "dragAppendEnd"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updatePointsAfterDrag", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updatePointsAfterDrag"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "getAdjustStart", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "getAdjustStart"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "getAdjustEnd", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "getAdjustEnd"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updateAfterAdjustStartAndEnd", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updateAfterAdjustStartAndEnd"), PolylineEdgeModel_class.prototype)), PolylineEdgeModel_class); // CONCATENATED MODULE: ./src/algorithm/index.ts // 各类算法的实现 /* * 计算垂直边的与起始点有一定距离对称,边垂直于边的点 * 调用方:计算箭头位置,计算扩大变得点击区域 */ var getVerticalPointOfLine = function getVerticalPointOfLine(config) { /* ** offset: 端点到垂直点的距离 ** verticalLength: 两边点到垂直点的距离 ** type: 标识求的是线段的开始端点/结束端点 */ var start = config.start, end = config.end, offset = config.offset, verticalLength = config.verticalLength, type = config.type; var pointPosition = { leftX: 0, leftY: 0, rightX: 0, rightY: 0 }; // // 边与水平线的夹角 var angleOfHorizontal = Math.atan((end.y - start.y) / (end.x - start.x)); // 边和两边点的夹角 var angleOfPoints = Math.atan(offset / verticalLength); // 点到起点的距离 var len = Math.sqrt(verticalLength * verticalLength + offset * offset); if (type === 'start') { if (end.x >= start.x) { pointPosition.leftX = start.x + len * Math.sin(angleOfHorizontal + angleOfPoints); pointPosition.leftY = start.y - len * Math.cos(angleOfHorizontal + angleOfPoints); pointPosition.rightX = start.x - len * Math.sin(angleOfHorizontal - angleOfPoints); pointPosition.rightY = start.y + len * Math.cos(angleOfHorizontal - angleOfPoints); } else { pointPosition.leftX = start.x - len * Math.sin(angleOfHorizontal + angleOfPoints); pointPosition.leftY = start.y + len * Math.cos(angleOfHorizontal + angleOfPoints); pointPosition.rightX = start.x + len * Math.sin(angleOfHorizontal - angleOfPoints); pointPosition.rightY = start.y - len * Math.cos(angleOfHorizontal - angleOfPoints); } } else if (type === 'end') { if (end.x >= start.x) { pointPosition.leftX = end.x + len * Math.sin(angleOfHorizontal - angleOfPoints); pointPosition.leftY = end.y - len * Math.cos(angleOfHorizontal - angleOfPoints); pointPosition.rightX = end.x - len * Math.sin(angleOfHorizontal + angleOfPoints); pointPosition.rightY = end.y + len * Math.cos(angleOfHorizontal + angleOfPoints); } else { pointPosition.leftX = end.x - len * Math.sin(angleOfHorizontal - angleOfPoints); pointPosition.leftY = end.y + len * Math.cos(angleOfHorizontal - angleOfPoints); pointPosition.rightX = end.x + len * Math.sin(angleOfHorizontal + angleOfPoints); pointPosition.rightY = end.y - len * Math.cos(angleOfHorizontal + angleOfPoints); } } return pointPosition; }; // CONCATENATED MODULE: ./src/util/edge.ts function edge_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function edge_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { edge_ownKeys(Object(source), true).forEach(function (key) { edge_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { edge_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function edge_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || edge_unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return edge_arrayLikeToArray(arr); } function edge_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { edge_typeof = function _typeof(obj) { return typeof obj; }; } else { edge_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return edge_typeof(obj); } function edge_slicedToArray(arr, i) { return edge_arrayWithHoles(arr) || edge_iterableToArrayLimit(arr, i) || edge_unsupportedIterableToArray(arr, i) || edge_nonIterableRest(); } function edge_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function edge_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return edge_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return edge_arrayLikeToArray(o, minLen); } function edge_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function edge_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function edge_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /* 手动创建边时edge->edgeModel */ var edge_setupEdgeModel = function setupEdgeModel(edge, graphModel) { var model; switch (edge.type) { case 'line': model = new LineEdgeModel_LineEdgeModel(edge, graphModel); break; case 'polyline': model = new PolylineEdgeModel_PolylineEdgeModel(edge, graphModel); break; default: model = new LineEdgeModel_LineEdgeModel(edge, graphModel); break; } return model; }; /* 判断两个Bbox是否重合 */ var isBboxOverLapping = function isBboxOverLapping(b1, b2) { return Math.abs(b1.centerX - b2.centerX) * 2 < b1.width + b2.width && Math.abs(b1.centerY - b2.centerY) * 2 < b1.height + b2.height; }; /* 连接点去重,去掉x,y位置重复的点 */ var filterRepeatPoints = function filterRepeatPoints(points) { var result = []; var pointsMap = {}; points.forEach(function (p) { var id = "".concat(p.x, "-").concat(p.y); p.id = id; pointsMap[id] = p; }); Object.keys(pointsMap).forEach(function (p) { result.push(pointsMap[p]); }); return result; }; /* 获取简单边:边之间除了起始点,只有1个中间点 */ var getSimplePolyline = function getSimplePolyline(sPoint, tPoint) { var points = [sPoint, { x: sPoint.x, y: tPoint.y }, tPoint]; return filterRepeatPoints(points); }; /* 扩展的bbox,保证起始点的下一个点一定在node的垂直方向,不会与线重合, offset是点与线的垂直距离 */ var getExpandedBBox = function getExpandedBBox(bbox, offset) { if (bbox.width === 0 && bbox.height === 0) { return bbox; } return { centerX: bbox.centerX, centerY: bbox.centerY, minX: bbox.minX - offset, minY: bbox.minY - offset, maxX: bbox.maxX + offset, maxY: bbox.maxY + offset, height: bbox.height + 2 * offset, width: bbox.width + 2 * offset }; }; /* 判断点与中心点边的方向:是否水平,true水平,false垂直 */ var edge_pointDirection = function pointDirection(point, bbox) { var dx = Math.abs(point.x - bbox.centerX); var dy = Math.abs(point.y - bbox.centerY); return dx / bbox.width > dy / bbox.height ? SegmentDirection.HORIZONTAL : SegmentDirection.VERTICAL; }; /* 获取扩展图形上的点,即起始终点相邻的点,上一个或者下一个节点 */ var edge_getExpandedBBoxPoint = function getExpandedBBoxPoint(bbox, point) { var direction = edge_pointDirection(point, bbox); if (direction === SegmentDirection.HORIZONTAL) { return { x: point.x > bbox.centerX ? bbox.maxX : bbox.minX, y: point.y }; } return { x: point.x, y: point.y > bbox.centerY ? bbox.maxY : bbox.minY }; }; /* 获取包含2个图形的外层box */ var mergeBBox = function mergeBBox(b1, b2) { var minX = Math.min(b1.minX, b2.minX); var minY = Math.min(b1.minY, b2.minY); var maxX = Math.max(b1.maxX, b2.maxX); var maxY = Math.max(b1.maxY, b2.maxY); return { centerX: (minX + maxX) / 2, centerY: (minY + maxY) / 2, minX: minX, minY: minY, maxX: maxX, maxY: maxY, height: maxY - minY, width: maxX - minX }; }; /* 获取多个点的外层bbox * 这个函数的用处 * 1、获取起始终点相邻点(expendBboxPoint)的bbox * 2、polylineEdge, bezierEdge,获取outline边框,这种情况传入offset */ var getBBoxOfPoints = function getBBoxOfPoints() { var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var offset = arguments.length > 1 ? arguments[1] : undefined; var xList = []; var yList = []; points.forEach(function (p) { xList.push(p.x); yList.push(p.y); }); var minX = Math.min.apply(Math, xList); var maxX = Math.max.apply(Math, xList); var minY = Math.min.apply(Math, yList); var maxY = Math.max.apply(Math, yList); var width = maxX - minX; var height = maxY - minY; if (offset) { width += offset; height += offset; } return { centerX: (minX + maxX) / 2, centerY: (minY + maxY) / 2, maxX: maxX, maxY: maxY, minX: minX, minY: minY, x: (minX + maxX) / 2, y: (minY + maxY) / 2, height: height, width: width }; }; /* 获取box四个角上的点 */ var getPointsFromBBox = function getPointsFromBBox(bbox) { var minX = bbox.minX, minY = bbox.minY, maxX = bbox.maxX, maxY = bbox.maxY; return [{ x: minX, y: minY }, { x: maxX, y: minY }, { x: maxX, y: maxY }, { x: minX, y: maxY }]; }; /* 判断某一点是否在box中 */ var isPointOutsideBBox = function isPointOutsideBBox(point, bbox) { var x = point.x, y = point.y; return x < bbox.minX || x > bbox.maxX || y < bbox.minY || y > bbox.maxY; }; /* 获取点的x方向上与box的交点 */ var getBBoxXCrossPoints = function getBBoxXCrossPoints(bbox, x) { if (x < bbox.minX || x > bbox.maxX) { return []; } return [{ x: x, y: bbox.minY }, { x: x, y: bbox.maxY }]; }; /* 获取点的y方向上与box的交点 */ var getBBoxYCrossPoints = function getBBoxYCrossPoints(bbox, y) { if (y < bbox.minY || y > bbox.maxY) { return []; } return [{ x: bbox.minX, y: y }, { x: bbox.maxX, y: y }]; }; /* 获取点的x,y方向上与box的交点 */ var getBBoxCrossPointsByPoint = function getBBoxCrossPointsByPoint(bbox, point) { return getBBoxXCrossPoints(bbox, point.x).concat(getBBoxYCrossPoints(bbox, point.y)); }; /* 计算两点之间的预测距离(非直线距离) */ var estimateDistance = function estimateDistance(p1, p2) { return Math.abs(p1.x - p2.x) + Math.abs(p1.y - p2.y); }; /* 减少点别重复计算进距离的误差 */ var costByPoints = function costByPoints(p, points) { var offset = -2; var result = 0; points.forEach(function (point) { if (point) { if (p.x === point.x) { result += offset; } if (p.y === point.y) { result += offset; } } }); return result; }; /* 预估距离 */ var heuristicCostEstimate = function heuristicCostEstimate(p, ps, pt, source, target) { return estimateDistance(p, ps) + estimateDistance(p, pt) + costByPoints(p, [ps, pt, source, target]); }; /* 重建路径,根据cameFrom属性计算出从起始到结束的路径 */ var rebuildPath = function rebuildPath(pathPoints, pointById, cameFrom, currentId, iterator) { if (!iterator) { iterator = 0; } pathPoints.unshift(pointById[currentId]); if (cameFrom[currentId] && cameFrom[currentId] !== currentId && iterator <= 100) { rebuildPath(pathPoints, pointById, cameFrom, cameFrom[currentId], iterator + 1); } }; /* 把计算完毕的点从开放列表中删除 */ var removeClosePointFromOpenList = function removeClosePointFromOpenList(arr, item) { var index = arr.indexOf(item); if (index > -1) { arr.splice(index, 1); } }; /* 通过向量判断线段之间是否是相交的 */ var isSegmentsIntersected = function isSegmentsIntersected(p0, p1, p2, p3) { var s1x = p1.x - p0.x; var s1y = p1.y - p0.y; var s2x = p3.x - p2.x; var s2y = p3.y - p2.y; var s = (-s1y * (p0.x - p2.x) + s1x * (p0.y - p2.y)) / (-s2x * s1y + s1x * s2y); var t = (s2x * (p0.y - p2.y) - s2y * (p0.x - p2.x)) / (-s2x * s1y + s1x * s2y); return s >= 0 && s <= 1 && t >= 0 && t <= 1; }; /* 判断线段与bbox是否是相交的,保证节点之间的边不会穿过节点自身 */ var isSegmentCrossingBBox = function isSegmentCrossingBBox(p1, p2, bbox) { if (bbox.width === 0 && bbox.height === 0) { return false; } var _getPointsFromBBox = getPointsFromBBox(bbox), _getPointsFromBBox2 = edge_slicedToArray(_getPointsFromBBox, 4), pa = _getPointsFromBBox2[0], pb = _getPointsFromBBox2[1], pc = _getPointsFromBBox2[2], pd = _getPointsFromBBox2[3]; return isSegmentsIntersected(p1, p2, pa, pb) || isSegmentsIntersected(p1, p2, pa, pd) || isSegmentsIntersected(p1, p2, pb, pc) || isSegmentsIntersected(p1, p2, pc, pd); }; /* 获取下一个相邻的点 */ var getNextNeighborPoints = function getNextNeighborPoints(points, point, bbox1, bbox2) { var neighbors = []; points.forEach(function (p) { if (p !== point) { if (p.x === point.x || p.y === point.y) { if (!isSegmentCrossingBBox(p, point, bbox1) && !isSegmentCrossingBBox(p, point, bbox2)) { neighbors.push(p); } } } }); return filterRepeatPoints(neighbors); }; /* 路径查找,Astart查找+曼哈顿距离 * 算法wiki:https://zh.wikipedia.org/wiki/A*%E6%90%9C%E5%B0%8B%E6%BC%94%E7%AE%97%E6%B3%95 * 方法无法复用,且调用了很多polyline相关的方法,暂不抽离到src/algorithm中 */ var pathFinder = function pathFinder(points, start, goal, sBBox, tBBox, os, ot) { // 定义已经遍历过的点 var closedSet = []; // 定义需要遍历的店 var openSet = [start]; // 定义节点的上一个节点 var cameFrom = {}; var gScore = {}; var fScore = {}; gScore[start.id] = 0; fScore[start.id] = heuristicCostEstimate(start, goal, start); var pointById = {}; points.forEach(function (p) { pointById[p.id] = p; }); var _loop = function _loop() { var current = void 0; var lowestFScore = Infinity; openSet.forEach(function (p) { if (fScore[p.id] < lowestFScore) { lowestFScore = fScore[p.id]; current = p; } }); if (current === goal) { var pathPoints = []; rebuildPath(pathPoints, pointById, cameFrom, goal.id); return { v: pathPoints }; } removeClosePointFromOpenList(openSet, current); closedSet.push(current); getNextNeighborPoints(points, current, sBBox, tBBox).forEach(function (neighbor) { if (closedSet.indexOf(neighbor) !== -1) { return; } if (openSet.indexOf(neighbor) === -1) { openSet.push(neighbor); } var tentativeGScore = fScore[current.id] + estimateDistance(current, neighbor); if (gScore[neighbor.id] && tentativeGScore >= gScore[neighbor.id]) { return; } cameFrom[neighbor.id] = current.id; gScore[neighbor.id] = tentativeGScore; fScore[neighbor.id] = gScore[neighbor.id] + heuristicCostEstimate(neighbor, goal, start, os, ot); }); }; while (openSet.length) { var _ret = _loop(); if (edge_typeof(_ret) === "object") return _ret.v; } return [start, goal]; }; var edge_getBoxByOriginNode = function getBoxByOriginNode(node) { var bbox = getNodeBBox(node); return bbox; }; /* 保证一条直线上只有2个节点: 删除x/y相同的中间节点 */ var pointFilter = function pointFilter(points) { var i = 1; while (i < points.length - 1) { var pre = points[i - 1]; var current = points[i]; var next = points[i + 1]; if (pre.x === current.x && current.x === next.x || pre.y === current.y && current.y === next.y) { points.splice(i, 1); } else { i++; } } return points; }; /* 计算折线点 */ var getPolylinePoints = function getPolylinePoints(start, end, sNode, tNode, offset) { var sBBox = edge_getBoxByOriginNode(sNode); var tBBox = edge_getBoxByOriginNode(tNode); var sxBBox = getExpandedBBox(sBBox, offset); var txBBox = getExpandedBBox(tBBox, offset); var sPoint = edge_getExpandedBBoxPoint(sxBBox, start); var tPoint = edge_getExpandedBBoxPoint(txBBox, end); // 当加上offset后的bbox有重合,直接简单计算节点 if (isBboxOverLapping(sxBBox, txBBox)) { var points = edge_getSimplePoints(start, end, sPoint, tPoint); return [start, sPoint].concat(_toConsumableArray(points), [tPoint, end]); } var lineBBox = getBBoxOfPoints([sPoint, tPoint]); var sMixBBox = mergeBBox(sxBBox, lineBBox); var tMixBBox = mergeBBox(txBBox, lineBBox); var connectPoints = []; connectPoints = connectPoints.concat(getPointsFromBBox(sMixBBox)); connectPoints = connectPoints.concat(getPointsFromBBox(tMixBBox)); // 中心点 var centerPoint = { x: (start.x + end.x) / 2, y: (start.y + end.y) / 2 }; // 获取中心点与其他box的交点 [lineBBox, sMixBBox, tMixBBox].forEach(function (bbox) { connectPoints = connectPoints.concat(getBBoxCrossPointsByPoint(bbox, centerPoint).filter(function (p) { return isPointOutsideBBox(p, sxBBox) && isPointOutsideBBox(p, txBBox); })); }); // 与起止终点相邻的两的,在x,y方向上的交点,这四个点组成了矩形 。。。解释图中在不中这两个点, [{ x: sPoint.x, y: tPoint.y }, { x: tPoint.x, y: sPoint.y }].forEach(function (p) { if (isPointOutsideBBox(p, sxBBox) && isPointOutsideBBox(p, txBBox)) { connectPoints.push(p); } }); connectPoints.unshift(sPoint); connectPoints.push(tPoint); connectPoints = filterRepeatPoints(connectPoints); // 路径查找-最关键的步骤 var pathPoints = pathFinder(connectPoints, sPoint, tPoint, sBBox, tBBox, start, end); pathPoints.unshift(start); pathPoints.push(end); // 删除一条直线上的多余节点 if (pathPoints.length > 2) { pathPoints = pointFilter(pathPoints); } return filterRepeatPoints(pathPoints); }; /** * 获取折线中最长的一个线 * @param pointsList 多个点组成的数组 */ var edge_getLongestEdge = function getLongestEdge(pointsList) { var points; if (pointsList.length === 1) { points = [pointsList[0], pointsList[0]]; } else if (pointsList.length >= 2) { var point1 = pointsList[0]; var point2 = pointsList[1]; var edgeLength = node_distance(point1.x, point1.y, point2.x, point2.y); for (var i = 1; i < pointsList.length - 1; i++) { var newPoint1 = pointsList[i]; var newPoint2 = pointsList[i + 1]; var newEdgeLength = node_distance(newPoint1.x, newPoint1.y, newPoint2.x, newPoint2.y); if (newEdgeLength > edgeLength) { edgeLength = newEdgeLength; point1 = newPoint1; point2 = newPoint2; } } points = [point1, point2]; } return points; }; /* 线段是否在节点内部, 被包含了 */ var edge_isSegmentsInNode = function isSegmentsInNode(start, end, node) { var startInNode = isInNode(start, node); var endInNode = isInNode(end, node); return startInNode && endInNode; }; /* 线段是否与节点相交 */ var edge_isSegmentsCrossNode = function isSegmentsCrossNode(start, end, node) { var startInNode = isInNode(start, node); var endInNode = isInNode(end, node); // bothInNode,线段两个端点都在节点内 var bothInNode = startInNode && endInNode; // cross,线段有端点在节点内 var inNode = startInNode || endInNode; // 有且只有一个点在节点内部 return !bothInNode && inNode; }; /* 获取线段在矩形内部的交点 */ var edge_getCrossPointInRect = function getCrossPointInRect(start, end, node) { var point; var crossSegments; var nodeBox = getNodeBBox(node); var points = getPointsFromBBox(nodeBox); for (var i = 0; i < points.length; i++) { var isCross = isSegmentsIntersected(start, end, points[i], points[(i + 1) % points.length]); if (isCross) { crossSegments = [points[i], points[(i + 1) % points.length]]; } } if (crossSegments) { point = getCrossPointOfLine(start, end, crossSegments[0], crossSegments[1]); } return point; }; /* 判断线段的方向 */ var edge_segmentDirection = function segmentDirection(start, end) { var direction; if (start.x === end.x) { direction = SegmentDirection.VERTICAL; } else if (start.y === end.y) { direction = SegmentDirection.HORIZONTAL; } return direction; }; var points2PointsList = function points2PointsList(points) { var currentPositionList = points.split(' '); var pointsList = []; currentPositionList && currentPositionList.forEach(function (item) { var _item$split = item.split(','), _item$split2 = edge_slicedToArray(_item$split, 2), x = _item$split2[0], y = _item$split2[1]; pointsList.push({ x: Number(x), y: Number(y) }); }); return pointsList; }; var edge_getSimplePoints = function getSimplePoints(start, end, sPoint, tPoint) { var points = []; // start,sPoint的方向,水平或者垂直,即路径第一条线段的方向 var startDirection = edge_segmentDirection(start, sPoint); // end,tPoint的方向,水平或者垂直,即路径最后一条条线段的方向 var endDirection = edge_segmentDirection(end, tPoint); // 根据两条线段的方向作了计算,调整线段经验所得,非严格最优计算,能保证不出现折线 // 方向相同,添加两个点,两条平行线垂直距离一半的两个端点 if (startDirection === endDirection) { if (start.y === sPoint.y) { points.push({ x: sPoint.x, y: (sPoint.y + tPoint.y) / 2 }); points.push({ x: tPoint.x, y: (sPoint.y + tPoint.y) / 2 }); } else { points.push({ x: (sPoint.x + tPoint.x) / 2, y: sPoint.y }); points.push({ x: (sPoint.x + tPoint.x) / 2, y: tPoint.y }); } } else { // 方向不同,添加一个点,保证不在当前线段上(会出现重合),且不能有折线 var point = { x: sPoint.x, y: tPoint.y }; var inStart = isInSegment(point, start, sPoint); var inEnd = isInSegment(point, end, tPoint); if (inStart || inEnd) { point = { x: tPoint.x, y: sPoint.y }; } else { var onStart = isOnLine(point, start, sPoint); var onEnd = isOnLine(point, end, tPoint); if (onStart && onEnd) { point = { x: tPoint.x, y: sPoint.y }; } } points.push(point); } return points; }; var isOnLine = function isOnLine(point, start, end) { return point.x === start.x && point.x === end.x || point.y === start.y && point.y === end.y; }; /* 求字符串的字节长度 */ var getBytesLength = function getBytesLength(word) { if (!word) { return 0; } var totalLength = 0; for (var i = 0; i < word.length; i++) { var c = word.charCodeAt(i); if (word.match(/[A-Z]/)) { totalLength += 1.5; } else if (c >= 0x0001 && c <= 0x007e || c >= 0xff60 && c <= 0xff9f) { totalLength += 1; } else { totalLength += 2; } } return totalLength; }; /** * Uses canvas.measureText to compute * and return the width of the given text of given font in pixels. * @param {String} text The text to be rendered. * @param {String} font The css font descriptor * that text is to be rendered with (e.g. "bold 14px verdana"). * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393 */ var canvas = null; var getTextWidth = function getTextWidth(text, font) { if (!canvas) { canvas = document.createElement('canvas'); } var context = canvas.getContext('2d'); context.font = font; var metrics = context.measureText(text); return metrics.width; }; // 扩大边可点区域,获取边append的信息 var edge_getAppendAttributes = function getAppendAttributes(appendInfo) { var start = appendInfo.start, end = appendInfo.end; var d; if (start.x === end.x && start.y === end.y) { // 拖拽过程中会出现起终点重合的情况,这时候append无法计算 d = ''; } else { var config = { start: start, end: end, offset: 10, verticalLength: 5 }; var startPosition = getVerticalPointOfLine(edge_objectSpread(edge_objectSpread({}, config), {}, { type: 'start' })); var endPosition = getVerticalPointOfLine(edge_objectSpread(edge_objectSpread({}, config), {}, { type: 'end' })); d = "M".concat(startPosition.leftX, " ").concat(startPosition.leftY, " \n L").concat(startPosition.rightX, " ").concat(startPosition.rightY, " \n L").concat(endPosition.rightX, " ").concat(endPosition.rightY, "\n L").concat(endPosition.leftX, " ").concat(endPosition.leftY, " z"); } return { d: d, fill: 'transparent', stroke: 'transparent', strokeWidth: 1, strokeDasharray: '4, 4' }; }; // bezier曲线 var edge_getBezierControlPoints = function getBezierControlPoints(_ref) { var start = _ref.start, end = _ref.end, sourceNode = _ref.sourceNode, targetNode = _ref.targetNode, offset = _ref.offset; var sBBox = getNodeBBox(sourceNode); var tBBox = getNodeBBox(targetNode); var sExpendBBox = getExpandedBBox(sBBox, offset); var tExpendBBox = getExpandedBBox(tBBox, offset); var sNext = edge_getExpandedBBoxPoint(sExpendBBox, start); var ePre = edge_getExpandedBBoxPoint(tExpendBBox, end); return { sNext: sNext, ePre: ePre }; }; // 根据bezier曲线path求出Points var getBezierPoints = function getBezierPoints(path) { var list = path.replace(/M/g, '').replace(/C/g, ',').split(','); var start = getBezierPoint(list[0]); var sNext = getBezierPoint(list[1]); var ePre = getBezierPoint(list[2]); var end = getBezierPoint(list[3]); return [start, sNext, ePre, end]; }; // 根据bezier曲线path求出Point坐标 var getBezierPoint = function getBezierPoint(positionStr) { var _positionStr$replace$ = positionStr.replace(/(^\s*)/g, '').split(' '), _positionStr$replace$2 = edge_slicedToArray(_positionStr$replace$, 2), x = _positionStr$replace$2[0], y = _positionStr$replace$2[1]; return { x: +x, y: +y }; }; // 根据bezier曲线path求出结束切线的两点坐标 var getEndTangent = function getEndTangent(path) { var bezierPoints = getBezierPoints(path); return [bezierPoints[2], bezierPoints[3]]; }; /** * 获取移动边后,文本位置距离边上的最近的一点 * @param point 边上文本的位置 * @param points 边的各个拐点 */ var edge_getClosestPointOfPolyline = function getClosestPointOfPolyline(point, points) { var x = point.x, y = point.y; var pointsPosition = points2PointsList(points); var minDistance = Number.MAX_SAFE_INTEGER; var crossPoint; var segments = []; for (var i = 0; i < pointsPosition.length; i++) { segments.push({ start: pointsPosition[i], end: pointsPosition[(i + 1) % pointsPosition.length] }); } segments.forEach(function (item) { var start = item.start, end = item.end; // 若线段垂直,则crossPoint的横坐标与线段一致 if (start.x === end.x) { var pointXY = { x: start.x, y: y }; var inSegment = isInSegment(pointXY, start, end); if (inSegment) { var currentDistance = Math.abs(start.x - x); if (currentDistance < minDistance) { minDistance = currentDistance; crossPoint = pointXY; } } } else if (start.y === end.y) { var _pointXY = { x: x, y: start.y }; var _inSegment = isInSegment(_pointXY, start, end); if (_inSegment) { var _currentDistance = Math.abs(start.y - y); if (_currentDistance < minDistance) { minDistance = _currentDistance; crossPoint = _pointXY; } } } }); // 边界:只有一条线段时,沿线段移动节点,当文本超出边后,文本没有可供参考的线段 if (!crossPoint) { var _segments$ = segments[0], start = _segments$.start, end = _segments$.end; crossPoint = { x: start.x + (end.x - start.x) / 2, y: start.y + (end.y - start.y) / 2 }; } return crossPoint; }; // 规范边初始化数据 var edge_pickEdgeConfig = function pickEdgeConfig(data) { return lodash_es_pick(data, ['id', 'type', 'sourceNodeId', 'sourceAnchorId', 'targetNodeId', 'targetAnchorId', 'pointsList', 'startPoint', 'endPoint', 'properties']); }; // eslint-disable-next-line arrow-body-style var twoPointDistance = function twoPointDistance(source, target) { // fix: 修复坐标存在负值时计算错误的问题。 // const source = { // x: p1.x, // y: Math.abs(p1.y), // }; // const target = { // x: Math.abs(p2.x), // y: Math.abs(p2.y), // }; return Math.sqrt(Math.pow(source.x - target.x, 2) + Math.pow(source.y - target.y, 2)); }; /** * 包装边生成函数 * @param graphModel graph model * @param generator 用户自定义的边生成函数 */ function createEdgeGenerator(graphModel, generator) { if (typeof generator !== 'function') { return function (sourceNode, targetNode, currentEdge) { return Object.assign({ type: graphModel.edgeType }, currentEdge); }; } return function (sourceNode, targetNode, currentEdge) { var result = generator(sourceNode, targetNode, currentEdge); // 无结果使用默认类型 if (!result) return { type: graphModel.edgeType }; if (typeof result === 'string') { return Object.assign({}, currentEdge, { type: result }); } return Object.assign({ type: result }, currentEdge); }; } // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.promise.js var es_promise = __webpack_require__(204); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/noop.js /** * This method returns `undefined`. * * @static * @memberOf _ * @since 2.3.0 * @category Util * @example * * _.times(2, _.noop); * // => [undefined, undefined] */ function noop() { // No operation performed. } /* harmony default export */ var lodash_es_noop = (noop); // CONCATENATED MODULE: ./src/util/drag.ts function drag_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function drag_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function drag_createClass(Constructor, protoProps, staticProps) { if (protoProps) drag_defineProperties(Constructor.prototype, protoProps); if (staticProps) drag_defineProperties(Constructor, staticProps); return Constructor; } function drag_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // import { snapToGrid } from './geometry'; var DOC = window.document; var LEFT_MOUSE_BUTTON_CODE = 0; function createDrag(_ref) { var _ref$onDragStart = _ref.onDragStart, onDragStart = _ref$onDragStart === void 0 ? lodash_es_noop : _ref$onDragStart, _ref$onDragging = _ref.onDragging, onDragging = _ref$onDragging === void 0 ? lodash_es_noop : _ref$onDragging, _ref$onDragEnd = _ref.onDragEnd, onDragEnd = _ref$onDragEnd === void 0 ? lodash_es_noop : _ref$onDragEnd, _ref$step = _ref.step, step = _ref$step === void 0 ? 1 : _ref$step, _ref$isStopPropagatio = _ref.isStopPropagation, isStopPropagation = _ref$isStopPropagatio === void 0 ? true : _ref$isStopPropagatio; var isDragging = false; var isStartDragging = false; var startX = 0; var startY = 0; var sumDeltaX = 0; var sumDeltaY = 0; function handleMouseMove(e) { if (isStopPropagation) e.stopPropagation(); if (!isStartDragging) return; isDragging = true; sumDeltaX += e.clientX - startX; sumDeltaY += e.clientY - startY; startX = e.clientX; startY = e.clientY; if (Math.abs(sumDeltaX) > step || Math.abs(sumDeltaY) > step) { var remainderX = sumDeltaX % step; var remainderY = sumDeltaY % step; var deltaX = sumDeltaX - remainderX; var deltaY = sumDeltaY - remainderY; sumDeltaX = remainderX; sumDeltaY = remainderY; onDragging({ deltaX: deltaX, deltaY: deltaY, event: e }); } } function handleMouseUp(e) { if (isStopPropagation) e.stopPropagation(); isStartDragging = false; DOC.removeEventListener('mousemove', handleMouseMove, false); DOC.removeEventListener('mouseup', handleMouseUp, false); if (!isDragging) return; isDragging = false; return onDragEnd({ event: e }); } function handleMouseDown(e) { if (e.button !== LEFT_MOUSE_BUTTON_CODE) return; if (isStopPropagation) e.stopPropagation(); isStartDragging = true; startX = e.clientX; startY = e.clientY; DOC.addEventListener('mousemove', handleMouseMove, false); DOC.addEventListener('mouseup', handleMouseUp, false); return onDragStart({ event: e }); } return handleMouseDown; } // 支持拖拽的时候,按照指定step进行。 // 因为在绘制的过程中因为放大缩小,移动的真实的step则是变化的。 var drag_StepDrag = /*#__PURE__*/function () { function StepDrag(_ref2) { var _this = this; var _ref2$onDragStart = _ref2.onDragStart, onDragStart = _ref2$onDragStart === void 0 ? lodash_es_noop : _ref2$onDragStart, _ref2$onDragging = _ref2.onDragging, onDragging = _ref2$onDragging === void 0 ? lodash_es_noop : _ref2$onDragging, _ref2$onDragEnd = _ref2.onDragEnd, onDragEnd = _ref2$onDragEnd === void 0 ? lodash_es_noop : _ref2$onDragEnd, _ref2$eventType = _ref2.eventType, eventType = _ref2$eventType === void 0 ? '' : _ref2$eventType, _ref2$eventCenter = _ref2.eventCenter, eventCenter = _ref2$eventCenter === void 0 ? null : _ref2$eventCenter, _ref2$step = _ref2.step, step = _ref2$step === void 0 ? 1 : _ref2$step, _ref2$isStopPropagati = _ref2.isStopPropagation, isStopPropagation = _ref2$isStopPropagati === void 0 ? true : _ref2$isStopPropagati, _ref2$model = _ref2.model, model = _ref2$model === void 0 ? null : _ref2$model, _ref2$data = _ref2.data, data = _ref2$data === void 0 ? null : _ref2$data; drag_classCallCheck(this, StepDrag); drag_defineProperty(this, "onDragStart", void 0); drag_defineProperty(this, "onDragging", void 0); drag_defineProperty(this, "onDragEnd", void 0); drag_defineProperty(this, "step", void 0); drag_defineProperty(this, "isStopPropagation", void 0); drag_defineProperty(this, "isDragging", false); drag_defineProperty(this, "isStartDragging", false); drag_defineProperty(this, "startX", 0); drag_defineProperty(this, "startY", 0); drag_defineProperty(this, "sumDeltaX", 0); drag_defineProperty(this, "sumDeltaY", 0); drag_defineProperty(this, "eventType", void 0); drag_defineProperty(this, "eventCenter", void 0); drag_defineProperty(this, "model", void 0); drag_defineProperty(this, "data", void 0); drag_defineProperty(this, "startTime", void 0); drag_defineProperty(this, "handleMouseDown", function (e) { var _this$model, _this$eventCenter; if (e.button !== LEFT_MOUSE_BUTTON_CODE) return; if (_this.isStopPropagation) e.stopPropagation(); _this.isStartDragging = true; _this.startX = e.clientX; _this.startY = e.clientY; DOC.addEventListener('mousemove', _this.handleMouseMove, false); DOC.addEventListener('mouseup', _this.handleMouseUp, false); var elementData = (_this$model = _this.model) === null || _this$model === void 0 ? void 0 : _this$model.getData(); (_this$eventCenter = _this.eventCenter) === null || _this$eventCenter === void 0 ? void 0 : _this$eventCenter.emit(EventType["".concat(_this.eventType, "_MOUSEDOWN")], { e: e, data: _this.data || elementData }); _this.startTime = new Date().getTime(); }); drag_defineProperty(this, "handleMouseMove", function (e) { if (_this.isStopPropagation) e.stopPropagation(); if (!_this.isStartDragging) return; _this.sumDeltaX += e.clientX - _this.startX; _this.sumDeltaY += e.clientY - _this.startY; _this.startX = e.clientX; _this.startY = e.clientY; if (_this.step <= 1 || Math.abs(_this.sumDeltaX) > _this.step || Math.abs(_this.sumDeltaY) > _this.step) { var _this$model2; var remainderX = _this.sumDeltaX % _this.step; var remainderY = _this.sumDeltaY % _this.step; var deltaX = _this.sumDeltaX - remainderX; var deltaY = _this.sumDeltaY - remainderY; _this.sumDeltaX = remainderX; _this.sumDeltaY = remainderY; var elementData = (_this$model2 = _this.model) === null || _this$model2 === void 0 ? void 0 : _this$model2.getData(); /** * 为了区分点击和拖动,在鼠标没有拖动时,不触发dragstart。 */ if (!_this.isDragging) { var _this$eventCenter2; (_this$eventCenter2 = _this.eventCenter) === null || _this$eventCenter2 === void 0 ? void 0 : _this$eventCenter2.emit(EventType["".concat(_this.eventType, "_DRAGSTART")], { e: e, data: _this.data || elementData }); _this.onDragStart({ event: e }); } _this.isDragging = true; // 为了让dragstart和drag不在同一个事件循环中,使drag事件放到下一个消息队列中。 Promise.resolve().then(function () { var _this$eventCenter3, _this$eventCenter4; _this.onDragging({ deltaX: deltaX, deltaY: deltaY, event: e }); (_this$eventCenter3 = _this.eventCenter) === null || _this$eventCenter3 === void 0 ? void 0 : _this$eventCenter3.emit(EventType["".concat(_this.eventType, "_MOUSEMOVE")], { e: e, data: _this.data || elementData }); (_this$eventCenter4 = _this.eventCenter) === null || _this$eventCenter4 === void 0 ? void 0 : _this$eventCenter4.emit(EventType["".concat(_this.eventType, "_DRAG")], { e: e, data: _this.data || elementData }); }); } }); drag_defineProperty(this, "handleMouseUp", function (e) { _this.isStartDragging = false; if (_this.isStopPropagation) e.stopPropagation(); // fix #568: 如果onDragging在下一个事件循环中触发,而drop在当前事件循环,会出现问题。 Promise.resolve().then(function () { var _this$model3, _this$eventCenter5, _this$eventCenter6; DOC.removeEventListener('mousemove', _this.handleMouseMove, false); DOC.removeEventListener('mouseup', _this.handleMouseUp, false); var elementData = (_this$model3 = _this.model) === null || _this$model3 === void 0 ? void 0 : _this$model3.getData(); (_this$eventCenter5 = _this.eventCenter) === null || _this$eventCenter5 === void 0 ? void 0 : _this$eventCenter5.emit(EventType["".concat(_this.eventType, "_MOUSEUP")], { e: e, data: _this.data || elementData }); if (!_this.isDragging) return; _this.isDragging = false; _this.onDragEnd({ event: e }); (_this$eventCenter6 = _this.eventCenter) === null || _this$eventCenter6 === void 0 ? void 0 : _this$eventCenter6.emit(EventType["".concat(_this.eventType, "_DROP")], { e: e, data: _this.data || elementData }); }); }); drag_defineProperty(this, "cancelDrag", function () { DOC.removeEventListener('mousemove', _this.handleMouseMove, false); DOC.removeEventListener('mouseup', _this.handleMouseUp, false); _this.onDragEnd({ event: null }); _this.isDragging = false; }); this.onDragStart = onDragStart; this.onDragging = onDragging; this.onDragEnd = onDragEnd; this.step = step; this.isStopPropagation = isStopPropagation; this.eventType = eventType; this.eventCenter = eventCenter; this.model = model; this.data = data; } drag_createClass(StepDrag, [{ key: "setStep", value: function setStep(step) { this.step = step; } }]); return StepDrag; }(); // CONCATENATED MODULE: ./src/util/index.ts // CONCATENATED MODULE: ./src/constant/DefaultAnimation.ts // 不填或者false返回的配置,表示不开启所有动画 var defaultAnimationCloseConfig = { node: false, edge: false }; // 仅使用true的时候返回的配置,表示开启所有动画 var defaultAnimationOpenConfig = { node: true, edge: true }; var defaultAnimationData = { stroke: 'red', strokeDasharray: '10 200', className: 'lf-edge-animation' }; // CONCATENATED MODULE: ./src/util/animation.ts var animation_updateAnimation = function updateAnimation(config) { if (!config || typeof config === 'boolean') { // 不转类型 return config === true ? lodash_es_cloneDeep(defaultAnimationOpenConfig) : lodash_es_cloneDeep(defaultAnimationCloseConfig); } // 传入的是对象AnimationConfig return lodash_es_merge(lodash_es_cloneDeep(defaultAnimationCloseConfig), config); }; // CONCATENATED MODULE: ./src/model/GraphModel.ts var GraphModel_class, GraphModel_descriptor, GraphModel_descriptor2, GraphModel_descriptor3, GraphModel_descriptor4, GraphModel_descriptor5, GraphModel_descriptor6, GraphModel_descriptor7, GraphModel_descriptor8, GraphModel_descriptor9, GraphModel_descriptor10, GraphModel_descriptor11, GraphModel_descriptor12; function GraphModel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function GraphModel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { GraphModel_ownKeys(Object(source), true).forEach(function (key) { GraphModel_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { GraphModel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function GraphModel_slicedToArray(arr, i) { return GraphModel_arrayWithHoles(arr) || GraphModel_iterableToArrayLimit(arr, i) || GraphModel_unsupportedIterableToArray(arr, i) || GraphModel_nonIterableRest(); } function GraphModel_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function GraphModel_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function GraphModel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function GraphModel_toConsumableArray(arr) { return GraphModel_arrayWithoutHoles(arr) || GraphModel_iterableToArray(arr) || GraphModel_unsupportedIterableToArray(arr) || GraphModel_nonIterableSpread(); } function GraphModel_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function GraphModel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return GraphModel_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return GraphModel_arrayLikeToArray(o, minLen); } function GraphModel_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function GraphModel_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return GraphModel_arrayLikeToArray(arr); } function GraphModel_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function GraphModel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { GraphModel_typeof = function _typeof(obj) { return typeof obj; }; } else { GraphModel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return GraphModel_typeof(obj); } function GraphModel_initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function GraphModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function GraphModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function GraphModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) GraphModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) GraphModel_defineProperties(Constructor, staticProps); return Constructor; } function GraphModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function GraphModel_applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function GraphModel_initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } var VisibleMoreSpace = 200; var GraphModel_GraphModel = (GraphModel_class = /*#__PURE__*/function () { // 允许在groupModel上扩展属性 function GraphModel(options) { GraphModel_classCallCheck(this, GraphModel); GraphModel_defineProperty(this, "rootEl", void 0); GraphModel_initializerDefineProperty(this, "width", GraphModel_descriptor, this); GraphModel_initializerDefineProperty(this, "height", GraphModel_descriptor2, this); GraphModel_defineProperty(this, "theme", void 0); GraphModel_defineProperty(this, "eventCenter", void 0); GraphModel_defineProperty(this, "modelMap", new Map()); GraphModel_defineProperty(this, "topElement", void 0); GraphModel_defineProperty(this, "animation", void 0); GraphModel_defineProperty(this, "idGenerator", void 0); GraphModel_defineProperty(this, "edgeGenerator", void 0); GraphModel_defineProperty(this, "nodeMoveRules", []); GraphModel_initializerDefineProperty(this, "edgeType", GraphModel_descriptor3, this); GraphModel_initializerDefineProperty(this, "nodes", GraphModel_descriptor4, this); GraphModel_initializerDefineProperty(this, "edges", GraphModel_descriptor5, this); GraphModel_initializerDefineProperty(this, "overlapMode", GraphModel_descriptor6, this); GraphModel_initializerDefineProperty(this, "background", GraphModel_descriptor7, this); GraphModel_initializerDefineProperty(this, "transformModel", GraphModel_descriptor8, this); GraphModel_initializerDefineProperty(this, "editConfigModel", GraphModel_descriptor9, this); GraphModel_initializerDefineProperty(this, "gridSize", GraphModel_descriptor10, this); GraphModel_initializerDefineProperty(this, "partial", GraphModel_descriptor11, this); GraphModel_initializerDefineProperty(this, "fakerNode", GraphModel_descriptor12, this); var container = options.container, _options$background = options.background, background = _options$background === void 0 ? {} : _options$background, grid = options.grid, idGenerator = options.idGenerator, edgeGenerator = options.edgeGenerator, animation = options.animation; this.background = background; if (GraphModel_typeof(grid) === 'object') { this.gridSize = grid.size; } this.rootEl = container; this.editConfigModel = new EditConfigModel_EditConfigModel(options); this.eventCenter = new EventEmitter(); this.transformModel = new TransformModel_TransformModel(this.eventCenter); this.theme = theme_updateTheme(options.style); this.edgeType = options.edgeType || 'polyline'; this.width = options.width; this.height = options.height; this.animation = animation_updateAnimation(animation); this.partial = options.partial; this.overlapMode = options.overlapMode || 0; this.idGenerator = idGenerator; this.edgeGenerator = createEdgeGenerator(this, edgeGenerator); this.width = options.width || this.rootEl.getBoundingClientRect().width; this.height = options.height || this.rootEl.getBoundingClientRect().height; this.flowId = uuid_createUuid(); } GraphModel_createClass(GraphModel, [{ key: "nodesMap", get: function get() { return this.nodes.reduce(function (nMap, model, index) { nMap[model.id] = { index: index, model: model }; return nMap; }, {}); } }, { key: "edgesMap", get: function get() { return this.edges.reduce(function (eMap, model, index) { eMap[model.id] = { index: index, model: model }; return eMap; }, {}); } }, { key: "modelsMap", get: function get() { return [].concat(GraphModel_toConsumableArray(this.nodes), GraphModel_toConsumableArray(this.edges)).reduce(function (eMap, model) { eMap[model.id] = model; return eMap; }, {}); } /** * 基于zIndex对元素进行排序。 * todo: 性能优化 */ }, { key: "sortElements", get: function get() { var elements = []; this.nodes.forEach(function (node) { return elements.push(node); }); this.edges.forEach(function (edge) { return elements.push(edge); }); elements = elements.sort(function (a, b) { return a.zIndex - b.zIndex; }); // 只显示可见区域的节点和边 var showElements = []; // todo: 缓存, 优化计算效率 var visibleLt = [-VisibleMoreSpace, -VisibleMoreSpace]; var visibleRb = [this.width + VisibleMoreSpace, this.height + VisibleMoreSpace]; for (var i = 0; i < elements.length; i++) { var currentItem = elements[i]; // 如果节点不在可见区域,且不是全元素显示模式,则隐藏节点。 if (currentItem.visible && (!this.partial || currentItem.isSelected || this.isElementInArea(currentItem, visibleLt, visibleRb, false, false))) { showElements.push(currentItem); } } return showElements; } /** * 当前编辑的元素,低频操作,先循环找。 */ }, { key: "textEditElement", get: function get() { var textEditNode = this.nodes.find(function (node) { return node.state === ElementState.TEXT_EDIT; }); var textEditEdge = this.edges.find(function (edge) { return edge.state === ElementState.TEXT_EDIT; }); return textEditNode || textEditEdge; } /** * 当前画布所有被选中的元素 */ }, { key: "selectElements", get: function get() { var elements = new Map(); this.nodes.forEach(function (node) { if (node.isSelected) { elements.set(node.id, node); } }); this.edges.forEach(function (edge) { if (edge.isSelected) { elements.set(edge.id, edge); } }); return elements; } /** * 获取指定区域内的所有元素 * @param leftTopPoint 表示区域左上角的点 * @param rightBottomPoint 表示区域右下角的点 * @param wholeEdge 是否要整个边都在区域内部 * @param wholeNode 是否要整个节点都在区域内部 * @param ignoreHideElement 是否忽略隐藏的节点 */ }, { key: "getAreaElement", value: function getAreaElement(leftTopPoint, rightBottomPoint) { var wholeEdge = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; var wholeNode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; var ignoreHideElement = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; var areaElements = []; var elements = []; this.nodes.forEach(function (node) { return elements.push(node); }); this.edges.forEach(function (edge) { return elements.push(edge); }); for (var i = 0; i < elements.length; i++) { var currentItem = elements[i]; if ((!ignoreHideElement || currentItem.visible) && this.isElementInArea(currentItem, leftTopPoint, rightBottomPoint, wholeEdge, wholeNode)) { areaElements.push(currentItem); } } return areaElements; } /** * 获取指定类型元素对应的Model */ }, { key: "getModel", value: function getModel(type) { return this.modelMap.get(type); } /** * 基于Id获取节点的model */ }, { key: "getNodeModelById", value: function getNodeModelById(nodeId) { var _this$nodesMap$nodeId; if (this.fakerNode && nodeId === this.fakerNode.id) { return this.fakerNode; } return (_this$nodesMap$nodeId = this.nodesMap[nodeId]) === null || _this$nodesMap$nodeId === void 0 ? void 0 : _this$nodesMap$nodeId.model; } /** * 因为流程图所在的位置可以是页面任何地方 * 当内部事件需要获取触发事件时,其相对于画布左上角的位置 * 需要事件触发位置减去画布相对于client的位置 */ }, { key: "getPointByClient", value: function getPointByClient(_ref) { var x1 = _ref.x, y1 = _ref.y; var bbox = this.rootEl.getBoundingClientRect(); var domOverlayPosition = { x: x1 - bbox.left, y: y1 - bbox.top }; var _this$transformModel$ = this.transformModel.HtmlPointToCanvasPoint([domOverlayPosition.x, domOverlayPosition.y]), _this$transformModel$2 = GraphModel_slicedToArray(_this$transformModel$, 2), x = _this$transformModel$2[0], y = _this$transformModel$2[1]; return { domOverlayPosition: domOverlayPosition, canvasOverlayPosition: { x: x, y: y } }; } /** * 判断一个元素是否在指定矩形区域内。 * @param element 节点或者边 * @param lt 左上角点 * @param rb 右下角点 * @param wholeEdge 边的起点和终点都在区域内才算 * @param wholeNode 节点的box都在区域内才算 */ }, { key: "isElementInArea", value: function isElementInArea(element, lt, rb) { var wholeEdge = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; var wholeNode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; if (element.BaseType === ElementType.NODE) { element = element; // 节点是否在选区内,判断逻辑为如果节点的bbox的四个角上的点都在选区内,则判断节点在选区内 var _getNodeBBox = getNodeBBox(element), minX = _getNodeBBox.minX, minY = _getNodeBBox.minY, maxX = _getNodeBBox.maxX, maxY = _getNodeBBox.maxY; var bboxPointsList = [{ x: minX, y: minY }, { x: maxX, y: minY }, { x: maxX, y: maxY }, { x: minX, y: maxY }]; var inArea = wholeNode; for (var i = 0; i < bboxPointsList.length; i++) { var _bboxPointsList$i = bboxPointsList[i], x = _bboxPointsList$i.x, y = _bboxPointsList$i.y; var _this$transformModel$3 = this.transformModel.CanvasPointToHtmlPoint([x, y]); var _this$transformModel$4 = GraphModel_slicedToArray(_this$transformModel$3, 2); x = _this$transformModel$4[0]; y = _this$transformModel$4[1]; if (isPointInArea([x, y], lt, rb) !== wholeNode) { inArea = !wholeNode; break; } } return inArea; } if (element.BaseType === ElementType.EDGE) { element = element; var _element = element, startPoint = _element.startPoint, endPoint = _element.endPoint; var startHtmlPoint = this.transformModel.CanvasPointToHtmlPoint([startPoint.x, startPoint.y]); var endHtmlPoint = this.transformModel.CanvasPointToHtmlPoint([endPoint.x, endPoint.y]); var isStartInArea = isPointInArea(startHtmlPoint, lt, rb); var isEndInArea = isPointInArea(endHtmlPoint, lt, rb); return wholeEdge ? isStartInArea && isEndInArea : isStartInArea || isEndInArea; } return false; } /** * 使用新的数据重新设置整个画布的元素 * 注意:将会清除画布上所有已有的节点和边 * @param { object } graphData 图数据 */ }, { key: "graphDataToModel", value: function graphDataToModel(graphData) { var _this = this; if (!this.width || !this.height) { this.resize(); } this.nodes = lodash_es_map(graphData.nodes, function (node) { var Model = _this.getModel(node.type); if (!Model) { throw new Error("\u627E\u4E0D\u5230".concat(node.type, "\u5BF9\u5E94\u7684\u8282\u70B9\u3002")); } var nodeX = node.x, nodeY = node.y; // 根据 grid 修正节点的 x, y if (nodeX && nodeY) { node.x = snapToGrid(nodeX, _this.gridSize); node.y = snapToGrid(nodeY, _this.gridSize); if (GraphModel_typeof(node.text) === 'object') { node.text.x -= getGridOffset(nodeX, _this.gridSize); node.text.y -= getGridOffset(nodeY, _this.gridSize); } } return new Model(node, _this); }); this.edges = lodash_es_map(graphData.edges, function (edge) { var Model = _this.getModel(edge.type); if (!Model) { throw new Error("\u627E\u4E0D\u5230".concat(edge.type, "\u5BF9\u5E94\u7684\u8FB9\u3002")); } return new Model(edge, _this); }); } /** * 获取画布数据 */ }, { key: "modelToGraphData", value: function modelToGraphData() { var edges = []; this.edges.forEach(function (edge) { var data = edge.getData(); if (data && !edge.virtual) edges.push(data); }); var nodes = []; this.nodes.forEach(function (node) { var data = node.getData(); if (data && !node.virtual) nodes.push(data); }); return { nodes: nodes, edges: edges }; } // 用户history记录的数据,忽略拖拽过程中的数据变更 }, { key: "modelToHistoryData", value: function modelToHistoryData() { var nodeDragging = false; var nodes = []; // 如果有节点在拖拽中,不更新history for (var i = 0; i < this.nodes.length; i++) { var nodeMode = this.nodes[i]; if (nodeMode.isDragging) { nodeDragging = true; break; } else { nodes.push(nodeMode.getHistoryData()); } } if (nodeDragging) { return false; } // 如果有边在拖拽中,不更新history var edgeDragging = false; var edges = []; for (var j = 0; j < this.edges.length; j++) { var edgeMode = this.edges[j]; if (edgeMode.isDragging) { edgeDragging = true; break; } else { edges.push(edgeMode.getHistoryData()); } } if (edgeDragging) { return false; } return { nodes: nodes, edges: edges }; } /** * 获取边的model */ }, { key: "getEdgeModelById", value: function getEdgeModelById(edgeId) { var _this$edgesMap$edgeId; return (_this$edgesMap$edgeId = this.edgesMap[edgeId]) === null || _this$edgesMap$edgeId === void 0 ? void 0 : _this$edgesMap$edgeId.model; } /** * 获取节点或者边的model */ }, { key: "getElement", value: function getElement(id) { return this.modelsMap[id]; } /** * 所有节点上所有边的model */ }, { key: "getNodeEdges", value: function getNodeEdges(nodeId) { var edges = []; for (var i = 0; i < this.edges.length; i++) { var edgeModel = this.edges[i]; var nodeAsSource = this.edges[i].sourceNodeId === nodeId; var nodeAsTarget = this.edges[i].targetNodeId === nodeId; if (nodeAsSource || nodeAsTarget) { edges.push(edgeModel); } } return edges; } /** * 获取选中的元素数据 * @param isIgnoreCheck 是否包括sourceNode和targetNode没有被选中的边,默认包括。 * 复制的时候不能包括此类边, 因为复制的时候不允许悬空的边 */ }, { key: "getSelectElements", value: function getSelectElements() { var isIgnoreCheck = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; var elements = this.selectElements; var graphData = { nodes: [], edges: [] }; elements.forEach(function (element) { if (element.BaseType === ElementType.NODE) { graphData.nodes.push(element.getData()); } if (element.BaseType === ElementType.EDGE) { var edgeData = element.getData(); var isNodeSelected = elements.get(edgeData.sourceNodeId) && elements.get(edgeData.targetNodeId); if (isIgnoreCheck || isNodeSelected) { graphData.edges.push(edgeData); } } }); return graphData; } /** * 修改对应元素 model 中的属性 * 注意:此方法慎用,除非您对logicflow内部有足够的了解。 * 大多数情况下,请使用setProperties、updateText、changeNodeId等方法。 * 例如直接使用此方法修改节点的id,那么就是会导致连接到此节点的边的sourceNodeId出现找不到的情况。 * @param {string} id 元素id * @param {object} attributes 需要更新的属性 */ }, { key: "updateAttributes", value: function updateAttributes(id, attributes) { var element = this.getElement(id); element.updateAttributes(attributes); } /** * 修改节点的id, 如果不传新的id,会内部自动创建一个。 * @param { string } oldId 将要被修改的id * @param { string } newId 可选,修改后的id * @returns 修改后的节点id, 如果传入的oldId不存在,返回空字符串 */ }, { key: "changeNodeId", value: function changeNodeId(oldId, newId) { if (!newId) { newId = uuid_createUuid(); } if (this.nodesMap[newId]) { console.warn("\u5F53\u524D\u6D41\u7A0B\u56FE\u5DF2\u5B58\u5728\u8282\u70B9".concat(newId, ", \u4FEE\u6539\u5931\u8D25")); return ''; } if (!this.nodesMap[oldId]) { console.warn("\u5F53\u524D\u6D41\u7A0B\u56FE\u627E\u4E0D\u5230\u8282\u70B9".concat(newId, ", \u4FEE\u6539\u5931\u8D25")); return ''; } this.edges.forEach(function (edge) { if (edge.sourceNodeId === oldId) { edge.sourceNodeId = newId; } if (edge.targetNodeId === oldId) { edge.targetNodeId = newId; } }); this.nodesMap[oldId].model.id = newId; return newId; } /** * 修改边的id, 如果不传新的id,会内部自动创建一个。 * @param { string } oldId 将要被修改的id * @param { string } newId 可选,修改后的id * @returns 修改后的节点id, 如果传入的oldId不存在,返回空字符串 */ }, { key: "changeEdgeId", value: function changeEdgeId(oldId, newId) { if (!newId) { newId = uuid_createUuid(); } if (this.edgesMap[newId]) { console.warn("\u5F53\u524D\u6D41\u7A0B\u56FE\u5DF2\u5B58\u5728\u8FB9: ".concat(newId, ", \u4FEE\u6539\u5931\u8D25")); return ''; } if (!this.edgesMap[oldId]) { console.warn("\u5F53\u524D\u6D41\u7A0B\u56FE\u627E\u4E0D\u5230\u8FB9: ".concat(newId, ", \u4FEE\u6539\u5931\u8D25")); return ''; } this.edges.forEach(function (edge) { if (edge.id === oldId) { // edge.id = newId; edge.changeEdgeId(newId); } }); return newId; } /** * 内部保留方法,请勿直接使用 */ }, { key: "setFakerNode", value: function setFakerNode(nodeModel) { this.fakerNode = nodeModel; } /** * 内部保留方法,请勿直接使用 */ }, { key: "removeFakerNode", value: function removeFakerNode() { this.fakerNode = null; } /** * 设置指定类型的Model,请勿直接使用 */ }, { key: "setModel", value: function setModel(type, ModelClass) { return this.modelMap.set(type, ModelClass); } /** * 将某个元素放置到顶部。 * 如果堆叠模式为默认模式,则将原置顶元素重新恢复原有层级。 * 如果堆叠模式为递增模式,则将需指定元素zIndex设置为当前最大zIndex + 1。 * @see todo link 堆叠模式 * @param id 元素Id */ }, { key: "toFront", value: function toFront(id) { var _this$nodesMap$id, _this$edgesMap$id; var element = ((_this$nodesMap$id = this.nodesMap[id]) === null || _this$nodesMap$id === void 0 ? void 0 : _this$nodesMap$id.model) || ((_this$edgesMap$id = this.edgesMap[id]) === null || _this$edgesMap$id === void 0 ? void 0 : _this$edgesMap$id.model); if (element) { if (this.overlapMode === OverlapMode.DEFAULT) { var _this$topElement; (_this$topElement = this.topElement) === null || _this$topElement === void 0 ? void 0 : _this$topElement.setZIndex(); element.setZIndex(ElementMaxZIndex); this.topElement = element; } if (this.overlapMode === OverlapMode.INCREASE) { this.setElementZIndex(id, 'top'); } } } /** * 设置元素的zIndex. * 注意:默认堆叠模式下,不建议使用此方法。 * @see todo link 堆叠模式 * @param id 元素id * @param zIndex zIndex的值,可以传数字,也支持传入'top' 和 'bottom' */ }, { key: "setElementZIndex", value: function setElementZIndex(id, zIndex) { var _this$nodesMap$id2, _this$edgesMap$id2; var element = ((_this$nodesMap$id2 = this.nodesMap[id]) === null || _this$nodesMap$id2 === void 0 ? void 0 : _this$nodesMap$id2.model) || ((_this$edgesMap$id2 = this.edgesMap[id]) === null || _this$edgesMap$id2 === void 0 ? void 0 : _this$edgesMap$id2.model); if (element) { var index; if (typeof zIndex === 'number') { index = zIndex; } if (zIndex === 'top') { index = getZIndex(); } if (zIndex === 'bottom') { index = getMinIndex(); } element.setZIndex(index); } } /** * 删除节点 * @param {string} nodeId 节点Id */ }, { key: "deleteNode", value: function deleteNode(id) { var nodeData = this.nodesMap[id].model.getData(); this.deleteEdgeBySource(id); this.deleteEdgeByTarget(id); this.nodes.splice(this.nodesMap[id].index, 1); this.eventCenter.emit(EventType.NODE_DELETE, { data: nodeData }); } /** * 添加节点 * @param nodeConfig 节点配置 * @param eventType 新增节点事件类型,默认EventType.NODE_ADD */ }, { key: "addNode", value: function addNode(nodeConfig) { var eventType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EventType.NODE_ADD; var nodeOriginData = formatData(nodeConfig); // 添加节点的时候,如果这个节点Id已经存在,则采用新的id if (nodeOriginData.id && this.nodesMap[nodeConfig.id]) { delete nodeOriginData.id; } var Model = this.getModel(nodeOriginData.type); if (!Model) { throw new Error("\u627E\u4E0D\u5230".concat(nodeOriginData.type, "\u5BF9\u5E94\u7684\u8282\u70B9\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5DF2\u6CE8\u518C\u6B64\u7C7B\u578B\u8282\u70B9\u3002")); } nodeOriginData.x = snapToGrid(nodeOriginData.x, this.gridSize); nodeOriginData.y = snapToGrid(nodeOriginData.y, this.gridSize); var nodeModel = new Model(nodeOriginData, this); this.nodes.push(nodeModel); var nodeData = nodeModel.getData(); this.eventCenter.emit(eventType, { data: nodeData }); return nodeModel; } /** * 克隆节点 * @param nodeId 节点Id */ }, { key: "cloneNode", value: function cloneNode(nodeId) { var Model = this.getNodeModelById(nodeId); var data = Model.getData(); data.x += 30; data.y += 30; delete data.id; if (data.text) { data.text.x += 30; data.text.y += 30; } var nodeModel = this.addNode(data); nodeModel.setSelected(true); Model.setSelected(false); return nodeModel.getData(); } /** * 移动节点-相对位置 * @param nodeModel 节点Id * @param deltaX X轴移动距离 * @param deltaY Y轴移动距离 * @param isIgnoreRule 是否忽略移动规则限制 */ }, { key: "moveNode", value: function moveNode(nodeId, deltaX, deltaY) { var isIgnoreRule = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; // 1) 移动节点 var node = this.nodesMap[nodeId]; if (!node) { console.warn("\u4E0D\u5B58\u5728id\u4E3A".concat(nodeId, "\u7684\u8282\u70B9")); return; } var nodeModel = node.model; var _nodeModel$getMoveDis = nodeModel.getMoveDistance(deltaX, deltaY, isIgnoreRule); var _nodeModel$getMoveDis2 = GraphModel_slicedToArray(_nodeModel$getMoveDis, 2); deltaX = _nodeModel$getMoveDis2[0]; deltaY = _nodeModel$getMoveDis2[1]; // 2) 移动边 this.moveEdge(nodeId, deltaX, deltaY); } /** * 移动节点-绝对位置 * @param nodeModel 节点Id * @param x X轴目标位置 * @param y Y轴目标位置 */ }, { key: "moveNode2Coordinate", value: function moveNode2Coordinate(nodeId, x, y) { var isIgnoreRule = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; // 1) 移动节点 var node = this.nodesMap[nodeId]; if (!node) { console.warn("\u4E0D\u5B58\u5728id\u4E3A".concat(nodeId, "\u7684\u8282\u70B9")); return; } var nodeModel = node.model; var originX = nodeModel.x, originY = nodeModel.y; var deltaX = x - originX; var deltaY = y - originY; this.moveNode(nodeId, deltaX, deltaY, isIgnoreRule); } /** * 显示节点、连线文本编辑框 * @param elementId 节点id */ }, { key: "editText", value: function editText(id) { this.setElementStateById(id, ElementState.TEXT_EDIT); } /** * 给两个节点之间添加一条边 * @param {object} edgeConfig */ }, { key: "addEdge", value: function addEdge(edgeConfig) { var edgeOriginData = formatData(edgeConfig); // 边的类型优先级:自定义>全局>默认 var type = edgeOriginData.type; if (!type) { type = this.edgeType; } if (edgeOriginData.id && this.edgesMap[edgeOriginData.id]) { delete edgeOriginData.id; } var Model = this.getModel(type); if (!Model) { throw new Error("\u627E\u4E0D\u5230".concat(type, "\u5BF9\u5E94\u7684\u8FB9\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5DF2\u6CE8\u518C\u6B64\u7C7B\u578B\u8FB9\u3002")); } var edgeModel = new Model(GraphModel_objectSpread(GraphModel_objectSpread({}, edgeOriginData), {}, { type: type }), this); var edgeData = edgeModel.getData(); this.edges.push(edgeModel); this.eventCenter.emit(EventType.EDGE_ADD, { data: edgeData }); return edgeModel; } /** * 移动边,内部方法,请勿直接使用 */ }, { key: "moveEdge", value: function moveEdge(nodeId, deltaX, deltaY) { /* 更新相关边位置 */ for (var i = 0; i < this.edges.length; i++) { var edgeModel = this.edges[i]; var _edgeModel$textPositi = edgeModel.textPosition, x = _edgeModel$textPositi.x, y = _edgeModel$textPositi.y; var nodeAsSource = this.edges[i].sourceNodeId === nodeId; var nodeAsTarget = this.edges[i].targetNodeId === nodeId; if (nodeAsSource) { edgeModel.moveStartPoint(deltaX, deltaY); } if (nodeAsTarget) { edgeModel.moveEndPoint(deltaX, deltaY); } // 如果有文案了,当节点移动引起文案位置修改时,找出当前文案位置与最新边距离最短距离的点 // 最大程度保持节点位置不变且在边上 if (nodeAsSource || nodeAsTarget) { var _edgeModel$text; // todo: 找到更好的边位置移动处理方式 // 如果是自定义边文本位置,则移动节点的时候重新计算其位置 if (edgeModel.customTextPosition === true) { edgeModel.resetTextPosition(); } else if (edgeModel.modelType === ModelType.POLYLINE_EDGE && (_edgeModel$text = edgeModel.text) !== null && _edgeModel$text !== void 0 && _edgeModel$text.value) { var textPosition = edgeModel.text; var newPoint = edge_getClosestPointOfPolyline(textPosition, edgeModel.points); edgeModel.moveText(newPoint.x - textPosition.x, newPoint.y - textPosition.y); } else { var _edgeModel$textPositi2 = edgeModel.textPosition, x1 = _edgeModel$textPositi2.x, y1 = _edgeModel$textPositi2.y; edgeModel.moveText(x1 - x, y1 - y); } } } } /** * 删除两节点之间的边 * @param sourceNodeId 边的起始节点 * @param targetNodeId 边的目的节点 */ }, { key: "deleteEdgeBySourceAndTarget", value: function deleteEdgeBySourceAndTarget(sourceNodeId, targetNodeId) { for (var i = 0; i < this.edges.length; i++) { if (this.edges[i].sourceNodeId === sourceNodeId && this.edges[i].targetNodeId === targetNodeId) { var edgeData = this.edges[i].getData(); this.edges.splice(i, 1); i--; this.eventCenter.emit(EventType.EDGE_DELETE, { data: edgeData }); } } } /** * 基于边Id删除边 */ }, { key: "deleteEdgeById", value: function deleteEdgeById(id) { var edge = this.edgesMap[id]; if (!edge) { return; } var idx = this.edgesMap[id].index; var edgeData = this.edgesMap[id].model.getData(); this.edges.splice(idx, 1); this.eventCenter.emit(EventType.EDGE_DELETE, { data: edgeData }); } /** * 删除以节点Id为起点的所有边 */ }, { key: "deleteEdgeBySource", value: function deleteEdgeBySource(sourceNodeId) { for (var i = 0; i < this.edges.length; i++) { if (this.edges[i].sourceNodeId === sourceNodeId) { var edgeData = this.edges[i].getData(); this.edges.splice(i, 1); i--; this.eventCenter.emit(EventType.EDGE_DELETE, { data: edgeData }); } } } /** * 删除以节点Id为终点的所有边 */ }, { key: "deleteEdgeByTarget", value: function deleteEdgeByTarget(targetNodeId) { for (var i = 0; i < this.edges.length; i++) { if (this.edges[i].targetNodeId === targetNodeId) { var edgeData = this.edges[i].getData(); this.edges.splice(i, 1); i--; this.eventCenter.emit(EventType.EDGE_DELETE, { data: edgeData }); } } } /** * 设置元素的状态,在需要保证整个画布上所有的元素只有一个元素拥有此状态时可以调用此方法。 * 例如文本编辑、菜单显示等。 * additionStateData: 传递的额外值,如菜单显示的时候,需要传递期望菜单显示的位置。 */ }, { key: "setElementStateById", value: function setElementStateById(id, state, additionStateData) { this.nodes.forEach(function (node) { if (node.id === id) { node.setElementState(state, additionStateData); } else { node.setElementState(ElementState.DEFAULT); } }); this.edges.forEach(function (edge) { if (edge.id === id) { edge.setElementState(state, additionStateData); } else { edge.setElementState(ElementState.DEFAULT); } }); } /** * 更新节点或边的文案 * @param id 节点或者边id * @param value 文案内容 */ }, { key: "updateText", value: function updateText(id, value) { this.nodes.forEach(function (node) { if (node.id === id) { node.updateText(value); } }); this.edges.forEach(function (edge) { if (edge.id === id) { edge.updateText(value); } }); } /** * 选中节点 * @param id 节点Id * @param multiple 是否为多选,如果为多选,则不去掉原有已选择节点的选中状态 */ }, { key: "selectNodeById", value: function selectNodeById(id) { var _this$nodesMap$id3; var multiple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; if (!multiple) { this.clearSelectElements(); } var selectElement = (_this$nodesMap$id3 = this.nodesMap[id]) === null || _this$nodesMap$id3 === void 0 ? void 0 : _this$nodesMap$id3.model; selectElement === null || selectElement === void 0 ? void 0 : selectElement.setSelected(true); } /** * 选中边 * @param id 边Id * @param multiple 是否为多选,如果为多选,则不去掉原已选中边的状态 */ }, { key: "selectEdgeById", value: function selectEdgeById(id) { var _this$edgesMap$id3; var multiple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; if (!multiple) { this.clearSelectElements(); } var selectElement = (_this$edgesMap$id3 = this.edgesMap[id]) === null || _this$edgesMap$id3 === void 0 ? void 0 : _this$edgesMap$id3.model; selectElement === null || selectElement === void 0 ? void 0 : selectElement.setSelected(true); } /** * 将图形选中 * @param id 选择元素ID * @param multiple 是否允许多选,如果为true,不会将上一个选中的元素重置 */ }, { key: "selectElementById", value: function selectElementById(id) { var multiple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; if (!multiple) { this.clearSelectElements(); } var selectElement = this.getElement(id); selectElement === null || selectElement === void 0 ? void 0 : selectElement.setSelected(true); } /** * 将所有选中的元素设置为非选中 */ }, { key: "clearSelectElements", value: function clearSelectElements() { this.selectElements.forEach(function (element) { element === null || element === void 0 ? void 0 : element.setSelected(false); }); this.selectElements.clear(); /** * 如果堆叠模式为默认模式,则将置顶元素重新恢复原有层级 */ if (this.overlapMode === OverlapMode.DEFAULT) { var _this$topElement2; (_this$topElement2 = this.topElement) === null || _this$topElement2 === void 0 ? void 0 : _this$topElement2.setZIndex(); } } /** * 批量移动节点,节点移动的时候,会动态计算所有节点与未移动节点的边位置 * 移动的节点之间的边会保持相对位置 */ }, { key: "moveNodes", value: function moveNodes(nodeIds, deltaX, deltaY) { var _this2 = this; var isIgnoreRule = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; // FIX: https://github.com/didi/LogicFlow/issues/1015 // 如果节点之间存在连线,则只移动连线一次。 var nodeIdMap = nodeIds.reduce(function (acc, cur) { var nodeModel = _this2.nodesMap[cur].model; var moveDistance = nodeModel.getMoveDistance(deltaX, deltaY, isIgnoreRule); acc[cur] = moveDistance; return acc; }, {}); for (var i = 0; i < this.edges.length; i++) { var edgeModel = this.edges[i]; var sourceMoveDistance = nodeIdMap[edgeModel.sourceNodeId]; var textDistanceX = void 0; var textDistanceY = void 0; if (sourceMoveDistance) { var _sourceMoveDistance = GraphModel_slicedToArray(sourceMoveDistance, 2); textDistanceX = _sourceMoveDistance[0]; textDistanceY = _sourceMoveDistance[1]; edgeModel.moveStartPoint(textDistanceX, textDistanceY); } var targetMoveDistance = nodeIdMap[edgeModel.sourceNodeId]; if (targetMoveDistance) { var _targetMoveDistance = GraphModel_slicedToArray(targetMoveDistance, 2); textDistanceX = _targetMoveDistance[0]; textDistanceY = _targetMoveDistance[1]; edgeModel.moveEndPoint(textDistanceX, textDistanceY); } if (sourceMoveDistance || targetMoveDistance) { edgeModel.moveText(textDistanceX, textDistanceY); } } } /** * 添加节点移动限制规则,在节点移动的时候触发。 * 如果方法返回false, 则会阻止节点移动。 * @param fn function * @example * * graphModel.addNodeMoveRules((nodeModel, x, y) => { * if (nodeModel.properties.disabled) { * return false * } * return true * }) * */ }, { key: "addNodeMoveRules", value: function addNodeMoveRules(fn) { if (!this.nodeMoveRules.includes(fn)) { this.nodeMoveRules.push(fn); } } /** * 设置默认的边类型 * 也就是设置在节点直接有用户手动绘制的连线类型。 * @param type Options.EdgeType */ }, { key: "setDefaultEdgeType", value: function setDefaultEdgeType(type) { this.edgeType = type; } /** * 修改指定节点类型 * @param id 节点id * @param type 节点类型 */ }, { key: "changeNodeType", value: function changeNodeType(id, type) { var nodeModel = this.getNodeModelById(id); if (!nodeModel) { console.warn("\u627E\u4E0D\u5230id\u4E3A".concat(id, "\u7684\u8282\u70B9")); return; } var data = nodeModel.getData(); data.type = type; var Model = this.getModel(type); if (!Model) { throw new Error("\u627E\u4E0D\u5230".concat(type, "\u5BF9\u5E94\u7684\u8282\u70B9\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5DF2\u6CE8\u518C\u6B64\u7C7B\u578B\u8282\u70B9\u3002")); } var newNodeModel = new Model(data, this); this.nodes.splice(this.nodesMap[id].index, 1, newNodeModel); // 微调边 var edgeModels = this.getNodeEdges(id); edgeModels.forEach(function (edge) { if (edge.sourceNodeId === id) { var point = getNodeAnchorPosition(newNodeModel, edge.startPoint, newNodeModel.width, newNodeModel.height); edge.updateStartPoint(point); } if (edge.targetNodeId === id) { var _point = getNodeAnchorPosition(newNodeModel, edge.endPoint, newNodeModel.width, newNodeModel.height); edge.updateEndPoint(_point); } }); } /** * 切换边的类型 * @param id 边Id * @param type 边类型 */ }, { key: "changeEdgeType", value: function changeEdgeType(id, type) { var edgeModel = this.getEdgeModelById(id); if (!edgeModel) { console.warn("\u627E\u4E0D\u5230id\u4E3A".concat(id, "\u7684\u8FB9")); return; } if (edgeModel.type === type) { return; } var data = edgeModel.getData(); data.type = type; var Model = this.getModel(type); if (!Model) { throw new Error("\u627E\u4E0D\u5230".concat(type, "\u5BF9\u5E94\u7684\u8282\u70B9\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5DF2\u6CE8\u518C\u6B64\u7C7B\u578B\u8282\u70B9\u3002")); } // 为了保持切换类型时不复用上一个类型的轨迹 delete data.pointsList; var newEdgeModel = new Model(data, this); this.edges.splice(this.edgesMap[id].index, 1, newEdgeModel); } /** * 获取所有以此节点为终点的边 */ }, { key: "getNodeIncomingEdge", value: function getNodeIncomingEdge(nodeId) { var edges = []; this.edges.forEach(function (edge) { if (edge.targetNodeId === nodeId) { edges.push(edge); } }); return edges; } /** * 获取所有以此节点为起点的边 */ }, { key: "getNodeOutgoingEdge", value: function getNodeOutgoingEdge(nodeId) { var edges = []; this.edges.forEach(function (edge) { if (edge.sourceNodeId === nodeId) { edges.push(edge); } }); return edges; } /** * 获取节点连接到的所有起始节点 */ }, { key: "getNodeIncomingNode", value: function getNodeIncomingNode(nodeId) { var _this3 = this; var nodes = []; this.edges.forEach(function (edge) { if (edge.targetNodeId === nodeId) { nodes.push(_this3.nodesMap[edge.sourceNodeId].model); } }); return nodes; } /** * 获取节点连接到的所有目标节点 */ }, { key: "getNodeOutgoingNode", value: function getNodeOutgoingNode(nodeId) { var _this4 = this; var nodes = []; this.edges.forEach(function (edge) { if (edge.sourceNodeId === nodeId) { nodes.push(_this4.nodesMap[edge.targetNodeId].model); } }); return nodes; } /** * 设置主题 * todo docs link */ }, { key: "setTheme", value: function setTheme(style) { this.theme = theme_updateTheme(GraphModel_objectSpread(GraphModel_objectSpread({}, this.theme), style)); } /** * 重新设置画布的宽高 */ }, { key: "resize", value: function resize(width, height) { this.width = width || this.rootEl.getBoundingClientRect().width; this.height = height || this.rootEl.getBoundingClientRect().height; if (!this.width || !this.height) { console.warn('渲染画布的时候无法获取画布宽高,请确认在container已挂载到DOM。@see https://github.com/didi/LogicFlow/issues/675'); } } /** * 清空画布 */ }, { key: "clearData", value: function clearData() { this.nodes = []; this.edges = []; } /** * 获取图形区域虚拟矩型的尺寸和中心坐标 * @returns */ }, { key: "getVirtualRectSize", value: function getVirtualRectSize() { var nodes = this.nodes; var nodesX = []; var nodesY = []; // 获取所有节点组成的x,y轴最大最小值,这里考虑了图形的长宽和边框 nodes.forEach(function (node) { var x = node.x, y = node.y, width = node.width, height = node.height; var _node$getNodeStyle = node.getNodeStyle(), _node$getNodeStyle$st = _node$getNodeStyle.strokeWidth, strokeWidth = _node$getNodeStyle$st === void 0 ? 0 : _node$getNodeStyle$st; nodesX = nodesX.concat([x + width / 2 + strokeWidth, x - width / 2 - strokeWidth]); nodesY = nodesY.concat([y + height / 2 + strokeWidth, y - height / 2 - strokeWidth]); }); var minX = Math.min.apply(Math, GraphModel_toConsumableArray(nodesX)); var maxX = Math.max.apply(Math, GraphModel_toConsumableArray(nodesX)); var minY = Math.min.apply(Math, GraphModel_toConsumableArray(nodesY)); var maxY = Math.max.apply(Math, GraphModel_toConsumableArray(nodesY)); var virtualRectWidth = maxX - minX || 0; var virtualRectHeight = maxY - minY || 0; // 获取虚拟矩型的中心坐标 var virtualRectCenterPositionX = minX + virtualRectWidth / 2; var virtualRectCenterPositionY = minY + virtualRectHeight / 2; return { virtualRectWidth: virtualRectWidth, virtualRectHeight: virtualRectHeight, virtualRectCenterPositionX: virtualRectCenterPositionX, virtualRectCenterPositionY: virtualRectCenterPositionY }; } /** * 将图形整体移动到画布中心 */ }, { key: "translateCenter", value: function translateCenter() { var nodes = this.nodes, width = this.width, height = this.height, rootEl = this.rootEl, transformModel = this.transformModel; if (!nodes.length) { return; } var containerWidth = width || rootEl.clientWidth; var containerHeight = height || rootEl.clientHeight; var _this$getVirtualRectS = this.getVirtualRectSize(), virtualRectCenterPositionX = _this$getVirtualRectS.virtualRectCenterPositionX, virtualRectCenterPositionY = _this$getVirtualRectS.virtualRectCenterPositionY; // 将虚拟矩型移动到画布中心 transformModel.focusOn(virtualRectCenterPositionX, virtualRectCenterPositionY, containerWidth, containerHeight); } /** * 画布图形适应屏幕大小 * @param verticalOffset number 距离盒子上下的距离, 默认为20 * @param horizontalOffset number 距离盒子左右的距离, 默认为20 */ }, { key: "fitView", value: function fitView() { var verticalOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 20; var horizontalOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20; var nodes = this.nodes, width = this.width, height = this.height, rootEl = this.rootEl, transformModel = this.transformModel; if (!nodes.length) { return; } var containerWidth = width || rootEl.clientWidth; var containerHeight = height || rootEl.clientHeight; var _this$getVirtualRectS2 = this.getVirtualRectSize(), virtualRectWidth = _this$getVirtualRectS2.virtualRectWidth, virtualRectHeight = _this$getVirtualRectS2.virtualRectHeight, virtualRectCenterPositionX = _this$getVirtualRectS2.virtualRectCenterPositionX, virtualRectCenterPositionY = _this$getVirtualRectS2.virtualRectCenterPositionY; var zoomRatioX = (virtualRectWidth + horizontalOffset) / containerWidth; var zoomRatioY = (virtualRectHeight + verticalOffset) / containerHeight; var zoomRatio = 0; zoomRatio = 1 / Math.max(zoomRatioX, zoomRatioY); var point = [containerWidth / 2, containerHeight / 2]; // 适应画布大小 transformModel.zoom(zoomRatio, point); // 将虚拟矩型移动到画布中心 transformModel.focusOn(virtualRectCenterPositionX, virtualRectCenterPositionY, containerWidth, containerHeight); } /** * 开启边的动画 * @param edgeId any */ }, { key: "openEdgeAnimation", value: function openEdgeAnimation(edgeId) { var edgeModel = this.getEdgeModelById(edgeId); edgeModel.openEdgeAnimation(); } /** * 关闭边的动画 * @param edgeId any */ }, { key: "closeEdgeAnimation", value: function closeEdgeAnimation(edgeId) { var edgeModel = this.getEdgeModelById(edgeId); edgeModel.closeEdgeAnimation(); } }]); return GraphModel; }(), (GraphModel_descriptor = GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "width", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: null }), GraphModel_descriptor2 = GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "height", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: null }), GraphModel_descriptor3 = GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "edgeType", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: null }), GraphModel_descriptor4 = GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "nodes", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), GraphModel_descriptor5 = GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "edges", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), GraphModel_descriptor6 = GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "overlapMode", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return OverlapMode.DEFAULT; } }), GraphModel_descriptor7 = GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "background", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: null }), GraphModel_descriptor8 = GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "transformModel", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: null }), GraphModel_descriptor9 = GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "editConfigModel", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: null }), GraphModel_descriptor10 = GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "gridSize", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 1; } }), GraphModel_descriptor11 = GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "partial", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), GraphModel_descriptor12 = GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "fakerNode", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: null }), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "nodesMap", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "nodesMap"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "edgesMap", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "edgesMap"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "modelsMap", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "modelsMap"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "sortElements", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "sortElements"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "textEditElement", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "textEditElement"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "selectElements", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "selectElements"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "setFakerNode", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "setFakerNode"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "removeFakerNode", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "removeFakerNode"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "setModel", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "setModel"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "toFront", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "toFront"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "setElementZIndex", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "setElementZIndex"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "deleteNode", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "deleteNode"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "addNode", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "addNode"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "cloneNode", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "cloneNode"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "moveNode", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "moveNode"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "moveNode2Coordinate", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "moveNode2Coordinate"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "editText", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "editText"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "addEdge", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "addEdge"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "moveEdge", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "moveEdge"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "deleteEdgeBySourceAndTarget", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "deleteEdgeBySourceAndTarget"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "deleteEdgeById", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "deleteEdgeById"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "deleteEdgeBySource", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "deleteEdgeBySource"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "deleteEdgeByTarget", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "deleteEdgeByTarget"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "setElementStateById", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "setElementStateById"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "updateText", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "updateText"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "selectNodeById", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "selectNodeById"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "selectEdgeById", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "selectEdgeById"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "selectElementById", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "selectElementById"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "clearSelectElements", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "clearSelectElements"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "moveNodes", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "moveNodes"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "setDefaultEdgeType", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "setDefaultEdgeType"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "changeNodeType", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "changeNodeType"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "changeEdgeType", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "changeEdgeType"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "getNodeIncomingEdge", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "getNodeIncomingEdge"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "getNodeOutgoingEdge", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "getNodeOutgoingEdge"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "getNodeIncomingNode", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "getNodeIncomingNode"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "getNodeOutgoingNode", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "getNodeOutgoingNode"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "setTheme", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "setTheme"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "resize", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "resize"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "clearData", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "clearData"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "translateCenter", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "translateCenter"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "fitView", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "fitView"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "openEdgeAnimation", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "openEdgeAnimation"), GraphModel_class.prototype), GraphModel_applyDecoratedDescriptor(GraphModel_class.prototype, "closeEdgeAnimation", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(GraphModel_class.prototype, "closeEdgeAnimation"), GraphModel_class.prototype)), GraphModel_class); /* harmony default export */ var model_GraphModel = (GraphModel_GraphModel); // CONCATENATED MODULE: ./src/view/overlay/CanvasOverlay.tsx function CanvasOverlay_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { CanvasOverlay_typeof = function _typeof(obj) { return typeof obj; }; } else { CanvasOverlay_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return CanvasOverlay_typeof(obj); } var CanvasOverlay_class; function CanvasOverlay_extends() { CanvasOverlay_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return CanvasOverlay_extends.apply(this, arguments); } function CanvasOverlay_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function CanvasOverlay_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function CanvasOverlay_createClass(Constructor, protoProps, staticProps) { if (protoProps) CanvasOverlay_defineProperties(Constructor.prototype, protoProps); if (staticProps) CanvasOverlay_defineProperties(Constructor, staticProps); return Constructor; } function CanvasOverlay_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) CanvasOverlay_setPrototypeOf(subClass, superClass); } function CanvasOverlay_setPrototypeOf(o, p) { CanvasOverlay_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return CanvasOverlay_setPrototypeOf(o, p); } function CanvasOverlay_createSuper(Derived) { var hasNativeReflectConstruct = CanvasOverlay_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = CanvasOverlay_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = CanvasOverlay_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return CanvasOverlay_possibleConstructorReturn(this, result); }; } function CanvasOverlay_possibleConstructorReturn(self, call) { if (call && (CanvasOverlay_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return CanvasOverlay_assertThisInitialized(self); } function CanvasOverlay_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function CanvasOverlay_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function CanvasOverlay_getPrototypeOf(o) { CanvasOverlay_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return CanvasOverlay_getPrototypeOf(o); } function CanvasOverlay_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // import getTransform from './getTransformHoc'; // type InjectedProps = IProps & { // transformStyle: GraphTransform // }; var CanvasOverlay_CanvasOverlay = src_observer(CanvasOverlay_class = /*#__PURE__*/function (_Component) { CanvasOverlay_inherits(CanvasOverlay, _Component); var _super = CanvasOverlay_createSuper(CanvasOverlay); function CanvasOverlay(props) { var _this; CanvasOverlay_classCallCheck(this, CanvasOverlay); _this = _super.call(this); CanvasOverlay_defineProperty(CanvasOverlay_assertThisInitialized(_this), "stepDrag", void 0); CanvasOverlay_defineProperty(CanvasOverlay_assertThisInitialized(_this), "stepScrollX", 0); CanvasOverlay_defineProperty(CanvasOverlay_assertThisInitialized(_this), "stepScrollY", 0); CanvasOverlay_defineProperty(CanvasOverlay_assertThisInitialized(_this), "onDragging", function (_ref) { var deltaX = _ref.deltaX, deltaY = _ref.deltaY; _this.setState({ isDragging: true }); var _this$props$graphMode = _this.props.graphModel, transformModel = _this$props$graphMode.transformModel, editConfigModel = _this$props$graphMode.editConfigModel; if (editConfigModel.stopMoveGraph) { return; } transformModel.translate(deltaX, deltaY); }); CanvasOverlay_defineProperty(CanvasOverlay_assertThisInitialized(_this), "onDragEnd", function () { _this.setState({ isDragging: false }); }); CanvasOverlay_defineProperty(CanvasOverlay_assertThisInitialized(_this), "zoomHandler", function (ev) { var _this$props = _this.props, _this$props$graphMode2 = _this$props.graphModel, editConfigModel = _this$props$graphMode2.editConfigModel, transformModel = _this$props$graphMode2.transformModel, gridSize = _this$props$graphMode2.gridSize, graphModel = _this$props.graphModel; var eX = ev.deltaX, eY = ev.deltaY; // 如果没有禁止滚动移动画布, 并且当前触发的时候ctrl键没有按住, 那么移动画布 if (!editConfigModel.stopScrollGraph && ev.ctrlKey !== true) { ev.preventDefault(); _this.stepScrollX += eX; _this.stepScrollY += eY; if (Math.abs(_this.stepScrollX) >= gridSize) { var remainderX = _this.stepScrollX % gridSize; var moveDistance = _this.stepScrollX - remainderX; transformModel.translate(-moveDistance * transformModel.SCALE_X, 0); _this.stepScrollX = remainderX; } if (Math.abs(_this.stepScrollY) >= gridSize) { var remainderY = _this.stepScrollY % gridSize; var moveDistanceY = _this.stepScrollY - remainderY; transformModel.translate(0, -moveDistanceY * transformModel.SCALE_Y); _this.stepScrollY = remainderY; } return; } // 如果没有禁止缩放画布,那么进行缩放. 在禁止缩放画布后,按住ctrl键也不能缩放了。 if (!editConfigModel.stopZoomGraph) { ev.preventDefault(); var position = graphModel.getPointByClient({ x: ev.clientX, y: ev.clientY }); var _position$canvasOverl = position.canvasOverlayPosition, x = _position$canvasOverl.x, y = _position$canvasOverl.y; transformModel.zoom(ev.deltaY < 0, [x, y]); } }); CanvasOverlay_defineProperty(CanvasOverlay_assertThisInitialized(_this), "clickHandler", function (ev) { // 点击空白处取消节点选中状态, 不包括冒泡过来的事件。 var target = ev.target; if (target.getAttribute('name') === 'canvas-overlay') { var graphModel = _this.props.graphModel; var selectElements = graphModel.selectElements; if (selectElements.size > 0) { graphModel.clearSelectElements(); } graphModel.eventCenter.emit(EventType.BLANK_CLICK, { e: ev }); } }); CanvasOverlay_defineProperty(CanvasOverlay_assertThisInitialized(_this), "handleContextMenu", function (ev) { var target = ev.target; if (target.getAttribute('name') === 'canvas-overlay') { ev.preventDefault(); var graphModel = _this.props.graphModel; var position = graphModel.getPointByClient({ x: ev.clientX, y: ev.clientY }); // graphModel.setElementState(ElementState.SHOW_MENU, position.domOverlayPosition); graphModel.eventCenter.emit(EventType.BLANK_CONTEXTMENU, { e: ev, position: position }); } }); CanvasOverlay_defineProperty(CanvasOverlay_assertThisInitialized(_this), "mouseDownHandler", function (ev) { var _this$props$graphMode3 = _this.props.graphModel, eventCenter = _this$props$graphMode3.eventCenter, editConfigModel = _this$props$graphMode3.editConfigModel, SCALE_X = _this$props$graphMode3.transformModel.SCALE_X, gridSize = _this$props$graphMode3.gridSize; var target = ev.target; var isFrozenElement = !editConfigModel.adjustEdge && !editConfigModel.adjustNodePosition; if (target.getAttribute('name') === 'canvas-overlay' || isFrozenElement) { if (!editConfigModel.stopMoveGraph) { _this.stepDrag.setStep(gridSize * SCALE_X); _this.stepDrag.handleMouseDown(ev); } else { eventCenter.emit(EventType.BLANK_MOUSEDOWN, { e: ev }); } // 为了处理画布移动的时候,编辑和菜单仍然存在的问题。 _this.clickHandler(ev); } }); var _props$graphModel = props.graphModel, _gridSize = _props$graphModel.gridSize, _eventCenter = _props$graphModel.eventCenter; _this.stepDrag = new drag_StepDrag({ onDragging: _this.onDragging, onDragEnd: _this.onDragEnd, step: _gridSize, eventType: 'BLANK', isStopPropagation: false, eventCenter: _eventCenter, model: null }); // 当ctrl键被按住的时候,可以放大缩小。 _this.state = { isDragging: false }; return _this; } // get InjectedProps() { // return this.props as InjectedProps; // } CanvasOverlay_createClass(CanvasOverlay, [{ key: "render", value: function render() { var transformModel = this.props.graphModel.transformModel; var _transformModel$getTr = transformModel.getTransformStyle(), transform = _transformModel$getTr.transform; var _this$props2 = this.props, children = _this$props2.children, dnd = _this$props2.dnd; var isDragging = this.state.isDragging; return Object(preact_module["g" /* h */])("svg", CanvasOverlay_extends({ xmlns: "http://www.w3.org/2000/svg", width: "100%", height: "100%", name: "canvas-overlay", onWheel: this.zoomHandler, onMouseDown: this.mouseDownHandler, onContextMenu: this.handleContextMenu, className: isDragging ? 'lf-canvas-overlay lf-dragging' : 'lf-canvas-overlay lf-drag-able' }, dnd.eventMap()), Object(preact_module["g" /* h */])("g", { transform: transform }, children)); } }]); return CanvasOverlay; }(preact_module["a" /* Component */])) || CanvasOverlay_class; /* harmony default export */ var overlay_CanvasOverlay = (CanvasOverlay_CanvasOverlay); // CONCATENATED MODULE: ./src/view/overlay/ToolOverlay.tsx function ToolOverlay_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ToolOverlay_typeof = function _typeof(obj) { return typeof obj; }; } else { ToolOverlay_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ToolOverlay_typeof(obj); } var ToolOverlay_class; function ToolOverlay_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ToolOverlay_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function ToolOverlay_createClass(Constructor, protoProps, staticProps) { if (protoProps) ToolOverlay_defineProperties(Constructor.prototype, protoProps); if (staticProps) ToolOverlay_defineProperties(Constructor, staticProps); return Constructor; } function ToolOverlay_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ToolOverlay_setPrototypeOf(subClass, superClass); } function ToolOverlay_setPrototypeOf(o, p) { ToolOverlay_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ToolOverlay_setPrototypeOf(o, p); } function ToolOverlay_createSuper(Derived) { var hasNativeReflectConstruct = ToolOverlay_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = ToolOverlay_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = ToolOverlay_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return ToolOverlay_possibleConstructorReturn(this, result); }; } function ToolOverlay_possibleConstructorReturn(self, call) { if (call && (ToolOverlay_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return ToolOverlay_assertThisInitialized(self); } function ToolOverlay_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function ToolOverlay_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function ToolOverlay_getPrototypeOf(o) { ToolOverlay_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ToolOverlay_getPrototypeOf(o); } var ToolOverlay_ToolOverlay = src_observer(ToolOverlay_class = /*#__PURE__*/function (_Component) { ToolOverlay_inherits(ToolOverlay, _Component); var _super = ToolOverlay_createSuper(ToolOverlay); function ToolOverlay() { ToolOverlay_classCallCheck(this, ToolOverlay); return _super.apply(this, arguments); } ToolOverlay_createClass(ToolOverlay, [{ key: "componentDidMount", value: // 在react严格模式下,useEffect会执行两次,但是在LogicFlow内部,则只会触发一次componentDidMount和componentDidUpdate。 // 其中第一次componentDidMount对应的graphModel为被丢弃的graphModel, 所以不应该生效。 // 在非react环境下,只会触发一次componentDidMount,不会触发componentDidUpdate。 // 所以这里采用componentDidUpdate和componentDidMount都去触发插件的render方法。 function componentDidMount() { this.triggerToolRender(); } }, { key: "componentDidUpdate", value: function componentDidUpdate() { this.triggerToolRender(); } /** * 外部传入的一般是HTMLElement */ }, { key: "getTools", value: function getTools() { var _this$props = this.props, tool = _this$props.tool, graphModel = _this$props.graphModel; var tools = tool.getTools(); var components = tools.map(function (item) { return Object(preact_module["g" /* h */])(item, { graphModel: graphModel, logicFlow: tool.instance }); }); tool.components = components; return components; } }, { key: "triggerToolRender", value: function triggerToolRender() { var _this$props2 = this.props, tool = _this$props2.tool, graphModel = _this$props2.graphModel; var ToolOverlayElement = document.querySelector("#ToolOverlay_".concat(graphModel.flowId)); var lf = tool.getInstance(); lf.components.forEach(function (render) { return render(lf, ToolOverlayElement); }); lf.components = []; // 保证extension组件的render只执行一次 } }, { key: "render", value: function render() { var graphModel = this.props.graphModel; return Object(preact_module["g" /* h */])("div", { className: "lf-tool-overlay", id: "ToolOverlay_".concat(graphModel.flowId) }, this.getTools()); } }]); return ToolOverlay; }(preact_module["a" /* Component */])) || ToolOverlay_class; // CONCATENATED MODULE: ./src/view/overlay/BackgroundOverlay.tsx function BackgroundOverlay_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { BackgroundOverlay_typeof = function _typeof(obj) { return typeof obj; }; } else { BackgroundOverlay_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return BackgroundOverlay_typeof(obj); } function BackgroundOverlay_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function BackgroundOverlay_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function BackgroundOverlay_createClass(Constructor, protoProps, staticProps) { if (protoProps) BackgroundOverlay_defineProperties(Constructor.prototype, protoProps); if (staticProps) BackgroundOverlay_defineProperties(Constructor, staticProps); return Constructor; } function BackgroundOverlay_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) BackgroundOverlay_setPrototypeOf(subClass, superClass); } function BackgroundOverlay_setPrototypeOf(o, p) { BackgroundOverlay_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return BackgroundOverlay_setPrototypeOf(o, p); } function BackgroundOverlay_createSuper(Derived) { var hasNativeReflectConstruct = BackgroundOverlay_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = BackgroundOverlay_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = BackgroundOverlay_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return BackgroundOverlay_possibleConstructorReturn(this, result); }; } function BackgroundOverlay_possibleConstructorReturn(self, call) { if (call && (BackgroundOverlay_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return BackgroundOverlay_assertThisInitialized(self); } function BackgroundOverlay_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function BackgroundOverlay_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function BackgroundOverlay_getPrototypeOf(o) { BackgroundOverlay_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return BackgroundOverlay_getPrototypeOf(o); } /** * 背景配置, 支持css属性配置 * https://developer.mozilla.org/zh-CN/docs/Web/CSS/background * @example * { * backgroundImage: "url('./img/grid.svg')", backgroundRepeat: 'repeat', * } */ var BackgroundOverlay_BackgroundOverlay = /*#__PURE__*/function (_Component) { BackgroundOverlay_inherits(BackgroundOverlay, _Component); var _super = BackgroundOverlay_createSuper(BackgroundOverlay); function BackgroundOverlay() { BackgroundOverlay_classCallCheck(this, BackgroundOverlay); return _super.apply(this, arguments); } BackgroundOverlay_createClass(BackgroundOverlay, [{ key: "render", value: function render() { var background = this.props.background; return Object(preact_module["g" /* h */])("div", { className: "lf-background" }, Object(preact_module["g" /* h */])("div", { style: background, className: "lf-background-area" })); } }]); return BackgroundOverlay; }(preact_module["a" /* Component */]); // CONCATENATED MODULE: ./src/view/overlay/Grid.tsx function Grid_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Grid_typeof = function _typeof(obj) { return typeof obj; }; } else { Grid_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Grid_typeof(obj); } var Grid_class; function Grid_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function Grid_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function Grid_createClass(Constructor, protoProps, staticProps) { if (protoProps) Grid_defineProperties(Constructor.prototype, protoProps); if (staticProps) Grid_defineProperties(Constructor, staticProps); return Constructor; } function Grid_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Grid_setPrototypeOf(subClass, superClass); } function Grid_setPrototypeOf(o, p) { Grid_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Grid_setPrototypeOf(o, p); } function Grid_createSuper(Derived) { var hasNativeReflectConstruct = Grid_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Grid_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Grid_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Grid_possibleConstructorReturn(this, result); }; } function Grid_possibleConstructorReturn(self, call) { if (call && (Grid_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Grid_assertThisInitialized(self); } function Grid_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function Grid_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function Grid_getPrototypeOf(o) { Grid_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Grid_getPrototypeOf(o); } function Grid_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var Grid_Grid = src_observer(Grid_class = /*#__PURE__*/function (_Component) { Grid_inherits(Grid, _Component); var _super = Grid_createSuper(Grid); function Grid() { var _this; Grid_classCallCheck(this, Grid); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); Grid_defineProperty(Grid_assertThisInitialized(_this), "id", uuid_createUuid()); return _this; } Grid_createClass(Grid, [{ key: "renderDot", value: // 网格类型为点状 function renderDot() { var _this$props = this.props, _this$props$config = _this$props.config, color = _this$props$config.color, _this$props$config$th = _this$props$config.thickness, thickness = _this$props$config$th === void 0 ? 2 : _this$props$config$th, size = _this$props.size, visible = _this$props.visible; var length = Math.min(Math.max(2, thickness), size / 2); // 2 < length < size /2 var opacity = 1; if (!visible) { opacity = 0; } /* eslint-disable-next-line */ return Object(preact_module["g" /* h */])("rect", { width: length, height: length, rx: length / 2, ry: length / 2, fill: color, opacity: opacity }); } // 网格类型为交叉线 // todo: 采用背景缩放的方式,实现更好的体验 }, { key: "renderMesh", value: function renderMesh() { var _this$props2 = this.props, _this$props2$config = _this$props2.config, color = _this$props2$config.color, _this$props2$config$t = _this$props2$config.thickness, thickness = _this$props2$config$t === void 0 ? 1 : _this$props2$config$t, size = _this$props2.size, visible = _this$props2.visible; var strokeWidth = Math.min(Math.max(1, thickness), size / 2); // 1 < strokeWidth < size /2 var d = "M ".concat(size, " 0 H0 M0 0 V0 ").concat(size); var opacity = 1; if (!visible) { opacity = 0; } return Object(preact_module["g" /* h */])("path", { d: d, stroke: color, strokeWidth: strokeWidth, opacity: opacity }); } }, { key: "render", value: function render() { // TODO 生成网格️️️✔、网格支持 options(size)✔ var _this$props3 = this.props, type = _this$props3.type, size = _this$props3.size, transformModel = _this$props3.graphModel.transformModel; var SCALE_X = transformModel.SCALE_X, SKEW_Y = transformModel.SKEW_Y, SKEW_X = transformModel.SKEW_X, SCALE_Y = transformModel.SCALE_Y, TRANSLATE_X = transformModel.TRANSLATE_X, TRANSLATE_Y = transformModel.TRANSLATE_Y; var matrixString = [SCALE_X, SKEW_Y, SKEW_X, SCALE_Y, TRANSLATE_X, TRANSLATE_Y].join(','); var transform = "matrix(".concat(matrixString, ")"); // const transitionStyle = { // transition: 'all 0.1s ease', // }; return Object(preact_module["g" /* h */])("div", { className: "lf-grid" }, Object(preact_module["g" /* h */])("svg", { xmlns: "http://www.w3.org/2000/svg", version: "1.1", width: "100%", height: "100%" }, Object(preact_module["g" /* h */])("defs", null, Object(preact_module["g" /* h */])("pattern", { id: this.id, patternUnits: "userSpaceOnUse", patternTransform: transform, x: "0", y: "0", width: size, height: size }, type === 'dot' && this.renderDot(), type === 'mesh' && this.renderMesh())), Object(preact_module["g" /* h */])("rect", { width: "100%", height: "100%", fill: "url(#".concat(this.id, ")") }))); } }]); return Grid; }(preact_module["a" /* Component */])) || Grid_class; Grid_Grid.defaultProps = { size: 20, visible: true, type: 'dot', config: { color: '#ababab', thickness: 1 } }; // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.object.entries.js var es_object_entries = __webpack_require__(52); // CONCATENATED MODULE: ./src/view/basic-shape/Line.tsx function Line_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Line_typeof = function _typeof(obj) { return typeof obj; }; } else { Line_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Line_typeof(obj); } function Line_slicedToArray(arr, i) { return Line_arrayWithHoles(arr) || Line_iterableToArrayLimit(arr, i) || Line_unsupportedIterableToArray(arr, i) || Line_nonIterableRest(); } function Line_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function Line_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Line_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Line_arrayLikeToArray(o, minLen); } function Line_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function Line_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function Line_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function Line(props) { var attrs = { // default x1: 10, y1: 10, x2: 20, y2: 20, stroke: 'black' // ...props, }; Object.entries(props).forEach(function (_ref) { var _ref2 = Line_slicedToArray(_ref, 2), k = _ref2[0], v = _ref2[1]; if (k === 'style') { attrs[k] = v; } else { var valueType = Line_typeof(v); if (valueType !== 'object') { attrs[k] = v; } } }); return Object(preact_module["g" /* h */])("line", attrs); } /* harmony default export */ var basic_shape_Line = (Line); // CONCATENATED MODULE: ./src/view/overlay/SnaplineOverlay.tsx function SnaplineOverlay_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { SnaplineOverlay_typeof = function _typeof(obj) { return typeof obj; }; } else { SnaplineOverlay_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return SnaplineOverlay_typeof(obj); } var SnaplineOverlay_class; function SnaplineOverlay_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function SnaplineOverlay_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { SnaplineOverlay_ownKeys(Object(source), true).forEach(function (key) { SnaplineOverlay_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { SnaplineOverlay_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function SnaplineOverlay_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function SnaplineOverlay_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function SnaplineOverlay_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function SnaplineOverlay_createClass(Constructor, protoProps, staticProps) { if (protoProps) SnaplineOverlay_defineProperties(Constructor.prototype, protoProps); if (staticProps) SnaplineOverlay_defineProperties(Constructor, staticProps); return Constructor; } function SnaplineOverlay_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) SnaplineOverlay_setPrototypeOf(subClass, superClass); } function SnaplineOverlay_setPrototypeOf(o, p) { SnaplineOverlay_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return SnaplineOverlay_setPrototypeOf(o, p); } function SnaplineOverlay_createSuper(Derived) { var hasNativeReflectConstruct = SnaplineOverlay_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = SnaplineOverlay_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = SnaplineOverlay_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return SnaplineOverlay_possibleConstructorReturn(this, result); }; } function SnaplineOverlay_possibleConstructorReturn(self, call) { if (call && (SnaplineOverlay_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return SnaplineOverlay_assertThisInitialized(self); } function SnaplineOverlay_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function SnaplineOverlay_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function SnaplineOverlay_getPrototypeOf(o) { SnaplineOverlay_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return SnaplineOverlay_getPrototypeOf(o); } var SnaplineOverlay_SnaplineOverlay = src_observer(SnaplineOverlay_class = /*#__PURE__*/function (_Component) { SnaplineOverlay_inherits(SnaplineOverlay, _Component); var _super = SnaplineOverlay_createSuper(SnaplineOverlay); function SnaplineOverlay() { SnaplineOverlay_classCallCheck(this, SnaplineOverlay); return _super.apply(this, arguments); } SnaplineOverlay_createClass(SnaplineOverlay, [{ key: "render", value: function render() { var snaplineModel = this.props.snaplineModel; var position = snaplineModel.position, isShowHorizontal = snaplineModel.isShowHorizontal, isShowVertical = snaplineModel.isShowVertical; var style = snaplineModel.getStyle(); var _position$x = position.x, x = _position$x === void 0 ? 0 : _position$x, _position$y = position.y, y = _position$y === void 0 ? 0 : _position$y; // 展示横向,纵向默认-100000,100000 减少计算量 var horizontalLine = SnaplineOverlay_objectSpread(SnaplineOverlay_objectSpread({ x1: -100000, y1: y, x2: 100000, y2: y }, style), {}, { stroke: isShowHorizontal ? style.stroke : 'none' }); var verticalLine = SnaplineOverlay_objectSpread(SnaplineOverlay_objectSpread({ x1: x, y1: -100000, x2: x, y2: 100000 }, style), {}, { stroke: isShowVertical ? style.stroke : 'none' }); return Object(preact_module["g" /* h */])("g", { className: "lf-snapline" }, Object(preact_module["g" /* h */])(basic_shape_Line, horizontalLine), Object(preact_module["g" /* h */])(basic_shape_Line, verticalLine)); } }]); return SnaplineOverlay; }(preact_module["a" /* Component */])) || SnaplineOverlay_class; // CONCATENATED MODULE: ./src/view/basic-shape/Rect.tsx function Rect_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Rect_typeof = function _typeof(obj) { return typeof obj; }; } else { Rect_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Rect_typeof(obj); } function Rect_slicedToArray(arr, i) { return Rect_arrayWithHoles(arr) || Rect_iterableToArrayLimit(arr, i) || Rect_unsupportedIterableToArray(arr, i) || Rect_nonIterableRest(); } function Rect_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function Rect_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Rect_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Rect_arrayLikeToArray(o, minLen); } function Rect_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function Rect_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function Rect_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // TODO: 默认样式引入 function Rect(props) { var x = props.x, y = props.y, width = props.width, height = props.height, className = props.className, radius = props.radius; var leftTopX = x - width / 2; var leftTopY = y - height / 2; var attrs = {}; Object.entries(props).forEach(function (_ref) { var _ref2 = Rect_slicedToArray(_ref, 2), k = _ref2[0], v = _ref2[1]; var valueType = Rect_typeof(v); if (valueType !== 'object') { attrs[k] = v; } }); if (className) { attrs.className = "lf-basic-shape ".concat(className); } else { attrs.className = 'lf-basic-shape'; } if (radius) { attrs.rx = radius; attrs.ry = radius; } attrs.x = leftTopX; attrs.y = leftTopY; return Object(preact_module["g" /* h */])("rect", attrs); } Rect.defaultProps = { className: '', radius: '' }; // CONCATENATED MODULE: ./src/view/overlay/OutlineOverlay.tsx function OutlineOverlay_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { OutlineOverlay_typeof = function _typeof(obj) { return typeof obj; }; } else { OutlineOverlay_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return OutlineOverlay_typeof(obj); } var OutlineOverlay_class; function OutlineOverlay_extends() { OutlineOverlay_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return OutlineOverlay_extends.apply(this, arguments); } function OutlineOverlay_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function OutlineOverlay_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { OutlineOverlay_ownKeys(Object(source), true).forEach(function (key) { OutlineOverlay_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { OutlineOverlay_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function OutlineOverlay_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function OutlineOverlay_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function OutlineOverlay_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function OutlineOverlay_createClass(Constructor, protoProps, staticProps) { if (protoProps) OutlineOverlay_defineProperties(Constructor.prototype, protoProps); if (staticProps) OutlineOverlay_defineProperties(Constructor, staticProps); return Constructor; } function OutlineOverlay_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) OutlineOverlay_setPrototypeOf(subClass, superClass); } function OutlineOverlay_setPrototypeOf(o, p) { OutlineOverlay_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return OutlineOverlay_setPrototypeOf(o, p); } function OutlineOverlay_createSuper(Derived) { var hasNativeReflectConstruct = OutlineOverlay_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = OutlineOverlay_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = OutlineOverlay_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return OutlineOverlay_possibleConstructorReturn(this, result); }; } function OutlineOverlay_possibleConstructorReturn(self, call) { if (call && (OutlineOverlay_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return OutlineOverlay_assertThisInitialized(self); } function OutlineOverlay_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function OutlineOverlay_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function OutlineOverlay_getPrototypeOf(o) { OutlineOverlay_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return OutlineOverlay_getPrototypeOf(o); } var OutlineOverlay_OutlineOverlay = src_observer(OutlineOverlay_class = /*#__PURE__*/function (_Component) { OutlineOverlay_inherits(OutlineOverlay, _Component); var _super = OutlineOverlay_createSuper(OutlineOverlay); function OutlineOverlay() { OutlineOverlay_classCallCheck(this, OutlineOverlay); return _super.apply(this, arguments); } OutlineOverlay_createClass(OutlineOverlay, [{ key: "getNodesOutline", value: // 节点outline function getNodesOutline() { var graphModel = this.props.graphModel; var nodes = graphModel.nodes, _graphModel$editConfi = graphModel.editConfigModel, hoverOutline = _graphModel$editConfi.hoverOutline, nodeSelectedOutline = _graphModel$editConfi.nodeSelectedOutline; var nodeOutline = []; nodes.forEach(function (element) { if (element.isHovered || element.isSelected) { var isHovered = element.isHovered, isSelected = element.isSelected, x = element.x, y = element.y, width = element.width, height = element.height; if (nodeSelectedOutline && isSelected || hoverOutline && isHovered) { var style = element.getOutlineStyle(); var attributes = {}; Object.keys(style).forEach(function (key) { if (key !== 'hover') { attributes[key] = style[key]; } }); if (isHovered) { var hoverStyle = style.hover; attributes = OutlineOverlay_objectSpread(OutlineOverlay_objectSpread({}, attributes), hoverStyle); } nodeOutline.push(Object(preact_module["g" /* h */])(Rect, OutlineOverlay_extends({ className: "lf-outline-node", x: x, y: y, width: width + 10, height: height + 10 }, attributes))); } } }); return nodeOutline; } // 边的outline }, { key: "getEdgeOutline", value: function getEdgeOutline() { var _this$props$graphMode = this.props.graphModel, edgeList = _this$props$graphMode.edges, _this$props$graphMode2 = _this$props$graphMode.editConfigModel, edgeSelectedOutline = _this$props$graphMode2.edgeSelectedOutline, hoverOutline = _this$props$graphMode2.hoverOutline; var edgeOutline = []; for (var i = 0; i < edgeList.length; i++) { var edge = edgeList[i]; if (edgeSelectedOutline && edge.isSelected || hoverOutline && edge.isHovered) { if (edge.modelType === ModelType.LINE_EDGE) { edgeOutline.push(this.getLineOutline(edge)); } else if (edge.modelType === ModelType.POLYLINE_EDGE) { edgeOutline.push(this.getPolylineOutline(edge)); } else if (edge.modelType === ModelType.BEZIER_EDGE) { edgeOutline.push(this.getBezierOutline(edge)); } } } return edgeOutline; } // 直线outline }, { key: "getLineOutline", value: function getLineOutline(line) { var startPoint = line.startPoint, endPoint = line.endPoint; var x = (startPoint.x + endPoint.x) / 2; var y = (startPoint.y + endPoint.y) / 2; var width = Math.abs(startPoint.x - endPoint.x) + 10; var height = Math.abs(startPoint.y - endPoint.y) + 10; var style = line.getOutlineStyle(); return Object(preact_module["g" /* h */])(Rect, OutlineOverlay_extends({ className: "lf-outline-edge", x: x, y: y, width: width, height: height }, style)); } // 折线outline }, { key: "getPolylineOutline", value: function getPolylineOutline(polyline) { var points = polyline.points; var pointsList = points2PointsList(points); var bbox = getBBoxOfPoints(pointsList, 8); var x = bbox.x, y = bbox.y, width = bbox.width, height = bbox.height; var style = polyline.getOutlineStyle(); return Object(preact_module["g" /* h */])(Rect, OutlineOverlay_extends({ className: "lf-outline", x: x, y: y, width: width, height: height }, style)); } // 曲线outline }, { key: "getBezierOutline", value: function getBezierOutline(bezier) { var path = bezier.path; var pointsList = getBezierPoints(path); var bbox = getBBoxOfPoints(pointsList, 8); var x = bbox.x, y = bbox.y, width = bbox.width, height = bbox.height; var style = bezier.getOutlineStyle(); return Object(preact_module["g" /* h */])(Rect, OutlineOverlay_extends({ className: "lf-outline", x: x, y: y, width: width, height: height }, style)); } }, { key: "render", value: function render() { return Object(preact_module["g" /* h */])("g", { className: "lf-outline" }, this.getNodesOutline(), this.getEdgeOutline()); } }]); return OutlineOverlay; }(preact_module["a" /* Component */])) || OutlineOverlay_class; // CONCATENATED MODULE: ./src/view/basic-shape/Circle.tsx function Circle_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Circle_typeof = function _typeof(obj) { return typeof obj; }; } else { Circle_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Circle_typeof(obj); } function Circle_slicedToArray(arr, i) { return Circle_arrayWithHoles(arr) || Circle_iterableToArrayLimit(arr, i) || Circle_unsupportedIterableToArray(arr, i) || Circle_nonIterableRest(); } function Circle_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function Circle_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Circle_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Circle_arrayLikeToArray(o, minLen); } function Circle_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function Circle_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function Circle_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function Circle(props) { var _props$x = props.x, x = _props$x === void 0 ? 0 : _props$x, _props$y = props.y, y = _props$y === void 0 ? 0 : _props$y, _props$r = props.r, r = _props$r === void 0 ? 4 : _props$r, className = props.className; var attrs = { cx: x, cy: y, r: r, fill: 'transparent', fillOpacity: 1, strokeWidth: '1', stroke: '#000', strokeOpacity: 1 }; Object.entries(props).forEach(function (_ref) { var _ref2 = Circle_slicedToArray(_ref, 2), k = _ref2[0], v = _ref2[1]; var valueType = Circle_typeof(v); if (valueType !== 'object') { attrs[k] = v; } }); if (className) { attrs.className = "lf-basic-shape ".concat(className); } else { attrs.className = 'lf-basic-shape'; } return Object(preact_module["g" /* h */])("circle", attrs); } // CONCATENATED MODULE: ./src/view/overlay/BezierAdjustOverlay.tsx function BezierAdjustOverlay_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { BezierAdjustOverlay_typeof = function _typeof(obj) { return typeof obj; }; } else { BezierAdjustOverlay_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return BezierAdjustOverlay_typeof(obj); } var BezierAdjustOverlay_class; function BezierAdjustOverlay_slicedToArray(arr, i) { return BezierAdjustOverlay_arrayWithHoles(arr) || BezierAdjustOverlay_iterableToArrayLimit(arr, i) || BezierAdjustOverlay_unsupportedIterableToArray(arr, i) || BezierAdjustOverlay_nonIterableRest(); } function BezierAdjustOverlay_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function BezierAdjustOverlay_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return BezierAdjustOverlay_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return BezierAdjustOverlay_arrayLikeToArray(o, minLen); } function BezierAdjustOverlay_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function BezierAdjustOverlay_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function BezierAdjustOverlay_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function BezierAdjustOverlay_extends() { BezierAdjustOverlay_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return BezierAdjustOverlay_extends.apply(this, arguments); } function BezierAdjustOverlay_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function BezierAdjustOverlay_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function BezierAdjustOverlay_createClass(Constructor, protoProps, staticProps) { if (protoProps) BezierAdjustOverlay_defineProperties(Constructor.prototype, protoProps); if (staticProps) BezierAdjustOverlay_defineProperties(Constructor, staticProps); return Constructor; } function BezierAdjustOverlay_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) BezierAdjustOverlay_setPrototypeOf(subClass, superClass); } function BezierAdjustOverlay_setPrototypeOf(o, p) { BezierAdjustOverlay_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return BezierAdjustOverlay_setPrototypeOf(o, p); } function BezierAdjustOverlay_createSuper(Derived) { var hasNativeReflectConstruct = BezierAdjustOverlay_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = BezierAdjustOverlay_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = BezierAdjustOverlay_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return BezierAdjustOverlay_possibleConstructorReturn(this, result); }; } function BezierAdjustOverlay_possibleConstructorReturn(self, call) { if (call && (BezierAdjustOverlay_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return BezierAdjustOverlay_assertThisInitialized(self); } function BezierAdjustOverlay_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function BezierAdjustOverlay_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function BezierAdjustOverlay_getPrototypeOf(o) { BezierAdjustOverlay_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return BezierAdjustOverlay_getPrototypeOf(o); } function BezierAdjustOverlay_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // bezier曲线的可调整锚点 var BezierAdjustOverlay_BezierAdjustAnchor = /*#__PURE__*/function (_Component) { BezierAdjustOverlay_inherits(BezierAdjustAnchor, _Component); var _super = BezierAdjustOverlay_createSuper(BezierAdjustAnchor); function BezierAdjustAnchor() { var _this; BezierAdjustOverlay_classCallCheck(this, BezierAdjustAnchor); _this = _super.call(this); BezierAdjustOverlay_defineProperty(BezierAdjustOverlay_assertThisInitialized(_this), "dragHandler", void 0); BezierAdjustOverlay_defineProperty(BezierAdjustOverlay_assertThisInitialized(_this), "onDragging", function (_ref) { var event = _ref.event; var _this$props = _this.props, graphModel = _this$props.graphModel, bezierModel = _this$props.bezierModel, type = _this$props.type; var _graphModel$getPointB = graphModel.getPointByClient({ x: event.clientX, y: event.clientY }), _graphModel$getPointB2 = _graphModel$getPointB.canvasOverlayPosition, x = _graphModel$getPointB2.x, y = _graphModel$getPointB2.y; bezierModel.updateAdjustAnchor({ x: x, y: y }, type); }); BezierAdjustOverlay_defineProperty(BezierAdjustOverlay_assertThisInitialized(_this), "onDragEnd", function () { var bezierModel = _this.props.bezierModel; bezierModel.isDragging = false; }); _this.dragHandler = new drag_StepDrag({ onDragging: _this.onDragging, onDragEnd: _this.onDragEnd }); return _this; } BezierAdjustOverlay_createClass(BezierAdjustAnchor, [{ key: "render", value: function render() { var _this2 = this; var position = this.props.position; var x = position.x, y = position.y; var bezierModel = this.props.bezierModel; var _bezierModel$getEdgeS = bezierModel.getEdgeStyle(), adjustAnchor = _bezierModel$getEdgeS.adjustAnchor; return Object(preact_module["g" /* h */])(Circle, BezierAdjustOverlay_extends({ className: "lf-bezier-adjust-anchor", x: x, y: y }, adjustAnchor, { onMouseDown: function onMouseDown(ev) { // if (edgeAddable !== false) { _this2.dragHandler.handleMouseDown(ev); // } } })); } }]); return BezierAdjustAnchor; }(preact_module["a" /* Component */]); var BezierAdjustOverlay_BezierAdjustOverlay = src_observer(BezierAdjustOverlay_class = /*#__PURE__*/function (_Component2) { BezierAdjustOverlay_inherits(BezierAdjustOverlay, _Component2); var _super2 = BezierAdjustOverlay_createSuper(BezierAdjustOverlay); function BezierAdjustOverlay() { BezierAdjustOverlay_classCallCheck(this, BezierAdjustOverlay); return _super2.apply(this, arguments); } BezierAdjustOverlay_createClass(BezierAdjustOverlay, [{ key: "getBezierAdjust", value: function getBezierAdjust(bezier, graphModel) { var path = bezier.path, id = bezier.id; var pointsList = getBezierPoints(path); var _pointsList = BezierAdjustOverlay_slicedToArray(pointsList, 4), start = _pointsList[0], sNext = _pointsList[1], ePre = _pointsList[2], end = _pointsList[3]; var _bezier$getEdgeStyle = bezier.getEdgeStyle(), adjustLine = _bezier$getEdgeStyle.adjustLine; var result = []; result.push(Object(preact_module["g" /* h */])(basic_shape_Line, BezierAdjustOverlay_extends({ x1: start.x, y1: start.y, x2: sNext.x, y2: sNext.y }, adjustLine))); result.push(Object(preact_module["g" /* h */])(BezierAdjustOverlay_BezierAdjustAnchor, { position: sNext, bezierModel: bezier, graphModel: graphModel, key: "".concat(id, "_ePre"), type: "sNext" })); result.push(Object(preact_module["g" /* h */])(basic_shape_Line, BezierAdjustOverlay_extends({ x1: end.x, y1: end.y, x2: ePre.x, y2: ePre.y }, adjustLine))); result.push(Object(preact_module["g" /* h */])(BezierAdjustOverlay_BezierAdjustAnchor, { position: ePre, bezierModel: bezier, graphModel: graphModel, key: "".concat(id, "_sNext"), type: "ePre" })); return result; } // 获取选中bezier曲线,调整操作线和锚点 }, { key: "selectedBezierEdge", value: function selectedBezierEdge() { var graphModel = this.props.graphModel; var edgeList = graphModel.edges; var edgeAdjust = []; for (var i = 0; i < edgeList.length; i++) { var edge = edgeList[i]; if (edge.isSelected && edge.modelType === ModelType.BEZIER_EDGE && edge.draggable) { edgeAdjust.push(this.getBezierAdjust(edge, graphModel)); } } return edgeAdjust; } }, { key: "render", value: function render() { return Object(preact_module["g" /* h */])("g", { className: "lf-bezier-adjust" }, this.selectedBezierEdge()); } }]); return BezierAdjustOverlay; }(preact_module["a" /* Component */])) || BezierAdjustOverlay_class; // CONCATENATED MODULE: ./src/view/overlay/ModificationOverlay.tsx function ModificationOverlay_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ModificationOverlay_typeof = function _typeof(obj) { return typeof obj; }; } else { ModificationOverlay_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ModificationOverlay_typeof(obj); } var ModificationOverlay_class; function ModificationOverlay_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ModificationOverlay_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function ModificationOverlay_createClass(Constructor, protoProps, staticProps) { if (protoProps) ModificationOverlay_defineProperties(Constructor.prototype, protoProps); if (staticProps) ModificationOverlay_defineProperties(Constructor, staticProps); return Constructor; } function ModificationOverlay_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ModificationOverlay_setPrototypeOf(subClass, superClass); } function ModificationOverlay_setPrototypeOf(o, p) { ModificationOverlay_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ModificationOverlay_setPrototypeOf(o, p); } function ModificationOverlay_createSuper(Derived) { var hasNativeReflectConstruct = ModificationOverlay_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = ModificationOverlay_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = ModificationOverlay_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return ModificationOverlay_possibleConstructorReturn(this, result); }; } function ModificationOverlay_possibleConstructorReturn(self, call) { if (call && (ModificationOverlay_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return ModificationOverlay_assertThisInitialized(self); } function ModificationOverlay_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function ModificationOverlay_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function ModificationOverlay_getPrototypeOf(o) { ModificationOverlay_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ModificationOverlay_getPrototypeOf(o); } var ModificationOverlay_ModificationOverlay = src_observer(ModificationOverlay_class = /*#__PURE__*/function (_Component) { ModificationOverlay_inherits(ModificationOverlay, _Component); var _super = ModificationOverlay_createSuper(ModificationOverlay); function ModificationOverlay() { ModificationOverlay_classCallCheck(this, ModificationOverlay); return _super.apply(this, arguments); } ModificationOverlay_createClass(ModificationOverlay, [{ key: "render", value: function render() { var transformModel = this.props.graphModel.transformModel; var _transformModel$getTr = transformModel.getTransformStyle(), transform = _transformModel$getTr.transform; var children = this.props.children; return Object(preact_module["g" /* h */])("svg", { xmlns: "http://www.w3.org/2000/svg", version: "1.1", width: "100%", height: "100%", className: "modification-overlay" }, Object(preact_module["g" /* h */])("g", { transform: transform }, children)); } }]); return ModificationOverlay; }(preact_module["a" /* Component */])) || ModificationOverlay_class; // CONCATENATED MODULE: ./src/view/Graph.tsx function Graph_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Graph_typeof = function _typeof(obj) { return typeof obj; }; } else { Graph_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Graph_typeof(obj); } var Graph_class; function Graph_extends() { Graph_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Graph_extends.apply(this, arguments); } function Graph_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function Graph_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function Graph_createClass(Constructor, protoProps, staticProps) { if (protoProps) Graph_defineProperties(Constructor.prototype, protoProps); if (staticProps) Graph_defineProperties(Constructor, staticProps); return Constructor; } function Graph_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Graph_setPrototypeOf(subClass, superClass); } function Graph_setPrototypeOf(o, p) { Graph_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Graph_setPrototypeOf(o, p); } function Graph_createSuper(Derived) { var hasNativeReflectConstruct = Graph_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Graph_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Graph_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Graph_possibleConstructorReturn(this, result); }; } function Graph_possibleConstructorReturn(self, call) { if (call && (Graph_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Graph_assertThisInitialized(self); } function Graph_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function Graph_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function Graph_getPrototypeOf(o) { Graph_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Graph_getPrototypeOf(o); } // import { inject } from 'mobx-react'; // todo: fixme type // @ts-ignore var Graph_Graph = src_observer(Graph_class = /*#__PURE__*/function (_Component) { Graph_inherits(Graph, _Component); var _super = Graph_createSuper(Graph); function Graph() { Graph_classCallCheck(this, Graph); return _super.apply(this, arguments); } Graph_createClass(Graph, [{ key: "getComponent", value: // get InjectedProps() { // return this.props as InjectedProps; // } function getComponent(model, graphModel) { var overlay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'canvas-overlay'; var getView = this.props.getView; var View = getView(model.type); return Object(preact_module["g" /* h */])(View, { key: model.id, model: model, graphModel: graphModel, overlay: overlay }); } }, { key: "render", value: function render() { var _this = this; var _this$props = this.props, graphModel = _this$props.graphModel, tool = _this$props.tool, options = _this$props.options, dnd = _this$props.dnd, snaplineModel = _this$props.snaplineModel; var style = {}; // 如果初始化的时候,不传宽高,则默认为父容器宽高。 if (options.width) { style.width = "".concat(graphModel.width, "px"); } if (options.height) { style.height = "".concat(graphModel.height, "px"); } var grid = options.grid; var fakerNode = graphModel.fakerNode, editConfigModel = graphModel.editConfigModel; var adjustEdge = editConfigModel.adjustEdge; return Object(preact_module["g" /* h */])("div", { className: "lf-graph", "flow-id": graphModel.flowId, style: style }, Object(preact_module["g" /* h */])(overlay_CanvasOverlay, { graphModel: graphModel, dnd: dnd }, Object(preact_module["g" /* h */])("g", { className: "lf-base" }, lodash_es_map(graphModel.sortElements, function (nodeModel) { return _this.getComponent(nodeModel, graphModel); })), fakerNode ? this.getComponent(fakerNode, graphModel) : ''), Object(preact_module["g" /* h */])(ModificationOverlay_ModificationOverlay, { graphModel: graphModel }, Object(preact_module["g" /* h */])(OutlineOverlay_OutlineOverlay, { graphModel: graphModel }), adjustEdge ? Object(preact_module["g" /* h */])(BezierAdjustOverlay_BezierAdjustOverlay, { graphModel: graphModel }) : '', options.snapline !== false ? Object(preact_module["g" /* h */])(SnaplineOverlay_SnaplineOverlay, { snaplineModel: snaplineModel }) : ''), Object(preact_module["g" /* h */])(ToolOverlay_ToolOverlay, { graphModel: graphModel, tool: tool }), options.background && Object(preact_module["g" /* h */])(BackgroundOverlay_BackgroundOverlay, { background: options.background }), options.grid && Object(preact_module["g" /* h */])(Grid_Grid, Graph_extends({}, grid, { graphModel: graphModel }))); } }]); return Graph; }(preact_module["a" /* Component */])) || Graph_class; /* harmony default export */ var view_Graph = (Graph_Graph); // CONCATENATED MODULE: ./src/view/behavior/DnD.ts function DnD_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function DnD_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { DnD_ownKeys(Object(source), true).forEach(function (key) { DnD_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { DnD_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function DnD_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function DnD_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function DnD_createClass(Constructor, protoProps, staticProps) { if (protoProps) DnD_defineProperties(Constructor.prototype, protoProps); if (staticProps) DnD_defineProperties(Constructor, staticProps); return Constructor; } function DnD_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // import LogicFlow, { BaseNodeModel } from '../../LogicFlow'; var DnD_Dnd = /*#__PURE__*/function () { function Dnd(params) { var _this = this; DnD_classCallCheck(this, Dnd); DnD_defineProperty(this, "nodeConfig", void 0); DnD_defineProperty(this, "lf", void 0); DnD_defineProperty(this, "fakerNode", void 0); DnD_defineProperty(this, "stopDrag", function () { _this.nodeConfig = null; window.document.removeEventListener('mouseup', _this.stopDrag); }); DnD_defineProperty(this, "dragEnter", function (e) { if (!_this.nodeConfig || _this.fakerNode) return; _this.fakerNode = _this.lf.createFakerNode(DnD_objectSpread(DnD_objectSpread({}, _this.nodeConfig), _this.clientToLocalPoint({ x: e.clientX, y: e.clientY }))); }); DnD_defineProperty(this, "onDragOver", function (e) { e.preventDefault(); if (_this.fakerNode) { var _this$clientToLocalPo = _this.clientToLocalPoint({ x: e.clientX, y: e.clientY }), x = _this$clientToLocalPo.x, y = _this$clientToLocalPo.y; _this.fakerNode.moveTo(x, y); var nodeData = _this.fakerNode.getData(); _this.lf.setNodeSnapLine(nodeData); _this.lf.graphModel.eventCenter.emit(EventType.NODE_DND_DRAG, { data: nodeData }); } return false; }); DnD_defineProperty(this, "onDragLeave", function () { if (_this.fakerNode) { _this.lf.removeNodeSnapLine(); _this.lf.graphModel.removeFakerNode(); _this.fakerNode = null; } }); DnD_defineProperty(this, "onDrop", function (e) { if (!_this.lf.graphModel || !e || !_this.nodeConfig) { return; } var currentNode = _this.lf.addNode(DnD_objectSpread(DnD_objectSpread({}, _this.nodeConfig), _this.clientToLocalPoint({ x: e.clientX, y: e.clientY })), EventType.NODE_DND_ADD); e.preventDefault(); e.stopPropagation(); _this.nodeConfig = null; _this.lf.removeNodeSnapLine(); _this.lf.graphModel.removeFakerNode(); _this.fakerNode = null; var nodeData = currentNode.getData(); // this.lf.graphModel.eventCenter.emit(EventType.NODE_DND_ADD, { // data: nodeData, // e, // }); }); var lf = params.lf; this.lf = lf; } DnD_createClass(Dnd, [{ key: "clientToLocalPoint", value: function clientToLocalPoint(_ref) { var x = _ref.x, y = _ref.y; var gridSize = lodash_es_get(this.lf.options, ['grid', 'size']); // 处理 container 的 offset 等 var position = this.lf.graphModel.getPointByClient({ x: x, y: y }); // 处理缩放和偏移 var _position$canvasOverl = position.canvasOverlayPosition, x1 = _position$canvasOverl.x, y1 = _position$canvasOverl.y; // x, y 对齐到网格的 size return { x: snapToGrid(x1, gridSize), y: snapToGrid(y1, gridSize) }; } }, { key: "startDrag", value: function startDrag(nodeConfig) { this.nodeConfig = nodeConfig; window.document.addEventListener('mouseup', this.stopDrag); } }, { key: "eventMap", value: function eventMap() { return { onMouseEnter: this.dragEnter, onMouseOver: this.dragEnter, // IE11 onMouseMove: this.onDragOver, onMouseLeave: this.onDragLeave, // onMouseOut: this.onDragLeave, // IE11 onMouseUp: this.onDrop }; } }]); return Dnd; }(); // CONCATENATED MODULE: ./src/options.ts // 用来获取用户传入的 options,并做一些容错和异常抛出 function options_get(options) { var container = options.container, grid = options.grid, width = options.width, height = options.height; if (!container) { throw new Error('请检查 container 参数是否有效'); } if (typeof width === 'string' || typeof height === 'string') { throw new Error('width或height不支持传入字符串,请传数字'); } if (grid) { options.grid = lodash_es_assign({ size: 20, type: 'dot', visible: true, config: { color: '#ababab', thickness: 1 } }, grid); } return lodash_es_assign({}, defaults, options); } // 默认 options var defaults = { background: false, grid: false, textEdit: true, disabledTools: [] }; // CONCATENATED MODULE: ./src/model/edge/BezierEdgeModel.ts function BezierEdgeModel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { BezierEdgeModel_typeof = function _typeof(obj) { return typeof obj; }; } else { BezierEdgeModel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return BezierEdgeModel_typeof(obj); } var BezierEdgeModel_class, BezierEdgeModel_descriptor; function BezierEdgeModel_slicedToArray(arr, i) { return BezierEdgeModel_arrayWithHoles(arr) || BezierEdgeModel_iterableToArrayLimit(arr, i) || BezierEdgeModel_unsupportedIterableToArray(arr, i) || BezierEdgeModel_nonIterableRest(); } function BezierEdgeModel_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function BezierEdgeModel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return BezierEdgeModel_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return BezierEdgeModel_arrayLikeToArray(o, minLen); } function BezierEdgeModel_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function BezierEdgeModel_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function BezierEdgeModel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function BezierEdgeModel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function BezierEdgeModel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { BezierEdgeModel_ownKeys(Object(source), true).forEach(function (key) { BezierEdgeModel_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { BezierEdgeModel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function BezierEdgeModel_initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function BezierEdgeModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function BezierEdgeModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function BezierEdgeModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) BezierEdgeModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) BezierEdgeModel_defineProperties(Constructor, staticProps); return Constructor; } function BezierEdgeModel_get() { if (typeof Reflect !== "undefined" && Reflect.get) { BezierEdgeModel_get = Reflect.get; } else { BezierEdgeModel_get = function _get(target, property, receiver) { var base = BezierEdgeModel_superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return BezierEdgeModel_get.apply(this, arguments); } function BezierEdgeModel_superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = BezierEdgeModel_getPrototypeOf(object); if (object === null) break; } return object; } function BezierEdgeModel_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) BezierEdgeModel_setPrototypeOf(subClass, superClass); } function BezierEdgeModel_setPrototypeOf(o, p) { BezierEdgeModel_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return BezierEdgeModel_setPrototypeOf(o, p); } function BezierEdgeModel_createSuper(Derived) { var hasNativeReflectConstruct = BezierEdgeModel_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = BezierEdgeModel_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = BezierEdgeModel_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return BezierEdgeModel_possibleConstructorReturn(this, result); }; } function BezierEdgeModel_possibleConstructorReturn(self, call) { if (call && (BezierEdgeModel_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return BezierEdgeModel_assertThisInitialized(self); } function BezierEdgeModel_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function BezierEdgeModel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function BezierEdgeModel_getPrototypeOf(o) { BezierEdgeModel_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return BezierEdgeModel_getPrototypeOf(o); } function BezierEdgeModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function BezierEdgeModel_applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function BezierEdgeModel_initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } var BezierEdgeModel_BezierEdgeModel = (BezierEdgeModel_class = /*#__PURE__*/function (_BaseEdgeModel) { BezierEdgeModel_inherits(BezierEdgeModel, _BaseEdgeModel); var _super = BezierEdgeModel_createSuper(BezierEdgeModel); function BezierEdgeModel() { var _this; BezierEdgeModel_classCallCheck(this, BezierEdgeModel); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); BezierEdgeModel_defineProperty(BezierEdgeModel_assertThisInitialized(_this), "modelType", ModelType.BEZIER_EDGE); BezierEdgeModel_initializerDefineProperty(BezierEdgeModel_assertThisInitialized(_this), "path", BezierEdgeModel_descriptor, BezierEdgeModel_assertThisInitialized(_this)); return _this; } BezierEdgeModel_createClass(BezierEdgeModel, [{ key: "initEdgeData", value: function initEdgeData(data) { this.offset = 100; BezierEdgeModel_get(BezierEdgeModel_getPrototypeOf(BezierEdgeModel.prototype), "initEdgeData", this).call(this, data); } }, { key: "getEdgeStyle", value: function getEdgeStyle() { var bezier = this.graphModel.theme.bezier; var style = BezierEdgeModel_get(BezierEdgeModel_getPrototypeOf(BezierEdgeModel.prototype), "getEdgeStyle", this).call(this); return BezierEdgeModel_objectSpread(BezierEdgeModel_objectSpread({}, style), lodash_es_cloneDeep(bezier)); } }, { key: "getTextPosition", value: function getTextPosition() { if (this.pointsList && this.pointsList.length > 0) { var pointsXSum = 0; var pointsYSum = 0; this.pointsList.forEach(function (_ref) { var x = _ref.x, y = _ref.y; pointsXSum += x; pointsYSum += y; }); return { x: pointsXSum / this.pointsList.length, y: pointsYSum / this.pointsList.length }; } return { x: (this.startPoint.x + this.endPoint.x) / 2, y: (this.startPoint.y + this.endPoint.y) / 2 }; } }, { key: "getData", value: function getData() { var data = BezierEdgeModel_get(BezierEdgeModel_getPrototypeOf(BezierEdgeModel.prototype), "getData", this).call(this); var pointsList = this.pointsList.map(function (_ref2) { var x = _ref2.x, y = _ref2.y; return { x: x, y: y }; }); return BezierEdgeModel_objectSpread(BezierEdgeModel_objectSpread({}, data), {}, { pointsList: pointsList }); } /* 获取贝塞尔曲线的控制点 */ }, { key: "getControls", value: function getControls() { var start = this.startPoint; var end = this.endPoint; var points = edge_getBezierControlPoints({ start: start, end: end, sourceNode: this.sourceNode, targetNode: this.targetNode, offset: this.offset }); return points; } /* 获取贝塞尔曲线的path */ }, { key: "getPath", value: function getPath(points) { var _points = BezierEdgeModel_slicedToArray(points, 4), start = _points[0], sNext = _points[1], ePre = _points[2], end = _points[3]; return "M ".concat(start.x, " ").concat(start.y, "\n C ").concat(sNext.x, " ").concat(sNext.y, ",\n ").concat(ePre.x, " ").concat(ePre.y, ",\n ").concat(end.x, " ").concat(end.y); } }, { key: "initPoints", value: function initPoints() { if (this.pointsList.length > 0) { this.path = this.getPath(this.pointsList); } else { this.updatePoints(); } } }, { key: "updatePoints", value: function updatePoints() { var _this$getControls = this.getControls(), sNext = _this$getControls.sNext, ePre = _this$getControls.ePre; this.updatePath(sNext, ePre); } }, { key: "updatePath", value: function updatePath(sNext, ePre) { var start = { x: this.startPoint.x, y: this.startPoint.y }; var end = { x: this.endPoint.x, y: this.endPoint.y }; if (!sNext || !ePre) { var control = this.getControls(); sNext = control.sNext; ePre = control.ePre; } this.pointsList = [start, sNext, ePre, end]; this.path = this.getPath(this.pointsList); } }, { key: "updateStartPoint", value: function updateStartPoint(anchor) { this.startPoint = anchor; this.updatePoints(); } }, { key: "updateEndPoint", value: function updateEndPoint(anchor) { this.endPoint = anchor; this.updatePoints(); } }, { key: "moveStartPoint", value: function moveStartPoint(deltaX, deltaY) { this.startPoint.x += deltaX; this.startPoint.y += deltaY; var _this$pointsList = BezierEdgeModel_slicedToArray(this.pointsList, 3), sNext = _this$pointsList[1], ePre = _this$pointsList[2]; // 保持调整点一起移动 sNext.x += deltaX; sNext.y += deltaY; this.updatePath(sNext, ePre); } }, { key: "moveEndPoint", value: function moveEndPoint(deltaX, deltaY) { this.endPoint.x += deltaX; this.endPoint.y += deltaY; var _this$pointsList2 = BezierEdgeModel_slicedToArray(this.pointsList, 3), sNext = _this$pointsList2[1], ePre = _this$pointsList2[2]; // 保持调整点一起移动 ePre.x += deltaX; ePre.y += deltaY; this.updatePath(sNext, ePre); } }, { key: "updateAdjustAnchor", value: function updateAdjustAnchor(anchor, type) { if (type === 'sNext') { this.pointsList[1] = anchor; } else if (type === 'ePre') { this.pointsList[2] = anchor; } this.path = this.getPath(this.pointsList); this.setText(Object.assign({}, this.text, this.textPosition)); } // 获取边调整的起点 }, { key: "getAdjustStart", value: function getAdjustStart() { return this.pointsList[0] || this.startPoint; } // 获取边调整的终点 }, { key: "getAdjustEnd", value: function getAdjustEnd() { var pointsList = this.pointsList; return pointsList[pointsList.length - 1] || this.endPoint; } // 起终点拖拽调整过程中,进行曲线路径更新 }, { key: "updateAfterAdjustStartAndEnd", value: function updateAfterAdjustStartAndEnd(_ref3) { var startPoint = _ref3.startPoint, endPoint = _ref3.endPoint, sourceNode = _ref3.sourceNode, targetNode = _ref3.targetNode; var _getBezierControlPoin = edge_getBezierControlPoints({ start: startPoint, end: endPoint, sourceNode: sourceNode, targetNode: targetNode, offset: this.offset }), sNext = _getBezierControlPoin.sNext, ePre = _getBezierControlPoin.ePre; this.pointsList = [startPoint, sNext, ePre, endPoint]; this.initPoints(); } }]); return BezierEdgeModel; }(edge_BaseEdgeModel), (BezierEdgeModel_descriptor = BezierEdgeModel_applyDecoratedDescriptor(BezierEdgeModel_class.prototype, "path", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return ''; } }), BezierEdgeModel_applyDecoratedDescriptor(BezierEdgeModel_class.prototype, "initPoints", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BezierEdgeModel_class.prototype, "initPoints"), BezierEdgeModel_class.prototype), BezierEdgeModel_applyDecoratedDescriptor(BezierEdgeModel_class.prototype, "updatePoints", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BezierEdgeModel_class.prototype, "updatePoints"), BezierEdgeModel_class.prototype), BezierEdgeModel_applyDecoratedDescriptor(BezierEdgeModel_class.prototype, "updateStartPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BezierEdgeModel_class.prototype, "updateStartPoint"), BezierEdgeModel_class.prototype), BezierEdgeModel_applyDecoratedDescriptor(BezierEdgeModel_class.prototype, "updateEndPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BezierEdgeModel_class.prototype, "updateEndPoint"), BezierEdgeModel_class.prototype), BezierEdgeModel_applyDecoratedDescriptor(BezierEdgeModel_class.prototype, "moveStartPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BezierEdgeModel_class.prototype, "moveStartPoint"), BezierEdgeModel_class.prototype), BezierEdgeModel_applyDecoratedDescriptor(BezierEdgeModel_class.prototype, "moveEndPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BezierEdgeModel_class.prototype, "moveEndPoint"), BezierEdgeModel_class.prototype), BezierEdgeModel_applyDecoratedDescriptor(BezierEdgeModel_class.prototype, "updateAdjustAnchor", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BezierEdgeModel_class.prototype, "updateAdjustAnchor"), BezierEdgeModel_class.prototype), BezierEdgeModel_applyDecoratedDescriptor(BezierEdgeModel_class.prototype, "getAdjustStart", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BezierEdgeModel_class.prototype, "getAdjustStart"), BezierEdgeModel_class.prototype), BezierEdgeModel_applyDecoratedDescriptor(BezierEdgeModel_class.prototype, "getAdjustEnd", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BezierEdgeModel_class.prototype, "getAdjustEnd"), BezierEdgeModel_class.prototype), BezierEdgeModel_applyDecoratedDescriptor(BezierEdgeModel_class.prototype, "updateAfterAdjustStartAndEnd", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BezierEdgeModel_class.prototype, "updateAfterAdjustStartAndEnd"), BezierEdgeModel_class.prototype)), BezierEdgeModel_class); // CONCATENATED MODULE: ./src/model/edge/index.ts // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isNil.js /** * Checks if `value` is `null` or `undefined`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is nullish, else `false`. * @example * * _.isNil(null); * // => true * * _.isNil(void 0); * // => true * * _.isNil(NaN); * // => false */ function isNil(value) { return value == null; } /* harmony default export */ var lodash_es_isNil = (isNil); // CONCATENATED MODULE: ./src/model/node/BaseNodeModel.ts var BaseNodeModel_class, BaseNodeModel_descriptor, BaseNodeModel_descriptor2, BaseNodeModel_descriptor3, BaseNodeModel_descriptor4, BaseNodeModel_descriptor5, BaseNodeModel_descriptor6, BaseNodeModel_descriptor7, BaseNodeModel_descriptor8, BaseNodeModel_descriptor9, BaseNodeModel_descriptor10, BaseNodeModel_descriptor11, BaseNodeModel_descriptor12, BaseNodeModel_descriptor13, BaseNodeModel_descriptor14, BaseNodeModel_descriptor15, BaseNodeModel_descriptor16, BaseNodeModel_descriptor17, BaseNodeModel_descriptor18, BaseNodeModel_descriptor19; function BaseNodeModel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { BaseNodeModel_typeof = function _typeof(obj) { return typeof obj; }; } else { BaseNodeModel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return BaseNodeModel_typeof(obj); } function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = BaseNodeModel_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } function BaseNodeModel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return BaseNodeModel_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return BaseNodeModel_arrayLikeToArray(o, minLen); } function BaseNodeModel_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function BaseNodeModel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function BaseNodeModel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { BaseNodeModel_ownKeys(Object(source), true).forEach(function (key) { BaseNodeModel_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { BaseNodeModel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function BaseNodeModel_initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function BaseNodeModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function BaseNodeModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function BaseNodeModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) BaseNodeModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) BaseNodeModel_defineProperties(Constructor, staticProps); return Constructor; } function BaseNodeModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function BaseNodeModel_applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function BaseNodeModel_initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } var BaseNodeModel_BaseNodeModel = (BaseNodeModel_class = /*#__PURE__*/function () { // 支持自定义 function BaseNodeModel(data, graphModel) { BaseNodeModel_classCallCheck(this, BaseNodeModel); BaseNodeModel_defineProperty(this, "id", ''); BaseNodeModel_initializerDefineProperty(this, "type", BaseNodeModel_descriptor, this); BaseNodeModel_initializerDefineProperty(this, "x", BaseNodeModel_descriptor2, this); BaseNodeModel_initializerDefineProperty(this, "y", BaseNodeModel_descriptor3, this); BaseNodeModel_initializerDefineProperty(this, "text", BaseNodeModel_descriptor4, this); BaseNodeModel_initializerDefineProperty(this, "properties", BaseNodeModel_descriptor5, this); BaseNodeModel_initializerDefineProperty(this, "_width", BaseNodeModel_descriptor6, this); BaseNodeModel_initializerDefineProperty(this, "_height", BaseNodeModel_descriptor7, this); BaseNodeModel_initializerDefineProperty(this, "anchorsOffset", BaseNodeModel_descriptor8, this); BaseNodeModel_initializerDefineProperty(this, "isSelected", BaseNodeModel_descriptor9, this); BaseNodeModel_initializerDefineProperty(this, "isHovered", BaseNodeModel_descriptor10, this); BaseNodeModel_initializerDefineProperty(this, "isShowAnchor", BaseNodeModel_descriptor11, this); BaseNodeModel_initializerDefineProperty(this, "isDragging", BaseNodeModel_descriptor12, this); BaseNodeModel_initializerDefineProperty(this, "isHitable", BaseNodeModel_descriptor13, this); BaseNodeModel_initializerDefineProperty(this, "draggable", BaseNodeModel_descriptor14, this); BaseNodeModel_initializerDefineProperty(this, "visible", BaseNodeModel_descriptor15, this); BaseNodeModel_defineProperty(this, "virtual", false); BaseNodeModel_defineProperty(this, "graphModel", void 0); BaseNodeModel_initializerDefineProperty(this, "zIndex", BaseNodeModel_descriptor16, this); BaseNodeModel_initializerDefineProperty(this, "state", BaseNodeModel_descriptor17, this); BaseNodeModel_initializerDefineProperty(this, "autoToFront", BaseNodeModel_descriptor18, this); BaseNodeModel_initializerDefineProperty(this, "style", BaseNodeModel_descriptor19, this); BaseNodeModel_defineProperty(this, "BaseType", ElementType.NODE); BaseNodeModel_defineProperty(this, "modelType", ModelType.NODE); BaseNodeModel_defineProperty(this, "additionStateData", void 0); BaseNodeModel_defineProperty(this, "targetRules", []); BaseNodeModel_defineProperty(this, "sourceRules", []); BaseNodeModel_defineProperty(this, "moveRules", []); BaseNodeModel_defineProperty(this, "hasSetTargetRules", false); BaseNodeModel_defineProperty(this, "hasSetSourceRules", false); this.graphModel = graphModel; this.initNodeData(data); this.setAttributes(); } /** * 获取进入当前节点的边和节点 */ BaseNodeModel_createClass(BaseNodeModel, [{ key: "width", get: // 数据属性 // 形状属性 function get() { return this._width; }, set: function set(value) { this._width = value; } }, { key: "height", get: function get() { return this._height; }, set: function set(value) { this._height = value; } }, { key: "incoming", get: function get() { return { nodes: this.graphModel.getNodeIncomingNode(this.id), edges: this.graphModel.getNodeIncomingEdge(this.id) }; } /* * 获取离开当前节点的边和节点 */ }, { key: "outgoing", get: function get() { return { nodes: this.graphModel.getNodeOutgoingNode(this.id), edges: this.graphModel.getNodeOutgoingEdge(this.id) }; } /** * @overridable 可以重写 * 初始化节点数据 * initNodeData和setAttributes的区别在于 * initNodeData只在节点初始化的时候调用,用于初始化节点的所有属性。 * setAttributes除了初始化调用外,还会在properties发生变化了调用。 */ }, { key: "initNodeData", value: function initNodeData(data) { if (!data.properties) { data.properties = {}; } if (!data.id) { // 自定义节点id > 全局定义id > 内置 var idGenerator = this.graphModel.idGenerator; var globalId = idGenerator && idGenerator(data.type); var nodeId = this.createId(); data.id = nodeId || globalId || uuid_createUuid(); } this.formatText(data); lodash_es_assign(this, node_pickNodeConfig(data)); var overlapMode = this.graphModel.overlapMode; if (overlapMode === OverlapMode.INCREASE) { this.zIndex = data.zIndex || getZIndex(); } } /** * 设置model属性,每次properties发生变化会触发 * 例如设置节点的宽度 * @example * * setAttributes () { * this.width = 300 * this.height = 200 * } * * @overridable 支持重写 */ }, { key: "setAttributes", value: function setAttributes() {} /** * @overridable 支持重写,自定义此类型节点默认生成方式 * @returns string */ }, { key: "createId", value: function createId() { return null; } /** * 初始化文本属性 */ }, { key: "formatText", value: function formatText(data) { if (!data.text) { data.text = { value: '', x: data.x, y: data.y, draggable: false, editable: true }; } if (data.text && typeof data.text === 'string') { data.text = { value: data.text, x: data.x, y: data.y, draggable: false, editable: true }; } else if (data.text && data.text.editable === undefined) { data.text.editable = true; } } /** * 获取被保存时返回的数据 * @overridable 支持重写 */ }, { key: "getData", value: function getData() { var _this$text = this.text, x = _this$text.x, y = _this$text.y, value = _this$text.value; var properties = this.properties; if (Object(mobx_module["x" /* isObservable */])(properties)) { properties = Object(mobx_module["I" /* toJS */])(properties); } var data = { id: this.id, type: this.type, x: this.x, y: this.y, properties: properties }; if (this.graphModel.overlapMode === OverlapMode.INCREASE) { data.zIndex = this.zIndex; } if (value) { data.text = { x: x, y: y, value: value }; } return data; } /** * 用于在历史记录时获取节点数据, * 在某些情况下,如果希望某个属性变化不引起history的变化, * 可以重写此方法。 */ }, { key: "getHistoryData", value: function getHistoryData() { return this.getData(); } /** * 获取当前节点的properties */ }, { key: "getProperties", value: function getProperties() { return Object(mobx_module["I" /* toJS */])(this.properties); } /** * @overridable 支持重写 * 获取当前节点样式 * @returns 自定义节点样式 */ }, { key: "getNodeStyle", value: function getNodeStyle() { return BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, this.graphModel.theme.baseNode), this.style); } /** * @overridable 支持重写 * 获取当前节点文本样式 */ }, { key: "getTextStyle", value: function getTextStyle() { // 透传 nodeText var nodeText = this.graphModel.theme.nodeText; return lodash_es_cloneDeep(nodeText); } /** * @overridable 支持重写 * 获取当前节点锚点样式 * @returns 自定义样式 */ }, { key: "getAnchorStyle", value: function getAnchorStyle(anchorInfo) { var anchor = this.graphModel.theme.anchor; // 防止被重写覆盖主题。 return lodash_es_cloneDeep(anchor); } /** * @overridable 支持重写 * 获取当前节点锚点拖出连线样式 * @returns 自定义锚点拖出样式 */ }, { key: "getAnchorLineStyle", value: function getAnchorLineStyle(anchorInfo) { var anchorLine = this.graphModel.theme.anchorLine; return lodash_es_cloneDeep(anchorLine); } /** * @overridable 支持重写 * 获取outline样式,重写可以定义此类型节点outline样式, 默认使用主题样式 * @returns 自定义outline样式 */ }, { key: "getOutlineStyle", value: function getOutlineStyle() { var outline = this.graphModel.theme.outline; return lodash_es_cloneDeep(outline); } /** * @over * 在边的时候,是否允许这个节点为source节点,边到target节点。 * * @param edgeId 调整的边的id,在开启adjustEdgeStartAndEnd后调整边连接的节点时会传入,见https://github.com/didi/LogicFlow/issues/926#issuecomment-1371823306 */ }, { key: "isAllowConnectedAsSource", value: function isAllowConnectedAsSource(target, sourceAnchor, targetAnchor, edgeId) { var rules = !this.hasSetSourceRules ? this.getConnectedSourceRules() : this.sourceRules; this.hasSetSourceRules = true; var isAllPass = true; var msg; for (var i = 0; i < rules.length; i++) { var rule = rules[i]; if (!rule.validate.call(this, this, target, sourceAnchor, targetAnchor, edgeId)) { isAllPass = false; msg = rule.message; break; } } return { isAllPass: isAllPass, msg: msg }; } /** * 获取当前节点作为连接的起始节点规则。 */ }, { key: "getConnectedSourceRules", value: function getConnectedSourceRules() { return this.sourceRules; } /** * 在连线的时候,是否允许这个节点为target节点 * * @param edgeId 调整的边的id,在开启adjustEdgeStartAndEnd后调整边连接的节点时会传入,见https://github.com/didi/LogicFlow/issues/926#issuecomment-1371823306 */ }, { key: "isAllowConnectedAsTarget", value: function isAllowConnectedAsTarget(source, sourceAnchor, targetAnchor, edgeId) { var rules = !this.hasSetTargetRules ? this.getConnectedTargetRules() : this.targetRules; this.hasSetTargetRules = true; var isAllPass = true; var msg; for (var i = 0; i < rules.length; i++) { var rule = rules[i]; if (!rule.validate.call(this, source, this, sourceAnchor, targetAnchor, edgeId)) { isAllPass = false; msg = rule.message; break; } } return { isAllPass: isAllPass, msg: msg }; } /** * 内部方法 * 是否允许移动节点到新的位置 */ }, { key: "isAllowMoveNode", value: function isAllowMoveNode(deltaX, deltaY) { var isAllowMoveX = true; var isAllowMoveY = true; var rules = this.moveRules.concat(this.graphModel.nodeMoveRules); var _iterator = _createForOfIteratorHelper(rules), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var rule = _step.value; var r = rule(this, deltaX, deltaY); if (!r) return false; if (BaseNodeModel_typeof(r) === 'object') { var r1 = r; if (r1.x === false && r1.y === false) { return false; } isAllowMoveX = isAllowMoveX && r1.x; isAllowMoveY = isAllowMoveY && r1.y; } } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } return { x: isAllowMoveX, y: isAllowMoveY }; } /** * 获取作为连线终点时的所有规则。 */ }, { key: "getConnectedTargetRules", value: function getConnectedTargetRules() { return this.targetRules; } /** * @returns Point[] 锚点坐标构成的数组 */ }, { key: "getAnchorsByOffset", value: function getAnchorsByOffset() { var anchorsOffset = this.anchorsOffset, id = this.id, x = this.x, y = this.y; if (anchorsOffset && anchorsOffset.length > 0) { return anchorsOffset.map(function (el, idx) { if (el.length) { el = el; // 历史数据格式 return { id: "".concat(id, "_").concat(idx), x: x + el[0], y: y + el[1] }; } el = el; return BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, el), {}, { x: x + el.x, y: y + el.y, id: el.id || "".concat(id, "_").concat(idx) }); }); } return this.getDefaultAnchor(); } /** * @overridable 子类重写此方法设置默认锚点 * 获取节点默认情况下的锚点 */ }, { key: "getDefaultAnchor", value: function getDefaultAnchor() { return []; } /** * @overridable 子类重写此方法获取手动连接边到节点时,需要连接的锚点 * 手动连接边到节点时,需要连接的锚点 */ }, { key: "getTargetAnchor", value: function getTargetAnchor(position) { return getClosestAnchor(position, this); } /** * 获取节点BBox */ }, { key: "getBounds", value: function getBounds() { return { x1: this.x - this.width / 2, y1: this.y - this.height / 2, x2: this.x + this.width / 2, y2: this.y + this.height / 2 }; } }, { key: "anchors", get: function get() { return this.getAnchorsByOffset(); } }, { key: "getAnchorInfo", value: function getAnchorInfo(anchorId) { if (lodash_es_isNil(anchorId)) return; for (var i = 0; i < this.anchors.length; i++) { var anchor = this.anchors[i]; if (anchor.id === anchorId) { return anchor; } } } }, { key: "addNodeMoveRules", value: function addNodeMoveRules(fn) { if (!this.moveRules.includes(fn)) { this.moveRules.push(fn); } } }, { key: "move", value: function move(deltaX, deltaY) { var isIgnoreRule = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var isAllowMoveX = false; var isAllowMoveY = false; if (isIgnoreRule) { isAllowMoveX = true; isAllowMoveY = true; } else { var r = this.isAllowMoveNode(deltaX, deltaY); if (typeof r === 'boolean') { isAllowMoveX = r; isAllowMoveY = r; } else { isAllowMoveX = r.x; isAllowMoveY = r.y; } } if (isAllowMoveX) { var targetX = this.x + deltaX; this.x = targetX; this.text && this.moveText(deltaX, 0); } if (isAllowMoveY) { var targetY = this.y + deltaY; this.y = targetY; this.text && this.moveText(0, deltaY); } return isAllowMoveX || isAllowMoveY; } }, { key: "getMoveDistance", value: function getMoveDistance(deltaX, deltaY) { var isIgnoreRule = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var isAllowMoveX = false; var isAllowMoveY = false; var moveX = 0; var moveY = 0; if (isIgnoreRule) { isAllowMoveX = true; isAllowMoveY = true; } else { var r = this.isAllowMoveNode(deltaX, deltaY); if (typeof r === 'boolean') { isAllowMoveX = r; isAllowMoveY = r; } else { isAllowMoveX = r.x; isAllowMoveY = r.y; } } if (isAllowMoveX && deltaX) { var targetX = this.x + deltaX; this.x = targetX; this.text && this.moveText(deltaX, 0); moveX = deltaX; } if (isAllowMoveY && deltaY) { var targetY = this.y + deltaY; this.y = targetY; this.text && this.moveText(0, deltaY); moveY = deltaY; } return [moveX, moveY]; } }, { key: "moveTo", value: function moveTo(x, y) { var isIgnoreRule = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var deltaX = x - this.x; var deltaY = y - this.y; if (!isIgnoreRule && !this.isAllowMoveNode(deltaX, deltaY)) return false; if (this.text) { this.text && this.moveText(deltaX, deltaY); } this.x = x; this.y = y; return true; } }, { key: "moveText", value: function moveText(deltaX, deltaY) { var _this$text2 = this.text, x = _this$text2.x, y = _this$text2.y, value = _this$text2.value, draggable = _this$text2.draggable, editable = _this$text2.editable; this.text = { value: value, editable: editable, draggable: draggable, x: x + deltaX, y: y + deltaY }; } }, { key: "updateText", value: function updateText(value) { this.text = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, this.text), {}, { value: value }); } }, { key: "setSelected", value: function setSelected() { var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.isSelected = flag; } }, { key: "setHovered", value: function setHovered() { var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.isHovered = flag; this.setIsShowAnchor(flag); } }, { key: "setIsShowAnchor", value: function setIsShowAnchor() { var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.isShowAnchor = flag; } }, { key: "setHitable", value: function setHitable() { var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.isHitable = flag; } }, { key: "setElementState", value: function setElementState(state, additionStateData) { this.state = state; this.additionStateData = additionStateData; } }, { key: "setProperty", value: function setProperty(key, val) { this.properties = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, this.properties), {}, BaseNodeModel_defineProperty({}, key, formatData(val))); this.setAttributes(); } }, { key: "setProperties", value: function setProperties(properties) { this.properties = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, this.properties), formatData(properties)); this.setAttributes(); } }, { key: "deleteProperty", value: function deleteProperty(key) { delete this.properties[key]; this.setAttributes(); } }, { key: "setStyle", value: function setStyle(key, val) { this.style = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, this.style), {}, BaseNodeModel_defineProperty({}, key, formatData(val))); } }, { key: "setStyles", value: function setStyles(styles) { this.style = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, this.style), formatData(styles)); } }, { key: "updateStyles", value: function updateStyles(styles) { this.style = BaseNodeModel_objectSpread({}, formatData(styles)); } }, { key: "setZIndex", value: function setZIndex() { var zIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; this.zIndex = zIndex; } }, { key: "updateAttributes", value: function updateAttributes(attributes) { lodash_es_assign(this, attributes); } }]); return BaseNodeModel; }(), (BaseNodeModel_descriptor = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "type", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return ''; } }), BaseNodeModel_descriptor2 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "x", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 0; } }), BaseNodeModel_descriptor3 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "y", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 0; } }), BaseNodeModel_descriptor4 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "text", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return { value: '', x: 0, y: 0, draggable: false, editable: true }; } }), BaseNodeModel_descriptor5 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "properties", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return {}; } }), BaseNodeModel_descriptor6 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "_width", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 100; } }), BaseNodeModel_descriptor7 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "_height", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 80; } }), BaseNodeModel_descriptor8 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "anchorsOffset", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), BaseNodeModel_descriptor9 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "isSelected", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), BaseNodeModel_descriptor10 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "isHovered", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), BaseNodeModel_descriptor11 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "isShowAnchor", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), BaseNodeModel_descriptor12 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "isDragging", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), BaseNodeModel_descriptor13 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "isHitable", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), BaseNodeModel_descriptor14 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "draggable", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), BaseNodeModel_descriptor15 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "visible", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), BaseNodeModel_descriptor16 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "zIndex", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 1; } }), BaseNodeModel_descriptor17 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "state", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 1; } }), BaseNodeModel_descriptor18 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "autoToFront", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), BaseNodeModel_descriptor19 = BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "style", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return {}; } }), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "incoming", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "incoming"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "outgoing", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "outgoing"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "addNodeMoveRules", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "addNodeMoveRules"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "move", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "move"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "getMoveDistance", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "getMoveDistance"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "moveTo", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "moveTo"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "moveText", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "moveText"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "updateText", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "updateText"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setSelected", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setSelected"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setHovered", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setHovered"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setIsShowAnchor", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setIsShowAnchor"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setHitable", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setHitable"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setElementState", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setElementState"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setProperty", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setProperty"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setProperties", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setProperties"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "deleteProperty", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "deleteProperty"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setStyle", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setStyle"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setStyles", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setStyles"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "updateStyles", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "updateStyles"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setZIndex", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setZIndex"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "updateAttributes", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "updateAttributes"), BaseNodeModel_class.prototype)), BaseNodeModel_class); // CONCATENATED MODULE: ./src/model/node/CircleNodeModel.ts function CircleNodeModel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { CircleNodeModel_typeof = function _typeof(obj) { return typeof obj; }; } else { CircleNodeModel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return CircleNodeModel_typeof(obj); } var CircleNodeModel_class, CircleNodeModel_descriptor; function CircleNodeModel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function CircleNodeModel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { CircleNodeModel_ownKeys(Object(source), true).forEach(function (key) { CircleNodeModel_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { CircleNodeModel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function CircleNodeModel_initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function CircleNodeModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function CircleNodeModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function CircleNodeModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) CircleNodeModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) CircleNodeModel_defineProperties(Constructor, staticProps); return Constructor; } function CircleNodeModel_get() { if (typeof Reflect !== "undefined" && Reflect.get) { CircleNodeModel_get = Reflect.get; } else { CircleNodeModel_get = function _get(target, property, receiver) { var base = CircleNodeModel_superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return CircleNodeModel_get.apply(this, arguments); } function CircleNodeModel_superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = CircleNodeModel_getPrototypeOf(object); if (object === null) break; } return object; } function CircleNodeModel_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) CircleNodeModel_setPrototypeOf(subClass, superClass); } function CircleNodeModel_setPrototypeOf(o, p) { CircleNodeModel_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return CircleNodeModel_setPrototypeOf(o, p); } function CircleNodeModel_createSuper(Derived) { var hasNativeReflectConstruct = CircleNodeModel_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = CircleNodeModel_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = CircleNodeModel_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return CircleNodeModel_possibleConstructorReturn(this, result); }; } function CircleNodeModel_possibleConstructorReturn(self, call) { if (call && (CircleNodeModel_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return CircleNodeModel_assertThisInitialized(self); } function CircleNodeModel_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function CircleNodeModel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function CircleNodeModel_getPrototypeOf(o) { CircleNodeModel_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return CircleNodeModel_getPrototypeOf(o); } function CircleNodeModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function CircleNodeModel_applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function CircleNodeModel_initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } var CircleNodeModel_CircleNodeModel = (CircleNodeModel_class = /*#__PURE__*/function (_BaseNodeModel) { CircleNodeModel_inherits(CircleNodeModel, _BaseNodeModel); var _super = CircleNodeModel_createSuper(CircleNodeModel); function CircleNodeModel() { var _this; CircleNodeModel_classCallCheck(this, CircleNodeModel); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); CircleNodeModel_defineProperty(CircleNodeModel_assertThisInitialized(_this), "modelType", ModelType.CIRCLE_NODE); CircleNodeModel_initializerDefineProperty(CircleNodeModel_assertThisInitialized(_this), "r", CircleNodeModel_descriptor, CircleNodeModel_assertThisInitialized(_this)); return _this; } CircleNodeModel_createClass(CircleNodeModel, [{ key: "width", get: function get() { return this.r * 2; } }, { key: "height", get: function get() { return this.r * 2; } }, { key: "getNodeStyle", value: function getNodeStyle() { var style = CircleNodeModel_get(CircleNodeModel_getPrototypeOf(CircleNodeModel.prototype), "getNodeStyle", this).call(this); var circle = this.graphModel.theme.circle; return CircleNodeModel_objectSpread(CircleNodeModel_objectSpread({}, style), lodash_es_cloneDeep(circle)); } }, { key: "getDefaultAnchor", value: function getDefaultAnchor() { var x = this.x, y = this.y, r = this.r; return [{ x: x, y: y - r, id: "".concat(this.id, "_0") }, { x: x + r, y: y, id: "".concat(this.id, "_1") }, { x: x, y: y + r, id: "".concat(this.id, "_2") }, { x: x - r, y: y, id: "".concat(this.id, "_3") }]; } }]); return CircleNodeModel; }(BaseNodeModel_BaseNodeModel), (CircleNodeModel_descriptor = CircleNodeModel_applyDecoratedDescriptor(CircleNodeModel_class.prototype, "r", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 50; } }), CircleNodeModel_applyDecoratedDescriptor(CircleNodeModel_class.prototype, "width", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(CircleNodeModel_class.prototype, "width"), CircleNodeModel_class.prototype), CircleNodeModel_applyDecoratedDescriptor(CircleNodeModel_class.prototype, "height", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(CircleNodeModel_class.prototype, "height"), CircleNodeModel_class.prototype)), CircleNodeModel_class); /* harmony default export */ var node_CircleNodeModel = (CircleNodeModel_CircleNodeModel); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.number.min-safe-integer.js var es_number_min_safe_integer = __webpack_require__(127); // CONCATENATED MODULE: ./src/model/node/DiamondNodeModel.ts function DiamondNodeModel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { DiamondNodeModel_typeof = function _typeof(obj) { return typeof obj; }; } else { DiamondNodeModel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return DiamondNodeModel_typeof(obj); } var DiamondNodeModel_class, DiamondNodeModel_descriptor, DiamondNodeModel_descriptor2; function DiamondNodeModel_slicedToArray(arr, i) { return DiamondNodeModel_arrayWithHoles(arr) || DiamondNodeModel_iterableToArrayLimit(arr, i) || DiamondNodeModel_unsupportedIterableToArray(arr, i) || DiamondNodeModel_nonIterableRest(); } function DiamondNodeModel_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function DiamondNodeModel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return DiamondNodeModel_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return DiamondNodeModel_arrayLikeToArray(o, minLen); } function DiamondNodeModel_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function DiamondNodeModel_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function DiamondNodeModel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function DiamondNodeModel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function DiamondNodeModel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { DiamondNodeModel_ownKeys(Object(source), true).forEach(function (key) { DiamondNodeModel_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { DiamondNodeModel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function DiamondNodeModel_initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function DiamondNodeModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function DiamondNodeModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function DiamondNodeModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) DiamondNodeModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) DiamondNodeModel_defineProperties(Constructor, staticProps); return Constructor; } function DiamondNodeModel_get() { if (typeof Reflect !== "undefined" && Reflect.get) { DiamondNodeModel_get = Reflect.get; } else { DiamondNodeModel_get = function _get(target, property, receiver) { var base = DiamondNodeModel_superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return DiamondNodeModel_get.apply(this, arguments); } function DiamondNodeModel_superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = DiamondNodeModel_getPrototypeOf(object); if (object === null) break; } return object; } function DiamondNodeModel_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) DiamondNodeModel_setPrototypeOf(subClass, superClass); } function DiamondNodeModel_setPrototypeOf(o, p) { DiamondNodeModel_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return DiamondNodeModel_setPrototypeOf(o, p); } function DiamondNodeModel_createSuper(Derived) { var hasNativeReflectConstruct = DiamondNodeModel_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = DiamondNodeModel_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = DiamondNodeModel_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return DiamondNodeModel_possibleConstructorReturn(this, result); }; } function DiamondNodeModel_possibleConstructorReturn(self, call) { if (call && (DiamondNodeModel_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return DiamondNodeModel_assertThisInitialized(self); } function DiamondNodeModel_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function DiamondNodeModel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function DiamondNodeModel_getPrototypeOf(o) { DiamondNodeModel_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return DiamondNodeModel_getPrototypeOf(o); } function DiamondNodeModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function DiamondNodeModel_applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function DiamondNodeModel_initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } var DiamondNodeModel_DiamondNodeModel = (DiamondNodeModel_class = /*#__PURE__*/function (_BaseNodeModel) { DiamondNodeModel_inherits(DiamondNodeModel, _BaseNodeModel); var _super = DiamondNodeModel_createSuper(DiamondNodeModel); function DiamondNodeModel() { var _this; DiamondNodeModel_classCallCheck(this, DiamondNodeModel); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); DiamondNodeModel_defineProperty(DiamondNodeModel_assertThisInitialized(_this), "modelType", ModelType.DIAMOND_NODE); DiamondNodeModel_initializerDefineProperty(DiamondNodeModel_assertThisInitialized(_this), "rx", DiamondNodeModel_descriptor, DiamondNodeModel_assertThisInitialized(_this)); DiamondNodeModel_initializerDefineProperty(DiamondNodeModel_assertThisInitialized(_this), "ry", DiamondNodeModel_descriptor2, DiamondNodeModel_assertThisInitialized(_this)); return _this; } DiamondNodeModel_createClass(DiamondNodeModel, [{ key: "getNodeStyle", value: function getNodeStyle() { var style = DiamondNodeModel_get(DiamondNodeModel_getPrototypeOf(DiamondNodeModel.prototype), "getNodeStyle", this).call(this); var diamond = this.graphModel.theme.diamond; return DiamondNodeModel_objectSpread(DiamondNodeModel_objectSpread({}, style), lodash_es_cloneDeep(diamond)); } }, { key: "points", get: function get() { var x = this.x, y = this.y, rx = this.rx, ry = this.ry; return [[x, y - ry], [x + rx, y], [x, y + ry], [x - rx, y]]; } }, { key: "pointsPosition", get: function get() { var pointsPosition = this.points.map(function (item) { return { x: item[0], y: item[1] }; }); return pointsPosition; } }, { key: "width", get: function get() { var min = Number.MAX_SAFE_INTEGER; var max = Number.MIN_SAFE_INTEGER; this.points.forEach(function (_ref) { var _ref2 = DiamondNodeModel_slicedToArray(_ref, 1), x = _ref2[0]; if (x < min) { min = x; } if (x > max) { max = x; } }); return max - min; } }, { key: "height", get: function get() { var min = Number.MAX_SAFE_INTEGER; var max = Number.MIN_SAFE_INTEGER; this.points.forEach(function (_ref3) { var _ref4 = DiamondNodeModel_slicedToArray(_ref3, 2), y = _ref4[1]; if (y < min) { min = y; } if (y > max) { max = y; } }); return max - min; } }, { key: "getDefaultAnchor", value: function getDefaultAnchor() { var _this2 = this; return this.points.map(function (_ref5, idx) { var _ref6 = DiamondNodeModel_slicedToArray(_ref5, 2), x1 = _ref6[0], y1 = _ref6[1]; return { x: x1, y: y1, id: "".concat(_this2.id, "_").concat(idx) }; }); } }]); return DiamondNodeModel; }(BaseNodeModel_BaseNodeModel), (DiamondNodeModel_descriptor = DiamondNodeModel_applyDecoratedDescriptor(DiamondNodeModel_class.prototype, "rx", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 30; } }), DiamondNodeModel_descriptor2 = DiamondNodeModel_applyDecoratedDescriptor(DiamondNodeModel_class.prototype, "ry", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 50; } }), DiamondNodeModel_applyDecoratedDescriptor(DiamondNodeModel_class.prototype, "points", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(DiamondNodeModel_class.prototype, "points"), DiamondNodeModel_class.prototype), DiamondNodeModel_applyDecoratedDescriptor(DiamondNodeModel_class.prototype, "pointsPosition", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(DiamondNodeModel_class.prototype, "pointsPosition"), DiamondNodeModel_class.prototype), DiamondNodeModel_applyDecoratedDescriptor(DiamondNodeModel_class.prototype, "width", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(DiamondNodeModel_class.prototype, "width"), DiamondNodeModel_class.prototype), DiamondNodeModel_applyDecoratedDescriptor(DiamondNodeModel_class.prototype, "height", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(DiamondNodeModel_class.prototype, "height"), DiamondNodeModel_class.prototype)), DiamondNodeModel_class); /* harmony default export */ var node_DiamondNodeModel = (DiamondNodeModel_DiamondNodeModel); // CONCATENATED MODULE: ./src/model/node/EllipseNodeModel.ts function EllipseNodeModel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { EllipseNodeModel_typeof = function _typeof(obj) { return typeof obj; }; } else { EllipseNodeModel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return EllipseNodeModel_typeof(obj); } var EllipseNodeModel_class, EllipseNodeModel_descriptor, EllipseNodeModel_descriptor2; function EllipseNodeModel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function EllipseNodeModel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { EllipseNodeModel_ownKeys(Object(source), true).forEach(function (key) { EllipseNodeModel_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { EllipseNodeModel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function EllipseNodeModel_initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function EllipseNodeModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function EllipseNodeModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function EllipseNodeModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) EllipseNodeModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) EllipseNodeModel_defineProperties(Constructor, staticProps); return Constructor; } function EllipseNodeModel_get() { if (typeof Reflect !== "undefined" && Reflect.get) { EllipseNodeModel_get = Reflect.get; } else { EllipseNodeModel_get = function _get(target, property, receiver) { var base = EllipseNodeModel_superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return EllipseNodeModel_get.apply(this, arguments); } function EllipseNodeModel_superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = EllipseNodeModel_getPrototypeOf(object); if (object === null) break; } return object; } function EllipseNodeModel_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) EllipseNodeModel_setPrototypeOf(subClass, superClass); } function EllipseNodeModel_setPrototypeOf(o, p) { EllipseNodeModel_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return EllipseNodeModel_setPrototypeOf(o, p); } function EllipseNodeModel_createSuper(Derived) { var hasNativeReflectConstruct = EllipseNodeModel_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = EllipseNodeModel_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = EllipseNodeModel_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return EllipseNodeModel_possibleConstructorReturn(this, result); }; } function EllipseNodeModel_possibleConstructorReturn(self, call) { if (call && (EllipseNodeModel_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return EllipseNodeModel_assertThisInitialized(self); } function EllipseNodeModel_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function EllipseNodeModel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function EllipseNodeModel_getPrototypeOf(o) { EllipseNodeModel_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return EllipseNodeModel_getPrototypeOf(o); } function EllipseNodeModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function EllipseNodeModel_applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function EllipseNodeModel_initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } var EllipseNodeModel_EllipseNodeModel = (EllipseNodeModel_class = /*#__PURE__*/function (_BaseNodeModel) { EllipseNodeModel_inherits(EllipseNodeModel, _BaseNodeModel); var _super = EllipseNodeModel_createSuper(EllipseNodeModel); function EllipseNodeModel() { var _this; EllipseNodeModel_classCallCheck(this, EllipseNodeModel); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); EllipseNodeModel_defineProperty(EllipseNodeModel_assertThisInitialized(_this), "modelType", ModelType.ELLIPSE_NODE); EllipseNodeModel_initializerDefineProperty(EllipseNodeModel_assertThisInitialized(_this), "rx", EllipseNodeModel_descriptor, EllipseNodeModel_assertThisInitialized(_this)); EllipseNodeModel_initializerDefineProperty(EllipseNodeModel_assertThisInitialized(_this), "ry", EllipseNodeModel_descriptor2, EllipseNodeModel_assertThisInitialized(_this)); return _this; } EllipseNodeModel_createClass(EllipseNodeModel, [{ key: "getNodeStyle", value: function getNodeStyle() { var style = EllipseNodeModel_get(EllipseNodeModel_getPrototypeOf(EllipseNodeModel.prototype), "getNodeStyle", this).call(this); var ellipse = this.graphModel.theme.ellipse; return EllipseNodeModel_objectSpread(EllipseNodeModel_objectSpread({}, style), lodash_es_cloneDeep(ellipse)); } }, { key: "width", get: function get() { return this.rx * 2; } }, { key: "height", get: function get() { return this.ry * 2; } }, { key: "getDefaultAnchor", value: function getDefaultAnchor() { var x = this.x, y = this.y, rx = this.rx, ry = this.ry; return [{ x: x, y: y - ry, id: "".concat(this.id, "_0") }, { x: x + rx, y: y, id: "".concat(this.id, "_1") }, { x: x, y: y + ry, id: "".concat(this.id, "_2") }, { x: x - rx, y: y, id: "".concat(this.id, "_3") }]; } }]); return EllipseNodeModel; }(BaseNodeModel_BaseNodeModel), (EllipseNodeModel_descriptor = EllipseNodeModel_applyDecoratedDescriptor(EllipseNodeModel_class.prototype, "rx", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 30; } }), EllipseNodeModel_descriptor2 = EllipseNodeModel_applyDecoratedDescriptor(EllipseNodeModel_class.prototype, "ry", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 45; } }), EllipseNodeModel_applyDecoratedDescriptor(EllipseNodeModel_class.prototype, "width", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(EllipseNodeModel_class.prototype, "width"), EllipseNodeModel_class.prototype), EllipseNodeModel_applyDecoratedDescriptor(EllipseNodeModel_class.prototype, "height", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(EllipseNodeModel_class.prototype, "height"), EllipseNodeModel_class.prototype)), EllipseNodeModel_class); /* harmony default export */ var node_EllipseNodeModel = (EllipseNodeModel_EllipseNodeModel); // CONCATENATED MODULE: ./src/model/node/PolygonNodeModel.ts function PolygonNodeModel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { PolygonNodeModel_typeof = function _typeof(obj) { return typeof obj; }; } else { PolygonNodeModel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return PolygonNodeModel_typeof(obj); } var PolygonNodeModel_class, PolygonNodeModel_descriptor; function PolygonNodeModel_slicedToArray(arr, i) { return PolygonNodeModel_arrayWithHoles(arr) || PolygonNodeModel_iterableToArrayLimit(arr, i) || PolygonNodeModel_unsupportedIterableToArray(arr, i) || PolygonNodeModel_nonIterableRest(); } function PolygonNodeModel_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function PolygonNodeModel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return PolygonNodeModel_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return PolygonNodeModel_arrayLikeToArray(o, minLen); } function PolygonNodeModel_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function PolygonNodeModel_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function PolygonNodeModel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function PolygonNodeModel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function PolygonNodeModel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { PolygonNodeModel_ownKeys(Object(source), true).forEach(function (key) { PolygonNodeModel_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { PolygonNodeModel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function PolygonNodeModel_initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function PolygonNodeModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function PolygonNodeModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function PolygonNodeModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) PolygonNodeModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) PolygonNodeModel_defineProperties(Constructor, staticProps); return Constructor; } function PolygonNodeModel_get() { if (typeof Reflect !== "undefined" && Reflect.get) { PolygonNodeModel_get = Reflect.get; } else { PolygonNodeModel_get = function _get(target, property, receiver) { var base = PolygonNodeModel_superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return PolygonNodeModel_get.apply(this, arguments); } function PolygonNodeModel_superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = PolygonNodeModel_getPrototypeOf(object); if (object === null) break; } return object; } function PolygonNodeModel_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) PolygonNodeModel_setPrototypeOf(subClass, superClass); } function PolygonNodeModel_setPrototypeOf(o, p) { PolygonNodeModel_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return PolygonNodeModel_setPrototypeOf(o, p); } function PolygonNodeModel_createSuper(Derived) { var hasNativeReflectConstruct = PolygonNodeModel_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = PolygonNodeModel_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = PolygonNodeModel_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return PolygonNodeModel_possibleConstructorReturn(this, result); }; } function PolygonNodeModel_possibleConstructorReturn(self, call) { if (call && (PolygonNodeModel_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return PolygonNodeModel_assertThisInitialized(self); } function PolygonNodeModel_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function PolygonNodeModel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function PolygonNodeModel_getPrototypeOf(o) { PolygonNodeModel_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return PolygonNodeModel_getPrototypeOf(o); } function PolygonNodeModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function PolygonNodeModel_applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function PolygonNodeModel_initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } var PolygonNodeModel_PolygonNodeModel = (PolygonNodeModel_class = /*#__PURE__*/function (_BaseNodeModel) { PolygonNodeModel_inherits(PolygonNodeModel, _BaseNodeModel); var _super = PolygonNodeModel_createSuper(PolygonNodeModel); function PolygonNodeModel() { var _this; PolygonNodeModel_classCallCheck(this, PolygonNodeModel); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); PolygonNodeModel_defineProperty(PolygonNodeModel_assertThisInitialized(_this), "modelType", ModelType.POLYGON_NODE); PolygonNodeModel_initializerDefineProperty(PolygonNodeModel_assertThisInitialized(_this), "points", PolygonNodeModel_descriptor, PolygonNodeModel_assertThisInitialized(_this)); return _this; } PolygonNodeModel_createClass(PolygonNodeModel, [{ key: "getNodeStyle", value: function getNodeStyle() { var style = PolygonNodeModel_get(PolygonNodeModel_getPrototypeOf(PolygonNodeModel.prototype), "getNodeStyle", this).call(this); var polygon = this.graphModel.theme.polygon; return PolygonNodeModel_objectSpread(PolygonNodeModel_objectSpread({}, style), lodash_es_cloneDeep(polygon)); } /** * 由于大多数情况下,我们初始化拿到的多边形坐标都是基于原点的(例如绘图工具到处的svg)。 * 在logicflow中对多边形进行移动,我们不需要去更新points, * 而是去更新多边形中心点即可。 */ }, { key: "pointsPosition", get: function get() { var x = this.x, y = this.y, width = this.width, height = this.height; var pointsPosition = this.points.map(function (item) { return { x: item[0] + x - width / 2, y: item[1] + y - height / 2 }; }); return pointsPosition; } }, { key: "width", get: function get() { var min = Number.MAX_SAFE_INTEGER; var max = Number.MIN_SAFE_INTEGER; this.points.forEach(function (_ref) { var _ref2 = PolygonNodeModel_slicedToArray(_ref, 1), x = _ref2[0]; if (x < min) { min = x; } if (x > max) { max = x; } }); return max - min; } }, { key: "height", get: function get() { var min = Number.MAX_SAFE_INTEGER; var max = Number.MIN_SAFE_INTEGER; this.points.forEach(function (_ref3) { var _ref4 = PolygonNodeModel_slicedToArray(_ref3, 2), y = _ref4[1]; if (y < min) { min = y; } if (y > max) { max = y; } }); return max - min; } }, { key: "getDefaultAnchor", value: function getDefaultAnchor() { var _this2 = this; var x = this.x, y = this.y, width = this.width, height = this.height, points = this.points; return points.map(function (_ref5, idx) { var _ref6 = PolygonNodeModel_slicedToArray(_ref5, 2), x1 = _ref6[0], y1 = _ref6[1]; return { x: x + x1 - width / 2, y: y + y1 - height / 2, id: "".concat(_this2.id, "_").concat(idx) }; }); } }]); return PolygonNodeModel; }(BaseNodeModel_BaseNodeModel), (PolygonNodeModel_descriptor = PolygonNodeModel_applyDecoratedDescriptor(PolygonNodeModel_class.prototype, "points", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return [[50, 0], [100, 50], [50, 100], [0, 50]]; } }), PolygonNodeModel_applyDecoratedDescriptor(PolygonNodeModel_class.prototype, "pointsPosition", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(PolygonNodeModel_class.prototype, "pointsPosition"), PolygonNodeModel_class.prototype), PolygonNodeModel_applyDecoratedDescriptor(PolygonNodeModel_class.prototype, "width", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(PolygonNodeModel_class.prototype, "width"), PolygonNodeModel_class.prototype), PolygonNodeModel_applyDecoratedDescriptor(PolygonNodeModel_class.prototype, "height", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(PolygonNodeModel_class.prototype, "height"), PolygonNodeModel_class.prototype)), PolygonNodeModel_class); /* harmony default export */ var node_PolygonNodeModel = (PolygonNodeModel_PolygonNodeModel); // CONCATENATED MODULE: ./src/model/node/RectNodeModel.ts function RectNodeModel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { RectNodeModel_typeof = function _typeof(obj) { return typeof obj; }; } else { RectNodeModel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return RectNodeModel_typeof(obj); } var RectNodeModel_class, RectNodeModel_descriptor; function RectNodeModel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function RectNodeModel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { RectNodeModel_ownKeys(Object(source), true).forEach(function (key) { RectNodeModel_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { RectNodeModel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function RectNodeModel_initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function RectNodeModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function RectNodeModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function RectNodeModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) RectNodeModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) RectNodeModel_defineProperties(Constructor, staticProps); return Constructor; } function RectNodeModel_get() { if (typeof Reflect !== "undefined" && Reflect.get) { RectNodeModel_get = Reflect.get; } else { RectNodeModel_get = function _get(target, property, receiver) { var base = RectNodeModel_superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return RectNodeModel_get.apply(this, arguments); } function RectNodeModel_superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = RectNodeModel_getPrototypeOf(object); if (object === null) break; } return object; } function RectNodeModel_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) RectNodeModel_setPrototypeOf(subClass, superClass); } function RectNodeModel_setPrototypeOf(o, p) { RectNodeModel_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return RectNodeModel_setPrototypeOf(o, p); } function RectNodeModel_createSuper(Derived) { var hasNativeReflectConstruct = RectNodeModel_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = RectNodeModel_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = RectNodeModel_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return RectNodeModel_possibleConstructorReturn(this, result); }; } function RectNodeModel_possibleConstructorReturn(self, call) { if (call && (RectNodeModel_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return RectNodeModel_assertThisInitialized(self); } function RectNodeModel_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function RectNodeModel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function RectNodeModel_getPrototypeOf(o) { RectNodeModel_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return RectNodeModel_getPrototypeOf(o); } function RectNodeModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function RectNodeModel_applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function RectNodeModel_initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } var RectNodeModel_RectNodeModel = (RectNodeModel_class = /*#__PURE__*/function (_BaseNodeModel) { RectNodeModel_inherits(RectNodeModel, _BaseNodeModel); var _super = RectNodeModel_createSuper(RectNodeModel); function RectNodeModel() { var _this; RectNodeModel_classCallCheck(this, RectNodeModel); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); RectNodeModel_defineProperty(RectNodeModel_assertThisInitialized(_this), "modelType", ModelType.RECT_NODE); RectNodeModel_initializerDefineProperty(RectNodeModel_assertThisInitialized(_this), "radius", RectNodeModel_descriptor, RectNodeModel_assertThisInitialized(_this)); return _this; } RectNodeModel_createClass(RectNodeModel, [{ key: "getDefaultAnchor", value: function getDefaultAnchor() { var x = this.x, y = this.y, width = this.width, height = this.height; return [{ x: x, y: y - height / 2, id: "".concat(this.id, "_0") }, { x: x + width / 2, y: y, id: "".concat(this.id, "_1") }, { x: x, y: y + height / 2, id: "".concat(this.id, "_2") }, { x: x - width / 2, y: y, id: "".concat(this.id, "_3") }]; } }, { key: "getNodeStyle", value: function getNodeStyle() { var style = RectNodeModel_get(RectNodeModel_getPrototypeOf(RectNodeModel.prototype), "getNodeStyle", this).call(this); var rect = this.graphModel.theme.rect; return RectNodeModel_objectSpread(RectNodeModel_objectSpread({}, style), lodash_es_cloneDeep(rect)); } }]); return RectNodeModel; }(BaseNodeModel_BaseNodeModel), (RectNodeModel_descriptor = RectNodeModel_applyDecoratedDescriptor(RectNodeModel_class.prototype, "radius", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 0; } })), RectNodeModel_class); /* harmony default export */ var node_RectNodeModel = (RectNodeModel_RectNodeModel); // CONCATENATED MODULE: ./src/model/node/TextNodeModel.ts function TextNodeModel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { TextNodeModel_typeof = function _typeof(obj) { return typeof obj; }; } else { TextNodeModel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return TextNodeModel_typeof(obj); } var TextNodeModel_class; function TextNodeModel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function TextNodeModel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { TextNodeModel_ownKeys(Object(source), true).forEach(function (key) { TextNodeModel_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { TextNodeModel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function TextNodeModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function TextNodeModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function TextNodeModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) TextNodeModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) TextNodeModel_defineProperties(Constructor, staticProps); return Constructor; } function TextNodeModel_get() { if (typeof Reflect !== "undefined" && Reflect.get) { TextNodeModel_get = Reflect.get; } else { TextNodeModel_get = function _get(target, property, receiver) { var base = TextNodeModel_superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return TextNodeModel_get.apply(this, arguments); } function TextNodeModel_superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = TextNodeModel_getPrototypeOf(object); if (object === null) break; } return object; } function TextNodeModel_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) TextNodeModel_setPrototypeOf(subClass, superClass); } function TextNodeModel_setPrototypeOf(o, p) { TextNodeModel_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return TextNodeModel_setPrototypeOf(o, p); } function TextNodeModel_createSuper(Derived) { var hasNativeReflectConstruct = TextNodeModel_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = TextNodeModel_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = TextNodeModel_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return TextNodeModel_possibleConstructorReturn(this, result); }; } function TextNodeModel_possibleConstructorReturn(self, call) { if (call && (TextNodeModel_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return TextNodeModel_assertThisInitialized(self); } function TextNodeModel_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function TextNodeModel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function TextNodeModel_getPrototypeOf(o) { TextNodeModel_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return TextNodeModel_getPrototypeOf(o); } function TextNodeModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function TextNodeModel_applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } var TextNodeModel_TextNodeModel = (TextNodeModel_class = /*#__PURE__*/function (_BaseNodeModel) { TextNodeModel_inherits(TextNodeModel, _BaseNodeModel); var _super = TextNodeModel_createSuper(TextNodeModel); function TextNodeModel() { var _this; TextNodeModel_classCallCheck(this, TextNodeModel); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); TextNodeModel_defineProperty(TextNodeModel_assertThisInitialized(_this), "modelType", ModelType.TEXT_NODE); return _this; } TextNodeModel_createClass(TextNodeModel, [{ key: "getTextStyle", value: function getTextStyle() { var style = TextNodeModel_get(TextNodeModel_getPrototypeOf(TextNodeModel.prototype), "getTextStyle", this).call(this); var text = this.graphModel.theme.text; return TextNodeModel_objectSpread(TextNodeModel_objectSpread({}, style), lodash_es_cloneDeep(text)); } }, { key: "width", get: function get() { var rows = String(this.text.value).split(/[\r\n]/g); var _this$getTextStyle = this.getTextStyle(), fontSize = _this$getTextStyle.fontSize; var _getSvgTextWidthHeigh = node_getSvgTextWidthHeight({ rows: rows, fontSize: fontSize, rowsLength: rows.length }), width = _getSvgTextWidthHeigh.width; return width; } }, { key: "height", get: function get() { var rows = String(this.text.value).split(/[\r\n]/g); var _this$getTextStyle2 = this.getTextStyle(), fontSize = _this$getTextStyle2.fontSize; var _getSvgTextWidthHeigh2 = node_getSvgTextWidthHeight({ rows: rows, fontSize: fontSize, rowsLength: rows.length }), height = _getSvgTextWidthHeigh2.height; return height; } }]); return TextNodeModel; }(BaseNodeModel_BaseNodeModel), (TextNodeModel_applyDecoratedDescriptor(TextNodeModel_class.prototype, "width", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(TextNodeModel_class.prototype, "width"), TextNodeModel_class.prototype), TextNodeModel_applyDecoratedDescriptor(TextNodeModel_class.prototype, "height", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(TextNodeModel_class.prototype, "height"), TextNodeModel_class.prototype)), TextNodeModel_class); /* harmony default export */ var node_TextNodeModel = (TextNodeModel_TextNodeModel); // CONCATENATED MODULE: ./src/model/node/HtmlNodeModel.ts function HtmlNodeModel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { HtmlNodeModel_typeof = function _typeof(obj) { return typeof obj; }; } else { HtmlNodeModel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return HtmlNodeModel_typeof(obj); } function HtmlNodeModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function HtmlNodeModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function HtmlNodeModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) HtmlNodeModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) HtmlNodeModel_defineProperties(Constructor, staticProps); return Constructor; } function HtmlNodeModel_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) HtmlNodeModel_setPrototypeOf(subClass, superClass); } function HtmlNodeModel_setPrototypeOf(o, p) { HtmlNodeModel_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return HtmlNodeModel_setPrototypeOf(o, p); } function HtmlNodeModel_createSuper(Derived) { var hasNativeReflectConstruct = HtmlNodeModel_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = HtmlNodeModel_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = HtmlNodeModel_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return HtmlNodeModel_possibleConstructorReturn(this, result); }; } function HtmlNodeModel_possibleConstructorReturn(self, call) { if (call && (HtmlNodeModel_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return HtmlNodeModel_assertThisInitialized(self); } function HtmlNodeModel_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function HtmlNodeModel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function HtmlNodeModel_getPrototypeOf(o) { HtmlNodeModel_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return HtmlNodeModel_getPrototypeOf(o); } function HtmlNodeModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var HtmlNodeModel_HtmlNodeModel = /*#__PURE__*/function (_BaseNodeModel) { HtmlNodeModel_inherits(HtmlNodeModel, _BaseNodeModel); var _super = HtmlNodeModel_createSuper(HtmlNodeModel); function HtmlNodeModel() { var _this; HtmlNodeModel_classCallCheck(this, HtmlNodeModel); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); HtmlNodeModel_defineProperty(HtmlNodeModel_assertThisInitialized(_this), "modelType", ModelType.HTML_NODE); return _this; } HtmlNodeModel_createClass(HtmlNodeModel, [{ key: "getDefaultAnchor", value: function getDefaultAnchor() { var x = this.x, y = this.y, width = this.width, height = this.height; return [{ x: x, y: y - height / 2, id: "".concat(this.id, "_0") }, { x: x + width / 2, y: y, id: "".concat(this.id, "_1") }, { x: x, y: y + height / 2, id: "".concat(this.id, "_2") }, { x: x - width / 2, y: y, id: "".concat(this.id, "_3") }]; } }]); return HtmlNodeModel; }(BaseNodeModel_BaseNodeModel); /* harmony default export */ var node_HtmlNodeModel = (HtmlNodeModel_HtmlNodeModel); // CONCATENATED MODULE: ./src/model/node/index.ts // CONCATENATED MODULE: ./src/model/BaseModel.ts // CONCATENATED MODULE: ./src/model/SnaplineModel.ts var SnaplineModel_class, SnaplineModel_descriptor, SnaplineModel_descriptor2, SnaplineModel_descriptor3; function SnaplineModel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function SnaplineModel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { SnaplineModel_ownKeys(Object(source), true).forEach(function (key) { SnaplineModel_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { SnaplineModel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function SnaplineModel_initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function SnaplineModel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function SnaplineModel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function SnaplineModel_createClass(Constructor, protoProps, staticProps) { if (protoProps) SnaplineModel_defineProperties(Constructor.prototype, protoProps); if (staticProps) SnaplineModel_defineProperties(Constructor, staticProps); return Constructor; } function SnaplineModel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function SnaplineModel_applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function SnaplineModel_initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } var SnaplineModel_SnaplineModel = (SnaplineModel_class = /*#__PURE__*/function () { // 是否展示水平对齐线 // 是否展示垂直对齐线 // 对齐线的中心位置,目前仅展示中心对齐的情况,后面可以考虑多种对齐策略 function SnaplineModel(graphModel) { SnaplineModel_classCallCheck(this, SnaplineModel); SnaplineModel_defineProperty(this, "graphModel", void 0); SnaplineModel_initializerDefineProperty(this, "isShowHorizontal", SnaplineModel_descriptor, this); SnaplineModel_initializerDefineProperty(this, "isShowVertical", SnaplineModel_descriptor2, this); SnaplineModel_initializerDefineProperty(this, "position", SnaplineModel_descriptor3, this); this.isShowHorizontal = false; this.isShowVertical = false; this.position = { x: 0, y: 0 }; this.graphModel = graphModel; } SnaplineModel_createClass(SnaplineModel, [{ key: "getStyle", value: function getStyle() { return SnaplineModel_objectSpread({}, this.graphModel.theme.snapline); } // 计算节点中心线与其他节点的对齐信息 }, { key: "getCenterSnapLine", value: function getCenterSnapLine(draggingNode, nodes) { var x = draggingNode.x, y = draggingNode.y; var isShowVertical = false; var isShowHorizontal = false; for (var i = 0; i < nodes.length; i++) { var item = nodes[i]; // 排除当前节点 if (item.id !== draggingNode.id) { if (x === item.x) { isShowVertical = true; } if (y === item.y) { isShowHorizontal = true; } // 如果水平垂直都显示,则停止循环。减少不必要的遍历 if (isShowVertical && isShowHorizontal) { break; } } } return { isShowVertical: isShowVertical, isShowHorizontal: isShowHorizontal, position: { x: x, y: y } }; } // 计算节点上下边框与其他节点的上下边框的对齐信息 }, { key: "getHorizontalSnapline", value: function getHorizontalSnapline(draggingNode, nodes) { var isShowHorizontal = false; var horizontalY; var id = draggingNode.id; var draggingData; if (id) { var fakerNode = this.graphModel.fakerNode; if (fakerNode && fakerNode.id === id) { draggingData = getNodeBBox(fakerNode); } else { var nodeModel = this.graphModel.getNodeModelById(id); draggingData = getNodeBBox(nodeModel); } } for (var i = 0; i < nodes.length; i++) { var item = nodes[i]; // 排除当前节点 if (item.id !== draggingNode.id) { var itemData = getNodeBBox(item); // 如果节点的最大最小Y轴坐标与节点的最大最小Y轴坐标相等,展示水平线 if (itemData.minY === draggingData.minY || itemData.maxY === draggingData.minY) { // 找到则停止循环。减少不必要的遍历 isShowHorizontal = true; horizontalY = draggingData.minY; break; } if (itemData.minY === draggingData.maxY || itemData.maxY === draggingData.maxY) { isShowHorizontal = true; horizontalY = draggingData.maxY; break; } } } return lodash_es_assign({ isShowHorizontal: isShowHorizontal, position: { y: horizontalY } }); } // 计算节点左右边框与其他节点的左右边框的对齐信息 }, { key: "getVerticalSnapline", value: function getVerticalSnapline(draggingNode, nodes) { var isShowVertical = false; var verticalX; var id = draggingNode.id; var draggingData; if (id) { var fakerNode = this.graphModel.fakerNode; if (fakerNode && fakerNode.id === id) { draggingData = getNodeBBox(fakerNode); } else { var nodeModel = this.graphModel.getNodeModelById(id); draggingData = getNodeBBox(nodeModel); } } for (var i = 0; i < nodes.length; i++) { var item = nodes[i]; // 排除当前节点 if (item.id !== draggingNode.id) { var itemData = getNodeBBox(item); // 如果节点的最大最小X轴坐标与节点的最大最小X轴坐标相等,展示垂直线 if (itemData.minX === draggingData.minX || itemData.maxX === draggingData.minX) { // 找到则停止循环。减少不必要的遍历 isShowVertical = true; verticalX = draggingData.minX; break; } if (itemData.minX === draggingData.maxX || itemData.maxX === draggingData.maxX) { isShowVertical = true; verticalX = draggingData.maxX; break; } } } return lodash_es_assign({ isShowVertical: isShowVertical, position: { x: verticalX } }); } // 计算节点与其他节点的对齐信息 }, { key: "getSnapLinePosition", value: function getSnapLinePosition(draggingNode, nodes) { var snaplineInfo = this.getCenterSnapLine(draggingNode, nodes); var isShowHorizontal = snaplineInfo.isShowHorizontal, isShowVertical = snaplineInfo.isShowVertical; // 中心对齐优先级最高 // 如果没有中心坐标的水平对齐,计算上下边框的对齐 if (!isShowHorizontal) { var horizontalSnapline = this.getHorizontalSnapline(draggingNode, nodes); if (horizontalSnapline.isShowHorizontal) { snaplineInfo.isShowHorizontal = horizontalSnapline.isShowHorizontal; snaplineInfo.position.y = horizontalSnapline.position.y; } } // 如果没有中心坐标的垂直对齐,计算左右边框的对齐 if (!isShowVertical) { var verticalSnapline = this.getVerticalSnapline(draggingNode, nodes); if (verticalSnapline.isShowVertical) { snaplineInfo.isShowVertical = verticalSnapline.isShowVertical; snaplineInfo.position.x = verticalSnapline.position.x; } } return snaplineInfo; } // 设置对齐信息 }, { key: "setSnaplineInfo", value: function setSnaplineInfo(snaplineInfo) { var isShowHorizontal = snaplineInfo.isShowHorizontal, isShowVertical = snaplineInfo.isShowVertical, position = snaplineInfo.position; this.position = position; this.isShowHorizontal = isShowHorizontal; this.isShowVertical = isShowVertical; } // 清空对齐信息,对齐线消失 }, { key: "clearSnapline", value: function clearSnapline() { this.position = { x: 0, y: 0 }; this.isShowHorizontal = false; this.isShowVertical = false; } // 设置节点对齐线 }, { key: "setNodeSnapLine", value: function setNodeSnapLine(nodeData) { var nodes = this.graphModel.nodes; var info = this.getSnapLinePosition(nodeData, nodes); this.setSnaplineInfo(info); } }]); return SnaplineModel; }(), (SnaplineModel_descriptor = SnaplineModel_applyDecoratedDescriptor(SnaplineModel_class.prototype, "isShowHorizontal", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: null }), SnaplineModel_descriptor2 = SnaplineModel_applyDecoratedDescriptor(SnaplineModel_class.prototype, "isShowVertical", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: null }), SnaplineModel_descriptor3 = SnaplineModel_applyDecoratedDescriptor(SnaplineModel_class.prototype, "position", [mobx_module["C" /* observable */]], { configurable: true, enumerable: true, writable: true, initializer: null }), SnaplineModel_applyDecoratedDescriptor(SnaplineModel_class.prototype, "clearSnapline", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(SnaplineModel_class.prototype, "clearSnapline"), SnaplineModel_class.prototype), SnaplineModel_applyDecoratedDescriptor(SnaplineModel_class.prototype, "setNodeSnapLine", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(SnaplineModel_class.prototype, "setNodeSnapLine"), SnaplineModel_class.prototype)), SnaplineModel_class); // CONCATENATED MODULE: ./src/model/index.ts // CONCATENATED MODULE: ./src/util/raf.ts var rafIdMap = new Map(); var raf_createRaf = function createRaf(callback) { var rafId = uuid_createUuid(); function run() { callback(); var eId = rafIdMap.get(rafId); if (eId) { var nId = window.requestAnimationFrame(run); rafIdMap.set(rafId, nId); } } var id = window.requestAnimationFrame(run); rafIdMap.set(rafId, id); return rafId; }; var cancelRaf = function cancelRaf(rafId) { var eId = rafIdMap.get(rafId); if (eId) { window.cancelAnimationFrame(eId); rafIdMap.delete(rafId); } }; // CONCATENATED MODULE: ./src/view/Anchor.tsx function Anchor_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Anchor_typeof = function _typeof(obj) { return typeof obj; }; } else { Anchor_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Anchor_typeof(obj); } function Anchor_extends() { Anchor_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Anchor_extends.apply(this, arguments); } function Anchor_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function Anchor_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Anchor_ownKeys(Object(source), true).forEach(function (key) { Anchor_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Anchor_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function Anchor_slicedToArray(arr, i) { return Anchor_arrayWithHoles(arr) || Anchor_iterableToArrayLimit(arr, i) || Anchor_unsupportedIterableToArray(arr, i) || Anchor_nonIterableRest(); } function Anchor_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function Anchor_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Anchor_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Anchor_arrayLikeToArray(o, minLen); } function Anchor_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function Anchor_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function Anchor_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function Anchor_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function Anchor_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function Anchor_createClass(Constructor, protoProps, staticProps) { if (protoProps) Anchor_defineProperties(Constructor.prototype, protoProps); if (staticProps) Anchor_defineProperties(Constructor, staticProps); return Constructor; } function Anchor_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Anchor_setPrototypeOf(subClass, superClass); } function Anchor_setPrototypeOf(o, p) { Anchor_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Anchor_setPrototypeOf(o, p); } function Anchor_createSuper(Derived) { var hasNativeReflectConstruct = Anchor_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Anchor_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Anchor_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Anchor_possibleConstructorReturn(this, result); }; } function Anchor_possibleConstructorReturn(self, call) { if (call && (Anchor_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Anchor_assertThisInitialized(self); } function Anchor_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function Anchor_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function Anchor_getPrototypeOf(o) { Anchor_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Anchor_getPrototypeOf(o); } function Anchor_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var Anchor_Anchor = /*#__PURE__*/function (_Component) { Anchor_inherits(Anchor, _Component); var _super = Anchor_createSuper(Anchor); // 不同的target,source的校验规则产生的结果不同 // 不同的target,target的校验规则不同 function Anchor() { var _this; Anchor_classCallCheck(this, Anchor); _this = _super.call(this); Anchor_defineProperty(Anchor_assertThisInitialized(_this), "preTargetNode", void 0); Anchor_defineProperty(Anchor_assertThisInitialized(_this), "sourceRuleResults", void 0); Anchor_defineProperty(Anchor_assertThisInitialized(_this), "targetRuleResults", void 0); Anchor_defineProperty(Anchor_assertThisInitialized(_this), "dragHandler", void 0); Anchor_defineProperty(Anchor_assertThisInitialized(_this), "t", void 0); Anchor_defineProperty(Anchor_assertThisInitialized(_this), "onDragStart", function (_ref) { var event = _ref.event; var _this$props = _this.props, anchorData = _this$props.anchorData, nodeModel = _this$props.nodeModel, graphModel = _this$props.graphModel; var overlapMode = graphModel.overlapMode; // nodeModel.setSelected(true); graphModel.selectNodeById(nodeModel.id); if (overlapMode !== OverlapMode.INCREASE && nodeModel.autoToFront) { graphModel.toFront(nodeModel.id); } graphModel.eventCenter.emit(EventType.ANCHOR_DRAGSTART, { data: anchorData, e: event, nodeModel: nodeModel }); _this.setState({ startX: anchorData.x, startY: anchorData.y, endX: anchorData.x, endY: anchorData.y }); }); Anchor_defineProperty(Anchor_assertThisInitialized(_this), "onDragging", function (_ref2) { var event = _ref2.event; var _this$props2 = _this.props, graphModel = _this$props2.graphModel, nodeModel = _this$props2.nodeModel, anchorData = _this$props2.anchorData; var transformModel = graphModel.transformModel, eventCenter = graphModel.eventCenter, width = graphModel.width, height = graphModel.height, _graphModel$editConfi = graphModel.editConfigModel, autoExpand = _graphModel$editConfi.autoExpand, stopMoveGraph = _graphModel$editConfi.stopMoveGraph; var clientX = event.clientX, clientY = event.clientY; var _graphModel$getPointB = graphModel.getPointByClient({ x: clientX, y: clientY }), _graphModel$getPointB2 = _graphModel$getPointB.domOverlayPosition, x = _graphModel$getPointB2.x, y = _graphModel$getPointB2.y, _graphModel$getPointB3 = _graphModel$getPointB.canvasOverlayPosition, x1 = _graphModel$getPointB3.x, y1 = _graphModel$getPointB3.y; if (_this.t) { cancelRaf(_this.t); } var nearBoundary = []; var size = 10; if (x < 10) { nearBoundary = [size, 0]; } else if (x + 10 > width) { nearBoundary = [-size, 0]; } else if (y < 10) { nearBoundary = [0, size]; } else if (y + 10 > height) { nearBoundary = [0, -size]; } _this.setState({ endX: x1, endY: y1, dragging: true }); _this.moveAnchorEnd(x1, y1); if (nearBoundary.length > 0 && !stopMoveGraph && autoExpand) { _this.t = raf_createRaf(function () { var _nearBoundary = nearBoundary, _nearBoundary2 = Anchor_slicedToArray(_nearBoundary, 2), translateX = _nearBoundary2[0], translateY = _nearBoundary2[1]; transformModel.translate(translateX, translateY); var _this$state = _this.state, endX = _this$state.endX, endY = _this$state.endY; _this.setState({ endX: endX - translateX, endY: endY - translateY }); _this.moveAnchorEnd(endX - translateX, endY - translateY); }); } eventCenter.emit(EventType.ANCHOR_DRAG, { data: anchorData, e: event, nodeModel: nodeModel }); }); Anchor_defineProperty(Anchor_assertThisInitialized(_this), "onDragEnd", function (_ref3) { var event = _ref3.event; if (_this.t) { cancelRaf(_this.t); } _this.checkEnd(event); _this.setState({ startX: 0, startY: 0, endX: 0, endY: 0, dragging: false }); // 清除掉缓存结果 fix:#320 因为创建边之后,会影响校验结果变化,所以需要重新校验 _this.sourceRuleResults.clear(); _this.targetRuleResults.clear(); var _this$props3 = _this.props, graphModel = _this$props3.graphModel, nodeModel = _this$props3.nodeModel, anchorData = _this$props3.anchorData; graphModel.eventCenter.emit(EventType.ANCHOR_DRAGEND, { data: anchorData, e: event, nodeModel: nodeModel }); }); Anchor_defineProperty(Anchor_assertThisInitialized(_this), "checkEnd", function (event) { var _this$props4 = _this.props, graphModel = _this$props4.graphModel, nodeModel = _this$props4.nodeModel, _this$props4$anchorDa = _this$props4.anchorData, x = _this$props4$anchorDa.x, y = _this$props4$anchorDa.y, id = _this$props4$anchorDa.id; // nodeModel.setSelected(false); /* 创建边 */ var edgeType = graphModel.edgeType; var _this$state2 = _this.state, endX = _this$state2.endX, endY = _this$state2.endY, dragging = _this$state2.dragging; var info = targetNodeInfo({ x: endX, y: endY }, graphModel); // 为了保证鼠标离开的时候,将上一个节点状态重置为正常状态。 if (_this.preTargetNode && _this.preTargetNode.state !== ElementState.DEFAULT) { _this.preTargetNode.setElementState(ElementState.DEFAULT); } // 没有dragging就结束边 if (!dragging) return; if (info && info.node) { var targetNode = info.node; var anchorId = info.anchor.id; var targetInfoId = "".concat(nodeModel.id, "_").concat(targetNode.id, "_").concat(anchorId, "_").concat(id); var _ref4 = _this.sourceRuleResults.get(targetInfoId) || {}, isSourcePass = _ref4.isAllPass, sourceMsg = _ref4.msg; var _ref5 = _this.targetRuleResults.get(targetInfoId) || {}, isTargetPass = _ref5.isAllPass, targetMsg = _ref5.msg; if (isSourcePass && isTargetPass) { targetNode.setElementState(ElementState.DEFAULT); var edgeData = graphModel.edgeGenerator(nodeModel.getData(), graphModel.getNodeModelById(info.node.id).getData()); var edgeModel = graphModel.addEdge(Anchor_objectSpread(Anchor_objectSpread({}, edgeData), {}, { sourceNodeId: nodeModel.id, sourceAnchorId: id, startPoint: { x: x, y: y }, targetNodeId: info.node.id, targetAnchorId: info.anchor.id, endPoint: { x: info.anchor.x, y: info.anchor.y } })); var anchorData = _this.props.anchorData; graphModel.eventCenter.emit(EventType.ANCHOR_DROP, { data: anchorData, e: event, nodeModel: nodeModel, edgeModel: edgeModel }); } else { var nodeData = targetNode.getData(); graphModel.eventCenter.emit(EventType.CONNECTION_NOT_ALLOWED, { data: nodeData, msg: targetMsg || sourceMsg }); } } }); _this.sourceRuleResults = new Map(); _this.targetRuleResults = new Map(); _this.state = { startX: 0, startY: 0, endX: 0, endY: 0, dragging: false }; _this.dragHandler = new drag_StepDrag({ onDragStart: _this.onDragStart, onDragging: _this.onDragging, onDragEnd: _this.onDragEnd }); return _this; } Anchor_createClass(Anchor, [{ key: "getAnchorShape", value: function getAnchorShape() { var _this$props5 = this.props, anchorData = _this$props5.anchorData, style = _this$props5.style, node = _this$props5.node; var anchorShape = node.getAnchorShape(anchorData); if (anchorShape) return anchorShape; var x = anchorData.x, y = anchorData.y; var hoverStyle = Anchor_objectSpread(Anchor_objectSpread({}, style), style.hover); return Object(preact_module["g" /* h */])("g", null, Object(preact_module["g" /* h */])(Circle, Anchor_extends({ className: "lf-node-anchor-hover" }, hoverStyle, { x: x, y: y })), Object(preact_module["g" /* h */])(Circle, Anchor_extends({ className: "lf-node-anchor" }, style, { x: x, y: y }))); } }, { key: "moveAnchorEnd", value: function moveAnchorEnd(endX, endY) { var _this$props6 = this.props, graphModel = _this$props6.graphModel, nodeModel = _this$props6.nodeModel, anchorData = _this$props6.anchorData; var info = targetNodeInfo({ x: endX, y: endY }, graphModel); if (info) { var targetNode = info.node; var anchorId = info.anchor.id; if (this.preTargetNode && this.preTargetNode !== info.node) { this.preTargetNode.setElementState(ElementState.DEFAULT); } // #500 不允许锚点自己连自己, 在锚点一开始连接的时候, 不触发自己连接自己的校验。 if (anchorData.id === anchorId) { return; } this.preTargetNode = targetNode; // 支持节点的每个锚点单独设置是否可连接,因此规则key去nodeId + anchorId作为唯一值 var targetInfoId = "".concat(nodeModel.id, "_").concat(targetNode.id, "_").concat(anchorId, "_").concat(anchorData.id); // 查看鼠标是否进入过target,若有检验结果,表示进入过, 就不重复计算了。 if (!this.targetRuleResults.has(targetInfoId)) { var targetAnchor = info.anchor; var sourceRuleResult = nodeModel.isAllowConnectedAsSource(targetNode, anchorData, targetAnchor); var targetRuleResult = targetNode.isAllowConnectedAsTarget(nodeModel, anchorData, targetAnchor); this.sourceRuleResults.set(targetInfoId, formateAnchorConnectValidateData(sourceRuleResult)); this.targetRuleResults.set(targetInfoId, formateAnchorConnectValidateData(targetRuleResult)); } var _this$sourceRuleResul = this.sourceRuleResults.get(targetInfoId), isSourcePass = _this$sourceRuleResul.isAllPass; var _this$targetRuleResul = this.targetRuleResults.get(targetInfoId), isTargetPass = _this$targetRuleResul.isAllPass; // 实时提示出即将链接的锚点 if (isSourcePass && isTargetPass) { targetNode.setElementState(ElementState.ALLOW_CONNECT); } else { targetNode.setElementState(ElementState.NOT_ALLOW_CONNECT); } } else if (this.preTargetNode && this.preTargetNode.state !== ElementState.DEFAULT) { // 为了保证鼠标离开的时候,将上一个节点状态重置为正常状态。 this.preTargetNode.setElementState(ElementState.DEFAULT); } } }, { key: "isShowLine", value: function isShowLine() { var _this$state3 = this.state, startX = _this$state3.startX, startY = _this$state3.startY, endX = _this$state3.endX, endY = _this$state3.endY; var v = node_distance(startX, startY, endX, endY); return v > 10; } }, { key: "render", value: function render() { var _this2 = this; var _this$state4 = this.state, startX = _this$state4.startX, startY = _this$state4.startY, endX = _this$state4.endX, endY = _this$state4.endY; var _this$props7 = this.props, edgeAddable = _this$props7.anchorData.edgeAddable, edgeStyle = _this$props7.edgeStyle; return (// className="lf-anchor" 作为下载时,需要将锚点删除的依据,不要修改类名 Object(preact_module["g" /* h */])("g", { className: "lf-anchor" }, Object(preact_module["g" /* h */])("g", { onMouseDown: function onMouseDown(ev) { if (edgeAddable !== false) { _this2.dragHandler.handleMouseDown(ev); } } }, this.getAnchorShape()), this.isShowLine() && Object(preact_module["g" /* h */])(basic_shape_Line, Anchor_extends({ x1: startX, y1: startY, x2: endX, y2: endY }, edgeStyle, { "pointer-events": "none" }))) ); } }]); return Anchor; }(preact_module["a" /* Component */]); /* harmony default export */ var view_Anchor = (Anchor_Anchor); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/core-js/modules/es.array.fill.js var es_array_fill = __webpack_require__(64); // CONCATENATED MODULE: ./src/view/basic-shape/Text.tsx function Text_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function Text_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Text_ownKeys(Object(source), true).forEach(function (key) { Text_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Text_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function Text_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function Text_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Text_typeof = function _typeof(obj) { return typeof obj; }; } else { Text_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Text_typeof(obj); } function Text_slicedToArray(arr, i) { return Text_arrayWithHoles(arr) || Text_iterableToArrayLimit(arr, i) || Text_unsupportedIterableToArray(arr, i) || Text_nonIterableRest(); } function Text_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function Text_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Text_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Text_arrayLikeToArray(o, minLen); } function Text_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function Text_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function Text_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function Text(props) { var _props$x = props.x, x = _props$x === void 0 ? 0 : _props$x, _props$y = props.y, y = _props$y === void 0 ? 0 : _props$y, value = props.value, fontSize = props.fontSize, _props$fill = props.fill, fill = _props$fill === void 0 ? 'currentColor' : _props$fill, _props$overflowMode = props.overflowMode, overflowMode = _props$overflowMode === void 0 ? 'default' : _props$overflowMode, _props$textWidth = props.textWidth, textWidth = _props$textWidth === void 0 ? '' : _props$textWidth, model = props.model; var attrs = { textAnchor: 'middle', 'dominant-baseline': 'middle', x: x, y: y, fill: fill // ...props, }; Object.entries(props).forEach(function (_ref) { var _ref2 = Text_slicedToArray(_ref, 2), k = _ref2[0], v = _ref2[1]; var valueType = Text_typeof(v); if (valueType !== 'object') { attrs[k] = v; } }); if (value) { // String(value),兼容纯数字的文案 var rows = String(value).split(/[\r\n]/g); var rowsLength = rows.length; if (overflowMode !== 'default') { // 非文本节点设置了自动换行,或边设置了自动换行并且设置了textWidth var BaseType = model.BaseType, modelType = model.modelType; if (BaseType === ElementType.NODE && modelType !== ModelType.TEXT_NODE || BaseType === ElementType.EDGE && textWidth) { return renderHtmlText(props); } } if (rowsLength > 1) { var tSpans = rows.map(function (row, i) { // 保证文字居中,文字Y轴偏移为当前行数对应中心行数的偏移行 * 行高 var tspanLineHeight = fontSize + 2; var offsetY = (i - (rowsLength - 1) / 2) * tspanLineHeight; return Object(preact_module["g" /* h */])("tspan", { className: "lf-text-tspan", x: x, y: y + offsetY }, row); }); return Object(preact_module["g" /* h */])("text", attrs, tSpans); } return Object(preact_module["g" /* h */])("text", attrs, value); } } function renderHtmlText(props) { var value = props.value, fontSize = props.fontSize, model = props.model, _props$fontFamily = props.fontFamily, fontFamily = _props$fontFamily === void 0 ? '' : _props$fontFamily, lineHeight = props.lineHeight, _props$wrapPadding = props.wrapPadding, wrapPadding = _props$wrapPadding === void 0 ? '0, 0' : _props$wrapPadding, overflowMode = props.overflowMode, x = props.x, y = props.y; var width = model.width, textHeight = model.textHeight; var textRealWidth = props.textWidth || width; var rows = String(value).split(/[\r\n]/g); var rowsLength = rows.length; var textRealHeight = getHtmlTextHeight({ rows: rows, style: { fontSize: "".concat(fontSize, "px"), width: "".concat(textRealWidth, "px"), fontFamily: fontFamily, lineHeight: lineHeight, padding: wrapPadding }, rowsLength: rowsLength, className: 'lf-get-text-height' }); // 当文字超过边框时,取文字高度的实际值,也就是文字可以超过边框 var foreignObjectHeight = model.height > textRealHeight ? model.height : textRealHeight; // 如果设置了文字高度,取设置的高度 if (textHeight) { foreignObjectHeight = textHeight; } var isEllipsis = overflowMode === 'ellipsis'; return Object(preact_module["g" /* h */])("g", null, Object(preact_module["g" /* h */])("foreignObject", { width: textRealWidth, height: foreignObjectHeight, x: x - textRealWidth / 2, y: y - foreignObjectHeight / 2 }, Object(preact_module["g" /* h */])("div", { className: "lf-node-text-auto-wrap", style: { minHeight: foreignObjectHeight, width: textRealWidth, padding: wrapPadding } }, Object(preact_module["g" /* h */])("div", { className: isEllipsis ? 'lf-node-text-ellipsis-content' : 'lf-node-text-auto-wrap-content', title: isEllipsis ? rows.join('') : '', style: Text_objectSpread({}, props) }, rows.map(function (item) { return Object(preact_module["g" /* h */])("div", { className: "lf-node-text--auto-wrap-inner" }, item); }))))); } // CONCATENATED MODULE: ./src/view/text/BaseText.tsx function BaseText_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { BaseText_typeof = function _typeof(obj) { return typeof obj; }; } else { BaseText_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return BaseText_typeof(obj); } function BaseText_extends() { BaseText_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return BaseText_extends.apply(this, arguments); } function BaseText_slicedToArray(arr, i) { return BaseText_arrayWithHoles(arr) || BaseText_iterableToArrayLimit(arr, i) || BaseText_unsupportedIterableToArray(arr, i) || BaseText_nonIterableRest(); } function BaseText_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function BaseText_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return BaseText_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return BaseText_arrayLikeToArray(o, minLen); } function BaseText_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function BaseText_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function BaseText_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function BaseText_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function BaseText_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function BaseText_createClass(Constructor, protoProps, staticProps) { if (protoProps) BaseText_defineProperties(Constructor.prototype, protoProps); if (staticProps) BaseText_defineProperties(Constructor, staticProps); return Constructor; } function BaseText_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) BaseText_setPrototypeOf(subClass, superClass); } function BaseText_setPrototypeOf(o, p) { BaseText_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return BaseText_setPrototypeOf(o, p); } function BaseText_createSuper(Derived) { var hasNativeReflectConstruct = BaseText_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = BaseText_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = BaseText_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return BaseText_possibleConstructorReturn(this, result); }; } function BaseText_possibleConstructorReturn(self, call) { if (call && (BaseText_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return BaseText_assertThisInitialized(self); } function BaseText_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function BaseText_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function BaseText_getPrototypeOf(o) { BaseText_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return BaseText_getPrototypeOf(o); } function BaseText_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var BaseText_BaseText = /*#__PURE__*/function (_Component) { BaseText_inherits(BaseText, _Component); var _super = BaseText_createSuper(BaseText); function BaseText(config) { var _this; BaseText_classCallCheck(this, BaseText); _this = _super.call(this); BaseText_defineProperty(BaseText_assertThisInitialized(_this), "dragHandler", void 0); BaseText_defineProperty(BaseText_assertThisInitialized(_this), "sumDeltaX", 0); BaseText_defineProperty(BaseText_assertThisInitialized(_this), "sumDeltaY", 0); BaseText_defineProperty(BaseText_assertThisInitialized(_this), "stepDrag", void 0); BaseText_defineProperty(BaseText_assertThisInitialized(_this), "onDragging", function (_ref) { var deltaX = _ref.deltaX, deltaY = _ref.deltaY; var _this$props = _this.props, model = _this$props.model, transformModel = _this$props.graphModel.transformModel; var _transformModel$fixDe = transformModel.fixDeltaXY(deltaX, deltaY), _transformModel$fixDe2 = BaseText_slicedToArray(_transformModel$fixDe, 2), curDeltaX = _transformModel$fixDe2[0], curDeltaY = _transformModel$fixDe2[1]; model.moveText(curDeltaX, curDeltaY); }); BaseText_defineProperty(BaseText_assertThisInitialized(_this), "dblClickHandler", function () { // 静默模式下,双击不更改状态,不可编辑 var editable = _this.props.editable; if (editable) { var model = _this.props.model; model.setElementState(ElementState.TEXT_EDIT); } }); BaseText_defineProperty(BaseText_assertThisInitialized(_this), "mouseDownHandle", function (ev) { var _this$props2 = _this.props, draggable = _this$props2.draggable, nodeTextDraggable = _this$props2.graphModel.editConfigModel.nodeTextDraggable; if (draggable || nodeTextDraggable) { _this.stepDrag.handleMouseDown(ev); } }); var _model = config.model, _draggable = config.draggable; _this.stepDrag = new drag_StepDrag({ onDragging: _this.onDragging, step: 1, model: _model, isStopPropagation: _draggable }); return _this; } BaseText_createClass(BaseText, [{ key: "getShape", value: function getShape() { var _this$props3 = this.props, model = _this$props3.model, graphModel = _this$props3.graphModel; var text = model.text; var editConfigModel = graphModel.editConfigModel; var value = text.value, x = text.x, y = text.y, editable = text.editable, draggable = text.draggable; var attr = { x: x, y: y, className: '', value: value }; if (editable) { attr.className = 'lf-element-text'; } else if (draggable || editConfigModel.nodeTextDraggable) { attr.className = 'lf-text-draggable'; } else { attr.className = 'lf-text-disabled'; } var style = model.getTextStyle(); return Object(preact_module["g" /* h */])(Text, BaseText_extends({}, attr, style, { model: model })); } }, { key: "render", value: function render() { var text = this.props.model.text; if (text) { return Object(preact_module["g" /* h */])("g", { onMouseDown: this.mouseDownHandle, onDblClick: this.dblClickHandler }, this.getShape()); } } }]); return BaseText; }(preact_module["a" /* Component */]); // CONCATENATED MODULE: ./src/util/browser.ts var isIe = window.navigator.userAgent.match(/MSIE|Trident/) !== null; // CONCATENATED MODULE: ./src/view/node/BaseNode.tsx function BaseNode_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { BaseNode_typeof = function _typeof(obj) { return typeof obj; }; } else { BaseNode_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return BaseNode_typeof(obj); } function BaseNode_slicedToArray(arr, i) { return BaseNode_arrayWithHoles(arr) || BaseNode_iterableToArrayLimit(arr, i) || BaseNode_unsupportedIterableToArray(arr, i) || BaseNode_nonIterableRest(); } function BaseNode_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function BaseNode_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return BaseNode_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return BaseNode_arrayLikeToArray(o, minLen); } function BaseNode_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function BaseNode_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function BaseNode_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function BaseNode_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function BaseNode_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function BaseNode_createClass(Constructor, protoProps, staticProps) { if (protoProps) BaseNode_defineProperties(Constructor.prototype, protoProps); if (staticProps) BaseNode_defineProperties(Constructor, staticProps); return Constructor; } function BaseNode_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) BaseNode_setPrototypeOf(subClass, superClass); } function BaseNode_setPrototypeOf(o, p) { BaseNode_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return BaseNode_setPrototypeOf(o, p); } function BaseNode_createSuper(Derived) { var hasNativeReflectConstruct = BaseNode_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = BaseNode_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = BaseNode_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return BaseNode_possibleConstructorReturn(this, result); }; } function BaseNode_possibleConstructorReturn(self, call) { if (call && (BaseNode_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return BaseNode_assertThisInitialized(self); } function BaseNode_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function BaseNode_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function BaseNode_getPrototypeOf(o) { BaseNode_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return BaseNode_getPrototypeOf(o); } function BaseNode_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var BaseNode_BaseNode = /*#__PURE__*/function (_Component) { BaseNode_inherits(BaseNode, _Component); var _super = BaseNode_createSuper(BaseNode); function BaseNode(props) { var _this; BaseNode_classCallCheck(this, BaseNode); _this = _super.call(this); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "t", void 0); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "moveOffset", void 0); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "stepDrag", void 0); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "contextMenuTime", void 0); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "startTime", void 0); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "clickTimer", void 0); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "onDragStart", function (_ref) { var _ref$event = _ref.event, clientX = _ref$event.clientX, clientY = _ref$event.clientY; var _this$props = _this.props, model = _this$props.model, graphModel = _this$props.graphModel; var _graphModel$getPointB = graphModel.getPointByClient({ x: clientX, y: clientY }), _graphModel$getPointB2 = _graphModel$getPointB.canvasOverlayPosition, x = _graphModel$getPointB2.x, y = _graphModel$getPointB2.y; _this.moveOffset = { x: model.x - x, y: model.y - y }; }); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "onDragging", function (_ref2) { var event = _ref2.event; var _this$props2 = _this.props, model = _this$props2.model, graphModel = _this$props2.graphModel; // const { isDragging } = model; var _graphModel$editConfi = graphModel.editConfigModel, stopMoveGraph = _graphModel$editConfi.stopMoveGraph, autoExpand = _graphModel$editConfi.autoExpand, transformModel = graphModel.transformModel, width = graphModel.width, height = graphModel.height, gridSize = graphModel.gridSize; model.isDragging = true; var clientX = event.clientX, clientY = event.clientY; var _graphModel$getPointB3 = graphModel.getPointByClient({ x: clientX, y: clientY }), _graphModel$getPointB4 = _graphModel$getPointB3.canvasOverlayPosition, x = _graphModel$getPointB4.x, y = _graphModel$getPointB4.y; var _transformModel$Canva = transformModel.CanvasPointToHtmlPoint([x, y]), _transformModel$Canva2 = BaseNode_slicedToArray(_transformModel$Canva, 2), x1 = _transformModel$Canva2[0], y1 = _transformModel$Canva2[1]; // 1. 考虑画布被缩放 // 2. 考虑鼠标位置不再节点中心 x = x + _this.moveOffset.x; y = y + _this.moveOffset.y; // 将x, y移动到grid上 x = snapToGrid(x, gridSize); y = snapToGrid(y, gridSize); if (!width || !height) { graphModel.moveNode2Coordinate(model.id, x, y); return; } var isOutCanvas = x1 < 0 || y1 < 0 || x1 > width || y1 > height; if (autoExpand && !stopMoveGraph && isOutCanvas) { // 鼠标超出画布后的拖动,不处理,而是让上一次setInterval持续滚动画布 return; } // 取节点左上角和右下角,计算节点移动是否超出范围 var _transformModel$Canva3 = transformModel.CanvasPointToHtmlPoint([x - model.width / 2, y - model.height / 2]), _transformModel$Canva4 = BaseNode_slicedToArray(_transformModel$Canva3, 2), leftTopX = _transformModel$Canva4[0], leftTopY = _transformModel$Canva4[1]; var _transformModel$Canva5 = transformModel.CanvasPointToHtmlPoint([x + model.width / 2, y + model.height / 2]), _transformModel$Canva6 = BaseNode_slicedToArray(_transformModel$Canva5, 2), rightBottomX = _transformModel$Canva6[0], rightBottomY = _transformModel$Canva6[1]; var size = Math.max(gridSize, 20); var nearBoundary = []; if (leftTopX < 0) { nearBoundary = [size, 0]; } else if (rightBottomX > graphModel.width) { nearBoundary = [-size, 0]; } else if (leftTopY < 0) { nearBoundary = [0, size]; } else if (rightBottomY > graphModel.height) { nearBoundary = [0, -size]; } if (_this.t) { cancelRaf(_this.t); } if (nearBoundary.length > 0 && !stopMoveGraph && autoExpand) { _this.t = raf_createRaf(function () { var _nearBoundary = nearBoundary, _nearBoundary2 = BaseNode_slicedToArray(_nearBoundary, 2), translateX = _nearBoundary2[0], translateY = _nearBoundary2[1]; transformModel.translate(translateX, translateY); graphModel.moveNode(model.id, -translateX / transformModel.SCALE_X, -translateY / transformModel.SCALE_X); }); } else { graphModel.moveNode2Coordinate(model.id, x, y); } }); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "onDragEnd", function () { if (_this.t) { cancelRaf(_this.t); } var model = _this.props.model; model.isDragging = false; }); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "handleClick", function (e) { // 节点拖拽进画布之后,不触发click事件相关emit // 点拖拽进画布没有触发mousedown事件,没有startTime,用这个值做区分 if (!_this.startTime) return; var time = new Date().getTime() - _this.startTime; if (time > 200) return; // 事件大于200ms,认为是拖拽, 不触发click事件。 var _this$props3 = _this.props, model = _this$props3.model, graphModel = _this$props3.graphModel; // 节点数据,多为事件对象数据抛出 var nodeData = model.getData(); var position = graphModel.getPointByClient({ x: e.clientX, y: e.clientY }); var eventOptions = { data: nodeData, e: e, position: position, isSelected: false, isMultiple: false }; var isRightClick = e.button === 2; // 这里 IE 11不能正确显示 var isDoubleClick = e.detail === 2; // 判断是否有右击,如果有右击则取消点击事件触发 if (isRightClick) return; var editConfigModel = graphModel.editConfigModel; // 在multipleSelect tool禁用的情况下,允许取消选中节点 var isMultiple = isMultipleSelect(e, editConfigModel); eventOptions.isMultiple = isMultiple; if (model.isSelected && !isDoubleClick && isMultiple) { eventOptions.isSelected = false; model.setSelected(false); } else { graphModel.selectNodeById(model.id, isMultiple); eventOptions.isSelected = true; _this.toFront(); } // 不是双击的,默认都是单击 if (isDoubleClick) { if (editConfigModel.nodeTextEdit && model.text.editable) { model.setSelected(false); graphModel.setElementStateById(model.id, ElementState.TEXT_EDIT); } graphModel.eventCenter.emit(EventType.NODE_DBCLICK, eventOptions); } else { graphModel.eventCenter.emit(EventType.ELEMENT_CLICK, eventOptions); graphModel.eventCenter.emit(EventType.NODE_CLICK, eventOptions); } }); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "handleContextMenu", function (ev) { ev.preventDefault(); var _this$props4 = _this.props, model = _this$props4.model, graphModel = _this$props4.graphModel; // 节点数据,多为事件对象数据抛出 var nodeData = model.getData(); var position = graphModel.getPointByClient({ x: ev.clientX, y: ev.clientY }); graphModel.setElementStateById(model.id, ElementState.SHOW_MENU, position.domOverlayPosition); if (!model.isSelected) { graphModel.selectNodeById(model.id); } graphModel.eventCenter.emit(EventType.NODE_CONTEXTMENU, { data: nodeData, e: ev, position: position }); _this.toFront(); }); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "handleMouseDown", function (ev) { var _this$props5 = _this.props, model = _this$props5.model, graphModel = _this$props5.graphModel; _this.startTime = new Date().getTime(); var editConfigModel = graphModel.editConfigModel; if (editConfigModel.adjustNodePosition && model.draggable) { _this.stepDrag && _this.stepDrag.handleMouseDown(ev); } }); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "setHoverON", function (ev) { var _this$props6 = _this.props, model = _this$props6.model, graphModel = _this$props6.graphModel; if (model.isHovered) return; var nodeData = model.getData(); model.setHovered(true); graphModel.eventCenter.emit(EventType.NODE_MOUSEENTER, { data: nodeData, e: ev }); }); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "setHoverOFF", function (ev) { var _this$props7 = _this.props, model = _this$props7.model, graphModel = _this$props7.graphModel; var nodeData = model.getData(); if (!model.isHovered) return; model.setHovered(false); graphModel.eventCenter.emit(EventType.NODE_MOUSELEAVE, { data: nodeData, e: ev }); }); BaseNode_defineProperty(BaseNode_assertThisInitialized(_this), "onMouseOut", function (ev) { if (isIe) { _this.setHoverOFF(ev); } }); var _props$graphModel = props.graphModel, _gridSize = _props$graphModel.gridSize, eventCenter = _props$graphModel.eventCenter, _model = props.model; // 不在构造函数中判断,因为editConfig可能会被动态改变 _this.stepDrag = new drag_StepDrag({ onDragStart: _this.onDragStart, onDragging: _this.onDragging, onDragEnd: _this.onDragEnd, step: _gridSize, eventType: 'NODE', isStopPropagation: false, eventCenter: eventCenter, model: _model }); return _this; } BaseNode_createClass(BaseNode, [{ key: "getAnchorShape", value: function getAnchorShape(anchorData) { return null; } }, { key: "getAnchors", value: function getAnchors() { var _this2 = this; var _this$props8 = this.props, model = _this$props8.model, graphModel = _this$props8.graphModel; var isSelected = model.isSelected, isHitable = model.isHitable, isDragging = model.isDragging, isShowAnchor = model.isShowAnchor; if (isHitable && (isSelected || isShowAnchor) && !isDragging) { return lodash_es_map(model.anchors, function (anchor, index) { var edgeStyle = model.getAnchorLineStyle(anchor); var style = model.getAnchorStyle(anchor); return Object(preact_module["g" /* h */])(view_Anchor, { anchorData: anchor, node: _this2, style: style, edgeStyle: edgeStyle, anchorIndex: index, nodeModel: model, graphModel: graphModel, setHoverOFF: _this2.setHoverOFF }); }); } return []; } }, { key: "getText", value: function getText() { var _this$props9 = this.props, model = _this$props9.model, graphModel = _this$props9.graphModel; // 文本被编辑的时候,显示编辑框,不显示文本。 if (model.state === ElementState.TEXT_EDIT) { return ''; } if (model.text) { var editConfigModel = graphModel.editConfigModel; var draggable = false; if (model.text.draggable || editConfigModel.nodeTextDraggable) { draggable = true; } return Object(preact_module["g" /* h */])(BaseText_BaseText, { editable: editConfigModel.nodeTextEdit && model.text.editable, model: model, graphModel: graphModel, draggable: draggable }); } } }, { key: "getStateClassName", value: function getStateClassName() { var _this$props$model = this.props.model, state = _this$props$model.state, isDragging = _this$props$model.isDragging, isSelected = _this$props$model.isSelected; var className = 'lf-node'; switch (state) { case ElementState.ALLOW_CONNECT: className += ' lf-node-allow'; break; case ElementState.NOT_ALLOW_CONNECT: className += ' lf-node-not-allow'; break; default: className += ' lf-node-default'; break; } if (isDragging) { className += ' lf-isDragging'; } if (isSelected) { className += ' lf-node-selected'; } return className; } }, { key: "toFront", value: /** * 节点置顶,可以被某些不需要置顶的节点重写,如group节点。 */ function toFront() { var _this$props10 = this.props, model = _this$props10.model, graphModel = _this$props10.graphModel; var overlapMode = graphModel.overlapMode; if (overlapMode !== OverlapMode.INCREASE && model.autoToFront) { graphModel.toFront(model.id); } } }, { key: "render", value: function render() { var _this$props11 = this.props, model = _this$props11.model, graphModel = _this$props11.graphModel; var _graphModel$editConfi2 = graphModel.editConfigModel, hideAnchors = _graphModel$editConfi2.hideAnchors, adjustNodePosition = _graphModel$editConfi2.adjustNodePosition, gridSize = graphModel.gridSize, SCALE_X = graphModel.transformModel.SCALE_X; var isHitable = model.isHitable, draggable = model.draggable; var nodeShapeInner = Object(preact_module["g" /* h */])("g", { className: "lf-node-content" }, this.getShape(), this.getText(), hideAnchors ? null : this.getAnchors()); var nodeShape; if (!isHitable) { nodeShape = Object(preact_module["g" /* h */])("g", { className: this.getStateClassName() }, nodeShapeInner); } else { if (adjustNodePosition && draggable) { this.stepDrag.setStep(gridSize * SCALE_X); } nodeShape = Object(preact_module["g" /* h */])("g", { className: this.getStateClassName(), onMouseDown: this.handleMouseDown, onClick: this.handleClick, onMouseEnter: this.setHoverON, onMouseOver: this.setHoverON, onMouseLeave: this.setHoverOFF, onMouseOut: this.onMouseOut, onContextMenu: this.handleContextMenu }, nodeShapeInner); } return nodeShape; } }], [{ key: "getModel", value: function getModel(defaultModel) { return defaultModel; } }]); return BaseNode; }(preact_module["a" /* Component */]); // CONCATENATED MODULE: ./src/view/node/RectNode.tsx function RectNode_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { RectNode_typeof = function _typeof(obj) { return typeof obj; }; } else { RectNode_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return RectNode_typeof(obj); } function RectNode_extends() { RectNode_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return RectNode_extends.apply(this, arguments); } function RectNode_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function RectNode_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function RectNode_createClass(Constructor, protoProps, staticProps) { if (protoProps) RectNode_defineProperties(Constructor.prototype, protoProps); if (staticProps) RectNode_defineProperties(Constructor, staticProps); return Constructor; } function RectNode_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) RectNode_setPrototypeOf(subClass, superClass); } function RectNode_setPrototypeOf(o, p) { RectNode_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return RectNode_setPrototypeOf(o, p); } function RectNode_createSuper(Derived) { var hasNativeReflectConstruct = RectNode_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = RectNode_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = RectNode_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return RectNode_possibleConstructorReturn(this, result); }; } function RectNode_possibleConstructorReturn(self, call) { if (call && (RectNode_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return RectNode_assertThisInitialized(self); } function RectNode_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function RectNode_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function RectNode_getPrototypeOf(o) { RectNode_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return RectNode_getPrototypeOf(o); } var RectNode_RectNode = /*#__PURE__*/function (_BaseNode) { RectNode_inherits(RectNode, _BaseNode); var _super = RectNode_createSuper(RectNode); function RectNode() { RectNode_classCallCheck(this, RectNode); return _super.apply(this, arguments); } RectNode_createClass(RectNode, [{ key: "getShape", value: function getShape() { var model = this.props.model; var style = model.getNodeStyle(); return Object(preact_module["g" /* h */])(Rect, RectNode_extends({}, style, { x: model.x, y: model.y, width: model.width, height: model.height, radius: model.radius })); } }]); return RectNode; }(BaseNode_BaseNode); // CONCATENATED MODULE: ./src/view/node/CircleNode.tsx function CircleNode_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { CircleNode_typeof = function _typeof(obj) { return typeof obj; }; } else { CircleNode_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return CircleNode_typeof(obj); } function CircleNode_extends() { CircleNode_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return CircleNode_extends.apply(this, arguments); } function CircleNode_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function CircleNode_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function CircleNode_createClass(Constructor, protoProps, staticProps) { if (protoProps) CircleNode_defineProperties(Constructor.prototype, protoProps); if (staticProps) CircleNode_defineProperties(Constructor, staticProps); return Constructor; } function CircleNode_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) CircleNode_setPrototypeOf(subClass, superClass); } function CircleNode_setPrototypeOf(o, p) { CircleNode_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return CircleNode_setPrototypeOf(o, p); } function CircleNode_createSuper(Derived) { var hasNativeReflectConstruct = CircleNode_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = CircleNode_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = CircleNode_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return CircleNode_possibleConstructorReturn(this, result); }; } function CircleNode_possibleConstructorReturn(self, call) { if (call && (CircleNode_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return CircleNode_assertThisInitialized(self); } function CircleNode_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function CircleNode_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function CircleNode_getPrototypeOf(o) { CircleNode_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return CircleNode_getPrototypeOf(o); } var CircleNode_CircleNode = /*#__PURE__*/function (_BaseNode) { CircleNode_inherits(CircleNode, _BaseNode); var _super = CircleNode_createSuper(CircleNode); function CircleNode() { CircleNode_classCallCheck(this, CircleNode); return _super.apply(this, arguments); } CircleNode_createClass(CircleNode, [{ key: "getShape", value: function getShape() { var model = this.props.model; var x = model.x, y = model.y, r = model.r; var style = model.getNodeStyle(); return Object(preact_module["g" /* h */])(Circle, CircleNode_extends({}, style, { x: x, y: y, r: r })); } }]); return CircleNode; }(BaseNode_BaseNode); // CONCATENATED MODULE: ./src/view/basic-shape/Polygon.tsx function Polygon_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Polygon_typeof = function _typeof(obj) { return typeof obj; }; } else { Polygon_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Polygon_typeof(obj); } function Polygon_slicedToArray(arr, i) { return Polygon_arrayWithHoles(arr) || Polygon_iterableToArrayLimit(arr, i) || Polygon_unsupportedIterableToArray(arr, i) || Polygon_nonIterableRest(); } function Polygon_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function Polygon_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Polygon_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Polygon_arrayLikeToArray(o, minLen); } function Polygon_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function Polygon_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function Polygon_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function Polygon(props) { var points = props.points, className = props.className; var attrs = { fill: 'transparent', fillOpacity: 1, strokeWidth: 1, stroke: '#000', strokeOpacity: 1, points: '' }; Object.entries(props).forEach(function (_ref) { var _ref2 = Polygon_slicedToArray(_ref, 2), k = _ref2[0], v = _ref2[1]; var valueType = Polygon_typeof(v); if (valueType !== 'object') { attrs[k] = v; } }); if (className) { attrs.className = "lf-basic-shape ".concat(className); } else { attrs.className = 'lf-basic-shape'; } attrs.points = points.map(function (point) { return point.join(','); }).join(' '); return Object(preact_module["g" /* h */])("polygon", attrs); } // CONCATENATED MODULE: ./src/view/node/PolygonNode.tsx function PolygonNode_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { PolygonNode_typeof = function _typeof(obj) { return typeof obj; }; } else { PolygonNode_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return PolygonNode_typeof(obj); } function PolygonNode_extends() { PolygonNode_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return PolygonNode_extends.apply(this, arguments); } function PolygonNode_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function PolygonNode_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function PolygonNode_createClass(Constructor, protoProps, staticProps) { if (protoProps) PolygonNode_defineProperties(Constructor.prototype, protoProps); if (staticProps) PolygonNode_defineProperties(Constructor, staticProps); return Constructor; } function PolygonNode_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) PolygonNode_setPrototypeOf(subClass, superClass); } function PolygonNode_setPrototypeOf(o, p) { PolygonNode_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return PolygonNode_setPrototypeOf(o, p); } function PolygonNode_createSuper(Derived) { var hasNativeReflectConstruct = PolygonNode_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = PolygonNode_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = PolygonNode_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return PolygonNode_possibleConstructorReturn(this, result); }; } function PolygonNode_possibleConstructorReturn(self, call) { if (call && (PolygonNode_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return PolygonNode_assertThisInitialized(self); } function PolygonNode_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function PolygonNode_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function PolygonNode_getPrototypeOf(o) { PolygonNode_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return PolygonNode_getPrototypeOf(o); } var PolygonNode_PolygonNode = /*#__PURE__*/function (_BaseNode) { PolygonNode_inherits(PolygonNode, _BaseNode); var _super = PolygonNode_createSuper(PolygonNode); function PolygonNode() { PolygonNode_classCallCheck(this, PolygonNode); return _super.apply(this, arguments); } PolygonNode_createClass(PolygonNode, [{ key: "getShape", value: function getShape() { var model = this.props.model; var x = model.x, y = model.y, width = model.width, height = model.height, points = model.points; var style = model.getNodeStyle(); var attr = { transform: "matrix(1 0 0 1 ".concat(x - width / 2, " ").concat(y - height / 2, ")") }; return Object(preact_module["g" /* h */])("g", attr, Object(preact_module["g" /* h */])(Polygon, PolygonNode_extends({}, style, { points: points, x: x, y: y }))); } }]); return PolygonNode; }(BaseNode_BaseNode); // CONCATENATED MODULE: ./src/view/node/DiamondNode.tsx function DiamondNode_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { DiamondNode_typeof = function _typeof(obj) { return typeof obj; }; } else { DiamondNode_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return DiamondNode_typeof(obj); } function DiamondNode_extends() { DiamondNode_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DiamondNode_extends.apply(this, arguments); } function DiamondNode_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function DiamondNode_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function DiamondNode_createClass(Constructor, protoProps, staticProps) { if (protoProps) DiamondNode_defineProperties(Constructor.prototype, protoProps); if (staticProps) DiamondNode_defineProperties(Constructor, staticProps); return Constructor; } function DiamondNode_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) DiamondNode_setPrototypeOf(subClass, superClass); } function DiamondNode_setPrototypeOf(o, p) { DiamondNode_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return DiamondNode_setPrototypeOf(o, p); } function DiamondNode_createSuper(Derived) { var hasNativeReflectConstruct = DiamondNode_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = DiamondNode_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = DiamondNode_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return DiamondNode_possibleConstructorReturn(this, result); }; } function DiamondNode_possibleConstructorReturn(self, call) { if (call && (DiamondNode_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return DiamondNode_assertThisInitialized(self); } function DiamondNode_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function DiamondNode_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function DiamondNode_getPrototypeOf(o) { DiamondNode_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return DiamondNode_getPrototypeOf(o); } var DiamondNode_DiamondNode = /*#__PURE__*/function (_BaseNode) { DiamondNode_inherits(DiamondNode, _BaseNode); var _super = DiamondNode_createSuper(DiamondNode); function DiamondNode() { DiamondNode_classCallCheck(this, DiamondNode); return _super.apply(this, arguments); } DiamondNode_createClass(DiamondNode, [{ key: "getShape", value: function getShape() { var model = this.props.model; var style = model.getNodeStyle(); return Object(preact_module["g" /* h */])("g", null, Object(preact_module["g" /* h */])(Polygon, DiamondNode_extends({}, style, { points: model.points, x: model.x, y: model.y }))); } }]); return DiamondNode; }(BaseNode_BaseNode); // CONCATENATED MODULE: ./src/view/basic-shape/Ellipse.tsx function Ellipse_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Ellipse_typeof = function _typeof(obj) { return typeof obj; }; } else { Ellipse_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Ellipse_typeof(obj); } function Ellipse_slicedToArray(arr, i) { return Ellipse_arrayWithHoles(arr) || Ellipse_iterableToArrayLimit(arr, i) || Ellipse_unsupportedIterableToArray(arr, i) || Ellipse_nonIterableRest(); } function Ellipse_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function Ellipse_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Ellipse_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Ellipse_arrayLikeToArray(o, minLen); } function Ellipse_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function Ellipse_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function Ellipse_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function Ellipse(props) { var _props$x = props.x, x = _props$x === void 0 ? 0 : _props$x, _props$y = props.y, y = _props$y === void 0 ? 0 : _props$y, _props$rx = props.rx, rx = _props$rx === void 0 ? 4 : _props$rx, _props$ry = props.ry, ry = _props$ry === void 0 ? 4 : _props$ry, className = props.className; var attrs = { cx: x, cy: y, rx: rx, ry: ry, fill: 'transparent', fillOpacity: 1, strokeWidth: '1', stroke: '#000', strokeOpacity: 1 }; Object.entries(props).forEach(function (_ref) { var _ref2 = Ellipse_slicedToArray(_ref, 2), k = _ref2[0], v = _ref2[1]; var valueType = Ellipse_typeof(v); if (valueType !== 'object') { attrs[k] = v; } }); if (className) { attrs.className = "lf-basic-shape ".concat(className); } else { attrs.className = 'lf-basic-shape'; } return Object(preact_module["g" /* h */])("ellipse", attrs); } // CONCATENATED MODULE: ./src/view/node/EllipseNode.tsx function EllipseNode_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { EllipseNode_typeof = function _typeof(obj) { return typeof obj; }; } else { EllipseNode_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return EllipseNode_typeof(obj); } function EllipseNode_extends() { EllipseNode_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return EllipseNode_extends.apply(this, arguments); } function EllipseNode_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function EllipseNode_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function EllipseNode_createClass(Constructor, protoProps, staticProps) { if (protoProps) EllipseNode_defineProperties(Constructor.prototype, protoProps); if (staticProps) EllipseNode_defineProperties(Constructor, staticProps); return Constructor; } function EllipseNode_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) EllipseNode_setPrototypeOf(subClass, superClass); } function EllipseNode_setPrototypeOf(o, p) { EllipseNode_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return EllipseNode_setPrototypeOf(o, p); } function EllipseNode_createSuper(Derived) { var hasNativeReflectConstruct = EllipseNode_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = EllipseNode_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = EllipseNode_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return EllipseNode_possibleConstructorReturn(this, result); }; } function EllipseNode_possibleConstructorReturn(self, call) { if (call && (EllipseNode_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return EllipseNode_assertThisInitialized(self); } function EllipseNode_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function EllipseNode_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function EllipseNode_getPrototypeOf(o) { EllipseNode_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return EllipseNode_getPrototypeOf(o); } var EllipseNode_EllipseNode = /*#__PURE__*/function (_BaseNode) { EllipseNode_inherits(EllipseNode, _BaseNode); var _super = EllipseNode_createSuper(EllipseNode); function EllipseNode() { EllipseNode_classCallCheck(this, EllipseNode); return _super.apply(this, arguments); } EllipseNode_createClass(EllipseNode, [{ key: "getShape", value: function getShape() { var model = this.props.model; var style = model.getNodeStyle(); return Object(preact_module["g" /* h */])(Ellipse, EllipseNode_extends({}, style, { x: model.x, y: model.y, rx: model.rx, ry: model.ry })); } }]); return EllipseNode; }(BaseNode_BaseNode); // CONCATENATED MODULE: ./src/view/node/TextNode.tsx function TextNode_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { TextNode_typeof = function _typeof(obj) { return typeof obj; }; } else { TextNode_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return TextNode_typeof(obj); } function TextNode_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function TextNode_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { TextNode_ownKeys(Object(source), true).forEach(function (key) { TextNode_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { TextNode_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function TextNode_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function TextNode_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function TextNode_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function TextNode_createClass(Constructor, protoProps, staticProps) { if (protoProps) TextNode_defineProperties(Constructor.prototype, protoProps); if (staticProps) TextNode_defineProperties(Constructor, staticProps); return Constructor; } function TextNode_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) TextNode_setPrototypeOf(subClass, superClass); } function TextNode_setPrototypeOf(o, p) { TextNode_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return TextNode_setPrototypeOf(o, p); } function TextNode_createSuper(Derived) { var hasNativeReflectConstruct = TextNode_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = TextNode_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = TextNode_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return TextNode_possibleConstructorReturn(this, result); }; } function TextNode_possibleConstructorReturn(self, call) { if (call && (TextNode_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return TextNode_assertThisInitialized(self); } function TextNode_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function TextNode_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function TextNode_getPrototypeOf(o) { TextNode_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return TextNode_getPrototypeOf(o); } var TextNode_TextNode = /*#__PURE__*/function (_BaseNode) { TextNode_inherits(TextNode, _BaseNode); var _super = TextNode_createSuper(TextNode); function TextNode() { TextNode_classCallCheck(this, TextNode); return _super.apply(this, arguments); } TextNode_createClass(TextNode, [{ key: "getBackground", value: function getBackground() { var model = this.props.model; var style = model.getTextStyle(); var text = model.text; if (text && text.value && style.background && style.background.fill !== 'transparent') { var x = text.x, y = text.y; // 背景框宽度,最长一行字节数/2 * fontsize + 2 // 背景框宽度, 行数 * fontsize + 2 var width = model.width, height = model.height; var rectAttr = TextNode_objectSpread(TextNode_objectSpread({}, style.background), {}, { x: x, y: y - 1, width: width, height: height }); return Object(preact_module["g" /* h */])(Rect, rectAttr); } } }, { key: "getShape", value: function getShape() { return Object(preact_module["g" /* h */])("g", null, this.getBackground()); } }]); return TextNode; }(BaseNode_BaseNode); // CONCATENATED MODULE: ./src/view/node/HtmlNode.tsx function HtmlNode_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { HtmlNode_typeof = function _typeof(obj) { return typeof obj; }; } else { HtmlNode_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return HtmlNode_typeof(obj); } function HtmlNode_extends() { HtmlNode_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return HtmlNode_extends.apply(this, arguments); } function HtmlNode_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function HtmlNode_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function HtmlNode_createClass(Constructor, protoProps, staticProps) { if (protoProps) HtmlNode_defineProperties(Constructor.prototype, protoProps); if (staticProps) HtmlNode_defineProperties(Constructor, staticProps); return Constructor; } function HtmlNode_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) HtmlNode_setPrototypeOf(subClass, superClass); } function HtmlNode_setPrototypeOf(o, p) { HtmlNode_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return HtmlNode_setPrototypeOf(o, p); } function HtmlNode_createSuper(Derived) { var hasNativeReflectConstruct = HtmlNode_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = HtmlNode_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = HtmlNode_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return HtmlNode_possibleConstructorReturn(this, result); }; } function HtmlNode_possibleConstructorReturn(self, call) { if (call && (HtmlNode_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return HtmlNode_assertThisInitialized(self); } function HtmlNode_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function HtmlNode_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function HtmlNode_getPrototypeOf(o) { HtmlNode_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return HtmlNode_getPrototypeOf(o); } function HtmlNode_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var HtmlNode_HtmlNode = /*#__PURE__*/function (_BaseNode) { HtmlNode_inherits(HtmlNode, _BaseNode); var _super = HtmlNode_createSuper(HtmlNode); function HtmlNode() { var _this; HtmlNode_classCallCheck(this, HtmlNode); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); HtmlNode_defineProperty(HtmlNode_assertThisInitialized(_this), "ref", void 0); HtmlNode_defineProperty(HtmlNode_assertThisInitialized(_this), "currentProperties", void 0); HtmlNode_defineProperty(HtmlNode_assertThisInitialized(_this), "preProperties", void 0); HtmlNode_defineProperty(HtmlNode_assertThisInitialized(_this), "setRef", function (dom) { _this.ref = dom; }); return _this; } HtmlNode_createClass(HtmlNode, [{ key: "rootEl", get: function get() { return this.ref; } /** * @overridable 支持重写 * 自定义HTML节点内容 * @param {HTMLElement} rootEl 自定义HTML节点内容可以挂载的dom节点 * @example * class CustomHtmlNode extends HtmlNode { * setHtml(rootEl) { * const input = document.createElement('input'); * rootEl.appendChild(input) * } * } */ }, { key: "setHtml", value: function setHtml(rootEl) { rootEl.appendChild(document.createElement('div')); } /** * @overridable 支持重写 * 和react的shouldComponentUpdate类似,都是为了避免出发不必要的render. * 但是这里不一样的地方在于,setHtml方法,我们只在properties发生变化了后再触发。 * 而x,y等这些坐标相关的方法发生了变化,不会再重新触发setHtml. */ }, { key: "shouldUpdate", value: function shouldUpdate() { if (this.preProperties && this.preProperties === this.currentProperties) return; this.preProperties = this.currentProperties; return true; } }, { key: "componentDidMount", value: function componentDidMount() { if (this.shouldUpdate()) { this.setHtml(this.rootEl); } } }, { key: "componentDidUpdate", value: function componentDidUpdate() { if (this.shouldUpdate()) { this.setHtml(this.rootEl); } } }, { key: "getShape", value: function getShape() { var model = this.props.model; var x = model.x, y = model.y, height = model.height, width = model.width; var style = model.getNodeStyle(); this.currentProperties = JSON.stringify(model.properties); return Object(preact_module["g" /* h */])("foreignObject", HtmlNode_extends({}, style, { x: x - width / 2, y: y - height / 2, width: width, height: height, ref: this.setRef })); } }]); return HtmlNode; }(BaseNode_BaseNode); // CONCATENATED MODULE: ./src/view/node/index.ts // CONCATENATED MODULE: ./src/view/text/LineText.tsx function LineText_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { LineText_typeof = function _typeof(obj) { return typeof obj; }; } else { LineText_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return LineText_typeof(obj); } function LineText_extends() { LineText_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return LineText_extends.apply(this, arguments); } function LineText_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function LineText_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { LineText_ownKeys(Object(source), true).forEach(function (key) { LineText_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { LineText_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function LineText_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function LineText_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function LineText_createClass(Constructor, protoProps, staticProps) { if (protoProps) LineText_defineProperties(Constructor.prototype, protoProps); if (staticProps) LineText_defineProperties(Constructor, staticProps); return Constructor; } function LineText_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) LineText_setPrototypeOf(subClass, superClass); } function LineText_setPrototypeOf(o, p) { LineText_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return LineText_setPrototypeOf(o, p); } function LineText_createSuper(Derived) { var hasNativeReflectConstruct = LineText_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = LineText_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = LineText_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return LineText_possibleConstructorReturn(this, result); }; } function LineText_possibleConstructorReturn(self, call) { if (call && (LineText_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return LineText_assertThisInitialized(self); } function LineText_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function LineText_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function LineText_getPrototypeOf(o) { LineText_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return LineText_getPrototypeOf(o); } function LineText_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var LineText_LineText = /*#__PURE__*/function (_BaseText) { LineText_inherits(LineText, _BaseText); var _super = LineText_createSuper(LineText); function LineText(config) { var _this; LineText_classCallCheck(this, LineText); _this = _super.call(this, config); LineText_defineProperty(LineText_assertThisInitialized(_this), "setHoverON", function () { _this.setState({ isHovered: true }); }); LineText_defineProperty(LineText_assertThisInitialized(_this), "setHoverOFF", function () { _this.setState({ isHovered: false }); }); _this.state = { isHovered: false }; return _this; } LineText_createClass(LineText, [{ key: "getBackground", value: function getBackground() { var model = this.props.model; var style = model.getTextStyle(); var text = model.text; var backgroundStyle = style.background || {}; var isHovered = this.state.isHovered; if (isHovered && style.hover && style.hover.background) { backgroundStyle = LineText_objectSpread(LineText_objectSpread({}, backgroundStyle), style.hover.background); } // 存在文本并且文本背景不为透明时计算背景框 if (text && text.value && backgroundStyle.fill !== 'transparent') { var fontSize = style.fontSize, overflowMode = style.overflowMode, lineHeight = style.lineHeight, wrapPadding = style.wrapPadding, textWidth = style.textWidth; var value = text.value; var x = text.x, y = text.y; var rows = String(value).split(/[\r\n]/g); // 计算行数 var rowsLength = rows.length; var rectAttr; if (overflowMode === 'autoWrap' && textWidth) { var textHeight = getHtmlTextHeight({ rows: rows, style: { fontSize: "".concat(fontSize, "px"), width: "".concat(textWidth, "px"), lineHeight: lineHeight, padding: wrapPadding }, rowsLength: rowsLength, className: 'lf-get-text-height' }); rectAttr = LineText_objectSpread(LineText_objectSpread({}, backgroundStyle), {}, { x: x - 1, y: y - 1, width: textWidth, height: textHeight }); } else { // 计算文本中最长的一行的字节数 var longestBytes = 0; rows && rows.forEach(function (item) { var rowByteLength = getBytesLength(item); longestBytes = rowByteLength > longestBytes ? rowByteLength : longestBytes; }); // 背景框宽度,最长一行字节数/2 * fontsize + 2 // 背景框宽度, 行数 * fontsize + 2 var _getSvgTextWidthHeigh = node_getSvgTextWidthHeight({ rows: rows, fontSize: fontSize, rowsLength: rowsLength }), width = _getSvgTextWidthHeigh.width, height = _getSvgTextWidthHeigh.height; // 根据设置的padding调整width, height, x, y的值 if (typeof backgroundStyle.wrapPadding === 'string') { var paddings = backgroundStyle.wrapPadding.split(',').filter(function (padding) { return padding.trim(); }).map(function (padding) { return parseFloat(padding.trim()); }); if (paddings.length > 0 && paddings.length <= 4) { if (paddings.length === 1) { paddings = [paddings[0], paddings[0], paddings[0], paddings[0]]; } else if (paddings.length === 2) { paddings = [paddings[0], paddings[1], paddings[0], paddings[1]]; } else if (paddings.length === 3) { paddings = [paddings[0], paddings[1], paddings[2], paddings[1]]; } width += paddings[1] + paddings[3]; height += paddings[0] + paddings[2]; x = x + (paddings[1] - paddings[3]) / 2; y = y + (paddings[2] - paddings[0]) / 2; } } rectAttr = LineText_objectSpread(LineText_objectSpread({}, backgroundStyle), {}, { x: x - 1, y: y - 1, width: width, height: height }); } return Object(preact_module["g" /* h */])(Rect, rectAttr); } } }, { key: "getShape", value: function getShape() { var model = this.props.model; var text = model.text; var value = text.value, x = text.x, y = text.y; if (!value) return; var style = model.getTextStyle(); var attr = LineText_objectSpread({ x: x, y: y, className: 'lf-element-text', value: value }, style); return Object(preact_module["g" /* h */])("g", { className: "lf-line-text", onMouseEnter: this.setHoverON, onMouseLeave: this.setHoverOFF }, this.getBackground(), Object(preact_module["g" /* h */])(Text, LineText_extends({}, attr, { model: model }))); } }]); return LineText; }(BaseText_BaseText); // CONCATENATED MODULE: ./src/view/edge/AdjustPoint.tsx function AdjustPoint_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { AdjustPoint_typeof = function _typeof(obj) { return typeof obj; }; } else { AdjustPoint_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return AdjustPoint_typeof(obj); } function AdjustPoint_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function AdjustPoint_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { AdjustPoint_ownKeys(Object(source), true).forEach(function (key) { AdjustPoint_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { AdjustPoint_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function AdjustPoint_slicedToArray(arr, i) { return AdjustPoint_arrayWithHoles(arr) || AdjustPoint_iterableToArrayLimit(arr, i) || AdjustPoint_unsupportedIterableToArray(arr, i) || AdjustPoint_nonIterableRest(); } function AdjustPoint_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function AdjustPoint_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return AdjustPoint_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return AdjustPoint_arrayLikeToArray(o, minLen); } function AdjustPoint_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function AdjustPoint_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function AdjustPoint_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function AdjustPoint_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function AdjustPoint_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function AdjustPoint_createClass(Constructor, protoProps, staticProps) { if (protoProps) AdjustPoint_defineProperties(Constructor.prototype, protoProps); if (staticProps) AdjustPoint_defineProperties(Constructor, staticProps); return Constructor; } function AdjustPoint_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) AdjustPoint_setPrototypeOf(subClass, superClass); } function AdjustPoint_setPrototypeOf(o, p) { AdjustPoint_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return AdjustPoint_setPrototypeOf(o, p); } function AdjustPoint_createSuper(Derived) { var hasNativeReflectConstruct = AdjustPoint_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = AdjustPoint_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = AdjustPoint_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return AdjustPoint_possibleConstructorReturn(this, result); }; } function AdjustPoint_possibleConstructorReturn(self, call) { if (call && (AdjustPoint_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return AdjustPoint_assertThisInitialized(self); } function AdjustPoint_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function AdjustPoint_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function AdjustPoint_getPrototypeOf(o) { AdjustPoint_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return AdjustPoint_getPrototypeOf(o); } function AdjustPoint_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var AdjustType; (function (AdjustType) { AdjustType["SOURCE"] = "SOURCE"; AdjustType["TARGET"] = "TARGET"; })(AdjustType || (AdjustType = {})); var AdjustPoint_AdjustPoint = /*#__PURE__*/function (_Component) { AdjustPoint_inherits(AdjustPoint, _Component); var _super = AdjustPoint_createSuper(AdjustPoint); function AdjustPoint(props) { var _this; AdjustPoint_classCallCheck(this, AdjustPoint); _this = _super.call(this); AdjustPoint_defineProperty(AdjustPoint_assertThisInitialized(_this), "stepDragData", void 0); AdjustPoint_defineProperty(AdjustPoint_assertThisInitialized(_this), "stepDrag", void 0); AdjustPoint_defineProperty(AdjustPoint_assertThisInitialized(_this), "oldEdge", void 0); AdjustPoint_defineProperty(AdjustPoint_assertThisInitialized(_this), "preTargetNode", void 0); AdjustPoint_defineProperty(AdjustPoint_assertThisInitialized(_this), "targetRuleResults", void 0); AdjustPoint_defineProperty(AdjustPoint_assertThisInitialized(_this), "sourceRuleResults", void 0); AdjustPoint_defineProperty(AdjustPoint_assertThisInitialized(_this), "handleMouseDown", function (ev) { if (_this.stepDrag) { _this.stepDrag.handleMouseDown(ev); } }); AdjustPoint_defineProperty(AdjustPoint_assertThisInitialized(_this), "onDragStart", function () { var _this$props = _this.props, x = _this$props.x, y = _this$props.y, edgeModel = _this$props.edgeModel; var startPoint = edgeModel.startPoint, endPoint = edgeModel.endPoint, pointsList = edgeModel.pointsList; // 记录下原始路径信息,在调整中,如果放弃调整,进行路径还原 _this.oldEdge = { startPoint: startPoint, endPoint: endPoint, pointsList: pointsList }; _this.setState({ endX: x, endY: y, dragging: true }); // 拖拽AdjustPoint时不修改edgeModel.isHitable,避免偶尔会出现边不能点击问题(https://github.com/didi/LogicFlow/issues/974) // edgeModel.isHitable = false; }); AdjustPoint_defineProperty(AdjustPoint_assertThisInitialized(_this), "onDragging", function (_ref) { var deltaX = _ref.deltaX, deltaY = _ref.deltaY; var _this$state = _this.state, endX = _this$state.endX, endY = _this$state.endY; var _this$props2 = _this.props, graphModel = _this$props2.graphModel, type = _this$props2.type; var transformModel = graphModel.transformModel, editConfigModel = graphModel.editConfigModel; var _transformModel$moveC = transformModel.moveCanvasPointByHtml([endX, endY], deltaX, deltaY), _transformModel$moveC2 = AdjustPoint_slicedToArray(_transformModel$moveC, 2), x = _transformModel$moveC2[0], y = _transformModel$moveC2[1]; _this.setState({ endX: x, endY: y, dragging: true }); // 调整过程中实时更新路径 var edgeModel = _this.props.edgeModel; var info = targetNodeInfo({ x: endX, y: endY }, graphModel); // 如果一定的坐标能够找到目标节点,预结算当前节点与目标节点的路径进行展示 if (info && info.node && _this.isAllowAdjust(info)) { var params; var startPoint = edgeModel.startPoint, endPoint = edgeModel.endPoint, sourceNode = edgeModel.sourceNode, targetNode = edgeModel.targetNode; if (type === AdjustType.SOURCE) { params = { startPoint: { x: info.anchor.x, y: info.anchor.y }, endPoint: { x: endPoint.x, y: endPoint.y }, sourceNode: info.node, targetNode: targetNode }; } else if (type === AdjustType.TARGET) { params = { startPoint: { x: startPoint.x, y: startPoint.y }, endPoint: { x: info.anchor.x, y: info.anchor.y }, sourceNode: sourceNode, targetNode: info.node }; } edgeModel.updateAfterAdjustStartAndEnd(params); } else if (type === AdjustType.SOURCE) { // 如果没有找到目标节点,更显起终点为当前坐标 edgeModel.updateStartPoint({ x: x, y: y }); } else if (type === AdjustType.TARGET) { edgeModel.updateEndPoint({ x: x, y: y }); } if (edgeModel.text.value && editConfigModel.adjustEdge) { edgeModel.setText(Object.assign({}, edgeModel.text, edgeModel.textPosition)); } }); AdjustPoint_defineProperty(AdjustPoint_assertThisInitialized(_this), "onDragEnd", function (_ref2) { var event = _ref2.event; try { var _this$preTargetNode; // 将状态置为非拖拽状态 _this.setState({ dragging: false }); var _this$props3 = _this.props, graphModel = _this$props3.graphModel, edgeModel = _this$props3.edgeModel, type = _this$props3.type; // 拖拽AdjustPoint时不修改edgeModel.isHitable,避免偶尔会出现边不能点击问题(https://github.com/didi/LogicFlow/issues/974) // edgeModel.isHitable = true; var _this$state2 = _this.state, endX = _this$state2.endX, endY = _this$state2.endY, dragging = _this$state2.dragging; var info = targetNodeInfo({ x: endX, y: endY }, graphModel); // 没有dragging就结束边 if (!dragging) return; // 如果找到目标节点,删除老边,创建新边 var needRecoveryEdge = false; var createEdgeInfo; if (info && info.node && _this.isAllowAdjust(info)) { var _edgeData$text; var edgeData = edgeModel.getData(); createEdgeInfo = AdjustPoint_objectSpread(AdjustPoint_objectSpread({}, edgeData), {}, { sourceAnchorId: '', targetAnchorId: '', text: (edgeData === null || edgeData === void 0 ? void 0 : (_edgeData$text = edgeData.text) === null || _edgeData$text === void 0 ? void 0 : _edgeData$text.value) || '' }); // 根据调整点是边的起点或重点,计算创建边需要的参数 if (type === AdjustType.SOURCE) { var edgeInfo = graphModel.edgeGenerator(graphModel.getNodeModelById(info.node.id).getData(), graphModel.getNodeModelById(edgeModel.targetNodeId).getData(), createEdgeInfo); createEdgeInfo = AdjustPoint_objectSpread(AdjustPoint_objectSpread({}, edgeInfo), {}, { sourceNodeId: info.node.id, sourceAnchorId: info.anchor.id, startPoint: { x: info.anchor.x, y: info.anchor.y }, targetNodeId: edgeModel.targetNodeId, endPoint: AdjustPoint_objectSpread({}, edgeModel.endPoint) }); // 找到的是原有的源节点上的原锚点时,还原边 if (edgeModel.sourceNodeId === info.node.id && edgeModel.sourceAnchorId === info.anchor.id) { needRecoveryEdge = true; } } else if (type === AdjustType.TARGET) { var _edgeInfo = graphModel.edgeGenerator(graphModel.getNodeModelById(edgeModel.sourceNodeId).getData(), graphModel.getNodeModelById(info.node.id).getData(), createEdgeInfo); createEdgeInfo = AdjustPoint_objectSpread(AdjustPoint_objectSpread({}, _edgeInfo), {}, { sourceNodeId: edgeModel.sourceNodeId, startPoint: AdjustPoint_objectSpread({}, edgeModel.startPoint), targetNodeId: info.node.id, targetAnchorId: info.anchor.id, endPoint: { x: info.anchor.x, y: info.anchor.y } }); // 找到的是原有的目标节点上的原锚点时,还原边 if (edgeModel.targetNodeId === info.node.id && edgeModel.targetAnchorId === info.anchor.id) { needRecoveryEdge = true; } } } else { needRecoveryEdge = true; } if (!needRecoveryEdge) { // 为了保证id不变必须要先删除老边,再创建新边,创建新边是会判断是否有重复的id // 删除老边 graphModel.deleteEdgeById(edgeModel.id); // 创建新边 var edge = graphModel.addEdge(AdjustPoint_objectSpread({}, createEdgeInfo)); // 向外抛出事件 graphModel.eventCenter.emit(EventType.EDGE_EXCHANGE_NODE, { data: { newEdge: edge.getData(), oldEdge: edgeModel.getData() } }); } else { // 如果没有找到目标节点,还原边 _this.recoveryEdge(); } (_this$preTargetNode = _this.preTargetNode) === null || _this$preTargetNode === void 0 ? void 0 : _this$preTargetNode.setElementState(ElementState.DEFAULT); } finally { var _graphModel2 = _this.props.graphModel; _graphModel2.eventCenter.emit(EventType.ADJUST_POINT_DRAGEND, { e: event, data: _this.stepDragData }); } }); AdjustPoint_defineProperty(AdjustPoint_assertThisInitialized(_this), "recoveryEdge", function () { var edgeModel = _this.props.edgeModel; var _this$oldEdge = _this.oldEdge, startPoint = _this$oldEdge.startPoint, endPoint = _this$oldEdge.endPoint, pointsList = _this$oldEdge.pointsList; edgeModel.updateStartPoint(startPoint); edgeModel.updateEndPoint(endPoint); // 折线和曲线还需要更新其pointsList if (edgeModel.modelType !== ModelType.LINE_EDGE) { edgeModel.pointsList = pointsList; edgeModel.initPoints(); } }); AdjustPoint_defineProperty(AdjustPoint_assertThisInitialized(_this), "getAdjustPointStyle", function () { var _this$props4 = _this.props, theme = _this$props4.graphModel.theme, edgeModel = _this$props4.edgeModel; var edgeAdjust = theme.edgeAdjust; return edgeAdjust; }); _this.state = { dragging: false, endX: 0, endY: 0 }; _this.targetRuleResults = new Map(); _this.sourceRuleResults = new Map(); var _type = props.type, _edgeModel = props.edgeModel, _graphModel = props.graphModel; var eventCenter = _graphModel.eventCenter; _this.stepDragData = { type: _type, edgeData: _edgeModel.getData() }; _this.stepDrag = new drag_StepDrag({ onDragStart: _this.onDragStart, onDragging: _this.onDragging, onDragEnd: _this.onDragEnd, eventType: 'ADJUST_POINT', isStopPropagation: false, eventCenter: eventCenter, data: _this.stepDragData }); return _this; } AdjustPoint_createClass(AdjustPoint, [{ key: "isAllowAdjust", value: function isAllowAdjust(info) { var _this$props5 = this.props, _this$props5$edgeMode = _this$props5.edgeModel, id = _this$props5$edgeMode.id, sourceNode = _this$props5$edgeMode.sourceNode, targetNode = _this$props5$edgeMode.targetNode, sourceAnchorId = _this$props5$edgeMode.sourceAnchorId, targetAnchorId = _this$props5$edgeMode.targetAnchorId, type = _this$props5.type; // const newTargetNode = info.node; var newSourceNode = null; var newTargetNode = null; var newSourceAnchor = null; var newTargetAnchor = null; // 如果调整的是连线起点 if (type === AdjustType.SOURCE) { newSourceNode = info.node; newTargetNode = targetNode; newSourceAnchor = info.anchor; newTargetAnchor = targetNode.getAnchorInfo(targetAnchorId); } else { newSourceNode = sourceNode; newTargetNode = info.node; newTargetAnchor = info.anchor; newSourceAnchor = sourceNode.getAnchorInfo(sourceAnchorId); } // 如果前一个接触的节点和此时接触的节点不相等,则将前一个节点状态重新设置为默认状态。 if (this.preTargetNode && this.preTargetNode !== info.node) { this.preTargetNode.setElementState(ElementState.DEFAULT); } this.preTargetNode = info.node; // #500 不允许锚点自己连自己, 在锚点一开始连接的时候, 不触发自己连接自己的校验。 if (newTargetAnchor.id === newSourceAnchor.id) { return false; } var targetInfoId = "".concat(newSourceNode.id, "_").concat(newTargetNode.id, "_").concat(newSourceAnchor.id, "_").concat(newTargetAnchor.id); // 查看鼠标是否进入过target,若有检验结果,表示进入过, 就不重复计算了。 if (!this.targetRuleResults.has(targetInfoId)) { var sourceRuleResult = newSourceNode.isAllowConnectedAsSource(newTargetNode, newSourceAnchor, newTargetAnchor, id); var targetRuleResult = newTargetNode.isAllowConnectedAsTarget(newSourceNode, newSourceAnchor, newTargetAnchor, id); this.sourceRuleResults.set(targetInfoId, formateAnchorConnectValidateData(sourceRuleResult)); this.targetRuleResults.set(targetInfoId, formateAnchorConnectValidateData(targetRuleResult)); } var _this$sourceRuleResul = this.sourceRuleResults.get(targetInfoId), isSourcePass = _this$sourceRuleResul.isAllPass; var _this$targetRuleResul = this.targetRuleResults.get(targetInfoId), isTargetPass = _this$targetRuleResul.isAllPass; // 实时提示出即将连接的节点是否允许连接 var state = isSourcePass && isTargetPass ? ElementState.ALLOW_CONNECT : ElementState.NOT_ALLOW_CONNECT; if (type === AdjustType.SOURCE) { newSourceNode.setElementState(state); } else { newTargetNode.setElementState(state); } return isSourcePass && isTargetPass; } }, { key: "render", value: function render() { var _this$props6 = this.props, x = _this$props6.x, y = _this$props6.y, getAdjustPointShape = _this$props6.getAdjustPointShape; var dragging = this.state.dragging; return Object(preact_module["g" /* h */])("g", { pointerEvents: dragging ? 'none' : '', onMouseDown: this.handleMouseDown }, getAdjustPointShape(x, y, dragging)); } }]); return AdjustPoint; }(preact_module["a" /* Component */]); // CONCATENATED MODULE: ./src/view/edge/BaseEdge.tsx function BaseEdge_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { BaseEdge_typeof = function _typeof(obj) { return typeof obj; }; } else { BaseEdge_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return BaseEdge_typeof(obj); } function BaseEdge_extends() { BaseEdge_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return BaseEdge_extends.apply(this, arguments); } function BaseEdge_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function BaseEdge_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function BaseEdge_createClass(Constructor, protoProps, staticProps) { if (protoProps) BaseEdge_defineProperties(Constructor.prototype, protoProps); if (staticProps) BaseEdge_defineProperties(Constructor, staticProps); return Constructor; } function BaseEdge_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) BaseEdge_setPrototypeOf(subClass, superClass); } function BaseEdge_setPrototypeOf(o, p) { BaseEdge_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return BaseEdge_setPrototypeOf(o, p); } function BaseEdge_createSuper(Derived) { var hasNativeReflectConstruct = BaseEdge_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = BaseEdge_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = BaseEdge_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return BaseEdge_possibleConstructorReturn(this, result); }; } function BaseEdge_possibleConstructorReturn(self, call) { if (call && (BaseEdge_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return BaseEdge_assertThisInitialized(self); } function BaseEdge_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function BaseEdge_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function BaseEdge_getPrototypeOf(o) { BaseEdge_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return BaseEdge_getPrototypeOf(o); } function BaseEdge_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var BaseEdge_BaseEdge = /*#__PURE__*/function (_Component) { BaseEdge_inherits(BaseEdge, _Component); var _super = BaseEdge_createSuper(BaseEdge); function BaseEdge() { var _this; BaseEdge_classCallCheck(this, BaseEdge); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); BaseEdge_defineProperty(BaseEdge_assertThisInitialized(_this), "startTime", void 0); BaseEdge_defineProperty(BaseEdge_assertThisInitialized(_this), "contextMenuTime", void 0); BaseEdge_defineProperty(BaseEdge_assertThisInitialized(_this), "clickTimer", void 0); BaseEdge_defineProperty(BaseEdge_assertThisInitialized(_this), "textRef", Object(preact_module["f" /* createRef */])()); BaseEdge_defineProperty(BaseEdge_assertThisInitialized(_this), "getAdjustPointShape", function (x, y) { var model = _this.props.model; var style = model.getAdjustPointStyle(); return Object(preact_module["g" /* h */])(Circle, BaseEdge_extends({ className: "lf-edge-adjust-point" }, style, { x: x, y: y })); }); BaseEdge_defineProperty(BaseEdge_assertThisInitialized(_this), "handleHover", function (hovered, ev) { var _this$props = _this.props, model = _this$props.model, eventCenter = _this$props.graphModel.eventCenter; model.setHovered(hovered); var eventName = hovered ? EventType.EDGE_MOUSEENTER : EventType.EDGE_MOUSELEAVE; var nodeData = model.getData(); eventCenter.emit(eventName, { data: nodeData, e: ev }); }); BaseEdge_defineProperty(BaseEdge_assertThisInitialized(_this), "setHoverON", function (ev) { // ! hover多次触发, onMouseOver + onMouseEnter var isHovered = _this.props.model.isHovered; if (isHovered) return; _this.textRef && _this.textRef.current.setHoverON(); _this.handleHover(true, ev); }); BaseEdge_defineProperty(BaseEdge_assertThisInitialized(_this), "setHoverOFF", function (ev) { var isHovered = _this.props.model.isHovered; if (!isHovered) return; _this.textRef && _this.textRef.current.setHoverOFF(); _this.handleHover(false, ev); }); BaseEdge_defineProperty(BaseEdge_assertThisInitialized(_this), "handleContextMenu", function (ev) { ev.preventDefault(); // 节点右击也会触发时间,区分右击和点击(mouseup) _this.contextMenuTime = new Date().getTime(); if (_this.clickTimer) { clearTimeout(_this.clickTimer); } var _this$props2 = _this.props, model = _this$props2.model, graphModel = _this$props2.graphModel; var position = graphModel.getPointByClient({ x: ev.clientX, y: ev.clientY }); graphModel.setElementStateById(model.id, ElementState.SHOW_MENU, position.domOverlayPosition); _this.toFront(); if (!model.isSelected) { graphModel.selectEdgeById(model.id); } // 边数据 var edgeData = model === null || model === void 0 ? void 0 : model.getData(); graphModel.eventCenter.emit(EventType.EDGE_CONTEXTMENU, { data: edgeData, e: ev, position: position }); }); BaseEdge_defineProperty(BaseEdge_assertThisInitialized(_this), "handleMouseDown", function (e) { e.stopPropagation(); _this.startTime = new Date().getTime(); }); BaseEdge_defineProperty(BaseEdge_assertThisInitialized(_this), "handleMouseUp", function (e) { if (!_this.startTime) return; var time = new Date().getTime() - _this.startTime; if (time > 200) return; // 事件大于200ms,认为是拖拽。 var isRightClick = e.button === 2; if (isRightClick) return; // 这里 IE 11不能正确显示 var isDoubleClick = e.detail === 2; var _this$props3 = _this.props, model = _this$props3.model, graphModel = _this$props3.graphModel; var edgeData = model === null || model === void 0 ? void 0 : model.getData(); var position = graphModel.getPointByClient({ x: e.clientX, y: e.clientY }); if (isDoubleClick) { var _editConfigModel = graphModel.editConfigModel, textEditElement = graphModel.textEditElement; // 当前边正在编辑,需要先重置状态才能变更文本框位置 if (textEditElement && textEditElement.id === model.id) { graphModel.setElementStateById(model.id, ElementState.DEFAULT); } // 边文案可编辑状态,才可以进行文案编辑 if (_editConfigModel.edgeTextEdit && model.text.editable) { graphModel.setElementStateById(model.id, ElementState.TEXT_EDIT); } if (model.modelType === ModelType.POLYLINE_EDGE) { var polylineEdgeModel = model; var _graphModel$getPointB = graphModel.getPointByClient({ x: e.x, y: e.y }), _graphModel$getPointB2 = _graphModel$getPointB.canvasOverlayPosition, x = _graphModel$getPointB2.x, y = _graphModel$getPointB2.y; var crossPoint = edge_getClosestPointOfPolyline({ x: x, y: y }, polylineEdgeModel.points); polylineEdgeModel.dbClickPosition = crossPoint; } graphModel.eventCenter.emit(EventType.EDGE_DBCLICK, { data: edgeData, e: e, position: position }); } else { // 单击 // 边右击也会触发mouseup事件,判断是否有右击,如果有右击则取消点击事件触发 // 边数据 graphModel.eventCenter.emit(EventType.ELEMENT_CLICK, { data: edgeData, e: e, position: position }); graphModel.eventCenter.emit(EventType.EDGE_CLICK, { data: edgeData, e: e, position: position }); } var editConfigModel = graphModel.editConfigModel; graphModel.selectEdgeById(model.id, isMultipleSelect(e, editConfigModel)); _this.toFront(); }); return _this; } BaseEdge_createClass(BaseEdge, [{ key: "getShape", value: /** * 不支持重写,请使用getEdge */ function getShape() { return Object(preact_module["g" /* h */])("g", null, this.getEdge()); } /** * @deprecated 请使用model.getTextStyle */ }, { key: "getTextStyle", value: function getTextStyle() {} /** * @overridable 可重写,自定义边文本DOM */ }, { key: "getText", value: function getText() { var _this$props4 = this.props, model = _this$props4.model, graphModel = _this$props4.graphModel; // 文本被编辑的时候,显示编辑框,不显示文本。 if (model.state === ElementState.TEXT_EDIT) { return null; } var draggable = false; var editConfigModel = graphModel.editConfigModel; if (model.text.draggable || editConfigModel.edgeTextDraggable) { draggable = true; } return Object(preact_module["g" /* h */])(LineText_LineText, { ref: this.textRef, editable: editConfigModel.edgeTextEdit && model.text.editable, model: model, graphModel: graphModel, draggable: draggable }); } /** * @deprecated */ }, { key: "getArrowInfo", value: function getArrowInfo() { var model = this.props.model; var startPoint = model.startPoint, endPoint = model.endPoint, isSelected = model.isSelected; var _ref = this.state, hover = _ref.hover; return { start: startPoint, end: endPoint, hover: hover, isSelected: isSelected }; } /** * @deprecated 请使用model.getArrowStyle */ }, { key: "getArrowStyle", value: function getArrowStyle() { console.error('getArrowStyle is deprecated in 1.2.0, please use model.getArrowStyle'); return null; } /** * 定义边的箭头,不支持重写。请使用getStartArrow和getEndArrow */ }, { key: "getArrow", value: function getArrow() { var model = this.props.model; var id = model.id; var _model$getArrowStyle = model.getArrowStyle(), _model$getArrowStyle$ = _model$getArrowStyle.refY, refY = _model$getArrowStyle$ === void 0 ? 0 : _model$getArrowStyle$, _model$getArrowStyle$2 = _model$getArrowStyle.refX, refX = _model$getArrowStyle$2 === void 0 ? 2 : _model$getArrowStyle$2; return Object(preact_module["g" /* h */])("g", null, Object(preact_module["g" /* h */])("defs", null, Object(preact_module["g" /* h */])("marker", { id: "marker-start-".concat(id), refX: -refX, refY: refY, overflow: "visible", orient: "auto", markerUnits: "userSpaceOnUse" }, this.getStartArrow()), Object(preact_module["g" /* h */])("marker", { id: "marker-end-".concat(id), refX: refX, refY: refY, overflow: "visible", orient: "auto", markerUnits: "userSpaceOnUse" }, this.getEndArrow()))); } /** * @overridable 可重写,自定义边起点箭头形状。 * @example * getStartArrow() { * const { model } = this.props; * const { stroke, strokeWidth, offset, verticalLength } = model.getArrowStyle(); * return ( * h('path', { * d: '' * }) * ) * } */ }, { key: "getStartArrow", value: function getStartArrow() { var model = this.props.model; var _model$getArrowStyle2 = model.getArrowStyle(), stroke = _model$getArrowStyle2.stroke, strokeWidth = _model$getArrowStyle2.strokeWidth, offset = _model$getArrowStyle2.offset, verticalLength = _model$getArrowStyle2.verticalLength; return Object(preact_module["g" /* h */])("path", { stroke: stroke, fill: stroke, strokeWidth: strokeWidth, d: "M 0 0 L ".concat(offset, " -").concat(verticalLength, " L ").concat(offset, " ").concat(verticalLength, " Z") }); } /** * @overridable 可重写,自定义边终点箭头形状。 * @example * getEndArrow() { * const { model } = this.props; * const { stroke, strokeWidth, offset, verticalLength } = model.getArrowStyle(); * return ( * h('path', { * d: '' * }) * ) * } */ }, { key: "getEndArrow", value: function getEndArrow() { var model = this.props.model; var _model$getArrowStyle3 = model.getArrowStyle(), stroke = _model$getArrowStyle3.stroke, strokeWidth = _model$getArrowStyle3.strokeWidth, offset = _model$getArrowStyle3.offset, verticalLength = _model$getArrowStyle3.verticalLength; return Object(preact_module["g" /* h */])("path", { stroke: stroke, fill: stroke, strokeWidth: strokeWidth, transform: "rotate(180)", d: "M 0 0 L ".concat(offset, " -").concat(verticalLength, " L ").concat(offset, " ").concat(verticalLength, " Z") }); } /** * @overridable 可重写,自定义调整边连接节点形状。在开启了adjustEdgeStartAndEnd的时候,会显示调整点。 * @param x 调整点x坐标 * @param y 调整点y坐标 * @example * getAdjustPointShape(x, y) { * const { model } = this.props; * const style = model.getAdjustPointStyle(); * return ( * h('circle', { * ...style, * x, * y * }) * ) * } */ }, { key: "getAdjustPoints", value: /** * 不支持重写。请使用getAdjustPointShape */ function getAdjustPoints() { var _this$props5 = this.props, model = _this$props5.model, graphModel = _this$props5.graphModel; var start = model.getAdjustStart(); var end = model.getAdjustEnd(); return Object(preact_module["g" /* h */])("g", null, Object(preact_module["g" /* h */])(AdjustPoint_AdjustPoint, BaseEdge_extends({ type: "SOURCE" }, start, { getAdjustPointShape: this.getAdjustPointShape, edgeModel: model, graphModel: graphModel })), Object(preact_module["g" /* h */])(AdjustPoint_AdjustPoint, BaseEdge_extends({ type: "TARGET" }, end, { getAdjustPointShape: this.getAdjustPointShape, edgeModel: model, graphModel: graphModel }))); } /** * @deprecated */ }, { key: "getAnimation", value: function getAnimation() { console.error('getAnimation is deprecated in 1.2.0, please use model.getEdgeAnimationStyle'); } /** * @overridable 可重写,在完全自定义边的时候,可以重写此方法,来自定义边的选区。 */ }, { key: "getAppendWidth", value: function getAppendWidth() { return Object(preact_module["g" /* h */])("g", null); } /** * 不建议重写,此方法为扩大边选区,方便用户点击选中边。 * 如果需要自定义边选区,请使用getAppendWidth。 */ }, { key: "getAppend", value: function getAppend() { return Object(preact_module["g" /* h */])("g", { className: "lf-edge-append" }, this.getAppendWidth()); } /** * 不支持重写,如果想要基于hover状态设置不同的样式,请在model中使用isHovered属性。 */ }, { key: "getEdge", value: /** * @overridable 支持重写, 此方法为获取边的形状,如果需要自定义边的形状,请重写此方法。 * @example https://docs.logic-flow.cn/docs/#/zh/guide/basic/edge?id=%e5%9f%ba%e4%ba%8e-react-%e7%bb%84%e4%bb%b6%e8%87%aa%e5%ae%9a%e4%b9%89%e8%be%b9 */ function getEdge() { return null; } /** * @overridable 支持重写, 此方法为边在被选中时将其置顶,如果不需要此功能,可以重写此方法。 */ }, { key: "toFront", value: function toFront() { var _this$props6 = this.props, graphModel = _this$props6.graphModel, model = _this$props6.model; var overlapMode = graphModel.overlapMode; if (overlapMode !== OverlapMode.INCREASE) { graphModel.toFront(model.id); } } /** * 不建议重写,如果要自定义边的形状,请重写getEdge方法。 */ }, { key: "render", value: function render() { var _this$props7 = this.props, _this$props7$model = _this$props7.model, isSelected = _this$props7$model.isSelected, isHitable = _this$props7$model.isHitable, isShowAdjustPoint = _this$props7$model.isShowAdjustPoint, graphModel = _this$props7.graphModel; var animation = graphModel.animation; return Object(preact_module["g" /* h */])("g", null, Object(preact_module["g" /* h */])("g", { className: ['lf-edge', !isHitable && 'pointer-none', isSelected && 'lf-edge-selected'].filter(Boolean).join(' '), onMouseDown: this.handleMouseDown, onMouseUp: this.handleMouseUp, onContextMenu: this.handleContextMenu, onMouseOver: this.setHoverON, onMouseEnter: this.setHoverON, onMouseLeave: this.setHoverOFF }, this.getShape(), this.getAppend(), this.getText(), this.getArrow()), isShowAdjustPoint && isSelected ? this.getAdjustPoints() : ''); } }]); return BaseEdge; }(preact_module["a" /* Component */]); // CONCATENATED MODULE: ./src/view/basic-shape/Path.tsx function Path_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Path_typeof = function _typeof(obj) { return typeof obj; }; } else { Path_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Path_typeof(obj); } function Path_slicedToArray(arr, i) { return Path_arrayWithHoles(arr) || Path_iterableToArrayLimit(arr, i) || Path_unsupportedIterableToArray(arr, i) || Path_nonIterableRest(); } function Path_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function Path_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Path_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Path_arrayLikeToArray(o, minLen); } function Path_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function Path_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function Path_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function Path(props) { var attrs = { d: '' }; Object.entries(props).forEach(function (_ref) { var _ref2 = Path_slicedToArray(_ref, 2), k = _ref2[0], v = _ref2[1]; var valueType = Path_typeof(v); if (k === 'style' || valueType !== 'object') { attrs[k] = v; } }); return Object(preact_module["g" /* h */])("path", attrs); } /* harmony default export */ var basic_shape_Path = (Path); // CONCATENATED MODULE: ./src/view/edge/LineEdge.tsx function LineEdge_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { LineEdge_typeof = function _typeof(obj) { return typeof obj; }; } else { LineEdge_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return LineEdge_typeof(obj); } function LineEdge_extends() { LineEdge_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return LineEdge_extends.apply(this, arguments); } function LineEdge_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function LineEdge_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function LineEdge_createClass(Constructor, protoProps, staticProps) { if (protoProps) LineEdge_defineProperties(Constructor.prototype, protoProps); if (staticProps) LineEdge_defineProperties(Constructor, staticProps); return Constructor; } function LineEdge_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) LineEdge_setPrototypeOf(subClass, superClass); } function LineEdge_setPrototypeOf(o, p) { LineEdge_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return LineEdge_setPrototypeOf(o, p); } function LineEdge_createSuper(Derived) { var hasNativeReflectConstruct = LineEdge_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = LineEdge_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = LineEdge_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return LineEdge_possibleConstructorReturn(this, result); }; } function LineEdge_possibleConstructorReturn(self, call) { if (call && (LineEdge_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return LineEdge_assertThisInitialized(self); } function LineEdge_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function LineEdge_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function LineEdge_getPrototypeOf(o) { LineEdge_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return LineEdge_getPrototypeOf(o); } var LineEdge_LineEdge = /*#__PURE__*/function (_BaseEdge) { LineEdge_inherits(LineEdge, _BaseEdge); var _super = LineEdge_createSuper(LineEdge); function LineEdge() { LineEdge_classCallCheck(this, LineEdge); return _super.apply(this, arguments); } LineEdge_createClass(LineEdge, [{ key: "getEdge", value: /** * @overridable 支持重写, 此方法为获取边的形状,如果需要自定义边的形状,请重写此方法。 * @example https://docs.logic-flow.cn/docs/#/zh/guide/basic/edge?id=%e5%9f%ba%e4%ba%8e-react-%e7%bb%84%e4%bb%b6%e8%87%aa%e5%ae%9a%e4%b9%89%e8%be%b9 */ function getEdge() { var model = this.props.model; var startPoint = model.startPoint, endPoint = model.endPoint, isAnimation = model.isAnimation, arrowConfig = model.arrowConfig; var style = model.getEdgeStyle(); var animationStyle = model.getEdgeAnimationStyle(); var strokeDasharray = animationStyle.strokeDasharray, stroke = animationStyle.stroke, strokeDashoffset = animationStyle.strokeDashoffset, animationName = animationStyle.animationName, animationDuration = animationStyle.animationDuration, animationIterationCount = animationStyle.animationIterationCount, animationTimingFunction = animationStyle.animationTimingFunction, animationDirection = animationStyle.animationDirection; return Object(preact_module["g" /* h */])(basic_shape_Line, LineEdge_extends({}, style, { x1: startPoint.x, y1: startPoint.y, x2: endPoint.x, y2: endPoint.y }, arrowConfig, isAnimation ? { strokeDasharray: strokeDasharray, stroke: stroke, style: { strokeDashoffset: strokeDashoffset, animationName: animationName, animationDuration: animationDuration, animationIterationCount: animationIterationCount, animationTimingFunction: animationTimingFunction, animationDirection: animationDirection } } : {})); } /** * @overridable 可重写,在完全自定义边的时候,可以重写此方法,来自定义边的选区。 */ }, { key: "getAppendWidth", value: function getAppendWidth() { var model = this.props.model; var startPoint = model.startPoint, endPoint = model.endPoint; var appendInfo = { start: startPoint, end: endPoint }; var _getAppendAttributes = edge_getAppendAttributes(appendInfo), d = _getAppendAttributes.d, strokeWidth = _getAppendAttributes.strokeWidth, fill = _getAppendAttributes.fill, strokeDasharray = _getAppendAttributes.strokeDasharray, stroke = _getAppendAttributes.stroke; return Object(preact_module["g" /* h */])(basic_shape_Path, { d: d, fill: fill, strokeWidth: strokeWidth, stroke: stroke, strokeDasharray: strokeDasharray }); } }]); return LineEdge; }(BaseEdge_BaseEdge); // CONCATENATED MODULE: ./src/view/basic-shape/Polyline.tsx function Polyline_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Polyline_typeof = function _typeof(obj) { return typeof obj; }; } else { Polyline_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Polyline_typeof(obj); } function Polyline_slicedToArray(arr, i) { return Polyline_arrayWithHoles(arr) || Polyline_iterableToArrayLimit(arr, i) || Polyline_unsupportedIterableToArray(arr, i) || Polyline_nonIterableRest(); } function Polyline_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function Polyline_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Polyline_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Polyline_arrayLikeToArray(o, minLen); } function Polyline_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function Polyline_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function Polyline_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function Polyline(props) { var attrs = { points: '', fill: 'none' }; Object.entries(props).forEach(function (_ref) { var _ref2 = Polyline_slicedToArray(_ref, 2), k = _ref2[0], v = _ref2[1]; if (k === 'style') { attrs[k] = v; } else { var valueType = Polyline_typeof(v); if (valueType !== 'object') { attrs[k] = v; } } }); return Object(preact_module["g" /* h */])("polyline", attrs); } /* harmony default export */ var basic_shape_Polyline = (Polyline); // CONCATENATED MODULE: ./src/view/edge/PolylineEdge.tsx function PolylineEdge_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { PolylineEdge_typeof = function _typeof(obj) { return typeof obj; }; } else { PolylineEdge_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return PolylineEdge_typeof(obj); } function PolylineEdge_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function PolylineEdge_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { PolylineEdge_ownKeys(Object(source), true).forEach(function (key) { PolylineEdge_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { PolylineEdge_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function PolylineEdge_extends() { PolylineEdge_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return PolylineEdge_extends.apply(this, arguments); } function PolylineEdge_slicedToArray(arr, i) { return PolylineEdge_arrayWithHoles(arr) || PolylineEdge_iterableToArrayLimit(arr, i) || PolylineEdge_unsupportedIterableToArray(arr, i) || PolylineEdge_nonIterableRest(); } function PolylineEdge_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function PolylineEdge_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return PolylineEdge_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return PolylineEdge_arrayLikeToArray(o, minLen); } function PolylineEdge_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function PolylineEdge_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function PolylineEdge_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function PolylineEdge_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function PolylineEdge_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function PolylineEdge_createClass(Constructor, protoProps, staticProps) { if (protoProps) PolylineEdge_defineProperties(Constructor.prototype, protoProps); if (staticProps) PolylineEdge_defineProperties(Constructor, staticProps); return Constructor; } function PolylineEdge_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) PolylineEdge_setPrototypeOf(subClass, superClass); } function PolylineEdge_setPrototypeOf(o, p) { PolylineEdge_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return PolylineEdge_setPrototypeOf(o, p); } function PolylineEdge_createSuper(Derived) { var hasNativeReflectConstruct = PolylineEdge_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = PolylineEdge_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = PolylineEdge_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return PolylineEdge_possibleConstructorReturn(this, result); }; } function PolylineEdge_possibleConstructorReturn(self, call) { if (call && (PolylineEdge_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return PolylineEdge_assertThisInitialized(self); } function PolylineEdge_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function PolylineEdge_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function PolylineEdge_getPrototypeOf(o) { PolylineEdge_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return PolylineEdge_getPrototypeOf(o); } function PolylineEdge_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var PolylineEdge_PolylineEdge = /*#__PURE__*/function (_BaseEdge) { PolylineEdge_inherits(PolylineEdge, _BaseEdge); var _super = PolylineEdge_createSuper(PolylineEdge); function PolylineEdge() { var _this; PolylineEdge_classCallCheck(this, PolylineEdge); _this = _super.call(this); PolylineEdge_defineProperty(PolylineEdge_assertThisInitialized(_this), "drag", void 0); PolylineEdge_defineProperty(PolylineEdge_assertThisInitialized(_this), "isDragging", void 0); PolylineEdge_defineProperty(PolylineEdge_assertThisInitialized(_this), "isShowAdjustPointTemp", void 0); PolylineEdge_defineProperty(PolylineEdge_assertThisInitialized(_this), "appendInfo", void 0); PolylineEdge_defineProperty(PolylineEdge_assertThisInitialized(_this), "onDragStart", function () { var polylineModel = _this.props.model; polylineModel.dragAppendStart(); _this.isShowAdjustPointTemp = polylineModel.isShowAdjustPoint; polylineModel.isShowAdjustPoint = false; }); PolylineEdge_defineProperty(PolylineEdge_assertThisInitialized(_this), "onDragging", function (_ref) { var deltaX = _ref.deltaX, deltaY = _ref.deltaY; var _this$props = _this.props, model = _this$props.model, graphModel = _this$props.graphModel; _this.isDragging = true; var transformModel = graphModel.transformModel, editConfigModel = graphModel.editConfigModel; var _transformModel$fixDe = transformModel.fixDeltaXY(deltaX, deltaY), _transformModel$fixDe2 = PolylineEdge_slicedToArray(_transformModel$fixDe, 2), curDeltaX = _transformModel$fixDe2[0], curDeltaY = _transformModel$fixDe2[1]; var polylineModel = model; // 更新当前拖拽的线段信息 // 1、如果只允许调整中间线段调用dragAppendSimple // 2、如果允许调整所有线段调用dragAppend var adjustEdgeMiddle = editConfigModel.adjustEdgeMiddle; if (adjustEdgeMiddle) { _this.appendInfo = polylineModel.dragAppendSimple(_this.appendInfo, { x: curDeltaX, y: curDeltaY }); } else { _this.appendInfo = polylineModel.dragAppend(_this.appendInfo, { x: curDeltaX, y: curDeltaY }); } }); PolylineEdge_defineProperty(PolylineEdge_assertThisInitialized(_this), "onDragEnd", function () { var _this$props2 = _this.props, model = _this$props2.model, eventCenter = _this$props2.graphModel.eventCenter; var polylineModel = model; polylineModel.dragAppendEnd(); _this.isDragging = false; polylineModel.isShowAdjustPoint = _this.isShowAdjustPointTemp; // 情况当前拖拽的线段信息 _this.appendInfo = undefined; // 向外抛出事件 eventCenter.emit(EventType.EDGE_ADJUST, { data: polylineModel.getData() }); }); PolylineEdge_defineProperty(PolylineEdge_assertThisInitialized(_this), "beforeDragStart", function (e, appendInfo) { // 如果允许拖拽调整触发事件处理 if (appendInfo.dragAble) { _this.drag.handleMouseDown(e); } // 记录当前拖拽的线段信息 _this.appendInfo = appendInfo; }); _this.drag = new drag_StepDrag({ onDragStart: _this.onDragStart, onDragging: _this.onDragging, onDragEnd: _this.onDragEnd, isStopPropagation: false }); return _this; } /** * 不支持重写 */ PolylineEdge_createClass(PolylineEdge, [{ key: "getEdge", value: /** * @overridable 支持重写, 此方法为获取边的形状,如果需要自定义边的形状,请重写此方法。 * @example https://docs.logic-flow.cn/docs/#/zh/guide/basic/edge?id=%e5%9f%ba%e4%ba%8e-react-%e7%bb%84%e4%bb%b6%e8%87%aa%e5%ae%9a%e4%b9%89%e8%be%b9 */ function getEdge() { var model = this.props.model; var points = model.points, isAnimation = model.isAnimation, arrowConfig = model.arrowConfig; var style = model.getEdgeStyle(); var animationStyle = model.getEdgeAnimationStyle(); var strokeDasharray = animationStyle.strokeDasharray, stroke = animationStyle.stroke, strokeDashoffset = animationStyle.strokeDashoffset, animationName = animationStyle.animationName, animationDuration = animationStyle.animationDuration, animationIterationCount = animationStyle.animationIterationCount, animationTimingFunction = animationStyle.animationTimingFunction, animationDirection = animationStyle.animationDirection; return Object(preact_module["g" /* h */])(basic_shape_Polyline, PolylineEdge_extends({ points: points }, style, arrowConfig, isAnimation ? { strokeDasharray: strokeDasharray, stroke: stroke, style: { strokeDashoffset: strokeDashoffset, animationName: animationName, animationDuration: animationDuration, animationIterationCount: animationIterationCount, animationTimingFunction: animationTimingFunction, animationDirection: animationDirection } } : {})); } /** * @deprecated */ }, { key: "getArrowInfo", value: function getArrowInfo() { var model = this.props.model; var points = model.points, isSelected = model.isSelected; var _ref2 = this.state, hover = _ref2.hover; var arrowInfo = { start: null, end: null, hover: hover, isSelected: isSelected }; var currentPositionList = points2PointsList(points); // 两点重合时不计算起终点 if (currentPositionList.length >= 2) { arrowInfo.start = currentPositionList[currentPositionList.length - 2]; arrowInfo.end = currentPositionList[currentPositionList.length - 1]; } return arrowInfo; } }, { key: "getAppendAttributes", value: function getAppendAttributes(appendInfo) { var start = appendInfo.start, end = appendInfo.end; var d; if (start.x === end.x && start.y === end.y) { // 拖拽过程中会出现起终点重合的情况,这时候append无法计算 d = ''; } else { var config = { start: start, end: end, offset: 10, verticalLength: 5 }; var startPosition = getVerticalPointOfLine(PolylineEdge_objectSpread(PolylineEdge_objectSpread({}, config), {}, { type: 'start' })); var endPosition = getVerticalPointOfLine(PolylineEdge_objectSpread(PolylineEdge_objectSpread({}, config), {}, { type: 'end' })); d = "M".concat(startPosition.leftX, " ").concat(startPosition.leftY, " \n L").concat(startPosition.rightX, " ").concat(startPosition.rightY, " \n L").concat(endPosition.rightX, " ").concat(endPosition.rightY, "\n L").concat(endPosition.leftX, " ").concat(endPosition.leftY, " z"); } return { d: d, fill: 'transparent', stroke: 'transparent', strokeWidth: 1, strokeDasharray: '4, 4' }; } }, { key: "getAppendShape", value: function getAppendShape(appendInfo) { var _this$getAppendAttrib = this.getAppendAttributes(appendInfo), d = _this$getAppendAttrib.d, strokeWidth = _this$getAppendAttrib.strokeWidth, fill = _this$getAppendAttrib.fill, strokeDasharray = _this$getAppendAttrib.strokeDasharray, stroke = _this$getAppendAttrib.stroke; return Object(preact_module["g" /* h */])(basic_shape_Path, { d: d, fill: fill, strokeWidth: strokeWidth, stroke: stroke, strokeDasharray: strokeDasharray }); } /** * @overridable 可重写,在完全自定义边的时候,可以重写此方法,来自定义边的选区。 */ }, { key: "getAppendWidth", value: function getAppendWidth() { var _this2 = this; var _this$props3 = this.props, model = _this$props3.model, graphModel = _this$props3.graphModel; var pointsList = model.pointsList, draggable = model.draggable; var LineAppendList = []; var pointsLen = pointsList.length; var _loop = function _loop(i) { var className = 'lf-polyline-append'; var appendInfo = { start: { x: pointsList[i].x, y: pointsList[i].y }, end: { x: pointsList[i + 1].x, y: pointsList[i + 1].y }, startIndex: i, endIndex: i + 1, direction: '', dragAble: true }; var append = Object(preact_module["g" /* h */])("g", { className: className }, _this2.getAppendShape(appendInfo)); var editConfigModel = graphModel.editConfigModel; var adjustEdge = editConfigModel.adjustEdge, adjustEdgeMiddle = editConfigModel.adjustEdgeMiddle; if (adjustEdge && draggable) { var startIndex = appendInfo.startIndex, endIndex = appendInfo.endIndex; // 如果不允许调整起点和终点相连的线段,设置该线段appendInfo的dragAble为false var dragDisable = adjustEdgeMiddle && (startIndex === 0 || endIndex === pointsLen - 1); appendInfo.dragAble = !dragDisable; if (appendInfo.start.x === appendInfo.end.x) { // 水平 if (appendInfo.dragAble) { className += '-ew-resize'; } appendInfo.direction = SegmentDirection.VERTICAL; } else if (appendInfo.start.y === appendInfo.end.y) { // 垂直 if (appendInfo.dragAble) { className += '-ns-resize'; } appendInfo.direction = SegmentDirection.HORIZONTAL; } append = Object(preact_module["g" /* h */])("g", { className: _this2.isDragging ? 'lf-dragging' : 'lf-drag-able', onMouseDown: function onMouseDown(e) { return _this2.beforeDragStart(e, appendInfo); } }, Object(preact_module["g" /* h */])("g", { className: className }, _this2.getAppendShape(appendInfo))); } LineAppendList.push(append); }; for (var i = 0; i < pointsLen - 1; i++) { _loop(i); } return Object(preact_module["g" /* h */])("g", null, LineAppendList); } }]); return PolylineEdge; }(BaseEdge_BaseEdge); // CONCATENATED MODULE: ./src/view/edge/BezierEdge.tsx function BezierEdge_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { BezierEdge_typeof = function _typeof(obj) { return typeof obj; }; } else { BezierEdge_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return BezierEdge_typeof(obj); } function BezierEdge_slicedToArray(arr, i) { return BezierEdge_arrayWithHoles(arr) || BezierEdge_iterableToArrayLimit(arr, i) || BezierEdge_unsupportedIterableToArray(arr, i) || BezierEdge_nonIterableRest(); } function BezierEdge_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function BezierEdge_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return BezierEdge_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return BezierEdge_arrayLikeToArray(o, minLen); } function BezierEdge_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function BezierEdge_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function BezierEdge_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function BezierEdge_extends() { BezierEdge_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return BezierEdge_extends.apply(this, arguments); } function BezierEdge_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function BezierEdge_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function BezierEdge_createClass(Constructor, protoProps, staticProps) { if (protoProps) BezierEdge_defineProperties(Constructor.prototype, protoProps); if (staticProps) BezierEdge_defineProperties(Constructor, staticProps); return Constructor; } function BezierEdge_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) BezierEdge_setPrototypeOf(subClass, superClass); } function BezierEdge_setPrototypeOf(o, p) { BezierEdge_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return BezierEdge_setPrototypeOf(o, p); } function BezierEdge_createSuper(Derived) { var hasNativeReflectConstruct = BezierEdge_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = BezierEdge_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = BezierEdge_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return BezierEdge_possibleConstructorReturn(this, result); }; } function BezierEdge_possibleConstructorReturn(self, call) { if (call && (BezierEdge_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return BezierEdge_assertThisInitialized(self); } function BezierEdge_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function BezierEdge_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function BezierEdge_getPrototypeOf(o) { BezierEdge_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return BezierEdge_getPrototypeOf(o); } var BezierEdge_BezierEdge = /*#__PURE__*/function (_BaseEdge) { BezierEdge_inherits(BezierEdge, _BaseEdge); var _super = BezierEdge_createSuper(BezierEdge); function BezierEdge() { BezierEdge_classCallCheck(this, BezierEdge); return _super.apply(this, arguments); } BezierEdge_createClass(BezierEdge, [{ key: "getEdge", value: /** * @overridable 支持重写, 此方法为获取边的形状,如果需要自定义边的形状,请重写此方法。 * @example https://docs.logic-flow.cn/docs/#/zh/guide/basic/edge?id=%e5%9f%ba%e4%ba%8e-react-%e7%bb%84%e4%bb%b6%e8%87%aa%e5%ae%9a%e4%b9%89%e8%be%b9 */ function getEdge() { var model = this.props.model; var style = model.getEdgeStyle(); var path = model.path, isAnimation = model.isAnimation, arrowConfig = model.arrowConfig; var animationStyle = model.getEdgeAnimationStyle(); var strokeDasharray = animationStyle.strokeDasharray, stroke = animationStyle.stroke, strokeDashoffset = animationStyle.strokeDashoffset, animationName = animationStyle.animationName, animationDuration = animationStyle.animationDuration, animationIterationCount = animationStyle.animationIterationCount, animationTimingFunction = animationStyle.animationTimingFunction, animationDirection = animationStyle.animationDirection; return Object(preact_module["g" /* h */])(basic_shape_Path, BezierEdge_extends({ d: path }, style, arrowConfig, isAnimation ? { strokeDasharray: strokeDasharray, stroke: stroke, style: { strokeDashoffset: strokeDashoffset, animationName: animationName, animationDuration: animationDuration, animationIterationCount: animationIterationCount, animationTimingFunction: animationTimingFunction, animationDirection: animationDirection } } : {})); } /** * @overridable 可重写,在完全自定义边的时候,可以重写此方法,来自定义边的选区。 */ }, { key: "getAppendWidth", value: function getAppendWidth() { var path = this.props.model.path; return Object(preact_module["g" /* h */])(basic_shape_Path, { d: path, strokeWidth: 10, stroke: "transparent", fill: "none" }); } /** * @deprecated */ }, { key: "getArrowInfo", value: function getArrowInfo() { var model = this.props.model; var _ref = this.state, hover = _ref.hover; var _ref2 = model, path = _ref2.path, isSelected = _ref2.isSelected; var _getEndTangent = getEndTangent(path), _getEndTangent2 = BezierEdge_slicedToArray(_getEndTangent, 2), ePre = _getEndTangent2[0], end = _getEndTangent2[1]; var arrowInfo = { start: ePre, end: end, hover: hover, isSelected: isSelected }; return arrowInfo; } }]); return BezierEdge; }(BaseEdge_BaseEdge); // CONCATENATED MODULE: ./src/view/edge/Arrow.tsx function Arrow_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Arrow_typeof = function _typeof(obj) { return typeof obj; }; } else { Arrow_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Arrow_typeof(obj); } function Arrow_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function Arrow_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Arrow_ownKeys(Object(source), true).forEach(function (key) { Arrow_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Arrow_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function Arrow_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function Arrow_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function Arrow_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function Arrow_createClass(Constructor, protoProps, staticProps) { if (protoProps) Arrow_defineProperties(Constructor.prototype, protoProps); if (staticProps) Arrow_defineProperties(Constructor, staticProps); return Constructor; } function Arrow_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Arrow_setPrototypeOf(subClass, superClass); } function Arrow_setPrototypeOf(o, p) { Arrow_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Arrow_setPrototypeOf(o, p); } function Arrow_createSuper(Derived) { var hasNativeReflectConstruct = Arrow_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Arrow_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Arrow_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Arrow_possibleConstructorReturn(this, result); }; } function Arrow_possibleConstructorReturn(self, call) { if (call && (Arrow_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Arrow_assertThisInitialized(self); } function Arrow_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function Arrow_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function Arrow_getPrototypeOf(o) { Arrow_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Arrow_getPrototypeOf(o); } var Arrow_Arrow = /*#__PURE__*/function (_Component) { Arrow_inherits(Arrow, _Component); var _super = Arrow_createSuper(Arrow); function Arrow() { Arrow_classCallCheck(this, Arrow); return _super.apply(this, arguments); } Arrow_createClass(Arrow, [{ key: "getArrowAttributes", value: function getArrowAttributes() { var _this$props = this.props, arrowInfo = _this$props.arrowInfo, style = _this$props.style; var start = arrowInfo.start, end = arrowInfo.end; var config = { start: start, end: end, offset: style.offset, verticalLength: style.verticalLength, type: 'end' }; var _getVerticalPointOfLi = getVerticalPointOfLine(config), leftX = _getVerticalPointOfLi.leftX, leftY = _getVerticalPointOfLi.leftY, rightX = _getVerticalPointOfLi.rightX, rightY = _getVerticalPointOfLi.rightY; return Arrow_objectSpread({ d: "M".concat(leftX, " ").concat(leftY, " L").concat(end.x, " ").concat(end.y, " L").concat(rightX, " ").concat(rightY, " z") }, style); } }, { key: "getShape", value: function getShape() { var _this$getArrowAttribu = this.getArrowAttributes(), d = _this$getArrowAttribu.d, strokeWidth = _this$getArrowAttribu.strokeWidth, stroke = _this$getArrowAttribu.stroke, fill = _this$getArrowAttribu.fill; return Object(preact_module["g" /* h */])(basic_shape_Path, { d: d, fill: fill, strokeWidth: strokeWidth, stroke: stroke }); } }, { key: "render", value: function render() { return Object(preact_module["g" /* h */])("g", { className: "lf-arrow" }, this.getShape()); } }]); return Arrow; }(preact_module["a" /* Component */]); // CONCATENATED MODULE: ./src/view/edge/index.ts // CONCATENATED MODULE: ./src/view/index.ts // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/isEqual.js /** * Performs a deep comparison between two values to determine if they are * equivalent. * * **Note:** This method supports comparing arrays, array buffers, booleans, * date objects, error objects, maps, numbers, `Object` objects, regexes, * sets, strings, symbols, and typed arrays. `Object` objects are compared * by their own, not inherited, enumerable properties. Functions and DOM * nodes are compared by strict equality, i.e. `===`. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.isEqual(object, other); * // => true * * object === other; * // => false */ function isEqual(value, other) { return _baseIsEqual(value, other); } /* harmony default export */ var lodash_es_isEqual = (isEqual); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/last.js /** * Gets the last element of `array`. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @returns {*} Returns the last element of `array`. * @example * * _.last([1, 2, 3]); * // => 3 */ function last(array) { var length = array == null ? 0 : array.length; return length ? array[length - 1] : undefined; } /* harmony default export */ var lodash_es_last = (last); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/now.js /** * Gets the timestamp of the number of milliseconds that have elapsed since * the Unix epoch (1 January 1970 00:00:00 UTC). * * @static * @memberOf _ * @since 2.4.0 * @category Date * @returns {number} Returns the timestamp. * @example * * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); * // => Logs the number of milliseconds it took for the deferred invocation. */ var now = function() { return _root["a" /* default */].Date.now(); }; /* harmony default export */ var lodash_es_now = (now); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_trimmedEndIndex.js /** Used to match a single whitespace character. */ var reWhitespace = /\s/; /** * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace * character of `string`. * * @private * @param {string} string The string to inspect. * @returns {number} Returns the index of the last non-whitespace character. */ function trimmedEndIndex(string) { var index = string.length; while (index-- && reWhitespace.test(string.charAt(index))) {} return index; } /* harmony default export */ var _trimmedEndIndex = (trimmedEndIndex); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/_baseTrim.js /** Used to match leading whitespace. */ var reTrimStart = /^\s+/; /** * The base implementation of `_.trim`. * * @private * @param {string} string The string to trim. * @returns {string} Returns the trimmed string. */ function baseTrim(string) { return string ? string.slice(0, _trimmedEndIndex(string) + 1).replace(reTrimStart, '') : string; } /* harmony default export */ var _baseTrim = (baseTrim); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/toNumber.js /** Used as references for various `Number` constants. */ var NAN = 0 / 0; /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; /** * Converts `value` to a number. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3.2); * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3.2'); * // => 3.2 */ function toNumber(value) { if (typeof value == 'number') { return value; } if (lodash_es_isSymbol(value)) { return NAN; } if (lodash_es_isObject(value)) { var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = lodash_es_isObject(other) ? (other + '') : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = _baseTrim(value); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : (reIsBadHex.test(value) ? NAN : +value); } /* harmony default export */ var lodash_es_toNumber = (toNumber); // CONCATENATED MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/lodash-es/debounce.js /** Error message constants. */ var debounce_FUNC_ERROR_TEXT = 'Expected a function'; /* Built-in method references for those with the same name as other `lodash` methods. */ var debounce_nativeMax = Math.max, nativeMin = Math.min; /** * Creates a debounced function that delays invoking `func` until after `wait` * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a `cancel` method to cancel * delayed `func` invocations and a `flush` method to immediately invoke them. * Provide `options` to indicate whether `func` should be invoked on the * leading and/or trailing edge of the `wait` timeout. The `func` is invoked * with the last arguments provided to the debounced function. Subsequent * calls to the debounced function return the result of the last `func` * invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the debounced function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.debounce` and `_.throttle`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to debounce. * @param {number} [wait=0] The number of milliseconds to delay. * @param {Object} [options={}] The options object. * @param {boolean} [options.leading=false] * Specify invoking on the leading edge of the timeout. * @param {number} [options.maxWait] * The maximum time `func` is allowed to be delayed before it's invoked. * @param {boolean} [options.trailing=true] * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example * * // Avoid costly calculations while the window size is in flux. * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); * * // Invoke `sendMail` when clicked, debouncing subsequent calls. * jQuery(element).on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); * * // Ensure `batchLog` is invoked once after 1 second of debounced calls. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); * var source = new EventSource('/stream'); * jQuery(source).on('message', debounced); * * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ function debounce(func, wait, options) { var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; if (typeof func != 'function') { throw new TypeError(debounce_FUNC_ERROR_TEXT); } wait = lodash_es_toNumber(wait) || 0; if (lodash_es_isObject(options)) { leading = !!options.leading; maxing = 'maxWait' in options; maxWait = maxing ? debounce_nativeMax(lodash_es_toNumber(options.maxWait) || 0, wait) : maxWait; trailing = 'trailing' in options ? !!options.trailing : trailing; } function invokeFunc(time) { var args = lastArgs, thisArg = lastThis; lastArgs = lastThis = undefined; lastInvokeTime = time; result = func.apply(thisArg, args); return result; } function leadingEdge(time) { // Reset any `maxWait` timer. lastInvokeTime = time; // Start the timer for the trailing edge. timerId = setTimeout(timerExpired, wait); // Invoke the leading edge. return leading ? invokeFunc(time) : result; } function remainingWait(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; } function shouldInvoke(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { var time = lodash_es_now(); if (shouldInvoke(time)) { return trailingEdge(time); } // Restart the timer. timerId = setTimeout(timerExpired, remainingWait(time)); } function trailingEdge(time) { timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been // debounced at least once. if (trailing && lastArgs) { return invokeFunc(time); } lastArgs = lastThis = undefined; return result; } function cancel() { if (timerId !== undefined) { clearTimeout(timerId); } lastInvokeTime = 0; lastArgs = lastCallTime = lastThis = timerId = undefined; } function flush() { return timerId === undefined ? result : trailingEdge(lodash_es_now()); } function debounced() { var time = lodash_es_now(), isInvoking = shouldInvoke(time); lastArgs = arguments; lastThis = this; lastCallTime = time; if (isInvoking) { if (timerId === undefined) { return leadingEdge(lastCallTime); } if (maxing) { // Handle invocations in a tight loop. clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } } if (timerId === undefined) { timerId = setTimeout(timerExpired, wait); } return result; } debounced.cancel = cancel; debounced.flush = flush; return debounced; } /* harmony default export */ var lodash_es_debounce = (debounce); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mobx-utils/mobx-utils.module.js var mobx_utils_module = __webpack_require__(166); // CONCATENATED MODULE: ./src/history/History.ts function History_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function History_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function History_createClass(Constructor, protoProps, staticProps) { if (protoProps) History_defineProperties(Constructor.prototype, protoProps); if (staticProps) History_defineProperties(Constructor, staticProps); return Constructor; } function History_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var History_History = /*#__PURE__*/function () { // 发生数据变化后,最多再等500ms,把距离上次的数据变更存储起来。 // 所以waitTime值越小,History对数据变化越敏感,存的undos就越细。 function History(eventCenter) { History_classCallCheck(this, History); History_defineProperty(this, "undos", []); History_defineProperty(this, "redos", []); History_defineProperty(this, "callbacks", []); History_defineProperty(this, "stopWatch", null); History_defineProperty(this, "curData", null); History_defineProperty(this, "maxSize", 50); History_defineProperty(this, "waitTime", 100); History_defineProperty(this, "eventCenter", void 0); this.eventCenter = eventCenter; } History_createClass(History, [{ key: "add", value: function add(data) { if (lodash_es_isEqual(lodash_es_last(this.undos), data)) return; this.undos.push(data); // 因为undo的时候,会触发add. // 所以需要区分这个add是undo触发的,还是用户正常操作触发的。 // 如果是用户正常操作触发的,需要清空redos if (!lodash_es_isEqual(this.curData, data)) { this.redos = []; } this.eventCenter.emit(EventType.HISTORY_CHANGE, { data: { undos: this.undos, redos: this.redos, undoAble: this.undos.length > 1, redoAble: this.redos.length > 0 } }); if (this.undos.length > this.maxSize) { this.undos.shift(); } } }, { key: "undoAble", value: function undoAble() { // undos栈顶就是当前图渲染出来的数据。 return this.undos.length > 1; } // 1) undo方法触发 // 2) graphModel重新渲染nodes和edges // 3) graphModel发生变化,触发watch // 4) watch触发add }, { key: "undo", value: function undo() { if (!this.undoAble()) return; var preData = this.undos.pop(); this.redos.push(preData); var curData = this.undos.pop(); this.curData = lodash_es_cloneDeep(curData); return curData; } }, { key: "redoAble", value: function redoAble() { return this.redos.length > 0; } }, { key: "redo", value: function redo() { if (!this.redoAble()) return; var curData = this.redos.pop(); this.curData = lodash_es_cloneDeep(curData); return curData; } }, { key: "watch", value: function watch(model) { var _this = this; this.stopWatch && this.stopWatch(); // 把当前watch的model转换一下数据存起来,无需清空redos。 this.undos.push(model.modelToGraphData()); this.stopWatch = Object(mobx_utils_module["a" /* deepObserve */])(model, lodash_es_debounce(function () { // 数据变更后,把最新的当前model数据存起来,并清空redos。 // 因为这个回调函数的触发,一般是用户交互而引起的,所以按正常逻辑需要清空redos。 var data = model.modelToHistoryData(); if (data) { _this.add(data); } }, this.waitTime)); } }]); return History; }(); /* harmony default export */ var history_History = (History_History); // CONCATENATED MODULE: ./src/tool/TextEditTool.tsx function TextEditTool_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { TextEditTool_typeof = function _typeof(obj) { return typeof obj; }; } else { TextEditTool_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return TextEditTool_typeof(obj); } var TextEditTool_class, _class2, _temp; function TextEditTool_slicedToArray(arr, i) { return TextEditTool_arrayWithHoles(arr) || TextEditTool_iterableToArrayLimit(arr, i) || TextEditTool_unsupportedIterableToArray(arr, i) || TextEditTool_nonIterableRest(); } function TextEditTool_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function TextEditTool_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return TextEditTool_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return TextEditTool_arrayLikeToArray(o, minLen); } function TextEditTool_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function TextEditTool_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function TextEditTool_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function TextEditTool_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function TextEditTool_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { TextEditTool_ownKeys(Object(source), true).forEach(function (key) { TextEditTool_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { TextEditTool_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function TextEditTool_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function TextEditTool_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function TextEditTool_createClass(Constructor, protoProps, staticProps) { if (protoProps) TextEditTool_defineProperties(Constructor.prototype, protoProps); if (staticProps) TextEditTool_defineProperties(Constructor, staticProps); return Constructor; } function TextEditTool_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) TextEditTool_setPrototypeOf(subClass, superClass); } function TextEditTool_setPrototypeOf(o, p) { TextEditTool_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return TextEditTool_setPrototypeOf(o, p); } function TextEditTool_createSuper(Derived) { var hasNativeReflectConstruct = TextEditTool_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = TextEditTool_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = TextEditTool_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return TextEditTool_possibleConstructorReturn(this, result); }; } function TextEditTool_possibleConstructorReturn(self, call) { if (call && (TextEditTool_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return TextEditTool_assertThisInitialized(self); } function TextEditTool_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function TextEditTool_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function TextEditTool_getPrototypeOf(o) { TextEditTool_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return TextEditTool_getPrototypeOf(o); } function TextEditTool_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // import { ElementState } from '../constant/constant'; var TextEditTool_TextEdit = src_observer(TextEditTool_class = (_temp = _class2 = /*#__PURE__*/function (_Component) { TextEditTool_inherits(TextEdit, _Component); var _super = TextEditTool_createSuper(TextEdit); function TextEdit() { var _this; TextEditTool_classCallCheck(this, TextEdit); _this = _super.call(this); TextEditTool_defineProperty(TextEditTool_assertThisInitialized(_this), "ref", Object(preact_module["f" /* createRef */])()); TextEditTool_defineProperty(TextEditTool_assertThisInitialized(_this), "__prevText", { type: '', text: '', id: '' }); TextEditTool_defineProperty(TextEditTool_assertThisInitialized(_this), "keyupHandler", function (ev) { var textEditElement = _this.props.graphModel.textEditElement; // 按下alt+enter表示输入完成 if (ev.key === 'Enter' && ev.altKey) { textEditElement.setElementState(0); } }); TextEditTool_defineProperty(TextEditTool_assertThisInitialized(_this), "inputHandler", function (ev) { var _ref = ev.target, value = _ref.innerText; var textEditElement = _this.props.graphModel.textEditElement; _this.__prevText = { type: textEditElement.type, text: value.replace(/(\r\n)+$|(\n)+$/, ''), // fix #488: 文本后面的换行符不保留 id: textEditElement.id }; }); TextEditTool_defineProperty(TextEditTool_assertThisInitialized(_this), "keydownHandler", function (ev) { ev.stopPropagation(); }); _this.state = { style: { left: 0, top: 0 } }; return _this; } TextEditTool_createClass(TextEdit, [{ key: "componentDidUpdate", value: function componentDidUpdate() { var graphModel = this.props.graphModel; if (this.ref.current) { this.ref.current.focus(); this.placeCaretAtEnd(this.ref.current); } if (this.__prevText.id !== '') { var _this$__prevText = this.__prevText, text = _this$__prevText.text, id = _this$__prevText.id; graphModel.updateText(id, text); graphModel.eventCenter.emit(EventType.TEXT_UPDATE, TextEditTool_objectSpread({}, this.__prevText)); this.__prevText.id = ''; this.__prevText.text = ''; this.__prevText.type = ''; } } }, { key: "placeCaretAtEnd", value: function placeCaretAtEnd(el) { if (window.getSelection !== undefined && document.createRange !== undefined) { var range = document.createRange(); range.selectNodeContents(el); range.collapse(false); var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range); } } }, { key: "render", value: function render() { var _textEditElement$text; var textEditElement = this.props.graphModel.textEditElement; var style = this.state.style; return textEditElement ? Object(preact_module["g" /* h */])("div", { contentEditable: true, className: "lf-text-input", style: style, ref: this.ref, key: textEditElement.id, onKeyUp: this.keyupHandler, onKeyDown: this.keydownHandler, onKeyPress: this.keydownHandler, onInput: this.inputHandler }, (_textEditElement$text = textEditElement.text) === null || _textEditElement$text === void 0 ? void 0 : _textEditElement$text.value) : null; } }], [{ key: "getDerivedStateFromProps", value: function getDerivedStateFromProps(props) { var graphModel = props.graphModel; var transformModel = graphModel.transformModel, theme = graphModel.theme; var textEditElement = graphModel.textEditElement; var autoStyle; if (textEditElement) { var _textEditElement$text2; // 由于边上的文本是依据显示的时候动态计算出来的 // 所以不能在边创建的时候就初始化文本位置。 // 而是在边上新建文本的时候创建。 if (!((_textEditElement$text2 = textEditElement.text) !== null && _textEditElement$text2 !== void 0 && _textEditElement$text2.value)) { if (textEditElement.BaseType === ElementType.EDGE) { textEditElement = textEditElement; var textConfig = textEditElement.text; var _textEditElement$text3 = textEditElement.textPosition, _x = _textEditElement$text3.x, _y = _textEditElement$text3.y; textConfig.x = _x; textConfig.y = _y; textEditElement.setText(textConfig); } else { textEditElement = textEditElement; } } // 自动换行节点边通用样式 var commonAutoStyle = { resize: 'auto', whiteSpace: 'normal', wordBreak: 'break-all' }; if (textEditElement.BaseType === ElementType.EDGE) { // 如果边文案自动换行, 设置编辑框宽度 var _theme$edgeText = theme.edgeText, overflowMode = _theme$edgeText.overflowMode, lineHeight = _theme$edgeText.lineHeight, wrapPadding = _theme$edgeText.wrapPadding, textWidth = _theme$edgeText.textWidth; if (textWidth && overflowMode === 'autoWrap') { autoStyle = TextEditTool_objectSpread(TextEditTool_objectSpread({}, commonAutoStyle), {}, { width: textWidth, minWidth: textWidth, lineHeight: lineHeight, padding: wrapPadding }); } } else if (textEditElement.BaseType === ElementType.NODE) { // 如果节点文案自动换行, 设置编辑框宽度 var _theme$nodeText = theme.nodeText, _overflowMode = _theme$nodeText.overflowMode, _lineHeight = _theme$nodeText.lineHeight, _wrapPadding = _theme$nodeText.wrapPadding, _textWidth = _theme$nodeText.textWidth; var _textEditElement = textEditElement, width = _textEditElement.width, modelType = _textEditElement.modelType; // 文本节点没有默认宽高,只有在设置了textWidth之后才能进行自动换行 if (modelType !== ModelType.TEXT_NODE && _overflowMode === 'autoWrap' || modelType === ModelType.TEXT_NODE && _textWidth) { autoStyle = TextEditTool_objectSpread(TextEditTool_objectSpread({}, commonAutoStyle), {}, { width: _textWidth || width, minWidth: _textWidth || width, lineHeight: _lineHeight, padding: _wrapPadding }); } } var _textEditElement$text4 = textEditElement.text, x = _textEditElement$text4.x, y = _textEditElement$text4.y; var _transformModel$Canva = transformModel.CanvasPointToHtmlPoint([x, y]), _transformModel$Canva2 = TextEditTool_slicedToArray(_transformModel$Canva, 2), left = _transformModel$Canva2[0], top = _transformModel$Canva2[1]; return { style: TextEditTool_objectSpread({ left: left, top: top }, autoStyle) }; } } }]); return TextEdit; }(preact_module["a" /* Component */]), TextEditTool_defineProperty(_class2, "toolName", 'textEdit'), _temp)) || TextEditTool_class; // CONCATENATED MODULE: ./src/algorithm/outline.ts // 获取节点的out var getNodeOutline = function getNodeOutline(_ref) { var x = _ref.x, y = _ref.y, width = _ref.width, height = _ref.height; return { x: x - width / 2, y: y - height / 2, x1: x + width / 2, y1: y + height / 2 }; }; var outline_getLineOutline = function getLineOutline(edge) { var startPoint = edge.startPoint, endPoint = edge.endPoint; var x = (startPoint.x + endPoint.x) / 2; var y = (startPoint.y + endPoint.y) / 2; var width = Math.abs(startPoint.x - endPoint.x) + 10; var height = Math.abs(startPoint.y - endPoint.y) + 10; return { x: x - width / 2, y: y - height / 2, x1: x + width / 2, y1: y + height / 2 }; }; var outline_getPolylineOutline = function getPolylineOutline(edge) { var points = edge.points; var pointsList = points2PointsList(points); var bbox = getBBoxOfPoints(pointsList, 8); var x = bbox.x, y = bbox.y, width = bbox.width, height = bbox.height; return { x: x - width / 2, y: y - height / 2, x1: x + width / 2, y1: y + height / 2 }; }; var outline_getBezierOutline = function getBezierOutline(edge) { var path = edge.path; var pointsList = getBezierPoints(path); var bbox = getBBoxOfPoints(pointsList, 8); var x = bbox.x, y = bbox.y, width = bbox.width, height = bbox.height; return { x: x - width / 2, y: y - height / 2, x1: x + width / 2, y1: y + height / 2 }; }; var outline_getEdgeOutline = function getEdgeOutline(edge) { if (edge.modelType === ModelType.LINE_EDGE) { return outline_getLineOutline(edge); } if (edge.modelType === ModelType.POLYLINE_EDGE) { return outline_getPolylineOutline(edge); } if (edge.modelType === ModelType.BEZIER_EDGE) { return outline_getBezierOutline(edge); } }; // CONCATENATED MODULE: ./src/tool/MultipleSelectTool.tsx function MultipleSelectTool_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { MultipleSelectTool_typeof = function _typeof(obj) { return typeof obj; }; } else { MultipleSelectTool_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return MultipleSelectTool_typeof(obj); } var MultipleSelectTool_class, MultipleSelectTool_class2, MultipleSelectTool_temp; function MultipleSelectTool_slicedToArray(arr, i) { return MultipleSelectTool_arrayWithHoles(arr) || MultipleSelectTool_iterableToArrayLimit(arr, i) || MultipleSelectTool_unsupportedIterableToArray(arr, i) || MultipleSelectTool_nonIterableRest(); } function MultipleSelectTool_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function MultipleSelectTool_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function MultipleSelectTool_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function MultipleSelectTool_toConsumableArray(arr) { return MultipleSelectTool_arrayWithoutHoles(arr) || MultipleSelectTool_iterableToArray(arr) || MultipleSelectTool_unsupportedIterableToArray(arr) || MultipleSelectTool_nonIterableSpread(); } function MultipleSelectTool_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function MultipleSelectTool_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return MultipleSelectTool_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return MultipleSelectTool_arrayLikeToArray(o, minLen); } function MultipleSelectTool_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function MultipleSelectTool_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return MultipleSelectTool_arrayLikeToArray(arr); } function MultipleSelectTool_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function MultipleSelectTool_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function MultipleSelectTool_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function MultipleSelectTool_createClass(Constructor, protoProps, staticProps) { if (protoProps) MultipleSelectTool_defineProperties(Constructor.prototype, protoProps); if (staticProps) MultipleSelectTool_defineProperties(Constructor, staticProps); return Constructor; } function MultipleSelectTool_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) MultipleSelectTool_setPrototypeOf(subClass, superClass); } function MultipleSelectTool_setPrototypeOf(o, p) { MultipleSelectTool_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return MultipleSelectTool_setPrototypeOf(o, p); } function MultipleSelectTool_createSuper(Derived) { var hasNativeReflectConstruct = MultipleSelectTool_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = MultipleSelectTool_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = MultipleSelectTool_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return MultipleSelectTool_possibleConstructorReturn(this, result); }; } function MultipleSelectTool_possibleConstructorReturn(self, call) { if (call && (MultipleSelectTool_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return MultipleSelectTool_assertThisInitialized(self); } function MultipleSelectTool_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function MultipleSelectTool_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function MultipleSelectTool_getPrototypeOf(o) { MultipleSelectTool_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return MultipleSelectTool_getPrototypeOf(o); } function MultipleSelectTool_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var MultipleSelectTool_MultipleSelect = src_observer(MultipleSelectTool_class = (MultipleSelectTool_temp = MultipleSelectTool_class2 = /*#__PURE__*/function (_Component) { MultipleSelectTool_inherits(MultipleSelect, _Component); var _super = MultipleSelectTool_createSuper(MultipleSelect); function MultipleSelect(props) { var _this; MultipleSelectTool_classCallCheck(this, MultipleSelect); _this = _super.call(this); MultipleSelectTool_defineProperty(MultipleSelectTool_assertThisInitialized(_this), "stepDrag", void 0); MultipleSelectTool_defineProperty(MultipleSelectTool_assertThisInitialized(_this), "handleMouseDown", function (ev) { _this.stepDrag.handleMouseDown(ev); }); MultipleSelectTool_defineProperty(MultipleSelectTool_assertThisInitialized(_this), "onDragging", function (_ref) { var deltaX = _ref.deltaX, deltaY = _ref.deltaY; var graphModel = _this.props.graphModel; var selectElements = graphModel.getSelectElements(true); graphModel.moveNodes(selectElements.nodes.map(function (node) { return node.id; }), deltaX, deltaY); }); MultipleSelectTool_defineProperty(MultipleSelectTool_assertThisInitialized(_this), "handleContextMenu", function (ev) { ev.preventDefault(); var _this$props = _this.props, graphModel = _this$props.graphModel, _this$props$graphMode = _this$props.graphModel, eventCenter = _this$props$graphMode.eventCenter, selectElements = _this$props$graphMode.selectElements; var position = graphModel.getPointByClient({ x: ev.clientX, y: ev.clientY }); var selectGraphData = { nodes: [], edges: [] }; var models = MultipleSelectTool_toConsumableArray(selectElements.values()); models.forEach(function (model) { if (model.BaseType === ElementType.NODE) { selectGraphData.nodes.push(model.getData()); } if (model.BaseType === ElementType.EDGE) { selectGraphData.edges.push(model.getData()); } }); eventCenter.emit(EventType.SELECTION_CONTEXTMENU, { data: selectGraphData, e: ev, position: position }); }); var _props$graphModel = props.graphModel, gridSize = _props$graphModel.gridSize, _eventCenter = _props$graphModel.eventCenter; _this.stepDrag = new drag_StepDrag({ onDragging: _this.onDragging, step: gridSize, eventType: 'SELECTION', eventCenter: _eventCenter }); return _this; } MultipleSelectTool_createClass(MultipleSelect, [{ key: "render", value: function render() { var _this$props$graphMode2 = this.props.graphModel, selectElements = _this$props$graphMode2.selectElements, transformModel = _this$props$graphMode2.transformModel; if (selectElements.size <= 1) return; var x = Number.MAX_SAFE_INTEGER; var y = Number.MAX_SAFE_INTEGER; var x1 = Number.MIN_SAFE_INTEGER; var y1 = Number.MIN_SAFE_INTEGER; selectElements.forEach(function (element) { var outline = { x: 0, y: 0, x1: 0, y1: 0 }; if (element.BaseType === ElementType.NODE) outline = getNodeOutline(element); if (element.BaseType === ElementType.EDGE) outline = outline_getEdgeOutline(element); x = Math.min(x, outline.x); y = Math.min(y, outline.y); x1 = Math.max(x1, outline.x1); y1 = Math.max(y1, outline.y1); }); var _transformModel$Canva = transformModel.CanvasPointToHtmlPoint([x, y]); var _transformModel$Canva2 = MultipleSelectTool_slicedToArray(_transformModel$Canva, 2); x = _transformModel$Canva2[0]; y = _transformModel$Canva2[1]; var _transformModel$Canva3 = transformModel.CanvasPointToHtmlPoint([x1, y1]); var _transformModel$Canva4 = MultipleSelectTool_slicedToArray(_transformModel$Canva3, 2); x1 = _transformModel$Canva4[0]; y1 = _transformModel$Canva4[1]; var style = { left: "".concat(x - 10, "px"), top: "".concat(y - 10, "px"), width: "".concat(x1 - x + 20, "px"), height: "".concat(y1 - y + 20, "px") }; return Object(preact_module["g" /* h */])("div", { className: "lf-multiple-select", style: style, onMouseDown: this.handleMouseDown, onContextMenu: this.handleContextMenu }); } }]); return MultipleSelect; }(preact_module["a" /* Component */]), MultipleSelectTool_defineProperty(MultipleSelectTool_class2, "toolName", 'multipleSelect'), MultipleSelectTool_temp)) || MultipleSelectTool_class; // CONCATENATED MODULE: ./src/tool/index.ts function tool_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function tool_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function tool_createClass(Constructor, protoProps, staticProps) { if (protoProps) tool_defineProperties(Constructor.prototype, protoProps); if (staticProps) tool_defineProperties(Constructor, staticProps); return Constructor; } function tool_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var tool_Tool = /*#__PURE__*/function () { function Tool(instance) { tool_classCallCheck(this, Tool); tool_defineProperty(this, "tools", void 0); tool_defineProperty(this, "components", void 0); tool_defineProperty(this, "toolMap", new Map()); tool_defineProperty(this, "instance", void 0); this.instance = instance; if (!this.isDisabledTool(TextEditTool_TextEdit.toolName)) { this.registerTool(TextEditTool_TextEdit.toolName, TextEditTool_TextEdit); } if (!this.isDisabledTool(MultipleSelectTool_MultipleSelect.toolName)) { this.registerTool(MultipleSelectTool_MultipleSelect.toolName, MultipleSelectTool_MultipleSelect); } // @see https://github.com/didi/LogicFlow/issues/152 var graphModel = instance.graphModel; var eventCenter = graphModel.eventCenter; eventCenter.on("".concat(EventType.GRAPH_TRANSFORM, ",").concat(EventType.NODE_CLICK, ",").concat(EventType.BLANK_CLICK, " "), function () { var textEditElement = graphModel.textEditElement, _graphModel$editConfi = graphModel.editConfigModel, edgeTextEdit = _graphModel$editConfi.edgeTextEdit, nodeTextEdit = _graphModel$editConfi.nodeTextEdit; // fix #826, 保留之前的文本可以编辑点击空白才设置为不可编辑。如果以后有其他需求再改。 if ((edgeTextEdit || nodeTextEdit) && textEditElement) { graphModel.textEditElement.setElementState(ElementState.DEFAULT); } }); } tool_createClass(Tool, [{ key: "isDisabledTool", value: function isDisabledTool(toolName) { return this.instance.options.disabledTools.indexOf(toolName) !== -1; } }, { key: "registerTool", value: function registerTool(name, component) { this.toolMap.set(name, component); } }, { key: "getTools", value: function getTools() { return Array.from(this.toolMap.values()); } }, { key: "getInstance", value: function getInstance() { return this.instance; } }]); return Tool; }(); // EXTERNAL MODULE: /Users/didi/niu-workspace/LogicFlow/node_modules/mousetrap/mousetrap.js var mousetrap = __webpack_require__(167); var mousetrap_default = /*#__PURE__*/__webpack_require__.n(mousetrap); // CONCATENATED MODULE: ./src/keyboard/index.ts function keyboard_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function keyboard_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function keyboard_createClass(Constructor, protoProps, staticProps) { if (protoProps) keyboard_defineProperties(Constructor.prototype, protoProps); if (staticProps) keyboard_defineProperties(Constructor, staticProps); return Constructor; } function keyboard_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var keyboard_Keyboard = /*#__PURE__*/function () { function Keyboard(options) { keyboard_classCallCheck(this, Keyboard); keyboard_defineProperty(this, "mousetrap", void 0); keyboard_defineProperty(this, "options", void 0); keyboard_defineProperty(this, "target", void 0); if (!options.keyboard) { options.keyboard = { enabled: false }; } this.options = options; var lf = options.lf; this.target = lf.container; this.mousetrap = new mousetrap_default.a(); if (options.keyboard.enabled) { this.enable(true); } } keyboard_createClass(Keyboard, [{ key: "initShortcuts", value: function initShortcuts() { var _this = this; var shortcuts = this.options.keyboard.shortcuts; if (shortcuts) { if (lodash_es_isArray(shortcuts)) { shortcuts.forEach(function (_ref) { var keys = _ref.keys, callback = _ref.callback, action = _ref.action; return _this.on(keys, callback, action); }); } else { var keys = shortcuts.keys, callback = shortcuts.callback, action = shortcuts.action; this.on(keys, callback, action); } } } }, { key: "on", value: function on(keys, callback, action) { this.mousetrap.bind(this.getKeys(keys), callback, action); } }, { key: "disabled", get: function get() { return this.options.keyboard.enabled !== true; } }, { key: "off", value: function off(keys, action) { this.mousetrap.unbind(this.getKeys(keys), action); } }, { key: "enable", value: function enable(force) { if (this.disabled || force) { this.options.keyboard.enabled = true; if (this.target instanceof HTMLElement) { this.target.setAttribute('tabindex', '-1'); // 去掉节点被选中时container出现的边框 this.target.style.outline = 'none'; } } } }, { key: "disable", value: function disable() { if (!this.disabled) { this.options.keyboard.enabled = false; if (this.target instanceof HTMLElement) { this.target.removeAttribute('tabindex'); } } } }, { key: "getKeys", value: function getKeys(keys) { var _this2 = this; return (Array.isArray(keys) ? keys : [keys]).map(function (key) { return _this2.formatKey(key); }); } }, { key: "formatKey", value: function formatKey(key) { var formated = key.toLowerCase().replace(/\s/g, '').replace('delete', 'del').replace('cmd', 'command'); return formated; } }]); return Keyboard; }(); /* harmony default export */ var keyboard = (keyboard_Keyboard); // CONCATENATED MODULE: ./src/keyboard/shortcut.ts var selected = null; function translationNodeData(nodeData, distance) { nodeData.x += distance; nodeData.y += distance; if (nodeData.text) { nodeData.text.x += distance; nodeData.text.y += distance; } return nodeData; } function translationEdgeData(edgeData, distance) { if (edgeData.startPoint) { edgeData.startPoint.x += distance; edgeData.startPoint.y += distance; } if (edgeData.endPoint) { edgeData.endPoint.x += distance; edgeData.endPoint.y += distance; } if (edgeData.pointsList && edgeData.pointsList.length > 0) { edgeData.pointsList.forEach(function (point) { point.x += distance; point.y += distance; }); } if (edgeData.text) { edgeData.text.x += distance; edgeData.text.y += distance; } return edgeData; } var TRANSLATION_DISTANCE = 40; function initDefaultShortcut(lf, graph) { var keyboard = lf.keyboard; var keyboardOptions = keyboard.options.keyboard; // 复制 keyboard.on(['cmd + c', 'ctrl + c'], function () { if (!keyboardOptions.enabled) return; if (graph.textEditElement) return; var guards = lf.options.guards; var elements = graph.getSelectElements(false); var enabledClone = guards && guards.beforeClone ? guards.beforeClone(elements) : true; if (!enabledClone) { selected = null; return false; } selected = elements; selected.nodes.forEach(function (node) { return translationNodeData(node, TRANSLATION_DISTANCE); }); selected.edges.forEach(function (edge) { return translationEdgeData(edge, TRANSLATION_DISTANCE); }); return false; }); // 粘贴 keyboard.on(['cmd + v', 'ctrl + v'], function () { if (!keyboardOptions.enabled) return; if (graph.textEditElement) return; if (selected && (selected.nodes || selected.edges)) { lf.clearSelectElements(); var addElements = lf.addElements(selected); if (!addElements) return; addElements.nodes.forEach(function (node) { return lf.selectElementById(node.id, true); }); addElements.edges.forEach(function (edge) { return lf.selectElementById(edge.id, true); }); selected.nodes.forEach(function (node) { return translationNodeData(node, TRANSLATION_DISTANCE); }); selected.edges.forEach(function (edge) { return translationEdgeData(edge, TRANSLATION_DISTANCE); }); } return false; }); // undo keyboard.on(['cmd + z', 'ctrl + z'], function () { if (!keyboardOptions.enabled) return; if (graph.textEditElement) return; lf.undo(); return false; }); // redo keyboard.on(['cmd + y', 'ctrl + y'], function () { if (!keyboardOptions.enabled) return; if (graph.textEditElement) return; lf.redo(); return false; }); // delete keyboard.on(['backspace'], function () { if (!keyboardOptions.enabled) return; if (graph.textEditElement) return; var elements = graph.getSelectElements(true); lf.clearSelectElements(); elements.edges.forEach(function (edge) { return lf.deleteEdge(edge.id); }); elements.nodes.forEach(function (node) { return lf.deleteNode(node.id); }); return false; }); } // CONCATENATED MODULE: ./src/tool/SnaplineTool.ts function snaplineTool(eventCenter, snaplineModel) { // 节点拖动时启动对齐线计算 eventCenter.on('node:mousemove', function (_ref) { var data = _ref.data; snaplineModel.setNodeSnapLine(data); }); // 节点拖动结束时,对齐线消失 eventCenter.on('node:mouseup', function () { snaplineModel.clearSnapline(); }); } // CONCATENATED MODULE: ./src/LogicFlow.tsx function LogicFlow_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { LogicFlow_typeof = function _typeof(obj) { return typeof obj; }; } else { LogicFlow_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return LogicFlow_typeof(obj); } function LogicFlow_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function LogicFlow_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { LogicFlow_ownKeys(Object(source), true).forEach(function (key) { LogicFlow_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { LogicFlow_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function LogicFlow_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function LogicFlow_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function LogicFlow_createClass(Constructor, protoProps, staticProps) { if (protoProps) LogicFlow_defineProperties(Constructor.prototype, protoProps); if (staticProps) LogicFlow_defineProperties(Constructor, staticProps); return Constructor; } function LogicFlow_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // import * as mobx from 'mobx'; // import { IReactComponent } from 'mobx-react/dist/types/IReactComponent'; if (false) {} var LogicFlow_LogicFlow = /*#__PURE__*/function () { function LogicFlow(options) { var _this = this; LogicFlow_classCallCheck(this, LogicFlow); LogicFlow_defineProperty(this, "container", void 0); LogicFlow_defineProperty(this, "width", void 0); LogicFlow_defineProperty(this, "height", void 0); LogicFlow_defineProperty(this, "graphModel", void 0); LogicFlow_defineProperty(this, "history", void 0); LogicFlow_defineProperty(this, "viewMap", new Map()); LogicFlow_defineProperty(this, "tool", void 0); LogicFlow_defineProperty(this, "keyboard", void 0); LogicFlow_defineProperty(this, "dnd", void 0); LogicFlow_defineProperty(this, "options", void 0); LogicFlow_defineProperty(this, "snaplineModel", void 0); LogicFlow_defineProperty(this, "components", []); LogicFlow_defineProperty(this, "plugins", void 0); LogicFlow_defineProperty(this, "extension", {}); LogicFlow_defineProperty(this, "adapterIn", void 0); LogicFlow_defineProperty(this, "adapterOut", void 0); LogicFlow_defineProperty(this, "getView", function (type) { return _this.viewMap.get(type); }); options = options_get(options); this.options = options; this.container = options.container; this.plugins = options.plugins; // model 初始化 this.graphModel = new model_GraphModel(LogicFlow_objectSpread({}, options)); // 附加功能初始化 this.tool = new tool_Tool(this); this.history = new history_History(this.graphModel.eventCenter); this.dnd = new DnD_Dnd({ lf: this }); this.keyboard = new keyboard({ lf: this, keyboard: options.keyboard }); // 不可编辑模式没有开启,且没有关闭对齐线 if (options.snapline !== false) { this.snaplineModel = new SnaplineModel_SnaplineModel(this.graphModel); snaplineTool(this.graphModel.eventCenter, this.snaplineModel); } // 先初始化默认内置快捷键 initDefaultShortcut(this, this.graphModel); // 然后再初始化自定义快捷键,自定义快捷键可以覆盖默认快捷键. // 插件最后初始化。方便插件强制覆盖内置快捷键 this.keyboard.initShortcuts(); // init 放到最后 this.defaultRegister(); this.installPlugins(options.disabledPlugins); } /** * 注册自定义节点和边 * 支持两种方式 * 方式一(推荐) * 详情见 todo: docs link * @example * import { RectNode, RectModel } from '@logicflow/core' * class CustomView extends RectNode { * } * class CustomModel extends RectModel { * } * lf.register({ * type: 'custom', * view: CustomView, * model: CustomModel * }) * 方式二 * 不推荐,极个别在自定义的时候需要用到lf的情况下可以用这种方式。 * 大多数情况下,我们可以直接在view中从this.props中获取graphModel * 或者model中直接this.graphModel获取model的方法。 * @example * lf.register('custom', ({ RectNode, RectModel }) => { * class CustomView extends RectNode {} * class CustomModel extends RectModel {} * return { * view: CustomView, * model: CustomModel * } * }) */ LogicFlow_createClass(LogicFlow, [{ key: "register", value: function register(type, fn) { var isObserverView = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; // 方式1 if (typeof type !== 'string') { this.registerElement(type); return; } var registerParam = { BaseEdge: BaseEdge_BaseEdge, BaseEdgeModel: BaseEdgeModel_BaseEdgeModel, BaseNode: BaseNode_BaseNode, BaseNodeModel: BaseNodeModel_BaseNodeModel, RectNode: RectNode_RectNode, RectNodeModel: RectNodeModel_RectNodeModel, CircleNode: CircleNode_CircleNode, CircleNodeModel: CircleNodeModel_CircleNodeModel, PolygonNode: PolygonNode_PolygonNode, PolygonNodeModel: PolygonNodeModel_PolygonNodeModel, TextNode: TextNode_TextNode, TextNodeModel: TextNodeModel_TextNodeModel, LineEdge: LineEdge_LineEdge, LineEdgeModel: LineEdgeModel_LineEdgeModel, DiamondNode: DiamondNode_DiamondNode, DiamondNodeModel: DiamondNodeModel_DiamondNodeModel, PolylineEdge: PolylineEdge_PolylineEdge, PolylineEdgeModel: PolylineEdgeModel_PolylineEdgeModel, BezierEdge: BezierEdge_BezierEdge, BezierEdgeModel: BezierEdgeModel_BezierEdgeModel, EllipseNode: EllipseNode_EllipseNode, EllipseNodeModel: EllipseNodeModel_EllipseNodeModel, HtmlNode: HtmlNode_HtmlNode, HtmlNodeModel: HtmlNodeModel_HtmlNodeModel, // mobx, h: preact_module["g" /* h */], type: type }; // 为了能让后来注册的可以继承前面注册的 // 例如我注册一个”开始节点“ // 然后我再想注册一个”立即开始节点“ // 注册传递参数改为动态。 this.viewMap.forEach(function (component) { var key = component.extendKey; if (key) { registerParam[key] = component; } }); this.graphModel.modelMap.forEach(function (component) { var key = component.extendKey; if (key) { registerParam[key] = component; } }); var _fn = fn(registerParam), ViewClass = _fn.view, ModelClass = _fn.model; var vClass = ViewClass; if (isObserverView && !vClass.isObervered) { vClass.isObervered = true; // @ts-ignore vClass = mobxreact_esm_observer(vClass); } this.setView(type, vClass); this.graphModel.setModel(type, ModelClass); } }, { key: "registerElement", value: function registerElement(config) { var vClass = config.view; if (config.isObserverView !== false && !vClass.isObervered) { vClass.isObervered = true; // @ts-ignore vClass = mobxreact_esm_observer(vClass); } this.setView(config.type, vClass); this.graphModel.setModel(config.type, config.model); } /** * 批量注册 * @param elements 注册的元素 */ }, { key: "batchRegister", value: function batchRegister() { var _this2 = this; var elements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; elements.forEach(function (element) { _this2.registerElement(element); }); } }, { key: "defaultRegister", value: function defaultRegister() { // register default shape this.registerElement({ view: RectNode_RectNode, model: RectNodeModel_RectNodeModel, type: 'rect' }); this.registerElement({ type: 'circle', view: CircleNode_CircleNode, model: CircleNodeModel_CircleNodeModel }); this.registerElement({ type: 'polygon', view: PolygonNode_PolygonNode, model: PolygonNodeModel_PolygonNodeModel }); this.registerElement({ type: 'line', view: LineEdge_LineEdge, model: LineEdgeModel_LineEdgeModel }); this.registerElement({ type: 'polyline', view: PolylineEdge_PolylineEdge, model: PolylineEdgeModel_PolylineEdgeModel }); this.registerElement({ type: 'bezier', view: BezierEdge_BezierEdge, model: BezierEdgeModel_BezierEdgeModel }); this.registerElement({ type: 'text', view: TextNode_TextNode, model: TextNodeModel_TextNodeModel }); this.registerElement({ type: 'ellipse', view: EllipseNode_EllipseNode, model: EllipseNodeModel_EllipseNodeModel }); this.registerElement({ type: 'diamond', view: DiamondNode_DiamondNode, model: DiamondNodeModel_DiamondNodeModel }); this.registerElement({ type: 'html', view: HtmlNode_HtmlNode, model: HtmlNodeModel_HtmlNodeModel }); } /** * 将图形选中 * @param id 选择元素ID * @param multiple 是否允许多选,如果为true,不会将上一个选中的元素重置 * @param toFront 是否将选中的元素置顶,默认为true */ }, { key: "selectElementById", value: function selectElementById(id) { var multiple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var toFront = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; this.graphModel.selectElementById(id, multiple); if (!multiple && toFront) { this.graphModel.toFront(id); } } /** * 定位到画布视口中心 * 支持用户传入图形当前的坐标或id,可以通过type来区分是节点还是边的id,也可以不传(兜底) * @param focusOnArgs.id 如果传入的是id, 则画布视口中心移动到此id的元素中心点。 * @param focusOnArgs.coordinate 如果传入的是坐标,则画布视口中心移动到此坐标。 */ }, { key: "focusOn", value: function focusOn(focusOnArgs) { var transformModel = this.graphModel.transformModel; var coordinate = focusOnArgs.coordinate; var id = focusOnArgs.id; if (!coordinate) { var model = this.getNodeModelById(id); if (model) { coordinate = model.getData(); } var edgeModel = this.getEdgeModelById(id); if (edgeModel) { coordinate = edgeModel.textPosition; } } var _coordinate = coordinate, x = _coordinate.x, y = _coordinate.y; transformModel.focusOn(x, y, this.graphModel.width, this.graphModel.height); } /** * 设置主题样式 * @param { object } style 自定义主题样式 * todo docs link */ }, { key: "setTheme", value: function setTheme(style) { this.graphModel.setTheme(style); } /** * 重新设置画布的宽高 * 不传会自动计算画布宽高 */ }, { key: "resize", value: function resize(width, height) { this.graphModel.resize(width, height); this.options.width = this.graphModel.width; this.options.height = this.graphModel.height; } /** * 设置默认的边类型。 * 也就是设置在节点直接有用户手动绘制的连线类型。 * @param type Options.EdgeType */ }, { key: "setDefaultEdgeType", value: function setDefaultEdgeType(type) { this.graphModel.setDefaultEdgeType(type); } /** * 更新节点或边的文案 * @param id 节点或者边id * @param value 文案内容 */ }, { key: "updateText", value: function updateText(id, value) { this.graphModel.updateText(id, value); } /** * 删除元素,在不确定当前id是节点还是边时使用 * @param id 元素id */ }, { key: "deleteElement", value: function deleteElement(id) { var _callback, _callback$BaseType$ca, _callback$BaseType; var model = this.getModelById(id); if (!model) return false; var callback = (_callback = {}, LogicFlow_defineProperty(_callback, ElementType.NODE, this.deleteNode), LogicFlow_defineProperty(_callback, ElementType.EDGE, this.deleteEdge), _callback); var BaseType = model.BaseType; return (_callback$BaseType$ca = (_callback$BaseType = callback[BaseType]) === null || _callback$BaseType === void 0 ? void 0 : _callback$BaseType.call(this, id)) !== null && _callback$BaseType$ca !== void 0 ? _callback$BaseType$ca : false; } /** * 获取节点或边对象 * @param id id */ }, { key: "getModelById", value: function getModelById(id) { return this.graphModel.getElement(id); } /** * 获取节点或边的数据 * @param id id */ }, { key: "getDataById", value: function getDataById(id) { var _this$graphModel$getE; return (_this$graphModel$getE = this.graphModel.getElement(id)) === null || _this$graphModel$getE === void 0 ? void 0 : _this$graphModel$getE.getData(); } /** * 修改指定节点类型 * @param id 节点id * @param type 节点类型 */ }, { key: "changeNodeType", value: function changeNodeType(id, type) { this.graphModel.changeNodeType(id, type); } /** * 切换边的类型 * @param id 边Id * @param type 边类型 */ }, { key: "changeEdgeType", value: function changeEdgeType(id, type) { this.graphModel.changeEdgeType(id, type); } /** * 获取节点连接的所有边的model * @param nodeId 节点ID * @returns model数组 */ }, { key: "getNodeEdges", value: function getNodeEdges(nodeId) { return this.graphModel.getNodeEdges(nodeId); } /** * 添加节点 * @param nodeConfig 节点配置 * @param eventType 新增节点事件类型,默认EventType.NODE_ADD */ }, { key: "addNode", value: function addNode(nodeConfig) { var eventType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EventType.NODE_ADD; return this.graphModel.addNode(nodeConfig, eventType); } /** * 删除节点 * @param {string} nodeId 节点Id */ }, { key: "deleteNode", value: function deleteNode(nodeId) { var Model = this.graphModel.getNodeModelById(nodeId); if (!Model) { return false; } var data = Model.getData(); var guards = this.options.guards; var enabledDelete = guards && guards.beforeDelete ? guards.beforeDelete(data) : true; if (enabledDelete) { this.graphModel.deleteNode(nodeId); } return enabledDelete; } /** * 克隆节点 * @param nodeId 节点Id */ }, { key: "cloneNode", value: function cloneNode(nodeId) { var Model = this.graphModel.getNodeModelById(nodeId); var data = Model.getData(); var guards = this.options.guards; var enabledClone = guards && guards.beforeClone ? guards.beforeClone(data) : true; if (enabledClone) { return this.graphModel.cloneNode(nodeId); } } /** * 修改节点的id, 如果不传新的id,会内部自动创建一个。 * @param { string } oldId 将要被修改的id * @param { string } newId 可选,修改后的id * @returns 修改后的节点id, 如果传入的oldId不存在,返回空字符串 */ }, { key: "changeNodeId", value: function changeNodeId(oldId, newId) { return this.graphModel.changeNodeId(oldId, newId); } /** * 获取节点对象 * @param nodeId 节点Id */ }, { key: "getNodeModelById", value: function getNodeModelById(nodeId) { return this.graphModel.getNodeModelById(nodeId); } /** * 获取节点数据 * @param nodeId 节点 */ }, { key: "getNodeDataById", value: function getNodeDataById(nodeId) { return this.graphModel.getNodeModelById(nodeId).getData(); } /** * 给两个节点之间添加一条边 * @example * lf.addEdge({ * type: 'polygon' * sourceNodeId: 'node_id_1', * targetNodeId: 'node_id_2', * }) * @param {object} edgeConfig */ }, { key: "addEdge", value: function addEdge(edgeConfig) { return this.graphModel.addEdge(edgeConfig); } /** * 删除边 * @param {string} edgeId 边Id */ }, { key: "deleteEdge", value: function deleteEdge(edgeId) { var guards = this.options.guards; var edge = this.graphModel.edgesMap[edgeId]; if (!edge) { return false; } var edgeData = edge.model.getData(); var enabledDelete = guards && guards.beforeDelete ? guards.beforeDelete(edgeData) : true; if (enabledDelete) { this.graphModel.deleteEdgeById(edgeId); } return enabledDelete; } /** * 删除指定类型的边, 基于边起点和终点,可以只传其一。 * @param config.sourceNodeId 边的起点节点ID * @param config.targetNodeId 边的终点节点ID */ }, { key: "deleteEdgeByNodeId", value: function deleteEdgeByNodeId(config) { var sourceNodeId = config.sourceNodeId, targetNodeId = config.targetNodeId; if (sourceNodeId && targetNodeId) { this.graphModel.deleteEdgeBySourceAndTarget(sourceNodeId, targetNodeId); } else if (sourceNodeId) { this.graphModel.deleteEdgeBySource(sourceNodeId); } else if (targetNodeId) { this.graphModel.deleteEdgeByTarget(targetNodeId); } } /** * 修改边的id, 如果不传新的id,会内部自动创建一个。 * @param { string } oldId 将要被修改的id * @param { string } newId 可选,修改后的id * @returns 修改后的节点id, 如果传入的oldId不存在,返回空字符串 */ }, { key: "changeEdgeId", value: function changeEdgeId(oldId, newId) { return this.graphModel.changeEdgeId(oldId, newId); } /** * 基于边Id获取边的model * @param edgeId 边的Id * @return model */ }, { key: "getEdgeModelById", value: function getEdgeModelById(edgeId) { var _edgesMap$edgeId; var edgesMap = this.graphModel.edgesMap; return (_edgesMap$edgeId = edgesMap[edgeId]) === null || _edgesMap$edgeId === void 0 ? void 0 : _edgesMap$edgeId.model; } /** * 获取满足条件边的model * @param edgeFilter 过滤条件 * @example * 获取所有起点为节点A的边的model * lf.getEdgeModels({ * sourceNodeId: 'nodeA_id' * }) * 获取所有终点为节点B的边的model * lf.getEdgeModels({ * targetNodeId: 'nodeB_id' * }) * 获取起点为节点A,终点为节点B的边 * lf.getEdgeModels({ * sourceNodeId: 'nodeA_id', * targetNodeId: 'nodeB_id' * }) * @return model数组 */ }, { key: "getEdgeModels", value: function getEdgeModels(edgeFilter) { var edges = this.graphModel.edges; var sourceNodeId = edgeFilter.sourceNodeId, targetNodeId = edgeFilter.targetNodeId; if (sourceNodeId && targetNodeId) { var result = []; edges.forEach(function (edge) { if (edge.sourceNodeId === sourceNodeId && edge.targetNodeId === targetNodeId) { result.push(edge); } }); return result; } if (sourceNodeId) { var _result = []; edges.forEach(function (edge) { if (edge.sourceNodeId === sourceNodeId) { _result.push(edge); } }); return _result; } if (targetNodeId) { var _result2 = []; edges.forEach(function (edge) { if (edge.targetNodeId === targetNodeId) { _result2.push(edge); } }); return _result2; } return []; } /** * 基于id获取边数据 * @param edgeId 边Id * @returns EdgeData */ }, { key: "getEdgeDataById", value: function getEdgeDataById(edgeId) { var _this$getEdgeModelByI; return (_this$getEdgeModelByI = this.getEdgeModelById(edgeId)) === null || _this$getEdgeModelByI === void 0 ? void 0 : _this$getEdgeModelByI.getData(); } /** * 获取所有以此节点为终点的边 */ }, { key: "getNodeIncomingEdge", value: function getNodeIncomingEdge(nodeId) { return this.graphModel.getNodeIncomingEdge(nodeId); } /** * 获取所有以此节点为起点的边 */ }, { key: "getNodeOutgoingEdge", value: function getNodeOutgoingEdge(nodeId) { return this.graphModel.getNodeOutgoingEdge(nodeId); } /** * 获取节点连接到的所有起始节点 */ }, { key: "getNodeIncomingNode", value: function getNodeIncomingNode(nodeId) { return this.graphModel.getNodeIncomingNode(nodeId); } /** * 获取节点连接到的所有目标节点 */ }, { key: "getNodeOutgoingNode", value: function getNodeOutgoingNode(nodeId) { return this.graphModel.getNodeOutgoingNode(nodeId); } /** * 显示节点、连线文本编辑框 * @param id 元素id */ }, { key: "editText", value: function editText(id) { this.graphModel.editText(id); } /** * 设置元素的自定义属性 * @see todo docs link * @param id 元素的id * @param properties 自定义属性 */ }, { key: "setProperties", value: function setProperties(id, properties) { var _this$graphModel$getE2; (_this$graphModel$getE2 = this.graphModel.getElement(id)) === null || _this$graphModel$getE2 === void 0 ? void 0 : _this$graphModel$getE2.setProperties(formatData(properties)); } }, { key: "deleteProperty", value: function deleteProperty(id, key) { var _this$graphModel$getE3; (_this$graphModel$getE3 = this.graphModel.getElement(id)) === null || _this$graphModel$getE3 === void 0 ? void 0 : _this$graphModel$getE3.deleteProperty(key); } /** * 获取元素的自定义属性 * @param id 元素的id * @returns 自定义属性 */ }, { key: "getProperties", value: function getProperties(id) { var _this$graphModel$getE4; return (_this$graphModel$getE4 = this.graphModel.getElement(id)) === null || _this$graphModel$getE4 === void 0 ? void 0 : _this$graphModel$getE4.getProperties(); } /** * 将某个元素放置到顶部。 * 如果堆叠模式为默认模式,则将原置顶元素重新恢复原有层级。 * 如果堆叠模式为递增模式,则将需指定元素zIndex设置为当前最大zIndex + 1。 * @see todo link 堆叠模式 * @param id 元素Id */ }, { key: "toFront", value: function toFront(id) { this.graphModel.toFront(id); } /** * 设置元素的zIndex. * 注意:默认堆叠模式下,不建议使用此方法。 * @see todo link 堆叠模式 * @param id 元素id * @param zIndex zIndex的值,可以传数字,也支持传入'top' 和 'bottom' */ }, { key: "setElementZIndex", value: function setElementZIndex(id, zIndex) { return this.graphModel.setElementZIndex(id, zIndex); } /** * 添加多个元素, 包括边和节点。 */ }, { key: "addElements", value: function addElements(_ref) { var _this3 = this; var nodes = _ref.nodes, edges = _ref.edges; var nodeIdMap = {}; var elements = { nodes: [], edges: [] }; for (var i = 0; i < nodes.length; i++) { var node = nodes[i]; var preId = node.id; var nodeModel = this.addNode(node); if (!nodeModel) return; if (preId) nodeIdMap[preId] = nodeModel.id; elements.nodes.push(nodeModel); } edges.forEach(function (edge) { var sourceId = edge.sourceNodeId; var targetId = edge.targetNodeId; if (nodeIdMap[sourceId]) sourceId = nodeIdMap[sourceId]; if (nodeIdMap[targetId]) targetId = nodeIdMap[targetId]; var edgeModel = _this3.graphModel.addEdge(LogicFlow_objectSpread(LogicFlow_objectSpread({}, edge), {}, { sourceNodeId: sourceId, targetNodeId: targetId })); elements.edges.push(edgeModel); }); return elements; } /** * 获取指定区域内的所有元素,此区域必须是DOM层。 * 例如鼠标绘制选区后,获取选区内的所有元素。 * @see todo 分层 * @param leftTopPoint 区域左上角坐标, dom层坐标 * @param rightBottomPoint 区域右下角坐标,dom层坐标 */ }, { key: "getAreaElement", value: function getAreaElement(leftTopPoint, rightBottomPoint) { var wholeEdge = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; var wholeNode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; var ignoreHideElement = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; return this.graphModel.getAreaElement(leftTopPoint, rightBottomPoint, wholeEdge, wholeNode, ignoreHideElement).map(function (element) { return element.getData(); }); } /** * 获取选中的元素数据 * @param isIgnoreCheck 是否包括sourceNode和targetNode没有被选中的边,默认包括。 * 注意:复制的时候不能包括此类边, 因为复制的时候不允许悬空的边。 */ }, { key: "getSelectElements", value: function getSelectElements() { var isIgnoreCheck = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; return this.graphModel.getSelectElements(isIgnoreCheck); } /** * 将所有选中的元素设置为非选中 */ }, { key: "clearSelectElements", value: function clearSelectElements() { this.graphModel.clearSelectElements(); } /** * 获取流程绘图数据 * 注意: getGraphData返回的数据受到adapter影响,所以其数据格式不一定是logicflow内部图数据格式。 * 如果实现通用插件,请使用getGraphRawData */ }, { key: "getGraphData", value: function getGraphData() { var data = this.graphModel.modelToGraphData(); if (this.adapterOut) { return this.adapterOut(data); } return data; } /** * 获取流程绘图原始数据 * 在存在adapter时,可以使用getGraphRawData获取图原始数据 */ }, { key: "getGraphRawData", value: function getGraphRawData() { return this.graphModel.modelToGraphData(); } /** * 清空画布 */ }, { key: "clearData", value: function clearData() { this.graphModel.clearData(); } /** * 更新流程图编辑相关设置 * @param {object} config 编辑配置 * @see todo docs link */ }, { key: "updateEditConfig", value: function updateEditConfig(config) { this.graphModel.editConfigModel.updateEditConfig(config); } /** * 获取流程图当前编辑相关设置 * @see todo docs link */ }, { key: "getEditConfig", value: function getEditConfig() { return this.graphModel.editConfigModel.getConfig(); } /** * 获取事件位置相对于画布左上角的坐标 * 画布所在的位置可以是页面任何地方,原生事件返回的坐标是相对于页面左上角的,该方法可以提供以画布左上角为原点的准确位置。 * @see todo link * @param {number} x 事件x坐标 * @param {number} y 事件y坐标 * @returns {object} Point 事件位置的坐标 * @returns {object} Point.domOverlayPosition HTML层上的坐标 * @returns {object} Point.canvasOverlayPosition SVG层上的坐标 */ }, { key: "getPointByClient", value: function getPointByClient(x, y) { return this.graphModel.getPointByClient({ x: x, y: y }); } /** * 历史记录操作 * 返回上一步 */ }, { key: "undo", value: function undo() { if (!this.history.undoAble()) return; // formatData兼容vue数据 var graphData = formatData(this.history.undo()); this.clearSelectElements(); this.graphModel.graphDataToModel(graphData); } /** * 历史记录操作 * 恢复下一步 */ }, { key: "redo", value: function redo() { if (!this.history.redoAble()) return; // formatData兼容vue数据 var graphData = formatData(this.history.redo()); this.clearSelectElements(); this.graphModel.graphDataToModel(graphData); } /** * 放大缩小图形 * @param zoomSize 放大缩小的值,支持传入0-n之间的数字。小于1表示缩小,大于1表示放大。也支持传入true和false按照内置的刻度放大缩小 * @param point 缩放的原点 * @returns {string} -放大缩小的比例 */ }, { key: "zoom", value: function zoom(zoomSize, point) { var transformModel = this.graphModel.transformModel; return transformModel.zoom(zoomSize, point); } /** * 重置图形的放大缩写比例为默认 */ }, { key: "resetZoom", value: function resetZoom() { var transformModel = this.graphModel.transformModel; transformModel.resetZoom(); } /** * 设置图形缩小时,能缩放到的最小倍数。参数为0-1自己。默认0.2 * @param size 图形缩小的最小值 */ }, { key: "setZoomMiniSize", value: function setZoomMiniSize(size) { var transformModel = this.graphModel.transformModel; transformModel.setZoomMiniSize(size); } /** * 设置图形放大时,能放大到的最大倍数,默认16 * @param size 图形放大的最大值 */ }, { key: "setZoomMaxSize", value: function setZoomMaxSize(size) { var transformModel = this.graphModel.transformModel; transformModel.setZoomMaxSize(size); } /** * 获取缩放的值和平移的值。 */ }, { key: "getTransform", value: function getTransform() { var _this$graphModel$tran = this.graphModel.transformModel, SCALE_X = _this$graphModel$tran.SCALE_X, SCALE_Y = _this$graphModel$tran.SCALE_Y, TRANSLATE_X = _this$graphModel$tran.TRANSLATE_X, TRANSLATE_Y = _this$graphModel$tran.TRANSLATE_Y; return { SCALE_X: SCALE_X, SCALE_Y: SCALE_Y, TRANSLATE_X: TRANSLATE_X, TRANSLATE_Y: TRANSLATE_Y }; } /** * 平移图 * @param x 向x轴移动距离 * @param y 向y轴移动距离 */ }, { key: "translate", value: function translate(x, y) { var transformModel = this.graphModel.transformModel; transformModel.translate(x, y); } /** * 还原图形为初始位置 */ }, { key: "resetTranslate", value: function resetTranslate() { var transformModel = this.graphModel.transformModel; var TRANSLATE_X = transformModel.TRANSLATE_X, TRANSLATE_Y = transformModel.TRANSLATE_Y; this.translate(-TRANSLATE_X, -TRANSLATE_Y); } /** * 图形画布居中显示 */ }, { key: "translateCenter", value: function translateCenter() { this.graphModel.translateCenter(); } /** * 图形适应屏幕大小 * @param verticalOffset number 距离盒子上下的距离, 默认为20 * @param horizontalOffset number 距离盒子左右的距离, 默认为20 */ }, { key: "fitView", value: function fitView(verticalOffset, horizontalOffset) { if (horizontalOffset === undefined) { horizontalOffset = verticalOffset; // 兼容以前的只传一个参数的情况 } this.graphModel.fitView(verticalOffset, horizontalOffset); } /** * 开启边的动画 * @param edgeId any */ }, { key: "openEdgeAnimation", value: function openEdgeAnimation(edgeId) { this.graphModel.openEdgeAnimation(edgeId); } /** * 关闭边的动画 * @param edgeId any */ }, { key: "closeEdgeAnimation", value: function closeEdgeAnimation(edgeId) { this.graphModel.closeEdgeAnimation(edgeId); } // 事件系统---------------------------------------------- /** * 监听事件 * 事件详情见 @see todo * 支持同时监听多个事件 * @example * lf.on('node:click,node:contextmenu', (data) => { * }); */ }, { key: "on", value: function on(evt, callback) { this.graphModel.eventCenter.on(evt, callback); } /** * 撤销监听事件 */ }, { key: "off", value: function off(evt, callback) { this.graphModel.eventCenter.off(evt, callback); } /** * 监听事件,只监听一次 */ }, { key: "once", value: function once(evt, callback) { this.graphModel.eventCenter.once(evt, callback); } /** * 触发监听事件 */ }, { key: "emit", value: function emit(evt, arg) { this.graphModel.eventCenter.emit(evt, arg); } // 插件系统---------------------------------------------- /** * 添加扩展, 待讨论,这里是不是静态方法好一些? * 重复添加插件的时候,把上一次添加的插件的销毁。 * @param plugin 插件 */ }, { key: "installPlugins", value: function installPlugins() { var _this$plugins, _this4 = this; var disabledPlugins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; // 安装插件,优先使用个性插件 var extensions = (_this$plugins = this.plugins) !== null && _this$plugins !== void 0 ? _this$plugins : LogicFlow.extensions; extensions.forEach(function (extension) { var pluginName = extension.pluginName || extension.name; if (disabledPlugins.indexOf(pluginName) === -1) { _this4.installPlugin(extension); } }); } /** * 加载插件-内部方法 */ }, { key: "installPlugin", value: function installPlugin(extension) { if (LogicFlow_typeof(extension) === 'object') { var install = extension.install, renderComponent = extension.render; install && install.call(extension, this, LogicFlow); renderComponent && this.components.push(renderComponent.bind(extension)); this.extension[extension.pluginName] = extension; return; } var ExtensionCls = extension; var extensionInstance = new ExtensionCls({ lf: this, LogicFlow: LogicFlow, options: this.options.pluginsOptions }); extensionInstance.render && this.components.push(extensionInstance.render.bind(extensionInstance)); this.extension[ExtensionCls.pluginName] = extensionInstance; } /** * 修改对应元素 model 中的属性 * 注意:此方法慎用,除非您对logicflow内部有足够的了解。 * 大多数情况下,请使用setProperties、updateText、changeNodeId等方法。 * 例如直接使用此方法修改节点的id,那么就是会导致连接到此节点的边的sourceNodeId出现找不到的情况。 * @param {string} id 元素id * @param {object} attributes 需要更新的属性 */ }, { key: "updateAttributes", value: function updateAttributes(id, attributes) { this.graphModel.updateAttributes(id, attributes); } /** * 内部保留方法 * 创建一个fakerNode,用于dnd插件拖动节点进画布的时候使用。 */ }, { key: "createFakerNode", value: function createFakerNode(nodeConfig) { var Model = this.graphModel.modelMap.get(nodeConfig.type); if (!Model) { console.warn("\u4E0D\u5B58\u5728\u4E3A".concat(nodeConfig.type, "\u7C7B\u578B\u7684\u8282\u70B9")); return; } // * initNodeData区分是否为虚拟节点 var fakerNodeModel = new Model(LogicFlow_objectSpread(LogicFlow_objectSpread({}, nodeConfig), {}, { virtual: true }), this.graphModel); this.graphModel.setFakerNode(fakerNodeModel); return fakerNodeModel; } /** * 内部保留方法 * 移除fakerNode */ }, { key: "removeFakerNode", value: function removeFakerNode() { this.graphModel.removeFakerNode(); } /** * 内部保留方法 * 用于fakerNode显示对齐线 */ }, { key: "setNodeSnapLine", value: function setNodeSnapLine(data) { if (this.snaplineModel) { this.snaplineModel.setNodeSnapLine(data); } } /** * 内部保留方法 * 用于fakerNode移除对齐线 */ }, { key: "removeNodeSnapLine", value: function removeNodeSnapLine() { if (this.snaplineModel) { this.snaplineModel.clearSnapline(); } } /** * 内部保留方法 * 用于fakerNode移除对齐线 */ }, { key: "setView", value: function setView(type, component) { this.viewMap.set(type, component); } }, { key: "renderRawData", value: function renderRawData(graphRawData) { this.graphModel.graphDataToModel(formatData(graphRawData)); if (this.options.history !== false) { this.history.watch(this.graphModel); } Object(preact_module["j" /* render */])(Object(preact_module["g" /* h */])(view_Graph, { getView: this.getView, tool: this.tool, options: this.options, dnd: this.dnd, snaplineModel: this.snaplineModel, graphModel: this.graphModel }), this.container); this.emit(EventType.GRAPH_RENDERED, this.graphModel.modelToGraphData()); } /** * 渲染图 * @example * lf.render({ * nodes: [ * { * id: 'node_1', * type: 'rect', * x: 100, * y: 100 * }, * { * id: 'node_2', * type: 'circle', * x: 300, * y: 200 * } * ], * edges: [ * { * sourceNodeId: 'node_1', * targetNodeId: 'node_2', * type: 'polyline' * } * ] * }) * @param graphData 图数据 */ }, { key: "render", value: function render() { var graphData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; if (this.adapterIn) { graphData = this.adapterIn(graphData); } this.renderRawData(graphData); } /** * 内部保留方法 * 获取指定类型的view */ }], [{ key: "use", value: function use(extension) { var pluginName = extension.pluginName; if (!pluginName) { console.warn("\u8BF7\u7ED9\u63D2\u4EF6".concat(extension.name || extension.constructor.name, "\u6307\u5B9ApluginName!")); pluginName = extension.name; // 兼容以前name的情况,1.0版本去掉。 } var preExtension = this.extensions.get(pluginName); preExtension && preExtension.destroy && preExtension.destroy(); this.extensions.set(pluginName, extension); } }]); return LogicFlow; }(); LogicFlow_defineProperty(LogicFlow_LogicFlow, "extensions", new Map()); // CONCATENATED MODULE: ./src/type/index.ts // import mobx from 'mobx'; // CONCATENATED MODULE: ./src/index.tsx // 统一对外导出 function src_observer(props) { return mobxreact_esm_observer(props); } /* harmony default export */ var src = __webpack_exports__["default"] = (LogicFlow_LogicFlow); /***/ }) /******/ ]); });