@egjs/conveyer
Version:
Conveyer adds Drag gestures to your Native Scroll.
1,665 lines (1,660 loc) • 117 kB
JavaScript
"use strict";
/*!
* @egjs/conveyer v1.8.1-alpha.0
* (c) 2025 NAVER Corp.
* @license MIT
*/
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
function some(arr, callback) {
var length = arr.length;
for (var i = 0; i < length; ++i) {
if (callback(arr[i], i)) {
return true;
}
}
return false;
}
function find(arr, callback) {
var length = arr.length;
for (var i = 0; i < length; ++i) {
if (callback(arr[i], i)) {
return arr[i];
}
}
return null;
}
function getUserAgentString(agent2) {
var userAgent = agent2;
if (typeof userAgent === "undefined") {
if (typeof navigator === "undefined" || !navigator) {
return "";
}
userAgent = navigator.userAgent || "";
}
return userAgent.toLowerCase();
}
function execRegExp(pattern, text) {
try {
return new RegExp(pattern, "g").exec(text);
} catch (e) {
return null;
}
}
function hasUserAgentData() {
if (typeof navigator === "undefined" || !navigator || !navigator.userAgentData) {
return false;
}
var userAgentData = navigator.userAgentData;
var brands = userAgentData.brands || userAgentData.uaList;
return !!(brands && brands.length);
}
function findVersion(versionTest, userAgent) {
var result = execRegExp("(" + versionTest + ")((?:\\/|\\s|:)([0-9|\\.|_]+))", userAgent);
return result ? result[3] : "";
}
function convertVersion(text) {
return text.replace(/_/g, ".");
}
function findPreset(presets, userAgent) {
var userPreset = null;
var version = "-1";
some(presets, function(preset) {
var result = execRegExp("(" + preset.test + ")((?:\\/|\\s|:)([0-9|\\.|_]+))?", userAgent);
if (!result || preset.brand) {
return false;
}
userPreset = preset;
version = result[3] || "-1";
if (preset.versionAlias) {
version = preset.versionAlias;
} else if (preset.versionTest) {
version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version;
}
version = convertVersion(version);
return true;
});
return {
preset: userPreset,
version
};
}
function findPresetBrand(presets, brands) {
var brandInfo = {
brand: "",
version: "-1"
};
some(presets, function(preset) {
var result = findBrand(brands, preset);
if (!result) {
return false;
}
brandInfo.brand = preset.id;
brandInfo.version = preset.versionAlias || result.version;
return brandInfo.version !== "-1";
});
return brandInfo;
}
function findBrand(brands, preset) {
return find(brands, function(_a) {
var brand = _a.brand;
return execRegExp("" + preset.test, brand.toLowerCase());
});
}
var BROWSER_PRESETS = [{
test: "phantomjs",
id: "phantomjs"
}, {
test: "whale",
id: "whale"
}, {
test: "edgios|edge|edg",
id: "edge"
}, {
test: "msie|trident|windows phone",
id: "ie",
versionTest: "iemobile|msie|rv"
}, {
test: "miuibrowser",
id: "miui browser"
}, {
test: "samsungbrowser",
id: "samsung internet"
}, {
test: "samsung",
id: "samsung internet",
versionTest: "version"
}, {
test: "chrome|crios",
id: "chrome"
}, {
test: "firefox|fxios",
id: "firefox"
}, {
test: "android",
id: "android browser",
versionTest: "version"
}, {
test: "safari|iphone|ipad|ipod",
id: "safari",
versionTest: "version"
}];
var CHROMIUM_PRESETS = [{
test: "(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)",
id: "chrome",
versionTest: "chrome"
}, {
test: "chromium",
id: "chrome"
}, {
test: "whale",
id: "chrome",
versionAlias: "-1",
brand: true
}];
var WEBKIT_PRESETS = [{
test: "applewebkit",
id: "webkit",
versionTest: "applewebkit|safari"
}];
var WEBVIEW_PRESETS = [{
test: "(?=(iphone|ipad))(?!(.*version))",
id: "webview"
}, {
test: "(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))",
id: "webview"
}, {
// test webview
test: "webview",
id: "webview"
}];
var OS_PRESETS = [{
test: "windows phone",
id: "windows phone"
}, {
test: "windows 2000",
id: "window",
versionAlias: "5.0"
}, {
test: "windows nt",
id: "window"
}, {
test: "win32|windows",
id: "window"
}, {
test: "iphone|ipad|ipod",
id: "ios",
versionTest: "iphone os|cpu os"
}, {
test: "macos|macintel|mac os x",
id: "mac"
}, {
test: "android|linux armv81",
id: "android"
}, {
test: "tizen",
id: "tizen"
}, {
test: "webos|web0s",
id: "webos"
}];
function isWebView(userAgent) {
return !!findPreset(WEBVIEW_PRESETS, userAgent).preset;
}
function getLegacyAgent(userAgent) {
var nextAgent = getUserAgentString(userAgent);
var isMobile = !!/mobi/g.exec(nextAgent);
var browser = {
name: "unknown",
version: "-1",
majorVersion: -1,
webview: isWebView(nextAgent),
chromium: false,
chromiumVersion: "-1",
webkit: false,
webkitVersion: "-1"
};
var os = {
name: "unknown",
version: "-1",
majorVersion: -1
};
var _a = findPreset(BROWSER_PRESETS, nextAgent), browserPreset = _a.preset, browserVersion = _a.version;
var _b = findPreset(OS_PRESETS, nextAgent), osPreset = _b.preset, osVersion = _b.version;
var chromiumPreset = findPreset(CHROMIUM_PRESETS, nextAgent);
browser.chromium = !!chromiumPreset.preset;
browser.chromiumVersion = chromiumPreset.version;
if (!browser.chromium) {
var webkitPreset = findPreset(WEBKIT_PRESETS, nextAgent);
browser.webkit = !!webkitPreset.preset;
browser.webkitVersion = webkitPreset.version;
}
if (osPreset) {
os.name = osPreset.id;
os.version = osVersion;
os.majorVersion = parseInt(osVersion, 10);
}
if (browserPreset) {
browser.name = browserPreset.id;
browser.version = browserVersion;
if (browser.webview && os.name === "ios" && browser.name !== "safari") {
browser.webview = false;
}
}
browser.majorVersion = parseInt(browser.version, 10);
return {
browser,
os,
isMobile,
isHints: false
};
}
function getClientHintsAgent(osData) {
var userAgentData = navigator.userAgentData;
var brands = (userAgentData.uaList || userAgentData.brands).slice();
var isMobile = userAgentData.mobile || false;
var firstBrand = brands[0];
var platform = (userAgentData.platform || navigator.platform).toLowerCase();
var browser = {
name: firstBrand.brand,
version: firstBrand.version,
majorVersion: -1,
webkit: false,
webkitVersion: "-1",
chromium: false,
chromiumVersion: "-1",
webview: !!findPresetBrand(WEBVIEW_PRESETS, brands).brand || isWebView(getUserAgentString())
};
var os = {
name: "unknown",
version: "-1",
majorVersion: -1
};
browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function(preset) {
return findBrand(brands, preset);
});
var chromiumBrand = findPresetBrand(CHROMIUM_PRESETS, brands);
browser.chromium = !!chromiumBrand.brand;
browser.chromiumVersion = chromiumBrand.version || "-1";
if (!browser.chromium) {
var webkitBrand = findPresetBrand(WEBKIT_PRESETS, brands);
browser.webkit = !!webkitBrand.brand;
browser.webkitVersion = webkitBrand.version || "-1";
}
var platfomResult = find(OS_PRESETS, function(preset) {
return new RegExp("" + preset.test, "g").exec(platform);
});
os.name = platfomResult ? platfomResult.id : "";
{
var browserBrand = findPresetBrand(BROWSER_PRESETS, brands);
browser.name = browserBrand.brand || browser.name;
browser.version = browserBrand.brand && osData ? osData.uaFullVersion : browserBrand.version;
}
if (browser.webkit) {
os.name = isMobile ? "ios" : "mac";
}
if (os.name === "ios" && browser.webview) {
browser.version = "-1";
}
os.version = convertVersion(os.version);
browser.version = convertVersion(browser.version);
os.majorVersion = parseInt(os.version, 10);
browser.majorVersion = parseInt(browser.version, 10);
return {
browser,
os,
isMobile,
isHints: true
};
}
function agent(userAgent) {
if (hasUserAgentData()) {
return getClientHintsAgent();
} else {
return getLegacyAgent(userAgent);
}
}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function() {
if (o && i >= o.length) o = void 0;
return {
value: o && o[i++],
done: !o
};
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
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
};
} 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 isUndefined = function(value) {
return typeof value === "undefined";
};
var ComponentEvent = /* @__PURE__ */ (function() {
function ComponentEvent2(eventType, props) {
var e_1, _a;
this._canceled = false;
if (props) {
try {
for (var _b = __values(Object.keys(props)), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
this[key] = props[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;
}
}
}
this.eventType = eventType;
}
var __proto = ComponentEvent2.prototype;
__proto.stop = function() {
this._canceled = true;
};
__proto.isCanceled = function() {
return this._canceled;
};
return ComponentEvent2;
})();
var Component = /* @__PURE__ */ (function() {
function Component2() {
this._eventHandler = {};
}
var __proto = Component2.prototype;
__proto.trigger = function(event) {
var params = [];
for (var _i = 1; _i < arguments.length; _i++) {
params[_i - 1] = arguments[_i];
}
var eventName = event instanceof ComponentEvent ? event.eventType : event;
var handlers = __spread(this._eventHandler[eventName] || []);
if (handlers.length <= 0) {
return this;
}
if (event instanceof ComponentEvent) {
event.currentTarget = this;
handlers.forEach(function(handler) {
handler(event);
});
} else {
handlers.forEach(function(handler) {
handler.apply(void 0, __spread(params));
});
}
return this;
};
__proto.once = function(eventName, handlerToAttach) {
var _this = this;
if (typeof eventName === "object" && isUndefined(handlerToAttach)) {
var eventHash = eventName;
for (var key in eventHash) {
this.once(key, eventHash[key]);
}
return this;
} else if (typeof eventName === "string" && typeof handlerToAttach === "function") {
var listener_1 = function() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
handlerToAttach.apply(void 0, __spread(args));
_this.off(eventName, listener_1);
};
this.on(eventName, listener_1);
}
return this;
};
__proto.hasOn = function(eventName) {
return !!this._eventHandler[eventName];
};
__proto.on = function(eventName, handlerToAttach) {
if (typeof eventName === "object" && isUndefined(handlerToAttach)) {
var eventHash = eventName;
for (var name in eventHash) {
this.on(name, eventHash[name]);
}
return this;
} else if (typeof eventName === "string" && typeof handlerToAttach === "function") {
var handlerList = this._eventHandler[eventName];
if (isUndefined(handlerList)) {
this._eventHandler[eventName] = [];
handlerList = this._eventHandler[eventName];
}
handlerList.push(handlerToAttach);
}
return this;
};
__proto.off = function(eventName, handlerToDetach) {
if (isUndefined(eventName)) {
this._eventHandler = {};
return this;
}
if (isUndefined(handlerToDetach)) {
if (typeof eventName === "string") {
delete this._eventHandler[eventName];
return this;
} else {
var eventHash = eventName;
for (var name in eventHash) {
this.off(name, eventHash[name]);
}
return this;
}
}
var handlerList = this._eventHandler[eventName];
if (handlerList) {
var length = handlerList.length;
for (var i = 0; i < length; ++i) {
if (handlerList[i] === handlerToDetach) {
handlerList.splice(i, 1);
if (length <= 1) {
delete this._eventHandler[eventName];
}
break;
}
}
}
return this;
};
Component2.VERSION = "3.0.5";
return Component2;
})();
var ComponentEvent$1 = ComponentEvent;
function keys(obj) {
return Object.keys(obj);
}
var OBSERVERS_PATH = "__observers__";
var COMPUTED_PATH = "__computed__";
var CFCS_DETECTED_DEPENDENCIES_VERSION = 1;
var CFCS_DETECTED_DEPENDENCIES = "__CFCS_DETECTED_DEPENDENCIES__";
var extendStatics$1 = function(d, b) {
extendStatics$1 = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d2, b2) {
d2.__proto__ = b2;
} || function(d2, b2) {
for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
};
return extendStatics$1(d, b);
};
function __extends$1(d, b) {
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics$1(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function getDetectedStack() {
Object[CFCS_DETECTED_DEPENDENCIES] = Object[CFCS_DETECTED_DEPENDENCIES] || {};
var versionList = Object[CFCS_DETECTED_DEPENDENCIES];
versionList[CFCS_DETECTED_DEPENDENCIES_VERSION] = versionList[CFCS_DETECTED_DEPENDENCIES_VERSION] || [];
return versionList[CFCS_DETECTED_DEPENDENCIES_VERSION];
}
function getCurrentDetected() {
var stack = getDetectedStack();
return stack[stack.length - 1];
}
function detectDependencies(host) {
var stack = getDetectedStack();
var observers = [];
var detected = {
host,
observers,
push: function(observer) {
if (host !== observer && observers.indexOf(observer) === -1) {
observers.push(observer);
}
}
};
stack.push(detected);
return detected;
}
function endDetectDependencies() {
var stack = getDetectedStack();
return stack.pop();
}
var Observer = /* @__PURE__ */ (function() {
function Observer2(value) {
this._emitter = new Component();
this._current = value;
}
var __proto = Observer2.prototype;
Object.defineProperty(__proto, "current", {
/**
* return the current value.
*/
get: function() {
var currentDetected = getCurrentDetected();
currentDetected === null || currentDetected === void 0 ? void 0 : currentDetected.push(this);
return this._current;
},
set: function(value) {
this._setCurrent(value);
},
enumerable: false,
configurable: true
});
__proto.subscribe = function(callback) {
this.current;
this._emitter.on("update", callback);
return this;
};
__proto.unsubscribe = function(callback) {
this._emitter.off("update", callback);
return this;
};
__proto._setCurrent = function(value) {
var prevValue = this._current;
var isUpdate = value !== prevValue;
this._current = value;
if (isUpdate) {
this._emitter.trigger("update", value, prevValue);
}
};
__proto.toString = function() {
return "".concat(this.current);
};
__proto.valueOf = function() {
return this.current;
};
return Observer2;
})();
var ComputedObserver = /* @__PURE__ */ (function(_super) {
__extends$1(ComputedObserver2, _super);
function ComputedObserver2(_computedCallback) {
var _this = _super.call(this) || this;
_this._computedCallback = _computedCallback;
_this._registered = [];
_this._onCheckUpdate = function() {
_this._setCurrent(_this.current);
};
_this._current = _this.current;
return _this;
}
var __proto = ComputedObserver2.prototype;
Object.defineProperty(__proto, "current", {
get: function() {
var _this = this;
detectDependencies(this);
var value = this._computedCallback();
var results = endDetectDependencies();
this._registered.forEach(function(observer) {
observer.unsubscribe(_this._onCheckUpdate);
});
results.observers.forEach(function(observer) {
observer.subscribe(_this._onCheckUpdate);
});
this._registered = results.observers;
return value;
},
enumerable: false,
configurable: true
});
return ComputedObserver2;
})(Observer);
function injectObserve(prototype, memberName, publicName) {
if (publicName === void 0) {
publicName = memberName;
}
var nextAttributes = {
configurable: true,
get: function() {
return getObserver(this, publicName).current;
},
set: function(value) {
getObserver(this, publicName, value).current = value;
}
};
Object.defineProperty(prototype, memberName, nextAttributes);
if (publicName !== memberName) {
Object.defineProperty(prototype, publicName, {
configurable: true,
get: function() {
return getObserver(this, publicName).current;
}
});
}
}
function Observe() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (args.length > 1) {
return injectObserve(args[0], args[1]);
}
return function(prototype, memberName) {
return injectObserve(prototype, memberName, args[0]);
};
}
function Reactive() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return Observe.apply(void 0, args);
}
function injectReactiveSubscribe(object) {
object["subscribe"] = function(name, callback) {
this[name];
getObserver(this, name).subscribe(callback);
};
object["unsubscribe"] = function(name, callback) {
var _this = this;
if (!name) {
keys(getObservers(this)).forEach(function(observerName) {
_this.unsubscribe(observerName);
});
return;
}
if (!(name in this)) {
return;
}
getObserver(this, name).unsubscribe(callback);
};
}
function ReactiveSubscribe(Constructor) {
var prototype = Constructor.prototype;
injectReactiveSubscribe(prototype);
}
function observe(defaultValue) {
return new Observer(defaultValue);
}
function computed(computedCallback) {
return new ComputedObserver(computedCallback);
}
function defineObservers(instance) {
var observers = {};
Object.defineProperty(instance, OBSERVERS_PATH, {
get: function() {
return observers;
}
});
return observers;
}
function getObservers(instance, isComputed) {
var _a, _b;
if (!instance[OBSERVERS_PATH]) {
defineObservers(instance);
}
var observers = instance[OBSERVERS_PATH];
if (!isComputed) {
var computedList = (_b = (_a = instance === null || instance === void 0 ? void 0 : instance.constructor) === null || _a === void 0 ? void 0 : _a.prototype) === null || _b === void 0 ? void 0 : _b[COMPUTED_PATH];
if (computedList) {
computedList.forEach(function(name) {
if (!(name in observers) && name in instance) {
instance[name];
}
});
}
}
return observers;
}
function getObserver(instance, name, defaultValue) {
var observers = getObservers(instance);
if (!observers[name]) {
observers[name] = observe(defaultValue);
}
return observers[name];
}
function Computed(prototype, memberName, attributes) {
var get = attributes.get;
function getComputed() {
var observers = getObservers(this, true);
if (!(memberName in observers)) {
observers[memberName] = computed(get.bind(this));
}
return getObserver(this, memberName).current;
}
var nextAttributes = {
configurable: true,
get: getComputed
};
prototype[COMPUTED_PATH] || (prototype[COMPUTED_PATH] = []);
var computedList = prototype[COMPUTED_PATH];
if (computedList.indexOf(memberName) === -1) {
computedList.push(memberName);
}
Object.defineProperty(prototype, memberName, nextAttributes);
return nextAttributes;
}
/*! *****************************************************************************
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.
***************************************************************************** */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d2, b2) {
d2.__proto__ = b2;
} || function(d2, b2) {
for (var p in b2) if (b2.hasOwnProperty(p)) d2[p] = b2[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 __assign2(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 __decorate(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 win;
if (typeof window === "undefined") {
win = {
navigator: {
userAgent: ""
}
};
} else {
win = window;
}
var DIRECTION_NONE = 1;
var DIRECTION_LEFT = 2;
var DIRECTION_RIGHT = 4;
var DIRECTION_HORIZONTAL = 2 | 4;
var DIRECTION_UP = 8;
var DIRECTION_DOWN = 16;
var DIRECTION_VERTICAL = 8 | 16;
var DIRECTION_ALL = 2 | 4 | 8 | 16;
var MOUSE_LEFT = "left";
var MOUSE_RIGHT = "right";
var MOUSE_MIDDLE = "middle";
var MOUSE_BUTTON_CODE_MAP = {
1: MOUSE_LEFT,
2: MOUSE_MIDDLE,
3: MOUSE_RIGHT
};
var ANY = "any";
var NONE = "none";
var SHIFT = "shift";
var CTRL = "ctrl";
var ALT = "alt";
var META = "meta";
var VELOCITY_INTERVAL = 16;
var IOS_EDGE_THRESHOLD = 30;
var IS_IOS_SAFARI = "ontouchstart" in win && agent().browser.name === "safari";
var TRANSFORM = (function() {
if (typeof document === "undefined") {
return "";
}
var bodyStyle = (document.head || document.getElementsByTagName("head")[0]).style;
var target = ["transform", "webkitTransform", "msTransform", "mozTransform"];
for (var i = 0, len = target.length; i < len; i++) {
if (target[i] in bodyStyle) {
return target[i];
}
}
return "";
})();
var PREVENT_DRAG_CSSPROPS = {
"-webkit-user-select": "none",
"-ms-user-select": "none",
"-moz-user-select": "none",
"user-select": "none",
"-webkit-user-drag": "none"
};
var toArray = function(nodes) {
var el = [];
for (var i = 0, len = nodes.length; i < len; i++) {
el.push(nodes[i]);
}
return el;
};
var $ = function(param, multi) {
if (multi === void 0) {
multi = false;
}
var el;
if (typeof param === "string") {
var match = param.match(/^<([a-z]+)\s*([^>]*)>/);
if (match) {
var dummy = document.createElement("div");
dummy.innerHTML = param;
el = toArray(dummy.childNodes);
} else {
el = toArray(document.querySelectorAll(param));
}
if (!multi) {
el = el.length >= 1 ? el[0] : void 0;
}
} else if (param === win) {
el = param;
} else if ("value" in param || "current" in param) {
el = param.value || param.current;
} else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) {
el = param;
} else if ("jQuery" in win && param instanceof jQuery || param.constructor.prototype.jquery) {
el = multi ? param.toArray() : param.get(0);
} else if (Array.isArray(param)) {
el = param.map(function(v) {
return $(v);
});
if (!multi) {
el = el.length >= 1 ? el[0] : void 0;
}
}
return el;
};
var raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame;
var caf = win.cancelAnimationFrame || win.webkitCancelAnimationFrame;
if (raf && !caf) {
var keyInfo_1 = {};
var oldraf_1 = raf;
raf = function(callback) {
var wrapCallback = function(timestamp) {
if (keyInfo_1[key]) {
callback(timestamp);
}
};
var key = oldraf_1(wrapCallback);
keyInfo_1[key] = true;
return key;
};
caf = function(key) {
delete keyInfo_1[key];
};
} else if (!(raf && caf)) {
raf = function(callback) {
return win.setTimeout(function() {
callback(win.performance && win.performance.now && win.performance.now() || (/* @__PURE__ */ new Date()).getTime());
}, 16);
};
caf = win.clearTimeout;
}
var requestAnimationFrame = function(fp) {
return raf(fp);
};
var cancelAnimationFrame = function(key) {
caf(key);
};
var map = function(obj, callback) {
var tranformed = {};
for (var k in obj) {
if (k) {
tranformed[k] = callback(obj[k], k);
}
}
return tranformed;
};
var filter = function(obj, callback) {
var filtered = {};
for (var k in obj) {
if (k && callback(obj[k], k)) {
filtered[k] = obj[k];
}
}
return filtered;
};
var every = function(obj, callback) {
for (var k in obj) {
if (k && !callback(obj[k], k)) {
return false;
}
}
return true;
};
var equal = function(target, base) {
return every(target, function(v, k) {
return v === base[k];
});
};
var roundNumFunc = {};
var roundNumber = function(num, roundUnit) {
if (!roundNumFunc[roundUnit]) {
roundNumFunc[roundUnit] = getRoundFunc(roundUnit);
}
return roundNumFunc[roundUnit](num);
};
var roundNumbers = function(num, roundUnit) {
if (!num || !roundUnit) {
return num;
}
return map(num, function(value, key) {
return roundNumber(value, typeof roundUnit === "number" ? roundUnit : roundUnit[key]);
});
};
var getDecimalPlace = function(val) {
if (!isFinite(val)) {
return 0;
}
var v = "".concat(val);
if (v.indexOf("e") >= 0) {
var p = 0;
var e = 1;
while (Math.round(val * e) / e !== val) {
e *= 10;
p++;
}
return p;
}
return v.indexOf(".") >= 0 ? v.length - v.indexOf(".") - 1 : 0;
};
var inversePow = function(n) {
return 1 / Math.pow(10, n);
};
var getRoundFunc = function(v) {
var p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1;
return function(n) {
if (v === 0) {
return 0;
}
return Math.round(Math.round(n / v) * v * p) / p;
};
};
var getAngle = function(posX, posY) {
return Math.atan2(posY, posX) * 180 / Math.PI;
};
var isCssPropsFromAxes = function(originalCssProps) {
var same = true;
Object.keys(PREVENT_DRAG_CSSPROPS).forEach(function(prop) {
if (!originalCssProps || originalCssProps[prop] !== PREVENT_DRAG_CSSPROPS[prop]) {
same = false;
}
});
return same;
};
var getDirection = function(useHorizontal, useVertical) {
if (useHorizontal && useVertical) {
return DIRECTION_ALL;
} else if (useHorizontal) {
return DIRECTION_HORIZONTAL;
} else if (useVertical) {
return DIRECTION_VERTICAL;
} else {
return DIRECTION_NONE;
}
};
var useDirection = function(checkType, direction, userDirection) {
if (userDirection) {
return !!(direction === DIRECTION_ALL || direction & checkType && userDirection & checkType);
} else {
return !!(direction & checkType);
}
};
var setCssProps = function(element, option, direction) {
var _a;
var touchActionMap = (_a = {}, _a[DIRECTION_NONE] = "auto", _a[DIRECTION_ALL] = "none", _a[DIRECTION_VERTICAL] = "pan-x", _a[DIRECTION_HORIZONTAL] = "pan-y", _a);
var oldCssProps = {};
if (element && element.style) {
var touchAction = option.touchAction ? option.touchAction : touchActionMap[direction];
var newCssProps_1 = __assign(__assign({}, PREVENT_DRAG_CSSPROPS), {
"touch-action": element.style["touch-action"] === "none" ? "none" : touchAction
});
Object.keys(newCssProps_1).forEach(function(prop) {
oldCssProps[prop] = element.style[prop];
});
Object.keys(newCssProps_1).forEach(function(prop) {
element.style[prop] = newCssProps_1[prop];
});
}
return oldCssProps;
};
var revertCssProps = function(element, originalCssProps) {
if (element && element.style && originalCssProps) {
Object.keys(originalCssProps).forEach(function(prop) {
element.style[prop] = originalCssProps[prop];
});
}
return;
};
var EventManager = /* @__PURE__ */ (function() {
function EventManager2(_axes) {
this._axes = _axes;
this.holdingCount = 0;
}
var __proto = EventManager2.prototype;
__proto.hold = function(pos, option) {
var roundPos = this._getRoundPos(pos).roundPos;
this._axes.trigger(new ComponentEvent$1("hold", {
pos: roundPos,
input: option.input || null,
inputEvent: option.event || null,
isTrusted: true
}));
};
__proto.triggerRelease = function(param) {
var _a = this._getRoundPos(param.destPos, param.depaPos), roundPos = _a.roundPos, roundDepa = _a.roundDepa;
param.destPos = roundPos;
param.depaPos = roundDepa;
param.setTo = this._createUserControll(param.destPos, param.duration);
this._axes.trigger(new ComponentEvent$1("release", __assign(__assign({}, param), {
bounceRatio: this._getBounceRatio(roundPos)
})));
};
__proto.triggerChange = function(pos, depaPos, option, holding) {
var _this = this;
if (holding === void 0) {
holding = false;
}
var animationManager = this.animationManager;
var axisManager = animationManager.axisManager;
var eventInfo = animationManager.getEventInfo();
var _a = this._getRoundPos(pos, depaPos), roundPos = _a.roundPos, roundDepa = _a.roundDepa;
var moveTo = axisManager.moveTo(roundPos, roundDepa);
var inputEvent = (option === null || option === void 0 ? void 0 : option.event) || (eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.event) || null;
var param = {
pos: moveTo.pos,
delta: moveTo.delta,
bounceRatio: this._getBounceRatio(moveTo.pos),
holding,
inputEvent,
isTrusted: !!inputEvent,
input: (option === null || option === void 0 ? void 0 : option.input) || (eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.input) || null,
set: inputEvent ? this._createUserControll(moveTo.pos) : function() {
}
// eslint-disable-line @typescript-eslint/no-empty-function
};
var event = new ComponentEvent$1("change", param);
this._axes.trigger(event);
Object.keys(moveTo.pos).forEach(function(axis) {
var p = moveTo.pos[axis];
getObserver(_this._axes, axis, p).current = p;
});
if (inputEvent) {
axisManager.set(param.set().destPos);
}
return !event.isCanceled();
};
__proto.triggerAnimationStart = function(param) {
var _a = this._getRoundPos(param.destPos, param.depaPos), roundPos = _a.roundPos, roundDepa = _a.roundDepa;
param.destPos = roundPos;
param.depaPos = roundDepa;
param.setTo = this._createUserControll(param.destPos, param.duration);
var event = new ComponentEvent$1("animationStart", param);
this._axes.trigger(event);
return !event.isCanceled();
};
__proto.triggerAnimationEnd = function(isTrusted) {
if (isTrusted === void 0) {
isTrusted = false;
}
this._axes.trigger(new ComponentEvent$1("animationEnd", {
isTrusted
}));
};
__proto.triggerFinish = function(isTrusted) {
if (isTrusted === void 0) {
isTrusted = false;
}
this._axes.trigger(new ComponentEvent$1("finish", {
isTrusted
}));
};
__proto.setAnimationManager = function(animationManager) {
this.animationManager = animationManager;
};
__proto.destroy = function() {
this._axes.off();
};
__proto._createUserControll = function(pos, duration) {
if (duration === void 0) {
duration = 0;
}
var userControl = {
destPos: __assign({}, pos),
duration
};
return function(toPos, userDuration) {
if (toPos) {
userControl.destPos = __assign({}, toPos);
}
if (userDuration !== void 0) {
userControl.duration = userDuration;
}
return userControl;
};
};
__proto._getRoundPos = function(pos, depaPos) {
var roundUnit = this._axes.options.round;
return {
roundPos: roundNumbers(pos, roundUnit),
roundDepa: roundNumbers(depaPos, roundUnit)
};
};
__proto._getBounceRatio = function(pos) {
return this._axes.axisManager.map(pos, function(v, opt) {
if (v < opt.range[0] && opt.bounce[0] !== 0) {
return (opt.range[0] - v) / opt.bounce[0];
} else if (v > opt.range[1] && opt.bounce[1] !== 0) {
return (v - opt.range[1]) / opt.bounce[1];
} else {
return 0;
}
});
};
__decorate([Observe], EventManager2.prototype, "holdingCount", void 0);
return EventManager2;
})();
var InterruptManager = /* @__PURE__ */ (function() {
function InterruptManager2(_options) {
this._options = _options;
this._prevented = false;
}
var __proto = InterruptManager2.prototype;
__proto.isInterrupting = function() {
return this._options.interruptable || this._prevented;
};
__proto.isInterrupted = function() {
return !this._options.interruptable && this._prevented;
};
__proto.setInterrupt = function(prevented) {
if (!this._options.interruptable) {
this._prevented = prevented;
}
};
return InterruptManager2;
})();
var getInsidePosition = function(destPos, range, circular, bounce) {
var toDestPos = destPos;
var targetRange = [circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0], circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1]];
toDestPos = Math.max(targetRange[0], toDestPos);
toDestPos = Math.min(targetRange[1], toDestPos);
return toDestPos;
};
var isOutside = function(pos, range) {
return pos < range[0] || pos > range[1];
};
var isEndofBounce = function(pos, range, bounce, circular) {
return !circular[0] && pos === range[0] - bounce[0] || !circular[1] && pos === range[1] + bounce[1];
};
var getDuration = function(distance, deceleration) {
var duration = Math.sqrt(distance / deceleration * 2);
return duration < 100 ? 0 : duration;
};
var isCircularable = function(destPos, range, circular) {
return circular[1] && destPos > range[1] || circular[0] && destPos < range[0];
};
var getCirculatedPos = function(pos, range, circular) {
var toPos = pos;
var min = range[0];
var max = range[1];
var length = max - min;
if (circular[1] && pos > max) {
toPos = (toPos - max) % length + min;
}
if (circular[0] && pos < min) {
toPos = (toPos - min) % length + max;
}
return toPos;
};
var AxisManager = /* @__PURE__ */ (function() {
function AxisManager2(_axis) {
var _this = this;
this._axis = _axis;
this._complementOptions();
this._pos = Object.keys(this._axis).reduce(function(pos, v) {
pos[v] = _this._axis[v].startPos;
return pos;
}, {});
}
var __proto = AxisManager2.prototype;
__proto.getDelta = function(depaPos, destPos) {
var fullDepaPos = this.get(depaPos);
return map(this.get(destPos), function(v, k) {
return v - fullDepaPos[k];
});
};
__proto.get = function(axes) {
var _this = this;
if (axes && Array.isArray(axes)) {
return axes.reduce(function(acc, v) {
if (v && v in _this._pos) {
acc[v] = _this._pos[v];
}
return acc;
}, {});
} else {
return __assign(__assign({}, this._pos), axes || {});
}
};
__proto.moveTo = function(pos, depaPos) {
if (depaPos === void 0) {
depaPos = this._pos;
}
var delta = map(this._pos, function(v, key) {
return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0;
});
this.set(this.map(pos, function(v, opt) {
return opt ? getCirculatedPos(v, opt.range, opt.circular) : 0;
}));
return {
pos: __assign({}, this._pos),
delta
};
};
__proto.set = function(pos) {
for (var k in pos) {
if (k && k in this._pos) {
this._pos[k] = pos[k];
}
}
};
__proto.every = function(pos, callback) {
var axisOptions = this._axis;
return every(pos, function(value, key) {
return callback(value, axisOptions[key], key);
});
};
__proto.filter = function(pos, callback) {
var axisOptions = this._axis;
return filter(pos, function(value, key) {
return callback(value, axisOptions[key], key);
});
};
__proto.map = function(pos, callback) {
var axisOptions = this._axis;
return map(pos, function(value, key) {
return callback(value, axisOptions[key], key);
});
};
__proto.isOutside = function(axes) {
return !this.every(axes ? this.get(axes) : this._pos, function(v, opt) {
return !isOutside(v, opt.range);
});
};
__proto.getAxisOptions = function(key) {
return this._axis[key];
};
__proto.setAxis = function(axis) {
var _this = this;
Object.keys(axis).forEach(function(key) {
if (!_this._axis[key]) {
throw new Error("Axis ".concat(key, " does not exist in Axes instance"));
}
_this._axis[key] = __assign(__assign({}, _this._axis[key]), axis[key]);
});
this._complementOptions();
};
__proto._complementOptions = function() {
var _this = this;
Object.keys(this._axis).forEach(function(axis) {
_this._axis[axis] = __assign({
range: [0, 100],
startPos: _this._axis[axis].range[0],
bounce: [0, 0],
circular: [false, false]
}, _this._axis[axis]);
["bounce", "circular"].forEach(function(v) {
var axisOption = _this._axis;
var key = axisOption[axis][v];
if (/string|number|boolean/.test(typeof key)) {
axisOption[axis][v] = [key, key];
}
});
});
};
return AxisManager2;
})();
var SUPPORT_TOUCH = "ontouchstart" in win;
var SUPPORT_POINTER = "PointerEvent" in win;
var SUPPORT_MSPOINTER = "MSPointerEvent" in win;
var SUPPORT_POINTER_EVENTS = SUPPORT_POINTER || SUPPORT_MSPOINTER;
var isValidKey = function(event, inputKey) {
if (!inputKey || inputKey.indexOf(ANY) > -1 || inputKey.indexOf(NONE) > -1 && !event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey || inputKey.indexOf(SHIFT) > -1 && event.shiftKey || inputKey.indexOf(CTRL) > -1 && event.ctrlKey || inputKey.indexOf(ALT) > -1 && event.altKey || inputKey.indexOf(META) > -1 && event.metaKey) {
return true;
}
return false;
};
var EventInput = /* @__PURE__ */ (function() {
function EventInput2() {
var _this = this;
this._stopContextMenu = function(event) {
event.preventDefault();
win.removeEventListener("contextmenu", _this._stopContextMenu);
};
}
var __proto = EventInput2.prototype;
__proto.extendEvent = function(event) {
var _a;
var prevEvent = this.prevEvent;
var center = this._getCenter(event);
var movement = prevEvent ? this._getMovement(event) : {
x: 0,
y: 0
};
var scale = prevEvent ? this._getScale(event) : 1;
var angle = prevEvent ? getAngle(center.x - prevEvent.center.x, center.y - prevEvent.center.y) : 0;
var deltaX = prevEvent ? prevEvent.deltaX + movement.x : movement.x;
var deltaY = prevEvent ? prevEvent.deltaY + movement.y : movement.y;
var offsetX = movement.x;
var offsetY = movement.y;
var latestInterval = this._latestInterval;
var timeStamp = Date.now();
var deltaTime = latestInterval ? timeStamp - latestInterval.timestamp : 0;
var velocityX = prevEvent ? prevEvent.velocityX : 0;
var velocityY = prevEvent ? prevEvent.velocityY : 0;
var directionX = prevEvent ? prevEvent.directionX : 1;
var directionY = prevEvent ? prevEvent.directionY : 1;
if (offsetX > 0) {
directionX = 1;
} else if (offsetX < 0) {
directionX = -1;
}
if (offsetY > 0) {
directionY = 1;
} else if (offsetY < 0) {
directionY = -1;
}
if (!latestInterval || deltaTime >= VELOCITY_INTERVAL) {
if (latestInterval) {
_a = [(deltaX - latestInterval.deltaX) / deltaTime, (deltaY - latestInterval.deltaY) / deltaTime], velocityX = _a[0], velocityY = _a[1];
}
this._latestInterval = {
timestamp: timeStamp,
deltaX,
deltaY
};
}
return {
srcEvent: event,
scale,
angle,
center,
deltaX,
deltaY,
offsetX,
offsetY,
directionX,
directionY,
velocityX,
velocityY,
preventSystemEvent: true
};
};
__proto._getDistance = function(start, end) {
var x = end.clientX - start.clientX;
var y = end.clientY - start.clientY;
return Math.sqrt(x * x + y * y);
};
__proto._getButton = function(event) {
var buttonCodeMap = {
1: MOUSE_LEFT,
2: MOUSE_RIGHT,
4: MOUSE_MIDDLE
};
var button = this._isTouchEvent(event) ? MOUSE_LEFT : buttonCodeMap[event.buttons];
return button ? button : null;
};
__proto._isTouchEvent = function(event) {
return event.type && event.type.indexOf("touch") > -1;
};
__proto._isValidButton = function(button, inputButton) {
return inputButton.indexOf(button) > -1;
};
__proto._isValidEvent = function(event, inputKey, inputButton) {
return (!inputKey || isValidKey(event, inputKey)) && (!inputButton || this._isValidButton(this._getButton(event), inputButton));
};
__proto._preventMouseButton = function(event, button) {
if (button === MOUSE_RIGHT) {
win.addEventListener("contextmenu", this._stopContextMenu);
} else if (button === MOUSE_MIDDLE) {
event.preventDefault();
}
};
return EventInput2;
})();
var MouseEventInput = /* @__PURE__ */ (function(_super) {
__extends(MouseEventInput2, _super);
function MouseEventInput2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.start = ["mousedown"];
_this.move = ["mousemove"];
_this.end = ["mouseup"];
return _this;
}
var __proto = MouseEventInput2.prototype;
__proto.onEventStart = function(event, inputKey, inputButton) {
var button = this._getButton(event);
if (!this._isValidEvent(event, inputKey, inputButton)) {
return null;
}
this._preventMouseButton(event, button);
return this.extendEvent(event);
};
__proto.onEventMove = function(event, inputKey, inputButton) {
if (!this._isValidEvent(event, inputKey, inputButton)) {
return null;
}
return this.extendEvent(event);
};
__proto.onEventEnd = function() {
return;
};
__proto.onRelease = function() {
this.prevEvent = null;
return;
};
__proto.getTouches = function(event, inputButton) {
if (inputButton) {
return this._isValidButton(MOUSE_BUTTON_CODE_MAP[event.which], inputButton) && this.end.indexOf(event.type) === -1 ? 1 : 0;
}
return 0;
};
__proto._getScale = function() {
return 1;
};
__proto._getCenter = function(event) {
return {
x: event.clientX,
y: event.clientY
};
};
__proto._getMovement = function(event) {
var prev = this.prevEvent.srcEvent;
return {
x: event.clientX - prev.clientX,
y: event.clientY - prev.clientY
};
};
return MouseEventInput2;
})(EventInput);
var TouchEventInput = /* @__PURE__ */ (function(_super) {
__extends(TouchEventInput2, _super);
function TouchEventInput2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.start = ["touchstart"];
_this.move = ["touchmove"];
_this.end = ["touchend", "touchcancel"];
return _this;
}
var __proto = TouchEventInput2.prototype;
__proto.onEventStart = function(event, inputKey) {
this._baseTouches = event.touches;
if (!this._isValidEvent(event, inputKey)) {
return null;
}
return this.extendEvent(event);
};
__proto.onEventMove = function(event, inputKey) {
if (!this._isValidEvent(event, inputKey)) {
return null;
}
return this.extendEvent(event);
};
__proto.onEventEnd = function(event) {
this._baseTouches = event.touches;
return;
};
__proto.onRelease = function() {
this.prevEvent = null;
this._baseTouches = null;
return;
};
__proto.getTouches = function(event) {
return event.touches.length;
};
__proto._getScale = function(event) {
if (event.touches.length !== 2 || this._baseTouches.length < 2) {
return null;
}
return this._getDistance(event.touches[0], event.touches[1]) / this._getDistance(this._baseTouches[0], this._baseTouches[1]);
};
__proto._getCenter = function(event) {
return {
x: event.touches[0].clientX,
y: event.touches[0].clientY
};
};
__proto._getMovement = function(event) {
var prev = this.prevEvent.srcEvent;
if (event.touches[0].identifier !== prev.touches[0].identifier) {
return {
x: 0,
y: 0
};
}
return {
x: event.touches[0].clientX - prev.touches[0].clientX,
y: event.touches[0].clientY - prev.touches[0].clientY
};
};
return TouchEventInput2;
})(EventInput);
var PointerEventInput = /* @__PURE__ */ (function(_super) {
__extends(PointerEventInput2, _super);
function PointerEventInput2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.start = SUPPORT_POINTER ? ["pointerdown"] : ["MSPointerDown"];
_this.move = SUPPORT_POINTER ? ["pointermove"] : ["MSPointerMove"];
_this.end = SUPPORT_POINTER ? ["pointerup", "pointercancel"] : ["MSPointerUp", "MSPointerCancel"];
_this._firstInputs = [];
_this._recentInputs = [];
return _this;
}
var __proto = PointerEventInput2.prototype;
__proto.onEventStart = function(event, inputKey, inputButton) {
var button = this._getButton(event);
if (!this._isValidEvent(event, inputKey, inputButton)) {
return null;
}
this._preventMouseButton(event, button);
this._updatePointerEvent(event);
return this.extendEvent(event);
};
__proto.onEventMove = function(event, inputKey, inputButton) {
if (!this._isValidEvent(event, inputKey, inputButton)) {
return null;
}
this._updatePointerEvent(event);
return this.extendEvent(event);
};
__proto.onEventEnd = function(event) {
this._removePointerEvent(event);
};
__proto.onRelease = function() {
this.prevEvent = null;
this._firstInputs = [];
this._recentInputs = [];
return;
};
__proto.getTouches = function() {
return this._recentInputs.length;
};
__proto._getScale = function() {
if (this._recentInputs.length !== 2) {
return null;
}
return this._getDistance(this._recentInputs[0], this._recentInputs[1]) / this._getDistance(this._firstInputs[0], this._firstInputs[1]);
};
__proto._getCenter = function(event) {
return {
x: event.clientX,
y: event.clientY
};
};
__proto._getMovement = function(event) {
var prev = this.prevEvent.srcEvent;
if (event.pointerId !== prev.pointerId) {
return {
x: 0,
y: 0
};
}
return {
x: event.clientX - prev.clientX,
y: event.clientY - prev.clientY
};
};
__proto._updatePointerEvent = function(event) {
var _this = this;
var addFlag = false;
this._recentInputs.forEach(function(e, i) {
if (e.pointerId === event.pointerId) {
addFlag = true;
_this._recentInputs[i] = event;
}
});
if (!addFlag) {
this._firstInputs.push(event);
this._recentInputs.push(event);
}
};
__proto._removePointerEvent = function(event) {