import { require_react } from "./chunk-QJTFJ6OV.js"; import { __commonJS, __esm, __export, __toCommonJS, __toESM } from "./chunk-V4OQ3NZ2.js"; // node_modules/tslib/tslib.es6.mjs var tslib_es6_exports = {}; __export(tslib_es6_exports, { __addDisposableResource: () => __addDisposableResource, __assign: () => __assign, __asyncDelegator: () => __asyncDelegator, __asyncGenerator: () => __asyncGenerator, __asyncValues: () => __asyncValues, __await: () => __await, __awaiter: () => __awaiter, __classPrivateFieldGet: () => __classPrivateFieldGet, __classPrivateFieldIn: () => __classPrivateFieldIn, __classPrivateFieldSet: () => __classPrivateFieldSet, __createBinding: () => __createBinding, __decorate: () => __decorate, __disposeResources: () => __disposeResources, __esDecorate: () => __esDecorate, __exportStar: () => __exportStar, __extends: () => __extends, __generator: () => __generator, __importDefault: () => __importDefault, __importStar: () => __importStar, __makeTemplateObject: () => __makeTemplateObject, __metadata: () => __metadata, __param: () => __param, __propKey: () => __propKey, __read: () => __read, __rest: () => __rest, __runInitializers: () => __runInitializers, __setFunctionName: () => __setFunctionName, __spread: () => __spread, __spreadArray: () => __spreadArray, __spreadArrays: () => __spreadArrays, __values: () => __values, default: () => tslib_es6_default }); function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } function __rest(s, e2) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e2.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e2.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } 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; } function __param(paramIndex, decorator) { return function(target, key) { decorator(target, key, paramIndex); }; } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function(f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result2 = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result2 === void 0) continue; if (result2 === null || typeof result2 !== "object") throw new TypeError("Object expected"); if (_ = accept(result2.get)) descriptor.get = _; if (_ = accept(result2.set)) descriptor.set = _; if (_ = accept(result2.init)) initializers.unshift(_); } else if (_ = accept(result2)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; } function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; } function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); } function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(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, reject2) { function fulfilled(value) { try { step(generator.next(value)); } catch (e2) { reject2(e2); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e2) { reject2(e2); } } function step(result2) { result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(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 (g && (g = 0, op[0] && (_ = 0)), _) 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 (e2) { op = [6, e2]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } 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 = [], e2; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e2 = { error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e2) throw e2.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { 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; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() { return this; }, i; function awaitReturn(f) { return function(v) { return Promise.resolve(v).then(f, reject2); }; } function verb(n, f) { if (g[n]) { i[n] = function(v) { return new Promise(function(a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } function resume(n, v) { try { step(g[n](v)); } catch (e2) { settle(q[0][3], e2); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject2) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject2(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function(e2) { throw e2; }), verb("return"), i[Symbol.iterator] = function() { return this; }, i; function verb(n, f) { i[n] = o[n] ? function(v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { return this; }, i); function verb(n) { i[n] = o[n] && function(v) { return new Promise(function(resolve, reject2) { v = o[n](v), settle(resolve, reject2, v.done, v.value); }); }; } function settle(resolve, reject2, d, v) { Promise.resolve(v).then(function(v2) { resolve({ value: v2, done: d }); }, reject2); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; } function __importStar(mod) { if (mod && mod.__esModule) return mod; var result2 = {}; if (mod != null) { for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result2, mod, k); } __setModuleDefault(result2, mod); return result2; } function __importDefault(mod) { return mod && mod.__esModule ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e2) { return Promise.reject(e2); } }; env.stack.push({ value, dispose, async }); } else if (async) { env.stack.push({ async: true }); } return value; } function __disposeResources(env) { function fail(e2) { env.error = env.hasError ? new _SuppressedError(e2, env.error, "An error was suppressed during disposal.") : e2; env.hasError = true; } function next() { while (env.stack.length) { var rec = env.stack.pop(); try { var result2 = rec.dispose && rec.dispose.call(rec.value); if (rec.async) return Promise.resolve(result2).then(next, function(e2) { fail(e2); return next(); }); } catch (e2) { fail(e2); } } if (env.hasError) throw env.error; } return next(); } var extendStatics, __assign, __createBinding, __setModuleDefault, _SuppressedError, tslib_es6_default; var init_tslib_es6 = __esm({ "node_modules/tslib/tslib.es6.mjs"() { 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 (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; }; return extendStatics(d, b); }; __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); }; __createBinding = Object.create ? function(o, m, k, k2) { if (k2 === void 0) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); } : function(o, m, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m[k]; }; __setModuleDefault = Object.create ? function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); } : function(o, v) { o["default"] = v; }; _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { var e2 = new Error(message); return e2.name = "SuppressedError", e2.error = error, e2.suppressed = suppressed, e2; }; tslib_es6_default = { __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources }; } }); // node_modules/fast-deep-equal/react.js var require_react2 = __commonJS({ "node_modules/fast-deep-equal/react.js"(exports2, module2) { "use strict"; module2.exports = function equal(a, b) { if (a === b) return true; if (a && b && typeof a == "object" && typeof b == "object") { if (a.constructor !== b.constructor) return false; var length, i, keys2; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0; ) if (!equal(a[i], b[i])) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); keys2 = Object.keys(a); length = keys2.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(b, keys2[i])) return false; for (i = length; i-- !== 0; ) { var key = keys2[i]; if (key === "_owner" && a.$$typeof) { continue; } if (!equal(a[key], b[key])) return false; } return true; } return a !== a && b !== b; }; } }); // node_modules/js-cookie/src/js.cookie.js var require_js_cookie = __commonJS({ "node_modules/js-cookie/src/js.cookie.js"(exports2, module2) { (function(factory) { var registeredInModuleLoader; if (typeof define === "function" && define.amd) { define(factory); registeredInModuleLoader = true; } if (typeof exports2 === "object") { module2.exports = factory(); registeredInModuleLoader = true; } if (!registeredInModuleLoader) { var OldCookies = window.Cookies; var api = window.Cookies = factory(); api.noConflict = function() { window.Cookies = OldCookies; return api; }; } })(function() { function extend() { var i = 0; var result2 = {}; for (; i < arguments.length; i++) { var attributes = arguments[i]; for (var key in attributes) { result2[key] = attributes[key]; } } return result2; } function decode(s) { return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); } function init(converter) { function api() { } function set2(key, value, attributes) { if (typeof document === "undefined") { return; } attributes = extend({ path: "/" }, api.defaults, attributes); if (typeof attributes.expires === "number") { attributes.expires = new Date(/* @__PURE__ */ new Date() * 1 + attributes.expires * 864e5); } attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ""; try { var result2 = JSON.stringify(value); if (/^[\{\[]/.test(result2)) { value = result2; } } catch (e2) { } value = converter.write ? converter.write(value, key) : encodeURIComponent(String(value)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); key = encodeURIComponent(String(key)).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/[\(\)]/g, escape); var stringifiedAttributes = ""; for (var attributeName in attributes) { if (!attributes[attributeName]) { continue; } stringifiedAttributes += "; " + attributeName; if (attributes[attributeName] === true) { continue; } stringifiedAttributes += "=" + attributes[attributeName].split(";")[0]; } return document.cookie = key + "=" + value + stringifiedAttributes; } function get2(key, json) { if (typeof document === "undefined") { return; } var jar = {}; var cookies = document.cookie ? document.cookie.split("; ") : []; var i = 0; for (; i < cookies.length; i++) { var parts = cookies[i].split("="); var cookie = parts.slice(1).join("="); if (!json && cookie.charAt(0) === '"') { cookie = cookie.slice(1, -1); } try { var name = decode(parts[0]); cookie = (converter.read || converter)(cookie, name) || decode(cookie); if (json) { try { cookie = JSON.parse(cookie); } catch (e2) { } } jar[name] = cookie; if (key === name) { break; } } catch (e2) { } } return key ? jar[key] : jar; } api.set = set2; api.get = function(key) { return get2( key, false /* read as raw */ ); }; api.getJSON = function(key) { return get2( key, true /* read as json */ ); }; api.remove = function(key, attributes) { set2(key, "", extend(attributes, { expires: -1 })); }; api.defaults = {}; api.withConverter = init; return api; } return init(function() { }); }); } }); // node_modules/toggle-selection/index.js var require_toggle_selection = __commonJS({ "node_modules/toggle-selection/index.js"(exports2, module2) { module2.exports = function() { var selection = document.getSelection(); if (!selection.rangeCount) { return function() { }; } var active = document.activeElement; var ranges = []; for (var i = 0; i < selection.rangeCount; i++) { ranges.push(selection.getRangeAt(i)); } switch (active.tagName.toUpperCase()) { case "INPUT": case "TEXTAREA": active.blur(); break; default: active = null; break; } selection.removeAllRanges(); return function() { selection.type === "Caret" && selection.removeAllRanges(); if (!selection.rangeCount) { ranges.forEach(function(range2) { selection.addRange(range2); }); } active && active.focus(); }; }; } }); // node_modules/copy-to-clipboard/index.js var require_copy_to_clipboard = __commonJS({ "node_modules/copy-to-clipboard/index.js"(exports2, module2) { "use strict"; var deselectCurrent = require_toggle_selection(); var clipboardToIE11Formatting = { "text/plain": "Text", "text/html": "Url", "default": "Text" }; var defaultMessage = "Copy to clipboard: #{key}, Enter"; function format(message) { var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C"; return message.replace(/#{\s*key\s*}/g, copyKey); } function copy(text, options) { var debug, message, reselectPrevious, range2, selection, mark, success = false; if (!options) { options = {}; } debug = options.debug || false; try { reselectPrevious = deselectCurrent(); range2 = document.createRange(); selection = document.getSelection(); mark = document.createElement("span"); mark.textContent = text; mark.ariaHidden = "true"; mark.style.all = "unset"; mark.style.position = "fixed"; mark.style.top = 0; mark.style.clip = "rect(0, 0, 0, 0)"; mark.style.whiteSpace = "pre"; mark.style.webkitUserSelect = "text"; mark.style.MozUserSelect = "text"; mark.style.msUserSelect = "text"; mark.style.userSelect = "text"; mark.addEventListener("copy", function(e2) { e2.stopPropagation(); if (options.format) { e2.preventDefault(); if (typeof e2.clipboardData === "undefined") { debug && console.warn("unable to use e.clipboardData"); debug && console.warn("trying IE specific stuff"); window.clipboardData.clearData(); var format2 = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting["default"]; window.clipboardData.setData(format2, text); } else { e2.clipboardData.clearData(); e2.clipboardData.setData(options.format, text); } } if (options.onCopy) { e2.preventDefault(); options.onCopy(e2.clipboardData); } }); document.body.appendChild(mark); range2.selectNodeContents(mark); selection.addRange(range2); var successful = document.execCommand("copy"); if (!successful) { throw new Error("copy command was unsuccessful"); } success = true; } catch (err) { debug && console.error("unable to copy using execCommand: ", err); debug && console.warn("trying IE specific stuff"); try { window.clipboardData.setData(options.format || "text", text); options.onCopy && options.onCopy(window.clipboardData); success = true; } catch (err2) { debug && console.error("unable to copy using clipboardData: ", err2); debug && console.error("falling back to prompt"); message = format("message" in options ? options.message : defaultMessage); window.prompt(message, text); } } finally { if (selection) { if (typeof selection.removeRange == "function") { selection.removeRange(range2); } else { selection.removeAllRanges(); } } if (mark) { document.body.removeChild(mark); } reselectPrevious(); } return success; } module2.exports = copy; } }); // node_modules/nano-css/index.js var require_nano_css = __commonJS({ "node_modules/nano-css/index.js"(exports2) { "use strict"; var KEBAB_REGEX = /[A-Z]/g; var hash = function(str) { var h = 5381, i = str.length; while (i) h = h * 33 ^ str.charCodeAt(--i); return "_" + (h >>> 0).toString(36); }; exports2.create = function(config) { config = config || {}; var assign2 = config.assign || Object.assign; var client = typeof window === "object"; if (true) { if (client) { if (typeof document !== "object" || !document.getElementsByTagName("HTML")) { console.error( 'nano-css detected browser environment because of "window" global, but "document" global seems to be defective.' ); } } } var renderer = assign2({ raw: "", pfx: "_", client, assign: assign2, stringify: JSON.stringify, kebab: function(prop) { return prop.replace(KEBAB_REGEX, "-$&").toLowerCase(); }, decl: function(key, value) { key = renderer.kebab(key); return key + ":" + value + ";"; }, hash: function(obj) { return hash(renderer.stringify(obj)); }, selector: function(parent2, selector) { return parent2 + (selector[0] === ":" ? "" : " ") + selector; }, putRaw: function(rawCssRule) { renderer.raw += rawCssRule; } }, config); if (renderer.client) { if (!renderer.sh) document.head.appendChild(renderer.sh = document.createElement("style")); if (true) { renderer.sh.setAttribute("data-nano-css-dev", ""); renderer.shTest = document.createElement("style"); renderer.shTest.setAttribute("data-nano-css-dev-tests", ""); document.head.appendChild(renderer.shTest); } renderer.putRaw = function(rawCssRule) { if (false) { var sheet = renderer.sh.sheet; try { sheet.insertRule(rawCssRule, sheet.cssRules.length); } catch (error) { } } else { try { renderer.shTest.sheet.insertRule(rawCssRule, renderer.shTest.sheet.cssRules.length); } catch (error) { if (config.verbose) { console.error(error); } } renderer.sh.appendChild(document.createTextNode(rawCssRule)); } }; } renderer.put = function(selector, decls, atrule) { var str = ""; var prop, value; var postponed = []; for (prop in decls) { value = decls[prop]; if (value instanceof Object && !(value instanceof Array)) { postponed.push(prop); } else { if (!renderer.sourcemaps) { str += " " + renderer.decl(prop, value, selector, atrule) + "\n"; } else { str += renderer.decl(prop, value, selector, atrule); } } } if (str) { if (!renderer.sourcemaps) { str = "\n" + selector + " {\n" + str + "}\n"; } else { str = selector + "{" + str + "}"; } renderer.putRaw(atrule ? atrule + "{" + str + "}" : str); } for (var i = 0; i < postponed.length; i++) { prop = postponed[i]; if (prop[0] === "@" && prop !== "@font-face") { renderer.putAt(selector, decls[prop], prop); } else { renderer.put(renderer.selector(selector, prop), decls[prop], atrule); } } }; renderer.putAt = renderer.put; return renderer; }; } }); // node_modules/nano-css/addon/__dev__/warnOnMissingDependencies.js var require_warnOnMissingDependencies = __commonJS({ "node_modules/nano-css/addon/__dev__/warnOnMissingDependencies.js"(exports2, module2) { "use strict"; var pkgName = "nano-css"; module2.exports = function warnOnMissingDependencies(addon, renderer, deps) { var missing = []; for (var i = 0; i < deps.length; i++) { var name = deps[i]; if (!renderer[name]) { missing.push(name); } } if (missing.length) { var str = 'Addon "' + addon + '" is missing the following dependencies:'; for (var j = 0; j < missing.length; j++) { str += '\n require("' + pkgName + "/addon/" + missing[j] + '").addon(nano);'; } throw new Error(str); } }; } }); // node_modules/nano-css/addon/cssom.js var require_cssom = __commonJS({ "node_modules/nano-css/addon/cssom.js"(exports2) { "use strict"; exports2.addon = function(renderer) { if (!renderer.client) return; if (true) { require_warnOnMissingDependencies()("cssom", renderer, ["sh"]); } document.head.appendChild(renderer.msh = document.createElement("style")); renderer.createRule = function(selector, prelude) { var rawCss = selector + "{}"; if (prelude) rawCss = prelude + "{" + rawCss + "}"; var sheet = prelude ? renderer.msh.sheet : renderer.sh.sheet; var index = sheet.insertRule(rawCss, sheet.cssRules.length); var rule = (sheet.cssRules || sheet.rules)[index]; rule.index = index; if (prelude) { var selectorRule = (rule.cssRules || rule.rules)[0]; rule.style = selectorRule.style; rule.styleMap = selectorRule.styleMap; } return rule; }; }; } }); // node_modules/nano-css/addon/vcssom/removeRule.js var require_removeRule = __commonJS({ "node_modules/nano-css/addon/vcssom/removeRule.js"(exports2) { function removeRule(rule) { var maxIndex = rule.index; var sh = rule.parentStyleSheet; var rules = sh.cssRules || sh.rules; maxIndex = Math.max(maxIndex, rules.length - 1); while (maxIndex >= 0) { if (rules[maxIndex] === rule) { sh.deleteRule(maxIndex); break; } maxIndex--; } } exports2.removeRule = removeRule; } }); // node_modules/nano-css/addon/vcssom.js var require_vcssom = __commonJS({ "node_modules/nano-css/addon/vcssom.js"(exports2) { "use strict"; var removeRule = require_removeRule().removeRule; exports2.addon = function(renderer) { if (!renderer.client) return; if (true) { require_warnOnMissingDependencies()("cssom", renderer, ["createRule"]); } var kebab = renderer.kebab; function VRule(selector, prelude) { this.rule = renderer.createRule(selector, prelude); this.decl = {}; } VRule.prototype.diff = function(newDecl) { var oldDecl = this.decl; var style = this.rule.style; var property2; for (property2 in oldDecl) if (newDecl[property2] === void 0) style.removeProperty(property2); for (property2 in newDecl) if (newDecl[property2] !== oldDecl[property2]) style.setProperty(kebab(property2), newDecl[property2]); this.decl = newDecl; }; VRule.prototype.del = function() { removeRule(this.rule); }; function VSheet() { this.tree = {}; } VSheet.prototype.diff = function(newTree) { var oldTree = this.tree; for (var prelude in oldTree) { if (newTree[prelude] === void 0) { var rules = oldTree[prelude]; for (var selector in rules) rules[selector].del(); } } for (var prelude in newTree) { if (oldTree[prelude] === void 0) { for (var selector in newTree[prelude]) { var rule = new VRule(selector, prelude); rule.diff(newTree[prelude][selector]); newTree[prelude][selector] = rule; } } else { var oldRules = oldTree[prelude]; var newRules = newTree[prelude]; for (var selector in oldRules) if (!newRules[selector]) oldRules[selector].del(); for (var selector in newRules) { var rule = oldRules[selector]; if (rule) { rule.diff(newRules[selector]); newRules[selector] = rule; } else { rule = new VRule(selector, prelude); rule.diff(newRules[selector]); newRules[selector] = rule; } } } } this.tree = newTree; }; renderer.VRule = VRule; renderer.VSheet = VSheet; }; } }); // node_modules/nano-css/addon/vcssom/cssToTree.js var require_cssToTree = __commonJS({ "node_modules/nano-css/addon/vcssom/cssToTree.js"(exports2) { function cssToTree2(tree, css, selector, prelude) { var declarations = {}; var hasDeclarations = false; var key, value; for (key in css) { value = css[key]; if (typeof value !== "object") { hasDeclarations = true; declarations[key] = value; } } if (hasDeclarations) { if (!tree[prelude]) tree[prelude] = {}; tree[prelude][selector] = declarations; } for (key in css) { value = css[key]; if (typeof value === "object") { if (key[0] === "@") { cssToTree2(tree, value, selector, key); } else { var hasCurrentSymbol = key.indexOf("&") > -1; var selectorParts = selector.split(","); if (hasCurrentSymbol) { for (var i = 0; i < selectorParts.length; i++) { selectorParts[i] = key.replace(/&/g, selectorParts[i]); } } else { for (var i = 0; i < selectorParts.length; i++) { selectorParts[i] = selectorParts[i] + " " + key; } } cssToTree2(tree, value, selectorParts.join(","), prelude); } } } } exports2.cssToTree = cssToTree2; } }); // node_modules/screenfull/dist/screenfull.js var require_screenfull = __commonJS({ "node_modules/screenfull/dist/screenfull.js"(exports2, module2) { (function() { "use strict"; var document2 = typeof window !== "undefined" && typeof window.document !== "undefined" ? window.document : {}; var isCommonjs = typeof module2 !== "undefined" && module2.exports; var fn = function() { var val; var fnMap = [ [ "requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror" ], // New WebKit [ "webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror" ], // Old WebKit [ "webkitRequestFullScreen", "webkitCancelFullScreen", "webkitCurrentFullScreenElement", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitfullscreenerror" ], [ "mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror" ], [ "msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError" ] ]; var i = 0; var l = fnMap.length; var ret = {}; for (; i < l; i++) { val = fnMap[i]; if (val && val[1] in document2) { for (i = 0; i < val.length; i++) { ret[fnMap[0][i]] = val[i]; } return ret; } } return false; }(); var eventNameMap = { change: fn.fullscreenchange, error: fn.fullscreenerror }; var screenfull2 = { request: function(element, options) { return new Promise((function(resolve, reject2) { var onFullScreenEntered = (function() { this.off("change", onFullScreenEntered); resolve(); }).bind(this); this.on("change", onFullScreenEntered); element = element || document2.documentElement; var returnPromise = element[fn.requestFullscreen](options); if (returnPromise instanceof Promise) { returnPromise.then(onFullScreenEntered).catch(reject2); } }).bind(this)); }, exit: function() { return new Promise((function(resolve, reject2) { if (!this.isFullscreen) { resolve(); return; } var onFullScreenExit = (function() { this.off("change", onFullScreenExit); resolve(); }).bind(this); this.on("change", onFullScreenExit); var returnPromise = document2[fn.exitFullscreen](); if (returnPromise instanceof Promise) { returnPromise.then(onFullScreenExit).catch(reject2); } }).bind(this)); }, toggle: function(element, options) { return this.isFullscreen ? this.exit() : this.request(element, options); }, onchange: function(callback) { this.on("change", callback); }, onerror: function(callback) { this.on("error", callback); }, on: function(event, callback) { var eventName = eventNameMap[event]; if (eventName) { document2.addEventListener(eventName, callback, false); } }, off: function(event, callback) { var eventName = eventNameMap[event]; if (eventName) { document2.removeEventListener(eventName, callback, false); } }, raw: fn }; if (!fn) { if (isCommonjs) { module2.exports = { isEnabled: false }; } else { window.screenfull = { isEnabled: false }; } return; } Object.defineProperties(screenfull2, { isFullscreen: { get: function() { return Boolean(document2[fn.fullscreenElement]); } }, element: { enumerable: true, get: function() { return document2[fn.fullscreenElement]; } }, isEnabled: { enumerable: true, get: function() { return Boolean(document2[fn.fullscreenEnabled]); } } }); if (isCommonjs) { module2.exports = screenfull2; } else { window.screenfull = screenfull2; } })(); } }); // node_modules/react-universal-interface/lib/render.js var require_render = __commonJS({ "node_modules/react-universal-interface/lib/render.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); var react_1 = require_react(); var isReact16Plus = parseInt(react_1.version.substr(0, react_1.version.indexOf("."))) > 15; var isFn = function(fn) { return typeof fn === "function"; }; var render2 = function(props, data) { var more = []; for (var _i = 2; _i < arguments.length; _i++) { more[_i - 2] = arguments[_i]; } if (true) { if (typeof props !== "object") { throw new TypeError("renderChildren(props, data) first argument must be a props object."); } var children_1 = props.children, render_1 = props.render; if (isFn(children_1) && isFn(render_1)) { console.warn('Both "render" and "children" are specified for in a universal interface component. Children will be used.'); console.trace(); } if (typeof data !== "object") { console.warn("Universal component interface normally expects data to be an object, " + ('"' + typeof data + '" received.')); console.trace(); } } var render3 = props.render, _a = props.children, children = _a === void 0 ? render3 : _a, component = props.component, _b = props.comp, comp = _b === void 0 ? component : _b; if (isFn(children)) return children.apply(void 0, tslib_1.__spreadArrays([data], more)); if (comp) { return react_1.createElement(comp, data); } if (children instanceof Array) return isReact16Plus ? children : react_1.createElement.apply(void 0, tslib_1.__spreadArrays(["div", null], children)); if (children && children instanceof Object) { if (true) { if (!children.type || typeof children.type !== "string" && typeof children.type !== "function" && typeof children.type !== "symbol") { console.warn('Universal component interface received object as children, expected React element, but received unexpected React "type".'); console.trace(); } if (typeof children.type === "string") return children; return react_1.cloneElement(children, Object.assign({}, children.props, data)); } else { if (typeof children.type === "string") return children; return react_1.cloneElement(children, Object.assign({}, children.props, data)); } } return children || null; }; exports2.default = render2; } }); // node_modules/react-universal-interface/lib/wrapInStatefulComponent.js var require_wrapInStatefulComponent = __commonJS({ "node_modules/react-universal-interface/lib/wrapInStatefulComponent.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); var React6 = tslib_1.__importStar(require_react()); var wrapInStatefulComponent = function(Comp) { var Decorated = function(_super) { tslib_1.__extends(class_1, _super); function class_1() { return _super !== null && _super.apply(this, arguments) || this; } class_1.prototype.render = function() { return Comp(this.props, this.context); }; return class_1; }(React6.Component); if (true) { Decorated.displayName = "Decorated(" + (Comp.displayName || Comp.name) + ")"; } return Decorated; }; exports2.default = wrapInStatefulComponent; } }); // node_modules/react-universal-interface/lib/addClassDecoratorSupport.js var require_addClassDecoratorSupport = __commonJS({ "node_modules/react-universal-interface/lib/addClassDecoratorSupport.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); var wrapInStatefulComponent_1 = tslib_1.__importDefault(require_wrapInStatefulComponent()); var addClassDecoratorSupport = function(Comp) { var isSFC = !Comp.prototype; return !isSFC ? Comp : wrapInStatefulComponent_1.default(Comp); }; exports2.default = addClassDecoratorSupport; } }); // node_modules/react-universal-interface/lib/createEnhancer.js var require_createEnhancer = __commonJS({ "node_modules/react-universal-interface/lib/createEnhancer.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.divWrapper = void 0; var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); var React6 = tslib_1.__importStar(require_react()); var addClassDecoratorSupport_1 = tslib_1.__importDefault(require_addClassDecoratorSupport()); var h = React6.createElement; var noWrap = function(Comp, propName, props, state) { var _a; return h(Comp, propName ? tslib_1.__assign((_a = {}, _a[propName] = state, _a), props) : tslib_1.__assign(tslib_1.__assign({}, state), props)); }; exports2.divWrapper = function(Comp, propName, props, state) { return h("div", null, noWrap(Comp, propName, props, state)); }; var createEnhancer = function(Facc, prop, wrapper) { if (wrapper === void 0) { wrapper = noWrap; } var enhancer = function(Comp, propName, faccProps) { if (propName === void 0) { propName = prop; } if (faccProps === void 0) { faccProps = null; } var isClassDecoratorMethodCall = typeof Comp === "string"; if (isClassDecoratorMethodCall) { return function(Klass) { return enhancer(Klass, Comp || prop, propName); }; } var Enhanced = function(props) { return h(Facc, faccProps, function(state) { return wrapper(Comp, propName, props, state); }); }; if (true) { Enhanced.displayName = (Facc.displayName || Facc.name) + "(" + (Comp.displayName || Comp.name) + ")"; } return isClassDecoratorMethodCall ? addClassDecoratorSupport_1.default(Enhanced) : Enhanced; }; return enhancer; }; exports2.default = createEnhancer; } }); // node_modules/react-universal-interface/lib/hookToRenderProp.js var require_hookToRenderProp = __commonJS({ "node_modules/react-universal-interface/lib/hookToRenderProp.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); var render_1 = tslib_1.__importDefault(require_render()); var defaultMapPropsToArgs = function(props) { return [props]; }; var hookToRenderProp = function(hook, mapPropsToArgs) { if (mapPropsToArgs === void 0) { mapPropsToArgs = defaultMapPropsToArgs; } return function(props) { return render_1.default(props, hook.apply(void 0, mapPropsToArgs(props))); }; }; exports2.default = hookToRenderProp; } }); // node_modules/react-universal-interface/lib/index.js var require_lib = __commonJS({ "node_modules/react-universal-interface/lib/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.hookToRenderProp = exports2.createEnhancer = exports2.render = void 0; var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); var render_1 = tslib_1.__importDefault(require_render()); exports2.render = render_1.default; var createEnhancer_1 = tslib_1.__importDefault(require_createEnhancer()); exports2.createEnhancer = createEnhancer_1.default; var hookToRenderProp_1 = tslib_1.__importDefault(require_hookToRenderProp()); exports2.hookToRenderProp = hookToRenderProp_1.default; } }); // node_modules/fast-shallow-equal/index.js var require_fast_shallow_equal = __commonJS({ "node_modules/fast-shallow-equal/index.js"(exports2) { var keyList = Object.keys; exports2.equal = function equal(a, b) { if (a === b) return true; if (!(a instanceof Object) || !(b instanceof Object)) return false; var keys2 = keyList(a); var length = keys2.length; for (var i = 0; i < length; i++) if (!(keys2[i] in b)) return false; for (var i = 0; i < length; i++) if (a[keys2[i]] !== b[keys2[i]]) return false; return length === keyList(b).length; }; } }); // node_modules/ts-easing/lib/index.js var require_lib2 = __commonJS({ "node_modules/ts-easing/lib/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.easing = { // No easing, no acceleration linear: function(t) { return t; }, // Accelerates fast, then slows quickly towards end. quadratic: function(t) { return t * (-(t * t) * t + 4 * t * t - 6 * t + 4); }, // Overshoots over 1 and then returns to 1 towards end. cubic: function(t) { return t * (4 * t * t - 9 * t + 6); }, // Overshoots over 1 multiple times - wiggles around 1. elastic: function(t) { return t * (33 * t * t * t * t - 106 * t * t * t + 126 * t * t - 67 * t + 15); }, // Accelerating from zero velocity inQuad: function(t) { return t * t; }, // Decelerating to zero velocity outQuad: function(t) { return t * (2 - t); }, // Acceleration until halfway, then deceleration inOutQuad: function(t) { return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; }, // Accelerating from zero velocity inCubic: function(t) { return t * t * t; }, // Decelerating to zero velocity outCubic: function(t) { return --t * t * t + 1; }, // Acceleration until halfway, then deceleration inOutCubic: function(t) { return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; }, // Accelerating from zero velocity inQuart: function(t) { return t * t * t * t; }, // Decelerating to zero velocity outQuart: function(t) { return 1 - --t * t * t * t; }, // Acceleration until halfway, then deceleration inOutQuart: function(t) { return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t; }, // Accelerating from zero velocity inQuint: function(t) { return t * t * t * t * t; }, // Decelerating to zero velocity outQuint: function(t) { return 1 + --t * t * t * t * t; }, // Acceleration until halfway, then deceleration inOutQuint: function(t) { return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t; }, // Accelerating from zero velocity inSine: function(t) { return -Math.cos(t * (Math.PI / 2)) + 1; }, // Decelerating to zero velocity outSine: function(t) { return Math.sin(t * (Math.PI / 2)); }, // Accelerating until halfway, then decelerating inOutSine: function(t) { return -(Math.cos(Math.PI * t) - 1) / 2; }, // Exponential accelerating from zero velocity inExpo: function(t) { return Math.pow(2, 10 * (t - 1)); }, // Exponential decelerating to zero velocity outExpo: function(t) { return -Math.pow(2, -10 * t) + 1; }, // Exponential accelerating until halfway, then decelerating inOutExpo: function(t) { t /= 0.5; if (t < 1) return Math.pow(2, 10 * (t - 1)) / 2; t--; return (-Math.pow(2, -10 * t) + 2) / 2; }, // Circular accelerating from zero velocity inCirc: function(t) { return -Math.sqrt(1 - t * t) + 1; }, // Circular decelerating to zero velocity Moves VERY fast at the beginning and // then quickly slows down in the middle. This tween can actually be used // in continuous transitions where target value changes all the time, // because of the very quick start, it hides the jitter between target value changes. outCirc: function(t) { return Math.sqrt(1 - (t = t - 1) * t); }, // Circular acceleration until halfway, then deceleration inOutCirc: function(t) { t /= 0.5; if (t < 1) return -(Math.sqrt(1 - t * t) - 1) / 2; t -= 2; return (Math.sqrt(1 - t * t) + 1) / 2; } }; } }); // node_modules/react-tiles-dnd/esm/tile-layout/TilesContainer.js init_tslib_es6(); var import_react104 = __toESM(require_react()); // node_modules/react-tiles-dnd/esm/tile-layout/useTileTable.js init_tslib_es6(); var import_react2 = __toESM(require_react()); // node_modules/@use-gesture/core/dist/maths-0ab39ae9.esm.js function clamp(v, min2, max2) { return Math.max(min2, Math.min(v, max2)); } var V = { toVector(v, fallback) { if (v === void 0) v = fallback; return Array.isArray(v) ? v : [v, v]; }, add(v1, v2) { return [v1[0] + v2[0], v1[1] + v2[1]]; }, sub(v1, v2) { return [v1[0] - v2[0], v1[1] - v2[1]]; }, addTo(v1, v2) { v1[0] += v2[0]; v1[1] += v2[1]; }, subTo(v1, v2) { v1[0] -= v2[0]; v1[1] -= v2[1]; } }; function rubberband(distance, dimension, constant2) { if (dimension === 0 || Math.abs(dimension) === Infinity) return Math.pow(distance, constant2 * 5); return distance * dimension * constant2 / (dimension + constant2 * distance); } function rubberbandIfOutOfBounds(position, min2, max2, constant2 = 0.15) { if (constant2 === 0) return clamp(position, min2, max2); if (position < min2) return -rubberband(min2 - position, max2 - min2, constant2) + min2; if (position > max2) return +rubberband(position - max2, max2 - min2, constant2) + max2; return position; } function computeRubberband(bounds, [Vx, Vy], [Rx, Ry]) { const [[X0, X1], [Y0, Y1]] = bounds; return [rubberbandIfOutOfBounds(Vx, X0, X1, Rx), rubberbandIfOutOfBounds(Vy, Y0, Y1, Ry)]; } // node_modules/@use-gesture/core/dist/actions-fe213e88.esm.js function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== void 0) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function ownKeys(e2, r) { var t = Object.keys(e2); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e2); r && (o = o.filter(function(r2) { return Object.getOwnPropertyDescriptor(e2, r2).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread2(e2) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function(r2) { _defineProperty(e2, r2, t[r2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) { Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t, r2)); }); } return e2; } var EVENT_TYPE_MAP = { pointer: { start: "down", change: "move", end: "up" }, mouse: { start: "down", change: "move", end: "up" }, touch: { start: "start", change: "move", end: "end" }, gesture: { start: "start", change: "change", end: "end" } }; function capitalize(string) { if (!string) return ""; return string[0].toUpperCase() + string.slice(1); } var actionsWithoutCaptureSupported = ["enter", "leave"]; function hasCapture(capture = false, actionKey) { return capture && !actionsWithoutCaptureSupported.includes(actionKey); } function toHandlerProp(device, action = "", capture = false) { const deviceProps = EVENT_TYPE_MAP[device]; const actionKey = deviceProps ? deviceProps[action] || action : action; return "on" + capitalize(device) + capitalize(actionKey) + (hasCapture(capture, actionKey) ? "Capture" : ""); } var pointerCaptureEvents = ["gotpointercapture", "lostpointercapture"]; function parseProp(prop) { let eventKey = prop.substring(2).toLowerCase(); const passive = !!~eventKey.indexOf("passive"); if (passive) eventKey = eventKey.replace("passive", ""); const captureKey = pointerCaptureEvents.includes(eventKey) ? "capturecapture" : "capture"; const capture = !!~eventKey.indexOf(captureKey); if (capture) eventKey = eventKey.replace("capture", ""); return { device: eventKey, capture, passive }; } function toDomEventType(device, action = "") { const deviceProps = EVENT_TYPE_MAP[device]; const actionKey = deviceProps ? deviceProps[action] || action : action; return device + actionKey; } function isTouch(event) { return "touches" in event; } function getPointerType(event) { if (isTouch(event)) return "touch"; if ("pointerType" in event) return event.pointerType; return "mouse"; } function getCurrentTargetTouchList(event) { return Array.from(event.touches).filter((e2) => { var _event$currentTarget, _event$currentTarget$; return e2.target === event.currentTarget || ((_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 || (_event$currentTarget$ = _event$currentTarget.contains) === null || _event$currentTarget$ === void 0 ? void 0 : _event$currentTarget$.call(_event$currentTarget, e2.target)); }); } function getTouchList(event) { return event.type === "touchend" || event.type === "touchcancel" ? event.changedTouches : event.targetTouches; } function getValueEvent(event) { return isTouch(event) ? getTouchList(event)[0] : event; } function touchIds(event) { return getCurrentTargetTouchList(event).map((touch) => touch.identifier); } function pointerId(event) { const valueEvent = getValueEvent(event); return isTouch(event) ? valueEvent.identifier : valueEvent.pointerId; } function pointerValues(event) { const valueEvent = getValueEvent(event); return [valueEvent.clientX, valueEvent.clientY]; } function getEventDetails(event) { const payload = {}; if ("buttons" in event) payload.buttons = event.buttons; if ("shiftKey" in event) { const { shiftKey, altKey, metaKey, ctrlKey } = event; Object.assign(payload, { shiftKey, altKey, metaKey, ctrlKey }); } return payload; } function call(v, ...args) { if (typeof v === "function") { return v(...args); } else { return v; } } function noop() { } function chain(...fns) { if (fns.length === 0) return noop; if (fns.length === 1) return fns[0]; return function() { let result2; for (const fn of fns) { result2 = fn.apply(this, arguments) || result2; } return result2; }; } function assignDefault(value, fallback) { return Object.assign({}, fallback, value || {}); } var BEFORE_LAST_KINEMATICS_DELAY = 32; var Engine = class { constructor(ctrl, args, key) { this.ctrl = ctrl; this.args = args; this.key = key; if (!this.state) { this.state = {}; this.computeValues([0, 0]); this.computeInitial(); if (this.init) this.init(); this.reset(); } } get state() { return this.ctrl.state[this.key]; } set state(state) { this.ctrl.state[this.key] = state; } get shared() { return this.ctrl.state.shared; } get eventStore() { return this.ctrl.gestureEventStores[this.key]; } get timeoutStore() { return this.ctrl.gestureTimeoutStores[this.key]; } get config() { return this.ctrl.config[this.key]; } get sharedConfig() { return this.ctrl.config.shared; } get handler() { return this.ctrl.handlers[this.key]; } reset() { const { state, shared, ingKey, args } = this; shared[ingKey] = state._active = state.active = state._blocked = state._force = false; state._step = [false, false]; state.intentional = false; state._movement = [0, 0]; state._distance = [0, 0]; state._direction = [0, 0]; state._delta = [0, 0]; state._bounds = [[-Infinity, Infinity], [-Infinity, Infinity]]; state.args = args; state.axis = void 0; state.memo = void 0; state.elapsedTime = state.timeDelta = 0; state.direction = [0, 0]; state.distance = [0, 0]; state.overflow = [0, 0]; state._movementBound = [false, false]; state.velocity = [0, 0]; state.movement = [0, 0]; state.delta = [0, 0]; state.timeStamp = 0; } start(event) { const state = this.state; const config = this.config; if (!state._active) { this.reset(); this.computeInitial(); state._active = true; state.target = event.target; state.currentTarget = event.currentTarget; state.lastOffset = config.from ? call(config.from, state) : state.offset; state.offset = state.lastOffset; state.startTime = state.timeStamp = event.timeStamp; } } computeValues(values2) { const state = this.state; state._values = values2; state.values = this.config.transform(values2); } computeInitial() { const state = this.state; state._initial = state._values; state.initial = state.values; } compute(event) { const { state, config, shared } = this; state.args = this.args; let dt = 0; if (event) { state.event = event; if (config.preventDefault && event.cancelable) state.event.preventDefault(); state.type = event.type; shared.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size; shared.locked = !!document.pointerLockElement; Object.assign(shared, getEventDetails(event)); shared.down = shared.pressed = shared.buttons % 2 === 1 || shared.touches > 0; dt = event.timeStamp - state.timeStamp; state.timeStamp = event.timeStamp; state.elapsedTime = state.timeStamp - state.startTime; } if (state._active) { const _absoluteDelta = state._delta.map(Math.abs); V.addTo(state._distance, _absoluteDelta); } if (this.axisIntent) this.axisIntent(event); const [_m0, _m1] = state._movement; const [t0, t1] = config.threshold; const { _step, values: values2 } = state; if (config.hasCustomTransform) { if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && values2[0]; if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && values2[1]; } else { if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && Math.sign(_m0) * t0; if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && Math.sign(_m1) * t1; } state.intentional = _step[0] !== false || _step[1] !== false; if (!state.intentional) return; const movement = [0, 0]; if (config.hasCustomTransform) { const [v0, v1] = values2; movement[0] = _step[0] !== false ? v0 - _step[0] : 0; movement[1] = _step[1] !== false ? v1 - _step[1] : 0; } else { movement[0] = _step[0] !== false ? _m0 - _step[0] : 0; movement[1] = _step[1] !== false ? _m1 - _step[1] : 0; } if (this.restrictToAxis && !state._blocked) this.restrictToAxis(movement); const previousOffset = state.offset; const gestureIsActive = state._active && !state._blocked || state.active; if (gestureIsActive) { state.first = state._active && !state.active; state.last = !state._active && state.active; state.active = shared[this.ingKey] = state._active; if (event) { if (state.first) { if ("bounds" in config) state._bounds = call(config.bounds, state); if (this.setup) this.setup(); } state.movement = movement; this.computeOffset(); } } const [ox, oy] = state.offset; const [[x0, x1], [y0, y1]] = state._bounds; state.overflow = [ox < x0 ? -1 : ox > x1 ? 1 : 0, oy < y0 ? -1 : oy > y1 ? 1 : 0]; state._movementBound[0] = state.overflow[0] ? state._movementBound[0] === false ? state._movement[0] : state._movementBound[0] : false; state._movementBound[1] = state.overflow[1] ? state._movementBound[1] === false ? state._movement[1] : state._movementBound[1] : false; const rubberband2 = state._active ? config.rubberband || [0, 0] : [0, 0]; state.offset = computeRubberband(state._bounds, state.offset, rubberband2); state.delta = V.sub(state.offset, previousOffset); this.computeMovement(); if (gestureIsActive && (!state.last || dt > BEFORE_LAST_KINEMATICS_DELAY)) { state.delta = V.sub(state.offset, previousOffset); const absoluteDelta = state.delta.map(Math.abs); V.addTo(state.distance, absoluteDelta); state.direction = state.delta.map(Math.sign); state._direction = state._delta.map(Math.sign); if (!state.first && dt > 0) { state.velocity = [absoluteDelta[0] / dt, absoluteDelta[1] / dt]; state.timeDelta = dt; } } } emit() { const state = this.state; const shared = this.shared; const config = this.config; if (!state._active) this.clean(); if ((state._blocked || !state.intentional) && !state._force && !config.triggerAllEvents) return; const memo = this.handler(_objectSpread2(_objectSpread2(_objectSpread2({}, shared), state), {}, { [this.aliasKey]: state.values })); if (memo !== void 0) state.memo = memo; } clean() { this.eventStore.clean(); this.timeoutStore.clean(); } }; function selectAxis([dx, dy], threshold) { const absDx = Math.abs(dx); const absDy = Math.abs(dy); if (absDx > absDy && absDx > threshold) { return "x"; } if (absDy > absDx && absDy > threshold) { return "y"; } return void 0; } var CoordinatesEngine = class extends Engine { constructor(...args) { super(...args); _defineProperty(this, "aliasKey", "xy"); } reset() { super.reset(); this.state.axis = void 0; } init() { this.state.offset = [0, 0]; this.state.lastOffset = [0, 0]; } computeOffset() { this.state.offset = V.add(this.state.lastOffset, this.state.movement); } computeMovement() { this.state.movement = V.sub(this.state.offset, this.state.lastOffset); } axisIntent(event) { const state = this.state; const config = this.config; if (!state.axis && event) { const threshold = typeof config.axisThreshold === "object" ? config.axisThreshold[getPointerType(event)] : config.axisThreshold; state.axis = selectAxis(state._movement, threshold); } state._blocked = (config.lockDirection || !!config.axis) && !state.axis || !!config.axis && config.axis !== state.axis; } restrictToAxis(v) { if (this.config.axis || this.config.lockDirection) { switch (this.state.axis) { case "x": v[1] = 0; break; case "y": v[0] = 0; break; } } } }; var identity = (v) => v; var DEFAULT_RUBBERBAND = 0.15; var commonConfigResolver = { enabled(value = true) { return value; }, eventOptions(value, _k, config) { return _objectSpread2(_objectSpread2({}, config.shared.eventOptions), value); }, preventDefault(value = false) { return value; }, triggerAllEvents(value = false) { return value; }, rubberband(value = 0) { switch (value) { case true: return [DEFAULT_RUBBERBAND, DEFAULT_RUBBERBAND]; case false: return [0, 0]; default: return V.toVector(value); } }, from(value) { if (typeof value === "function") return value; if (value != null) return V.toVector(value); }, transform(value, _k, config) { const transform2 = value || config.shared.transform; this.hasCustomTransform = !!transform2; if (true) { const originalTransform = transform2 || identity; return (v) => { const r = originalTransform(v); if (!isFinite(r[0]) || !isFinite(r[1])) { console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${r[0]},${[1]}]`); } return r; }; } return transform2 || identity; }, threshold(value) { return V.toVector(value, 0); } }; if (true) { Object.assign(commonConfigResolver, { domTarget(value) { if (value !== void 0) { throw Error(`[@use-gesture]: \`domTarget\` option has been renamed to \`target\`.`); } return NaN; }, lockDirection(value) { if (value !== void 0) { throw Error(`[@use-gesture]: \`lockDirection\` option has been merged with \`axis\`. Use it as in \`{ axis: 'lock' }\``); } return NaN; }, initial(value) { if (value !== void 0) { throw Error(`[@use-gesture]: \`initial\` option has been renamed to \`from\`.`); } return NaN; } }); } var DEFAULT_AXIS_THRESHOLD = 0; var coordinatesConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, { axis(_v, _k, { axis }) { this.lockDirection = axis === "lock"; if (!this.lockDirection) return axis; }, axisThreshold(value = DEFAULT_AXIS_THRESHOLD) { return value; }, bounds(value = {}) { if (typeof value === "function") { return (state) => coordinatesConfigResolver.bounds(value(state)); } if ("current" in value) { return () => value.current; } if (typeof HTMLElement === "function" && value instanceof HTMLElement) { return value; } const { left = -Infinity, right = Infinity, top = -Infinity, bottom = Infinity } = value; return [[left, right], [top, bottom]]; } }); var KEYS_DELTA_MAP = { ArrowRight: (displacement, factor = 1) => [displacement * factor, 0], ArrowLeft: (displacement, factor = 1) => [-1 * displacement * factor, 0], ArrowUp: (displacement, factor = 1) => [0, -1 * displacement * factor], ArrowDown: (displacement, factor = 1) => [0, displacement * factor] }; var DragEngine = class extends CoordinatesEngine { constructor(...args) { super(...args); _defineProperty(this, "ingKey", "dragging"); } reset() { super.reset(); const state = this.state; state._pointerId = void 0; state._pointerActive = false; state._keyboardActive = false; state._preventScroll = false; state._delayed = false; state.swipe = [0, 0]; state.tap = false; state.canceled = false; state.cancel = this.cancel.bind(this); } setup() { const state = this.state; if (state._bounds instanceof HTMLElement) { const boundRect = state._bounds.getBoundingClientRect(); const targetRect = state.currentTarget.getBoundingClientRect(); const _bounds = { left: boundRect.left - targetRect.left + state.offset[0], right: boundRect.right - targetRect.right + state.offset[0], top: boundRect.top - targetRect.top + state.offset[1], bottom: boundRect.bottom - targetRect.bottom + state.offset[1] }; state._bounds = coordinatesConfigResolver.bounds(_bounds); } } cancel() { const state = this.state; if (state.canceled) return; state.canceled = true; state._active = false; setTimeout(() => { this.compute(); this.emit(); }, 0); } setActive() { this.state._active = this.state._pointerActive || this.state._keyboardActive; } clean() { this.pointerClean(); this.state._pointerActive = false; this.state._keyboardActive = false; super.clean(); } pointerDown(event) { const config = this.config; const state = this.state; if (event.buttons != null && (Array.isArray(config.pointerButtons) ? !config.pointerButtons.includes(event.buttons) : config.pointerButtons !== -1 && config.pointerButtons !== event.buttons)) return; const ctrlIds = this.ctrl.setEventIds(event); if (config.pointerCapture) { event.target.setPointerCapture(event.pointerId); } if (ctrlIds && ctrlIds.size > 1 && state._pointerActive) return; this.start(event); this.setupPointer(event); state._pointerId = pointerId(event); state._pointerActive = true; this.computeValues(pointerValues(event)); this.computeInitial(); if (config.preventScrollAxis && getPointerType(event) !== "mouse") { state._active = false; this.setupScrollPrevention(event); } else if (config.delay > 0) { this.setupDelayTrigger(event); if (config.triggerAllEvents) { this.compute(event); this.emit(); } } else { this.startPointerDrag(event); } } startPointerDrag(event) { const state = this.state; state._active = true; state._preventScroll = true; state._delayed = false; this.compute(event); this.emit(); } pointerMove(event) { const state = this.state; const config = this.config; if (!state._pointerActive) return; const id = pointerId(event); if (state._pointerId !== void 0 && id !== state._pointerId) return; const _values = pointerValues(event); if (document.pointerLockElement === event.target) { state._delta = [event.movementX, event.movementY]; } else { state._delta = V.sub(_values, state._values); this.computeValues(_values); } V.addTo(state._movement, state._delta); this.compute(event); if (state._delayed && state.intentional) { this.timeoutStore.remove("dragDelay"); state.active = false; this.startPointerDrag(event); return; } if (config.preventScrollAxis && !state._preventScroll) { if (state.axis) { if (state.axis === config.preventScrollAxis || config.preventScrollAxis === "xy") { state._active = false; this.clean(); return; } else { this.timeoutStore.remove("startPointerDrag"); this.startPointerDrag(event); return; } } else { return; } } this.emit(); } pointerUp(event) { this.ctrl.setEventIds(event); try { if (this.config.pointerCapture && event.target.hasPointerCapture(event.pointerId)) { ; event.target.releasePointerCapture(event.pointerId); } } catch (_unused) { if (true) { console.warn(`[@use-gesture]: If you see this message, it's likely that you're using an outdated version of \`@react-three/fiber\`. Please upgrade to the latest version.`); } } const state = this.state; const config = this.config; if (!state._active || !state._pointerActive) return; const id = pointerId(event); if (state._pointerId !== void 0 && id !== state._pointerId) return; this.state._pointerActive = false; this.setActive(); this.compute(event); const [dx, dy] = state._distance; state.tap = dx <= config.tapsThreshold && dy <= config.tapsThreshold; if (state.tap && config.filterTaps) { state._force = true; } else { const [_dx, _dy] = state._delta; const [_mx, _my] = state._movement; const [svx, svy] = config.swipe.velocity; const [sx, sy] = config.swipe.distance; const sdt = config.swipe.duration; if (state.elapsedTime < sdt) { const _vx = Math.abs(_dx / state.timeDelta); const _vy = Math.abs(_dy / state.timeDelta); if (_vx > svx && Math.abs(_mx) > sx) state.swipe[0] = Math.sign(_dx); if (_vy > svy && Math.abs(_my) > sy) state.swipe[1] = Math.sign(_dy); } } this.emit(); } pointerClick(event) { if (!this.state.tap && event.detail > 0) { event.preventDefault(); event.stopPropagation(); } } setupPointer(event) { const config = this.config; const device = config.device; if (true) { try { if (device === "pointer" && config.preventScrollDelay === void 0) { const currentTarget = "uv" in event ? event.sourceEvent.currentTarget : event.currentTarget; const style = window.getComputedStyle(currentTarget); if (style.touchAction === "auto") { console.warn(`[@use-gesture]: The drag target has its \`touch-action\` style property set to \`auto\`. It is recommended to add \`touch-action: 'none'\` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action. This message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.`, currentTarget); } } } catch (_unused2) { } } if (config.pointerLock) { event.currentTarget.requestPointerLock(); } if (!config.pointerCapture) { this.eventStore.add(this.sharedConfig.window, device, "change", this.pointerMove.bind(this)); this.eventStore.add(this.sharedConfig.window, device, "end", this.pointerUp.bind(this)); this.eventStore.add(this.sharedConfig.window, device, "cancel", this.pointerUp.bind(this)); } } pointerClean() { if (this.config.pointerLock && document.pointerLockElement === this.state.currentTarget) { document.exitPointerLock(); } } preventScroll(event) { if (this.state._preventScroll && event.cancelable) { event.preventDefault(); } } setupScrollPrevention(event) { this.state._preventScroll = false; persistEvent(event); const remove2 = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), { passive: false }); this.eventStore.add(this.sharedConfig.window, "touch", "end", remove2); this.eventStore.add(this.sharedConfig.window, "touch", "cancel", remove2); this.timeoutStore.add("startPointerDrag", this.startPointerDrag.bind(this), this.config.preventScrollDelay, event); } setupDelayTrigger(event) { this.state._delayed = true; this.timeoutStore.add("dragDelay", () => { this.state._step = [0, 0]; this.startPointerDrag(event); }, this.config.delay); } keyDown(event) { const deltaFn = KEYS_DELTA_MAP[event.key]; if (deltaFn) { const state = this.state; const factor = event.shiftKey ? 10 : event.altKey ? 0.1 : 1; this.start(event); state._delta = deltaFn(this.config.keyboardDisplacement, factor); state._keyboardActive = true; V.addTo(state._movement, state._delta); this.compute(event); this.emit(); } } keyUp(event) { if (!(event.key in KEYS_DELTA_MAP)) return; this.state._keyboardActive = false; this.setActive(); this.compute(event); this.emit(); } bind(bindFunction) { const device = this.config.device; bindFunction(device, "start", this.pointerDown.bind(this)); if (this.config.pointerCapture) { bindFunction(device, "change", this.pointerMove.bind(this)); bindFunction(device, "end", this.pointerUp.bind(this)); bindFunction(device, "cancel", this.pointerUp.bind(this)); bindFunction("lostPointerCapture", "", this.pointerUp.bind(this)); } if (this.config.keys) { bindFunction("key", "down", this.keyDown.bind(this)); bindFunction("key", "up", this.keyUp.bind(this)); } if (this.config.filterTaps) { bindFunction("click", "", this.pointerClick.bind(this), { capture: true, passive: false }); } } }; function persistEvent(event) { "persist" in event && typeof event.persist === "function" && event.persist(); } var isBrowser = typeof window !== "undefined" && window.document && window.document.createElement; function supportsTouchEvents() { return isBrowser && "ontouchstart" in window; } function isTouchScreen() { return supportsTouchEvents() || isBrowser && window.navigator.maxTouchPoints > 1; } function supportsPointerEvents() { return isBrowser && "onpointerdown" in window; } function supportsPointerLock() { return isBrowser && "exitPointerLock" in window.document; } function supportsGestureEvents() { try { return "constructor" in GestureEvent; } catch (e2) { return false; } } var SUPPORT = { isBrowser, gesture: supportsGestureEvents(), touch: supportsTouchEvents(), touchscreen: isTouchScreen(), pointer: supportsPointerEvents(), pointerLock: supportsPointerLock() }; var DEFAULT_PREVENT_SCROLL_DELAY = 250; var DEFAULT_DRAG_DELAY = 180; var DEFAULT_SWIPE_VELOCITY = 0.5; var DEFAULT_SWIPE_DISTANCE = 50; var DEFAULT_SWIPE_DURATION = 250; var DEFAULT_KEYBOARD_DISPLACEMENT = 10; var DEFAULT_DRAG_AXIS_THRESHOLD = { mouse: 0, touch: 0, pen: 8 }; var dragConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, { device(_v, _k, { pointer: { touch = false, lock = false, mouse = false } = {} }) { this.pointerLock = lock && SUPPORT.pointerLock; if (SUPPORT.touch && touch) return "touch"; if (this.pointerLock) return "mouse"; if (SUPPORT.pointer && !mouse) return "pointer"; if (SUPPORT.touch) return "touch"; return "mouse"; }, preventScrollAxis(value, _k, { preventScroll }) { this.preventScrollDelay = typeof preventScroll === "number" ? preventScroll : preventScroll || preventScroll === void 0 && value ? DEFAULT_PREVENT_SCROLL_DELAY : void 0; if (!SUPPORT.touchscreen || preventScroll === false) return void 0; return value ? value : preventScroll !== void 0 ? "y" : void 0; }, pointerCapture(_v, _k, { pointer: { capture = true, buttons = 1, keys: keys2 = true } = {} }) { this.pointerButtons = buttons; this.keys = keys2; return !this.pointerLock && this.device === "pointer" && capture; }, threshold(value, _k, { filterTaps = false, tapsThreshold = 3, axis = void 0 }) { const threshold = V.toVector(value, filterTaps ? tapsThreshold : axis ? 1 : 0); this.filterTaps = filterTaps; this.tapsThreshold = tapsThreshold; return threshold; }, swipe({ velocity = DEFAULT_SWIPE_VELOCITY, distance = DEFAULT_SWIPE_DISTANCE, duration = DEFAULT_SWIPE_DURATION } = {}) { return { velocity: this.transform(V.toVector(velocity)), distance: this.transform(V.toVector(distance)), duration }; }, delay(value = 0) { switch (value) { case true: return DEFAULT_DRAG_DELAY; case false: return 0; default: return value; } }, axisThreshold(value) { if (!value) return DEFAULT_DRAG_AXIS_THRESHOLD; return _objectSpread2(_objectSpread2({}, DEFAULT_DRAG_AXIS_THRESHOLD), value); }, keyboardDisplacement(value = DEFAULT_KEYBOARD_DISPLACEMENT) { return value; } }); if (true) { Object.assign(dragConfigResolver, { useTouch(value) { if (value !== void 0) { throw Error(`[@use-gesture]: \`useTouch\` option has been renamed to \`pointer.touch\`. Use it as in \`{ pointer: { touch: true } }\`.`); } return NaN; }, experimental_preventWindowScrollY(value) { if (value !== void 0) { throw Error(`[@use-gesture]: \`experimental_preventWindowScrollY\` option has been renamed to \`preventScroll\`.`); } return NaN; }, swipeVelocity(value) { if (value !== void 0) { throw Error(`[@use-gesture]: \`swipeVelocity\` option has been renamed to \`swipe.velocity\`. Use it as in \`{ swipe: { velocity: 0.5 } }\`.`); } return NaN; }, swipeDistance(value) { if (value !== void 0) { throw Error(`[@use-gesture]: \`swipeDistance\` option has been renamed to \`swipe.distance\`. Use it as in \`{ swipe: { distance: 50 } }\`.`); } return NaN; }, swipeDuration(value) { if (value !== void 0) { throw Error(`[@use-gesture]: \`swipeDuration\` option has been renamed to \`swipe.duration\`. Use it as in \`{ swipe: { duration: 250 } }\`.`); } return NaN; } }); } var pinchConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, { device(_v, _k, { shared, pointer: { touch = false } = {} }) { const sharedConfig = shared; if (sharedConfig.target && !SUPPORT.touch && SUPPORT.gesture) return "gesture"; if (SUPPORT.touch && touch) return "touch"; if (SUPPORT.touchscreen) { if (SUPPORT.pointer) return "pointer"; if (SUPPORT.touch) return "touch"; } }, bounds(_v, _k, { scaleBounds = {}, angleBounds = {} }) { const _scaleBounds = (state) => { const D = assignDefault(call(scaleBounds, state), { min: -Infinity, max: Infinity }); return [D.min, D.max]; }; const _angleBounds = (state) => { const A = assignDefault(call(angleBounds, state), { min: -Infinity, max: Infinity }); return [A.min, A.max]; }; if (typeof scaleBounds !== "function" && typeof angleBounds !== "function") return [_scaleBounds(), _angleBounds()]; return (state) => [_scaleBounds(state), _angleBounds(state)]; }, threshold(value, _k, config) { this.lockDirection = config.axis === "lock"; const threshold = V.toVector(value, this.lockDirection ? [0.1, 3] : 0); return threshold; }, modifierKey(value) { if (value === void 0) return "ctrlKey"; return value; }, pinchOnWheel(value = true) { return value; } }); var moveConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, { mouseOnly: (value = true) => value }); var hoverConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, { mouseOnly: (value = true) => value }); var EngineMap = /* @__PURE__ */ new Map(); var ConfigResolverMap = /* @__PURE__ */ new Map(); function registerAction(action) { EngineMap.set(action.key, action.engine); ConfigResolverMap.set(action.key, action.resolver); } var dragAction = { key: "drag", engine: DragEngine, resolver: dragConfigResolver }; // node_modules/@use-gesture/react/dist/use-gesture-react.esm.js var import_react = __toESM(require_react()); // node_modules/@use-gesture/core/dist/use-gesture-core.esm.js 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; } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } var sharedConfigResolver = { target(value) { if (value) { return () => "current" in value ? value.current : value; } return void 0; }, enabled(value = true) { return value; }, window(value = SUPPORT.isBrowser ? window : void 0) { return value; }, eventOptions({ passive = true, capture = false } = {}) { return { passive, capture }; }, transform(value) { return value; } }; var _excluded = ["target", "eventOptions", "window", "enabled", "transform"]; function resolveWith(config = {}, resolvers) { const result2 = {}; for (const [key, resolver] of Object.entries(resolvers)) { switch (typeof resolver) { case "function": if (true) { const r = resolver.call(result2, config[key], key, config); if (!Number.isNaN(r)) result2[key] = r; } else { result2[key] = resolver.call(result2, config[key], key, config); } break; case "object": result2[key] = resolveWith(config[key], resolver); break; case "boolean": if (resolver) result2[key] = config[key]; break; } } return result2; } function parse(newConfig, gestureKey, _config = {}) { const _ref = newConfig, { target, eventOptions, window: window2, enabled, transform: transform2 } = _ref, rest2 = _objectWithoutProperties(_ref, _excluded); _config.shared = resolveWith({ target, eventOptions, window: window2, enabled, transform: transform2 }, sharedConfigResolver); if (gestureKey) { const resolver = ConfigResolverMap.get(gestureKey); _config[gestureKey] = resolveWith(_objectSpread2({ shared: _config.shared }, rest2), resolver); } else { for (const key in rest2) { const resolver = ConfigResolverMap.get(key); if (resolver) { _config[key] = resolveWith(_objectSpread2({ shared: _config.shared }, rest2[key]), resolver); } else if (true) { if (!["drag", "pinch", "scroll", "wheel", "move", "hover"].includes(key)) { if (key === "domTarget") { throw Error(`[@use-gesture]: \`domTarget\` option has been renamed to \`target\`.`); } console.warn(`[@use-gesture]: Unknown config key \`${key}\` was used. Please read the documentation for further information.`); } } } } return _config; } var EventStore = class { constructor(ctrl, gestureKey) { _defineProperty(this, "_listeners", /* @__PURE__ */ new Set()); this._ctrl = ctrl; this._gestureKey = gestureKey; } add(element, device, action, handler, options) { const listeners = this._listeners; const type = toDomEventType(device, action); const _options = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}; const eventOptions = _objectSpread2(_objectSpread2({}, _options), options); element.addEventListener(type, handler, eventOptions); const remove2 = () => { element.removeEventListener(type, handler, eventOptions); listeners.delete(remove2); }; listeners.add(remove2); return remove2; } clean() { this._listeners.forEach((remove2) => remove2()); this._listeners.clear(); } }; var TimeoutStore = class { constructor() { _defineProperty(this, "_timeouts", /* @__PURE__ */ new Map()); } add(key, callback, ms = 140, ...args) { this.remove(key); this._timeouts.set(key, window.setTimeout(callback, ms, ...args)); } remove(key) { const timeout = this._timeouts.get(key); if (timeout) window.clearTimeout(timeout); } clean() { this._timeouts.forEach((timeout) => void window.clearTimeout(timeout)); this._timeouts.clear(); } }; var Controller = class { constructor(handlers) { _defineProperty(this, "gestures", /* @__PURE__ */ new Set()); _defineProperty(this, "_targetEventStore", new EventStore(this)); _defineProperty(this, "gestureEventStores", {}); _defineProperty(this, "gestureTimeoutStores", {}); _defineProperty(this, "handlers", {}); _defineProperty(this, "config", {}); _defineProperty(this, "pointerIds", /* @__PURE__ */ new Set()); _defineProperty(this, "touchIds", /* @__PURE__ */ new Set()); _defineProperty(this, "state", { shared: { shiftKey: false, metaKey: false, ctrlKey: false, altKey: false } }); resolveGestures(this, handlers); } setEventIds(event) { if (isTouch(event)) { this.touchIds = new Set(touchIds(event)); return this.touchIds; } else if ("pointerId" in event) { if (event.type === "pointerup" || event.type === "pointercancel") this.pointerIds.delete(event.pointerId); else if (event.type === "pointerdown") this.pointerIds.add(event.pointerId); return this.pointerIds; } } applyHandlers(handlers, nativeHandlers) { this.handlers = handlers; this.nativeHandlers = nativeHandlers; } applyConfig(config, gestureKey) { this.config = parse(config, gestureKey, this.config); } clean() { this._targetEventStore.clean(); for (const key of this.gestures) { this.gestureEventStores[key].clean(); this.gestureTimeoutStores[key].clean(); } } effect() { if (this.config.shared.target) this.bind(); return () => this._targetEventStore.clean(); } bind(...args) { const sharedConfig = this.config.shared; const props = {}; let target; if (sharedConfig.target) { target = sharedConfig.target(); if (!target) return; } if (sharedConfig.enabled) { for (const gestureKey of this.gestures) { const gestureConfig = this.config[gestureKey]; const bindFunction = bindToProps(props, gestureConfig.eventOptions, !!target); if (gestureConfig.enabled) { const Engine2 = EngineMap.get(gestureKey); new Engine2(this, args, gestureKey).bind(bindFunction); } } const nativeBindFunction = bindToProps(props, sharedConfig.eventOptions, !!target); for (const eventKey in this.nativeHandlers) { nativeBindFunction(eventKey, "", (event) => this.nativeHandlers[eventKey](_objectSpread2(_objectSpread2({}, this.state.shared), {}, { event, args })), void 0, true); } } for (const handlerProp in props) { props[handlerProp] = chain(...props[handlerProp]); } if (!target) return props; for (const handlerProp in props) { const { device, capture, passive } = parseProp(handlerProp); this._targetEventStore.add(target, device, "", props[handlerProp], { capture, passive }); } } }; function setupGesture(ctrl, gestureKey) { ctrl.gestures.add(gestureKey); ctrl.gestureEventStores[gestureKey] = new EventStore(ctrl, gestureKey); ctrl.gestureTimeoutStores[gestureKey] = new TimeoutStore(); } function resolveGestures(ctrl, internalHandlers) { if (internalHandlers.drag) setupGesture(ctrl, "drag"); if (internalHandlers.wheel) setupGesture(ctrl, "wheel"); if (internalHandlers.scroll) setupGesture(ctrl, "scroll"); if (internalHandlers.move) setupGesture(ctrl, "move"); if (internalHandlers.pinch) setupGesture(ctrl, "pinch"); if (internalHandlers.hover) setupGesture(ctrl, "hover"); } var bindToProps = (props, eventOptions, withPassiveOption) => (device, action, handler, options = {}, isNative2 = false) => { var _options$capture, _options$passive; const capture = (_options$capture = options.capture) !== null && _options$capture !== void 0 ? _options$capture : eventOptions.capture; const passive = (_options$passive = options.passive) !== null && _options$passive !== void 0 ? _options$passive : eventOptions.passive; let handlerProp = isNative2 ? device : toHandlerProp(device, action, capture); if (withPassiveOption && passive) handlerProp += "Passive"; props[handlerProp] = props[handlerProp] || []; props[handlerProp].push(handler); }; // node_modules/@use-gesture/react/dist/use-gesture-react.esm.js function useRecognizers(handlers, config = {}, gestureKey, nativeHandlers) { const ctrl = import_react.default.useMemo(() => new Controller(handlers), []); ctrl.applyHandlers(handlers, nativeHandlers); ctrl.applyConfig(config, gestureKey); import_react.default.useEffect(ctrl.effect.bind(ctrl)); import_react.default.useEffect(() => { return ctrl.clean.bind(ctrl); }, []); if (config.target === void 0) { return ctrl.bind.bind(ctrl); } return void 0; } function useDrag(handler, config) { registerAction(dragAction); return useRecognizers({ drag: handler }, config || {}, "drag"); } // node_modules/react-tiles-dnd/esm/tile-layout/table-utils/tiles-table.js init_tslib_es6(); // node_modules/react-tiles-dnd/esm/tile-layout/table-utils/table.js init_tslib_es6(); var newTable = function(rows, cols, value) { return new Array(rows).fill(null).map(function(_) { return new Array(cols).fill(value); }); }; var copyTable = function(table) { return __spreadArray([], __read(table)).map(function(row) { return __spreadArray([], __read(row)); }); }; var tableSize = function(table) { var rows = table.length; var cols = rows ? table[0].length : 0; return { rows, cols }; }; var isEmptyRow = function(row) { return !row.find(function(cell) { return !!cell; }); }; var trimLocation = function(table, _a) { var col = _a.col, row = _a.row; var _b = tableSize(table), cols = _b.cols, rows = _b.rows; return { col: col < 0 ? 0 : col >= cols ? cols - 1 : col, row: row < 0 ? 0 : row >= rows ? rows - 1 : row }; }; var pointToLocation = function(table, x, y, _a) { var elementWidth = _a.elementWidth, elementHeight = _a.elementHeight; var col = Math.floor(x / elementWidth); var row = Math.floor(y / elementHeight); return trimLocation(table, { col, row }); }; var fitsInTable = function(coords, table) { var _a = tableSize(table), rows = _a.rows, cols = _a.cols; for (var row = coords.row; row < coords.row + coords.rowSpan; row++) { for (var col = coords.col; col < coords.col + coords.colSpan; col++) { if (row > rows || col > cols) return false; if (table[row][col]) return false; } } return true; }; var placeInTable = function(coords, data, table) { var newTable2 = copyTable(table); for (var row = coords.row; row < coords.row + coords.rowSpan; row++) { for (var col = coords.col; col < coords.col + coords.colSpan; col++) { newTable2[row][col] = data; } } return newTable2; }; var findFirstFittingPosition = function(span, table) { var _a = tableSize(table), rows = _a.rows, cols = _a.cols; var free = true; for (var tableRow = 0; tableRow <= rows - span.rowSpan; tableRow++) { for (var tableCol = 0; tableCol <= cols - span.colSpan; tableCol++) { free = true; for (var cellRow = 0; cellRow < span.rowSpan; cellRow++) { for (var cellCol = 0; cellCol < span.colSpan; cellCol++) { free = free && !table[tableRow + cellRow][tableCol + cellCol]; } } if (free) { return { row: tableRow, col: tableCol }; } } } }; // node_modules/react-tiles-dnd/esm/tile-layout/table-utils/tiles-table.js var interceptTiles = function(table, startRow, startCol, rowSpan, colSpan) { var interceptTiles2 = []; var _a = tableSize(table), rows = _a.rows, cols = _a.cols; for (var row = startRow; row < startRow + rowSpan; row++) { if (row >= rows) continue; var _loop_1 = function(col2) { if (col2 >= cols) return "continue"; var cell = table[row][col2]; if (cell && !interceptTiles2.find(function(t) { return t.data === cell.data; })) { interceptTiles2.push(cell); } }; for (var col = startCol; col < startCol + colSpan; col++) { _loop_1(col); } } return interceptTiles2.sort(function(a, b) { return a.col + a.row * cols - (b.col + b.row * cols); }); }; var tableToTilesList = function(table) { var _a = tableSize(table), rows = _a.rows, cols = _a.cols; return interceptTiles(table, 0, 0, rows, cols); }; var tilesListToTable = function(tiles, columns) { var maxRows = tiles.reduce(function(memo, tile) { return memo + tile.rowSpan; }, 0); var table = newTable(maxRows, columns, void 0); tiles.forEach(function(tile) { var position = findFirstFittingPosition(tile, table); if (position) { var fittedTile = __assign(__assign({}, tile), position); table = placeInTable(fittedTile, fittedTile, table); } }); return table.filter(function(row) { return !isEmptyRow(row); }); }; // node_modules/react-tiles-dnd/esm/tile-layout/strategies/move.js init_tslib_es6(); // node_modules/react-tiles-dnd/esm/tile-layout/table-utils/tiles.js init_tslib_es6(); var getTileTouchPoint = function(draggingTile, targetTile, absolutePosition, _a) { var elementHeight = _a.elementHeight, elementWidth = _a.elementWidth, activeBorderSize = _a.activeBorderSize; var position = { x: absolutePosition.x - targetTile.col * elementWidth, y: absolutePosition.y - targetTile.row * elementHeight }; if (draggingTile.col >= targetTile.col && position.x < activeBorderSize) return "left"; if (draggingTile.col <= targetTile.col && position.x > elementWidth * targetTile.colSpan - activeBorderSize) return "right"; if (draggingTile.row <= targetTile.row && position.y > elementHeight * targetTile.rowSpan - activeBorderSize) return "bottom"; if (draggingTile.row >= targetTile.row && position.y < activeBorderSize) return "top"; if (position.x > activeBorderSize && position.y < elementWidth * targetTile.colSpan - activeBorderSize && position.y > activeBorderSize && position.y < elementHeight * targetTile.rowSpan - activeBorderSize) return "center"; }; // node_modules/react-tiles-dnd/esm/tile-layout/strategies/move.js var dragMove = { onDragMove: function(_a) { var offsetX = _a.offsetX, offsetY = _a.offsetY, config = _a.config, state = _a.state, table = _a.table, canAcceptDrop = _a.canAcceptDrop; var elementHeight = config.elementHeight, elementWidth = config.elementWidth, columns = config.columns; var draggingTile = state.draggingTile, dragPosition = state.dragPosition, dropTargetTile = state.dropTargetTile, droppable = state.droppable, start = state.start, tiles = state.tiles; if (!draggingTile || !dragPosition || !start || !tiles) return; var x = start.col * elementWidth + offsetX + dragPosition.x; var y = start.row * elementHeight + offsetY + dragPosition.y; var cell = pointToLocation(table, x, y, config); var tsize = tableSize(table); if (cell.col <= tsize.cols && cell.row <= tsize.rows) { var touchedTile = table[cell.row][cell.col]; if (!touchedTile || touchedTile.data === draggingTile.data) return; var touchPoint = getTileTouchPoint(draggingTile, touchedTile, { x, y }, config); if (!touchPoint) return; if (touchPoint === "center") { if (touchedTile === dropTargetTile) return { dropTargetTile, droppable }; if (canAcceptDrop(draggingTile, touchedTile)) return { dropTargetTile: touchedTile, droppable: true }; return; } var rowDisplacement = Math.floor(dragPosition.y / elementHeight); var colDisplacement = Math.floor(dragPosition.x / elementWidth); var newDragTileLocation = trimLocation(table, touchPoint === "right" ? { col: cell.col - (draggingTile.colSpan - 1), row: cell.row - rowDisplacement } : touchPoint === "left" ? { col: cell.col, row: cell.row - rowDisplacement } : touchPoint === "top" ? { col: cell.col - colDisplacement, row: cell.row } : ( /*touchPoint === 'bottom'*/ { col: cell.col - colDisplacement, row: cell.row - (draggingTile.rowSpan - 1) } )); var hoverTiles_1 = interceptTiles(table, newDragTileLocation.row, newDragTileLocation.col, draggingTile.rowSpan, draggingTile.colSpan).filter(function(tiles2) { return tiles2.data !== draggingTile.data; }); if (!hoverTiles_1.length) { return; } var otherTiles = tiles.filter(function(tile) { return tile.data !== draggingTile.data && !hoverTiles_1.find(function(t) { return t.data === tile.data; }); }); var newDraggingTile = __assign(__assign({}, draggingTile), newDragTileLocation); var checkTable_1 = newTable(tsize.rows + draggingTile.rowSpan - 1, tsize.cols, 0); otherTiles.forEach(function(tile) { checkTable_1 = placeInTable(tile, 1, checkTable_1); }); if (!fitsInTable(newDraggingTile, checkTable_1)) { return; } checkTable_1 = placeInTable(newDraggingTile, 1, checkTable_1); var repositionedHoverTiles_1 = []; if (hoverTiles_1.find(function(tile) { var newPosition = findFirstFittingPosition(tile, checkTable_1); if (!newPosition) return true; var repositionedTile = __assign(__assign({}, tile), newPosition); repositionedHoverTiles_1.push(repositionedTile); checkTable_1 = placeInTable(repositionedTile, 1, checkTable_1); return false; })) { return; } var reorderedTiles = __spreadArray(__spreadArray(__spreadArray([], __read(repositionedHoverTiles_1)), __read(otherTiles)), [ newDraggingTile ]).sort(function(a, b) { return a.col + a.row * columns - (b.col + b.row * columns); }); return { draggingTile: newDraggingTile, tiles: reorderedTiles }; } }, onDragEnd: function() { return void 0; } }; var move_default = dragMove; // node_modules/react-tiles-dnd/esm/tile-layout/strategies/reorder.js var reorder = { onDragMove: function(_a) { var _b; var offsetX = _a.offsetX, offsetY = _a.offsetY, config = _a.config, state = _a.state, table = _a.table, canAcceptDrop = _a.canAcceptDrop; var elementHeight = config.elementHeight, elementWidth = config.elementWidth; var draggingTile = state.draggingTile, dragPosition = state.dragPosition, dropTargetTile = state.dropTargetTile, droppable = state.droppable, start = state.start, tiles = state.tiles; console.log("DRAG MOVE"); if (!draggingTile || !dragPosition || !start || !tiles) return; var getInsertionPoint = function(tiles2, touchPoint2, touchedTile2) { var tilePosition = tiles2.findIndex(function(tile) { return tile.data === (touchedTile2 === null || touchedTile2 === void 0 ? void 0 : touchedTile2.data); }); if (touchPoint2 === "left") { var leftTile = tilePosition - 1 >= 0 ? tiles2[tilePosition - 1] : void 0; if (leftTile === draggingTile) return void 0; return { insertionPoint: { right: touchedTile2, left: (leftTile === null || leftTile === void 0 ? void 0 : leftTile.row) === touchedTile2.row ? leftTile : void 0 } }; } else { var rightTile = tilePosition + 1 < tiles2.length ? tiles2[tilePosition + 1] : void 0; if (rightTile === draggingTile) return void 0; return { insertionPoint: { left: touchedTile2, right: (rightTile === null || rightTile === void 0 ? void 0 : rightTile.row) === touchedTile2.row ? rightTile : void 0 } }; } }; var x = start.col * elementWidth + offsetX + dragPosition.x; var y = start.row * elementHeight + offsetY + dragPosition.y; var cell = pointToLocation(table, x, y, config); var tsize = tableSize(table); var touchedTile = table[cell.row][cell.col]; if (!touchedTile || touchedTile.data === draggingTile.data) return; var touchPoint = getTileTouchPoint(touchedTile, touchedTile, { x, y }, config); if (!touchPoint) return; console.log("touch point:", touchPoint); if (touchPoint === "center") { if (touchedTile === dropTargetTile) return { dropTargetTile, droppable }; if (canAcceptDrop(draggingTile, touchedTile)) return { dropTargetTile: touchedTile, droppable: true }; return; } if (touchPoint !== "right" && touchPoint !== "left") return; if (touchedTile.row !== cell.row) { var adjacentCol = touchPoint === "left" ? cell.col - 1 : cell.col + touchedTile.colSpan; if (adjacentCol < 0 || adjacentCol > tsize.cols) return; var adjacentTile = table[cell.row][adjacentCol]; if (!adjacentTile) return; var shiftedInsertionPoint = (_b = getInsertionPoint(tiles, touchPoint === "left" ? "right" : "left", adjacentTile)) === null || _b === void 0 ? void 0 : _b.insertionPoint; console.log("SHIFTING: ", { shiftedInsertionPoint, touchPoint }); return { insertionPoint: { left: touchPoint === "left" ? shiftedInsertionPoint === null || shiftedInsertionPoint === void 0 ? void 0 : shiftedInsertionPoint.right : void 0, right: touchPoint === "right" ? shiftedInsertionPoint === null || shiftedInsertionPoint === void 0 ? void 0 : shiftedInsertionPoint.left : void 0 } }; } return getInsertionPoint(tiles, touchPoint, touchedTile); }, onDragEnd: function(_a) { var state = _a.state; var insertionPoint = state.insertionPoint, draggingTile = state.draggingTile, tiles = state.tiles; console.log("Drag end start:", { insertionPoint, draggingTile, tiles }); if (!tiles || !draggingTile || !insertionPoint) return; var newTiles = tiles.filter(function(tile) { return tile.data !== draggingTile.data; }); var left = insertionPoint.left, right = insertionPoint.right; var insertionLeftIdx = left ? newTiles.findIndex(function(tile) { return tile.data === left.data; }) + 1 : -1; var insertionRightIdx = right ? newTiles.findIndex(function(tile) { return tile.data === right.data; }) : -1; var insertionIndex = insertionLeftIdx > 0 ? insertionLeftIdx : insertionRightIdx; if (insertionIndex < 0) newTiles.push(draggingTile); else { newTiles.splice(insertionIndex, 0, draggingTile); } console.log("Drag end:", { insertionPoint, insertionLeftIdx, insertionRightIdx, draggingTile, tiles, newTiles }); return { tiles: newTiles }; } }; var reorder_default = reorder; // node_modules/react-tiles-dnd/esm/tile-layout/useTileTable.js var useTileTable = function(_a) { var enabled = _a.enabled, strategy = _a.strategy, elementWidth = _a.elementWidth, elementHeight = _a.elementHeight, activeBorderSize = _a.activeBorderSize, columns = _a.columns, currentTiles = _a.currentTiles, canAcceptDrop = _a.canAcceptDrop, changeTilesOrder = _a.changeTilesOrder, didDrop = _a.didDrop; var strategyImpl = strategy === "reorder" ? reorder_default : move_default; var _b = __read((0, import_react2.useState)({ dragging: false, droppable: false }), 2), state = _b[0], setState = _b[1]; var draggingTiles = state.tiles, dragging = state.dragging, insertionPoint = state.insertionPoint; var effectiveTiles = enabled && dragging && draggingTiles || currentTiles; var table = (0, import_react2.useMemo)(function() { return tilesListToTable(effectiveTiles, columns); }, [effectiveTiles, columns]); var positionedTiles = (0, import_react2.useMemo)(function() { return tableToTilesList(table); }, [table]); var config = { elementHeight, elementWidth, activeBorderSize, columns }; var bind2 = useDrag(function(_a2) { var _b2 = __read(_a2.args, 1), data = _b2[0], dragging2 = _a2.dragging, tap2 = _a2.tap, xy = _a2.xy, movement = _a2.movement, event = _a2.event; if (dragging2) { if (!tap2) { event.preventDefault(); event.stopPropagation(); } if (!state.dragging) { var rect = event.currentTarget.getBoundingClientRect(); var draggingTile_1 = positionedTiles.find(function(tile) { return tile.data === data; }); if (!draggingTile_1) return; setState({ dragging: true, droppable: false, tiles: positionedTiles, draggingTile: draggingTile_1, dragPosition: { x: xy[0] - rect.x, y: xy[1] - rect.y }, offset: { x: movement[0], y: movement[1] }, start: { col: draggingTile_1.col, row: draggingTile_1.row } }); } else { var result_1 = strategyImpl.onDragMove({ offsetX: movement[0], offsetY: movement[1], canAcceptDrop, config, state, table }) || {}; setState(function(state2) { return __assign(__assign(__assign({}, state2), { offset: { x: movement[0], y: movement[1] }, dropTargetTile: void 0, droppable: false, insertionPoint: void 0 }), result_1); }); } } else { if (state.draggingTile && state.dropTargetTile && state.droppable) { didDrop(state.draggingTile, state.dropTargetTile); } else { var result2 = strategyImpl.onDragEnd({ offsetX: movement[0], offsetY: movement[1], canAcceptDrop, config, state, table }) || {}; var finalState = __assign(__assign({}, state), result2); finalState.tiles && changeTilesOrder(finalState.tiles); } setState({ dragging: false, droppable: false }); } }, { filterTaps: true, enabled }); var renderTileProps = (0, import_react2.useMemo)(function() { if (!enabled) { return positionedTiles.map(function(tile) { return __assign(__assign({}, tile), { tileWidth: elementWidth, tileHeight: elementHeight, isDragging: false, isDropTarget: false, isDroppable: false, isDroppableAtInsertPosition: false, insertAtLeft: false, insertAtRight: false, x: tile.col * elementWidth, y: tile.row * elementHeight }); }).sort(function(a, b) { return a.key - b.key; }); } else return positionedTiles.map(function(tile) { var _a2, _b2, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; return __assign(__assign({}, tile), { tileWidth: elementWidth, tileHeight: elementHeight, isDragging: tile.data === ((_a2 = state.draggingTile) === null || _a2 === void 0 ? void 0 : _a2.data), isDropTarget: tile.data === ((_b2 = state.dropTargetTile) === null || _b2 === void 0 ? void 0 : _b2.data), insertAtLeft: tile.data === ((_d = (_c = state.insertionPoint) === null || _c === void 0 ? void 0 : _c.left) === null || _d === void 0 ? void 0 : _d.data), insertAtRight: tile.data === ((_f = (_e = state.insertionPoint) === null || _e === void 0 ? void 0 : _e.right) === null || _f === void 0 ? void 0 : _f.data), isDroppable: tile.data === ((_g = state.draggingTile) === null || _g === void 0 ? void 0 : _g.data) && state.droppable, isDroppableAtInsertPosition: !!(tile.data === ((_h = state.draggingTile) === null || _h === void 0 ? void 0 : _h.data) && state.insertionPoint), x: tile.data === ((_j = state.draggingTile) === null || _j === void 0 ? void 0 : _j.data) ? (((_k = state.start) === null || _k === void 0 ? void 0 : _k.col) || 0) * elementWidth + (((_l = state.offset) === null || _l === void 0 ? void 0 : _l.x) || 0) : tile.col * elementWidth, y: tile.data === ((_m = state.draggingTile) === null || _m === void 0 ? void 0 : _m.data) ? (((_o = state.start) === null || _o === void 0 ? void 0 : _o.row) || 0) * elementHeight + (((_p = state.offset) === null || _p === void 0 ? void 0 : _p.y) || 0) : tile.row * elementHeight }); }).sort(function(a, b) { return a.key - b.key; }); }, [state, positionedTiles, elementHeight, elementWidth, enabled]); var draggingTile = state.draggingTile; var insertIndicatorPosition = (0, import_react2.useMemo)(function() { var _a2 = insertionPoint || {}, left = _a2.left, right = _a2.right; if (left) return { x: (left.col + left.colSpan) * elementWidth, y: left.row * elementHeight }; if (right) return { x: right.col * elementWidth, y: right.row * elementHeight }; if (draggingTile) return { x: draggingTile.col * elementWidth, y: draggingTile.row * elementHeight }; }, [insertionPoint, elementHeight, elementWidth, draggingTile]); return { table, tableHeight: table.length * elementHeight, tiles: positionedTiles, insertIndicatorPosition, bind: bind2, renderTileProps }; }; // node_modules/react-use/esm/factory/createMemo.js var import_react4 = __toESM(require_react()); // node_modules/react-use/esm/factory/createReducerContext.js var import_react5 = __toESM(require_react()); // node_modules/react-use/esm/factory/createReducer.js var import_react8 = __toESM(require_react()); // node_modules/react-use/esm/useUpdateEffect.js var import_react7 = __toESM(require_react()); // node_modules/react-use/esm/useFirstMountState.js var import_react6 = __toESM(require_react()); // node_modules/react-use/esm/factory/createStateContext.js var import_react9 = __toESM(require_react()); // node_modules/react-use/esm/useAsync.js var import_react12 = __toESM(require_react()); // node_modules/react-use/esm/useAsyncFn.js init_tslib_es6(); var import_react11 = __toESM(require_react()); // node_modules/react-use/esm/useMountedState.js var import_react10 = __toESM(require_react()); // node_modules/react-use/esm/useAsyncRetry.js init_tslib_es6(); var import_react13 = __toESM(require_react()); // node_modules/react-use/esm/factory/createHTMLMediaHook.js init_tslib_es6(); var React2 = __toESM(require_react()); var import_react15 = __toESM(require_react()); // node_modules/react-use/esm/useSetState.js var import_react14 = __toESM(require_react()); var useSetState = function(initialState) { if (initialState === void 0) { initialState = {}; } var _a = (0, import_react14.useState)(initialState), state = _a[0], set2 = _a[1]; var setState = (0, import_react14.useCallback)(function(patch) { set2(function(prevState) { return Object.assign({}, prevState, patch instanceof Function ? patch(prevState) : patch); }); }, []); return [state, setState]; }; var useSetState_default = useSetState; // node_modules/react-use/esm/misc/parseTimeRanges.js function parseTimeRanges(ranges) { var result2 = []; for (var i = 0; i < ranges.length; i++) { result2.push({ start: ranges.start(i), end: ranges.end(i) }); } return result2; } // node_modules/react-use/esm/factory/createHTMLMediaHook.js function createHTMLMediaHook(tag) { return function(elOrProps) { var element; var props; if (React2.isValidElement(elOrProps)) { element = elOrProps; props = element.props; } else { props = elOrProps; } var _a = useSetState_default({ buffered: [], time: 0, duration: 0, paused: true, muted: false, volume: 1, playing: false }), state = _a[0], setState = _a[1]; var ref = (0, import_react15.useRef)(null); var wrapEvent = function(userEvent, proxyEvent) { return function(event) { try { proxyEvent && proxyEvent(event); } finally { userEvent && userEvent(event); } }; }; var onPlay = function() { return setState({ paused: false }); }; var onPlaying = function() { return setState({ playing: true }); }; var onWaiting = function() { return setState({ playing: false }); }; var onPause = function() { return setState({ paused: true, playing: false }); }; var onVolumeChange = function() { var el = ref.current; if (!el) { return; } setState({ muted: el.muted, volume: el.volume }); }; var onDurationChange = function() { var el = ref.current; if (!el) { return; } var duration = el.duration, buffered = el.buffered; setState({ duration, buffered: parseTimeRanges(buffered) }); }; var onTimeUpdate = function() { var el = ref.current; if (!el) { return; } setState({ time: el.currentTime }); }; var onProgress = function() { var el = ref.current; if (!el) { return; } setState({ buffered: parseTimeRanges(el.buffered) }); }; if (element) { element = React2.cloneElement(element, __assign(__assign({ controls: false }, props), { ref, onPlay: wrapEvent(props.onPlay, onPlay), onPlaying: wrapEvent(props.onPlaying, onPlaying), onWaiting: wrapEvent(props.onWaiting, onWaiting), onPause: wrapEvent(props.onPause, onPause), onVolumeChange: wrapEvent(props.onVolumeChange, onVolumeChange), onDurationChange: wrapEvent(props.onDurationChange, onDurationChange), onTimeUpdate: wrapEvent(props.onTimeUpdate, onTimeUpdate), onProgress: wrapEvent(props.onProgress, onProgress) })); } else { element = React2.createElement(tag, __assign(__assign({ controls: false }, props), { ref, onPlay: wrapEvent(props.onPlay, onPlay), onPlaying: wrapEvent(props.onPlaying, onPlaying), onWaiting: wrapEvent(props.onWaiting, onWaiting), onPause: wrapEvent(props.onPause, onPause), onVolumeChange: wrapEvent(props.onVolumeChange, onVolumeChange), onDurationChange: wrapEvent(props.onDurationChange, onDurationChange), onTimeUpdate: wrapEvent(props.onTimeUpdate, onTimeUpdate), onProgress: wrapEvent(props.onProgress, onProgress) })); } var lockPlay = false; var controls = { play: function() { var el = ref.current; if (!el) { return void 0; } if (!lockPlay) { var promise = el.play(); var isPromise = typeof promise === "object"; if (isPromise) { lockPlay = true; var resetLock = function() { lockPlay = false; }; promise.then(resetLock, resetLock); } return promise; } return void 0; }, pause: function() { var el = ref.current; if (el && !lockPlay) { return el.pause(); } }, seek: function(time) { var el = ref.current; if (!el || state.duration === void 0) { return; } time = Math.min(state.duration, Math.max(0, time)); el.currentTime = time; }, volume: function(volume) { var el = ref.current; if (!el) { return; } volume = Math.min(1, Math.max(0, volume)); el.volume = volume; setState({ volume }); }, mute: function() { var el = ref.current; if (!el) { return; } el.muted = true; }, unmute: function() { var el = ref.current; if (!el) { return; } el.muted = false; } }; (0, import_react15.useEffect)(function() { var el = ref.current; if (!el) { if (true) { if (tag === "audio") { console.error("useAudio() ref to