import { n as __exportAll, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-Bk_YeHJf.js"; import { t as require_react } from "./react-Bk9vEtng.js"; import { t as require_react_dom } from "./react-dom-f6U-7Wx1.js"; import { t as require_scheduler } from "./scheduler-B49edKHR.js"; //#region node_modules/konva/lib/Global.js /* * Konva JavaScript Framework v10.9.0 * http://konvajs.org/ * Licensed under the MIT * Date: @@date * * Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS) * Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva) * * @license */ var PI_OVER_180 = Math.PI / 180; /** * @namespace Konva */ function detectBrowser() { return typeof window !== "undefined" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]"); } var glob = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" ? self : {}; var Konva$2 = { _global: glob, version: "10.9.0", isBrowser: detectBrowser(), isUnminified: /param/.test(function(param) {}.toString()), dblClickWindow: 400, getAngle(angle) { return Konva$2.angleDeg ? angle * PI_OVER_180 : angle; }, enableTrace: false, pointerEventsEnabled: true, /** * Should Konva automatically update canvas on any changes. Default is true. * @property autoDrawEnabled * @default true * @name autoDrawEnabled * @memberof Konva * @example * Konva.autoDrawEnabled = true; */ autoDrawEnabled: true, /** * Should we enable hit detection while dragging? For performance reasons, by default it is false. * But on some rare cases you want to see hit graph and check intersections. Just set it to true. * @property hitOnDragEnabled * @default false * @name hitOnDragEnabled * @memberof Konva * @example * Konva.hitOnDragEnabled = true; */ hitOnDragEnabled: false, /** * Should we capture touch events and bind them to the touchstart target? That is how it works on DOM elements. * The case: we touchstart on div1, then touchmove out of that element into another element div2. * DOM will continue trigger touchmove events on div1 (not div2). Because events are "captured" into initial target. * By default Konva do not do that and will trigger touchmove on another element, while pointer is moving. * @property capturePointerEventsEnabled * @default false * @name capturePointerEventsEnabled * @memberof Konva * @example * Konva.capturePointerEventsEnabled = true; */ capturePointerEventsEnabled: false, _renderBackend: "web", /** * Use legacy text rendering. with "middle" baseline by default. * @property legacyTextRendering * @default false * @name legacyTextRendering * @memberof Konva * @example * Konva.legacyTextRendering = true; */ legacyTextRendering: false, /** * Global pixel ratio configuration. KonvaJS automatically detect pixel ratio of current device. * But you may override such property, if you want to use your value. Set this value before any components initializations. * @property pixelRatio * @default window.devicePixelRatio || 1 * @name pixelRatio * @memberof Konva * @example * // before any Konva code: * Konva.pixelRatio = 1; */ pixelRatio: typeof window !== "undefined" && window.devicePixelRatio || 1, /** * Drag distance property. If you start to drag a node you may want to wait until pointer is moved to some distance from start point * on either axis, only then start dragging. Default is 3px. * @property dragDistance * @default 3 * @memberof Konva * @example * Konva.dragDistance = 10; */ dragDistance: 3, /** * Use degree values for angle properties. You may set this property to false if you want to use radian values. * @property angleDeg * @default true * @memberof Konva * @example * node.rotation(45); // 45 degrees * Konva.angleDeg = false; * node.rotation(Math.PI / 2); // PI/2 radian */ angleDeg: true, /** * Show warnings about wrong API usage (`Konva.Util.warn`). Errors are always printed * @property showWarnings * @default true * @memberof Konva * @example * Konva.showWarnings = false; */ showWarnings: true, /** * Configure what mouse buttons can be used for drag and drop. * Default value is [0, 1] - left and middle mouse buttons. * @property dragButtons * @default [0, 1] * @memberof Konva * @example * // enable left and right mouse buttons * Konva.dragButtons = [0, 2]; */ dragButtons: [0, 1], /** * returns whether or not drag and drop is currently active * @method * @memberof Konva */ isDragging() { return Konva$2["DD"].isDragging; }, /** * returns whether or not a Transformer is currently transforming a node * @method * @memberof Konva */ isTransforming() { var _a, _b; return (_b = (_a = Konva$2["Transformer"]) === null || _a === void 0 ? void 0 : _a.isTransforming()) !== null && _b !== void 0 ? _b : false; }, /** * returns whether or not a drag and drop operation is ready, but may * not necessarily have started * @method * @memberof Konva */ isDragReady() { return !!Konva$2["DD"].node; }, /** * Should Konva release canvas elements on destroy. Default is true. * Useful to avoid memory leak issues in Safari on macOS/iOS. * @property releaseCanvasOnDestroy * @default true * @name releaseCanvasOnDestroy * @memberof Konva * @example * Konva.releaseCanvasOnDestroy = true; */ releaseCanvasOnDestroy: true, document: glob.document, _injectGlobal(Konva) { if (typeof glob.Konva !== "undefined") console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment."); glob.Konva = Konva; } }; var _boundedShapes = /* @__PURE__ */ new Set(); var _registerNode = (NodeClass, boundsCoverPaint = false) => { Konva$2[NodeClass.prototype.getClassName()] = NodeClass; if (boundsCoverPaint) _boundedShapes.add(NodeClass); }; Konva$2._injectGlobal(Konva$2); //#endregion //#region node_modules/konva/lib/Util.js var NODE_ERROR = `Konva.js unsupported environment. Looks like you are trying to use Konva.js in Node.js environment (or in a Web Worker), because "document" object is undefined. To use Konva.js in Node.js environment, you need to use the "canvas-backend" or "skia-backend" module. bash: npm install canvas js: import "konva/canvas-backend"; or bash: npm install skia-canvas js: import "konva/skia-backend"; `; var ensureBrowser = () => { if (typeof document === "undefined") throw new Error(NODE_ERROR); }; /** * Transform constructor. * In most of the cases you don't need to use it in your app. Because it is for internal usage in Konva core. * But there is a documentation for that class in case you still want * to make some manual calculations. * @constructor * @param {Array} [m] Optional six-element matrix * @memberof Konva */ var Transform = class Transform { constructor(m) { this.dirty = false; this.m = m ? m.slice() : [ 1, 0, 0, 1, 0, 0 ]; } reset() { this.m[0] = 1; this.m[1] = 0; this.m[2] = 0; this.m[3] = 1; this.m[4] = 0; this.m[5] = 0; } /** * Copy Konva.Transform object * @method * @name Konva.Transform#copy * @returns {Konva.Transform} * @example * const tr = shape.getTransform().copy() */ copy() { return new Transform(this.m); } copyInto(tr) { tr.m[0] = this.m[0]; tr.m[1] = this.m[1]; tr.m[2] = this.m[2]; tr.m[3] = this.m[3]; tr.m[4] = this.m[4]; tr.m[5] = this.m[5]; } /** * Transform point * @method * @name Konva.Transform#point * @param {Object} point 2D point(x, y) * @returns {Object} 2D point(x, y) */ point(point) { const m = this.m; return { x: m[0] * point.x + m[2] * point.y + m[4], y: m[1] * point.x + m[3] * point.y + m[5] }; } _getTransformedRect(rect) { const [a, b, c, d, e, f] = this.m; const x1 = rect.x, y1 = rect.y, x2 = rect.x + rect.width, y2 = rect.y + rect.height; const xs = [ a * x1 + c * y1 + e, a * x2 + c * y1 + e, a * x2 + c * y2 + e, a * x1 + c * y2 + e ]; const ys = [ b * x1 + d * y1 + f, b * x2 + d * y1 + f, b * x2 + d * y2 + f, b * x1 + d * y2 + f ]; const minX = Math.min(xs[0], xs[1], xs[2], xs[3]); const minY = Math.min(ys[0], ys[1], ys[2], ys[3]); return { x: minX, y: minY, width: Math.max(xs[0], xs[1], xs[2], xs[3]) - minX, height: Math.max(ys[0], ys[1], ys[2], ys[3]) - minY }; } /** * Apply translation * @method * @name Konva.Transform#translate * @param {Number} x * @param {Number} y * @returns {Konva.Transform} */ translate(x, y) { this.m[4] += this.m[0] * x + this.m[2] * y; this.m[5] += this.m[1] * x + this.m[3] * y; return this; } /** * Apply scale * @method * @name Konva.Transform#scale * @param {Number} sx * @param {Number} sy * @returns {Konva.Transform} */ scale(sx, sy) { this.m[0] *= sx; this.m[1] *= sx; this.m[2] *= sy; this.m[3] *= sy; return this; } /** * Apply rotation * @method * @name Konva.Transform#rotate * @param {Number} rad Angle in radians * @returns {Konva.Transform} */ rotate(rad) { const c = Math.cos(rad); const s = Math.sin(rad); const m11 = this.m[0] * c + this.m[2] * s; const m12 = this.m[1] * c + this.m[3] * s; const m21 = this.m[0] * -s + this.m[2] * c; const m22 = this.m[1] * -s + this.m[3] * c; this.m[0] = m11; this.m[1] = m12; this.m[2] = m21; this.m[3] = m22; return this; } /** * Returns the translation * @method * @name Konva.Transform#getTranslation * @returns {Object} 2D point(x, y) */ getTranslation() { return { x: this.m[4], y: this.m[5] }; } /** * Apply skew * @method * @name Konva.Transform#skew * @param {Number} sx * @param {Number} sy * @returns {Konva.Transform} */ skew(sx, sy) { const m11 = this.m[0] + this.m[2] * sy; const m12 = this.m[1] + this.m[3] * sy; const m21 = this.m[2] + this.m[0] * sx; const m22 = this.m[3] + this.m[1] * sx; this.m[0] = m11; this.m[1] = m12; this.m[2] = m21; this.m[3] = m22; return this; } /** * Transform multiplication * @method * @name Konva.Transform#multiply * @param {Konva.Transform} matrix * @returns {Konva.Transform} */ multiply(matrix) { const m11 = this.m[0] * matrix.m[0] + this.m[2] * matrix.m[1]; const m12 = this.m[1] * matrix.m[0] + this.m[3] * matrix.m[1]; const m21 = this.m[0] * matrix.m[2] + this.m[2] * matrix.m[3]; const m22 = this.m[1] * matrix.m[2] + this.m[3] * matrix.m[3]; const dx = this.m[0] * matrix.m[4] + this.m[2] * matrix.m[5] + this.m[4]; const dy = this.m[1] * matrix.m[4] + this.m[3] * matrix.m[5] + this.m[5]; this.m[0] = m11; this.m[1] = m12; this.m[2] = m21; this.m[3] = m22; this.m[4] = dx; this.m[5] = dy; return this; } /** * Invert the matrix * @method * @name Konva.Transform#invert * @returns {Konva.Transform} */ isInvertible() { return this.m[0] * this.m[3] - this.m[1] * this.m[2] !== 0; } invert() { const d = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]); const m0 = this.m[3] * d; const m1 = -this.m[1] * d; const m2 = -this.m[2] * d; const m3 = this.m[0] * d; const m4 = d * (this.m[2] * this.m[5] - this.m[3] * this.m[4]); const m5 = d * (this.m[1] * this.m[4] - this.m[0] * this.m[5]); this.m[0] = m0; this.m[1] = m1; this.m[2] = m2; this.m[3] = m3; this.m[4] = m4; this.m[5] = m5; return this; } /** * return matrix * @method * @name Konva.Transform#getMatrix */ getMatrix() { return this.m; } /** * convert transformation matrix back into node's attributes * @method * @name Konva.Transform#decompose * @returns {Konva.Transform} */ decompose() { const a = this.m[0]; const b = this.m[1]; const c = this.m[2]; const d = this.m[3]; const e = this.m[4]; const f = this.m[5]; const delta = a * d - b * c; const result = { x: e, y: f, rotation: 0, scaleX: 0, scaleY: 0, skewX: 0, skewY: 0 }; if (a != 0 || b != 0) { const r = Math.sqrt(a * a + b * b); result.rotation = b > 0 ? Math.acos(a / r) : -Math.acos(a / r); result.scaleX = r; result.scaleY = delta / r; result.skewX = delta && (a * c + b * d) / delta; result.skewY = 0; } else if (c != 0 || d != 0) { const s = Math.sqrt(c * c + d * d); result.rotation = Math.PI / 2 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)); result.scaleX = delta / s; result.scaleY = s; result.skewX = 0; result.skewY = delta && (a * c + b * d) / delta; } result.rotation = Util._getRotation(result.rotation); return result; } }; var OBJECT_ARRAY = "[object Array]"; var OBJECT_NUMBER = "[object Number]"; var OBJECT_STRING = "[object String]"; var OBJECT_BOOLEAN = "[object Boolean]"; var PI_OVER_DEG180 = Math.PI / 180; var DEG180_OVER_PI = 180 / Math.PI; var HASH = "#"; var EMPTY_STRING$1 = ""; var ZERO = "0"; var KONVA_WARNING = "Konva warning: "; var KONVA_ERROR = "Konva error: "; var COLORS = { aliceblue: [ 240, 248, 255 ], antiquewhite: [ 250, 235, 215 ], aqua: [ 0, 255, 255 ], aquamarine: [ 127, 255, 212 ], azure: [ 240, 255, 255 ], beige: [ 245, 245, 220 ], bisque: [ 255, 228, 196 ], black: [ 0, 0, 0 ], blanchedalmond: [ 255, 235, 205 ], blue: [ 0, 0, 255 ], blueviolet: [ 138, 43, 226 ], brown: [ 165, 42, 42 ], burlywood: [ 222, 184, 135 ], cadetblue: [ 95, 158, 160 ], chartreuse: [ 127, 255, 0 ], chocolate: [ 210, 105, 30 ], coral: [ 255, 127, 80 ], cornflowerblue: [ 100, 149, 237 ], cornsilk: [ 255, 248, 220 ], crimson: [ 220, 20, 60 ], cyan: [ 0, 255, 255 ], darkblue: [ 0, 0, 139 ], darkcyan: [ 0, 139, 139 ], darkgoldenrod: [ 184, 134, 11 ], darkgray: [ 169, 169, 169 ], darkgreen: [ 0, 100, 0 ], darkgrey: [ 169, 169, 169 ], darkkhaki: [ 189, 183, 107 ], darkmagenta: [ 139, 0, 139 ], darkolivegreen: [ 85, 107, 47 ], darkorange: [ 255, 140, 0 ], darkorchid: [ 153, 50, 204 ], darkred: [ 139, 0, 0 ], darksalmon: [ 233, 150, 122 ], darkseagreen: [ 143, 188, 143 ], darkslateblue: [ 72, 61, 139 ], darkslategray: [ 47, 79, 79 ], darkslategrey: [ 47, 79, 79 ], darkturquoise: [ 0, 206, 209 ], darkviolet: [ 148, 0, 211 ], deeppink: [ 255, 20, 147 ], deepskyblue: [ 0, 191, 255 ], dimgray: [ 105, 105, 105 ], dimgrey: [ 105, 105, 105 ], dodgerblue: [ 30, 144, 255 ], firebrick: [ 178, 34, 34 ], floralwhite: [ 255, 250, 240 ], forestgreen: [ 34, 139, 34 ], fuchsia: [ 255, 0, 255 ], gainsboro: [ 220, 220, 220 ], ghostwhite: [ 248, 248, 255 ], gold: [ 255, 215, 0 ], goldenrod: [ 218, 165, 32 ], gray: [ 128, 128, 128 ], green: [ 0, 128, 0 ], greenyellow: [ 173, 255, 47 ], grey: [ 128, 128, 128 ], honeydew: [ 240, 255, 240 ], hotpink: [ 255, 105, 180 ], indianred: [ 205, 92, 92 ], indigo: [ 75, 0, 130 ], ivory: [ 255, 255, 240 ], khaki: [ 240, 230, 140 ], lavender: [ 230, 230, 250 ], lavenderblush: [ 255, 240, 245 ], lawngreen: [ 124, 252, 0 ], lemonchiffon: [ 255, 250, 205 ], lightblue: [ 173, 216, 230 ], lightcoral: [ 240, 128, 128 ], lightcyan: [ 224, 255, 255 ], lightgoldenrodyellow: [ 250, 250, 210 ], lightgray: [ 211, 211, 211 ], lightgreen: [ 144, 238, 144 ], lightgrey: [ 211, 211, 211 ], lightpink: [ 255, 182, 193 ], lightsalmon: [ 255, 160, 122 ], lightseagreen: [ 32, 178, 170 ], lightskyblue: [ 135, 206, 250 ], lightslategray: [ 119, 136, 153 ], lightslategrey: [ 119, 136, 153 ], lightsteelblue: [ 176, 196, 222 ], lightyellow: [ 255, 255, 224 ], lime: [ 0, 255, 0 ], limegreen: [ 50, 205, 50 ], linen: [ 250, 240, 230 ], magenta: [ 255, 0, 255 ], maroon: [ 128, 0, 0 ], mediumaquamarine: [ 102, 205, 170 ], mediumblue: [ 0, 0, 205 ], mediumorchid: [ 186, 85, 211 ], mediumpurple: [ 147, 112, 219 ], mediumseagreen: [ 60, 179, 113 ], mediumslateblue: [ 123, 104, 238 ], mediumspringgreen: [ 0, 250, 154 ], mediumturquoise: [ 72, 209, 204 ], mediumvioletred: [ 199, 21, 133 ], midnightblue: [ 25, 25, 112 ], mintcream: [ 245, 255, 250 ], mistyrose: [ 255, 228, 225 ], moccasin: [ 255, 228, 181 ], navajowhite: [ 255, 222, 173 ], navy: [ 0, 0, 128 ], oldlace: [ 253, 245, 230 ], olive: [ 128, 128, 0 ], olivedrab: [ 107, 142, 35 ], orange: [ 255, 165, 0 ], orangered: [ 255, 69, 0 ], orchid: [ 218, 112, 214 ], palegoldenrod: [ 238, 232, 170 ], palegreen: [ 152, 251, 152 ], paleturquoise: [ 175, 238, 238 ], palevioletred: [ 219, 112, 147 ], papayawhip: [ 255, 239, 213 ], peachpuff: [ 255, 218, 185 ], peru: [ 205, 133, 63 ], pink: [ 255, 192, 203 ], plum: [ 221, 160, 221 ], powderblue: [ 176, 224, 230 ], purple: [ 128, 0, 128 ], rebeccapurple: [ 102, 51, 153 ], red: [ 255, 0, 0 ], rosybrown: [ 188, 143, 143 ], royalblue: [ 65, 105, 225 ], saddlebrown: [ 139, 69, 19 ], salmon: [ 250, 128, 114 ], sandybrown: [ 244, 164, 96 ], seagreen: [ 46, 139, 87 ], seashell: [ 255, 245, 238 ], sienna: [ 160, 82, 45 ], silver: [ 192, 192, 192 ], skyblue: [ 135, 206, 235 ], slateblue: [ 106, 90, 205 ], slategray: [ 112, 128, 144 ], slategrey: [ 112, 128, 144 ], snow: [ 255, 250, 250 ], springgreen: [ 0, 255, 127 ], steelblue: [ 70, 130, 180 ], tan: [ 210, 180, 140 ], teal: [ 0, 128, 128 ], thistle: [ 216, 191, 216 ], transparent: [ 0, 0, 0, 0 ], tomato: [ 255, 99, 71 ], turquoise: [ 64, 224, 208 ], violet: [ 238, 130, 238 ], wheat: [ 245, 222, 179 ], white: [ 255, 255, 255 ], whitesmoke: [ 245, 245, 245 ], yellow: [ 255, 255, 0 ], yellowgreen: [ 154, 205, 50 ] }; var _isCanvasFarblingActive = null; var defaultWindow = typeof window !== "undefined" ? window : {}; var animQueues = /* @__PURE__ */ new WeakMap(); var requestFrame = (win, f) => { if (typeof win.requestAnimationFrame === "function") win.requestAnimationFrame(f); else if (typeof requestAnimationFrame !== "undefined") requestAnimationFrame(f); else setTimeout(f, 16); }; var capitalizeCache = /* @__PURE__ */ new Map(); var TypedArray = Object.getPrototypeOf(Int8Array); var splitColorComponents = (str) => { const components = str.trim(); return components.indexOf(",") === -1 ? components.split(/\s*\/\s*|\s+/) : components.split(/\s*,\s*/); }; var NUMBER_SOURCE = "[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?"; var COLOR_COMPONENT_REGEX = new RegExp(`^(${NUMBER_SOURCE})(%?)$`, "i"); var parseColorComponent = (value, max) => { const match = COLOR_COMPONENT_REGEX.exec(value); if (!match) return NaN; const n = match[2] ? Number(match[1]) / 100 * max : Number(match[1]); return Math.min(Math.max(n, 0), max); }; var HEX_COLOR_REGEX = /^#[0-9a-f]+$/i; var HUE_REGEX = new RegExp(`^(${NUMBER_SOURCE})(deg|grad|rad|turn)?$`, "i"); var HUE_UNITS = { deg: 1, grad: .9, rad: DEG180_OVER_PI, turn: 360 }; /** * @namespace Util * @memberof Konva */ function clampRadius(radius, max) { return Math.min(Math.max(radius || 0, 0), max); } var Util = { _isElement(obj) { return !!(obj && obj.nodeType == 1); }, _isFunction(obj) { return !!(obj && obj.constructor && obj.call && obj.apply); }, _isPlainObject(obj) { return !!obj && obj.constructor === Object; }, _isArray(obj) { return Object.prototype.toString.call(obj) === OBJECT_ARRAY; }, _isNumber(obj) { return Object.prototype.toString.call(obj) === OBJECT_NUMBER && !isNaN(obj) && isFinite(obj); }, _isString(obj) { return Object.prototype.toString.call(obj) === OBJECT_STRING; }, _isBoolean(obj) { return Object.prototype.toString.call(obj) === OBJECT_BOOLEAN; }, isObject(val) { return val instanceof Object; }, isValidSelector(selector) { if (typeof selector !== "string") return false; const firstChar = selector[0]; return firstChar === "#" || firstChar === "." || firstChar === firstChar.toUpperCase(); }, _sign(number) { if (number === 0) return 1; if (number > 0) return 1; else return -1; }, requestAnimFrame(callback, win) { const target = win && !win.closed && win || defaultWindow; let queue = animQueues.get(target); if (!queue) { queue = []; animQueues.set(target, queue); requestFrame(target, function() { animQueues.delete(target); queue.forEach(function(cb) { cb(); }); }); } queue.push(callback); }, createCanvasElement() { ensureBrowser(); const canvas = document.createElement("canvas"); try { canvas.style = canvas.style || {}; } catch (e) {} return canvas; }, createImageElement() { ensureBrowser(); return document.createElement("img"); }, _urlToImage(url, callback, onError) { const imageObj = Util.createImageElement(); imageObj.onload = function() { callback(imageObj); }; imageObj.onerror = (event) => { onError === null || onError === void 0 || onError(event instanceof Error ? event : /* @__PURE__ */ new Error("Unable to load image.")); }; imageObj.src = url; }, _rgbToHex(r, g, b) { return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); }, _hexToRgb(hex) { hex = hex.replace(HASH, EMPTY_STRING$1); const bigint = parseInt(hex, 16); return { r: bigint >> 16 & 255, g: bigint >> 8 & 255, b: bigint & 255 }; }, /** * return random hex color * @method * @memberof Konva.Util * @example * shape.fill(Konva.Util.getRandomColor()); */ getRandomColor() { let randColor = (Math.random() * 16777215 << 0).toString(16); while (randColor.length < 6) randColor = ZERO + randColor; return HASH + randColor; }, /** * Check if canvas farbling is active (e.g., Brave browser fingerprinting protection) * @method * @memberof Konva.Util * @returns {Boolean} */ isCanvasFarblingActive() { if (_isCanvasFarblingActive !== null) return _isCanvasFarblingActive; if (typeof document === "undefined") { _isCanvasFarblingActive = false; return false; } const c = this.createCanvasElement(); c.width = 10; c.height = 10; const ctx = c.getContext("2d", { willReadFrequently: true }); ctx.clearRect(0, 0, 10, 10); ctx.fillStyle = "#282828"; ctx.fillRect(0, 0, 10, 10); const d = ctx.getImageData(0, 0, 10, 10).data; let isFarbling = false; for (let i = 0; i < 100; i++) if (d[i * 4] !== 40 || d[i * 4 + 1] !== 40 || d[i * 4 + 2] !== 40 || d[i * 4 + 3] !== 255) { isFarbling = true; break; } _isCanvasFarblingActive = isFarbling; this.releaseCanvas(c); return _isCanvasFarblingActive; }, /** * Get a random color for hit detection (snapped to the hit color grid) * @method * @memberof Konva.Util * @returns {String} hex color string */ getHitColor() { const channel = () => Math.random() * 256 | 0; return this.getHitColorKey(channel(), channel(), channel()); }, /** * Get hit color key from RGB values (snapped to the hit color grid) * @method * @memberof Konva.Util * @param {Number} r - red component (0-255) * @param {Number} g - green component (0-255) * @param {Number} b - blue component (0-255) * @returns {String} hex color key string */ getHitColorKey(r, g, b) { const step = this.isCanvasFarblingActive() ? 5 : 3; const snap = (value) => Math.round(value / step) * step; return HASH + this._rgbToHex(snap(r), snap(g), snap(b)); }, /** * Snap a hex color to the hit color grid * @method * @memberof Konva.Util * @param {String} hex - hex color string (e.g., "#ff00ff") * @returns {String} snapped hex color string */ getSnappedHexColor(hex) { const { r, g, b } = this._hexToRgb(hex); return this.getHitColorKey(r, g, b); }, /** * get RGB components of a color * @method * @memberof Konva.Util * @param {String} color * @example * // each of the following examples return {r:0, g:0, b:255} * var rgb = Konva.Util.getRGB('blue'); * var rgb = Konva.Util.getRGB('#0000ff'); * var rgb = Konva.Util.getRGB('rgb(0,0,255)'); */ getRGB(color) { var _a; const { r = 0, g = 0, b = 0 } = (_a = Util.colorToRGBA(color)) !== null && _a !== void 0 ? _a : {}; return { r, g, b }; }, colorToRGBA(str) { str = (str || "").trim() || "black"; const color = Util._namedColorToRBA(str) || Util._hex3ColorToRGBA(str) || Util._hex4ColorToRGBA(str) || Util._hex6ColorToRGBA(str) || Util._hex8ColorToRGBA(str) || Util._rgbColorToRGBA(str) || Util._hslColorToRGBA(str); if (color && [ color.r, color.g, color.b, color.a ].every(Util._isNumber)) return color; }, _namedColorToRBA(str) { const c = COLORS[str.toLowerCase()]; if (!c) return null; return { r: c[0], g: c[1], b: c[2], a: c.length > 3 ? c[3] : 1 }; }, _rgbColorToRGBA(str) { const match = /^rgba?\(([^)]*)\)$/i.exec(str); if (!match) return; const parts = splitColorComponents(match[1]); if (parts.length < 3 || parts.length > 4) return; return { r: parseColorComponent(parts[0], 255), g: parseColorComponent(parts[1], 255), b: parseColorComponent(parts[2], 255), a: parts.length > 3 ? parseColorComponent(parts[3], 1) : 1 }; }, _hex8ColorToRGBA(str) { if (str.length === 9 && HEX_COLOR_REGEX.test(str)) return { r: parseInt(str.slice(1, 3), 16), g: parseInt(str.slice(3, 5), 16), b: parseInt(str.slice(5, 7), 16), a: parseInt(str.slice(7, 9), 16) / 255 }; }, _hex6ColorToRGBA(str) { if (str.length === 7 && HEX_COLOR_REGEX.test(str)) return { r: parseInt(str.slice(1, 3), 16), g: parseInt(str.slice(3, 5), 16), b: parseInt(str.slice(5, 7), 16), a: 1 }; }, _hex4ColorToRGBA(str) { if (str.length === 5 && HEX_COLOR_REGEX.test(str)) return { r: parseInt(str[1] + str[1], 16), g: parseInt(str[2] + str[2], 16), b: parseInt(str[3] + str[3], 16), a: parseInt(str[4] + str[4], 16) / 255 }; }, _hex3ColorToRGBA(str) { if (str.length === 4 && HEX_COLOR_REGEX.test(str)) return { r: parseInt(str[1] + str[1], 16), g: parseInt(str[2] + str[2], 16), b: parseInt(str[3] + str[3], 16), a: 1 }; }, _hslColorToRGBA(str) { const match = /^hsla?\(([^)]*)\)$/i.exec(str); if (!match) return; const parts = splitColorComponents(match[1]); if (parts.length < 3 || parts.length > 4) return; const hue = HUE_REGEX.exec(parts[0]); if (!hue) return; const unit = hue[2]; const degrees = Number(hue[1]) * (unit ? HUE_UNITS[unit.toLowerCase()] : 1); if (!isFinite(degrees)) return; const h = (degrees % 360 + 360) % 360 / 360; const s = parseColorComponent(parts[1], 100) / 100; const l = parseColorComponent(parts[2], 100) / 100; const a = parts.length > 3 ? parseColorComponent(parts[3], 1) : 1; const t2 = l < .5 ? l * (1 + s) : l + s - l * s; const t1 = 2 * l - t2; const rgb = [ 0, 0, 0 ]; for (let i = 0; i < 3; i++) { let t3 = h + 1 / 3 * -(i - 1); if (t3 < 0) t3++; if (t3 > 1) t3--; let val; if (6 * t3 < 1) val = t1 + (t2 - t1) * 6 * t3; else if (2 * t3 < 1) val = t2; else if (3 * t3 < 2) val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; else val = t1; rgb[i] = val * 255; } return { r: Math.round(rgb[0]), g: Math.round(rgb[1]), b: Math.round(rgb[2]), a }; }, _getPointsRect(points) { let minX = Infinity; let minY = Infinity; let maxX = -Infinity; let maxY = -Infinity; for (let i = 0; i < points.length; i += 2) { const x = points[i]; const y = points[i + 1]; if (!isNaN(x)) { minX = Math.min(minX, x); maxX = Math.max(maxX, x); } if (!isNaN(y)) { minY = Math.min(minY, y); maxY = Math.max(maxY, y); } } if (!isFinite(minX + minY)) return { x: 0, y: 0, width: 0, height: 0 }; return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; }, /** * check intersection of two client rectangles * @method * @memberof Konva.Util * @param {Object} r1 - { x, y, width, height } client rectangle * @param {Object} r2 - { x, y, width, height } client rectangle * @example * const overlapping = Konva.Util.haveIntersection(shape1.getClientRect(), shape2.getClientRect()); */ haveIntersection(r1, r2) { return !(r2.x > r1.x + r1.width || r2.x + r2.width < r1.x || r2.y > r1.y + r1.height || r2.y + r2.height < r1.y); }, cloneObject(obj) { const copy = {}; for (const key in obj) copy[key] = Util._cloneValue(obj[key]); return copy; }, _cloneValue(val) { if (Util._isArray(val)) return val.some((item) => typeof item === "object") ? val.map(Util._cloneValue) : val.slice(); if (Util._isPlainObject(val)) return Util.cloneObject(val); return val instanceof TypedArray ? val.slice() : val; }, cloneArray(arr) { return arr.slice(0); }, degToRad(deg) { return deg * PI_OVER_DEG180; }, radToDeg(rad) { return rad * DEG180_OVER_PI; }, _getRotation(radians) { return Konva$2.angleDeg ? Util.radToDeg(radians) : radians; }, _capitalize(str) { const cached = capitalizeCache.get(str); if (cached !== void 0) return cached; const out = str.charAt(0).toUpperCase() + str.slice(1); capitalizeCache.set(str, out); return out; }, throw(str) { throw new Error(KONVA_ERROR + str); }, error(str) { console.error(KONVA_ERROR + str); }, warn(str) { if (!Konva$2.showWarnings) return; console.warn(KONVA_WARNING + str); }, _batchEvents(batch, run) { if (!batch) return run(); let called = false; let active = true; try { batch(() => { if (called || !active) { Util.warn("eventBatchFunc must call its argument exactly once, synchronously."); return; } called = true; run(); }); } finally { active = false; if (!called) Util.warn("eventBatchFunc must call its argument synchronously."); } }, each(obj, func) { for (const key in obj) func(key, obj[key]); }, _inRange(val, left, right) { return left <= val && val < right; }, _getProjectionToSegment(x1, y1, x2, y2, x3, y3) { let x, y, dist; const pd2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); if (pd2 == 0) { x = x1; y = y1; dist = (x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2); } else { const u = ((x3 - x1) * (x2 - x1) + (y3 - y1) * (y2 - y1)) / pd2; if (u < 0) { x = x1; y = y1; dist = (x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3); } else if (u > 1) { x = x2; y = y2; dist = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3); } else { x = x1 + u * (x2 - x1); y = y1 + u * (y2 - y1); dist = (x - x3) * (x - x3) + (y - y3) * (y - y3); } } return [ x, y, dist ]; }, _getProjectionToLine(pt, line, isClosed) { const pc = Util.cloneObject(pt); let dist = Number.MAX_VALUE; line.forEach(function(p1, i) { if (!isClosed && i === line.length - 1) return; const p2 = line[(i + 1) % line.length]; const proj = Util._getProjectionToSegment(p1.x, p1.y, p2.x, p2.y, pt.x, pt.y); const px = proj[0], py = proj[1], pdist = proj[2]; if (pdist < dist) { pc.x = px; pc.y = py; dist = pdist; } }); return pc; }, _prepareArrayForTween(startArray, endArray, isClosed) { const start = [], end = []; if (startArray.length > endArray.length) { const temp = endArray; endArray = startArray; startArray = temp; } for (let n = 0; n < startArray.length; n += 2) start.push({ x: startArray[n], y: startArray[n + 1] }); for (let n = 0; n < endArray.length; n += 2) end.push({ x: endArray[n], y: endArray[n + 1] }); const newStart = []; end.forEach(function(point) { const pr = Util._getProjectionToLine(point, start, isClosed); newStart.push(pr.x); newStart.push(pr.y); }); return newStart; }, _prepareToStringify(obj, ancestors = /* @__PURE__ */ new Set()) { const copy = Util._isArray(obj) ? [] : {}; ancestors.add(obj); for (const key of Object.keys(obj)) { const val = obj[key]; if (Util._isElement(val) || ancestors.has(val)) continue; copy[key] = Util._isPlainObject(val) || Util._isArray(val) ? Util._prepareToStringify(val, ancestors) : val; } ancestors.delete(obj); return copy; }, _assign(target, source) { for (const key in source) target[key] = source[key]; return target; }, _getEventType(type) { if (type.indexOf("pointer") >= 0) return "pointer"; if (type.indexOf("touch") >= 0) return "touch"; return "mouse"; }, _getFirstPointerId(evt) { var _a; if (!evt.touches) return (_a = evt.pointerId) !== null && _a !== void 0 ? _a : 999; else return evt.changedTouches[0].identifier; }, releaseCanvas(...canvases) { if (!Konva$2.releaseCanvasOnDestroy) return; canvases.forEach((c) => { c.width = 0; c.height = 0; }); }, _cornerRadii(cornerRadius, width, height) { const max = Math.min(width, height) / 2; if (typeof cornerRadius === "number") { const radius = clampRadius(cornerRadius, max); return [ radius, radius, radius, radius ]; } return [ clampRadius(cornerRadius[0], max), clampRadius(cornerRadius[1], max), clampRadius(cornerRadius[2], max), clampRadius(cornerRadius[3], max) ]; }, drawRoundedRectPath(context, width, height, cornerRadius) { let xOrigin = width < 0 ? width : 0; let yOrigin = height < 0 ? height : 0; width = Math.abs(width); height = Math.abs(height); const [topLeft, topRight, bottomRight, bottomLeft] = Util._cornerRadii(cornerRadius, width, height); context.moveTo(xOrigin + topLeft, yOrigin); context.lineTo(xOrigin + width - topRight, yOrigin); context.arc(xOrigin + width - topRight, yOrigin + topRight, topRight, Math.PI * 3 / 2, 0, false); context.lineTo(xOrigin + width, yOrigin + height - bottomRight); context.arc(xOrigin + width - bottomRight, yOrigin + height - bottomRight, bottomRight, 0, Math.PI / 2, false); context.lineTo(xOrigin + bottomLeft, yOrigin + height); context.arc(xOrigin + bottomLeft, yOrigin + height - bottomLeft, bottomLeft, Math.PI / 2, Math.PI, false); context.lineTo(xOrigin, yOrigin + topLeft); context.arc(xOrigin + topLeft, yOrigin + topLeft, topLeft, Math.PI, Math.PI * 3 / 2, false); }, drawRoundedPolygonPath(context, points, sides, radius, cornerRadius) { radius = Math.abs(radius); for (let i = 0; i < sides; i++) { const prev = points[(i - 1 + sides) % sides]; const curr = points[i]; const next = points[(i + 1) % sides]; const vec1 = { x: curr.x - prev.x, y: curr.y - prev.y }; const vec2 = { x: next.x - curr.x, y: next.y - curr.y }; const len1 = Math.hypot(vec1.x, vec1.y); const len2 = Math.hypot(vec2.x, vec2.y); let currCornerRadius; if (typeof cornerRadius === "number") currCornerRadius = cornerRadius; else currCornerRadius = i < cornerRadius.length ? cornerRadius[i] : 0; currCornerRadius = radius * Math.cos(Math.PI / sides) * Math.min(1, currCornerRadius / radius * 2); const normalVec1 = { x: vec1.x / len1, y: vec1.y / len1 }; const normalVec2 = { x: vec2.x / len2, y: vec2.y / len2 }; const p1 = { x: curr.x - normalVec1.x * currCornerRadius, y: curr.y - normalVec1.y * currCornerRadius }; const p2 = { x: curr.x + normalVec2.x * currCornerRadius, y: curr.y + normalVec2.y * currCornerRadius }; if (i === 0) context.moveTo(p1.x, p1.y); else context.lineTo(p1.x, p1.y); context.arcTo(curr.x, curr.y, p2.x, p2.y, currCornerRadius); } } }; //#endregion //#region node_modules/konva/lib/Context.js function simplifyArray(arr) { const retArr = [], len = arr.length, util = Util; for (let n = 0; n < len; n++) { let val = arr[n]; if (util._isNumber(val)) val = Math.round(val * 1e3) / 1e3; else if (!util._isString(val)) val = val + ""; retArr.push(val); } return retArr; } var COMMA = ","; var OPEN_PAREN = "("; var CLOSE_PAREN = ")"; var SEMICOLON = ";"; var DOUBLE_PAREN = "()"; var EQUALS = "="; var CONTEXT_METHODS = [ "arc", "arcTo", "beginPath", "bezierCurveTo", "clearRect", "clip", "closePath", "createLinearGradient", "createPattern", "createRadialGradient", "drawImage", "ellipse", "fill", "fillText", "getImageData", "createImageData", "lineTo", "moveTo", "putImageData", "quadraticCurveTo", "rect", "roundRect", "restore", "rotate", "save", "scale", "setLineDash", "setTransform", "stroke", "strokeText", "transform", "translate" ]; var CONTEXT_PROPERTIES = [ "fillStyle", "strokeStyle", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY", "letterSpacing", "lineCap", "lineDashOffset", "lineJoin", "lineWidth", "miterLimit", "direction", "font", "textAlign", "textBaseline", "globalAlpha", "globalCompositeOperation", "imageSmoothingEnabled", "imageSmoothingQuality", "filter" ]; var traceArrMax = 100; var _cssFiltersSupported = null; function isCSSFiltersSupported() { if (_cssFiltersSupported !== null) return _cssFiltersSupported; try { const canvas = Util.createCanvasElement(); const ctx = canvas.getContext("2d"); _cssFiltersSupported = !!ctx && "filter" in ctx; Util.releaseCanvas(canvas); } catch (e) { _cssFiltersSupported = false; } return _cssFiltersSupported; } /** * Konva wrapper around native 2d canvas context. It has almost the same API of 2d context with some additional functions. * With core Konva shapes you don't need to use this object. But you will use it if you want to create * a [custom shape](/docs/react/Custom_Shape.html) or a [custom hit regions](/docs/events/Custom_Hit_Region.html). * For full information about each 2d context API use [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D) * @constructor * @memberof Konva * @example * const rect = new Konva.Shape({ * fill: 'red', * width: 100, * height: 100, * sceneFunc: (ctx, shape) => { * // ctx - is context wrapper * // shape - is instance of Konva.Shape, so it equals to "rect" variable * ctx.rect(0, 0, shape.getAttr('width'), shape.getAttr('height')); * * // automatically fill shape from props and draw hit region * ctx.fillStrokeShape(shape); * } * }) */ var Context = class { constructor(canvas) { this.canvas = canvas; if (Konva$2.enableTrace) { this.traceArr = []; this._enableTrace(); } } /** * fill shape * @method * @name Konva.Context#fillShape * @param {Konva.Shape} shape */ fillShape(shape) { if (shape.fillEnabled()) this._fill(shape); } _fill(shape) {} /** * stroke shape * @method * @name Konva.Context#strokeShape * @param {Konva.Shape} shape */ strokeShape(shape) { if (shape.hasStroke()) this._stroke(shape); } _stroke(shape) {} /** * fill then stroke * @method * @name Konva.Context#fillStrokeShape * @param {Konva.Shape} shape */ fillStrokeShape(shape) { if (shape.attrs.fillAfterStrokeEnabled) { this.strokeShape(shape); this.fillShape(shape); } else { this.fillShape(shape); this.strokeShape(shape); } } getTrace(relaxed, rounded) { let traceArr = this.traceArr, len = traceArr.length, str = "", n, trace, method, args; for (n = 0; n < len; n++) { trace = traceArr[n]; method = trace.method; if (method) { args = trace.args; str += method; if (relaxed) str += DOUBLE_PAREN; else { if (rounded) args = args.map((a) => typeof a === "number" ? Math.floor(a) : a); str += OPEN_PAREN + args.join(COMMA) + CLOSE_PAREN; } } else { str += trace.property; if (!relaxed) str += EQUALS + trace.val; } str += SEMICOLON; } return str; } clearTrace() { this.traceArr = []; } _trace(str) { let traceArr = this.traceArr, len; traceArr.push(str); len = traceArr.length; if (len >= traceArrMax) traceArr.shift(); } /** * reset canvas context transform * @method * @name Konva.Context#reset */ reset() { const pixelRatio = this.getCanvas().getPixelRatio(); this.setTransform(1 * pixelRatio, 0, 0, 1 * pixelRatio, 0, 0); } /** * get canvas wrapper * @method * @name Konva.Context#getCanvas * @returns {Konva.Canvas} */ getCanvas() { return this.canvas; } /** * clear canvas * @method * @name Konva.Context#clear * @param {Object} [bounds] * @param {Number} [bounds.x] * @param {Number} [bounds.y] * @param {Number} [bounds.width] * @param {Number} [bounds.height] */ clear(bounds) { const canvas = this.getCanvas(); if (bounds) this.clearRect(bounds.x || 0, bounds.y || 0, bounds.width || 0, bounds.height || 0); else this.clearRect(0, 0, canvas.getWidth() / canvas.pixelRatio, canvas.getHeight() / canvas.pixelRatio); } _drawDeviceBuffer(canvas) { const { x, y, width, height } = canvas._isolationRect; this.setTransform(1, 0, 0, 1, 0, 0); this.imageSmoothingEnabled = false; this.drawImage(canvas._canvas, 0, 0, width, height, x, y, width, height); } _applyLineCap(shape) { const lineCap = shape.attrs.lineCap; if (lineCap) this.setAttr("lineCap", lineCap); } _getOpacity(shape) { if (!this._opacityRoot) return shape.getAbsoluteOpacity(); let opacity = shape.opacity(); let parent = shape.parent; while (parent && parent !== this._opacityRoot) { opacity *= parent.opacity(); parent = parent.parent; } return opacity; } _applyOpacity(shape) { const absOpacity = this._getOpacity(shape); if (absOpacity !== 1) this.setAttr("globalAlpha", absOpacity); } _applyLineJoin(shape) { const lineJoin = shape.attrs.lineJoin; if (lineJoin) this.setAttr("lineJoin", lineJoin); } _applyMiterLimit(shape) { const miterLimit = shape.attrs.miterLimit; if (miterLimit != null) this.setAttr("miterLimit", miterLimit); } setAttr(attr, val) { this._context[attr] = val; } /** * arc function. * @method * @name Konva.Context#arc */ arc(x, y, radius, startAngle, endAngle, counterClockwise) { this._context.arc(x, y, radius, startAngle, endAngle, counterClockwise); } /** * arcTo function. * @method * @name Konva.Context#arcTo * */ arcTo(x1, y1, x2, y2, radius) { this._context.arcTo(x1, y1, x2, y2, radius); } /** * beginPath function. * @method * @name Konva.Context#beginPath */ beginPath() { this._context.beginPath(); } /** * bezierCurveTo function. * @method * @name Konva.Context#bezierCurveTo */ bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) { this._context.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y); } /** * clearRect function. * @method * @name Konva.Context#clearRect */ clearRect(x, y, width, height) { this._context.clearRect(x, y, width, height); } clip(...args) { this._context.clip.apply(this._context, args); } /** * closePath function. * @method * @name Konva.Context#closePath */ closePath() { this._context.closePath(); } /** * createImageData function. * @method * @name Konva.Context#createImageData */ createImageData(width, height) { const a = arguments; if (a.length === 2) return this._context.createImageData(width, height); else if (a.length === 1) return this._context.createImageData(width); } /** * createLinearGradient function. * @method * @name Konva.Context#createLinearGradient */ createLinearGradient(x0, y0, x1, y1) { return this._context.createLinearGradient(x0, y0, x1, y1); } /** * createPattern function. * @method * @name Konva.Context#createPattern */ createPattern(image, repetition) { return this._context.createPattern(image, repetition); } /** * createRadialGradient function. * @method * @name Konva.Context#createRadialGradient */ createRadialGradient(x0, y0, r0, x1, y1, r1) { return this._context.createRadialGradient(x0, y0, r0, x1, y1, r1); } /** * drawImage function. * @method * @name Konva.Context#drawImage */ drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) { const a = arguments, _context = this._context; if (a.length === 3) _context.drawImage(image, sx, sy); else if (a.length === 5) _context.drawImage(image, sx, sy, sWidth, sHeight); else if (a.length === 9) _context.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight); } /** * ellipse function. * @method * @name Konva.Context#ellipse */ ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise) { this._context.ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise); } /** * isPointInPath function. * @method * @name Konva.Context#isPointInPath */ isPointInPath(x, y, path, fillRule) { if (path) return this._context.isPointInPath(path, x, y, fillRule); return this._context.isPointInPath(x, y, fillRule); } fill(...args) { this._context.fill.apply(this._context, args); } /** * fillRect function. * @method * @name Konva.Context#fillRect */ fillRect(x, y, width, height) { this._context.fillRect(x, y, width, height); } /** * strokeRect function. * @method * @name Konva.Context#strokeRect */ strokeRect(x, y, width, height) { this._context.strokeRect(x, y, width, height); } /** * fillText function. * @method * @name Konva.Context#fillText */ fillText(text, x, y, maxWidth) { if (maxWidth) this._context.fillText(text, x, y, maxWidth); else this._context.fillText(text, x, y); } /** * measureText function. * @method * @name Konva.Context#measureText */ measureText(text) { return this._context.measureText(text); } /** * getImageData function. * @method * @name Konva.Context#getImageData */ getImageData(sx, sy, sw, sh) { return this._context.getImageData(sx, sy, sw, sh); } /** * lineTo function. * @method * @name Konva.Context#lineTo */ lineTo(x, y) { this._context.lineTo(x, y); } /** * moveTo function. * @method * @name Konva.Context#moveTo */ moveTo(x, y) { this._context.moveTo(x, y); } /** * rect function. * @method * @name Konva.Context#rect */ rect(x, y, width, height) { this._context.rect(x, y, width, height); } /** * roundRect function. * @method * @name Konva.Context#roundRect */ roundRect(x, y, width, height, radii) { this._context.roundRect(x, y, width, height, radii); } /** * putImageData function. * @method * @name Konva.Context#putImageData */ putImageData(imageData, dx, dy) { this._context.putImageData(imageData, dx, dy); } /** * quadraticCurveTo function. * @method * @name Konva.Context#quadraticCurveTo */ quadraticCurveTo(cpx, cpy, x, y) { this._context.quadraticCurveTo(cpx, cpy, x, y); } /** * restore function. * @method * @name Konva.Context#restore */ restore() { this._context.restore(); } /** * rotate function. * @method * @name Konva.Context#rotate */ rotate(angle) { this._context.rotate(angle); } /** * save function. * @method * @name Konva.Context#save */ save() { this._context.save(); } /** * scale function. * @method * @name Konva.Context#scale */ scale(x, y) { this._context.scale(x, y); } /** * setLineDash function. * @method * @name Konva.Context#setLineDash */ setLineDash(segments) { this._context.setLineDash(segments); } /** * getLineDash function. * @method * @name Konva.Context#getLineDash */ getLineDash() { return this._context.getLineDash(); } /** * setTransform function. * @method * @name Konva.Context#setTransform */ setTransform(a, b, c, d, e, f) { this._context.setTransform(a, b, c, d, e, f); } /** * stroke function. * @method * @name Konva.Context#stroke */ stroke(path2d) { if (path2d) this._context.stroke(path2d); else this._context.stroke(); } /** * strokeText function. * @method * @name Konva.Context#strokeText */ strokeText(text, x, y, maxWidth) { this._context.strokeText(text, x, y, maxWidth); } /** * transform function. * @method * @name Konva.Context#transform */ transform(a, b, c, d, e, f) { this._context.transform(a, b, c, d, e, f); } /** * translate function. * @method * @name Konva.Context#translate */ translate(x, y) { this._context.translate(x, y); } _enableTrace() { let that = this, len = CONTEXT_METHODS.length, origSetter = this.setAttr, n, args; const func = function(methodName) { let origMethod = that[methodName], ret; that[methodName] = function() { args = simplifyArray(Array.prototype.slice.call(arguments, 0)); ret = origMethod.apply(that, arguments); that._trace({ method: methodName, args }); return ret; }; }; for (n = 0; n < len; n++) func(CONTEXT_METHODS[n]); that.setAttr = function() { origSetter.apply(that, arguments); const prop = arguments[0]; let val = arguments[1]; if (prop === "shadowOffsetX" || prop === "shadowOffsetY" || prop === "shadowBlur") val = val / this.canvas.getPixelRatio(); that._trace({ property: prop, val }); }; } _applyGlobalCompositeOperation(node) { const op = node.attrs.globalCompositeOperation; if (!(!op || op === "source-over")) this.setAttr("globalCompositeOperation", op); } }; CONTEXT_PROPERTIES.forEach(function(prop) { Object.defineProperty(Context.prototype, prop, { get() { return this._context[prop]; }, set(val) { this._context[prop] = val; } }); }); var SceneContext = class extends Context { constructor(canvas, { willReadFrequently = false } = {}) { super(canvas); this._context = canvas._canvas.getContext("2d", { willReadFrequently }); } _getFillPattern(shape) { const context = this._context; if ("patternQuality" in context) context.patternQuality = context.imageSmoothingEnabled ? "good" : "nearest"; return shape._getFillPattern(); } _getFillStyle(shape) { const color = shape.fill(); const priority = shape.fillPriority(); if (color && priority === "color") return color; const pattern = shape.fillPatternImage(); if (pattern && priority === "pattern") return this._getFillPattern(shape); const linear = shape.fillLinearGradientColorStops(); if (linear && priority === "linear-gradient") return shape._getLinearGradient(); const radial = shape.fillRadialGradientColorStops(); if (radial && priority === "radial-gradient") return shape._getRadialGradient(); if (color) return color; if (pattern) return this._getFillPattern(shape); if (linear) return shape._getLinearGradient(); if (radial) return shape._getRadialGradient(); } _fill(shape) { const style = this._getFillStyle(shape); if (style !== void 0) { this.setAttr("fillStyle", style); shape._fillFunc(this); } } _strokeLinearGradient(shape) { let start = shape.getStrokeLinearGradientStartPoint(), end = shape.getStrokeLinearGradientEndPoint(); if (!shape.getStrokeScaleEnabled()) { const { a, b, c, d, e, f } = this._context.getTransform(); const transform = new Transform([ a, b, c, d, e, f ]); const ratio = this.canvas.getPixelRatio(); const dx = end.x - start.x; const dy = end.y - start.y; const nx = d * dx - b * dy; const ny = a * dy - c * dx; const lengthSquared = nx * nx + ny * ny; const scale = lengthSquared ? (dx * dx + dy * dy) * (a * d - b * c) / lengthSquared : 0; start = transform.point(start); end = { x: start.x + nx * scale, y: start.y + ny * scale }; start = { x: start.x / ratio, y: start.y / ratio }; end = { x: end.x / ratio, y: end.y / ratio }; } const colorStops = shape.getStrokeLinearGradientColorStops(), grd = this.createLinearGradient(start.x, start.y, end.x, end.y); if (colorStops) { for (let n = 0; n < colorStops.length; n += 2) grd.addColorStop(colorStops[n], colorStops[n + 1]); this.setAttr("strokeStyle", grd); } } _applyStrokeStyle(shape) { if (shape.strokeLinearGradientColorStops()) this._strokeLinearGradient(shape); else this.setAttr("strokeStyle", shape.stroke()); } _stroke(shape) { const dash = shape.dash(), strokeScaleEnabled = shape.getStrokeScaleEnabled(); if (!strokeScaleEnabled) this.save(); this._applyLineCap(shape); if (dash && shape.dashEnabled()) { this.setLineDash(dash); this.setAttr("lineDashOffset", shape.dashOffset()); } this.setAttr("lineWidth", shape.strokeWidth()); const shadowColor = this.shadowColor; const shadowForStrokeEnabled = shape.getShadowForStrokeEnabled(); if (!shadowForStrokeEnabled) this.setAttr("shadowColor", "rgba(0,0,0,0)"); this._applyStrokeStyle(shape); if (!strokeScaleEnabled) { const pixelRatio = this.getCanvas().getPixelRatio(); this.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); } try { shape._strokeFunc(this); } finally { if (!shadowForStrokeEnabled) this.setAttr("shadowColor", shadowColor); if (!strokeScaleEnabled) this.restore(); } } _applyShadow(shape) { var _a; const color = (_a = shape.getShadowRGBA()) !== null && _a !== void 0 ? _a : "black", blur = shape.getShadowBlur(), offset = shape.getShadowOffset(), scale = shape.getAbsoluteScale(), ratio = this.canvas.getPixelRatio(), scaleX = scale.x * ratio, scaleY = scale.y * ratio; this.setAttr("shadowColor", color); this.setAttr("shadowBlur", blur * Math.min(Math.abs(scaleX), Math.abs(scaleY))); this.setAttr("shadowOffsetX", offset.x * scaleX); this.setAttr("shadowOffsetY", offset.y * scaleY); } }; var HitContext = class extends Context { constructor(canvas) { super(canvas); this._context = canvas._canvas.getContext("2d", { willReadFrequently: true }); } _fill(shape) { this.save(); this.setAttr("fillStyle", shape.colorKey); shape._fillFuncHit(this); this.restore(); } strokeShape(shape) { if (shape.hasHitStroke()) this._stroke(shape); } _stroke(shape) { const strokeScaleEnabled = shape.getStrokeScaleEnabled(); if (!strokeScaleEnabled) { this.save(); const pixelRatio = this.getCanvas().getPixelRatio(); this.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); } this._applyLineCap(shape); const hitStrokeWidth = shape.hitStrokeWidth(); const strokeWidth = hitStrokeWidth === "auto" ? shape.strokeWidth() : hitStrokeWidth; this.setAttr("lineWidth", strokeWidth); this.setAttr("strokeStyle", shape.colorKey); shape._strokeFuncHit(this); if (!strokeScaleEnabled) this.restore(); } }; //#endregion //#region node_modules/konva/lib/Canvas.js /** * Canvas Renderer constructor. It is a wrapper around native canvas element. * Usually you don't need to use it manually. * @constructor * @abstract * @memberof Konva * @param {Object} config * @param {Number} config.width * @param {Number} config.height * @param {Number} config.pixelRatio */ var Canvas = class { constructor(config) { this.pixelRatio = 1; this.width = 0; this.height = 0; this._logicalWidth = 0; this._logicalHeight = 0; this.isCache = false; const pixelRatio = (config || {}).pixelRatio || Konva$2.pixelRatio || Konva$2._global.devicePixelRatio || 1; this.pixelRatio = pixelRatio; this._canvas = Util.createCanvasElement(); this._canvas.style.padding = "0"; this._canvas.style.margin = "0"; this._canvas.style.border = "0"; this._canvas.style.background = "transparent"; this._canvas.style.position = "absolute"; this._canvas.style.top = "0"; this._canvas.style.left = "0"; } /** * get canvas context * @method * @name Konva.Canvas#getContext * @returns {CanvasContext} context */ getContext() { return this.context; } /** * get pixel ratio * @method * @name Konva.Canvas#getPixelRatio * @returns {Number} pixel ratio * @example * var pixelRatio = layer.getCanvas().getPixelRatio(); */ getPixelRatio() { return this.pixelRatio; } /** * set pixel ratio * KonvaJS automatically handles pixel ratio adustments in order to render crisp drawings * on all devices. Most desktops, low end tablets, and low end phones, have device pixel ratios * of 1. Some high end tablets and phones, like iPhones and iPads have a device pixel ratio * of 2. Some Macbook Pros, and iMacs also have a device pixel ratio of 2. Some high end Android devices have pixel * ratios of 2 or 3. Some browsers like Firefox allow you to configure the pixel ratio of the viewport. Unless otherwise * specificed, the pixel ratio will be defaulted to the actual device pixel ratio. You can override the device pixel * ratio for special situations, or, if you don't want the pixel ratio to be taken into account, you can set it to 1. * @method * @name Konva.Canvas#setPixelRatio * @param {Number} pixelRatio * @example * layer.getCanvas().setPixelRatio(3); */ setPixelRatio(pixelRatio) { this.pixelRatio = pixelRatio; this.setSize(this._logicalWidth, this._logicalHeight); } setWidth(width) { this.setSize(width, this._logicalHeight); } setHeight(height) { this.setSize(this._logicalWidth, height); } getWidth() { return this.width; } getHeight() { return this.height; } _bitmapSize(size) { return Math.floor((size || 0) * this.pixelRatio); } setSize(width, height) { if (!isFinite(width !== null && width !== void 0 ? width : 0) || !isFinite(height !== null && height !== void 0 ? height : 0)) { Util.error(`Canvas size must be finite numbers, got ${width}x${height}. The canvas is left empty.`); width = height = 0; } width = width || 0; height = height || 0; const pixelRatio = this.pixelRatio; const context = this.getContext()._context; const imageSmoothingEnabled = context.imageSmoothingEnabled; this._logicalWidth = width; this._logicalHeight = height; this.width = this._canvas.width = this._bitmapSize(width); this.height = this._canvas.height = this._bitmapSize(height); this._canvas.style.width = width + "px"; this._canvas.style.height = height + "px"; context.scale(pixelRatio, pixelRatio); context.imageSmoothingEnabled = imageSmoothingEnabled; } setSizeIfChanged(width, height) { if (this.width !== this._bitmapSize(width) || this.height !== this._bitmapSize(height)) this.setSize(width, height); } /** * to data url * @method * @name Konva.Canvas#toDataURL * @param {String} mimeType * @param {Number} quality between 0 and 1 for jpg mime types * @returns {String} data url string */ toDataURL(mimeType, quality) { try { return this._canvas.toDataURL(mimeType, quality); } catch (e) { try { return this._canvas.toDataURL(); } catch (err) { Util.error("Unable to get data URL. " + err.message + " For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."); throw err; } } } }; var SceneCanvas = class SceneCanvas extends Canvas { _prepareIsolationCanvas(rect) { const { a, b, c, d, e, f } = this.getContext()._context.getTransform(); const view = this._isolationRect || this; let x = 0, y = 0, width = view.width, height = view.height; if (rect) { const box = new Transform([ a, b, c, d, e, f ])._getTransformedRect(rect); x = Math.max(0, Math.floor(box.x) - 1); y = Math.max(0, Math.floor(box.y) - 1); width = Math.min(width, Math.ceil(box.x + box.width) + 1) - x; height = Math.min(height, Math.ceil(box.y + box.height) + 1) - y; } if (!(width > 0 && height > 0)) { x = y = 0; width = height = 1; } const surface = this._isolationCanvas || (this._isolationCanvas = new SceneCanvas({ width: 0, height: 0, pixelRatio: this.pixelRatio })); if (surface.width < width || surface.height < height) { const ratio = this.pixelRatio; const grow = (need, have, max) => Math.min(max, Math.ceil((have < need ? Math.max(need, have * 1.5) : have) / ratio)); surface.setSize(grow(width, surface.width, this._logicalWidth), grow(height, surface.height, this._logicalHeight)); } surface._isolationRect = { x, y, width, height }; const peak = surface._isolationPeak; peak.width = Math.max(peak.width, width); peak.height = Math.max(peak.height, height); const context = surface.getContext(); context.setTransform(1, 0, 0, 1, 0, 0); context.clearRect(0, 0, width, height); context.setTransform(a, b, c, d, e - x, f - y); const parent = this.getContext(); context.imageSmoothingEnabled = parent.imageSmoothingEnabled; context.imageSmoothingQuality = parent.imageSmoothingQuality; context.direction = parent.direction; return surface; } _trimIsolationCanvas() { const surface = this._isolationCanvas; if (!surface) return; const peak = surface._isolationPeak; surface._isolationLowFrames = surface.width * surface.height > 4 * peak.width * peak.height ? surface._isolationLowFrames + 1 : 0; if (surface._isolationLowFrames >= 10) this._releaseIsolationCanvas(); else { peak.width = peak.height = 0; surface._trimIsolationCanvas(); } } _releaseIsolationCanvas() { const surface = this._isolationCanvas; if (surface) { surface._releaseIsolationCanvas(); Util.releaseCanvas(surface._canvas); this._isolationCanvas = void 0; } } setSize(width, height) { this._releaseIsolationCanvas(); super.setSize(width, height); } constructor(config = { width: 0, height: 0, willReadFrequently: false }) { super(config); this._isolationPeak = { width: 0, height: 0 }; this._isolationLowFrames = 0; this.context = new SceneContext(this, { willReadFrequently: config.willReadFrequently }); this.setSize(config.width, config.height); } }; var HitCanvas = class extends Canvas { constructor(config = { width: 0, height: 0 }) { super(config); this.hitCanvas = true; this.context = new HitContext(this); this.context.imageSmoothingEnabled = false; this.setSize(config.width, config.height); } }; //#endregion //#region node_modules/konva/lib/DragAndDrop.js var DD = { get isDragging() { let flag = false; DD._dragElements.forEach((elem) => { if (elem.dragStatus === "dragging") flag = true; }); return flag; }, get node() { let node; for (const elem of DD._dragElements.values()) { if (elem.dragStatus === "dragging") return elem.node; node = elem.node; } return node; }, _dragElements: /* @__PURE__ */ new Map(), _listenToWindow(win) { const endDragBefore = (evt) => DD._endDragBefore(evt, win); const drag = (evt) => DD._batchEvents(() => DD._drag(evt, win), win); const endDragAfter = (evt) => DD._batchEvents(() => DD._endDragAfter(evt)); win.addEventListener("mouseup", endDragBefore, true); win.addEventListener("touchend", endDragBefore, true); win.addEventListener("touchcancel", endDragBefore, true); win.addEventListener("mousemove", drag); win.addEventListener("touchmove", drag); win.addEventListener("mouseup", endDragAfter, false); win.addEventListener("touchend", endDragAfter, false); win.addEventListener("touchcancel", endDragAfter, false); }, _batchEvents(callback, win) { if (!DD._dragElements.size) return; const batches = /* @__PURE__ */ new Set(); for (const { node } of DD._dragElements.values()) { const stage = node.getStage(); if (!stage || win && stage._getOwnerWindow() !== win) continue; const batch = stage.eventBatchFunc(); if (batch) batches.add(batch); } let run = callback; for (const batch of batches) { const next = run; run = () => Util._batchEvents(batch, next); } run(); }, _drag(evt, win) { const nodesToFireEvents = []; const positioned = /* @__PURE__ */ new Set(); DD._dragElements.forEach((elem, key) => { const { node } = elem; const stage = node.getStage(); if (win && stage._getOwnerWindow() !== win) return; if (!positioned.has(stage)) { stage.setPointersPositions(evt); positioned.add(stage); } if (elem.pointerEventType && elem.pointerEventType !== stage._pointerEventType) return; if (elem.pointerId === void 0) { elem.pointerId = Util._getFirstPointerId(evt); elem.pointerEventType = stage._pointerEventType; if (elem.dragStatus === "dragging") stage._cancelClick(elem.pointerId, elem.pointerEventType); } const pos = stage._changedPointerPositions.find((pos) => pos.id === elem.pointerId); if (!pos) return; if (elem.dragStatus !== "dragging") { const dragDistance = node.dragDistance(); if (Math.max(Math.abs(pos.x - elem.startPointerPos.x), Math.abs(pos.y - elem.startPointerPos.y)) < dragDistance) return; node.startDrag({ evt }); if (!node.isDragging()) return; } node._setDragPosition(evt, elem); nodesToFireEvents.push(node); }); nodesToFireEvents.forEach((node) => { if (!node.getStage()) return; node.fire("dragmove", { type: "dragmove", target: node, evt }, true); }); }, _endDragBefore(evt, win, only) { const drawNodes = []; const positioned = /* @__PURE__ */ new Set(); DD._dragElements.forEach((elem, key) => { const { node } = elem; if (only && elem !== only && elem.pointerId !== only.pointerId) return; const stage = node.getStage(); if (evt && !positioned.has(stage) && (!win || stage._getOwnerWindow() === win)) { stage.setPointersPositions(evt); positioned.add(stage); } if (!only) { if (evt && elem.pointerEventType && elem.pointerEventType !== Util._getEventType(evt.type)) return; if (!(elem.pointerId === void 0 || stage._changedPointerPositions.some((pos) => pos.id === elem.pointerId))) return; } if (elem.dragStatus === "ready") DD._dragElements.delete(key); else { stage._cancelClick(elem.pointerId, elem.pointerEventType); elem.dragStatus = "stopped"; const drawNode = node.getLayer() || stage; if (drawNode && drawNodes.indexOf(drawNode) === -1) drawNodes.push(drawNode); } }); drawNodes.forEach((drawNode) => { drawNode.draw(); }); }, _endDragAfter(evt, only) { DD._dragElements.forEach((elem, key) => { if (elem.dragStatus !== "stopped" || only && elem !== only && elem.pointerId !== only.pointerId) return; elem.node.fire("dragend", { type: "dragend", target: elem.node, evt }, true); if (elem.dragStatus !== "dragging") DD._dragElements.delete(key); }); } }; //#endregion //#region node_modules/konva/lib/PointerEvents.js var Captures = /* @__PURE__ */ new Map(); var SUPPORT_POINTER_EVENTS = Konva$2._global["PointerEvent"] !== void 0; function getCapturedShape(pointerId, stage) { const capture = Captures.get(pointerId); return capture && (!stage || capture.stage === stage) ? capture.shape : void 0; } function fireCapture(shape, type, pointerId) { shape._fire(type, { evt: new PointerEvent(type, { pointerId }), pointerId }); } function hasPointerCapture(pointerId, shape) { var _a; return ((_a = Captures.get(pointerId)) === null || _a === void 0 ? void 0 : _a.shape) === shape; } function setPointerCapture(pointerId, shape) { var _a; releaseCapture(pointerId); const stage = shape.getStage(); if (!stage) return; Captures.set(pointerId, { shape, stage }); if (SUPPORT_POINTER_EVENTS) { try { (_a = stage.content) === null || _a === void 0 || _a.setPointerCapture(pointerId); } catch (e) {} fireCapture(shape, "gotpointercapture", pointerId); } } function releaseCapturesOf(node) { Captures.forEach(({ shape, stage }, pointerId) => { if (shape === node || stage === node) releaseCapture(pointerId); }); } function releaseCapture(pointerId, target) { var _a; const capture = Captures.get(pointerId); if (!capture || target && capture.shape !== target) return; const { shape, stage } = capture; Captures.delete(pointerId); if (SUPPORT_POINTER_EVENTS) { try { (_a = stage.content) === null || _a === void 0 || _a.releasePointerCapture(pointerId); } catch (e) {} fireCapture(shape, "lostpointercapture", pointerId); } } //#endregion //#region node_modules/konva/lib/Validators.js function _formatValue(val) { if (Util._isString(val)) return "\"" + val + "\""; if (Object.prototype.toString.call(val) === "[object Number]") return val; if (Util._isBoolean(val)) return val; return Object.prototype.toString.call(val); } function RGBComponent(val) { if (val > 255) return 255; else if (val < 0) return 0; return Math.round(val); } function getNumberValidator() { if (Konva$2.isUnminified) return function(val, attr) { if (!Util._isNumber(val)) Util.warn(_formatValue(val) + " is a not valid value for \"" + attr + "\" attribute. The value should be a number."); return val; }; } function getNumberOrArrayOfNumbersValidator(noOfElements) { if (Konva$2.isUnminified) return function(val, attr) { let isNumber = Util._isNumber(val); let isValidArray = Util._isArray(val) && val.length == noOfElements; if (!isNumber && !isValidArray) Util.warn(_formatValue(val) + " is a not valid value for \"" + attr + "\" attribute. The value should be a number or Array(" + noOfElements + ")"); return val; }; } function getNumberOrAutoValidator() { if (Konva$2.isUnminified) return function(val, attr) { if (!(Util._isNumber(val) || val === "auto")) Util.warn(_formatValue(val) + " is a not valid value for \"" + attr + "\" attribute. The value should be a number or \"auto\"."); return val; }; } function getStringValidator() { if (Konva$2.isUnminified) return function(val, attr) { if (!Util._isString(val)) Util.warn(_formatValue(val) + " is a not valid value for \"" + attr + "\" attribute. The value should be a string."); return val; }; } function getStringOrGradientValidator() { if (Konva$2.isUnminified) return function(val, attr) { const isString = Util._isString(val); const isGradient = Object.prototype.toString.call(val) === "[object CanvasGradient]" || val && val["addColorStop"]; if (!(isString || isGradient)) Util.warn(_formatValue(val) + " is a not valid value for \"" + attr + "\" attribute. The value should be a string or a native gradient."); return val; }; } function getNumberArrayValidator() { if (Konva$2.isUnminified) return function(val, attr) { if (val instanceof TypedArray) return val; if (!Util._isArray(val)) Util.warn(_formatValue(val) + " is a not valid value for \"" + attr + "\" attribute. The value should be a array of numbers."); else val.forEach(function(item) { if (!Util._isNumber(item)) Util.warn("\"" + attr + "\" attribute has non numeric element " + item + ". Make sure that all elements are numbers."); }); return val; }; } function getBooleanValidator() { if (Konva$2.isUnminified) return function(val, attr) { if (!(val === true || val === false)) Util.warn(_formatValue(val) + " is a not valid value for \"" + attr + "\" attribute. The value should be a boolean."); return val; }; } function getComponentValidator(components) { if (Konva$2.isUnminified) return function(val, attr) { if (val === void 0 || val === null) return val; if (!Util.isObject(val)) Util.warn(_formatValue(val) + " is a not valid value for \"" + attr + "\" attribute. The value should be an object with properties " + components); return val; }; } //#endregion //#region node_modules/konva/lib/Factory.js var GET = "get"; var SET$1 = "set"; var Factory = { addGetterSetter(constructor, attr, def, validator, after) { Factory.addGetter(constructor, attr, def); Factory.addSetter(constructor, attr, validator, after); Factory.addOverloadedGetterSetter(constructor, attr); }, addGetter(constructor, attr, def) { const method = GET + Util._capitalize(attr); const isArr = Array.isArray(def); const getter = function() { const val = this.attrs[attr]; return val === void 0 ? isArr ? def.slice() : def : val; }; getter._def = def; constructor.prototype[method] = constructor.prototype[method] || getter; }, addSetter(constructor, attr, validator, after) { const method = SET$1 + Util._capitalize(attr); if (!constructor.prototype[method]) Factory.overWriteSetter(constructor, attr, validator, after); }, overWriteSetter(constructor, attr, validator, after) { const method = SET$1 + Util._capitalize(attr); constructor.prototype[method] = function(val) { if (validator && val !== void 0 && val !== null) val = validator.call(this, val, attr); this._setAttr(attr, val); if (after) after.call(this); return this; }; }, addComponentsGetterSetter(constructor, attr, components, validator, after) { const len = components.length, capitalize = Util._capitalize, getter = GET + capitalize(attr), setter = SET$1 + capitalize(attr), keys = components.map((c) => attr + capitalize(c)), getters = keys.map((key) => GET + capitalize(key)); constructor.prototype[getter] = function() { const ret = {}; for (let n = 0; n < len; n++) { const get = this[getters[n]]; ret[components[n]] = get ? get.call(this) : this.attrs[keys[n]]; } return ret; }; const basicValidator = getComponentValidator(components); constructor.prototype[setter] = function(val) { const oldVal = this[getter](); if (validator) val = validator.call(this, val, attr); if (basicValidator) basicValidator.call(this, val, attr); for (const key in val) { if (!val.hasOwnProperty(key)) continue; this._setAttr(attr + capitalize(key), val[key]); } if (!val) components.forEach((component) => { this._setAttr(attr + capitalize(component), void 0); }); this._fireChangeEvent(attr, oldVal, val); if (after) after.call(this); return this; }; Factory.addOverloadedGetterSetter(constructor, attr); }, addOverloadedGetterSetter(constructor, attr) { const capitalizedAttr = Util._capitalize(attr), setter = SET$1 + capitalizedAttr, getter = GET + capitalizedAttr; const accessor = function() { if (arguments.length) { this[setter](arguments[0]); return this; } return this[getter](); }; constructor.prototype[attr] = accessor; }, backCompat(constructor, methods) { Util.each(methods, function(oldMethodName, newMethodName) { const method = constructor.prototype[newMethodName]; const oldGetter = GET + Util._capitalize(oldMethodName); const oldSetter = SET$1 + Util._capitalize(oldMethodName); function deprecated() { Util.error("\"" + oldMethodName + "\" method is deprecated and will be removed soon. Use \"\"" + newMethodName + "\" instead."); return method.apply(this, arguments); } constructor.prototype[oldMethodName] = deprecated; constructor.prototype[oldGetter] = deprecated; constructor.prototype[oldSetter] = deprecated; }); }, afterSetFilter() { this._filterUpToDate = false; } }; //#endregion //#region node_modules/konva/lib/Node.js function parseCSSFilters(cssFilter) { const steps = []; const filterRegex = /(\w+)\(([^)]*)\)/g; let match; while ((match = filterRegex.exec(cssFilter)) !== null) { const [, name, argument] = match; if (![ "blur", "brightness", "contrast", "grayscale", "sepia", "invert" ].includes(name)) { Util.warn(`CSS filter "${name}" is not supported in fallback mode. Consider using function filters for better compatibility.`); continue; } const value = argument.trim() === "" ? name === "blur" ? 0 : 1 : parseFloat(argument) / (argument.includes("%") ? 100 : 1); steps.push({ name, value }); } return function(imageData, pixelRatio = 1) { var _a; for (const { name, value } of steps) { if ([ "grayscale", "sepia", "invert" ].includes(name)) { const amount = Math.min(1, Math.max(0, value)); const data = imageData.data; for (let i = 0; i < data.length; i += 4) { const r = data[i], g = data[i + 1], b = data[i + 2]; let red, green, blue; if (name === "grayscale") red = green = blue = .2126 * r + .7152 * g + .0722 * b; else if (name === "sepia") { red = .393 * r + .769 * g + .189 * b; green = .349 * r + .686 * g + .168 * b; blue = .272 * r + .534 * g + .131 * b; } else { red = 255 - r; green = 255 - g; blue = 255 - b; } data[i] = r + (red - r) * amount; data[i + 1] = g + (green - g) * amount; data[i + 2] = b + (blue - b) * amount; } continue; } const filter = (_a = Konva$2.Filters) === null || _a === void 0 ? void 0 : _a[Util._capitalize(name)]; if (!filter) continue; const context = Object.create(this); context.attrs = { ...this.attrs }; if (name === "blur") context.attrs.blurRadius = value * .5; if (name === "brightness") context.attrs.brightness = value; if (name === "contrast") context.attrs.contrast = 100 * (Math.sqrt(value) - 1); filter.call(context, imageData, pixelRatio); } }; } var ABSOLUTE_OPACITY = "absoluteOpacity"; var ABSOLUTE_TRANSFORM = "absoluteTransform"; var CHANGE = "Change"; var CHILDREN = "children"; var KONVA = "konva"; var LISTENING = "listening"; var NON_BUBBLING_EVENTS = [ "mouseenter", "mouseleave", "pointerenter", "pointerleave", "touchenter", "touchleave" ]; var SET = "set"; var SHAPE = "Shape"; var SPACE$1 = " "; var STAGE$1 = "stage"; var TRANSFORM = "transform"; var UPPER_STAGE = "Stage"; var VISIBLE = "visible"; var TRANSFORM_CHANGE_STR$1 = [ "xChange.konva", "yChange.konva", "scaleXChange.konva", "scaleYChange.konva", "skewXChange.konva", "skewYChange.konva", "rotationChange.konva", "offsetXChange.konva", "offsetYChange.konva", "transformsEnabledChange.konva" ].join(SPACE$1); var idCounter$1 = 1; /** * Node constructor. Nodes are entities that can be transformed, layered, * and have bound events. The stage, layers, groups, and shapes all extend Node. * @constructor * @memberof Konva * @param {Object} config * @@nodeParams */ var Node = class Node { constructor(config) { this._id = idCounter$1++; this.eventListeners = {}; this.attrs = {}; this.index = 0; this.parent = null; this._cache = {}; this._canvasCache = null; this._batchingTransformChange = false; this._needClearTransformCache = false; this._filterUpToDate = false; this._isUnderCache = false; this._dragEventId = null; this._shouldFireChangeEvents = false; this.setAttrs(config); this._shouldFireChangeEvents = true; } hasChildren() { return false; } _clearCache(attr) { if ((attr === TRANSFORM || attr === ABSOLUTE_TRANSFORM) && this._cache[attr]) this._cache[attr].dirty = true; else if (attr) this._cache[attr] = void 0; else { this._cache = {}; if (this._attrsVersion !== void 0) this._attrsVersion++; } } _releaseCanvasCache() { const cache = this._canvasCache; if (cache) { Util.releaseCanvas(cache.scene._canvas, cache.filter._canvas, ...cache.hit ? [cache.hit._canvas] : []); this._canvasCache = null; } } _getCache(attr, privateGetter) { let cache = this._cache[attr]; if (cache === void 0 || (attr === TRANSFORM || attr === ABSOLUTE_TRANSFORM) && cache.dirty === true) { cache = privateGetter.call(this); this._cache[attr] = cache; } return cache; } _getCanvasCache() { return this._canvasCache; } _clearSelfAndDescendantCache(attr) { this._clearCache(attr); if (attr === void 0 || attr === ABSOLUTE_TRANSFORM) this.fire("absoluteTransformChange"); } static _runAfterUpdateBatch(cb) { if (Node._updateBatchDepth > 0) Node._pendingUpdates.add(cb); else cb(); } static _flushUpdateBatch() { if (Node._updateBatchDepth > 0) return; const callbacks = Node._pendingUpdates; if (!callbacks.size) return; Node._pendingUpdates = /* @__PURE__ */ new Set(); callbacks.forEach((callback) => callback()); } static _updateBatch(fn) { Node._updateBatchDepth++; try { return fn(); } finally { Node._updateBatchDepth--; Node._flushUpdateBatch(); } } static _beginUpdateBatch() { Node._updateBatchDepth++; let finished = false; return () => { if (finished) return; finished = true; Node._updateBatchDepth--; Node._flushUpdateBatch(); }; } /** * clear cached canvas * @method * @name Konva.Node#clearCache * @returns {Konva.Node} * @example * node.clearCache(); */ clearCache() { this._releaseCanvasCache(); this._clearSelfAndDescendantCache(); this._requestDraw(); return this; } /** * cache node to improve drawing performance, apply filters, or create more accurate * hit regions. For all basic shapes size of cache canvas will be automatically detected. * If you need to cache your custom `Konva.Shape` instance you have to pass shape's bounding box * properties. Look at [https://konvajs.org/docs/performance/Shape_Caching.html](https://konvajs.org/docs/performance/Shape_Caching.html) for more information. * @method * @name Konva.Node#cache * @param {Object} [config] * @param {Number} [config.x] * @param {Number} [config.y] * @param {Number} [config.width] * @param {Number} [config.height] * @param {Number} [config.offset] increase canvas size by `offset` pixel in all directions. * @param {Boolean} [config.drawBorder] when set to true, a red border will be drawn around the cached * region for debugging purposes * @param {Number} [config.pixelRatio] pixel ratio of the cache canvas, the canvas pixels per CSS pixel of the node. Default is `Konva.pixelRatio`, the device pixel ratio. A higher value keeps the cache sharp when the node is scaled up. * @param {Boolean} [config.imageSmoothingEnabled] control imageSmoothingEnabled property of created canvas for cache * @param {Number} [config.hitCanvasPixelRatio] change quality (or pixel ratio) of cached hit canvas. * @returns {Konva.Node} * @example * // cache a shape with the x,y position of the bounding box at the center and * // the width and height of the bounding box equal to the width and height of * // the shape obtained from shape.width() and shape.height() * image.cache(); * * // cache a node and define the bounding box position and size * node.cache({ * x: -30, * y: -30, * width: 100, * height: 200 * }); * * // cache a node and draw a red border around the bounding box * // for debugging purposes * node.cache({ * x: -30, * y: -30, * width: 100, * height: 200, * offset : 10, * drawBorder: true * }); */ cache(config) { const conf = config || {}; let rect = {}; if (conf.x === void 0 || conf.y === void 0 || conf.width === void 0 || conf.height === void 0) { const wasUnderCache = this._isUnderCache; this._isUnderCache = true; rect = this.getClientRect({ skipTransform: true, relativeTo: this.getParent() || void 0 }); this._isUnderCache = wasUnderCache; } let x = conf.x === void 0 ? Math.floor(rect.x) : conf.x, y = conf.y === void 0 ? Math.floor(rect.y) : conf.y, width = Math.ceil(conf.width || rect.x + rect.width - x), height = Math.ceil(conf.height || rect.y + rect.height - y), pixelRatio = conf.pixelRatio, offset = conf.offset || 0, drawBorder = conf.drawBorder || false, hitCanvasPixelRatio = conf.hitCanvasPixelRatio || 1; if (width <= 0 || height <= 0 || !isFinite(x + y + width + height)) { Util.error(`Can not cache the node. Its size is 0 or its bounds are not finite numbers (${x}, ${y}, ${width}x${height}). Caching is skipped.`); return this; } width += offset * 2; height += offset * 2; x -= offset; y -= offset; const cachedSceneCanvas = new SceneCanvas({ pixelRatio, width, height }), cachedFilterCanvas = new SceneCanvas({ pixelRatio, width: 0, height: 0, willReadFrequently: true }), sceneContext = cachedSceneCanvas.getContext(); cachedSceneCanvas.isCache = true; this._releaseCanvasCache(); this._filterUpToDate = false; if (conf.imageSmoothingEnabled === false) { cachedSceneCanvas.getContext()._context.imageSmoothingEnabled = false; cachedFilterCanvas.getContext()._context.imageSmoothingEnabled = false; } sceneContext.save(); sceneContext.translate(-x, -y); this._isUnderCache = true; this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY); try { this.drawScene(cachedSceneCanvas, this); } catch (e) { Util.releaseCanvas(cachedSceneCanvas._canvas); throw e; } finally { this._isUnderCache = false; this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY); sceneContext.restore(); cachedSceneCanvas._releaseIsolationCanvas(); } if (drawBorder) { sceneContext.save(); sceneContext.beginPath(); sceneContext.rect(0, 0, width, height); sceneContext.closePath(); sceneContext.setAttr("strokeStyle", "red"); sceneContext.setAttr("lineWidth", 5); sceneContext.stroke(); sceneContext.restore(); } this._canvasCache = { scene: cachedSceneCanvas, filter: cachedFilterCanvas, hit: null, hitConfig: { pixelRatio: hitCanvasPixelRatio, width, height }, x, y }; this._clearSelfAndDescendantCache(); this._requestDraw(); return this; } _getCachedHitCanvas(top) { if (top === this) return null; const cache = this._getCanvasCache(); if (!cache) return null; if (cache.hit) return cache.hit; const hitCanvas = new HitCanvas(cache.hitConfig); hitCanvas.isCache = true; const hitContext = hitCanvas.getContext(); hitContext.save(); hitContext.translate(-cache.x, -cache.y); this.drawHit(hitCanvas, this); hitContext.restore(); cache.hit = hitCanvas; return hitCanvas; } /** * determine if node is currently cached * @method * @name Konva.Node#isCached * @returns {Boolean} */ isCached() { return !!this._canvasCache; } /** * Return client rectangle {x, y, width, height} of node. This rectangle also include all styling (strokes, shadows, etc). * The purpose of the method is similar to getBoundingClientRect API of the DOM. * Non-scaling stroke padding is converted from its drawing canvas to the requested coordinates. * Cached strokes use the cache's coordinates; their pixels scale with the cached bitmap. * @method * @name Konva.Node#getClientRect * @param {Object} config * @param {Boolean} [config.skipTransform] should we apply transform to node for calculating rect? * @param {Boolean} [config.skipShadow] should we apply shadow to the node for calculating bound box? * @param {Boolean} [config.skipStroke] should we apply stroke to the node for calculating bound box? * @param {Object} [config.relativeTo] calculate client rect relative to one of the parents * @returns {Object} rect with {x, y, width, height} properties * @example * var rect = new Konva.Rect({ * width : 100, * height : 100, * x : 50, * y : 50, * strokeWidth : 4, * stroke : 'black', * offsetX : 50, * scaleY : 2 * }); * * // get client rect without think off transformations (position, rotation, scale, offset, etc) * rect.getClientRect({ skipTransform: true}); * // returns { * // x : -2, // two pixels for stroke / 2 * // y : -2, * // width : 104, // increased by 4 for stroke * // height : 104 * //} * * // get client rect with transformation applied * rect.getClientRect(); * // returns Object {x: -2, y: 46, width: 104, height: 208} */ getClientRect(config) { throw new Error("abstract \"getClientRect\" method call"); } _getCachedSceneRect(config) { const cache = config._forDrawing && !this._isUnderCache && this._getCanvasCache(); if (!cache) return; const rect = { x: cache.x, y: cache.y, width: cache.scene.width / cache.scene.pixelRatio, height: cache.scene.height / cache.scene.pixelRatio }; return config.skipTransform ? rect : this._transformedRect(rect, config.relativeTo); } _transformedRect(rect, top) { return this.getAbsoluteTransform(top)._getTransformedRect(rect); } _drawCachedSceneCanvas(context) { context.save(); context._applyOpacity(this); context._applyGlobalCompositeOperation(this); const canvasCache = this._getCanvasCache(); context.translate(canvasCache.x, canvasCache.y); const cacheCanvas = this._getCachedSceneCanvas(); const ratio = cacheCanvas.pixelRatio; context.drawImage(cacheCanvas._canvas, 0, 0, cacheCanvas.width / ratio, cacheCanvas.height / ratio); context.restore(); } _drawCachedHitCanvas(context, hitCanvas) { const canvasCache = this._getCanvasCache(); context.save(); context.translate(canvasCache.x, canvasCache.y); context.drawImage(hitCanvas._canvas, 0, 0, hitCanvas.width / hitCanvas.pixelRatio, hitCanvas.height / hitCanvas.pixelRatio); context.restore(); } _getCachedSceneCanvas() { let filters = this.filters(), cachedCanvas = this._getCanvasCache(), sceneCanvas = cachedCanvas.scene, filterCanvas = cachedCanvas.filter, filterContext = filterCanvas.getContext(), len, imageData, n, filter; if (!filters || filters.length === 0) return sceneCanvas; if (this._filterUpToDate) return filterCanvas; let useNativeOnly = true; for (let i = 0; i < filters.length; i++) if (typeof filters[i] !== "string" || !isCSSFiltersSupported()) { useNativeOnly = false; break; } const ratio = sceneCanvas.pixelRatio; filterCanvas.setSizeIfChanged(sceneCanvas._logicalWidth, sceneCanvas._logicalHeight); if (useNativeOnly) { const finalFilter = filters.join(" ").replace(/url\((?:[^()"']|"[^"]*"|'[^']*')*\)|"[^"]*"|'[^']*'|([-+]?(?:\d*\.)?\d+(?:e[-+]?\d+)?)(px|em|rem|ex|ch|cap|ic|lh|rlh|vw|vh|vmin|vmax|cm|mm|q|in|pt|pc)\b/gi, (token, value, unit) => value === void 0 ? token : `${Number(value) * ratio}${unit}`); filterContext.clear(); filterContext.save(); filterContext.setAttr("filter", finalFilter); filterContext.drawImage(sceneCanvas._canvas, 0, 0, sceneCanvas.getWidth() / ratio, sceneCanvas.getHeight() / ratio); filterContext.restore(); this._filterUpToDate = true; return filterCanvas; } try { len = filters.length; filterContext.clear(); filterContext.drawImage(sceneCanvas._canvas, 0, 0, sceneCanvas.getWidth() / ratio, sceneCanvas.getHeight() / ratio); imageData = filterContext.getImageData(0, 0, filterCanvas.getWidth(), filterCanvas.getHeight()); for (n = 0; n < len; n++) { filter = filters[n]; if (typeof filter === "string") filter = parseCSSFilters(filter); filter.call(this, imageData, ratio); } filterContext.putImageData(imageData, 0, 0); } catch (e) { Util.error("Unable to apply filter. " + e.message + " This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html."); } this._filterUpToDate = true; return filterCanvas; } /** * bind events to the node. KonvaJS supports mouseover, mousemove, * mouseout, mouseenter, mouseleave, mousedown, mouseup, wheel, contextmenu, click, dblclick, touchstart, touchmove, * touchend, tap, dbltap, dragstart, dragmove, dragend and destroy events. * Pass in a string of events delimited by a space to bind multiple events at once * such as 'mousedown mouseup mousemove'. Include a namespace to bind an * event by name such as 'click.foobar'. * @method * @name Konva.Node#on * @param {String} evtStr e.g. 'click', 'mousedown touchstart', 'mousedown.foo touchstart.foo' * @param {Function} handler The handler function. The first argument of that function is event object. Event object has `target` as main target of the event, `currentTarget` as current node listener and `evt` as native browser event. * @returns {Konva.Node} * @example * // add click listener * node.on('click', function() { * console.log('you clicked me!'); * }); * * // get the target node * node.on('click', function(evt) { * console.log(evt.target); * }); * * // stop event propagation * node.on('click', function(evt) { * evt.cancelBubble = true; * }); * * // bind multiple listeners * node.on('click touchstart', function() { * console.log('you clicked/touched me!'); * }); * * // namespace listener * node.on('click.foo', function() { * console.log('you clicked/touched me!'); * }); * * // get the event type * node.on('click tap', function(evt) { * var eventType = evt.type; * }); * * // get native event object * node.on('click tap', function(evt) { * var nativeEvent = evt.evt; * }); * * // for change events, get the old and new val * node.on('xChange', function(evt) { * var oldVal = evt.oldVal; * var newVal = evt.newVal; * }); * * // get event targets * // with event delegations * layer.on('click', 'Group', function(evt) { * var shape = evt.target; * var group = evt.currentTarget; * }); */ on(...args) { this._prepareListeners(); const evtStr = args[0]; const selectorOrHandler = args[1]; args[2]; if (args.length === 3) return this._delegate.apply(this, args); const events = evtStr.split(SPACE$1); for (let n = 0; n < events.length; n++) { const parts = events[n].split("."); const baseEvent = parts[0]; const name = parts[1] || ""; if (!this.eventListeners[baseEvent]) this.eventListeners[baseEvent] = []; this.eventListeners[baseEvent].push({ name, handler: selectorOrHandler }); } return this; } /** * remove event bindings from the node. Pass in a string of * event types delimmited by a space to remove multiple event * bindings at once such as 'mousedown mouseup mousemove'. * include a namespace to remove an event binding by name * such as 'click.foobar'. If you only give a name like '.foobar', * all events in that namespace will be removed. * @method * @name Konva.Node#off * @param {String} evtStr e.g. 'click', 'mousedown touchstart', '.foobar' * @returns {Konva.Node} * @example * // remove listener * node.off('click'); * * // remove multiple listeners * node.off('click touchstart'); * * // remove listener by name * node.off('click.foo'); */ _prepareListeners() { if (this === this.constructor.prototype) { if (!this.hasOwnProperty("eventListeners")) this.eventListeners = {}; Node.protoListenerMap = /* @__PURE__ */ new WeakMap(); } } off(evtStr, callback) { this._prepareListeners(); let events = (evtStr || "").split(SPACE$1), len = events.length, n, t, event, parts, baseEvent, name; if (!evtStr) for (t in this.eventListeners) this._off(t); for (n = 0; n < len; n++) { event = events[n]; parts = event.split("."); baseEvent = parts[0]; name = parts[1]; if (baseEvent) { if (this.eventListeners[baseEvent]) this._off(baseEvent, name, callback); } else for (t in this.eventListeners) this._off(t, name, callback); } return this; } dispatchEvent(evt) { const e = { target: this, type: evt.type, evt }; this.fire(evt.type, e); return this; } addEventListener(type, handler) { this.on(type, function(evt) { handler.call(this, evt.evt); }); return this; } removeEventListener(type) { this.off(type); return this; } _delegate(event, selector, handler) { const stopNode = this; this.on(event, function(evt) { const targets = evt.target.findAncestors(selector, true, stopNode); for (let i = 0; i < targets.length; i++) { evt = Util.cloneObject(evt); evt.currentTarget = targets[i]; handler.call(targets[i], evt); } }); return this; } /** * remove a node from parent, but don't destroy. You can reuse the node later. * @method * @name Konva.Node#remove * @returns {Konva.Node} * @example * node.remove(); */ remove() { if (this.isDragging()) this.stopDrag(); DD._dragElements.delete(this._id); DD._dragElements.forEach((elem, key) => { if (this.isAncestorOf(elem.node)) DD._dragElements.delete(key); }); this._remove(); return this; } _clearCaches() { this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM); this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY); this._clearSelfAndDescendantCache(STAGE$1); this._clearSelfAndDescendantCache(VISIBLE); this._clearSelfAndDescendantCache(LISTENING); } _remove() { const parent = this.getParent(); if (parent && parent.children) { parent.children.splice(this.index, 1); parent._setChildrenIndices(); this.parent = null; } this._clearCaches(); } /** * remove and destroy a node. Kill it and delete forever! You should not reuse node after destroy(). * If the node is a container (Group, Stage or Layer) it will destroy all children too. * The node fires a `destroy` event first, so anything holding a reference to it can let go. * When an ancestor is being destroyed the node is already detached from its parent at that point. * @method * @name Konva.Node#destroy * @example * node.on('destroy', () => console.log('gone')); * node.destroy(); */ destroy() { this._fire("destroy", { target: this }); releaseCapturesOf(this); this.remove(); this.clearCache(); return this; } /** * get attr * @method * @name Konva.Node#getAttr * @param {String} attr * @returns {Integer|String|Object|Array} * @example * var x = node.getAttr('x'); */ getAttr(attr) { const method = "get" + Util._capitalize(attr); if (Util._isFunction(this[method])) return this[method](); return this.attrs[attr]; } /** * get ancestors * @method * @name Konva.Node#getAncestors * @returns {Array} * @example * shape.getAncestors().forEach(function(node) { * console.log(node.id()); * }) */ getAncestors() { let parent = this.getParent(), ancestors = []; while (parent) { ancestors.push(parent); parent = parent.getParent(); } return ancestors; } /** * get attrs object literal * @method * @name Konva.Node#getAttrs * @returns {Object} */ getAttrs() { return this.attrs || {}; } /** * set multiple attrs at once using an object literal * @method * @name Konva.Node#setAttrs * @param {Object} config object containing key value pairs * @returns {Konva.Node} * @example * node.setAttrs({ * x: 5, * fill: 'red' * }); */ setAttrs(config) { this._batchTransformChanges(() => { let key, method; if (!config) return this; for (key in config) { if (key === CHILDREN) continue; method = SET + Util._capitalize(key); if (Util._isFunction(this[method])) this[method](config[key]); else this._setAttr(key, config[key]); } }); return this; } /** * determine if node is listening for events by taking into account ancestors. * * Parent | Self | isListening * listening | listening | * ----------+-----------+------------ * T | T | T * T | F | F * F | T | F * F | F | F * * @method * @name Konva.Node#isListening * @returns {Boolean} */ isListening() { return this._getCache(LISTENING, this._isListening); } _isListening(relativeTo) { if (!this.listening()) return false; const parent = this.getParent(); if (parent && parent !== relativeTo && this !== relativeTo) return parent._isListening(relativeTo); else return true; } /** * determine if node is visible by taking into account ancestors. * * Parent | Self | isVisible * visible | visible | * ----------+-----------+------------ * T | T | T * T | F | F * F | T | F * F | F | F * @method * @name Konva.Node#isVisible * @returns {Boolean} */ isVisible() { return this._getCache(VISIBLE, this._isVisible); } _isVisible(relativeTo) { if (!this.visible()) return false; const parent = this.getParent(); if (parent && parent !== relativeTo && this !== relativeTo) return parent._isVisible(relativeTo); else return true; } shouldDrawHit(top) { if (top) return this._isVisible(top) && this._isListening(top); return this.isListening() && this.isVisible(); } /** * show node. set visible = true * @method * @name Konva.Node#show * @returns {Konva.Node} */ show() { this.visible(true); return this; } /** * hide node. Hidden nodes are no longer detectable * @method * @name Konva.Node#hide * @returns {Konva.Node} */ hide() { this.visible(false); return this; } getZIndex() { return this.index || 0; } /** * get absolute z-index which takes into account sibling * and ancestor indices * @method * @name Konva.Node#getAbsoluteZIndex * @returns {Integer} */ getAbsoluteZIndex() { let depth = this.getDepth(), that = this, index = 0, nodes, len, n, child; function addChildren(children) { nodes = []; len = children.length; for (n = 0; n < len; n++) { child = children[n]; index++; if (child.nodeType !== SHAPE) nodes = nodes.concat(child.children); if (child._id === that._id) n = len; } if (nodes.length > 0 && nodes[0].getDepth() <= depth) addChildren(nodes); } const stage = this.getStage(); if (that.nodeType !== UPPER_STAGE && stage) addChildren(stage.children); return index; } /** * get node depth in node tree. Returns an integer. * e.g. Stage depth will always be 0. Layers will always be 1. Groups and Shapes will always * be >= 2 * @method * @name Konva.Node#getDepth * @returns {Integer} * @example * var depth = shape.getDepth(); // 2 for a shape right inside of a layer */ getDepth() { let depth = 0, parent = this.parent; while (parent) { depth++; parent = parent.parent; } return depth; } _batchTransformChanges(func) { if (this._batchingTransformChange) { func(); return; } Node._updateBatch(() => { this._batchingTransformChange = true; try { func(); } finally { this._batchingTransformChange = false; if (this._needClearTransformCache) { this._needClearTransformCache = false; this._clearCache(TRANSFORM); this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM); } } }); } setPosition(pos) { this._batchTransformChanges(() => { this.x(pos.x); this.y(pos.y); }); return this; } getPosition() { return { x: this.x(), y: this.y() }; } /** * get position of first pointer (like mouse or first touch) relative to local coordinates of current node * @method * @name Konva.Node#getRelativePointerPosition * @returns {Konva.Node} * @example * * // let's think we have a rectangle at position x = 10, y = 10 * // now we clicked at x = 15, y = 15 of the stage * // if you want to know position of the click, related to the rectangle you can use * rect.getRelativePointerPosition(); */ getRelativePointerPosition() { const stage = this.getStage(); if (!stage) return null; const pos = stage.getPointerPosition(); if (!pos) return null; const transform = this.getAbsoluteTransform().copy(); transform.invert(); return transform.point(pos); } /** * get absolute position of a node. That function can be used to calculate absolute position, but relative to any ancestor * @method * @name Konva.Node#getAbsolutePosition * @param {Object} [top] optional ancestor node * @returns {Konva.Node} * @example * * // returns absolute position relative to top-left corner of canvas * node.getAbsolutePosition(); * * // calculate absolute position of node, inside stage * // so stage transforms are ignored * node.getAbsolutePosition(stage) */ getAbsolutePosition(top) { const absoluteMatrix = this.getAbsoluteTransform(top).getMatrix(), absoluteTransform = new Transform(), offset = this.offset(); absoluteTransform.m = absoluteMatrix.slice(); absoluteTransform.translate(offset.x, offset.y); return absoluteTransform.getTranslation(); } setAbsolutePosition(pos) { const { x, y, ...origTrans } = this._clearTransform(); this.attrs.x = x; this.attrs.y = y; this._clearCache(TRANSFORM); const it = this._getAbsoluteTransform().copy(); const invertible = it.isInvertible(); it.invert(); it.translate(pos.x, pos.y); const { x: dx, y: dy } = it.getTranslation(); this._setTransform(origTrans); if (invertible) this.setPosition({ x: this.attrs.x + dx, y: this.attrs.y + dy }); else Util.warn("Cannot set the absolute position: the absolute transform is not invertible (an ancestor has a zero scale)."); this._clearCache(TRANSFORM); this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM); return this; } _setTransform(trans) { let key; for (key in trans) this.attrs[key] = trans[key]; } _clearTransform() { const trans = { x: this.x(), y: this.y(), rotation: this.rotation(), scaleX: this.scaleX(), scaleY: this.scaleY(), offsetX: this.offsetX(), offsetY: this.offsetY(), skewX: this.skewX(), skewY: this.skewY() }; this.attrs.x = 0; this.attrs.y = 0; this.attrs.rotation = 0; this.attrs.scaleX = 1; this.attrs.scaleY = 1; this.attrs.offsetX = 0; this.attrs.offsetY = 0; this.attrs.skewX = 0; this.attrs.skewY = 0; return trans; } /** * move node by an amount relative to its current position * @method * @name Konva.Node#move * @param {Object} change * @param {Number} change.x * @param {Number} change.y * @returns {Konva.Node} * @example * // move node in x direction by 1px and y direction by 2px * node.move({ * x: 1, * y: 2 * }); */ move(change) { let changeX = change.x, changeY = change.y, x = this.x(), y = this.y(); if (changeX !== void 0) x += changeX; if (changeY !== void 0) y += changeY; this.setPosition({ x, y }); return this; } /** * rotate node by an amount in degrees relative to its current rotation * @method * @name Konva.Node#rotate * @param {Number} theta * @returns {Konva.Node} */ rotate(theta) { this.rotation(this.rotation() + theta); return this; } /** * move node to the top of its siblings * @method * @name Konva.Node#moveToTop * @returns {Boolean} */ moveToTop() { if (!this.parent) { Util.warn("Node has no parent. moveToTop function is ignored."); return false; } const index = this.index; if (index < this.parent.children.length - 1) { this.parent.children.splice(index, 1); this.parent.children.push(this); this.parent._setChildrenIndices(); return true; } return false; } /** * move node up * @method * @name Konva.Node#moveUp * @returns {Boolean} flag is moved or not */ moveUp() { if (!this.parent) { Util.warn("Node has no parent. moveUp function is ignored."); return false; } const index = this.index; if (index < this.parent.children.length - 1) { this.parent.children.splice(index, 1); this.parent.children.splice(index + 1, 0, this); this.parent._setChildrenIndices(); return true; } return false; } /** * move node down * @method * @name Konva.Node#moveDown * @returns {Boolean} */ moveDown() { if (!this.parent) { Util.warn("Node has no parent. moveDown function is ignored."); return false; } const index = this.index; if (index > 0) { this.parent.children.splice(index, 1); this.parent.children.splice(index - 1, 0, this); this.parent._setChildrenIndices(); return true; } return false; } /** * move node to the bottom of its siblings * @method * @name Konva.Node#moveToBottom * @returns {Boolean} */ moveToBottom() { if (!this.parent) { Util.warn("Node has no parent. moveToBottom function is ignored."); return false; } const index = this.index; if (index > 0) { this.parent.children.splice(index, 1); this.parent.children.unshift(this); this.parent._setChildrenIndices(); return true; } return false; } setZIndex(zIndex) { if (!this.parent) { Util.warn("Node has no parent. zIndex parameter is ignored."); return this; } if (zIndex < 0 || zIndex >= this.parent.children.length) Util.warn("Unexpected value " + zIndex + " for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to " + (this.parent.children.length - 1) + "."); const index = this.index; this.parent.children.splice(index, 1); this.parent.children.splice(zIndex, 0, this); this.parent._setChildrenIndices(); return this; } /** * get absolute opacity * @method * @name Konva.Node#getAbsoluteOpacity * @returns {Number} */ getAbsoluteOpacity() { return this._getCache(ABSOLUTE_OPACITY, this._getAbsoluteOpacity); } _getAbsoluteOpacity() { let absOpacity = this.opacity(); const parent = this.getParent(); if (parent && !parent._isUnderCache) absOpacity *= parent.getAbsoluteOpacity(); return absOpacity; } /** * move node to another container * @method * @name Konva.Node#moveTo * @param {Container} newContainer * @returns {Konva.Node} * @example * // move node from current layer into layer2 * node.moveTo(layer2); */ moveTo(newContainer) { if (this.getParent() !== newContainer) { this._remove(); newContainer.add(this); } return this; } /** * convert Node into an object for serialization. Returns an object. * @method * @name Konva.Node#toObject * @returns {Object} */ toObject() { var _a; const attrs = this.getAttrs(); let key, val, nonPlainObject; const obj = { attrs: {}, className: this.getClassName() }; for (key in attrs) { val = attrs[key]; if (val instanceof TypedArray) val = Array.from(val); nonPlainObject = Util.isObject(val) && !Util._isPlainObject(val) && !Util._isArray(val); if (nonPlainObject) continue; if (((_a = this["get" + Util._capitalize(key)]) === null || _a === void 0 ? void 0 : _a._def) !== val || key === "brightness" || key === "threshold") obj.attrs[key] = key === "filters" && Util._isArray(val) ? val.filter((filter) => typeof filter === "string") : Util.isObject(val) ? Util._prepareToStringify(val) : val; } return obj; } /** * convert Node into a JSON string. Returns a JSON string. * @method * @name Konva.Node#toJSON * @returns {String} */ toJSON() { return JSON.stringify(this.toObject()); } /** * get parent container * @method * @name Konva.Node#getParent * @returns {Konva.Node} */ getParent() { return this.parent; } /** * get all ancestors (parent then parent of the parent, etc) of the node * @method * @name Konva.Node#findAncestors * @param {String} selector selector for search * @param {Boolean} [includeSelf] show we think that node is ancestro itself? * @param {Konva.Node} [stopNode] optional node where we need to stop searching (one of ancestors) * @returns {Array} [ancestors] * @example * // get one of the parent group * var parentGroups = node.findAncestors('Group'); */ findAncestors(selector, includeSelf, stopNode) { const res = []; if (includeSelf && this._isMatch(selector)) res.push(this); let ancestor = this.parent; while (ancestor) { if (ancestor === stopNode) return res; if (ancestor._isMatch(selector)) res.push(ancestor); ancestor = ancestor.parent; } return res; } isAncestorOf(node) { return false; } /** * get ancestor (parent or parent of the parent, etc) of the node that match passed selector * @method * @name Konva.Node#findAncestor * @param {String} selector selector for search * @param {Boolean} [includeSelf] show we think that node is ancestro itself? * @param {Konva.Node} [stopNode] optional node where we need to stop searching (one of ancestors) * @returns {Konva.Node} ancestor * @example * // get one of the parent group * var group = node.findAncestors('.mygroup'); */ findAncestor(selector, includeSelf, stopNode) { return this.findAncestors(selector, includeSelf, stopNode)[0]; } _isMatch(selector) { if (!selector) return false; if (typeof selector === "function") return selector(this); let selectorArr = selector.replace(/ /g, "").split(","), len = selectorArr.length, n, sel; for (n = 0; n < len; n++) { sel = selectorArr[n]; if (!Util.isValidSelector(sel)) { Util.warn("Selector \"" + sel + "\" is invalid. Allowed selectors examples are \"#foo\", \".bar\" or \"Group\"."); Util.warn("If you have a custom shape with such className, please change it to start with upper letter like \"Triangle\"."); Util.warn("Konva is awesome, right?"); } if (sel.charAt(0) === "#") { if (this.id() === sel.slice(1)) return true; } else if (sel.charAt(0) === ".") { if (this.hasName(sel.slice(1))) return true; } else if (this.className === sel || this.nodeType === sel) return true; } return false; } /** * get layer ancestor * @method * @name Konva.Node#getLayer * @returns {Konva.Layer} */ getLayer() { const parent = this.getParent(); return parent ? parent.getLayer() : null; } /** * get stage ancestor * @method * @name Konva.Node#getStage * @returns {Konva.Stage} */ getStage() { return this._getCache(STAGE$1, this._getStage); } _getStage() { const parent = this.getParent(); if (parent) return parent.getStage(); else return null; } /** * fire event * @method * @name Konva.Node#fire * @param {String} eventType event type. can be a regular event, like click, mouseover, or mouseout, or it can be a custom event, like myCustomEvent * @param {Event} [evt] event object * @param {Boolean} [bubble] setting the value to false, or leaving it undefined, will result in the event * not bubbling. Setting the value to true will result in the event bubbling. * @returns {Konva.Node} * @example * // manually fire click event * node.fire('click'); * * // fire custom event * node.fire('foo'); * * // fire custom event with custom event object * node.fire('foo', { * bar: 10 * }); * * // fire click event that bubbles * node.fire('click', null, true); */ fire(eventType, evt, bubble) { evt = evt || {}; evt.target = evt.target || this; if (bubble) this._fireAndBubble(eventType, evt); else this._fire(eventType, evt); return this; } /** * get absolute transform of the node which takes into * account its ancestor transforms * @method * @name Konva.Node#getAbsoluteTransform * @returns {Konva.Transform} */ getAbsoluteTransform(top) { if (top || this._hasCachedAncestor()) return this._getAbsoluteTransform(top); return this._getCache(ABSOLUTE_TRANSFORM, this._getCachedAbsoluteTransform); } _hasCachedAncestor() { let parent = this.parent; while (parent) { if (parent.isCached()) return true; parent = parent.parent; } return false; } _getAbsoluteTransform(top) { const at = new Transform(); if (this === top) return at; if (this.parent && this.parent !== top) this.parent.getAbsoluteTransform(top).copyInto(at); return this._multiplyOwnTransform(at); } _getCachedAbsoluteTransform() { const at = this._cache[ABSOLUTE_TRANSFORM] || new Transform(); if (this.parent) this.parent.getAbsoluteTransform().copyInto(at); else at.reset(); this._multiplyOwnTransform(at); at.dirty = false; return at; } _multiplyOwnTransform(at) { const transformsEnabled = this.transformsEnabled(); if (transformsEnabled === "all") at.multiply(this.getTransform()); else if (transformsEnabled === "position") { const x = this.attrs.x || 0; const y = this.attrs.y || 0; const offsetX = this.attrs.offsetX || 0; const offsetY = this.attrs.offsetY || 0; at.translate(x - offsetX, y - offsetY); } return at; } /** * get absolute scale of the node which takes into * account its ancestor scales * @method * @name Konva.Node#getAbsoluteScale * @returns {Object} * @example * // get absolute scale x * var scaleX = node.getAbsoluteScale().x; */ getAbsoluteScale(top) { let parent = this; while (parent) { if (parent._isUnderCache) top = parent; parent = parent.getParent(); } const attrs = this.getAbsoluteTransform(top).decompose(); return { x: attrs.scaleX, y: attrs.scaleY }; } /** * get absolute rotation of the node which takes into * account its ancestor rotations * @method * @name Konva.Node#getAbsoluteRotation * @returns {Number} * @example * // get absolute rotation * var rotation = node.getAbsoluteRotation(); */ getAbsoluteRotation() { return this.getAbsoluteTransform().decompose().rotation; } /** * get transform of the node * @method * @name Konva.Node#getTransform * @returns {Konva.Transform} */ getTransform() { return this._getCache(TRANSFORM, this._getTransform); } _getTransform() { var _a, _b; const m = this._cache[TRANSFORM] || new Transform(); m.reset(); const x = this.x(), y = this.y(), rotation = Konva$2.getAngle(this.rotation()), scaleX = (_a = this.attrs.scaleX) !== null && _a !== void 0 ? _a : 1, scaleY = (_b = this.attrs.scaleY) !== null && _b !== void 0 ? _b : 1, skewX = this.attrs.skewX || 0, skewY = this.attrs.skewY || 0, offsetX = this.attrs.offsetX || 0, offsetY = this.attrs.offsetY || 0; if (x !== 0 || y !== 0) m.translate(x, y); if (rotation !== 0) m.rotate(rotation); if (skewX !== 0 || skewY !== 0) m.skew(skewX, skewY); if (scaleX !== 1 || scaleY !== 1) m.scale(scaleX, scaleY); if (offsetX !== 0 || offsetY !== 0) m.translate(-1 * offsetX, -1 * offsetY); m.dirty = false; return m; } /** * clone node. Returns a new Node instance with identical attributes. You can also override * the node properties with an object literal, enabling you to use an existing node as a template * for another node * @method * @name Konva.Node#clone * @param {Object} obj override attrs * @returns {Konva.Node} * @example * // simple clone * var clone = node.clone(); * * // clone a node and override the x position * var clone = rect.clone({ * x: 5 * }); */ clone(obj) { let attrs = Util.cloneObject(this.attrs), key, allListeners, len, n, listener; for (key in obj) attrs[key] = obj[key]; const node = new this.constructor(attrs); for (key in this.eventListeners) { allListeners = this.eventListeners[key]; len = allListeners.length; for (n = 0; n < len; n++) { listener = allListeners[n]; if (listener.name.indexOf(KONVA) < 0) { if (!node.eventListeners[key]) node.eventListeners[key] = []; node.eventListeners[key].push(listener); } } } return node; } _toKonvaCanvas(config) { config = config || {}; const box = config.x === void 0 || config.y === void 0 || !config.width || !config.height ? this.getClientRect() : { x: 0, y: 0, width: 0, height: 0 }; if (!isFinite(box.x + box.y + box.width + box.height)) Util.error(`Cannot find the bounds of the node to export, its client rect is ${box.x}, ${box.y}, ${box.width}x${box.height}. Check its position, size and points.`); const stage = this.getStage(), x = config.x !== void 0 ? config.x : Math.floor(box.x), y = config.y !== void 0 ? config.y : Math.floor(box.y), pixelRatio = config.pixelRatio || 1, canvas = new SceneCanvas({ width: config.width || Math.max(0, Math.ceil(box.x + box.width - x)) || (stage ? stage.width() : 0), height: config.height || Math.max(0, Math.ceil(box.y + box.height - y)) || (stage ? stage.height() : 0), pixelRatio }), context = canvas.getContext(); if (config.imageSmoothingEnabled === false) context._context.imageSmoothingEnabled = false; context.save(); if (x || y) context.translate(-1 * x, -1 * y); this.drawScene(canvas); context.restore(); canvas._releaseIsolationCanvas(); return canvas; } /** * converts node into an canvas element. * @method * @name Konva.Node#toCanvas * @param {Object} config * @param {Function} config.callback function executed when the composite has completed * @param {Number} [config.x] x position of canvas section * @param {Number} [config.y] y position of canvas section * @param {Number} [config.width] width of canvas section * @param {Number} [config.height] height of canvas section * @param {Number} [config.pixelRatio] pixelRatio of output canvas. Default is 1. * Higher pixel ratios increase export resolution. Cached nodes keep their cache resolution. * Rebuild caches at the export pixel ratio to preserve detail. * The pixel ratio multiplies the dimensions of the exported image. * If you export to 500x500 size with pixelRatio = 2, then produced image will have size 1000x1000. * @param {Boolean} [config.imageSmoothingEnabled] set this to false if you want to disable imageSmoothing * @example * var canvas = node.toCanvas(); */ toCanvas(config) { return this._toKonvaCanvas(config)._canvas; } /** * Creates a composite data URL (base64 string). If MIME type is not * specified, then "image/png" will result. For "image/jpeg", specify a quality * level as quality (range 0.0 - 1.0) * @method * @name Konva.Node#toDataURL * @param {Object} config * @param {String} [config.mimeType] can be "image/png" or "image/jpeg". * "image/png" is the default * @param {Number} [config.x] x position of canvas section * @param {Number} [config.y] y position of canvas section * @param {Number} [config.width] width of canvas section * @param {Number} [config.height] height of canvas section * @param {Number} [config.quality] jpeg quality. If using an "image/jpeg" mimeType, * you can specify the quality from 0 to 1, where 0 is very poor quality and 1 * is very high quality * @param {Number} [config.pixelRatio] pixelRatio of output image url. Default is 1. * Higher pixel ratios increase export resolution. Cached nodes keep their cache resolution. * Rebuild caches at the export pixel ratio to preserve detail. * The pixel ratio multiplies the dimensions of the exported image. * If you export to 500x500 size with pixelRatio = 2, then produced image will have size 1000x1000. * @param {Boolean} [config.imageSmoothingEnabled] set this to false if you want to disable imageSmoothing * @returns {String} */ toDataURL(config) { var _a; config = config || {}; const mimeType = config.mimeType || null, quality = (_a = config.quality) !== null && _a !== void 0 ? _a : null; const url = this._toKonvaCanvas(config).toDataURL(mimeType, quality); if (config.callback) config.callback(url); return url; } /** * converts node into an image. Since the toImage * method is asynchronous, the resulting image can only be retrieved from the config callback * or the returned Promise. toImage is most commonly used * to cache complex drawings as an image so that they don't have to constantly be redrawn * @method * @name Konva.Node#toImage * @param {Object} config * @param {Function} [config.callback] function executed when the composite has completed * @param {String} [config.mimeType] can be "image/png" or "image/jpeg". * "image/png" is the default * @param {Number} [config.x] x position of canvas section * @param {Number} [config.y] y position of canvas section * @param {Number} [config.width] width of canvas section * @param {Number} [config.height] height of canvas section * @param {Number} [config.quality] jpeg quality. If using an "image/jpeg" mimeType, * you can specify the quality from 0 to 1, where 0 is very poor quality and 1 * is very high quality * @param {Number} [config.pixelRatio] pixelRatio of output image. Default is 1. * Higher pixel ratios increase export resolution. Cached nodes keep their cache resolution. * Rebuild caches at the export pixel ratio to preserve detail. * The pixel ratio multiplies the dimensions of the exported image. * If you export to 500x500 size with pixelRatio = 2, then produced image will have size 1000x1000. * @param {Boolean} [config.imageSmoothingEnabled] set this to false if you want to disable imageSmoothing * @return {Promise} * @example * var image = node.toImage({ * callback(img) { * // do stuff with img * } * }); */ toImage(config) { return new Promise((resolve, reject) => { try { const { callback, ...rest } = config || {}; Util._urlToImage(this.toDataURL(rest), function(img) { resolve(img); callback === null || callback === void 0 || callback(img); }, reject); } catch (err) { reject(err); } }); } /** * Converts node into a blob. Since the toBlob method is asynchronous, * the resulting blob can only be retrieved from the config callback * or the returned Promise. * @method * @name Konva.Node#toBlob * @param {Object} config * @param {Function} [config.callback] function executed when the composite has completed * @param {Number} [config.x] x position of canvas section * @param {Number} [config.y] y position of canvas section * @param {Number} [config.width] width of canvas section * @param {Number} [config.height] height of canvas section * @param {Number} [config.pixelRatio] pixelRatio of output canvas. Default is 1. * Higher pixel ratios increase export resolution. Cached nodes keep their cache resolution. * Rebuild caches at the export pixel ratio to preserve detail. * The pixel ratio multiplies the dimensions of the exported image. * If you export to 500x500 size with pixelRatio = 2, then produced image will have size 1000x1000. * @param {Boolean} [config.imageSmoothingEnabled] set this to false if you want to disable imageSmoothing * @example * var blob = await node.toBlob({}); * @returns {Promise} rejects if the canvas can not be encoded */ toBlob(config) { return new Promise((resolve, reject) => { try { this.toCanvas(config).toBlob((blob) => { var _a; if (!blob) { reject(/* @__PURE__ */ new Error("Konva: toBlob() failed, the canvas was not encoded")); return; } resolve(blob); (_a = config === null || config === void 0 ? void 0 : config.callback) === null || _a === void 0 || _a.call(config, blob); }, config === null || config === void 0 ? void 0 : config.mimeType, config === null || config === void 0 ? void 0 : config.quality); } catch (err) { reject(err); } }); } setSize(size) { this.width(size.width); this.height(size.height); return this; } getSize() { return { width: this.width(), height: this.height() }; } /** * get class name, which may return Stage, Layer, Group, or shape class names like Rect, Circle, Text, etc. * @method * @name Konva.Node#getClassName * @returns {String} */ getClassName() { return this.className || this.nodeType; } /** * get the node type, which may return Stage, Layer, Group, or Shape * @method * @name Konva.Node#getType * @returns {String} */ getType() { return this.nodeType; } getDragDistance() { if (this.attrs.dragDistance !== void 0) return this.attrs.dragDistance; else if (this.parent) return this.parent.getDragDistance(); else return Konva$2.dragDistance; } _off(type, name, callback) { let evtListeners = this.eventListeners[type], i, evtName, handler; for (i = 0; i < evtListeners.length; i++) { evtName = evtListeners[i].name; handler = evtListeners[i].handler; if ((evtName !== "konva" || name === "konva") && (!name || evtName === name) && (!callback || callback === handler)) { evtListeners.splice(i, 1); if (evtListeners.length === 0) { delete this.eventListeners[type]; break; } i--; } } } _fireChangeEvent(attr, oldVal, newVal) { this._fire(attr + CHANGE, { oldVal, newVal }); } /** * add name to node * @method * @name Konva.Node#addName * @param {String} name * @returns {Konva.Node} * @example * node.name('red'); * node.addName('selected'); * node.name(); // return 'red selected' */ addName(name) { if (!this.hasName(name)) { const oldName = this.name(); const newName = oldName ? oldName + " " + name : name; this.name(newName); } return this; } /** * check is node has name * @method * @name Konva.Node#hasName * @param {String} name * @returns {Boolean} * @example * node.name('red'); * node.hasName('red'); // return true * node.hasName('selected'); // return false * node.hasName(''); // return false */ hasName(name) { if (!name) return false; const fullName = this.name(); if (!fullName) return false; return (fullName || "").split(/\s/g).indexOf(name) !== -1; } /** * remove name from node * @method * @name Konva.Node#removeName * @param {String} name * @returns {Konva.Node} * @example * node.name('red selected'); * node.removeName('selected'); * node.hasName('selected'); // return false * node.name(); // return 'red' */ removeName(name) { const names = (this.name() || "").split(/\s/g); const index = names.indexOf(name); if (index !== -1) { names.splice(index, 1); this.name(names.join(" ")); } return this; } /** * set attr * @method * @name Konva.Node#setAttr * @param {String} attr * @param {*} val * @returns {Konva.Node} * @example * node.setAttr('x', 5); */ setAttr(attr, val) { const func = this[SET + Util._capitalize(attr)]; if (Util._isFunction(func)) func.call(this, val); else this._setAttr(attr, val); return this; } _addSubtreeObserver(observer) { var _a; ((_a = this._subtreeObservers) !== null && _a !== void 0 ? _a : this._subtreeObservers = /* @__PURE__ */ new Set()).add(observer); Node._subtreeObserverCount++; } _removeSubtreeObserver(observer) { var _a; if ((_a = this._subtreeObservers) === null || _a === void 0 ? void 0 : _a.delete(observer)) Node._subtreeObserverCount--; } _notifySubtreeChange() { if (!Node._subtreeObserverCount) return; for (let node = this; node; node = node.parent) { const observers = node._subtreeObservers; if (observers) for (const o of observers) o._onSubtreeChange(node); } } _requestDraw() { var _a; (_a = this.parent) === null || _a === void 0 || _a._notifySubtreeChange(); if (Konva$2.autoDrawEnabled) { const drawNode = this.getLayer() || this.getStage(); drawNode === null || drawNode === void 0 || drawNode.batchDraw(); } } _setAttr(key, val) { const oldVal = this.attrs[key]; if (oldVal === val && !Util.isObject(val)) return; if (val === void 0 || val === null) delete this.attrs[key]; else this.attrs[key] = val; if (this._attrsVersion !== void 0) this._attrsVersion++; if (this._shouldFireChangeEvents) this._fireChangeEvent(key, oldVal, val); this._requestDraw(); } _fireAndBubble(eventType, evt, compareShape) { if (evt && this.nodeType === SHAPE) evt.target = this; const nonBubbling = NON_BUBBLING_EVENTS.indexOf(eventType) !== -1; if (!(nonBubbling && (compareShape && (this === compareShape || this.isAncestorOf && this.isAncestorOf(compareShape)) || this.nodeType === "Stage" && !compareShape))) { this._fire(eventType, evt); const stopBubble = nonBubbling && compareShape && compareShape.isAncestorOf && compareShape.isAncestorOf(this) && !compareShape.isAncestorOf(this.parent); if ((evt && !evt.cancelBubble || !evt) && this.parent && this.parent.isListening() && !stopBubble) { if (compareShape && compareShape.parent) this._fireAndBubble.call(this.parent, eventType, evt, compareShape); else this._fireAndBubble.call(this.parent, eventType, evt); } } } _getProtoListeners(eventType) { var _a, _b; const proto = Object.getPrototypeOf(this); let allListeners = Node.protoListenerMap.get(proto); if (!allListeners) { allListeners = {}; Node.protoListenerMap.set(proto, allListeners); } let events = allListeners[eventType]; if (events === void 0) { events = []; const seen = /* @__PURE__ */ new Set(); let obj = Object.getPrototypeOf(this); while (obj) { const hierarchyEvents = (_b = (_a = obj.eventListeners) === null || _a === void 0 ? void 0 : _a[eventType]) !== null && _b !== void 0 ? _b : []; for (let i = 0; i < hierarchyEvents.length; i++) { const entry = hierarchyEvents[i]; if (!seen.has(entry)) { seen.add(entry); events.push(entry); } } obj = Object.getPrototypeOf(obj); } allListeners[eventType] = events; } return events; } _fire(eventType, evt) { evt = evt || {}; evt.currentTarget = this; evt.type = eventType; const topListeners = this._getProtoListeners(eventType); if (topListeners) for (let i = 0; i < topListeners.length; i++) topListeners[i].handler.call(this, evt); const selfListeners = this.eventListeners[eventType]; if (selfListeners) { const list = selfListeners.slice(); const origLen = list.length; for (let i = 0; i < list.length; i++) list[i].handler.call(this, evt); const liveListeners = this.eventListeners[eventType]; if (liveListeners) for (let i = origLen; i < liveListeners.length; i++) liveListeners[i].handler.call(this, evt); } } /** * draw both scene and hit graphs. If the node being drawn is the stage, all of the layers will be cleared and redrawn * @method * @name Konva.Node#draw * @returns {Konva.Node} */ draw() { this.drawScene(); this.drawHit(); return this; } _createDragElement(evt) { var _a; const pointerId = evt ? evt.pointerId : void 0; const stage = this.getStage(); const ap = this.getAbsolutePosition(); if (!stage) return; const pos = stage._getPointerById(pointerId) || stage._changedPointerPositions[0] || ap; const type = ((_a = evt === null || evt === void 0 ? void 0 : evt.evt) === null || _a === void 0 ? void 0 : _a.type) ? Util._getEventType(evt.evt.type) : stage._pointerEventType; const bound = type !== "pointer"; DD._dragElements.set(this._id, { node: this, startPointerPos: pos, offset: { x: pos.x - ap.x, y: pos.y - ap.y }, dragStatus: "ready", pointerId: bound ? pointerId !== null && pointerId !== void 0 ? pointerId : "id" in pos ? pos.id : void 0 : void 0, pointerEventType: bound ? type : void 0, startEvent: evt }); } /** * initiate drag and drop. * @method * @name Konva.Node#startDrag */ startDrag(evt, bubbleEvent = true) { var _a; if (!DD._dragElements.has(this._id)) this._createDragElement(evt); const elem = DD._dragElements.get(this._id); if (!elem) return; elem.dragStatus = "dragging"; (_a = this.getStage()) === null || _a === void 0 || _a._cancelClick(elem.pointerId, elem.pointerEventType); this.fire("dragstart", { type: "dragstart", target: this, evt: elem.startEvent && elem.startEvent.evt || evt && evt.evt }, bubbleEvent); } _setDragPosition(evt, elem) { const pos = this.getStage()._getPointerById(elem.pointerId); if (!pos) return; let newNodePos = { x: pos.x - elem.offset.x, y: pos.y - elem.offset.y }; const dbf = this.dragBoundFunc(); if (dbf !== void 0) { const bounded = dbf.call(this, newNodePos, evt); if (!bounded) Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc."); else if (!Util._isNumber(bounded.x) || !Util._isNumber(bounded.y)) { Util.warn(`dragBoundFunc returned a position with a non-finite x or y (${bounded.x}, ${bounded.y}). The node was not moved.`); return; } else newNodePos = bounded; } const lastPos = elem.lastPos; if (!lastPos || lastPos.x !== newNodePos.x || lastPos.y !== newNodePos.y) { this.setAbsolutePosition(newNodePos); this._requestDraw(); } elem.lastPos = newNodePos; } /** * stop drag and drop * @method * @name Konva.Node#stopDrag */ stopDrag(evt) { const elem = DD._dragElements.get(this._id); if (!elem) return; elem.dragStatus = "stopped"; DD._endDragBefore(evt, void 0, elem); DD._endDragAfter(evt, elem); } setDraggable(draggable) { this._setAttr("draggable", draggable); this._dragChange(); } /** * determine if node is currently in drag and drop mode * @method * @name Konva.Node#isDragging */ isDragging() { const elem = DD._dragElements.get(this._id); return elem ? elem.dragStatus === "dragging" : false; } _listenDrag() { this._dragCleanup(); this.on("mousedown.konva touchstart.konva", function(evt) { if (!(!(evt.evt["button"] !== void 0) || Konva$2.dragButtons.indexOf(evt.evt["button"]) >= 0)) return; if (DD._dragElements.has(this._id)) return; let hasDraggingChild = false; DD._dragElements.forEach((elem) => { if (this.isAncestorOf(elem.node)) hasDraggingChild = true; }); if (!hasDraggingChild) this._createDragElement(evt); }); } _dragChange() { if (this.attrs.draggable) this._listenDrag(); else { this._dragCleanup(); if (!this.getStage()) return; const dragElement = DD._dragElements.get(this._id); const isDragging = dragElement && dragElement.dragStatus === "dragging"; const isReady = dragElement && dragElement.dragStatus === "ready"; if (isDragging) this.stopDrag(); else if (isReady) DD._dragElements.delete(this._id); } } _dragCleanup() { this.off("mousedown.konva"); this.off("touchstart.konva"); } /** * determine if node (at least partially) is currently in user-visible area * @method * @param {(Number | Object)} margin optional margin in pixels * @param {Number} margin.x * @param {Number} margin.y * @returns {Boolean} * @name Konva.Node#isClientRectOnScreen * @example * // get index * // default calculations * var isOnScreen = node.isClientRectOnScreen() * // increase object size (or screen size) for cases when objects close to the screen still need to be marked as "visible" * var isOnScreen = node.isClientRectOnScreen({ x: stage.width(), y: stage.height() }) */ isClientRectOnScreen(margin = { x: 0, y: 0 }) { const stage = this.getStage(); if (!stage) return false; const screenRect = { x: -margin.x, y: -margin.y, width: stage.width() + 2 * margin.x, height: stage.height() + 2 * margin.y }; return Util.haveIntersection(screenRect, this.getClientRect()); } /** * create node with JSON string or an Object. Deserialization restores attributes only, * not functions, images or event handlers (that would make the serialized object huge): * `sceneFunc`/`hitFunc` of custom shapes, images and `fillPatternImage`, `clipFunc`, * `dragBoundFunc`, filter functions, the `nodes`, `boundBoxFunc` and `anchorStyleFunc` * of a Transformer, typed arrays and the `cache()` state. If your app uses them (it probably * does), select the nodes after loading the stage and set these properties again with * `on()`, `sceneFunc()`, `image()` and so on * @method * @memberof Konva.Node * @param {String|Object} data string or object * @param {Element} [container] optional container dom element used only if you're * creating a stage node */ static create(data, container) { if (Util._isString(data)) data = JSON.parse(data); return this._createNode(data, container); } static _createNode(obj, container) { let className = Node.prototype.getClassName.call(obj), children = obj.children, no, len, n; if (container) obj.attrs.container = container; if (!Konva$2[className]) { const fallback = children ? "Group" : "Shape"; Util.warn("Can not find a node with class name \"" + className + `". Fallback to "${fallback}".`); className = fallback; } const Class = Konva$2[className]; no = new Class(obj.attrs); if (children) { len = children.length; for (n = 0; n < len; n++) no.add(Node._createNode(children[n])); } return no; } }; Node._subtreeObserverCount = 0; Node._updateBatchDepth = 0; Node._pendingUpdates = /* @__PURE__ */ new Set(); Node.protoListenerMap = /* @__PURE__ */ new WeakMap(); Node.prototype.nodeType = "Node"; Node.prototype._attrsAffectingSize = []; Node.prototype.on(TRANSFORM_CHANGE_STR$1, function() { if (this._batchingTransformChange) { this._needClearTransformCache = true; return; } this._clearCache(TRANSFORM); this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM); }); Node.prototype.on("visibleChange.konva", function() { this._clearSelfAndDescendantCache(VISIBLE); }); Node.prototype.on("listeningChange.konva", function() { this._clearSelfAndDescendantCache(LISTENING); for (let parent = this.getParent(); parent; parent = parent.getParent()) { const cache = parent._getCanvasCache(); if (cache === null || cache === void 0 ? void 0 : cache.hit) { Util.releaseCanvas(cache.hit._canvas); cache.hit = null; } } }); Node.prototype.on("opacityChange.konva", function() { this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY); }); var addGetterSetter = Factory.addGetterSetter; /** * get/set zIndex relative to the node's siblings who share the same parent. * Please remember that zIndex is not absolute (like in CSS). It is relative to parent element only. * @name Konva.Node#zIndex * @method * @param {Number} index * @returns {Number} * @example * // get index * var index = node.zIndex(); * * // set index * node.zIndex(2); */ addGetterSetter(Node, "zIndex"); /** * get/set node absolute position * @name Konva.Node#absolutePosition * @method * @param {Object} pos * @param {Number} pos.x * @param {Number} pos.y * @returns {Object} * @example * // get position * var position = node.absolutePosition(); * * // set position * node.absolutePosition({ * x: 5, * y: 10 * }); */ addGetterSetter(Node, "absolutePosition"); addGetterSetter(Node, "position"); /** * get/set node position relative to parent * @name Konva.Node#position * @method * @param {Object} pos * @param {Number} pos.x * @param {Number} pos.y * @returns {Object} * @example * // get position * var position = node.position(); * * // set position * node.position({ * x: 5, * y: 10 * }); */ addGetterSetter(Node, "x", 0, getNumberValidator()); /** * get/set x position * @name Konva.Node#x * @method * @param {Number} x * @returns {Object} * @example * // get x * var x = node.x(); * * // set x * node.x(5); */ addGetterSetter(Node, "y", 0, getNumberValidator()); /** * get/set y position * @name Konva.Node#y * @method * @param {Number} y * @returns {Integer} * @example * // get y * var y = node.y(); * * // set y * node.y(5); */ addGetterSetter(Node, "globalCompositeOperation", "source-over", getStringValidator()); /** * get/set globalCompositeOperation of a node. globalCompositeOperation DOESN'T affect hit graph of nodes. So they are still trigger to events as they have default "source-over" globalCompositeOperation. * @name Konva.Node#globalCompositeOperation * @method * @param {String} type * @returns {String} * @example * // get globalCompositeOperation * var globalCompositeOperation = shape.globalCompositeOperation(); * * // set globalCompositeOperation * shape.globalCompositeOperation('source-in'); */ addGetterSetter(Node, "opacity", 1, getNumberValidator()); /** * get/set opacity. Opacity values range from 0 to 1. * A node with an opacity of 0 is fully transparent, and a node * with an opacity of 1 is fully opaque * @name Konva.Node#opacity * @method * @param {Object} opacity * @returns {Number} * @example * // get opacity * var opacity = node.opacity(); * * // set opacity * node.opacity(0.5); */ addGetterSetter(Node, "name", "", getStringValidator()); /** * get/set name. * @name Konva.Node#name * @method * @param {String} name * @returns {String} * @example * // get name * var name = node.name(); * * // set name * node.name('foo'); * * // also node may have multiple names (as css classes) * node.name('foo bar'); */ addGetterSetter(Node, "id", "", getStringValidator()); /** * get/set id. Id is global for whole page. * @name Konva.Node#id * @method * @param {String} id * @returns {String} * @example * // get id * var name = node.id(); * * // set id * node.id('foo'); */ addGetterSetter(Node, "rotation", 0, getNumberValidator()); /** * get/set rotation in degrees * @name Konva.Node#rotation * @method * @param {Number} rotation * @returns {Number} * @example * // get rotation in degrees * var rotation = node.rotation(); * * // set rotation in degrees * node.rotation(45); */ Factory.addComponentsGetterSetter(Node, "scale", ["x", "y"]); /** * get/set scale * @name Konva.Node#scale * @param {Object} scale * @param {Number} scale.x * @param {Number} scale.y * @method * @returns {Object} * @example * // get scale * var scale = node.scale(); * * // set scale * shape.scale({ * x: 2, * y: 3 * }); */ addGetterSetter(Node, "scaleX", 1, getNumberValidator()); /** * get/set scale x * @name Konva.Node#scaleX * @param {Number} x * @method * @returns {Number} * @example * // get scale x * var scaleX = node.scaleX(); * * // set scale x * node.scaleX(2); */ addGetterSetter(Node, "scaleY", 1, getNumberValidator()); /** * get/set scale y * @name Konva.Node#scaleY * @param {Number} y * @method * @returns {Number} * @example * // get scale y * var scaleY = node.scaleY(); * * // set scale y * node.scaleY(2); */ Factory.addComponentsGetterSetter(Node, "skew", ["x", "y"]); /** * get/set skew * @name Konva.Node#skew * @param {Object} skew * @param {Number} skew.x * @param {Number} skew.y * @method * @returns {Object} * @example * // get skew * var skew = node.skew(); * * // set skew * node.skew({ * x: 20, * y: 10 * }); */ addGetterSetter(Node, "skewX", 0, getNumberValidator()); /** * get/set skew x * @name Konva.Node#skewX * @param {Number} x * @method * @returns {Number} * @example * // get skew x * var skewX = node.skewX(); * * // set skew x * node.skewX(3); */ addGetterSetter(Node, "skewY", 0, getNumberValidator()); /** * get/set skew y * @name Konva.Node#skewY * @param {Number} y * @method * @returns {Number} * @example * // get skew y * var skewY = node.skewY(); * * // set skew y * node.skewY(3); */ Factory.addComponentsGetterSetter(Node, "offset", ["x", "y"]); /** * get/set offset. Offsets the default position and rotation point * @method * @param {Object} offset * @param {Number} offset.x * @param {Number} offset.y * @returns {Object} * @example * // get offset * var offset = node.offset(); * * // set offset * node.offset({ * x: 20, * y: 10 * }); */ addGetterSetter(Node, "offsetX", 0, getNumberValidator()); /** * get/set offset x * @name Konva.Node#offsetX * @method * @param {Number} x * @returns {Number} * @example * // get offset x * var offsetX = node.offsetX(); * * // set offset x * node.offsetX(3); */ addGetterSetter(Node, "offsetY", 0, getNumberValidator()); /** * get/set offset y * @name Konva.Node#offsetY * @method * @param {Number} y * @returns {Number} * @example * // get offset y * var offsetY = node.offsetY(); * * // set offset y * node.offsetY(3); */ addGetterSetter(Node, "dragDistance", void 0, getNumberValidator()); /** * get/set drag distance. A drag starts once the pointer moved this far from where it * went down, on either axis. Default is `Konva.dragDistance` * @name Konva.Node#dragDistance * @method * @param {Number} distance * @returns {Number} * @example * // get drag distance * var dragDistance = node.dragDistance(); * * // set distance * // node starts dragging only if pointer moved more then 3 pixels * node.dragDistance(3); * // or set globally * Konva.dragDistance = 3; */ addGetterSetter(Node, "width", 0, getNumberValidator()); /** * get/set width * @name Konva.Node#width * @method * @param {Number} width * @returns {Number} * @example * // get width * var width = node.width(); * * // set width * node.width(100); */ addGetterSetter(Node, "height", 0, getNumberValidator()); /** * get/set height * @name Konva.Node#height * @method * @param {Number} height * @returns {Number} * @example * // get height * var height = node.height(); * * // set height * node.height(100); */ addGetterSetter(Node, "listening", true, getBooleanValidator()); /** * get/set listening attr. If you need to determine if a node is listening or not * by taking into account its parents, use the isListening() method * nodes with listening set to false will not be detected in hit graph * so they will be ignored in container.getIntersection() method * a non-listening layer (or a layer of a non-listening stage) also * releases its hit canvas, so it uses less memory * @name Konva.Node#listening * @method * @param {Boolean} listening Can be true, or false. The default is true. * @returns {Boolean} * @example * // get listening attr * var listening = node.listening(); * * // stop listening for events, remove node and all its children from hit graph * node.listening(false); * * // listen to events according to the parent * node.listening(true); */ /** * get/set preventDefault * By default all shapes will prevent default behavior * of a browser on a pointer move or tap. * that will prevent native scrolling when you are trying to drag&drop a node * but sometimes you may need to enable default actions * in that case you can set the property to false * @name Konva.Node#preventDefault * @method * @param {Boolean} preventDefault * @returns {Boolean} * @example * // get preventDefault * var shouldPrevent = shape.preventDefault(); * * // set preventDefault * shape.preventDefault(false); */ addGetterSetter(Node, "preventDefault", true, getBooleanValidator()); addGetterSetter(Node, "filters", void 0, function(val) { this._filterUpToDate = false; return val; }); /** * get/set filters. Supports function filters, CSS filter strings, or mixed arrays. * CSS filters are applied using native browser performance when possible, function filters use ImageData manipulation. * CSS filters automatically fall back to function filters in unsupported browsers. * Blur radii, pixelation sizes and CSS lengths use node coordinates, independent of cache pixelRatio. * Custom filters receive (imageData, pixelRatio). ImageData contains full-resolution backing pixels. * @name Konva.Node#filters * @method * @param {Array} filters array of filter functions and/or CSS filter strings * @returns {Array} * @example * // get filters * var filters = node.filters(); * * // set CSS filters only (caching required, uses native performance) * node.cache(); * node.filters(['blur(5px)', 'brightness(1.2)', 'contrast(1.5)']); * * // set function filters only (caching required) * node.cache(); * node.filters([Konva.Filters.Blur, Konva.Filters.Sepia, Konva.Filters.Invert]); * * // mix CSS and function filters (caching required, uses fallback strategy) * node.cache(); * node.filters([ * 'blur(3px)', // CSS filter * Konva.Filters.Invert, // function filter * 'brightness(1.5)' // CSS filter * ]); */ addGetterSetter(Node, "visible", true, getBooleanValidator()); /** * get/set visible attr. Can be true, or false. The default is true. * If you need to determine if a node is visible or not * by taking into account its parents, use the isVisible() method * @name Konva.Node#visible * @method * @param {Boolean} visible * @returns {Boolean} * @example * // get visible attr * var visible = node.visible(); * * // make invisible * node.visible(false); * * // make visible (according to the parent) * node.visible(true); * */ addGetterSetter(Node, "transformsEnabled", "all", getStringValidator()); /** * get/set transforms that are enabled. Can be "all", "none", or "position". The default * is "all" * @name Konva.Node#transformsEnabled * @method * @param {String} enabled * @returns {String} * @example * // enable position transform only to improve draw performance * node.transformsEnabled('position'); * * // enable all transforms * node.transformsEnabled('all'); */ /** * get/set node size * @name Konva.Node#size * @method * @param {Object} size * @param {Number} size.width * @param {Number} size.height * @returns {Object} * @example * // get node size * var size = node.size(); * var width = size.width; * var height = size.height; * * // set size * node.size({ * width: 100, * height: 200 * }); */ addGetterSetter(Node, "size"); /** * get/set drag bound function. This is used to override the default * drag and drop position. The function is called with the absolute position * the node is about to get and the native event, and must return the * absolute position to use * @name Konva.Node#dragBoundFunc * @method * @param {Function} dragBoundFunc function(pos, evt) returning `{ x, y }` * @returns {Function} * @example * // get drag bound function * var dragBoundFunc = node.dragBoundFunc(); * * // create vertical drag and drop * node.dragBoundFunc(function(pos){ * // important pos - is absolute position of the node * // you should return absolute position too * return { * x: this.absolutePosition().x, * y: pos.y * }; * }); */ addGetterSetter(Node, "dragBoundFunc"); /** * get/set draggable flag * @name Konva.Node#draggable * @method * @param {Boolean} draggable * @returns {Boolean} * @example * // get draggable flag * var draggable = node.draggable(); * * // enable drag and drop * node.draggable(true); * * // disable drag and drop * node.draggable(false); */ addGetterSetter(Node, "draggable", false, getBooleanValidator()); Factory.backCompat(Node, { rotateDeg: "rotate", setRotationDeg: "setRotation", getRotationDeg: "getRotation" }); //#endregion //#region node_modules/konva/lib/Container.js /** * Container constructor.  Containers are used to contain nodes or other containers * @constructor * @memberof Konva * @augments Konva.Node * @abstract * @param {Object} config * @@nodeParams * @@containerParams */ var Container = class extends Node { constructor() { super(...arguments); this.children = []; } /** * returns an array of direct descendant nodes * @method * @name Konva.Container#getChildren * @param {Function} [filterFunc] filter function * @returns {Array} * @example * // get all children * var children = layer.getChildren(); * * // get only circles * var circles = layer.getChildren(function(node){ * return node.getClassName() === 'Circle'; * }); */ getChildren(filterFunc) { const children = this.children || []; return filterFunc ? children.filter(filterFunc) : children.slice(); } /** * determine if node has children * @method * @name Konva.Container#hasChildren * @returns {Boolean} */ hasChildren() { return this.children.length > 0; } /** * remove all children. Children will be still in memory. * If you want to completely destroy all children please use "destroyChildren" method instead * @method * @name Konva.Container#removeChildren */ removeChildren() { return this._clearChildren("remove"); } /** * destroy all children nodes. * @method * @name Konva.Container#destroyChildren */ destroyChildren() { return this._clearChildren("destroy"); } _clearChildren(dispose) { return Node._updateBatch(() => { this.children.forEach((child) => { child.parent = null; child.index = 0; child[dispose](); }); this.children = []; this._notifySubtreeChange(); this._requestDraw(); return this; }); } /** * add a child and children into container * @name Konva.Container#add * @method * @param {...Konva.Node} children * @returns {Container} * @example * layer.add(rect); * layer.add(shape1, shape2, shape3); * // empty arrays are accepted, though each individual child must be defined * layer.add(...shapes); */ add(...children) { if (children.length === 0) return this; if (children.length > 1) { for (let i = 0; i < children.length; i++) this.add(children[i]); return this; } const child = children[0]; if (child.getParent()) { child.moveTo(this); return this; } this._validateAdd(child); child.index = this.children.length; child.parent = this; child._clearCaches(); this.children.push(child); this._fire("add", { child }); this._notifySubtreeChange(); this._requestDraw(); return this; } destroy() { if (this.hasChildren()) this.destroyChildren(); super.destroy(); return this; } /** * return an array of nodes that match the selector. * You can provide a string with '#' for id selections and '.' for name selections. * Or a function that will return true/false when a node is passed through. See example below. * With strings you can also select by type or class name. Pass multiple selectors * separated by a comma. * @method * @name Konva.Container#find * @param {String | Function} selector * @returns {Array} * @example * * Passing a string as a selector * // select node with id foo * var node = stage.find('#foo'); * * // select nodes with name bar inside layer * var nodes = layer.find('.bar'); * * // select all groups inside layer * var nodes = layer.find('Group'); * * // select all rectangles inside layer * var nodes = layer.find('Rect'); * * // select node with an id of foo or a name of bar inside layer * var nodes = layer.find('#foo, .bar'); * * Passing a function as a selector * * // get all groups with a function * var groups = stage.find(node => { * return node.getType() === 'Group'; * }); * * // get only Nodes with partial opacity * var alphaNodes = layer.find(node => { * return node.getType() === 'Node' && node.getAbsoluteOpacity() < 1; * }); */ find(selector) { return this._generalFind(selector, false); } /** * return a first node from `find` method * @method * @name Konva.Container#findOne * @param {String | Function} selector * @returns {Konva.Node | Undefined} * @example * // select node with id foo * var node = stage.findOne('#foo'); * * // select node with name bar inside layer * var nodes = layer.findOne('.bar'); * * // select the first node to return true in a function * var node = stage.findOne(node => { * return node.getType() === 'Shape' * }) */ findOne(selector) { const result = this._generalFind(selector, true); return result.length > 0 ? result[0] : void 0; } _generalFind(selector, findOne) { const retArr = []; this._descendants((node) => { const valid = node._isMatch(selector); if (valid) retArr.push(node); if (valid && findOne) return true; return false; }); return retArr; } _descendants(fn) { let shouldStop = false; for (const child of this.children) { shouldStop = fn(child); if (shouldStop) return true; if (!child.hasChildren()) continue; shouldStop = child._descendants(fn); if (shouldStop) return true; } return false; } toObject() { const obj = Node.prototype.toObject.call(this); obj.children = []; this.children.forEach((child) => { obj.children.push(child.toObject()); }); return obj; } /** * determine if node is an ancestor * of descendant * @method * @name Konva.Container#isAncestorOf * @param {Konva.Node} node */ isAncestorOf(node) { let parent = node.getParent(); while (parent) { if (parent._id === this._id) return true; parent = parent.getParent(); } return false; } clone(obj) { const node = Node.prototype.clone.call(this, obj); this.children.forEach(function(no) { node.add(no.clone()); }); return node; } /** * get all shapes that intersect a point. Note: because this method must clear a temporary * canvas and redraw every shape inside the container, it should only be used for special situations * because it performs very poorly. Please use the {@link Konva.Stage#getIntersection} method if at all possible * because it performs much better. * Nodes with listening set to false or invisible nodes are not detected * @method * @name Konva.Container#getAllIntersections * @param {Object} pos * @param {Number} pos.x * @param {Number} pos.y * @returns {Array} array of shapes */ getAllIntersections(pos) { const arr = []; this.find("Shape").forEach((shape) => { if (shape.isVisible() && shape.intersects(pos)) arr.push(shape); }); return arr; } _clearSelfAndDescendantCache(attr) { var _a; const isAbsTransform = attr === void 0 || attr === "absoluteTransform"; if (isAbsTransform) Node._updateBatchDepth++; try { super._clearSelfAndDescendantCache(attr); if (attr === "absoluteTransform" && this.isCached()) return; (_a = this.children) === null || _a === void 0 || _a.forEach(function(node) { node._clearSelfAndDescendantCache(attr); }); } finally { if (isAbsTransform && --Node._updateBatchDepth === 0) Node._flushUpdateBatch(); } } _setChildrenIndices() { var _a; (_a = this.children) === null || _a === void 0 || _a.forEach(function(child, n) { child.index = n; }); this._notifySubtreeChange(); this._requestDraw(); } drawScene(can, top) { const layer = this.getLayer(), canvas = can || layer && layer.getCanvas(), context = canvas && canvas.getContext(), cachedCanvas = this._getCanvasCache(), cachedSceneCanvas = cachedCanvas && cachedCanvas.scene; const caching = top === this; if (!(top ? this._isVisible(top) : this.isVisible()) && !caching) return this; if (cachedSceneCanvas) { context.save(); const m = this.getAbsoluteTransform(top).getMatrix(); context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); this._drawCachedSceneCanvas(context); context.restore(); } else this._drawChildren("drawScene", canvas, top); return this; } drawHit(can, top) { if (!this.shouldDrawHit(top)) return this; const layer = this.getLayer(), canvas = can || layer && layer.hitCanvas, context = canvas && canvas.getContext(), cachedHitCanvas = this._getCachedHitCanvas(top); if (cachedHitCanvas) { context.save(); const m = this.getAbsoluteTransform(top).getMatrix(); context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); this._drawCachedHitCanvas(context, cachedHitCanvas); context.restore(); } else this._drawChildren("drawHit", canvas, top); return this; } _drawChildren(drawMethod, canvas, top) { const context = canvas && canvas.getContext(), clipWidth = this.clipWidth(), clipHeight = this.clipHeight(), clipFunc = this.clipFunc(), hasClip = typeof clipWidth === "number" && typeof clipHeight === "number" || clipFunc; const selfCache = top === this; if (hasClip) { context.save(); const transform = this.getAbsoluteTransform(top); let m = transform.getMatrix(); context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); context.beginPath(); let clipArgs; if (clipFunc) clipArgs = clipFunc.call(this, context, this); else { const clipX = this.clipX(); const clipY = this.clipY(); context.rect(clipX || 0, clipY || 0, clipWidth, clipHeight); } context.clip.apply(context, clipArgs); m = transform.copy().invert().getMatrix(); context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); } const hasComposition = !selfCache && this.globalCompositeOperation() !== "source-over" && drawMethod === "drawScene"; if (hasComposition) { context.save(); context._applyGlobalCompositeOperation(this); } try { this._drawChildNodes(drawMethod, canvas, top); } finally { if (hasComposition) context.restore(); if (hasClip) context.restore(); } } _drawChildNodes(drawMethod, canvas, top) { var _a; (_a = this.children) === null || _a === void 0 || _a.forEach(function(child) { child[drawMethod](canvas, top); }); } getClientRect(config = {}) { var _a; const cachedRect = this._getCachedSceneRect(config); if (cachedRect) return cachedRect; const skipTransform = config.skipTransform; const relativeTo = config.relativeTo; const [a, b, c, d] = this.getAbsoluteTransform().getMatrix(); const measureTransformed = !skipTransform && (config._forDrawing || a * d - b * c === 0); let minX, minY, maxX, maxY; let selfRect = { x: Infinity, y: Infinity, width: 0, height: 0 }; const that = this; (_a = this.children) === null || _a === void 0 || _a.forEach(function(child) { if (!child.visible()) return; const rect = child.getClientRect({ relativeTo: measureTransformed ? relativeTo : that, _forDrawing: config._forDrawing, skipShadow: config.skipShadow, skipStroke: config.skipStroke }); if (rect.width === 0 && rect.height === 0 || !isFinite(rect.x + rect.y + rect.width + rect.height)) return; if (minX === void 0) { minX = rect.x; minY = rect.y; maxX = rect.x + rect.width; maxY = rect.y + rect.height; } else { minX = Math.min(minX, rect.x); minY = Math.min(minY, rect.y); maxX = Math.max(maxX, rect.x + rect.width); maxY = Math.max(maxY, rect.y + rect.height); } }); if (minX !== void 0) selfRect = { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; else selfRect = { x: 0, y: 0, width: 0, height: 0 }; if (!skipTransform && !measureTransformed) return this._transformedRect(selfRect, relativeTo); return selfRect; } }; Factory.addComponentsGetterSetter(Container, "clip", [ "x", "y", "width", "height" ]); /** * get/set clip * @method * @name Konva.Container#clip * @param {Object} clip * @param {Number} clip.x * @param {Number} clip.y * @param {Number} clip.width * @param {Number} clip.height * @returns {Object} * @example * // get clip * var clip = container.clip(); * * // set clip * container.clip({ * x: 20, * y: 20, * width: 20, * height: 20 * }); */ Factory.addGetterSetter(Container, "clipX", void 0, getNumberValidator()); /** * get/set clip x * @name Konva.Container#clipX * @method * @param {Number} x * @returns {Number} * @example * // get clip x * var clipX = container.clipX(); * * // set clip x * container.clipX(10); */ Factory.addGetterSetter(Container, "clipY", void 0, getNumberValidator()); /** * get/set clip y * @name Konva.Container#clipY * @method * @param {Number} y * @returns {Number} * @example * // get clip y * var clipY = container.clipY(); * * // set clip y * container.clipY(10); */ Factory.addGetterSetter(Container, "clipWidth", void 0, getNumberValidator()); /** * get/set clip width * @name Konva.Container#clipWidth * @method * @param {Number} width * @returns {Number} * @example * // get clip width * var clipWidth = container.clipWidth(); * * // set clip width * container.clipWidth(100); */ Factory.addGetterSetter(Container, "clipHeight", void 0, getNumberValidator()); /** * get/set clip height * @name Konva.Container#clipHeight * @method * @param {Number} height * @returns {Number} * @example * // get clip height * var clipHeight = container.clipHeight(); * * // set clip height * container.clipHeight(100); */ Factory.addGetterSetter(Container, "clipFunc"); /** * get/set clip function * @name Konva.Container#clipFunc * @method * @param {Function} function * @returns {Function} * @example * // get clip function * var clipFunction = container.clipFunc(); * * // set clip function * container.clipFunc(function(ctx) { * ctx.rect(0, 0, 100, 100); * }); * * container.clipFunc(function(ctx) { * // optionally return a clip Path2D and clip-rule or just the clip-rule * return [new Path2D('M0 0v50h50Z'), 'evenodd'] * }); */ //#endregion //#region node_modules/konva/lib/Stage.js var STAGE = "Stage"; var STRING = "string"; var PX = "px"; var MOUSEOUT = "mouseout"; var MOUSELEAVE = "mouseleave"; var MOUSEOVER = "mouseover"; var MOUSEENTER = "mouseenter"; var MOUSEMOVE = "mousemove"; var MOUSEDOWN = "mousedown"; var MOUSEUP = "mouseup"; var POINTERMOVE = "pointermove"; var POINTERDOWN = "pointerdown"; var POINTERUP = "pointerup"; var POINTERCANCEL = "pointercancel"; var LOSTPOINTERCAPTURE = "lostpointercapture"; var POINTEROUT = "pointerout"; var POINTERLEAVE = "pointerleave"; var POINTEROVER = "pointerover"; var POINTERENTER = "pointerenter"; var CONTEXTMENU = "contextmenu"; var TOUCHSTART = "touchstart"; var TOUCHEND = "touchend"; var TOUCHMOVE = "touchmove"; var TOUCHCANCEL = "touchcancel"; var WHEEL = "wheel"; var MAX_LAYERS_NUMBER = 5; var EVENTS = [ [MOUSEENTER, "_pointerenter"], [MOUSEDOWN, "_pointerdown"], [MOUSEMOVE, "_pointermove"], [MOUSEUP, "_pointerup"], [MOUSELEAVE, "_pointerleave"], [TOUCHSTART, "_pointerdown"], [TOUCHMOVE, "_pointermove"], [TOUCHEND, "_pointerup"], [TOUCHCANCEL, "_pointercancel"], [MOUSEOVER, "_pointerover"], [WHEEL, "_wheel"], [CONTEXTMENU, "_contextmenu"], [POINTERDOWN, "_pointerdown"], [POINTERMOVE, "_pointermove"], [POINTERUP, "_pointerup"], [POINTERCANCEL, "_pointercancel"], [POINTERLEAVE, "_pointerleave"], [LOSTPOINTERCAPTURE, "_lostpointercapture"] ]; var EVENTS_MAP = { mouse: { [POINTEROUT]: MOUSEOUT, [POINTERLEAVE]: MOUSELEAVE, [POINTEROVER]: MOUSEOVER, [POINTERENTER]: MOUSEENTER, [POINTERMOVE]: MOUSEMOVE, [POINTERDOWN]: MOUSEDOWN, [POINTERUP]: MOUSEUP, [POINTERCANCEL]: "mousecancel", pointerclick: "click", pointerdblclick: "dblclick" }, touch: { [POINTEROUT]: "touchout", [POINTERLEAVE]: "touchleave", [POINTEROVER]: "touchover", [POINTERENTER]: "touchenter", [POINTERMOVE]: TOUCHMOVE, [POINTERDOWN]: TOUCHSTART, [POINTERUP]: TOUCHEND, [POINTERCANCEL]: TOUCHCANCEL, pointerclick: "tap", pointerdblclick: "dbltap" }, pointer: { [POINTEROUT]: POINTEROUT, [POINTERLEAVE]: POINTERLEAVE, [POINTEROVER]: POINTEROVER, [POINTERENTER]: POINTERENTER, [POINTERMOVE]: POINTERMOVE, [POINTERDOWN]: POINTERDOWN, [POINTERUP]: POINTERUP, [POINTERCANCEL]: POINTERCANCEL, pointerclick: "pointerclick", pointerdblclick: "pointerdblclick" } }; var getEventsMap = (eventType) => { const type = Util._getEventType(eventType); if (type === "pointer") return Konva$2.pointerEventsEnabled && EVENTS_MAP.pointer; if (type === "touch") return EVENTS_MAP.touch; if (type === "mouse") return EVENTS_MAP.mouse; }; function checkNoClip(attrs = {}) { if (attrs.clipFunc || attrs.clipWidth || attrs.clipHeight) Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."); return attrs; } var NO_POINTERS_MESSAGE = `Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);`; var stages = []; var listeningWindows = /* @__PURE__ */ new WeakSet(); var listenToWindow = (win) => { if (!win || listeningWindows.has(win)) return; listeningWindows.add(win); DD._listenToWindow(win); win.document.addEventListener("visibilitychange", () => { stages.forEach((stage) => { stage.batchDraw(); }); }); }; /** * Stage constructor. A stage is used to contain multiple layers * @constructor * @memberof Konva * @augments Konva.Container * @param {Object} config * @param {String|Element} config.container Container selector or DOM element * @@nodeParams * @example * var stage = new Konva.Stage({ * width: 500, * height: 800, * container: 'containerId' // or "#containerId" or ".containerClass" * }); */ var Stage$1 = class extends Container { constructor(config) { super(checkNoClip(config)); this._pointerPositions = []; this._changedPointerPositions = []; this._pointerStates = /* @__PURE__ */ new Map(); this._lastClicks = {}; this._buildDOM(); this._bindContentEvents(); stages.push(this); this.on("widthChange.konva heightChange.konva", this._resizeDOM); this.on("visibleChange.konva", this._checkVisibility); this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva", () => { checkNoClip(this.attrs); }); this._checkVisibility(); } _validateAdd(child) { const isLayer = child.getType() === "Layer"; const isFastLayer = child.getType() === "FastLayer"; if (!(isLayer || isFastLayer)) Util.throw("You may only add layers to the stage."); } _checkVisibility() { if (!this.content) return; const style = this.visible() ? "" : "none"; this.content.style.display = style; } /** * The window the stage is rendered in. It is not always the window Konva was * imported into: the container may belong to an iframe, or to a window * opened with `window.open`. */ _getOwnerWindow() { var _a; const element = this.content || this.container(); return ((_a = element === null || element === void 0 ? void 0 : element.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) || (Konva$2.isBrowser ? window : null); } /** * set container dom element which contains the stage wrapper div element * @method * @name Konva.Stage#setContainer * @param {DomElement} container can pass in a dom element or id string */ setContainer(container) { if (typeof container === STRING) { let id; if (container.charAt(0) === ".") { const className = container.slice(1); container = document.getElementsByClassName(className)[0]; } else { if (container.charAt(0) !== "#") id = container; else id = container.slice(1); container = document.getElementById(id); } if (!container) throw "Can not find container in document with id " + id; } this._setAttr("container", container); if (this.content) { if (this.content.parentElement) this.content.parentElement.removeChild(this.content); container.appendChild(this.content); listenToWindow(this._getOwnerWindow()); } return this; } shouldDrawHit() { return true; } /** * clear all layers * @method * @name Konva.Stage#clear */ clear() { const layers = this.children, len = layers.length; for (let n = 0; n < len; n++) layers[n].clear(); return this; } clone(obj) { if (!obj) obj = {}; obj.container = typeof document !== "undefined" && document.createElement("div"); return Container.prototype.clone.call(this, obj); } destroy() { var _a; super.destroy(); this._pointerStates.clear(); this._lastClicks = {}; const content = this.content; (_a = content === null || content === void 0 ? void 0 : content.parentNode) === null || _a === void 0 || _a.removeChild(content); const index = stages.indexOf(this); if (index > -1) stages.splice(index, 1); Util.releaseCanvas(this.bufferHitCanvas._canvas); return this; } /** * returns ABSOLUTE pointer position which can be a touch position or mouse position * pointer position doesn't include any transforms (such as scale) of the stage * it is just a plain position of pointer relative to top-left corner of the canvas * @method * @name Konva.Stage#getPointerPosition * @returns {Vector2d|null} */ getPointerPosition() { const pos = this._pointerPositions[0] || this._changedPointerPositions[0]; if (!pos) { Util.warn(NO_POINTERS_MESSAGE); return null; } return { x: pos.x, y: pos.y }; } _getPointerById(id) { return this._pointerPositions.find((p) => p.id === id); } getPointersPositions() { return this._pointerPositions; } getStage() { return this; } getContent() { return this.content; } _toKonvaCanvas(config) { config = { ...config }; config.x = config.x || 0; config.y = config.y || 0; config.width = config.width || this.width(); config.height = config.height || this.height(); const canvas = new SceneCanvas({ width: config.width, height: config.height, pixelRatio: config.pixelRatio || 1 }); const _context = canvas.getContext()._context; const layers = this.children; if (config.x || config.y) _context.translate(-1 * config.x, -1 * config.y); layers.forEach(function(layer) { if (!layer.isVisible()) return; const layerCanvas = layer._toKonvaCanvas(config); _context.drawImage(layerCanvas._canvas, config.x, config.y, layerCanvas.getWidth() / layerCanvas.getPixelRatio(), layerCanvas.getHeight() / layerCanvas.getPixelRatio()); Util.releaseCanvas(layerCanvas._canvas); }); return canvas; } /** * get visible intersection shape. This is the preferred * method for determining if a point intersects a shape or not. * It reads the hit canvas, so it finds what pointer events would: nodes with * listening set to false or invisible nodes are not detected, a shape with opacity 0 * is, and `hitStrokeWidth` counts. The position is relative to the top left corner of the * stage container, like `stage.getPointerPosition()`, without the stage transform * @method * @name Konva.Stage#getIntersection * @param {Object} pos * @param {Number} pos.x * @param {Number} pos.y * @returns {Konva.Node} * @example * var shape = stage.getIntersection({x: 50, y: 50}); */ getIntersection(pos) { if (!pos) return null; const layers = this.children, end = layers.length - 1; for (let n = end; n >= 0; n--) { const shape = layers[n].getIntersection(pos); if (shape) return shape; } return null; } _resizeDOM() { const width = this.width(); const height = this.height(); if (this.content) { this.content.style.width = width + PX; this.content.style.height = height + PX; } this.children.forEach((layer) => { layer._setSize({ width, height }); layer.draw(); }); } add(layer, ...rest) { if (arguments.length > 1) { for (let i = 0; i < arguments.length; i++) this.add(arguments[i]); return this; } super.add(layer); const length = this.children.length; if (length > MAX_LAYERS_NUMBER) Util.warn("The stage has " + length + " layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."); layer._setSize({ width: this.width(), height: this.height() }); layer.draw(); if (Konva$2.isBrowser) this.content.appendChild(layer.canvas._canvas); return this; } getParent() { return null; } getLayer() { return null; } hasPointerCapture(pointerId) { return hasPointerCapture(pointerId, this); } setPointerCapture(pointerId) { setPointerCapture(pointerId, this); } releaseCapture(pointerId) { releaseCapture(pointerId, this); } /** * returns an array of layers * @method * @name Konva.Stage#getLayers */ getLayers() { return this.getChildren(); } _bindContentEvents() { if (!Konva$2.isBrowser) return; EVENTS.forEach(([event, methodName]) => { this.content.addEventListener(event, (evt) => { this._batchEvents(() => this[methodName](evt)); }, { passive: false }); }); } _batchEvents(callback) { Util._batchEvents(this.eventBatchFunc(), callback); } _pointerenter(evt) { this.setPointersPositions(evt); const events = getEventsMap(evt.type); if (events) this._fire(events.pointerenter, { evt, target: this, currentTarget: this }); } _pointerover(evt) { this.setPointersPositions(evt); const events = getEventsMap(evt.type); if (events) this._fire(events.pointerover, { evt, target: this, currentTarget: this }); } _pointerEventsEnabled() { if (Konva$2.hitOnDragEnabled) return true; for (const { node, dragStatus } of DD._dragElements.values()) if (dragStatus === "dragging" && node.getStage() === this) return false; return !this.getLayers().some((layer) => { var _a; return (_a = Konva$2["Transformer"]) === null || _a === void 0 ? void 0 : _a._isLayerTransforming(layer); }); } _cancelClick(pointerId, eventType) { const types = eventType ? [eventType] : [ "mouse", "touch", "pointer" ]; for (const type of types) { const state = this._pointerStates.get(`${type}:${pointerId}`); if (!state) continue; state.clickStartShape = void 0; if (state.relatedPointer) state.relatedPointer.clickStartShape = void 0; } } _pointerleave(evt) { var _a, _b; const events = getEventsMap(evt.type); const eventType = Util._getEventType(evt.type); if (!events) return; this.setPointersPositions(evt); const pointerId = (_a = this._changedPointerPositions[0]) === null || _a === void 0 ? void 0 : _a.id; const key = `${eventType}:${pointerId}`; const state = this._pointerStates.get(key); const targetShape = ((_b = state === null || state === void 0 ? void 0 : state.targetShape) === null || _b === void 0 ? void 0 : _b.getStage()) === this ? state.targetShape : void 0; const eventsEnabled = this._pointerEventsEnabled() || evt.pointerType === "touch" && !(state === null || state === void 0 ? void 0 : state.downPosition); if (eventsEnabled) { if ((state === null || state === void 0 ? void 0 : state.clickStartShape) !== void 0) state.targetShape = void 0; else this._pointerStates.delete(key); } if (targetShape && eventsEnabled) { targetShape._fireAndBubble(events.pointerout, { evt, pointerId }); targetShape._fireAndBubble(events.pointerleave, { evt, pointerId }); this._fire(events.pointerleave, { evt, target: this, currentTarget: this }); } else if (eventsEnabled) { this._fire(events.pointerleave, { evt, target: this, currentTarget: this }); this._fire(events.pointerout, { evt, target: this, currentTarget: this }); } this.pointerPos = null; this._pointerPositions = []; this._changedPointerPositions = []; this._pointerEventType = void 0; } _pointerdown(evt) { const events = getEventsMap(evt.type); const eventType = Util._getEventType(evt.type); if (!events) return; this.setPointersPositions(evt); let triggeredOnShape = false; this._changedPointerPositions.forEach((pos) => { var _a; const shape = this.getIntersection(pos); const key = `${eventType}:${pos.id}`; const state = { targetShape: (_a = this._pointerStates.get(key)) === null || _a === void 0 ? void 0 : _a.targetShape, clickStartShape: shape && shape.isListening() ? shape : null, lastClick: this._lastClicks[eventType], downPosition: pos, pointerType: evt.pointerType }; this._pointerStates.delete(key); if (eventType !== "pointer") for (const [pointerKey, pointer] of [...this._pointerStates].reverse()) { if (!pointerKey.startsWith("pointer:") || !pointer.downPosition || eventType === "touch" && pointer.relatedPointer) continue; if (eventType === "mouse" ? pointer.pointerType !== "touch" : pointer.pointerType === "touch" && pointer.downPosition.x === pos.x && pointer.downPosition.y === pos.y) { state.relatedPointer = pointer; pointer.relatedPointer = state; if (pointer.clickStartShape === void 0) state.clickStartShape = void 0; break; } } this._pointerStates.set(key, state); for (const elem of DD._dragElements.values()) if (elem.dragStatus === "dragging" && (elem.pointerId === void 0 || elem.pointerEventType === eventType && elem.pointerId === pos.id || elem.pointerEventType === "mouse" && eventType === "pointer" && state.pointerType !== "touch") && elem.node.getStage() === this) { if (elem.pointerId === void 0 && eventType !== "pointer") { elem.pointerId = pos.id; elem.pointerEventType = eventType; } this._cancelClick(pos.id, eventType); } if (!shape || !shape.isListening()) return; if (Konva$2.capturePointerEventsEnabled) shape.setPointerCapture(pos.id); shape._fireAndBubble(events.pointerdown, { evt, pointerId: pos.id }); triggeredOnShape = true; const isTouch = evt.type.indexOf("touch") >= 0; if (shape.preventDefault() && evt.cancelable && isTouch) evt.preventDefault(); }); if (!triggeredOnShape) this._fire(events.pointerdown, { evt, target: this, currentTarget: this, pointerId: this._changedPointerPositions[0].id }); } _pointermove(evt) { const events = getEventsMap(evt.type); const eventType = Util._getEventType(evt.type); if (!events) return; const isTouchPointer = evt.type.indexOf("touch") >= 0 || evt.pointerType === "touch"; if (evt.cancelable && isTouchPointer) { for (const { node, dragStatus } of DD._dragElements.values()) if (dragStatus === "dragging" && node.getStage() === this && node.preventDefault()) { evt.preventDefault(); break; } } this.setPointersPositions(evt); if (!this._pointerEventsEnabled()) return; const processedShapesIds = {}; let triggeredOnShape = false; this._changedPointerPositions.forEach((pos) => { var _a; const key = `${eventType}:${pos.id}`; let state = this._pointerStates.get(key); if (!state) { state = {}; this._pointerStates.set(key, state); } const shape = getCapturedShape(pos.id) || this.getIntersection(pos); const targetShape = state.targetShape === shape || ((_a = state.targetShape) === null || _a === void 0 ? void 0 : _a.getStage()) === this ? state.targetShape : void 0; const pointerId = pos.id; const event = { evt, pointerId }; const differentTarget = targetShape !== shape; state.targetShape = shape && shape.isListening() ? shape : void 0; if (differentTarget && targetShape) { targetShape._fireAndBubble(events.pointerout, { ...event }, shape); targetShape._fireAndBubble(events.pointerleave, { ...event }, shape); } if (shape && shape.isListening()) { triggeredOnShape = true; if (differentTarget) { shape._fireAndBubble(events.pointerover, { ...event }, targetShape); shape._fireAndBubble(events.pointerenter, { ...event }, targetShape); } if (!processedShapesIds[shape._id]) { processedShapesIds[shape._id] = true; shape._fireAndBubble(events.pointermove, { ...event }); } } else if (targetShape) this._fire(events.pointerover, { evt, target: this, currentTarget: this, pointerId }); }); if (!triggeredOnShape) this._fire(events.pointermove, { evt, target: this, currentTarget: this, pointerId: this._changedPointerPositions[0].id }); } _pointerup(evt) { const events = getEventsMap(evt.type); const eventType = Util._getEventType(evt.type); if (!events) return; this.setPointersPositions(evt); const processedShapesIds = {}; let skipPointerUpTrigger = false; this._changedPointerPositions.forEach((pos) => { var _a; const key = `${eventType}:${pos.id}`; const state = this._pointerStates.get(key); const listenClick = (state === null || state === void 0 ? void 0 : state.clickStartShape) !== void 0; const clickStartShape = state === null || state === void 0 ? void 0 : state.clickStartShape; if ((state === null || state === void 0 ? void 0 : state.targetShape) && eventType !== "touch") this._pointerStates.set(key, { targetShape: state.targetShape }); else this._pointerStates.delete(key); const shape = getCapturedShape(pos.id) || this.getIntersection(pos); const alreadyReleased = shape && processedShapesIds[shape._id]; if (shape) { shape.releaseCapture(pos.id); processedShapesIds[shape._id] = true; } const pointerId = pos.id; const event = { evt, pointerId }; const clickTarget = shape && shape.isListening() ? shape : null; const lastClick = this._lastClicks[eventType]; const canClick = listenClick && (!clickTarget || clickStartShape === clickTarget); const fireDblClick = canClick && lastClick && (state === null || state === void 0 ? void 0 : state.lastClick) === lastClick && lastClick.shape === clickTarget && Date.now() - lastClick.time < Konva$2.dblClickWindow; if (canClick) this._lastClicks[eventType] = fireDblClick ? void 0 : { shape: clickTarget, time: Date.now() }; if (shape && shape.isListening()) { skipPointerUpTrigger = true; if (!alreadyReleased) shape._fireAndBubble(events.pointerup, { ...event }); if (listenClick && clickStartShape === shape) { shape._fireAndBubble(events.pointerclick, { ...event }); if (fireDblClick) shape._fireAndBubble(events.pointerdblclick, { ...event }); } } else { if (!skipPointerUpTrigger) { this._fire(events.pointerup, { evt, target: this, currentTarget: this, pointerId: this._changedPointerPositions[0].id }); skipPointerUpTrigger = true; } if (listenClick) this._fire(events.pointerclick, { evt, target: this, currentTarget: this, pointerId }); if (fireDblClick) this._fire(events.pointerdblclick, { evt, target: this, currentTarget: this, pointerId }); } if (eventType === "touch" && ((_a = state === null || state === void 0 ? void 0 : state.targetShape) === null || _a === void 0 ? void 0 : _a.getStage()) === this) { state.targetShape._fireAndBubble(events.pointerout, { ...event }); state.targetShape._fireAndBubble(events.pointerleave, { ...event }); } }); if (!skipPointerUpTrigger) this._fire(events.pointerup, { evt, target: this, currentTarget: this, pointerId: this._changedPointerPositions[0].id }); if (evt.cancelable && eventType !== "touch" && eventType !== "pointer") evt.preventDefault(); } _contextmenu(evt) { this.setPointersPositions(evt); const shape = this.getIntersection(this.getPointerPosition()); if (shape && shape.isListening()) shape._fireAndBubble(CONTEXTMENU, { evt }); else this._fire(CONTEXTMENU, { evt, target: this, currentTarget: this }); } _wheel(evt) { this.setPointersPositions(evt); const shape = this.getIntersection(this.getPointerPosition()); if (shape && shape.isListening()) shape._fireAndBubble(WHEEL, { evt }); else this._fire(WHEEL, { evt, target: this, currentTarget: this }); } _pointercancel(evt) { this.setPointersPositions(evt); const events = getEventsMap(evt.type); this._changedPointerPositions.forEach((pos) => { var _a; const eventType = Util._getEventType(evt.type); const key = `${eventType}:${pos.id}`; this._cancelClick(pos.id, eventType); const targetShape = (_a = this._pointerStates.get(key)) === null || _a === void 0 ? void 0 : _a.targetShape; if (targetShape && eventType !== "touch") this._pointerStates.set(key, { targetShape }); else this._pointerStates.delete(key); const shape = getCapturedShape(pos.id) || this.getIntersection(pos); const event = { evt, pointerId: pos.id }; if (shape) { if (events) shape._fireAndBubble(events.pointercancel, { ...event }); shape._fireAndBubble(POINTERUP, { ...event }); } else if (events) this._fire(events.pointercancel, { ...event, target: this, currentTarget: this }); releaseCapture(pos.id); if (events && eventType === "touch" && (targetShape === null || targetShape === void 0 ? void 0 : targetShape.getStage()) === this) { targetShape._fireAndBubble(events.pointerout, { ...event }); targetShape._fireAndBubble(events.pointerleave, { ...event }); } }); } _lostpointercapture(evt) { if (getCapturedShape(evt.pointerId, this)) releaseCapture(evt.pointerId); } /** * manually register pointers positions (mouse/touch) in the stage. * So you can use stage.getPointerPosition(). Usually you don't need to use that method * because all internal events are automatically registered. It may be useful if event * is triggered outside of the stage, but you still want to use Konva methods to get pointers position. * @method * @name Konva.Stage#setPointersPositions * @param {Object} evt Event object * @example * * window.addEventListener('mousemove', (e) => { * stage.setPointersPositions(e); * }); */ setPointersPositions(evt) { const contentPosition = this._getContentPosition(); let x = null, y = null; evt = evt ? evt : window.event; if (evt.touches !== void 0) { this._pointerEventType = "touch"; this._pointerPositions = []; this._changedPointerPositions = []; Array.prototype.forEach.call(evt.touches, (touch) => { this._pointerPositions.push({ id: touch.identifier, x: (touch.clientX - contentPosition.left) / contentPosition.scaleX, y: (touch.clientY - contentPosition.top) / contentPosition.scaleY }); }); Array.prototype.forEach.call(evt.changedTouches || evt.touches, (touch) => { this._changedPointerPositions.push({ id: touch.identifier, x: (touch.clientX - contentPosition.left) / contentPosition.scaleX, y: (touch.clientY - contentPosition.top) / contentPosition.scaleY }); }); } else { this._pointerEventType = evt.pointerId === void 0 ? "mouse" : "pointer"; x = (evt.clientX - contentPosition.left) / contentPosition.scaleX; y = (evt.clientY - contentPosition.top) / contentPosition.scaleY; this.pointerPos = { x, y }; this._pointerPositions = [{ x, y, id: Util._getFirstPointerId(evt) }]; this._changedPointerPositions = [{ x, y, id: Util._getFirstPointerId(evt) }]; } } _setPointerPosition(evt) { Util.warn("Method _setPointerPosition is deprecated. Use \"stage.setPointersPositions(event)\" instead."); this.setPointersPositions(evt); } _getContentPosition() { if (!this.content || !this.content.getBoundingClientRect) return { top: 0, left: 0, scaleX: 1, scaleY: 1 }; const rect = this.content.getBoundingClientRect(); return { top: rect.top, left: rect.left, scaleX: rect.width / this.content.clientWidth || 1, scaleY: rect.height / this.content.clientHeight || 1 }; } _buildDOM() { this.bufferHitCanvas = new HitCanvas({ pixelRatio: 1, width: 0, height: 0 }); if (!Konva$2.isBrowser) return; const container = this.container(); if (!container) throw "Stage has no container. A container is required."; container.innerHTML = ""; this.content = container.ownerDocument.createElement("div"); this.content.style.position = "relative"; this.content.style.userSelect = "none"; this.content.className = "konvajs-content"; this.content.setAttribute("role", "presentation"); container.appendChild(this.content); listenToWindow(this._getOwnerWindow()); this._resizeDOM(); } cache() { Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."); return this; } clearCache() { return this; } /** * batch draw * @method * @name Konva.Stage#batchDraw * @return {Konva.Stage} this */ batchDraw() { var _a; (_a = this.children) === null || _a === void 0 || _a.forEach(function(layer) { layer.batchDraw(); }); return this; } }; Stage$1.prototype.nodeType = STAGE; _registerNode(Stage$1); /** * get/set container DOM element. The container may belong to another window * than the one Konva was imported into: an iframe, or a window opened with * `window.open`. The stage then uses the events and the frames of that window. * @method * @name Konva.Stage#container * @returns {DomElement} container * @example * // get container * var container = stage.container(); * // set container * var container = document.createElement('div'); * body.appendChild(container); * stage.container(container); * * // a stage in a popout window * var popout = window.open('', '', 'width=600,height=400'); * stage.container(popout.document.body); */ Factory.addGetterSetter(Stage$1, "container"); /** * Get/set the callback used by framework integrations to batch native input. * The callback must invoke its argument exactly once, synchronously. Existing * node events keep their order and cancellation behavior. Direct node.fire() * and programmatic mutations do not create a batch. * Missing calls warn; duplicate or late calls warn and are ignored. Exceptions * propagate and skipped input is not replayed, so an invalid callback can * prevent input processing and drag cleanup. * Each native Konva listener creates its own scope; a DOM event may invoke * several listeners. Batching does not reorder or merge those listeners. * @method * @name Konva.Stage#eventBatchFunc * @example * stage.eventBatchFunc((run) => frameworkBatch(run)); */ Factory.addGetterSetter(Stage$1, "eventBatchFunc"); //#endregion //#region node_modules/konva/lib/Shape.js var HAS_SHADOW = "hasShadow"; var HAS_FILL = "hasFill"; var HAS_STROKE = "hasStroke"; var SHADOW_RGBA = "shadowRGBA"; var patternImage = "patternImage"; var linearGradient = "linearGradient"; var radialGradient = "radialGradient"; var dummyContext$1; function getDummyContext$1() { if (dummyContext$1) return dummyContext$1; dummyContext$1 = Util.createCanvasElement().getContext("2d"); return dummyContext$1; } var shapes = {}; function _fillFunc$2(context) { const fillRule = this.attrs.fillRule; if (fillRule) context.fill(fillRule); else context.fill(); } function _strokeFunc$2(context) { context.stroke(); } function _clearHasShadowCache() { this._clearCache(HAS_SHADOW); } function _clearHasFillCache() { this._clearCache(HAS_FILL); } function _clearHasStrokeCache() { this._clearCache(HAS_STROKE); } function _clearGetShadowRGBACache() { this._clearCache(SHADOW_RGBA); } function _clearFillPatternCache() { this._clearCache(patternImage); } function _clearLinearGradientCache() { this._clearCache(linearGradient); } function _clearRadialGradientCache() { this._clearCache(radialGradient); } /** * Shape constructor. Shapes are primitive objects such as rectangles, * circles, text, lines, etc. * @constructor * @memberof Konva * @augments Konva.Node * @param {Object} config * @@shapeParams * @@nodeParams * @example * var customShape = new Konva.Shape({ * x: 5, * y: 10, * fill: 'red', * // a Konva.Canvas renderer is passed into the sceneFunc function * sceneFunc (context, shape) { * context.beginPath(); * context.moveTo(200, 50); * context.lineTo(420, 80); * context.quadraticCurveTo(300, 100, 260, 170); * context.closePath(); * // Konva specific method * context.fillStrokeShape(shape); * } *}); */ var Shape$1 = class Shape$1 extends Node { constructor(config) { super(config); let key; let attempts = 0; while (true) { key = Util.getHitColor(); if (key && !(key in shapes)) break; attempts++; if (attempts >= 1e4) { Util.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."); key = Util.getRandomColor(); break; } } this.colorKey = key; shapes[key] = this; } /** * @deprecated */ getContext() { Util.warn("shape.getContext() method is deprecated. Please do not use it."); return this.getLayer().getContext(); } /** * @deprecated */ getCanvas() { Util.warn("shape.getCanvas() method is deprecated. Please do not use it."); return this.getLayer().getCanvas(); } getSceneFunc() { return this.attrs.sceneFunc || this["_sceneFunc"]; } getHitFunc() { return this.attrs.hitFunc || this["_hitFunc"]; } /** * returns whether or not a shadow will be rendered * @method * @name Konva.Shape#hasShadow * @returns {Boolean} */ hasShadow() { return this._getCache(HAS_SHADOW, this._hasShadow); } _hasShadow() { return this.shadowEnabled() && this.shadowOpacity() !== 0 && !!(this.shadowColor() || this.shadowBlur() || this.shadowOffsetX() || this.shadowOffsetY()); } _getFillPattern() { return this._getCache(patternImage, this.__getFillPattern); } __getFillPattern() { if (this.fillPatternImage()) { const pattern = getDummyContext$1().createPattern(this.fillPatternImage(), this.fillPatternRepeat() || "repeat"); if (pattern && pattern.setTransform) { const tr = new Transform(); tr.translate(this.fillPatternX(), this.fillPatternY()); tr.rotate(Konva$2.getAngle(this.fillPatternRotation())); tr.scale(this.fillPatternScaleX(), this.fillPatternScaleY()); tr.translate(-1 * this.fillPatternOffsetX(), -1 * this.fillPatternOffsetY()); const m = tr.getMatrix(); const matrix = typeof DOMMatrix === "undefined" ? { a: m[0], b: m[1], c: m[2], d: m[3], e: m[4], f: m[5] } : new DOMMatrix(m); pattern.setTransform(matrix); } return pattern; } } _getLinearGradient() { return this._getCache(linearGradient, this.__getLinearGradient); } __getLinearGradient() { const colorStops = this.fillLinearGradientColorStops(); if (colorStops) { const ctx = getDummyContext$1(); const start = this.fillLinearGradientStartPoint(); const end = this.fillLinearGradientEndPoint(); const grd = ctx.createLinearGradient(start.x, start.y, end.x, end.y); for (let n = 0; n < colorStops.length; n += 2) grd.addColorStop(colorStops[n], colorStops[n + 1]); return grd; } } _getRadialGradient() { return this._getCache(radialGradient, this.__getRadialGradient); } __getRadialGradient() { const colorStops = this.fillRadialGradientColorStops(); if (colorStops) { const ctx = getDummyContext$1(); const start = this.fillRadialGradientStartPoint(); const end = this.fillRadialGradientEndPoint(); const grd = ctx.createRadialGradient(start.x, start.y, this.fillRadialGradientStartRadius(), end.x, end.y, this.fillRadialGradientEndRadius()); for (let n = 0; n < colorStops.length; n += 2) grd.addColorStop(colorStops[n], colorStops[n + 1]); return grd; } } getShadowRGBA() { return this._getCache(SHADOW_RGBA, this._getShadowRGBA); } _getShadowRGBA() { if (!this.hasShadow()) return; const rgba = Util.colorToRGBA(this.shadowColor()); if (rgba) return "rgba(" + rgba.r + "," + rgba.g + "," + rgba.b + "," + rgba.a * (this.shadowOpacity() || 1) + ")"; } /** * returns whether or not the shape will be filled * @method * @name Konva.Shape#hasFill * @returns {Boolean} */ hasFill() { return this._getCache(HAS_FILL, this._hasFill); } _hasFill() { return this.fillEnabled() && !!(this.fill() || this.fillPatternImage() || this.fillLinearGradientColorStops() || this.fillRadialGradientColorStops()); } /** * returns whether or not the shape will be stroked * @method * @name Konva.Shape#hasStroke * @returns {Boolean} */ hasStroke() { return this._getCache(HAS_STROKE, this._hasStroke); } _hasStroke() { return this.strokeEnabled() && !!(this.strokeWidth() && (this.stroke() || this.strokeLinearGradientColorStops())); } hasHitStroke() { const width = this.hitStrokeWidth(); if (width === "auto") return this.hasStroke(); return this.strokeEnabled() && !!width; } /** * determines if point is in the shape, regardless if other shapes are on top of it. Note: because * this method clears a temporary canvas and then redraws the shape, it performs very poorly if executed many times * consecutively. Please use the {@link Konva.Stage#getIntersection} method if at all possible * because it performs much better. A shape that is invisible, not listening or not on a stage * never intersects * @method * @name Konva.Shape#intersects * @param {Object} point * @param {Number} point.x * @param {Number} point.y * @returns {Boolean} */ intersects(point) { const stage = this.getStage(); if (!stage) return false; const bufferHitCanvas = stage.bufferHitCanvas; bufferHitCanvas.setSizeIfChanged(stage.width(), stage.height()); bufferHitCanvas.getContext().clear(); this.drawHit(bufferHitCanvas); return bufferHitCanvas.context.getImageData(Math.floor(point.x), Math.floor(point.y), 1, 1).data[3] > 0; } destroy() { Node.prototype.destroy.call(this); delete shapes[this.colorKey]; delete this.colorKey; return this; } _useBufferCanvas(forceFill, opacity = this.getAbsoluteOpacity()) { var _a; if (!((_a = this.attrs.perfectDrawEnabled) !== null && _a !== void 0 ? _a : true)) return false; const hasFill = forceFill || this.hasFill(); const hasStroke = this.hasStroke(); const isTransparent = !this._isUnderCache && opacity !== 1; if (hasFill && hasStroke && isTransparent) return true; const hasShadow = this.hasShadow(); const strokeForShadow = this.shadowForStrokeEnabled(); if (hasFill && hasStroke && hasShadow && strokeForShadow) return true; return false; } setStrokeHitEnabled(val) { Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."); if (val) this.hitStrokeWidth("auto"); else this.hitStrokeWidth(0); } getStrokeHitEnabled() { if (this.hitStrokeWidth() === 0) return false; else return true; } /** * return self rectangle (x, y, width, height) of shape. * This method are not taken into account transformation and styles. * @method * @name Konva.Shape#getSelfRect * @returns {Object} rect with {x, y, width, height} properties * @example * * rect.getSelfRect(); // return {x:0, y:0, width:rect.width(), height:rect.height()} * circle.getSelfRect(); // return {x: - circle.width() / 2, y: - circle.height() / 2, width:circle.width(), height:circle.height()} * */ getSelfRect() { const selfRectFunc = this.attrs.selfRectFunc; if (selfRectFunc) return { ...selfRectFunc.call(this, this) }; const size = this.size(); return { x: this._centroid ? -size.width / 2 : 0, y: this._centroid ? -size.height / 2 : 0, width: size.width, height: size.height }; } _getSelfRectForDrawing() { return this.getSelfRect(); } getClientRect(config = {}) { const cachedRect = this._getCachedSceneRect(config); if (cachedRect) return cachedRect; const skipTransform = config.skipTransform; const relativeTo = config.relativeTo; const forDrawing = config._forDrawing; let fillRect = forDrawing ? this._getSelfRectForDrawing() : this.getSelfRect(); if (forDrawing && !this.strokeScaleEnabled()) fillRect = this._transformedRect(fillRect, relativeTo); else if (fillRect.width < 0 || fillRect.height < 0) fillRect = new Transform()._getTransformedRect(fillRect); const strokeWidth = !config.skipStroke && this.hasStroke() ? forDrawing ? this._getStrokePadding() * 2 : this.strokeWidth() : 0; let strokeWidthX = strokeWidth; let strokeWidthY = strokeWidth; let collapsedStroke; if (!forDrawing && strokeWidth && !this.strokeScaleEnabled()) { let top = this; while (top && !top.isCached() && !top._isUnderCache) top = top.parent; const [a, b, c, d] = this.getAbsoluteTransform(top).getMatrix(); const determinant = Math.abs(a * d - b * c); if (determinant) { strokeWidthX *= Math.hypot(c, d) / determinant; strokeWidthY *= Math.hypot(a, b) / determinant; } else if (!skipTransform) { strokeWidthX = strokeWidthY = 0; collapsedStroke = top ? top.getAbsoluteTransform().copy() : new Transform(); if (relativeTo) { const relativeTransform = relativeTo.getAbsoluteTransform(); const [a, b, c, d] = relativeTransform.getMatrix(); collapsedStroke = a * d - b * c ? relativeTransform.copy().invert().multiply(collapsedStroke) : new Transform(); } } } let rect = { x: fillRect.x - strokeWidthX / 2, y: fillRect.y - strokeWidthY / 2, width: fillRect.width + strokeWidthX, height: fillRect.height + strokeWidthY }; if (forDrawing && this.strokeScaleEnabled()) rect = this._transformedRect(rect, relativeTo); if (!config.skipShadow && this.hasShadow()) { const scale = forDrawing ? this.getAbsoluteScale() : { x: 1, y: 1 }; const dx = this.shadowOffsetX() * scale.x; const dy = this.shadowOffsetY() * scale.y; const blur = this.shadowBlur() * (forDrawing ? 2 * Math.min(Math.abs(scale.x), Math.abs(scale.y)) : 1); rect.x += Math.min(0, dx) - blur; rect.y += Math.min(0, dy) - blur; rect.width += Math.abs(dx) + blur * 2; rect.height += Math.abs(dy) + blur * 2; } if (forDrawing) return rect; if (!skipTransform) { const transformed = this._transformedRect(rect, relativeTo); if (collapsedStroke) { const [a, b, c, d] = collapsedStroke.getMatrix(); const x = strokeWidth * Math.hypot(a, c) / 2; const y = strokeWidth * Math.hypot(b, d) / 2; transformed.x -= x; transformed.y -= y; transformed.width += x * 2; transformed.height += y * 2; } return transformed; } return rect; } _getStrokePadding(miterLimit = this.miterLimit() || 10) { if (this.attrs.sceneFunc) miterLimit = this.miterLimit() || 10; return Math.abs(this.strokeWidth()) / 2 * Math.max(this.lineCap() === "square" ? Math.SQRT2 : 1, (this.lineJoin() || "miter") === "miter" ? miterLimit : 1); } drawScene(can, top) { const layer = this.getLayer(); const canvas = can || layer.getCanvas(), context = canvas.getContext(), cachedCanvas = this._getCanvasCache(), drawFunc = this.getSceneFunc(), hasShadow = this.hasShadow(); const cachingSelf = top === this; if (!(top ? this._isVisible(top) : this.isVisible()) && !cachingSelf) return this; if (cachedCanvas) { context.save(); const m = this.getAbsoluteTransform(top).getMatrix(); context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); this._drawCachedSceneCanvas(context); context.restore(); return this; } if (!drawFunc) return this; context.save(); try { if (canvas.width && canvas.height && this._useBufferCanvas(void 0, context._getOpacity(this))) { const bounded = !!context._opacityRoot || !!this.attrs.selfRectFunc && this.getSelfRect === Shape$1.prototype.getSelfRect || !this.attrs.sceneFunc && !this.attrs.charRenderFunc && _boundedShapes.has(this.constructor); const bc = canvas._prepareIsolationCanvas(bounded ? this.getClientRect({ _forDrawing: true, relativeTo: top, skipShadow: true }) : void 0); const bufferContext = bc.getContext(); bufferContext.save(); bufferContext._applyLineJoin(this); bufferContext._applyMiterLimit(this); const o = this.getAbsoluteTransform(top).getMatrix(); bufferContext.transform(o[0], o[1], o[2], o[3], o[4], o[5]); drawFunc.call(this, bufferContext, this); bufferContext.restore(); if (hasShadow) context._applyShadow(this); if (!cachingSelf) { context._applyOpacity(this); context._applyGlobalCompositeOperation(this); } context._drawDeviceBuffer(bc); } else { context._applyLineJoin(this); context._applyMiterLimit(this); if (!cachingSelf) { const o = this.getAbsoluteTransform(top).getMatrix(); context.transform(o[0], o[1], o[2], o[3], o[4], o[5]); context._applyOpacity(this); context._applyGlobalCompositeOperation(this); } if (hasShadow) context._applyShadow(this); drawFunc.call(this, context, this); } } catch (error) { canvas._releaseIsolationCanvas(); throw error; } finally { context.restore(); } return this; } drawHit(can, top) { if (!this.shouldDrawHit(top)) return this; const layer = this.getLayer(), canvas = can || layer.hitCanvas, context = canvas && canvas.getContext(), drawFunc = this.hitFunc() || this.sceneFunc(), cachedHitCanvas = this._getCachedHitCanvas(top); if (!this.colorKey) Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"); if (cachedHitCanvas) { context.save(); const m = this.getAbsoluteTransform(top).getMatrix(); context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); this._drawCachedHitCanvas(context, cachedHitCanvas); context.restore(); return this; } if (!drawFunc) return this; context.save(); context._applyLineJoin(this); context._applyMiterLimit(this); if (!(this === top)) { const o = this.getAbsoluteTransform(top).getMatrix(); context.transform(o[0], o[1], o[2], o[3], o[4], o[5]); } try { drawFunc.call(this, context, this); } finally { context.restore(); } return this; } /** * draw hit graph using the cached scene canvas * @method * @name Konva.Shape#drawHitFromCache * @param {Integer} alphaThreshold alpha channel threshold that determines whether or not * a pixel should be drawn onto the hit graph. Must be a value between 0 and 255. * The default is 0 * @returns {Konva.Shape} * @example * shape.cache(); * shape.drawHitFromCache(); */ drawHitFromCache(alphaThreshold = 0) { const sceneCanvas = this._getCachedSceneCanvas(), hitCanvas = this._getCachedHitCanvas(), hitContext = hitCanvas.getContext(), hitWidth = hitCanvas.getWidth(), hitHeight = hitCanvas.getHeight(); hitContext.clear(); hitContext.drawImage(sceneCanvas._canvas, 0, 0, hitWidth / hitCanvas.pixelRatio, hitHeight / hitCanvas.pixelRatio); try { const hitImageData = hitContext.getImageData(0, 0, hitWidth, hitHeight); const hitData = hitImageData.data; const len = hitData.length; const rgbColorKey = Util._hexToRgb(this.colorKey); for (let i = 0; i < len; i += 4) if (hitData[i + 3] > alphaThreshold) { hitData[i] = rgbColorKey.r; hitData[i + 1] = rgbColorKey.g; hitData[i + 2] = rgbColorKey.b; hitData[i + 3] = 255; } else hitData[i + 3] = 0; hitContext.putImageData(hitImageData, 0, 0); } catch (e) { Util.error("Unable to draw hit graph from cached scene canvas. " + e.message); } return this; } hasPointerCapture(pointerId) { return hasPointerCapture(pointerId, this); } setPointerCapture(pointerId) { setPointerCapture(pointerId, this); } releaseCapture(pointerId) { releaseCapture(pointerId, this); } }; Shape$1.prototype._fillFunc = _fillFunc$2; Shape$1.prototype._strokeFunc = _strokeFunc$2; Shape$1.prototype._fillFuncHit = _fillFunc$2; Shape$1.prototype._strokeFuncHit = _strokeFunc$2; Shape$1.prototype._centroid = false; Shape$1.prototype.nodeType = "Shape"; _registerNode(Shape$1); Shape$1.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetXChange.konva shadowOffsetYChange.konva shadowOpacityChange.konva shadowEnabledChange.konva", _clearHasShadowCache); Shape$1.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva", _clearGetShadowRGBACache); Shape$1.prototype.on("fillEnabledChange.konva fillChange.konva fillPatternImageChange.konva fillLinearGradientColorStopsChange.konva fillRadialGradientColorStopsChange.konva", _clearHasFillCache); Shape$1.prototype.on("strokeEnabledChange.konva strokeWidthChange.konva strokeChange.konva strokeLinearGradientColorStopsChange.konva", _clearHasStrokeCache); Shape$1.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva", _clearFillPatternCache); Shape$1.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva", _clearLinearGradientCache); Shape$1.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva", _clearRadialGradientCache); Factory.addGetterSetter(Shape$1, "stroke", void 0, getStringOrGradientValidator()); /** * get/set stroke color * @name Konva.Shape#stroke * @method * @param {String} color * @returns {String} * @example * // get stroke color * var stroke = shape.stroke(); * * // set stroke color with color string * shape.stroke('green'); * * // set stroke color with hex * shape.stroke('#00ff00'); * * // set stroke color with rgb * shape.stroke('rgb(0,255,0)'); * * // set stroke color with rgba and make it 50% opaque * shape.stroke('rgba(0,255,0,0.5'); */ Factory.addGetterSetter(Shape$1, "strokeWidth", 2, getNumberValidator()); /** * get/set stroke width * @name Konva.Shape#strokeWidth * @method * @param {Number} strokeWidth * @returns {Number} * @example * // get stroke width * var strokeWidth = shape.strokeWidth(); * * // set stroke width * shape.strokeWidth(10); */ Factory.addGetterSetter(Shape$1, "fillAfterStrokeEnabled", false); /** * get/set fillAfterStrokeEnabled property. By default Konva is drawing filling first, then stroke on top of the fill. * In rare situations you may want a different behavior. When you have a stroke first then fill on top of it. * Especially useful for Text objects. * Default is false. * @name Konva.Shape#fillAfterStrokeEnabled * @method * @param {Boolean} fillAfterStrokeEnabled * @returns {Boolean} * @example * // get stroke width * var fillAfterStrokeEnabled = shape.fillAfterStrokeEnabled(); * * // set stroke width * shape.fillAfterStrokeEnabled(true); */ Factory.addGetterSetter(Shape$1, "hitStrokeWidth", "auto", getNumberOrAutoValidator()); /** * get/set stroke width for hit detection. Default value is "auto", it means it will be equals to strokeWidth * @name Konva.Shape#hitStrokeWidth * @method * @param {Number} hitStrokeWidth * @returns {Number} * @example * // get stroke width * var hitStrokeWidth = shape.hitStrokeWidth(); * * // set hit stroke width * shape.hitStrokeWidth(20); * // set hit stroke width always equals to scene stroke width * shape.hitStrokeWidth('auto'); */ Factory.addGetterSetter(Shape$1, "strokeHitEnabled", true, getBooleanValidator()); /** * **deprecated, use hitStrokeWidth instead!** get/set strokeHitEnabled property. Useful for performance optimization. * You may set `shape.strokeHitEnabled(false)`. In this case stroke will be no draw on hit canvas, so hit area * of shape will be decreased (by lineWidth / 2). Remember that non closed line with `strokeHitEnabled = false` * will be not drawn on hit canvas, that is mean line will no trigger pointer events (like mouseover) * Default value is true. * @name Konva.Shape#strokeHitEnabled * @method * @param {Boolean} strokeHitEnabled * @returns {Boolean} * @example * // get strokeHitEnabled * var strokeHitEnabled = shape.strokeHitEnabled(); * * // set strokeHitEnabled * shape.strokeHitEnabled(); */ Factory.addGetterSetter(Shape$1, "perfectDrawEnabled", true, getBooleanValidator()); /** * get/set perfectDrawEnabled. If a shape has fill, stroke and opacity you may set `perfectDrawEnabled` to false to improve performance. * See http://konvajs.org/docs/performance/Disable_Perfect_Draw.html for more information. * Default value is true * @name Konva.Shape#perfectDrawEnabled * @method * @param {Boolean} perfectDrawEnabled * @returns {Boolean} * @example * // get perfectDrawEnabled * var perfectDrawEnabled = shape.perfectDrawEnabled(); * * // set perfectDrawEnabled * shape.perfectDrawEnabled(); */ Factory.addGetterSetter(Shape$1, "shadowForStrokeEnabled", true, getBooleanValidator()); /** * get/set shadowForStrokeEnabled. Useful for performance optimization. * You may set `shape.shadowForStrokeEnabled(false)`. In this case stroke will no effect shadow. * Remember if you set `shadowForStrokeEnabled = false` for non closed line - that line will have no shadow!. * Default value is true * @name Konva.Shape#shadowForStrokeEnabled * @method * @param {Boolean} shadowForStrokeEnabled * @returns {Boolean} * @example * // get shadowForStrokeEnabled * var shadowForStrokeEnabled = shape.shadowForStrokeEnabled(); * * // set shadowForStrokeEnabled * shape.shadowForStrokeEnabled(); */ Factory.addGetterSetter(Shape$1, "lineJoin"); /** * get/set line join. Can be miter, round, or bevel. The * default is miter * @name Konva.Shape#lineJoin * @method * @param {String} lineJoin * @returns {String} * @example * // get line join * var lineJoin = shape.lineJoin(); * * // set line join * shape.lineJoin('round'); */ Factory.addGetterSetter(Shape$1, "lineCap"); /** * get/set line cap. Can be butt, round, or square * @name Konva.Shape#lineCap * @method * @param {String} lineCap * @returns {String} * @example * // get line cap * var lineCap = shape.lineCap(); * * // set line cap * shape.lineCap('round'); */ Factory.addGetterSetter(Shape$1, "miterLimit"); /** * get/set miterLimit. * @name Konva.Shape#miterLimit * @method * @param {Number} miterLimit * @returns {Number} * @example * // get miter limit * var miterLimit = shape.miterLimit(); * * // set miter limit * shape.miterLimit(10); */ Factory.addGetterSetter(Shape$1, "sceneFunc"); /** * get/set scene draw function. That function is used to draw the shape on a canvas. * Also that function will be used to draw hit area of the shape, in case if hitFunc is not defined. * @name Konva.Shape#sceneFunc * @method * @param {Function} drawFunc drawing function * @returns {Function} * @example * // get scene draw function * var sceneFunc = shape.sceneFunc(); * * // set scene draw function * shape.sceneFunc(function(context, shape) { * context.beginPath(); * context.rect(0, 0, shape.width(), shape.height()); * context.closePath(); * // important Konva method that fill and stroke shape from its properties * // like stroke and fill * context.fillStrokeShape(shape); * }); */ Factory.addGetterSetter(Shape$1, "hitFunc"); /** * get/set hit draw function. That function is used to draw custom hit area of a shape. * @name Konva.Shape#hitFunc * @method * @param {Function} drawFunc drawing function * @returns {Function} * @example * // get hit draw function * var hitFunc = shape.hitFunc(); * * // set hit draw function * shape.hitFunc(function(context) { * context.beginPath(); * context.rect(0, 0, shape.width(), shape.height()); * context.closePath(); * // important Konva method that fill and stroke shape from its properties * context.fillStrokeShape(shape); * }); */ Factory.addGetterSetter(Shape$1, "selfRectFunc"); /** * get/set the function that returns the self rectangle of a custom shape: the * local, untransformed area its sceneFunc paints, before the stroke and shadow * Konva adds. Use it when drawing goes outside the width and height box, so * bounds, cache(), isolated groups and perfect drawing include that paint. * Paint outside the returned rectangle can be clipped. Meant for custom * shapes, and for Text drawn with charRenderFunc; built-in shapes that compute * their own bounds may ignore it. * @name Konva.Shape#selfRectFunc * @method * @param {Function} selfRectFunc function returning {x, y, width, height} * @returns {Function} * @example * shape.selfRectFunc(() => ({ x: -10, y: -10, width: 120, height: 120 })); * // back to the automatic width and height box * shape.selfRectFunc(undefined); */ Factory.addGetterSetter(Shape$1, "dash"); /** * get/set dash array for stroke. * @name Konva.Shape#dash * @method * @param {Array} dash * @returns {Array} * @example * // apply dashed stroke that is 10px long and 5 pixels apart * line.dash([10, 5]); * // apply dashed stroke that is made up of alternating dashed * // lines that are 10px long and 20px apart, and dots that have * // a radius of 5px and are 20px apart * line.dash([10, 20, 0.001, 20]); */ Factory.addGetterSetter(Shape$1, "dashOffset", 0, getNumberValidator()); /** * get/set dash offset for stroke. * @name Konva.Shape#dash * @method * @param {Number} dash offset * @returns {Number} * @example * // apply dashed stroke that is 10px long and 5 pixels apart with an offset of 5px * line.dash([10, 5]); * line.dashOffset(5); */ Factory.addGetterSetter(Shape$1, "shadowColor", void 0, getStringValidator()); /** * get/set shadow color * @name Konva.Shape#shadowColor * @method * @param {String} color * @returns {String} * @example * // get shadow color * var shadow = shape.shadowColor(); * * // set shadow color with color string * shape.shadowColor('green'); * * // set shadow color with hex * shape.shadowColor('#00ff00'); * * // set shadow color with rgb * shape.shadowColor('rgb(0,255,0)'); * * // set shadow color with rgba and make it 50% opaque * shape.shadowColor('rgba(0,255,0,0.5'); */ Factory.addGetterSetter(Shape$1, "shadowBlur", 0, getNumberValidator()); /** * get/set shadow blur * @name Konva.Shape#shadowBlur * @method * @param {Number} blur * @returns {Number} * @example * // get shadow blur * var shadowBlur = shape.shadowBlur(); * * // set shadow blur * shape.shadowBlur(10); */ Factory.addGetterSetter(Shape$1, "shadowOpacity", 1, getNumberValidator()); /** * get/set shadow opacity. must be a value between 0 and 1 * @name Konva.Shape#shadowOpacity * @method * @param {Number} opacity * @returns {Number} * @example * // get shadow opacity * var shadowOpacity = shape.shadowOpacity(); * * // set shadow opacity * shape.shadowOpacity(0.5); */ Factory.addComponentsGetterSetter(Shape$1, "shadowOffset", ["x", "y"]); /** * get/set shadow offset * @name Konva.Shape#shadowOffset * @method * @param {Object} offset * @param {Number} offset.x * @param {Number} offset.y * @returns {Object} * @example * // get shadow offset * var shadowOffset = shape.shadowOffset(); * * // set shadow offset * shape.shadowOffset({ * x: 20, * y: 10 * }); */ Factory.addGetterSetter(Shape$1, "shadowOffsetX", 0, getNumberValidator()); /** * get/set shadow offset x * @name Konva.Shape#shadowOffsetX * @method * @param {Number} x * @returns {Number} * @example * // get shadow offset x * var shadowOffsetX = shape.shadowOffsetX(); * * // set shadow offset x * shape.shadowOffsetX(5); */ Factory.addGetterSetter(Shape$1, "shadowOffsetY", 0, getNumberValidator()); /** * get/set shadow offset y * @name Konva.Shape#shadowOffsetY * @method * @param {Number} y * @returns {Number} * @example * // get shadow offset y * var shadowOffsetY = shape.shadowOffsetY(); * * // set shadow offset y * shape.shadowOffsetY(5); */ Factory.addGetterSetter(Shape$1, "fillPatternImage"); /** * get/set fill pattern image * @name Konva.Shape#fillPatternImage * @method * @param {Image} image object * @returns {Image} * @example * // get fill pattern image * var fillPatternImage = shape.fillPatternImage(); * * // set fill pattern image * var imageObj = new Image(); * imageObj.onload = function() { * shape.fillPatternImage(imageObj); * }; * imageObj.src = 'path/to/image/jpg'; */ Factory.addGetterSetter(Shape$1, "fill", void 0, getStringOrGradientValidator()); /** * get/set fill color * @name Konva.Shape#fill * @method * @param {String} color * @returns {String} * @example * // get fill color * var fill = shape.fill(); * * // set fill color with color string * shape.fill('green'); * * // set fill color with hex * shape.fill('#00ff00'); * * // set fill color with rgb * shape.fill('rgb(0,255,0)'); * * // set fill color with rgba and make it 50% opaque * shape.fill('rgba(0,255,0,0.5'); * * // shape without fill * shape.fill(null); */ Factory.addGetterSetter(Shape$1, "fillPatternX", 0, getNumberValidator()); /** * get/set fill pattern x * @name Konva.Shape#fillPatternX * @method * @param {Number} x * @returns {Number} * @example * // get fill pattern x * var fillPatternX = shape.fillPatternX(); * // set fill pattern x * shape.fillPatternX(20); */ Factory.addGetterSetter(Shape$1, "fillPatternY", 0, getNumberValidator()); /** * get/set fill pattern y * @name Konva.Shape#fillPatternY * @method * @param {Number} y * @returns {Number} * @example * // get fill pattern y * var fillPatternY = shape.fillPatternY(); * // set fill pattern y * shape.fillPatternY(20); */ Factory.addGetterSetter(Shape$1, "fillLinearGradientColorStops"); /** * get/set fill linear gradient color stops * @name Konva.Shape#fillLinearGradientColorStops * @method * @param {Array} colorStops * @returns {Array} colorStops * @example * // get fill linear gradient color stops * var colorStops = shape.fillLinearGradientColorStops(); * * // create a linear gradient that starts with red, changes to blue * // halfway through, and then changes to green * shape.fillLinearGradientColorStops(0, 'red', 0.5, 'blue', 1, 'green'); */ Factory.addGetterSetter(Shape$1, "strokeLinearGradientColorStops"); /** * get/set stroke linear gradient color stops * @name Konva.Shape#strokeLinearGradientColorStops * @method * @param {Array} colorStops * @returns {Array} colorStops * @example * // get stroke linear gradient color stops * var colorStops = shape.strokeLinearGradientColorStops(); * * // create a linear gradient that starts with red, changes to blue * // halfway through, and then changes to green * shape.strokeLinearGradientColorStops([0, 'red', 0.5, 'blue', 1, 'green']); */ Factory.addGetterSetter(Shape$1, "fillRadialGradientStartRadius", 0); /** * get/set fill radial gradient start radius * @name Konva.Shape#fillRadialGradientStartRadius * @method * @param {Number} radius * @returns {Number} * @example * // get radial gradient start radius * var startRadius = shape.fillRadialGradientStartRadius(); * * // set radial gradient start radius * shape.fillRadialGradientStartRadius(0); */ Factory.addGetterSetter(Shape$1, "fillRadialGradientEndRadius", 0); /** * get/set fill radial gradient end radius * @name Konva.Shape#fillRadialGradientEndRadius * @method * @param {Number} radius * @returns {Number} * @example * // get radial gradient end radius * var endRadius = shape.fillRadialGradientEndRadius(); * * // set radial gradient end radius * shape.fillRadialGradientEndRadius(100); */ Factory.addGetterSetter(Shape$1, "fillRadialGradientColorStops"); /** * get/set fill radial gradient color stops * @name Konva.Shape#fillRadialGradientColorStops * @method * @param {Number} colorStops * @returns {Array} * @example * // get fill radial gradient color stops * var colorStops = shape.fillRadialGradientColorStops(); * * // create a radial gradient that starts with red, changes to blue * // halfway through, and then changes to green * shape.fillRadialGradientColorStops(0, 'red', 0.5, 'blue', 1, 'green'); */ Factory.addGetterSetter(Shape$1, "fillPatternRepeat", "repeat"); /** * get/set fill pattern repeat. Can be 'repeat', 'repeat-x', 'repeat-y', or 'no-repeat'. The default is 'repeat' * @name Konva.Shape#fillPatternRepeat * @method * @param {String} repeat * @returns {String} * @example * // get fill pattern repeat * var repeat = shape.fillPatternRepeat(); * * // repeat pattern in x direction only * shape.fillPatternRepeat('repeat-x'); * * // do not repeat the pattern * shape.fillPatternRepeat('no-repeat'); */ Factory.addGetterSetter(Shape$1, "fillEnabled", true); /** * get/set fill enabled flag * @name Konva.Shape#fillEnabled * @method * @param {Boolean} enabled * @returns {Boolean} * @example * // get fill enabled flag * var fillEnabled = shape.fillEnabled(); * * // disable fill * shape.fillEnabled(false); * * // enable fill * shape.fillEnabled(true); */ Factory.addGetterSetter(Shape$1, "strokeEnabled", true); /** * get/set stroke enabled flag * @name Konva.Shape#strokeEnabled * @method * @param {Boolean} enabled * @returns {Boolean} * @example * // get stroke enabled flag * var strokeEnabled = shape.strokeEnabled(); * * // disable stroke * shape.strokeEnabled(false); * * // enable stroke * shape.strokeEnabled(true); */ Factory.addGetterSetter(Shape$1, "shadowEnabled", true); /** * get/set shadow enabled flag * @name Konva.Shape#shadowEnabled * @method * @param {Boolean} enabled * @returns {Boolean} * @example * // get shadow enabled flag * var shadowEnabled = shape.shadowEnabled(); * * // disable shadow * shape.shadowEnabled(false); * * // enable shadow * shape.shadowEnabled(true); */ Factory.addGetterSetter(Shape$1, "dashEnabled", true); /** * get/set dash enabled flag * @name Konva.Shape#dashEnabled * @method * @param {Boolean} enabled * @returns {Boolean} * @example * // get dash enabled flag * var dashEnabled = shape.dashEnabled(); * * // disable dash * shape.dashEnabled(false); * * // enable dash * shape.dashEnabled(true); */ Factory.addGetterSetter(Shape$1, "strokeScaleEnabled", true); /** * get/set strokeScale enabled flag. Text and TextPath always scale their stroke. * @name Konva.Shape#strokeScaleEnabled * @method * @param {Boolean} enabled * @returns {Boolean} * @example * // get stroke scale enabled flag * var strokeScaleEnabled = shape.strokeScaleEnabled(); * * // disable stroke scale * shape.strokeScaleEnabled(false); * * // enable stroke scale * shape.strokeScaleEnabled(true); */ Factory.addGetterSetter(Shape$1, "fillPriority", "color"); /** * get/set fill priority. can be color, pattern, linear-gradient, or radial-gradient. The default is color. * This is handy if you want to toggle between different fill types. * @name Konva.Shape#fillPriority * @method * @param {String} priority * @returns {String} * @example * // get fill priority * var fillPriority = shape.fillPriority(); * * // set fill priority * shape.fillPriority('linear-gradient'); */ Factory.addComponentsGetterSetter(Shape$1, "fillPatternOffset", ["x", "y"]); /** * get/set fill pattern offset * @name Konva.Shape#fillPatternOffset * @method * @param {Object} offset * @param {Number} offset.x * @param {Number} offset.y * @returns {Object} * @example * // get fill pattern offset * var patternOffset = shape.fillPatternOffset(); * * // set fill pattern offset * shape.fillPatternOffset({ * x: 20, * y: 10 * }); */ Factory.addGetterSetter(Shape$1, "fillPatternOffsetX", 0, getNumberValidator()); /** * get/set fill pattern offset x * @name Konva.Shape#fillPatternOffsetX * @method * @param {Number} x * @returns {Number} * @example * // get fill pattern offset x * var patternOffsetX = shape.fillPatternOffsetX(); * * // set fill pattern offset x * shape.fillPatternOffsetX(20); */ Factory.addGetterSetter(Shape$1, "fillPatternOffsetY", 0, getNumberValidator()); /** * get/set fill pattern offset y * @name Konva.Shape#fillPatternOffsetY * @method * @param {Number} y * @returns {Number} * @example * // get fill pattern offset y * var patternOffsetY = shape.fillPatternOffsetY(); * * // set fill pattern offset y * shape.fillPatternOffsetY(10); */ Factory.addComponentsGetterSetter(Shape$1, "fillPatternScale", ["x", "y"]); /** * get/set fill pattern scale * @name Konva.Shape#fillPatternScale * @method * @param {Object} scale * @param {Number} scale.x * @param {Number} scale.y * @returns {Object} * @example * // get fill pattern scale * var patternScale = shape.fillPatternScale(); * * // set fill pattern scale * shape.fillPatternScale({ * x: 2, * y: 2 * }); */ Factory.addGetterSetter(Shape$1, "fillPatternScaleX", 1, getNumberValidator()); /** * get/set fill pattern scale x * @name Konva.Shape#fillPatternScaleX * @method * @param {Number} x * @returns {Number} * @example * // get fill pattern scale x * var patternScaleX = shape.fillPatternScaleX(); * * // set fill pattern scale x * shape.fillPatternScaleX(2); */ Factory.addGetterSetter(Shape$1, "fillPatternScaleY", 1, getNumberValidator()); /** * get/set fill pattern scale y * @name Konva.Shape#fillPatternScaleY * @method * @param {Number} y * @returns {Number} * @example * // get fill pattern scale y * var patternScaleY = shape.fillPatternScaleY(); * * // set fill pattern scale y * shape.fillPatternScaleY(2); */ Factory.addComponentsGetterSetter(Shape$1, "fillLinearGradientStartPoint", ["x", "y"]); /** * get/set fill linear gradient start point * @name Konva.Shape#fillLinearGradientStartPoint * @method * @param {Object} startPoint * @param {Number} startPoint.x * @param {Number} startPoint.y * @returns {Object} * @example * // get fill linear gradient start point * var startPoint = shape.fillLinearGradientStartPoint(); * * // set fill linear gradient start point * shape.fillLinearGradientStartPoint({ * x: 20, * y: 10 * }); */ Factory.addComponentsGetterSetter(Shape$1, "strokeLinearGradientStartPoint", ["x", "y"]); /** * get/set stroke linear gradient start point * @name Konva.Shape#strokeLinearGradientStartPoint * @method * @param {Object} startPoint * @param {Number} startPoint.x * @param {Number} startPoint.y * @returns {Object} * @example * // get stroke linear gradient start point * var startPoint = shape.strokeLinearGradientStartPoint(); * * // set stroke linear gradient start point * shape.strokeLinearGradientStartPoint({ * x: 20, * y: 10 * }); */ Factory.addGetterSetter(Shape$1, "fillLinearGradientStartPointX", 0); /** * get/set fill linear gradient start point x * @name Konva.Shape#fillLinearGradientStartPointX * @method * @param {Number} x * @returns {Number} * @example * // get fill linear gradient start point x * var startPointX = shape.fillLinearGradientStartPointX(); * * // set fill linear gradient start point x * shape.fillLinearGradientStartPointX(20); */ Factory.addGetterSetter(Shape$1, "strokeLinearGradientStartPointX", 0); /** * get/set stroke linear gradient start point x * @name Konva.Shape#strokeLinearGradientStartPointX * @method * @param {Number} x * @returns {Number} * @example * // get stroke linear gradient start point x * var startPointX = shape.strokeLinearGradientStartPointX(); * * // set stroke linear gradient start point x * shape.strokeLinearGradientStartPointX(20); */ Factory.addGetterSetter(Shape$1, "fillLinearGradientStartPointY", 0); /** * get/set fill linear gradient start point y * @name Konva.Shape#fillLinearGradientStartPointY * @method * @param {Number} y * @returns {Number} * @example * // get fill linear gradient start point y * var startPointY = shape.fillLinearGradientStartPointY(); * * // set fill linear gradient start point y * shape.fillLinearGradientStartPointY(20); */ Factory.addGetterSetter(Shape$1, "strokeLinearGradientStartPointY", 0); /** * get/set stroke linear gradient start point y * @name Konva.Shape#strokeLinearGradientStartPointY * @method * @param {Number} y * @returns {Number} * @example * // get stroke linear gradient start point y * var startPointY = shape.strokeLinearGradientStartPointY(); * * // set stroke linear gradient start point y * shape.strokeLinearGradientStartPointY(20); */ Factory.addComponentsGetterSetter(Shape$1, "fillLinearGradientEndPoint", ["x", "y"]); /** * get/set fill linear gradient end point * @name Konva.Shape#fillLinearGradientEndPoint * @method * @param {Object} endPoint * @param {Number} endPoint.x * @param {Number} endPoint.y * @returns {Object} * @example * // get fill linear gradient end point * var endPoint = shape.fillLinearGradientEndPoint(); * * // set fill linear gradient end point * shape.fillLinearGradientEndPoint({ * x: 20, * y: 10 * }); */ Factory.addComponentsGetterSetter(Shape$1, "strokeLinearGradientEndPoint", ["x", "y"]); /** * get/set stroke linear gradient end point * @name Konva.Shape#strokeLinearGradientEndPoint * @method * @param {Object} endPoint * @param {Number} endPoint.x * @param {Number} endPoint.y * @returns {Object} * @example * // get stroke linear gradient end point * var endPoint = shape.strokeLinearGradientEndPoint(); * * // set stroke linear gradient end point * shape.strokeLinearGradientEndPoint({ * x: 20, * y: 10 * }); */ Factory.addGetterSetter(Shape$1, "fillLinearGradientEndPointX", 0); /** * get/set fill linear gradient end point x * @name Konva.Shape#fillLinearGradientEndPointX * @method * @param {Number} x * @returns {Number} * @example * // get fill linear gradient end point x * var endPointX = shape.fillLinearGradientEndPointX(); * * // set fill linear gradient end point x * shape.fillLinearGradientEndPointX(20); */ Factory.addGetterSetter(Shape$1, "strokeLinearGradientEndPointX", 0); /** * get/set fill linear gradient end point x * @name Konva.Shape#strokeLinearGradientEndPointX * @method * @param {Number} x * @returns {Number} * @example * // get stroke linear gradient end point x * var endPointX = shape.strokeLinearGradientEndPointX(); * * // set stroke linear gradient end point x * shape.strokeLinearGradientEndPointX(20); */ Factory.addGetterSetter(Shape$1, "fillLinearGradientEndPointY", 0); /** * get/set fill linear gradient end point y * @name Konva.Shape#fillLinearGradientEndPointY * @method * @param {Number} y * @returns {Number} * @example * // get fill linear gradient end point y * var endPointY = shape.fillLinearGradientEndPointY(); * * // set fill linear gradient end point y * shape.fillLinearGradientEndPointY(20); */ Factory.addGetterSetter(Shape$1, "strokeLinearGradientEndPointY", 0); /** * get/set stroke linear gradient end point y * @name Konva.Shape#strokeLinearGradientEndPointY * @method * @param {Number} y * @returns {Number} * @example * // get stroke linear gradient end point y * var endPointY = shape.strokeLinearGradientEndPointY(); * * // set stroke linear gradient end point y * shape.strokeLinearGradientEndPointY(20); */ Factory.addComponentsGetterSetter(Shape$1, "fillRadialGradientStartPoint", ["x", "y"]); /** * get/set fill radial gradient start point * @name Konva.Shape#fillRadialGradientStartPoint * @method * @param {Object} startPoint * @param {Number} startPoint.x * @param {Number} startPoint.y * @returns {Object} * @example * // get fill radial gradient start point * var startPoint = shape.fillRadialGradientStartPoint(); * * // set fill radial gradient start point * shape.fillRadialGradientStartPoint({ * x: 20, * y: 10 * }); */ Factory.addGetterSetter(Shape$1, "fillRadialGradientStartPointX", 0); /** * get/set fill radial gradient start point x * @name Konva.Shape#fillRadialGradientStartPointX * @method * @param {Number} x * @returns {Number} * @example * // get fill radial gradient start point x * var startPointX = shape.fillRadialGradientStartPointX(); * * // set fill radial gradient start point x * shape.fillRadialGradientStartPointX(20); */ Factory.addGetterSetter(Shape$1, "fillRadialGradientStartPointY", 0); /** * get/set fill radial gradient start point y * @name Konva.Shape#fillRadialGradientStartPointY * @method * @param {Number} y * @returns {Number} * @example * // get fill radial gradient start point y * var startPointY = shape.fillRadialGradientStartPointY(); * * // set fill radial gradient start point y * shape.fillRadialGradientStartPointY(20); */ Factory.addComponentsGetterSetter(Shape$1, "fillRadialGradientEndPoint", ["x", "y"]); /** * get/set fill radial gradient end point * @name Konva.Shape#fillRadialGradientEndPoint * @method * @param {Object} endPoint * @param {Number} endPoint.x * @param {Number} endPoint.y * @returns {Object} * @example * // get fill radial gradient end point * var endPoint = shape.fillRadialGradientEndPoint(); * * // set fill radial gradient end point * shape.fillRadialGradientEndPoint({ * x: 20, * y: 10 * }); */ Factory.addGetterSetter(Shape$1, "fillRadialGradientEndPointX", 0); /** * get/set fill radial gradient end point x * @name Konva.Shape#fillRadialGradientEndPointX * @method * @param {Number} x * @returns {Number} * @example * // get fill radial gradient end point x * var endPointX = shape.fillRadialGradientEndPointX(); * * // set fill radial gradient end point x * shape.fillRadialGradientEndPointX(20); */ Factory.addGetterSetter(Shape$1, "fillRadialGradientEndPointY", 0); /** * get/set fill radial gradient end point y * @name Konva.Shape#fillRadialGradientEndPointY * @method * @param {Number} y * @returns {Number} * @example * // get fill radial gradient end point y * var endPointY = shape.fillRadialGradientEndPointY(); * * // set fill radial gradient end point y * shape.fillRadialGradientEndPointY(20); */ Factory.addGetterSetter(Shape$1, "fillPatternRotation", 0); /** * get/set fill pattern rotation in degrees * @name Konva.Shape#fillPatternRotation * @method * @param {Number} rotation * @returns {Konva.Shape} * @example * // get fill pattern rotation * var patternRotation = shape.fillPatternRotation(); * * // set fill pattern rotation * shape.fillPatternRotation(20); */ Factory.addGetterSetter(Shape$1, "fillRule", void 0, getStringValidator()); /** * get/set fill rule * @name Konva.Shape#fillRule * @method * @param {CanvasFillRule} rotation * @returns {Konva.Shape} * @example * // get fill rule * var fillRule = shape.fillRule(); * * // set fill rule * shape.fillRule('evenodd'); */ Factory.backCompat(Shape$1, { dashArray: "dash", getDashArray: "getDash", setDashArray: "setDash", drawFunc: "sceneFunc", getDrawFunc: "getSceneFunc", setDrawFunc: "setSceneFunc", drawHitFunc: "hitFunc", getDrawHitFunc: "getHitFunc", setDrawHitFunc: "setHitFunc" }); //#endregion //#region node_modules/konva/lib/Layer.js var BEFORE_DRAW = "beforeDraw"; var DRAW = "draw"; var HIT_SEARCH_RADIUS = 10; var HIT_SEARCH_MAX_DISTANCE = 256; function getHitShape(data, i) { return data[i + 3] >= 128 ? shapes[Util.getHitColorKey(data[i], data[i + 1], data[i + 2])] : void 0; } /** * Layer constructor. Layers are tied to their own canvas element and are used * to contain groups or shapes. * @constructor * @memberof Konva * @augments Konva.Container * @param {Object} config * @param {Boolean} [config.clearBeforeDraw] set this property to false if you don't want * to clear the canvas before each layer draw. The default value is true. * @@nodeParams * @@containerParams * @example * var layer = new Konva.Layer(); * stage.add(layer); * // now you can add shapes, groups into the layer */ var Layer$1 = class extends Container { constructor(config) { super(config); this.canvas = new SceneCanvas(); this.hitCanvas = new HitCanvas({ pixelRatio: 1 }); this._waitingForDraw = false; this.on("visibleChange.konva", this._checkVisibility); this._checkVisibility(); this.on("imageSmoothingEnabledChange.konva", this._setSmoothEnabled); this._setSmoothEnabled(); } createPNGStream() { return this.canvas._canvas.createPNGStream(); } /** * get layer canvas wrapper * @method * @name Konva.Layer#getCanvas */ getCanvas() { return this.canvas; } /** * get native canvas element * @method * @name Konva.Layer#getNativeCanvasElement */ getNativeCanvasElement() { return this.canvas._canvas; } /** * get layer hit canvas * @method * @name Konva.Layer#getHitCanvas */ getHitCanvas() { return this.hitCanvas; } /** * get layer canvas context * @method * @name Konva.Layer#getContext */ getContext() { return this.getCanvas().getContext(); } /** * clear the scene and hit canvas of the layer. The nodes stay and are * drawn again by the next `draw()` * @method * @name Konva.Layer#clear * @param {Object} [bounds] clear only this rectangle: `{ x, y, width, height }` * @returns {Konva.Layer} * @example * layer.clear(); * layer.clear({ x: 0, y: 0, width: 100, height: 100 }); */ clear(bounds) { this.getContext().clear(bounds); this.getHitCanvas().getContext().clear(bounds); return this; } setZIndex(index) { super.setZIndex(index); const stage = this.getStage(); if (stage && stage.content) { stage.content.removeChild(this.getNativeCanvasElement()); if (index < stage.children.length - 1) stage.content.insertBefore(this.getNativeCanvasElement(), stage.children[index + 1].getCanvas()._canvas); else stage.content.appendChild(this.getNativeCanvasElement()); } return this; } moveToTop() { Node.prototype.moveToTop.call(this); const stage = this.getStage(); if (stage && stage.content) { stage.content.removeChild(this.getNativeCanvasElement()); stage.content.appendChild(this.getNativeCanvasElement()); } return true; } moveUp() { if (!Node.prototype.moveUp.call(this)) return false; const stage = this.getStage(); if (!stage || !stage.content) return false; stage.content.removeChild(this.getNativeCanvasElement()); if (this.index < stage.children.length - 1) stage.content.insertBefore(this.getNativeCanvasElement(), stage.children[this.index + 1].getCanvas()._canvas); else stage.content.appendChild(this.getNativeCanvasElement()); return true; } moveDown() { if (Node.prototype.moveDown.call(this)) { const stage = this.getStage(); if (stage) { const children = stage.children; if (stage.content) { stage.content.removeChild(this.getNativeCanvasElement()); stage.content.insertBefore(this.getNativeCanvasElement(), children[this.index + 1].getCanvas()._canvas); } } return true; } return false; } moveToBottom() { if (Node.prototype.moveToBottom.call(this)) { const stage = this.getStage(); if (stage) { const children = stage.children; if (stage.content) { stage.content.removeChild(this.getNativeCanvasElement()); stage.content.insertBefore(this.getNativeCanvasElement(), children[1].getCanvas()._canvas); } } return true; } return false; } getLayer() { return this; } remove() { var _a, _b; super.remove(); const scene = this.getNativeCanvasElement(); const hit = this.getHitCanvas()._canvas; (_a = scene.parentNode) === null || _a === void 0 || _a.removeChild(scene); (_b = hit.parentNode) === null || _b === void 0 || _b.removeChild(hit); return this; } getStage() { return this.parent; } _setSize({ width, height }) { this.canvas.setSize(width, height); this._syncHitCanvasSize(); this._setSmoothEnabled(); return this; } _syncHitCanvasSize() { const listening = this.isListening(); this.hitCanvas.setSizeIfChanged((listening ? this.getWidth() : 0) || 0, (listening ? this.getHeight() : 0) || 0); } _validateAdd(child) { const type = child.getType(); if (type !== "Group" && type !== "Shape") Util.throw("You may only add groups and shapes to a layer."); } _toKonvaCanvas(config) { config = { ...config }; config.width = config.width || this.getWidth(); config.height = config.height || this.getHeight(); config.x = config.x !== void 0 ? config.x : this.x(); config.y = config.y !== void 0 ? config.y : this.y(); return Node.prototype._toKonvaCanvas.call(this, config); } _checkVisibility() { if (this.visible()) this.canvas._canvas.style.display = "block"; else this.canvas._canvas.style.display = "none"; } _setSmoothEnabled() { this.getContext()._context.imageSmoothingEnabled = this.imageSmoothingEnabled(); } /** * get/set width of layer. getter return width of stage. setter doing nothing. * if you want change width use `stage.width(value);` * @name Konva.Layer#width * @method * @returns {Number} * @example * var width = layer.width(); */ getWidth() { if (this.parent) return this.parent.width(); } setWidth() { Util.warn("Can not change width of layer. Use \"stage.width(value)\" function instead."); } /** * get/set height of layer.getter return height of stage. setter doing nothing. * if you want change height use `stage.height(value);` * @name Konva.Layer#height * @method * @returns {Number} * @example * var height = layer.height(); */ getHeight() { if (this.parent) return this.parent.height(); } setHeight() { Util.warn("Can not change height of layer. Use \"stage.height(value)\" function instead."); } /** * batch draw. this function will not do immediate draw * but it will schedule drawing to next tick (requestAnimFrame) * @method * @name Konva.Layer#batchDraw * @return {Konva.Layer} this */ batchDraw() { var _a; if (!this._waitingForDraw) { this._waitingForDraw = true; Util.requestAnimFrame(() => { this._waitingForDraw = false; this.draw(); }, (_a = this.getStage()) === null || _a === void 0 ? void 0 : _a._getOwnerWindow()); } return this; } /** * get visible intersection shape. This is the preferred * method for determining if a point intersects a shape or not. * It reads the hit canvas, so it finds what pointer events would: nodes with * listening set to false or invisible nodes are not detected, a shape with opacity 0 * is, and `hitStrokeWidth` counts. The position is relative to the top left corner of the * stage container, like `stage.getPointerPosition()`, without the stage transform * @method * @name Konva.Layer#getIntersection * @param {Object} pos * @param {Number} pos.x * @param {Number} pos.y * @returns {Konva.Node} * @example * var shape = layer.getIntersection({x: 50, y: 50}); */ getIntersection(pos) { if (!this.isListening() || !this.isVisible()) return null; const hit = this._getIntersection(pos); if (hit.shape) return hit.shape; if (!hit.antialiased) return null; const ratio = this.hitCanvas.pixelRatio, cx = Math.floor(pos.x * ratio), cy = Math.floor(pos.y * ratio); const read = (r) => this.hitCanvas.context.getImageData(cx - r, cy - r, r * 2 + 1, r * 2 + 1).data; let r = HIT_SEARCH_RADIUS, size = r * 2 + 1, data = read(r), previousMax = data[(r * size + r) * 4 + 3]; for (let d = 1; d <= HIT_SEARCH_MAX_DISTANCE; d++) { if (d > r) { r = Math.min(HIT_SEARCH_MAX_DISTANCE, r * 2); size = r * 2 + 1; data = read(r); } let max = 0; for (let y = -d; y <= d; y++) { const step = Math.abs(y) === d ? 1 : d * 2; for (let x = -d; x <= d; x += step) { const i = ((y + r) * size + x + r) * 4; const shape = getHitShape(data, i); if (shape) return shape; max = Math.max(max, data[i + 3]); } } if (max <= previousMax && max !== 255) return null; previousMax = max; } return null; } _getIntersection(pos) { if (!this.hitCanvas.width || !this.hitCanvas.height) return {}; const ratio = this.hitCanvas.pixelRatio; const p = this.hitCanvas.context.getImageData(Math.floor(pos.x * ratio), Math.floor(pos.y * ratio), 1, 1).data; const shape = getHitShape(p, 0); if (shape) return { shape }; if (p[3] > 0) return { antialiased: true }; return {}; } drawScene(can, top) { const layer = this.getLayer(), canvas = can || layer && layer.getCanvas(); this._fire(BEFORE_DRAW, { node: this }); if (this.clearBeforeDraw()) canvas.getContext().clear(); Container.prototype.drawScene.call(this, canvas, top); canvas._trimIsolationCanvas(); this._fire(DRAW, { node: this }); return this; } shouldDrawHit(top) { var _a; if (!super.shouldDrawHit(top)) return false; if (top || Konva$2.hitOnDragEnabled) return true; let underDrag = false; DD._dragElements.forEach((elem) => { if (elem.dragStatus === "dragging" && (elem.node === this.getStage() || elem.node.getLayer() === this)) underDrag = true; }); return !underDrag && !((_a = Konva$2["Transformer"]) === null || _a === void 0 ? void 0 : _a._isLayerTransforming(this)); } drawHit(can, top) { const layer = this.getLayer(), canvas = can || layer && layer.hitCanvas; if (!can && layer) { layer._syncHitCanvasSize(); if (layer.clearBeforeDraw()) layer.getHitCanvas().getContext().clear(); } Container.prototype.drawHit.call(this, canvas, top); return this; } /** * enable hit graph. **DEPRECATED!** Use `layer.listening(true)` instead. * @name Konva.Layer#enableHitGraph * @method * @returns {Layer} */ enableHitGraph() { this.hitGraphEnabled(true); return this; } /** * disable hit graph. **DEPRECATED!** Use `layer.listening(false)` instead. * @name Konva.Layer#disableHitGraph * @method * @returns {Layer} */ disableHitGraph() { this.hitGraphEnabled(false); return this; } setHitGraphEnabled(val) { Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."); this.listening(val); } getHitGraphEnabled(val) { Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."); return this.listening(); } /** * Show or hide hit canvas over the stage. May be useful for debugging custom hitFunc * @name Konva.Layer#toggleHitCanvas * @method */ toggleHitCanvas() { if (!this.parent || !this.parent["content"]) return; const parent = this.parent; if (!!this.hitCanvas._canvas.parentNode) parent.content.removeChild(this.hitCanvas._canvas); else parent.content.appendChild(this.hitCanvas._canvas); } destroy() { this.getCanvas()._releaseIsolationCanvas(); Util.releaseCanvas(this.getNativeCanvasElement(), this.getHitCanvas()._canvas); return super.destroy(); } }; Layer$1.prototype.nodeType = "Layer"; _registerNode(Layer$1); /** * get/set imageSmoothingEnabled flag * For more info see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled * @name Konva.Layer#imageSmoothingEnabled * @method * @param {Boolean} imageSmoothingEnabled * @returns {Boolean} * @example * // get imageSmoothingEnabled flag * var imageSmoothingEnabled = layer.imageSmoothingEnabled(); * * layer.imageSmoothingEnabled(false); * * layer.imageSmoothingEnabled(true); */ Factory.addGetterSetter(Layer$1, "imageSmoothingEnabled", true); /** * get/set clearBeforeDraw flag which determines if the layer is cleared or not * before drawing * @name Konva.Layer#clearBeforeDraw * @method * @param {Boolean} clearBeforeDraw * @returns {Boolean} * @example * // get clearBeforeDraw flag * var clearBeforeDraw = layer.clearBeforeDraw(); * * // disable clear before draw * layer.clearBeforeDraw(false); * * // enable clear before draw * layer.clearBeforeDraw(true); */ Factory.addGetterSetter(Layer$1, "clearBeforeDraw", true); Factory.addOverloadedGetterSetter(Layer$1, "hitGraphEnabled"); /** * get/set hitGraphEnabled flag. **DEPRECATED!** Use `layer.listening(false)` instead. * Disabling the hit graph will greatly increase * draw performance because the hit graph will not be redrawn each time the layer is * drawn. This, however, also disables mouse/touch event detection * @name Konva.Layer#hitGraphEnabled * @method * @param {Boolean} enabled * @returns {Boolean} * @example * // get hitGraphEnabled flag * var hitGraphEnabled = layer.hitGraphEnabled(); * * // disable hit graph * layer.hitGraphEnabled(false); * * // enable hit graph * layer.hitGraphEnabled(true); */ //#endregion //#region node_modules/konva/lib/FastLayer.js /** * FastLayer constructor. **DEPRECATED!** Please use `Konva.Layer({ listening: false})` instead. Layers are tied to their own canvas element and are used * to contain shapes only. If you don't need node nesting, mouse and touch interactions, * or event pub/sub, you should use FastLayer instead of Layer to create your layers. * It renders about 2x faster than normal layers. * * @constructor * @memberof Konva * @augments Konva.Layer @@containerParams * @example * var layer = new Konva.FastLayer(); */ var FastLayer$1 = class extends Layer$1 { constructor(attrs) { super(attrs); this.listening(false); Util.warn("Konva.FastLayer is deprecated. Please use \"new Konva.Layer({ listening: false })\" instead."); } }; FastLayer$1.prototype.nodeType = "FastLayer"; _registerNode(FastLayer$1); //#endregion //#region node_modules/konva/lib/Group.js /** * Group constructor. Groups are used to contain shapes or other groups. * @constructor * @memberof Konva * @augments Konva.Container * @param {Object} config * @param {Boolean} [config.isolated=false] composite children as one live image * @@nodeParams * @@containerParams * @example * var group = new Konva.Group(); */ var Group$1 = class extends Container { _validateAdd(child) { const type = child.getType(); if (type !== "Group" && type !== "Shape") Util.throw("You may only add groups and shapes to groups."); } _drawChildNodes(drawMethod, canvas, top) { if (drawMethod !== "drawScene" || !this.isolated() || top === this) return super._drawChildNodes(drawMethod, canvas, top); if (!canvas.width || !canvas.height) return; const context = canvas.getContext(); const surface = canvas._prepareIsolationCanvas(this.getClientRect({ _forDrawing: true, relativeTo: top })); const surfaceContext = surface.getContext(); surfaceContext._opacityRoot = this; context.save(); try { super._drawChildNodes(drawMethod, surface, top); context._applyOpacity(this); context._drawDeviceBuffer(surface); } catch (error) { canvas._releaseIsolationCanvas(); throw error; } finally { context.restore(); surfaceContext._opacityRoot = void 0; } } }; /** * Get or set group isolation. Default is false. * An isolated group draws its children into a transparent canvas on each scene draw. * The group opacity and globalCompositeOperation apply once to the completed image. * Child blend modes and erasing affect only the content inside that canvas. * * Explicit cache() calls keep their snapshot behavior. clearCache() resumes live drawing. * Hit testing keeps its normal behavior, including hits on erased content. * For video or canvas sources, schedule draws when the source changes. * * Buffers use conservative content bounds at the destination pixel ratio. * Moving the buffer origin changes native edge coverage. A few edge pixels * can differ substantially; isolation does not promise pixel-identical antialiasing. * Like cache(), isolation requires custom drawing (sceneFunc, charRenderFunc) to provide accurate * bounds, including any pixels it paints outside its size: selfRectFunc or a * getSelfRect() override. * Text is bounded by its lines plus one font size, so a glyph with many stacked * marks can be clipped. node-canvas shadows can change with bitmap origin. * Siblings reuse a buffer; unused or oversized buffers are freed after each layer draw. * @name Konva.Group#isolated * @method * @param {Boolean} isolated * @returns {Boolean} * @example * const group = new Konva.Group({ isolated: true, opacity: 0.5 }); * group.add(shape1, shape2); * group.isolated(false); */ Factory.addGetterSetter(Group$1, "isolated", false, getBooleanValidator()); Group$1.prototype.nodeType = "Group"; _registerNode(Group$1); //#endregion //#region node_modules/konva/lib/Animation.js var _a; var now$1 = ((_a = glob.performance) === null || _a === void 0 ? void 0 : _a.now) ? () => glob.performance.now() : Date.now; /** * Animation constructor. * @constructor * @memberof Konva * @param {AnimationFn} func function executed on each animation frame. The function is passed a frame object, which contains * timeDiff, lastTime, time, and frameRate properties. The timeDiff property is the number of milliseconds that have passed * since the last animation frame. The time property accumulates elapsed animation time in milliseconds across stop/start calls, excluding paused time. * The lastTime property is the current frame's clock timestamp in milliseconds. The frameRate property is the current frame rate in frames / second. * Return false from function, if you don't need to redraw layer/layers on some frames. * @param {Konva.Layer|Array} [layers] layer(s) to be redrawn on each animation frame. Can be a layer, an array of layers, or null. * Not specifying a node will result in no redraw. * @example * // move a node to the right at 50 pixels / second * var velocity = 50; * * var anim = new Konva.Animation(function(frame) { * var dist = velocity * (frame.timeDiff / 1000); * node.move({x: dist, y: 0}); * }, layer); * * anim.start(); */ var Animation = class Animation { constructor(func, layers) { this.id = Animation.animIdCounter++; this.frame = { time: 0, timeDiff: 0, lastTime: now$1(), frameRate: 0 }; this.func = func; this.setLayers(layers); } /** * set layers to be redrawn on each animation frame * @method * @name Konva.Animation#setLayers * @param {Konva.Layer|Array} [layers] layer(s) to be redrawn. Can be a layer, an array of layers, or null. Not specifying a node will result in no redraw. * @return {Konva.Animation} this */ setLayers(layers) { this.layers = layers ? [].concat(layers) : []; return this; } /** * get layers * @method * @name Konva.Animation#getLayers * @return {Array} Array of Konva.Layer */ getLayers() { return this.layers; } /** * add layer. Returns true if the layer was added, and false if it was not * @method * @name Konva.Animation#addLayer * @param {Konva.Layer} layer to add * @return {Bool} true if layer is added to animation, otherwise false */ addLayer(layer) { const layers = this.layers; const len = layers.length; for (let n = 0; n < len; n++) if (layers[n]._id === layer._id) return false; this.layers.push(layer); return true; } /** * determine if animation is running or not. returns true or false * @method * @name Konva.Animation#isRunning * @return {Bool} is animation running? */ isRunning() { return Animation.animations.has(this); } /** * start animation * @method * @name Konva.Animation#start * @return {Konva.Animation} this */ start() { this.stop(); this.frame.timeDiff = 0; this.frame.lastTime = now$1(); Animation._addAnimation(this); return this; } /** * stop animation * @method * @name Konva.Animation#stop * @return {Konva.Animation} this */ stop() { Animation._removeAnimation(this); return this; } _updateFrameObject(time) { this.frame.timeDiff = time - this.frame.lastTime; this.frame.lastTime = time; this.frame.time += this.frame.timeDiff; this.frame.frameRate = 1e3 / this.frame.timeDiff; } static _addAnimation(anim) { this.animations.add(anim); this._handleAnimation(); } static _removeAnimation(anim) { this.animations.delete(anim); } static _runFrames() { const layersToDraw = /* @__PURE__ */ new Set(); Node._updateBatch(() => { Array.from(this.animations).forEach((anim) => { if (!this.animations.has(anim)) return; anim._updateFrameObject(now$1()); if (anim.func && anim.func.call(anim, anim.frame) === false) return; anim.layers.forEach((layer) => layer && layersToDraw.add(layer)); }); }); layersToDraw.forEach((layer) => layer.batchDraw()); } static _animationLoop() { const Anim = Animation; if (Anim.animations.size) { Anim._runFrames(); Util.requestAnimFrame(Anim._animationLoop); } else Anim.animRunning = false; } static _handleAnimation() { if (!this.animRunning) { this.animRunning = true; Util.requestAnimFrame(this._animationLoop); } } }; Animation.animations = /* @__PURE__ */ new Set(); Animation.animIdCounter = 0; Animation.animRunning = false; //#endregion //#region node_modules/konva/lib/Tween.js var blacklist = { node: 1, duration: 1, easing: 1, onFinish: 1, onUpdate: 1, onReset: 1, yoyo: 1 }; var PAUSED = 1; var PLAYING = 2; var REVERSING = 3; var colorAttrs = [ "fill", "stroke", "shadowColor" ]; var idCounter = 0; function colorToRGBA(color) { return Util.colorToRGBA(color) || Util.throw("can not tween the color \"" + color + "\", because it is not a valid color."); } function colorDiff(start, end) { return { r: end.r - start.r, g: end.g - start.g, b: end.b - start.b, a: end.a - start.a }; } function tweenColor(start, diff, i) { return "rgba(" + Math.round(start.r + diff.r * i) + "," + Math.round(start.g + diff.g * i) + "," + Math.round(start.b + diff.b * i) + "," + (start.a + diff.a * i) + ")"; } var TweenEngine = class { constructor(prop, propFunc, func, begin, finish, duration, yoyo) { this.prop = prop; this.propFunc = propFunc; this.begin = begin; this._pos = begin; this.duration = duration; this._change = 0; this.prevPos = 0; this.yoyo = yoyo; this._time = 0; this._position = 0; this._startTime = 0; this._finish = 0; this.func = func; this._change = finish - this.begin; this.pause(); } fire(str) { const handler = this[str]; if (handler) handler(); } setTime(t) { if (t > this.duration) { if (this.yoyo) { this._time = this.duration; this.reverse(); } else this.finish(); } else if (t < 0) { if (this.yoyo) { this._time = 0; this.play(); } else this.reset(); } else { this._time = t; this.update(); } } getTime() { return this._time; } setPosition(p) { this.prevPos = this._pos; this.propFunc(p); this._pos = p; } getPosition(t) { if (t === void 0) t = this._time; return this.func(t, this.begin, this._change, this.duration); } play() { this.state = PLAYING; this._startTime = this.getTimer() - this._time; this.fire("onPlay"); this.onEnterFrame(); } reverse() { this.state = REVERSING; this._time = this.duration - this._time; this._startTime = this.getTimer() - this._time; this.fire("onReverse"); this.onEnterFrame(); } seek(t) { this.pause(); this._time = t; this.update(); this.fire("onSeek"); } reset() { this.pause(); this._time = 0; this.update(); this.fire("onReset"); } finish() { this.pause(); this._time = this.duration; this.update(); this.fire("onFinish"); } update() { this.setPosition(this.getPosition(this._time)); this.fire("onUpdate"); } onEnterFrame() { const t = this.getTimer() - this._startTime; if (this.state === PLAYING) this.setTime(t); else if (this.state === REVERSING) this.setTime(this.duration - t); } pause() { this.state = PAUSED; this.fire("onPause"); } getTimer() { return Date.now(); } }; /** * Tween constructor. Tweens enable you to animate a node between the current state and a new state. * You can play, pause, reverse, seek, reset, and finish tweens. By default, tweens are animated using * a linear easing. For more tweening options, check out {@link Konva.Easings} * @constructor * @memberof Konva * @example * // instantiate new tween which fully rotates a node in 1 second * var tween = new Konva.Tween({ * // list of tween specific properties * node: node, * duration: 1, * easing: Konva.Easings.EaseInOut, * yoyo: false, // play back and forth * onUpdate: () => console.log('node attrs updated'), * onFinish: () => console.log('finished'), * // set new values for any attributes of a passed node * rotation: 360, * fill: 'red' * }); * * // play tween * tween.play(); * * // pause tween * tween.pause(); */ var Tween = class Tween { constructor(config) { const that = this, node = config.node, nodeId = node._id, easing = config.easing || Easings.Linear, yoyo = !!config.yoyo; let duration, key; if (typeof config.duration === "undefined") duration = .3; else if (config.duration === 0) duration = .001; else duration = config.duration; this.node = node; this._id = idCounter++; const layers = node.getLayer() || (node instanceof Konva$2["Stage"] ? node.getLayers() : null); if (!layers) Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."); this.anim = new Animation(function() { that.tween.onEnterFrame(); }, layers); this.tween = new TweenEngine(key, function(i) { that._tweenFunc(i); }, easing, 0, 1, duration * 1e3, yoyo); this._addListeners(); if (!Tween.attrs[nodeId]) Tween.attrs[nodeId] = {}; if (!Tween.attrs[nodeId][this._id]) Tween.attrs[nodeId][this._id] = {}; if (!Tween.tweens[nodeId]) Tween.tweens[nodeId] = {}; for (key in config) if (blacklist[key] === void 0) this._addAttr(key, config[key]); this.reset(); this.onFinish = config.onFinish; this.onReset = config.onReset; this.onUpdate = config.onUpdate; } _addAttr(key, end) { if (Util._isPlainObject(end)) { for (const component in end) this._addAttr(key + Util._capitalize(component), end[component]); return; } const node = this.node, nodeId = node._id; let diff, len, trueEnd, trueStart; const tweenId = Tween.tweens[nodeId][key]; if (tweenId !== void 0) delete Tween.attrs[nodeId][tweenId][key]; let start = node.getAttr(key); if (Util._isArray(end) || Util._isArray(start)) { diff = []; trueStart = start; trueEnd = end; start = Util._isArray(start) ? start.slice() : new Array(end.length).fill(start || 0); if (!Util._isArray(end)) end = new Array(start.length).fill(end); len = Math.max(end.length, start.length); if (key === "points" && end.length !== start.length) { if (end.length > start.length) start = Util._prepareArrayForTween(start, end, node.closed()); else end = Util._prepareArrayForTween(end, start, node.closed()); } if (key.endsWith("ColorStops")) for (let n = 0; n < len; n++) if (n % 2 === 0) diff.push((end[n] || 0) - (start[n] || 0)); else { const startRGBA = colorToRGBA(start[n]); start[n] = startRGBA; diff.push(colorDiff(startRGBA, colorToRGBA(end[n]))); } else for (let n = 0; n < len; n++) diff.push((end[n] || 0) - (start[n] || 0)); } else if (colorAttrs.indexOf(key) !== -1) { start = colorToRGBA(start); diff = colorDiff(start, colorToRGBA(end)); } else diff = end - start; Tween.attrs[nodeId][this._id][key] = { start, diff, end, trueEnd, trueStart }; Tween.tweens[nodeId][key] = this._id; } _tweenFunc(i) { var _a; const node = this.node, attrs = (_a = Tween.attrs[node._id]) === null || _a === void 0 ? void 0 : _a[this._id]; let key, attr, start, diff, newVal, n, len, end; for (key in attrs) { attr = attrs[key]; start = attr.start; diff = attr.diff; end = attr.end; if (Util._isArray(start)) { newVal = []; len = Math.max(start.length, end.length); if (key.endsWith("ColorStops")) for (n = 0; n < len; n++) if (n % 2 === 0) newVal.push((start[n] || 0) + diff[n] * i); else newVal.push(tweenColor(start[n], diff[n], i)); else for (n = 0; n < len; n++) newVal.push((start[n] || 0) + diff[n] * i); } else if (colorAttrs.indexOf(key) !== -1) newVal = tweenColor(start, diff, i); else newVal = start + diff * i; node.setAttr(key, newVal); } } _addListeners() { const destroyEvent = `destroy.konva-tween${this._id}`; const onDestroy = () => this.destroy(); const start = () => { this.node.off(destroyEvent).on(destroyEvent, onDestroy); this.anim.start(); }; this.tween.onPlay = start; this.tween.onReverse = start; this.tween.onPause = () => { this.node.off(destroyEvent); this.anim.stop(); }; const end = (edge, callback) => { var _a; const attrs = (_a = Tween.attrs[this.node._id]) === null || _a === void 0 ? void 0 : _a[this._id]; if (!attrs) return; for (const key in attrs) if (attrs[key][edge] !== void 0) this.node.setAttr(key, attrs[key][edge]); callback === null || callback === void 0 || callback.call(this); }; this.tween.onFinish = () => end("trueEnd", this.onFinish); this.tween.onReset = () => end("trueStart", this.onReset); this.tween.onUpdate = () => { if (this.onUpdate) this.onUpdate.call(this); }; } /** * play * @method * @name Konva.Tween#play * @returns {Tween} */ play() { this.tween.play(); return this; } /** * reverse * @method * @name Konva.Tween#reverse * @returns {Tween} */ reverse() { this.tween.reverse(); return this; } /** * reset * @method * @name Konva.Tween#reset * @returns {Tween} */ reset() { this.tween.reset(); return this; } /** * seek * @method * @name Konva.Tween#seek * @param {Number} t time in seconds between 0 and the duration * @returns {Tween} */ seek(t) { this.tween.seek(t * 1e3); return this; } /** * pause * @method * @name Konva.Tween#pause * @returns {Tween} */ pause() { this.tween.pause(); return this; } /** * finish * @method * @name Konva.Tween#finish * @returns {Tween} */ finish() { this.tween.finish(); return this; } /** * destroy * @method * @name Konva.Tween#destroy */ destroy() { var _a; const nodeId = this.node._id, thisId = this._id, owned = (_a = Tween.attrs[nodeId]) === null || _a === void 0 ? void 0 : _a[thisId], owners = Tween.tweens[nodeId]; this.pause(); if (this.anim) this.anim.stop(); if (owned) { if (owners) { for (const key in owned) delete owners[key]; if (Object.keys(owners).length === 0) delete Tween.tweens[nodeId]; } delete Tween.attrs[nodeId][thisId]; if (Object.keys(Tween.attrs[nodeId]).length === 0) delete Tween.attrs[nodeId]; } } }; Tween.attrs = {}; Tween.tweens = {}; /** * Tween node properties. Shorter usage of {@link Konva.Tween} object. * * @method Konva.Node#to * @param {Object} [params] tween params * @returns {Konva.Tween} * @example * * circle.to({ * x : 50, * duration : 0.5, * onUpdate: () => console.log('props updated'), * onFinish: () => console.log('finished'), * }); */ Node.prototype.to = function(params) { const onFinish = params.onFinish; const tween = new Tween({ ...params, node: this, onFinish() { tween.destroy(); if (onFinish) onFinish(); } }); tween.play(); return tween; }; /** * @namespace Easings * @memberof Konva */ var Easings = { /** * back ease in * @function * @memberof Konva.Easings */ BackEaseIn(t, b, c, d) { return c * (t /= d) * t * (2.70158 * t - 1.70158) + b; }, /** * back ease out * @function * @memberof Konva.Easings */ BackEaseOut(t, b, c, d) { return c * ((t = t / d - 1) * t * (2.70158 * t + 1.70158) + 1) + b; }, /** * back ease in out * @function * @memberof Konva.Easings */ BackEaseInOut(t, b, c, d) { let s = 1.70158; if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b; return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b; }, /** * elastic ease in * @function * @memberof Konva.Easings */ ElasticEaseIn(t, b, c, d, a, p) { let s = 0; if (t === 0) return b; if ((t /= d) === 1) return b + c; if (!p) p = d * .3; if (!a || a < Math.abs(c)) { a = c; s = p / 4; } else s = p / (2 * Math.PI) * Math.asin(c / a); return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; }, /** * elastic ease out * @function * @memberof Konva.Easings */ ElasticEaseOut(t, b, c, d, a, p) { let s = 0; if (t === 0) return b; if ((t /= d) === 1) return b + c; if (!p) p = d * .3; if (!a || a < Math.abs(c)) { a = c; s = p / 4; } else s = p / (2 * Math.PI) * Math.asin(c / a); return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b; }, /** * elastic ease in out * @function * @memberof Konva.Easings */ ElasticEaseInOut(t, b, c, d, a, p) { let s = 0; if (t === 0) return b; if ((t /= d / 2) === 2) return b + c; if (!p) p = d * (.3 * 1.5); if (!a || a < Math.abs(c)) { a = c; s = p / 4; } else s = p / (2 * Math.PI) * Math.asin(c / a); if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b; }, /** * bounce ease out * @function * @memberof Konva.Easings */ BounceEaseOut(t, b, c, d) { if ((t /= d) < 1 / 2.75) return c * (7.5625 * t * t) + b; else if (t < 2 / 2.75) return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b; else if (t < 2.5 / 2.75) return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b; else return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b; }, /** * bounce ease in * @function * @memberof Konva.Easings */ BounceEaseIn(t, b, c, d) { return c - Easings.BounceEaseOut(d - t, 0, c, d) + b; }, /** * bounce ease in out * @function * @memberof Konva.Easings */ BounceEaseInOut(t, b, c, d) { if (t < d / 2) return Easings.BounceEaseIn(t * 2, 0, c, d) * .5 + b; else return Easings.BounceEaseOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b; }, /** * ease in * @function * @memberof Konva.Easings */ EaseIn(t, b, c, d) { return c * (t /= d) * t + b; }, /** * ease out * @function * @memberof Konva.Easings */ EaseOut(t, b, c, d) { return -c * (t /= d) * (t - 2) + b; }, /** * ease in out * @function * @memberof Konva.Easings */ EaseInOut(t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t + b; return -c / 2 * (--t * (t - 2) - 1) + b; }, /** * strong ease in * @function * @memberof Konva.Easings */ StrongEaseIn(t, b, c, d) { return c * (t /= d) * t * t * t * t + b; }, /** * strong ease out * @function * @memberof Konva.Easings */ StrongEaseOut(t, b, c, d) { return c * ((t = t / d - 1) * t * t * t * t + 1) + b; }, /** * strong ease in out * @function * @memberof Konva.Easings */ StrongEaseInOut(t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b; return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; }, /** * linear * @function * @memberof Konva.Easings */ Linear(t, b, c, d) { return c * t / d + b; } }; //#endregion //#region node_modules/konva/lib/_CoreInternals.js var Konva$1 = Util._assign(Konva$2, { /** * Defer automatic Konva.Transformer updates across many synchronous node changes * and run them once when the returned function is called. * A Transformer normally updates after every change of an attached node, so a loop * over N selected nodes costs N updates, each measuring all N nodes. In a batch it costs one. * A single setAttrs(), position(), destroyChildren(), removeChildren() call or animation frame is * already batched; use this for anything else, for example a React commit or an undo. * Attributes and change events stay synchronous. Inside the batch, the Transformer's own * x(), y(), width(), height() and getClientRect() are computed on read; its anchors are laid out * when the batch finishes, or earlier if something draws or measures them. * Change events fire inside the batch, so a listener sees the new attributes and the * Transformer's box, but not its anchors; call transformer.update() there if it needs them. * Batches nest. Call the returned function in a finally block, and do not keep a batch * open across an await or an animation frame. * @method * @name Konva.beginUpdateBatch * @returns {Function} finishes the batch and runs the pending updates * @example * const finish = Konva.beginUpdateBatch(); * try { * selectedNodes.forEach((node) => node.width(100)); * } finally { * finish(); * } */ beginUpdateBatch: Node._beginUpdateBatch, Util, Transform, Node, Container, Stage: Stage$1, stages, Layer: Layer$1, FastLayer: FastLayer$1, Group: Group$1, DD, Shape: Shape$1, shapes, Animation, Tween, Easings, Context, Canvas }); //#endregion //#region node_modules/konva/lib/shapes/Arc.js /** * Arc constructor * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {Number} config.angle in degrees * @param {Number} config.innerRadius * @param {Number} config.outerRadius * @param {Boolean} [config.clockwise] * @@shapeParams * @@nodeParams * @example * // draw a Arc that's pointing downwards * var arc = new Konva.Arc({ * innerRadius: 40, * outerRadius: 80, * fill: 'red', * stroke: 'black', * strokeWidth: 5, * angle: 60, * rotation: -120 * }); */ var Arc$1 = class extends Shape$1 { _sceneFunc(context) { const angle = Konva$2.getAngle(this.angle()), clockwise = this.clockwise(); context.beginPath(); context.arc(0, 0, Math.abs(this.outerRadius()), 0, angle, clockwise); context.arc(0, 0, Math.abs(this.innerRadius()), angle, 0, !clockwise); context.closePath(); context.fillStrokeShape(this); } getWidth() { return Math.abs(this.outerRadius()) * 2; } getHeight() { return Math.abs(this.outerRadius()) * 2; } setWidth(width) { this.outerRadius(width / 2); } setHeight(height) { this.outerRadius(height / 2); } getSelfRect() { const r1 = Math.abs(this.innerRadius()), r2 = Math.abs(this.outerRadius()); const innerRadius = Math.min(r1, r2), outerRadius = Math.max(r1, r2); const clockwise = this.clockwise(); const rawAngle = Konva$2.getAngle(this.angle()); if (rawAngle % (Math.PI * 2) === 0) return rawAngle !== 0 ? { x: -outerRadius, y: -outerRadius, width: outerRadius * 2, height: outerRadius * 2 } : { x: innerRadius, y: 0, width: outerRadius - innerRadius, height: 0 }; const turn = Math.PI * 2; const sweep = clockwise ? -rawAngle : rawAngle; const angle = sweep >= turn ? turn : (sweep % turn + turn) % turn; const boundLeftRatio = Math.cos(Math.min(angle, Math.PI)); const boundRightRatio = 1; const boundTopRatio = Math.sin(Math.min(Math.max(Math.PI, angle), 3 * Math.PI / 2)); const boundBottomRatio = Math.sin(Math.min(angle, Math.PI / 2)); const boundLeft = boundLeftRatio * (boundLeftRatio > 0 ? innerRadius : outerRadius); const boundRight = boundRightRatio * outerRadius; const boundTop = boundTopRatio * (boundTopRatio > 0 ? innerRadius : outerRadius); const boundBottom = boundBottomRatio * (boundBottomRatio > 0 ? outerRadius : innerRadius); return { x: boundLeft, y: clockwise ? -1 * boundBottom : boundTop, width: boundRight - boundLeft, height: boundBottom - boundTop }; } }; Arc$1.prototype._centroid = true; Arc$1.prototype.className = "Arc"; Arc$1.prototype._attrsAffectingSize = [ "innerRadius", "outerRadius", "angle", "clockwise" ]; _registerNode(Arc$1, true); Factory.addGetterSetter(Arc$1, "innerRadius", 0, getNumberValidator()); /** * get/set innerRadius * @name Konva.Arc#innerRadius * @method * @param {Number} innerRadius * @returns {Number} * @example * // get inner radius * var innerRadius = arc.innerRadius(); * * // set inner radius * arc.innerRadius(20); */ Factory.addGetterSetter(Arc$1, "outerRadius", 0, getNumberValidator()); /** * get/set outerRadius * @name Konva.Arc#outerRadius * @method * @param {Number} outerRadius * @returns {Number} * @example * // get outer radius * var outerRadius = arc.outerRadius(); * * // set outer radius * arc.outerRadius(20); */ Factory.addGetterSetter(Arc$1, "angle", 0, getNumberValidator()); /** * get/set angle in degrees * @name Konva.Arc#angle * @method * @param {Number} angle * @returns {Number} * @example * // get angle * var angle = arc.angle(); * * // set angle * arc.angle(20); */ Factory.addGetterSetter(Arc$1, "clockwise", false, getBooleanValidator()); /** * get/set clockwise flag * @name Konva.Arc#clockwise * @method * @param {Boolean} clockwise * @returns {Boolean} * @example * // get clockwise flag * var clockwise = arc.clockwise(); * * // draw arc counter-clockwise * arc.clockwise(false); * * // draw arc clockwise * arc.clockwise(true); */ //#endregion //#region node_modules/konva/lib/BezierFunctions.js var tValues20 = [ -.07652652113349734, .07652652113349734, -.22778585114164507, .22778585114164507, -.37370608871541955, .37370608871541955, -.5108670019508271, .5108670019508271, -.636053680726515, .636053680726515, -.7463319064601508, .7463319064601508, -.8391169718222188, .8391169718222188, -.912234428251326, .912234428251326, -.9639719272779138, .9639719272779138, -.9931285991850949, .9931285991850949 ]; var cValues20 = [ .15275338713072584, .15275338713072584, .14917298647260374, .14917298647260374, .14209610931838204, .14209610931838204, .13168863844917664, .13168863844917664, .11819453196151841, .11819453196151841, .10193011981724044, .10193011981724044, .08327674157670475, .08327674157670475, .06267204833410907, .06267204833410907, .04060142980038694, .04060142980038694, .017614007139152118, .017614007139152118 ]; var getCubicArcLength = (xs, ys, t) => { const z = t / 2; let sum = 0; for (let i = 0; i < tValues20.length; i++) { const correctedT = z * tValues20[i] + z; sum += cValues20[i] * BFunc(xs, ys, correctedT); } return z * sum; }; var getQuadraticArcLength = (xs, ys, t = 1) => getCubicArcLength([ xs[0], xs[0] + 2 / 3 * (xs[1] - xs[0]), xs[2] + 2 / 3 * (xs[1] - xs[2]), xs[2] ], [ ys[0], ys[0] + 2 / 3 * (ys[1] - ys[0]), ys[2] + 2 / 3 * (ys[1] - ys[2]), ys[2] ], t); function BFunc(xs, ys, t) { const mt = 1 - t; const a = mt * mt; const b = 2 * mt * t; const c = t * t; const dx = a * (3 * (xs[1] - xs[0])) + b * (3 * (xs[2] - xs[1])) + c * (3 * (xs[3] - xs[2])); const dy = a * (3 * (ys[1] - ys[0])) + b * (3 * (ys[2] - ys[1])) + c * (3 * (ys[3] - ys[2])); return Math.sqrt(dx * dx + dy * dy); } var t2length = (length, totalLength, func) => { let error = 1; let t = length / totalLength; let step = (length - func(t)) / totalLength; let numIterations = 0; while (error > .001) { const increasedTLength = func(t + step); const increasedTError = Math.abs(length - increasedTLength) / totalLength; if (increasedTError < error) { error = increasedTError; t += step; } else { const decreasedTLength = func(t - step); const decreasedTError = Math.abs(length - decreasedTLength) / totalLength; if (decreasedTError < error) { error = decreasedTError; t -= step; } else step /= 2; } numIterations++; if (numIterations > 500) break; } return t; }; var quadraticAt = (p0, p1, p2, t) => { const mt = 1 - t; return mt * mt * p0 + 2 * mt * t * p1 + t * t * p2; }; /** * Points where a quadratic bezier segment reaches its highest or lowest value * on one of the two axes, as a flat [x, y, x, y, ...] list. The two end points * are not included, because the caller knows them already. */ var getQuadraticExtremaPoints = (x0, y0, x1, y1, x2, y2) => { const extrema = []; for (const axis of [[ x0, x1, x2 ], [ y0, y1, y2 ]]) { const t = (axis[0] - axis[1]) / (axis[0] - 2 * axis[1] + axis[2]); if (t > 0 && t < 1) extrema.push(quadraticAt(x0, x1, x2, t), quadraticAt(y0, y1, y2, t)); } return extrema; }; var cubicAt = (p0, p1, p2, p3, t) => { const mt = 1 - t; return mt * mt * mt * p0 + 3 * mt * mt * t * p1 + 3 * mt * t * t * p2 + t * t * t * p3; }; /** * Points where a cubic bezier segment reaches its highest or lowest value on * one of the two axes, as a flat [x, y, x, y, ...] list. The two end points * are not included, because the caller knows them already. */ var getCubicExtremaPoints = (x0, y0, x1, y1, x2, y2, x3, y3) => { const extrema = []; for (const axis of [[ x0, x1, x2, x3 ], [ y0, y1, y2, y3 ]]) { const a = -3 * axis[0] + 9 * axis[1] - 9 * axis[2] + 3 * axis[3]; const b = 6 * axis[0] - 12 * axis[1] + 6 * axis[2]; const c = -3 * axis[0] + 3 * axis[1]; const discriminant = b * b - 4 * a * c; if (discriminant < 0) continue; const q = -(b + (b < 0 ? -1 : 1) * Math.sqrt(discriminant)) / 2; for (const t of [q / a, c / q]) if (t > 0 && t < 1) extrema.push(cubicAt(x0, x1, x2, x3, t), cubicAt(y0, y1, y2, y3, t)); } return extrema; }; //#endregion //#region node_modules/konva/lib/shapes/Line.js function getControlPoints(x0, y0, x1, y1, x2, y2, t) { const d01 = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2)), d12 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)), dSum = d01 + d12; if (dSum === 0) return [ x1, y1, x1, y1 ]; const fa = t * d01 / dSum, fb = t * d12 / dSum; return [ x1 - fa * (x2 - x0), y1 - fa * (y2 - y0), x1 + fb * (x2 - x0), y1 + fb * (y2 - y0) ]; } function expandPoints(p, tension) { const len = p.length, allPoints = []; for (let n = 2; n < len - 2; n += 2) { const cp = getControlPoints(p[n - 2], p[n - 1], p[n], p[n + 1], p[n + 2], p[n + 3], tension); if (isNaN(cp[0])) continue; allPoints.push(cp[0]); allPoints.push(cp[1]); allPoints.push(p[n]); allPoints.push(p[n + 1]); allPoints.push(cp[2]); allPoints.push(cp[3]); } return allPoints; } function getBezierExtremaPoints(points) { const extrema = []; for (let n = 0; n + 7 < points.length; n += 6) extrema.push(points[n + 6], points[n + 7], ...getCubicExtremaPoints(points[n], points[n + 1], points[n + 2], points[n + 3], points[n + 4], points[n + 5], points[n + 6], points[n + 7])); return extrema; } /** * Line constructor.  Lines are defined by an array of points and * a tension * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {Array} config.points Flat array of points coordinates. You should define them as [x1, y1, x2, y2, x3, y3]. * @param {Number} [config.tension] Higher values will result in a more curvy line. A value of 0 will result in no interpolation. * The default is 0 * @param {Boolean} [config.closed] defines whether or not the line shape is closed, creating a polygon or blob * @param {Boolean} [config.bezier] if no tension is provided but bezier=true, we draw the line as a bezier using the passed points * @@shapeParams * @@nodeParams * @example * var line = new Konva.Line({ * x: 100, * y: 50, * points: [73, 70, 340, 23, 450, 60, 500, 20], * stroke: 'red', * tension: 1 * }); */ var Line$1 = class extends Shape$1 { constructor(config) { super(config); this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva", function() { this._clearCache("tensionPoints"); }); } _hasTension() { return this.tension() !== 0 && this.points().length > 4; } /** * Report every curve segment of a line with a tension, in draw order. Both * the scene function and the bounding rect read the shape through this, so * that they can not disagree about which curve the line is. * * The handlers take plain numbers, because this runs on every frame. */ _eachTensionSegment(onQuadratic, onCubic) { const points = this.points(), length = points.length, closed = this.closed(), tp = this.getTensionPoints(), len = tp.length; let x0 = points[0], y0 = points[1], n = closed ? 0 : 4; if (!closed) { onQuadratic(x0, y0, tp[0], tp[1], tp[2], tp[3]); x0 = tp[2]; y0 = tp[3]; } while (n < len - 2) { const cp1x = tp[n++], cp1y = tp[n++], cp2x = tp[n++], cp2y = tp[n++], x = tp[n++], y = tp[n++]; onCubic(x0, y0, cp1x, cp1y, cp2x, cp2y, x, y); x0 = x; y0 = y; } if (!closed) onQuadratic(x0, y0, tp[len - 2], tp[len - 1], points[length - 2], points[length - 1]); } _getStrokePadding(miterLimit = this.points().length === 4 && !this.closed() ? 1 : void 0) { return super._getStrokePadding(miterLimit); } _sceneFunc(context) { const points = this.points(), length = points.length, closed = this.closed(), bezier = this.bezier(); if (!length) return; let n = 0; context.beginPath(); context.moveTo(points[0], points[1]); if (this._hasTension()) this._eachTensionSegment((_x0, _y0, cpx, cpy, x, y) => context.quadraticCurveTo(cpx, cpy, x, y), (_x0, _y0, cp1x, cp1y, cp2x, cp2y, x, y) => context.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)); else if (bezier) { n = 2; while (n < length) context.bezierCurveTo(points[n++], points[n++], points[n++], points[n++], points[n++], points[n++]); } else for (n = 2; n < length; n += 2) context.lineTo(points[n], points[n + 1]); if (closed) { context.closePath(); context.fillStrokeShape(this); } else context.strokeShape(this); } getTensionPoints() { return this._getCache("tensionPoints", this._getTensionPoints); } _getTensionPoints() { if (this.closed()) return this._getTensionPointsClosed(); else return expandPoints(this.points(), this.tension()); } _getTensionPointsClosed() { const p = this.points(), len = p.length, tension = this.tension(), firstControlPoints = getControlPoints(p[len - 2], p[len - 1], p[0], p[1], p[2], p[3], tension), lastControlPoints = getControlPoints(p[len - 4], p[len - 3], p[len - 2], p[len - 1], p[0], p[1], tension), middle = expandPoints(p, tension); return [firstControlPoints[2], firstControlPoints[3]].concat(middle).concat([ lastControlPoints[0], lastControlPoints[1], p[len - 2], p[len - 1], lastControlPoints[2], lastControlPoints[3], firstControlPoints[0], firstControlPoints[1], p[0], p[1] ]); } getWidth() { return this.getSelfRect().width; } getHeight() { return this.getSelfRect().height; } getSelfRect() { let points = this.points(); if (points.length < 4) return { x: points[0] || 0, y: points[1] || 0, width: 0, height: 0 }; if (this._hasTension()) { const bounds = [points[0], points[1]]; this._eachTensionSegment((x0, y0, cpx, cpy, x, y) => bounds.push(x, y, ...getQuadraticExtremaPoints(x0, y0, cpx, cpy, x, y)), (x0, y0, cp1x, cp1y, cp2x, cp2y, x, y) => bounds.push(x, y, ...getCubicExtremaPoints(x0, y0, cp1x, cp1y, cp2x, cp2y, x, y))); points = bounds; } else if (this.bezier()) points = [ points[0], points[1], ...getBezierExtremaPoints(points) ]; return Util._getPointsRect(points); } }; Line$1.prototype.className = "Line"; Line$1.prototype._attrsAffectingSize = [ "points", "bezier", "tension", "closed" ]; _registerNode(Line$1, true); Factory.addGetterSetter(Line$1, "closed", false); /** * get/set closed flag. The default is false * @name Konva.Line#closed * @method * @param {Boolean} closed * @returns {Boolean} * @example * // get closed flag * var closed = line.closed(); * * // close the shape * line.closed(true); * * // open the shape * line.closed(false); */ Factory.addGetterSetter(Line$1, "bezier", false); /** * get/set bezier flag. The default is false * @name Konva.Line#bezier * @method * @param {Boolean} bezier * @returns {Boolean} * @example * // get whether the line is a bezier * var isBezier = line.bezier(); * * // set whether the line is a bezier * line.bezier(true); */ Factory.addGetterSetter(Line$1, "tension", 0, getNumberValidator()); /** * get/set tension * @name Konva.Line#tension * @method * @param {Number} tension Higher values will result in a more curvy line. A value of 0 will result in no interpolation. The default is 0 * @returns {Number} * @example * // get tension * var tension = line.tension(); * * // set tension * line.tension(3); */ Factory.addGetterSetter(Line$1, "points", [], getNumberArrayValidator()); /** * get/set points array. Points is a flat array [x1, y1, x2, y2]. It is flat for performance reasons. * @name Konva.Line#points * @method * @param {Array} points * @returns {Array} * @example * // get points * var points = line.points(); * * // set points * line.points([10, 20, 30, 40, 50, 60]); * * // push a new point * line.points(line.points().concat([70, 80])); */ //#endregion //#region node_modules/konva/lib/shapes/Path.js var PARAM_COUNT = { m: 2, l: 2, h: 1, v: 1, c: 6, s: 4, q: 4, t: 2, a: 7, z: 0 }; var TAU = Math.PI * 2; /** * Path constructor. * @author Jason Follas * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {String} config.data SVG data string * @@shapeParams * @@nodeParams * @example * var path = new Konva.Path({ * x: 240, * y: 40, * data: 'M12.582,9.551C3.251,16.237,0.921,29.021,7.08,38.564l-2.36,1.689l4.893,2.262l4.893,2.262l-0.568-5.36l-0.567-5.359l-2.365,1.694c-4.657-7.375-2.83-17.185,4.352-22.33c7.451-5.338,17.817-3.625,23.156,3.824c5.337,7.449,3.625,17.813-3.821,23.152l2.857,3.988c9.617-6.893,11.827-20.277,4.935-29.896C35.591,4.87,22.204,2.658,12.582,9.551z', * fill: 'green', * scaleX: 2, * scaleY: 2 * }); */ var Path$1 = class Path$1 extends Shape$1 { constructor(config) { super(config); this.dataArray = []; this.pathLength = 0; this._readDataAttribute(); this.on("dataChange.konva", function() { this._readDataAttribute(); }); } _readDataAttribute() { this.dataArray = Path$1.parsePathData(this.data()); this.pathLength = Path$1.getPathLength(this.dataArray); } _sceneFunc(context) { const ca = this.dataArray; context.beginPath(); let isClosed = false; for (let n = 0; n < ca.length; n++) { const c = ca[n].command; const p = ca[n].points; switch (c) { case "L": context.lineTo(p[0], p[1]); break; case "M": context.moveTo(p[0], p[1]); break; case "C": context.bezierCurveTo(p[0], p[1], p[2], p[3], p[4], p[5]); break; case "Q": context.quadraticCurveTo(p[0], p[1], p[2], p[3]); break; case "A": context.ellipse(p[0], p[1], p[2], p[3], p[6], p[4], p[4] + p[5], !p[7]); break; case "z": isClosed = true; context.closePath(); } } if (!isClosed && !this.hasFill()) context.strokeShape(this); else context.fillStrokeShape(this); } getWidth() { return this.getSelfRect().width; } getHeight() { return this.getSelfRect().height; } getSelfRect() { const points = []; this.dataArray.forEach(function(data) { if (data.command === "A") { const [cx, cy, rx, ry, start, dTheta, psi] = data.points; const cos = Math.cos(psi), sin = Math.sin(psi); const end = Path$1.getPointOnEllipticalArc(cx, cy, rx, ry, start + dTheta, psi); points.push(data.start.x, data.start.y, end.x, end.y); const tx = Math.atan2(-ry * sin, rx * cos); const ty = Math.atan2(ry * cos, rx * sin); [ tx, tx + Math.PI, ty, ty + Math.PI ].forEach((t) => { if (((t - start) * Math.sign(dTheta) % TAU + TAU) % TAU < Math.abs(dTheta)) { const point = Path$1.getPointOnEllipticalArc(cx, cy, rx, ry, t, psi); points.push(point.x, point.y); } }); } else if (data.command === "C") points.push(data.start.x, data.start.y, data.points[4], data.points[5], ...getCubicExtremaPoints(data.start.x, data.start.y, data.points[0], data.points[1], data.points[2], data.points[3], data.points[4], data.points[5])); else if (data.command === "Q") points.push(data.start.x, data.start.y, data.points[2], data.points[3], ...getQuadraticExtremaPoints(data.start.x, data.start.y, data.points[0], data.points[1], data.points[2], data.points[3])); else points.push(...data.points); }); return Util._getPointsRect(points); } /** * Return length of the path. * @method * @name Konva.Path#getLength * @returns {Number} length * @example * var length = path.getLength(); */ getLength() { return this.pathLength; } /** * Get point on path at specific length of the path * @method * @name Konva.Path#getPointAtLength * @param {Number} length length * @returns {Object} point {x,y} point * @example * var point = path.getPointAtLength(10); */ getPointAtLength(length) { return Path$1.getPointAtLengthOfDataArray(length, this.dataArray); } static getLineLength(x1, y1, x2, y2) { return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); } static getPathLength(dataArray) { let pathLength = 0; for (let i = 0; i < dataArray.length; ++i) pathLength += dataArray[i].pathLength; return pathLength; } static getPointAtLengthOfDataArray(length, dataArray, cursor) { var _a, _b; let points, i = (_a = cursor === null || cursor === void 0 ? void 0 : cursor.index) !== null && _a !== void 0 ? _a : 0, offset = (_b = cursor === null || cursor === void 0 ? void 0 : cursor.offset) !== null && _b !== void 0 ? _b : 0, ii = dataArray.length; if (!ii) return null; while (i > 0 && length <= offset) offset -= dataArray[--i].pathLength; length -= offset; while (i < ii && length > dataArray[i].pathLength) { const segmentLength = dataArray[i].pathLength; length -= segmentLength; offset += segmentLength; ++i; } if (cursor && i < ii) { cursor.index = i; cursor.offset = offset; } if (i === ii) { i--; length = dataArray[i].pathLength; } if (length < .01) { if (dataArray[i].command === "M") { points = dataArray[i].points.slice(0, 2); return { x: points[0], y: points[1] }; } else return { x: dataArray[i].start.x, y: dataArray[i].start.y }; } const cp = dataArray[i]; const p = cp.points; switch (cp.command) { case "L": case "z": return Path$1.getPointOnLine(length, cp.start.x, cp.start.y, p[0], p[1]); case "C": return Path$1.getPointOnCubicBezier(t2length(length, cp.pathLength, (i) => { return getCubicArcLength([ cp.start.x, p[0], p[2], p[4] ], [ cp.start.y, p[1], p[3], p[5] ], i); }), cp.start.x, cp.start.y, p[0], p[1], p[2], p[3], p[4], p[5]); case "Q": return Path$1.getPointOnQuadraticBezier(t2length(length, cp.pathLength, (i) => { return getQuadraticArcLength([ cp.start.x, p[0], p[2] ], [ cp.start.y, p[1], p[3] ], i); }), cp.start.x, cp.start.y, p[0], p[1], p[2], p[3]); case "A": return Path$1.getPointOnEllipticalArc(p[0], p[1], p[2], p[3], p[2] === p[3] ? p[4] + p[5] * length / cp.pathLength : Path$1._walkArc(p, length).theta, p[6]); } return null; } static getPointOnLine(dist, P1x, P1y, P2x, P2y, fromX, fromY) { fromX = fromX !== null && fromX !== void 0 ? fromX : P1x; fromY = fromY !== null && fromY !== void 0 ? fromY : P1y; const len = this.getLineLength(P1x, P1y, P2x, P2y); if (len < 1e-10) return { x: P1x, y: P1y }; if (P2x === P1x) return { x: fromX, y: fromY + (P2y > P1y ? dist : -dist) }; const m = (P2y - P1y) / (P2x - P1x); const run = Math.sqrt(dist * dist / (1 + m * m)) * (P2x < P1x ? -1 : 1); const rise = m * run; if (Math.abs(fromY - P1y - m * (fromX - P1x)) < 1e-10) return { x: fromX + run, y: fromY + rise }; const u = ((fromX - P1x) * (P2x - P1x) + (fromY - P1y) * (P2y - P1y)) / (len * len); const ix = P1x + u * (P2x - P1x); const iy = P1y + u * (P2y - P1y); const pRise = this.getLineLength(fromX, fromY, ix, iy); const pRun = Math.sqrt(dist * dist - pRise * pRise); const adjustedRun = Math.sqrt(pRun * pRun / (1 + m * m)) * (P2x < P1x ? -1 : 1); const adjustedRise = m * adjustedRun; return { x: ix + adjustedRun, y: iy + adjustedRise }; } static getPointOnCubicBezier(pct, P1x, P1y, P2x, P2y, P3x, P3y, P4x, P4y) { function CB1(t) { return t * t * t; } function CB2(t) { return 3 * t * t * (1 - t); } function CB3(t) { return 3 * t * (1 - t) * (1 - t); } function CB4(t) { return (1 - t) * (1 - t) * (1 - t); } return { x: P4x * CB1(pct) + P3x * CB2(pct) + P2x * CB3(pct) + P1x * CB4(pct), y: P4y * CB1(pct) + P3y * CB2(pct) + P2y * CB3(pct) + P1y * CB4(pct) }; } static getPointOnQuadraticBezier(pct, P1x, P1y, P2x, P2y, P3x, P3y) { function QB1(t) { return t * t; } function QB2(t) { return 2 * t * (1 - t); } function QB3(t) { return (1 - t) * (1 - t); } return { x: P3x * QB1(pct) + P2x * QB2(pct) + P1x * QB3(pct), y: P3y * QB1(pct) + P2y * QB2(pct) + P1y * QB3(pct) }; } static getPointOnEllipticalArc(cx, cy, rx, ry, theta, psi) { const cosPsi = Math.cos(psi), sinPsi = Math.sin(psi); const pt = { x: rx * Math.cos(theta), y: ry * Math.sin(theta) }; return { x: cx + (pt.x * cosPsi - pt.y * sinPsi), y: cy + (pt.x * sinPsi + pt.y * cosPsi) }; } static parsePathData(data) { if (!data) return []; let cs = data; const cc = [ "m", "M", "l", "L", "v", "V", "h", "H", "z", "Z", "c", "C", "q", "Q", "t", "T", "s", "S", "a", "A" ]; cs = cs.replace(/* @__PURE__ */ new RegExp(" ", "g"), ","); for (let n = 0; n < cc.length; n++) cs = cs.replace(new RegExp(cc[n], "g"), "|" + cc[n]); const arr = cs.split("|"); const ca = []; const coords = []; let cpx = 0; let cpy = 0; let spx = 0; let spy = 0; const re = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi; let match; for (let n = 1; n < arr.length; n++) { let str = arr[n]; let c = str.charAt(0); str = str.slice(1); coords.length = 0; while (match = re.exec(str)) coords.push(match[0]); const p = []; let arcParamIndex = c === "A" || c === "a" ? 0 : -1; for (let j = 0, jlen = coords.length; j < jlen; j++) { let token = coords[j]; while ((arcParamIndex === 3 || arcParamIndex === 4) && token.length > 1 && (token[0] === "0" || token[0] === "1")) { p.push(+token[0]); arcParamIndex++; token = token.slice(1); } const parsed = parseFloat(token); p.push(isNaN(parsed) ? 0 : parsed); if (arcParamIndex >= 0) arcParamIndex = (arcParamIndex + 1) % 7; } let pIndex = 0; while (pIndex < p.length) { if (p.length - pIndex < PARAM_COUNT[c.toLowerCase()] || c === "z" || c === "Z") break; let cmd = ""; let points = []; const startX = cpx, startY = cpy; let prevCmd, ctlPtx, ctlPty; let rx, ry, psi, fa, fs, x1, y1; switch (c) { case "l": cpx += p[pIndex++]; cpy += p[pIndex++]; cmd = "L"; points.push(cpx, cpy); break; case "L": cpx = p[pIndex++]; cpy = p[pIndex++]; points.push(cpx, cpy); break; case "m": cpx += p[pIndex++]; cpy += p[pIndex++]; cmd = "M"; spx = cpx; spy = cpy; points.push(cpx, cpy); c = "l"; break; case "M": cpx = p[pIndex++]; cpy = p[pIndex++]; cmd = "M"; spx = cpx; spy = cpy; points.push(cpx, cpy); c = "L"; break; case "h": cpx += p[pIndex++]; cmd = "L"; points.push(cpx, cpy); break; case "H": cpx = p[pIndex++]; cmd = "L"; points.push(cpx, cpy); break; case "v": cpy += p[pIndex++]; cmd = "L"; points.push(cpx, cpy); break; case "V": cpy = p[pIndex++]; cmd = "L"; points.push(cpx, cpy); break; case "C": points.push(p[pIndex++], p[pIndex++], p[pIndex++], p[pIndex++]); cpx = p[pIndex++]; cpy = p[pIndex++]; points.push(cpx, cpy); break; case "c": points.push(cpx + p[pIndex++], cpy + p[pIndex++], cpx + p[pIndex++], cpy + p[pIndex++]); cpx += p[pIndex++]; cpy += p[pIndex++]; cmd = "C"; points.push(cpx, cpy); break; case "S": ctlPtx = cpx; ctlPty = cpy; prevCmd = ca[ca.length - 1]; if ((prevCmd === null || prevCmd === void 0 ? void 0 : prevCmd.command) === "C") { ctlPtx = cpx + (cpx - prevCmd.points[2]); ctlPty = cpy + (cpy - prevCmd.points[3]); } points.push(ctlPtx, ctlPty, p[pIndex++], p[pIndex++]); cpx = p[pIndex++]; cpy = p[pIndex++]; cmd = "C"; points.push(cpx, cpy); break; case "s": ctlPtx = cpx; ctlPty = cpy; prevCmd = ca[ca.length - 1]; if ((prevCmd === null || prevCmd === void 0 ? void 0 : prevCmd.command) === "C") { ctlPtx = cpx + (cpx - prevCmd.points[2]); ctlPty = cpy + (cpy - prevCmd.points[3]); } points.push(ctlPtx, ctlPty, cpx + p[pIndex++], cpy + p[pIndex++]); cpx += p[pIndex++]; cpy += p[pIndex++]; cmd = "C"; points.push(cpx, cpy); break; case "Q": points.push(p[pIndex++], p[pIndex++]); cpx = p[pIndex++]; cpy = p[pIndex++]; points.push(cpx, cpy); break; case "q": points.push(cpx + p[pIndex++], cpy + p[pIndex++]); cpx += p[pIndex++]; cpy += p[pIndex++]; cmd = "Q"; points.push(cpx, cpy); break; case "T": ctlPtx = cpx; ctlPty = cpy; prevCmd = ca[ca.length - 1]; if ((prevCmd === null || prevCmd === void 0 ? void 0 : prevCmd.command) === "Q") { ctlPtx = cpx + (cpx - prevCmd.points[0]); ctlPty = cpy + (cpy - prevCmd.points[1]); } cpx = p[pIndex++]; cpy = p[pIndex++]; cmd = "Q"; points.push(ctlPtx, ctlPty, cpx, cpy); break; case "t": ctlPtx = cpx; ctlPty = cpy; prevCmd = ca[ca.length - 1]; if ((prevCmd === null || prevCmd === void 0 ? void 0 : prevCmd.command) === "Q") { ctlPtx = cpx + (cpx - prevCmd.points[0]); ctlPty = cpy + (cpy - prevCmd.points[1]); } cpx += p[pIndex++]; cpy += p[pIndex++]; cmd = "Q"; points.push(ctlPtx, ctlPty, cpx, cpy); break; case "A": case "a": rx = Math.abs(p[pIndex++]); ry = Math.abs(p[pIndex++]); psi = p[pIndex++]; fa = p[pIndex++]; fs = p[pIndex++]; x1 = cpx; y1 = cpy; if (c === "a") { cpx += p[pIndex++]; cpy += p[pIndex++]; } else { cpx = p[pIndex++]; cpy = p[pIndex++]; } cmd = "A"; if (cpx === x1 && cpy === y1) continue; else if (!rx || !ry) { cmd = "L"; points.push(cpx, cpy); } else points = this.convertEndpointToCenterParameterization(x1, y1, cpx, cpy, fa, fs, rx, ry, psi); } ca.push({ command: cmd || c, points, start: { x: startX, y: startY }, pathLength: this.calcLength(startX, startY, cmd || c, points) }); } if (c === "z" || c === "Z") { ca.push({ command: "z", points: [spx, spy], start: { x: cpx, y: cpy }, pathLength: this.getLineLength(cpx, cpy, spx, spy) }); cpx = spx; cpy = spy; } } return ca; } /** * Walks an arc in one degree steps, accumulating its length. Returns the * angle `length` along the arc, or its end angle and total length when * `length` is past the end. */ static _walkArc(points, length) { const [cx, cy, rx, ry, start, dTheta] = points; const steps = Math.max(1, Math.ceil(Math.abs(dTheta) / (Math.PI / 180))); let p1 = Path$1.getPointOnEllipticalArc(cx, cy, rx, ry, start, 0); let prev = start; let len = 0; for (let i = 1; i <= steps; i++) { const t = start + dTheta * i / steps; const p2 = Path$1.getPointOnEllipticalArc(cx, cy, rx, ry, t, 0); const d = Path$1.getLineLength(p1.x, p1.y, p2.x, p2.y); if (len + d >= length) return { theta: prev + (t - prev) * ((length - len) / d), length }; len += d; p1 = p2; prev = t; } return { theta: prev, length: len }; } static calcLength(x, y, cmd, points) { const path = Path$1; switch (cmd) { case "L": return path.getLineLength(x, y, points[0], points[1]); case "C": return getCubicArcLength([ x, points[0], points[2], points[4] ], [ y, points[1], points[3], points[5] ], 1); case "Q": return getQuadraticArcLength([ x, points[0], points[2] ], [ y, points[1], points[3] ], 1); case "A": return path._walkArc(points, Infinity).length; } return 0; } static convertEndpointToCenterParameterization(x1, y1, x2, y2, fa, fs, rx, ry, psiDeg) { const psi = psiDeg * (Math.PI / 180); const xp = Math.cos(psi) * (x1 - x2) / 2 + Math.sin(psi) * (y1 - y2) / 2; const yp = -1 * Math.sin(psi) * (x1 - x2) / 2 + Math.cos(psi) * (y1 - y2) / 2; const lambda = xp * xp / (rx * rx) + yp * yp / (ry * ry); if (lambda > 1) { rx *= Math.sqrt(lambda); ry *= Math.sqrt(lambda); } let f = Math.sqrt((rx * rx * (ry * ry) - rx * rx * (yp * yp) - ry * ry * (xp * xp)) / (rx * rx * (yp * yp) + ry * ry * (xp * xp))); if (fa === fs) f *= -1; if (isNaN(f)) f = 0; const cxp = f * rx * yp / ry; const cyp = f * -ry * xp / rx; const cx = (x1 + x2) / 2 + Math.cos(psi) * cxp - Math.sin(psi) * cyp; const cy = (y1 + y2) / 2 + Math.sin(psi) * cxp + Math.cos(psi) * cyp; const vMag = function(v) { return Math.sqrt(v[0] * v[0] + v[1] * v[1]); }; const vRatio = function(u, v) { return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v)); }; const vAngle = function(u, v) { return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vRatio(u, v)); }; const theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]); const u = [(xp - cxp) / rx, (yp - cyp) / ry]; const v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry]; let dTheta = vAngle(u, v); if (vRatio(u, v) <= -1) dTheta = Math.PI; if (vRatio(u, v) >= 1) dTheta = 0; if (fs === 0 && dTheta > 0) dTheta = dTheta - 2 * Math.PI; if (fs === 1 && dTheta < 0) dTheta = dTheta + 2 * Math.PI; return [ cx, cy, rx, ry, theta, dTheta, psi, fs ]; } }; Path$1.prototype.className = "Path"; Path$1.prototype._attrsAffectingSize = ["data"]; _registerNode(Path$1, true); /** * get/set SVG path data string. This method * also automatically parses the data string * into a data array. Currently supported SVG data: * M, m, L, l, H, h, V, v, Q, q, T, t, C, c, S, s, A, a, Z, z * @name Konva.Path#data * @method * @param {String} data svg path string * @returns {String} * @example * // get data * var data = path.data(); * * // set data * path.data('M200,100h100v50z'); */ Factory.addGetterSetter(Path$1, "data"); /** * get width of the path. It is computed from the path data and cannot be set * @name Konva.Path#width * @method * @returns {Number} * @example * var width = path.width(); */ /** * get height of the path. It is computed from the path data and cannot be set * @name Konva.Path#height * @method * @returns {Number} * @example * var height = path.height(); */ //#endregion //#region node_modules/konva/lib/shapes/Arrow.js /** * Arrow constructor * @constructor * @memberof Konva * @augments Konva.Line * @param {Object} config * @param {Array} config.points Flat array of points coordinates. You should define them as [x1, y1, x2, y2, x3, y3]. * @param {Number} [config.tension] Higher values will result in a more curvy line. A value of 0 will result in no interpolation. * The default is 0 * @param {Number} config.pointerLength Arrow pointer length. Default value is 10. * @param {Number} config.pointerWidth Arrow pointer width. Default value is 10. * @param {Boolean} config.pointerAtBeginning Do we need to draw pointer on beginning position?. Default false. * @param {Boolean} config.pointerAtEnding Do we need to draw pointer on ending position?. Default true. * @@shapeParams * @@nodeParams * @example * var line = new Konva.Line({ * points: [73, 70, 340, 23, 450, 60, 500, 20], * stroke: 'red', * tension: 1, * pointerLength : 10, * pointerWidth : 12 * }); */ var Arrow$1 = class extends Line$1 { _getStrokePadding() { return super._getStrokePadding(this.pointerAtBeginning() || this.pointerAtEnding() ? this.miterLimit() || 10 : void 0); } _sceneFunc(ctx) { super._sceneFunc(ctx); const points = this.points(); const n = points.length; if (n < 4) return; const length = this.pointerLength(); const width = this.pointerWidth(); if (this.pointerAtEnding()) { ctx.save(); ctx.beginPath(); ctx.translate(points[n - 2], points[n - 1]); ctx.rotate(this._getPointerAngle(false)); ctx.moveTo(0, 0); ctx.lineTo(-length, width / 2); ctx.lineTo(-length, -width / 2); ctx.closePath(); ctx.restore(); this.__fillStroke(ctx); } if (this.pointerAtBeginning()) { ctx.save(); ctx.beginPath(); ctx.translate(points[0], points[1]); ctx.rotate(this._getPointerAngle(true)); ctx.moveTo(0, 0); ctx.lineTo(-length, width / 2); ctx.lineTo(-length, -width / 2); ctx.closePath(); ctx.restore(); this.__fillStroke(ctx); } } _getPointerAngle(atBeginning) { const points = this.points(); const n = points.length; const fromTension = this.tension() !== 0 && n > 4; const tp = fromTension ? this.getTensionPoints() : points; const ex = atBeginning ? points[0] : points[n - 2], ey = atBeginning ? points[1] : points[n - 1]; let dx = 0, dy = 0; if (fromTension && atBeginning) { dx = ex - (tp[0] + tp[2]) / 2; dy = ey - (tp[1] + tp[3]) / 2; } else if (fromTension) { const x = tp[tp.length - 4], y = tp[tp.length - 3]; const controlX = tp[tp.length - 2], controlY = tp[tp.length - 1]; const lastLength = Path$1.calcLength(x, y, "Q", [ controlX, controlY, ex, ey ]); const previous = Path$1.getPointOnQuadraticBezier(lastLength ? Math.max(0, 1 - this.pointerLength() / lastLength) : 0, x, y, controlX, controlY, ex, ey); dx = ex - previous.x; dy = ey - previous.y; } for (let i = atBeginning ? 0 : tp.length - 2; !dx && !dy && i >= 0 && i < tp.length; i += atBeginning ? 2 : -2) { dx = ex - tp[i]; dy = ey - tp[i + 1]; } const turn = Math.PI * 2; return (Math.atan2(dy, dx) + turn) % turn; } __fillStroke(ctx) { const isDashEnabled = this.dashEnabled(); if (isDashEnabled) { this.attrs.dashEnabled = false; ctx.setLineDash([]); } ctx.fillStrokeShape(this); if (isDashEnabled) this.attrs.dashEnabled = true; } getSelfRect() { const lineRect = super.getSelfRect(); const points = this.points(); if (points.length < 4) return lineRect; let minX = lineRect.x, minY = lineRect.y; let maxX = minX + lineRect.width, maxY = minY + lineRect.height; for (const beginning of [false, true]) { if (!(beginning ? this.pointerAtBeginning() : this.pointerAtEnding())) continue; const index = beginning ? 0 : points.length - 2; const angle = this._getPointerAngle(beginning); const cos = Math.cos(angle), sin = Math.sin(angle); const x = points[index] - this.pointerLength() * cos; const y = points[index + 1] - this.pointerLength() * sin; const dx = Math.abs(this.pointerWidth() * sin / 2); const dy = Math.abs(this.pointerWidth() * cos / 2); minX = Math.min(minX, x - dx); minY = Math.min(minY, y - dy); maxX = Math.max(maxX, x + dx); maxY = Math.max(maxY, y + dy); } return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; } }; Arrow$1.prototype.className = "Arrow"; Arrow$1.prototype._attrsAffectingSize = [ ...Line$1.prototype._attrsAffectingSize, "pointerLength", "pointerWidth", "pointerAtBeginning", "pointerAtEnding" ]; _registerNode(Arrow$1, true); /** * get/set pointerLength * @name Konva.Arrow#pointerLength * @method * @param {Number} Length of pointer of arrow. The default is 10. * @returns {Number} * @example * // get length * var pointerLength = line.pointerLength(); * * // set length * line.pointerLength(15); */ Factory.addGetterSetter(Arrow$1, "pointerLength", 10, getNumberValidator()); /** * get/set pointerWidth * @name Konva.Arrow#pointerWidth * @method * @param {Number} Width of pointer of arrow. * The default is 10. * @returns {Number} * @example * // get width * var pointerWidth = line.pointerWidth(); * * // set width * line.pointerWidth(15); */ Factory.addGetterSetter(Arrow$1, "pointerWidth", 10, getNumberValidator()); /** * get/set pointerAtBeginning * @name Konva.Arrow#pointerAtBeginning * @method * @param {Boolean} pointerAtBeginning Whether to draw a pointer at the beginning of the arrow. The default is false. * @returns {Boolean} * @example * // get value * var pointerAtBeginning = line.pointerAtBeginning(); * * // set value * line.pointerAtBeginning(true); */ Factory.addGetterSetter(Arrow$1, "pointerAtBeginning", false); /** * get/set pointerAtEnding * @name Konva.Arrow#pointerAtEnding * @method * @param {Boolean} pointerAtEnding Whether to draw a pointer at the end of the arrow. The default is true. * @returns {Boolean} * @example * // get value * var pointerAtEnding = line.pointerAtEnding(); * * // set value * line.pointerAtEnding(false); */ Factory.addGetterSetter(Arrow$1, "pointerAtEnding", true); //#endregion //#region node_modules/konva/lib/shapes/Circle.js /** * Circle constructor * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {Number} config.radius * @@shapeParams * @@nodeParams * @example * // create circle * var circle = new Konva.Circle({ * radius: 40, * fill: 'red', * stroke: 'black', * strokeWidth: 5 * }); */ var Circle$1 = class extends Shape$1 { _getStrokePadding() { return super._getStrokePadding(1); } _sceneFunc(context) { context.beginPath(); context.arc(0, 0, Math.abs(this.attrs.radius || 0), 0, Math.PI * 2, false); context.closePath(); context.fillStrokeShape(this); } getWidth() { return Math.abs(this.radius()) * 2; } getHeight() { return Math.abs(this.radius()) * 2; } setWidth(width) { this.radius(width / 2); } setHeight(height) { this.radius(height / 2); } }; Circle$1.prototype._centroid = true; Circle$1.prototype.className = "Circle"; Circle$1.prototype._attrsAffectingSize = ["radius"]; _registerNode(Circle$1, true); /** * get/set radius * @name Konva.Circle#radius * @method * @param {Number} radius * @returns {Number} * @example * // get radius * var radius = circle.radius(); * * // set radius * circle.radius(10); */ Factory.addGetterSetter(Circle$1, "radius", 0, getNumberValidator()); //#endregion //#region node_modules/konva/lib/shapes/Ellipse.js /** * Ellipse constructor * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {Object} config.radius defines x and y radius * @@shapeParams * @@nodeParams * @example * var ellipse = new Konva.Ellipse({ * radius : { * x : 50, * y : 50 * }, * fill: 'red' * }); */ var Ellipse$1 = class extends Shape$1 { _getStrokePadding() { return super._getStrokePadding(1); } _sceneFunc(context) { const rx = Math.abs(this.radiusX()), ry = Math.abs(this.radiusY()); context.beginPath(); context.ellipse(0, 0, rx, ry, 0, 0, Math.PI * 2, false); context.closePath(); context.fillStrokeShape(this); } getWidth() { return Math.abs(this.radiusX()) * 2; } getHeight() { return Math.abs(this.radiusY()) * 2; } setWidth(width) { this.radiusX(width / 2); } setHeight(height) { this.radiusY(height / 2); } }; Ellipse$1.prototype.className = "Ellipse"; Ellipse$1.prototype._centroid = true; Ellipse$1.prototype._attrsAffectingSize = ["radiusX", "radiusY"]; _registerNode(Ellipse$1, true); Factory.addComponentsGetterSetter(Ellipse$1, "radius", ["x", "y"]); /** * get/set radius * @name Konva.Ellipse#radius * @method * @param {Object} radius * @param {Number} radius.x * @param {Number} radius.y * @returns {Object} * @example * // get radius * var radius = ellipse.radius(); * * // set radius * ellipse.radius({ * x: 200, * y: 100 * }); */ Factory.addGetterSetter(Ellipse$1, "radiusX", 0, getNumberValidator()); /** * get/set radius x * @name Konva.Ellipse#radiusX * @method * @param {Number} x * @returns {Number} * @example * // get radius x * var radiusX = ellipse.radiusX(); * * // set radius x * ellipse.radiusX(200); */ Factory.addGetterSetter(Ellipse$1, "radiusY", 0, getNumberValidator()); /** * get/set radius y * @name Konva.Ellipse#radiusY * @method * @param {Number} y * @returns {Number} * @example * // get radius y * var radiusY = ellipse.radiusY(); * * // set radius y * ellipse.radiusY(200); */ //#endregion //#region node_modules/konva/lib/shapes/Image.js /** * Image constructor * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {Image} config.image * @param {Object} [config.crop] * @@shapeParams * @@nodeParams * @example * var imageObj = new Image(); * imageObj.onload = function() { * var image = new Konva.Image({ * x: 200, * y: 50, * image: imageObj, * width: 100, * height: 100 * }); * }; * imageObj.src = '/path/to/image.jpg' */ var Image$1 = class Image$1 extends Shape$1 { constructor(attrs) { super(attrs); this._loadListener = () => { this._requestDraw(); }; this.on("imageChange.konva", (props) => { this._removeImageLoad(props.oldVal); this._setImageLoad(); }); this._setImageLoad(); } _setImageLoad() { var _a; const image = this.image(); if ((image === null || image === void 0 ? void 0 : image.complete) && image.src || (image === null || image === void 0 ? void 0 : image.readyState) >= 2) return; (_a = image === null || image === void 0 ? void 0 : image.addEventListener) === null || _a === void 0 || _a.call(image, "videoWidth" in image ? "loadeddata" : "load", this._loadListener); } _removeImageLoad(image) { var _a; (_a = image === null || image === void 0 ? void 0 : image.removeEventListener) === null || _a === void 0 || _a.call(image, "videoWidth" in image ? "loadeddata" : "load", this._loadListener); } destroy() { this._removeImageLoad(this.image()); super.destroy(); return this; } _useBufferCanvas(forceFill, opacity = this.getAbsoluteOpacity()) { if (this.attrs.perfectDrawEnabled === false) return false; const hasCornerRadius = !!this.cornerRadius(); const hasShadow = this.hasShadow(); if (hasCornerRadius && hasShadow) return true; return super._useBufferCanvas(true, opacity); } _getStrokePadding() { return super._getStrokePadding(this.strokeScaleEnabled() ? 1 : void 0); } _sceneFunc(context) { const width = this.getWidth(); const height = this.getHeight(); const cornerRadius = this.cornerRadius(); const image = this.attrs.image; if (this.hasFill() || this.hasStroke() || cornerRadius) { context.beginPath(); cornerRadius ? Util.drawRoundedRectPath(context, width, height, cornerRadius) : context.rect(0, 0, width, height); context.closePath(); context.fillStrokeShape(this); } if (image) { if (cornerRadius) context.clip(); const cropWidth = this.attrs.cropWidth; const cropHeight = this.attrs.cropHeight; if (cropWidth && cropHeight) context.drawImage(image, this.cropX(), this.cropY(), cropWidth, cropHeight, 0, 0, width, height); else context.drawImage(image, 0, 0, width, height); } } _hitFunc(context) { const width = this.width(), height = this.height(), cornerRadius = this.cornerRadius(); context.beginPath(); if (!cornerRadius) context.rect(0, 0, width, height); else Util.drawRoundedRectPath(context, width, height, cornerRadius); context.closePath(); context.fillStrokeShape(this); } getWidth() { var _a, _b, _c; const image = this.image(); return (_c = (_b = (_a = this.attrs.width) !== null && _a !== void 0 ? _a : image === null || image === void 0 ? void 0 : image.videoWidth) !== null && _b !== void 0 ? _b : image === null || image === void 0 ? void 0 : image.width) !== null && _c !== void 0 ? _c : 0; } getHeight() { var _a, _b, _c; const image = this.image(); return (_c = (_b = (_a = this.attrs.height) !== null && _a !== void 0 ? _a : image === null || image === void 0 ? void 0 : image.videoHeight) !== null && _b !== void 0 ? _b : image === null || image === void 0 ? void 0 : image.height) !== null && _c !== void 0 ? _c : 0; } /** * load image from given url and create `Konva.Image` instance * @method * @memberof Konva.Image * @param {String} url image source * @param {Function} callback with Konva.Image instance as first argument * @param {Function} onError optional error handler * @example * Konva.Image.fromURL(imageURL, function(image){ * // image is Konva.Image instance * layer.add(image); * }); */ static fromURL(url, callback, onError = null) { const img = Util.createImageElement(); img.onload = () => { img.onload = img.onerror = null; callback(new Image$1({ image: img })); }; img.onerror = onError; img.crossOrigin = "Anonymous"; img.src = url; } }; Image$1.prototype.className = "Image"; Image$1.prototype._attrsAffectingSize = ["image"]; _registerNode(Image$1, true); /** * get/set corner radius * @method * @name Konva.Image#cornerRadius * @param {Number} cornerRadius * @returns {Number} * @example * // get corner radius * var cornerRadius = image.cornerRadius(); * * // set corner radius * image.cornerRadius(10); * * // set different corner radius values * // top-left, top-right, bottom-right, bottom-left * image.cornerRadius([0, 10, 20, 30]); */ Factory.addGetterSetter(Image$1, "cornerRadius", 0, getNumberOrArrayOfNumbersValidator(4)); /** * get/set image source. It can be image, canvas or video element * @name Konva.Image#image * @method * @param {Object} image source * @returns {Object} * @example * // get value * var image = shape.image(); * * // set value * shape.image(img); */ Factory.addGetterSetter(Image$1, "image"); Factory.addComponentsGetterSetter(Image$1, "crop", [ "x", "y", "width", "height" ]); /** * get/set crop * @method * @name Konva.Image#crop * @param {Object} crop * @param {Number} crop.x * @param {Number} crop.y * @param {Number} crop.width * @param {Number} crop.height * @returns {Object} * @example * // get crop * var crop = image.crop(); * * // set crop * image.crop({ * x: 20, * y: 20, * width: 20, * height: 20 * }); */ Factory.addGetterSetter(Image$1, "cropX", 0, getNumberValidator()); /** * get/set crop x * @method * @name Konva.Image#cropX * @param {Number} x * @returns {Number} * @example * // get crop x * var cropX = image.cropX(); * * // set crop x * image.cropX(20); */ Factory.addGetterSetter(Image$1, "cropY", 0, getNumberValidator()); /** * get/set crop y * @name Konva.Image#cropY * @method * @param {Number} y * @returns {Number} * @example * // get crop y * var cropY = image.cropY(); * * // set crop y * image.cropY(20); */ Factory.addGetterSetter(Image$1, "cropWidth", 0, getNumberValidator()); /** * get/set crop width * @name Konva.Image#cropWidth * @method * @param {Number} width * @returns {Number} * @example * // get crop width * var cropWidth = image.cropWidth(); * * // set crop width * image.cropWidth(20); */ Factory.addGetterSetter(Image$1, "cropHeight", 0, getNumberValidator()); /** * get/set crop height * @name Konva.Image#cropHeight * @method * @param {Number} height * @returns {Number} * @example * // get crop height * var cropHeight = image.cropHeight(); * * // set crop height * image.cropHeight(20); */ //#endregion //#region node_modules/konva/lib/shapes/Text.js var segmenter = typeof Intl !== "undefined" && Intl.Segmenter ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null; function getDecorationLineWidth(fontSize) { return fontSize / 15; } function stringToArray(string) { if (!segmenter) return string.match(/\p{RI}\p{RI}|\P{M}(?:\p{M}|\p{Emoji_Modifier}|\uFE0F|\u200D\P{M})*|\p{M}+/gu) || []; return Array.from(segmenter.segment(string), (s) => s.segment); } var AUTO = "auto"; var CENTER = "center"; var INHERIT = "inherit"; var JUSTIFY = "justify"; var CHANGE_KONVA = "Change.konva"; var CONTEXT_2D = "2d"; var DASH = "-"; var LEFT$1 = "left"; var TEXT = "text"; var TEXT_UPPER = "Text"; var TOP = "top"; var BOTTOM = "bottom"; var MIDDLE = "middle"; var NORMAL$1 = "normal"; var PX_SPACE = "px "; var SPACE = " "; var RIGHT$1 = "right"; var RTL = "rtl"; var WORD = "word"; var CHAR = "char"; var NONE$1 = "none"; var ELLIPSIS = "…"; var ATTR_CHANGE_LIST$1 = [ "direction", "fontFamily", "fontSize", "fontStyle", "fontVariant", "padding", "align", "verticalAlign", "lineHeight", "text", "width", "height", "wrap", "ellipsis", "letterSpacing" ]; var _shadowOpacityBuggy = null; function hasShadowOpacityBug() { if (_shadowOpacityBuggy !== null) return _shadowOpacityBuggy; _shadowOpacityBuggy = false; let c; try { c = Util.createCanvasElement(); c.width = 10; c.height = 10; const ctx = c.getContext(CONTEXT_2D); if (ctx) { ctx.globalAlpha = 0; ctx.shadowColor = "black"; ctx.shadowBlur = 5; ctx.shadowOffsetX = 5; ctx.shadowOffsetY = 5; ctx.fillStyle = "black"; ctx.font = "10px Arial"; ctx.fillText("X", 0, 10); const data = ctx.getImageData(0, 0, 10, 10).data; for (let i = 3; i < data.length; i += 4) if (data[i] > 0) { _shadowOpacityBuggy = true; break; } } } catch (e) {} finally { if (c) Util.releaseCanvas(c); } return _shadowOpacityBuggy; } function normalizeFontFamily(fontFamily) { return fontFamily.split(",").map((family) => { family = family.trim(); const hasSpace = family.indexOf(" ") >= 0; const hasQuotes = family.indexOf("\"") >= 0 || family.indexOf("'") >= 0; if (hasSpace && !hasQuotes) family = `"${family}"`; return family; }).join(", "); } var dummyContext; function getDummyContext() { if (dummyContext) return dummyContext; dummyContext = Util.createCanvasElement().getContext(CONTEXT_2D); return dummyContext; } function _fillFunc$1(context) { if (this._partialFillStyle) context.setAttr("fillStyle", this._partialFillStyle); context.fillText(this._partialText, this._partialTextX, this._partialTextY); } function _strokeFunc$1(context) { context.setAttr("miterLimit", 2); if (this._partialStrokeStyle) context.setAttr("strokeStyle", this._partialStrokeStyle); context.strokeText(this._partialText, this._partialTextX, this._partialTextY); } function checkDefaultFill(config) { config = config || {}; return config.fill || config.fillLinearGradientColorStops || config.fillRadialGradientColorStops || config.fillPatternImage ? config : { ...config, fill: "black" }; } /** * Text constructor * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {String} [config.direction] default is inherit * @param {String} [config.fontFamily] default is Arial * @param {Number} [config.fontSize] in pixels. Default is 12 * @param {String} [config.fontStyle] can be 'normal', 'italic', or 'bold', '500' or even 'italic bold'. 'normal' is the default. * @param {String} [config.fontVariant] can be normal or small-caps. Default is normal * @param {String} [config.textDecoration] can be line-through, underline or empty string. Default is empty string. * @param {Number} [config.underlineOffset] offset for underline line. Default is calculated based on font size. * @param {String} config.text * @param {String} [config.align] can be left, center, right or justify * @param {String} [config.verticalAlign] can be top, middle or bottom * @param {Number} [config.padding] * @param {Number} [config.lineHeight] default is 1 * @param {String} [config.wrap] can be "word", "char", or "none". Default is word * @param {Boolean} [config.ellipsis] can be true or false. Default is false. If true, text that does not fit is cut and ends with "…". That needs a fixed height or wrap="none" * @@shapeParams * @@nodeParams * @example * var text = new Konva.Text({ * x: 10, * y: 15, * text: 'Simple Text', * fontSize: 30, * fontFamily: 'Calibri', * fill: 'green' * }); */ var Text$1 = class extends Shape$1 { constructor(config) { super(checkDefaultFill(config)); this._partialTextX = 0; this._partialTextY = 0; this._baselineShift = 0; this._setTextData(); } _sceneFunc(context) { var _a, _b; const textArr = this.textArr, textArrLen = textArr.length; if (!this.text()) return; let padding = this.padding(), fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, direction = this.direction(), align = this.align(), totalWidth = this.getWidth(), letterSpacing = this.letterSpacing(), charRenderFunc = this.charRenderFunc(), textDecoration = this.textDecoration(), shouldUnderline = textDecoration.indexOf("underline") !== -1, shouldLineThrough = textDecoration.indexOf("line-through") !== -1, n; let translateY = lineHeightPx / 2; let baseline = MIDDLE; if (!Konva$2.legacyTextRendering) { const metrics = this.measureSize("M"); baseline = "alphabetic"; translateY = (((_a = metrics.fontBoundingBoxAscent) !== null && _a !== void 0 ? _a : metrics.actualBoundingBoxAscent) - ((_b = metrics.fontBoundingBoxDescent) !== null && _b !== void 0 ? _b : metrics.actualBoundingBoxDescent)) / 2 + lineHeightPx / 2; } if (direction !== INHERIT) context.setAttr("direction", direction); else direction = context.direction; context.setAttr("font", this._getContextFont()); context.setAttr("textBaseline", baseline); context.setAttr("textAlign", LEFT$1); context.translate(padding, this._getTextTop()); if (charRenderFunc) { const style = context._getFillStyle(this); if (style !== void 0) context.fillStyle = style; if (this.hasStroke()) context._applyStrokeStyle(this); } const fillStyleBefore = charRenderFunc ? context.fillStyle : void 0; const strokeStyleBefore = charRenderFunc ? context.strokeStyle : void 0; let charIndex = 0; for (n = 0; n < textArrLen; n++) { let lineTranslateX = 0; let lineTranslateY = 0; const obj = textArr[n], text = obj.text, width = obj.width, lastLine = obj.lastInParagraph; context.save(); if (align === RIGHT$1) lineTranslateX += totalWidth - width - padding * 2; else if (align === CENTER) lineTranslateX += (totalWidth - width - padding * 2) / 2; if (shouldUnderline) { context.save(); context.beginPath(); const yOffset = this._getUnderlineOffset(); const x = lineTranslateX; const y = translateY + lineTranslateY + yOffset; context.moveTo(x, y); const lineWidth = align === JUSTIFY && !lastLine ? totalWidth - padding * 2 : width; context.lineTo(x + Math.round(lineWidth), y); context.lineWidth = getDecorationLineWidth(fontSize); context.strokeStyle = context._getFillStyle(this); context.stroke(); context.restore(); } const lineThroughStartX = lineTranslateX; if (direction !== RTL && (letterSpacing !== 0 || align === JUSTIFY || charRenderFunc)) { const spacesNumber = text.split(" ").length - 1; const array = stringToArray(text); for (let li = 0; li < array.length; li++) { const letter = array[li]; if (letter === " " && !lastLine && align === JUSTIFY) lineTranslateX += (totalWidth - padding * 2 - width) / spacesNumber; this._partialTextX = lineTranslateX; this._partialTextY = translateY + lineTranslateY; this._partialText = letter; const letterWidth = context.measureText(letter).width; if (charRenderFunc) { context.save(); charRenderFunc({ char: letter, index: charIndex, x: lineTranslateX, y: translateY + lineTranslateY, lineIndex: n, column: li, isLastInLine: li === array.length - 1, width: letterWidth, context }); const fillStyleAfter = context.fillStyle; if (fillStyleAfter !== fillStyleBefore) this._partialFillStyle = fillStyleAfter; const strokeStyleAfter = context.strokeStyle; if (strokeStyleAfter !== strokeStyleBefore) this._partialStrokeStyle = strokeStyleAfter; } context.fillStrokeShape(this); if (charRenderFunc) { this._partialFillStyle = void 0; this._partialStrokeStyle = void 0; context.restore(); } lineTranslateX += letterWidth + letterSpacing; charIndex++; } } else { if (letterSpacing !== 0) context.setAttr("letterSpacing", `${letterSpacing}px`); this._partialTextX = lineTranslateX; this._partialTextY = translateY + lineTranslateY; this._partialText = text; context.fillStrokeShape(this); } if (shouldLineThrough) { context.save(); context.beginPath(); const yOffset = !Konva$2.legacyTextRendering ? -Math.round(fontSize / 4) : 0; const x = lineThroughStartX; context.moveTo(x, translateY + lineTranslateY + yOffset); const lineWidth = align === JUSTIFY && !lastLine ? totalWidth - padding * 2 : width; context.lineTo(x + Math.round(lineWidth), translateY + lineTranslateY + yOffset); context.lineWidth = getDecorationLineWidth(fontSize); context.strokeStyle = context._getFillStyle(this); context.stroke(); context.restore(); } context.restore(); if (textArrLen > 1) translateY += lineHeightPx; } } _getTextTop() { const padding = this.padding(), free = this.getHeight() - this.textArr.length * this.lineHeight() * this.fontSize() - padding * 2, verticalAlign = this.verticalAlign(); if (verticalAlign === MIDDLE) return padding + free / 2; if (verticalAlign === BOTTOM) return padding + free; return padding; } _getUnderlineOffset() { var _a; return (_a = this.underlineOffset()) !== null && _a !== void 0 ? _a : Math.round(this.fontSize() / (!Konva$2.legacyTextRendering ? 4 : 2)); } getSelfRect() { const rect = super.getSelfRect(); const lines = this.textArr.length; if (!lines || this.textDecoration().indexOf("underline") === -1) return rect; const fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize; let bottom = this._getTextTop() + lines * lineHeightPx - lineHeightPx / 2; if (!Konva$2.legacyTextRendering) bottom += this._baselineShift; bottom += this._getUnderlineOffset() + getDecorationLineWidth(fontSize) / 2; rect.height = Math.max(rect.y + rect.height, bottom) - rect.y; return rect; } _getSelfRectForDrawing() { const rect = this.getSelfRect(), fontSize = this.fontSize(), padding = this.padding(), lineHeightPx = this.lineHeight() * fontSize, available = this.getWidth() - padding * 2, align = this.align(), blockHeight = this.textArr.length * lineHeightPx, top = this._getTextTop(); let left = rect.x, right = rect.x + rect.width; for (const { text, width } of this.textArr) { const x = padding + (align === RIGHT$1 ? available - width : align === CENTER ? (available - width) / 2 : 0); const back = Math.min(0, this.letterSpacing()) * text.length; left = Math.min(left, x + back); right = Math.max(right, x + width - back); } const underline = this.textDecoration().includes("underline"); const y = Math.min(rect.y, top + (underline ? Math.min(0, this._getUnderlineOffset()) : 0)); return { x: left - fontSize, y: y - fontSize, width: right - left + fontSize * 2, height: Math.max(rect.y + rect.height, top + blockHeight) - y + fontSize * 2 }; } _hitFunc(context) { const width = this.getWidth(), height = this.getHeight(); context.beginPath(); context.rect(0, 0, width, height); context.closePath(); context.fillStrokeShape(this); } setText(text) { const str = Util._isString(text) ? text : text === null || text === void 0 ? "" : text + ""; this._setAttr(TEXT, str); return this; } getWidth() { return this.attrs.width === AUTO || this.attrs.width === void 0 ? this.getTextWidth() + this.padding() * 2 : this.attrs.width; } getHeight() { return this.attrs.height === AUTO || this.attrs.height === void 0 ? this.fontSize() * this.textArr.length * this.lineHeight() + this.padding() * 2 : this.attrs.height; } /** * get pure text width without padding * @method * @name Konva.Text#getTextWidth * @returns {Number} */ getTextWidth() { return this.textWidth; } getTextHeight() { Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."); return this.textHeight; } /** * measure string with the font of current text shape. * That method can't handle multiline text. * @method * @name Konva.Text#measureSize * @param {String} text text to measure * @returns {Object} { width , height } of measured text */ measureSize(text) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; let _context = getDummyContext(), fontSize = this.fontSize(), metrics; _context.save(); _context.font = this._getContextFont(); metrics = _context.measureText(text); _context.restore(); const scaleFactor = fontSize / 100; return { actualBoundingBoxAscent: (_a = metrics.actualBoundingBoxAscent) !== null && _a !== void 0 ? _a : 71.58203125 * scaleFactor, actualBoundingBoxDescent: (_b = metrics.actualBoundingBoxDescent) !== null && _b !== void 0 ? _b : 0, actualBoundingBoxLeft: (_c = metrics.actualBoundingBoxLeft) !== null && _c !== void 0 ? _c : -7.421875 * scaleFactor, actualBoundingBoxRight: (_d = metrics.actualBoundingBoxRight) !== null && _d !== void 0 ? _d : 75.732421875 * scaleFactor, alphabeticBaseline: (_e = metrics.alphabeticBaseline) !== null && _e !== void 0 ? _e : 0, emHeightAscent: (_f = metrics.emHeightAscent) !== null && _f !== void 0 ? _f : 100 * scaleFactor, emHeightDescent: (_g = metrics.emHeightDescent) !== null && _g !== void 0 ? _g : -20 * scaleFactor, fontBoundingBoxAscent: (_h = metrics.fontBoundingBoxAscent) !== null && _h !== void 0 ? _h : 91 * scaleFactor, fontBoundingBoxDescent: (_j = metrics.fontBoundingBoxDescent) !== null && _j !== void 0 ? _j : 21 * scaleFactor, hangingBaseline: (_k = metrics.hangingBaseline) !== null && _k !== void 0 ? _k : 72.80000305175781 * scaleFactor, ideographicBaseline: (_l = metrics.ideographicBaseline) !== null && _l !== void 0 ? _l : -21 * scaleFactor, width: metrics.width, height: fontSize }; } _getContextFont() { return this.fontStyle() + SPACE + this.fontVariant() + SPACE + (this.fontSize() + PX_SPACE) + normalizeFontFamily(this.fontFamily()); } _addTextLine(line) { if (this.align() === JUSTIFY) line = line.trim(); const width = this._getTextWidth(line); return this.textArr.push({ text: line, width, lastInParagraph: false }); } _getTextWidth(text, graphemes) { const letterSpacing = this.letterSpacing(); const spacing = letterSpacing ? letterSpacing * (graphemes !== null && graphemes !== void 0 ? graphemes : stringToArray(text).length) : 0; return getDummyContext().measureText(text).width + spacing; } _setTextData() { let lines = this.text().split("\n"), fontSize = +this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, width = this.attrs.width, height = this.attrs.height, fixedWidth = width !== AUTO && width !== void 0, fixedHeight = height !== AUTO && height !== void 0, padding = this.padding(), maxWidth = width - padding * 2, maxHeightPx = height - padding * 2, currentHeightPx = 0, wrap = this.wrap(), wrapAtWord = wrap !== CHAR && wrap !== NONE$1, shouldAddEllipsis = this.ellipsis(); const sample = this.measureSize("M"); this._baselineShift = (sample.fontBoundingBoxAscent - sample.fontBoundingBoxDescent) / 2; this.textArr = []; const dummyContext = getDummyContext(); dummyContext.font = this._getContextFont(); dummyContext.fontKerning = this.direction() !== RTL && (this.letterSpacing() !== 0 || this.align() === JUSTIFY || !!this.charRenderFunc()) ? "none" : "auto"; const additionalWidth = shouldAddEllipsis ? this._getTextWidth(ELLIPSIS) : 0; for (let i = 0, max = lines.length; i < max; ++i) { let line = lines[i]; let lineWidth = this._getTextWidth(line); if (fixedWidth && lineWidth > maxWidth) { const graphemes = stringToArray(line); const length = graphemes.length; let start = 0; const text = (end) => graphemes.slice(start, end).join(""); const isBreak = (char) => char === SPACE || char === DASH; const perLine = Math.max(1, Math.ceil(length * maxWidth / lineWidth)); while (start < length) { const extraWidth = shouldAddEllipsis && fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx ? additionalWidth : 0; const fits = (end) => { if (this._getTextWidth(text(end), end - start) + extraWidth > maxWidth) return false; return true; }; let low = start, high = Math.min(length, start + perLine); while (fits(high)) { low = high; if (high === length) break; high = Math.min(length, high + (high - start)); } while (high - low > 1) { const mid = low + high >>> 1; if (fits(mid)) low = mid; else high = mid; } if (low === start) break; if (low === length) { this._addTextLine(text(length)); currentHeightPx += lineHeightPx; if (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx && i < max - 1) this._tryToAddEllipsisToLastLine(); break; } if (wrapAtWord && !isBreak(graphemes[low])) { let wrapIndex = low - 1; while (wrapIndex >= start && !isBreak(graphemes[wrapIndex])) wrapIndex--; if (wrapIndex >= start) low = wrapIndex + 1; } this._addTextLine(text(low).trimRight()); currentHeightPx += lineHeightPx; if (this._shouldHandleEllipsis(currentHeightPx)) { this._tryToAddEllipsisToLastLine(); break; } start = low; while (start < length && !graphemes[start].trim()) start++; } } else { this._addTextLine(line); currentHeightPx += lineHeightPx; if (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx && i < max - 1) this._tryToAddEllipsisToLastLine(); } if (this.textArr[this.textArr.length - 1]) this.textArr[this.textArr.length - 1].lastInParagraph = true; if (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx) break; } this.textHeight = fontSize; this.textWidth = this.textArr.reduce((width, line) => Math.max(width, line.width), 0); } /** * whether to handle ellipsis, there are two cases: * 1. the current line is the last line * 2. wrap is NONE * @param {Number} currentHeightPx * @returns {Boolean} */ _shouldHandleEllipsis(currentHeightPx) { const fontSize = +this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, height = this.attrs.height, fixedHeight = height !== AUTO && height !== void 0, maxHeightPx = height - this.padding() * 2; return !(this.wrap() !== NONE$1) || fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx; } _tryToAddEllipsisToLastLine() { const width = this.attrs.width, fixedWidth = width !== AUTO && width !== void 0, maxWidth = width - this.padding() * 2, shouldAddEllipsis = this.ellipsis(); const lastLine = this.textArr[this.textArr.length - 1]; if (!lastLine || !shouldAddEllipsis) return; let text = lastLine.text + ELLIPSIS; if (fixedWidth) { const graphemes = stringToArray(lastLine.text); while (graphemes.length && this._getTextWidth(text) > maxWidth) { graphemes.pop(); text = graphemes.join("") + ELLIPSIS; } if (this._getTextWidth(text) > maxWidth) text = ""; } lastLine.text = text; lastLine.width = this._getTextWidth(text); } getStrokeScaleEnabled() { return true; } _getStrokePadding() { return super._getStrokePadding(2); } _useBufferCanvas(forceFill, opacity = this.getAbsoluteOpacity()) { if (this.attrs.perfectDrawEnabled === false) return false; const hasLine = this.textDecoration().indexOf("underline") !== -1 || this.textDecoration().indexOf("line-through") !== -1; const hasShadow = this.hasShadow(); if (hasLine && hasShadow) return true; if (hasShadow && opacity !== 1 && hasShadowOpacityBug()) return true; return super._useBufferCanvas(forceFill, opacity); } }; Text$1.prototype._fillFunc = _fillFunc$1; Text$1.prototype._strokeFunc = _strokeFunc$1; Text$1.prototype.className = TEXT_UPPER; Text$1.prototype._attrsAffectingSize = ATTR_CHANGE_LIST$1.filter((attr) => attr !== "width" && attr !== "height").concat(["textDecoration", "underlineOffset"]); _registerNode(Text$1, true); Text$1.prototype.on(ATTR_CHANGE_LIST$1.map((attr) => attr + CHANGE_KONVA).join(" "), function() { this._setTextData(); }); /** * get/set width of text area, which includes padding. * @name Konva.Text#width * @method * @param {Number} width * @returns {Number} * @example * // get width * var width = text.width(); * * // set width * text.width(20); * * // set to auto * text.width('auto'); * text.width() // will return calculated width, and not "auto" */ Factory.overWriteSetter(Text$1, "width", getNumberOrAutoValidator()); /** * get/set the height of the text area, which takes into account multi-line text, line heights, and padding. * @name Konva.Text#height * @method * @param {Number} height * @returns {Number} * @example * // get height * var height = text.height(); * * // set height * text.height(20); * * // set to auto * text.height('auto'); * text.height() // will return calculated height, and not "auto" */ Factory.overWriteSetter(Text$1, "height", getNumberOrAutoValidator()); /** * get/set direction * @name Konva.Text#direction * @method * @param {String} direction * @returns {String} * @example * // get direction * var direction = text.direction(); * * // set direction * text.direction('rtl'); */ Factory.addGetterSetter(Text$1, "direction", INHERIT); /** * get/set font family * @name Konva.Text#fontFamily * @method * @param {String} fontFamily * @returns {String} * @example * // get font family * var fontFamily = text.fontFamily(); * * // set font family * text.fontFamily('Arial'); */ Factory.addGetterSetter(Text$1, "fontFamily", "Arial"); /** * get/set font size in pixels * @name Konva.Text#fontSize * @method * @param {Number} fontSize * @returns {Number} * @example * // get font size * var fontSize = text.fontSize(); * * // set font size to 22px * text.fontSize(22); */ Factory.addGetterSetter(Text$1, "fontSize", 12, getNumberValidator()); /** * get/set font style. Can be 'normal', 'italic', or 'bold', '500' or even 'italic bold'. 'normal' is the default. * @name Konva.Text#fontStyle * @method * @param {String} fontStyle * @returns {String} * @example * // get font style * var fontStyle = text.fontStyle(); * * // set font style * text.fontStyle('bold'); */ Factory.addGetterSetter(Text$1, "fontStyle", NORMAL$1); /** * get/set font variant. Can be 'normal' or 'small-caps'. 'normal' is the default. * @name Konva.Text#fontVariant * @method * @param {String} fontVariant * @returns {String} * @example * // get font variant * var fontVariant = text.fontVariant(); * * // set font variant * text.fontVariant('small-caps'); */ Factory.addGetterSetter(Text$1, "fontVariant", NORMAL$1); /** * get/set padding * @name Konva.Text#padding * @method * @param {Number} padding * @returns {Number} * @example * // get padding * var padding = text.padding(); * * // set padding to 10 pixels * text.padding(10); */ Factory.addGetterSetter(Text$1, "padding", 0, getNumberValidator()); /** * get/set horizontal align of text. Can be 'left', 'center', 'right' or 'justify' * @name Konva.Text#align * @method * @param {String} align * @returns {String} * @example * // get text align * var align = text.align(); * * // center text * text.align('center'); * * // align text to right * text.align('right'); * * // justify text */ Factory.addGetterSetter(Text$1, "align", LEFT$1); /** * get/set vertical align of text. Can be 'top', 'middle', 'bottom'. * @name Konva.Text#verticalAlign * @method * @param {String} verticalAlign * @returns {String} * @example * // get text vertical align * var verticalAlign = text.verticalAlign(); * * // center text * text.verticalAlign('middle'); */ Factory.addGetterSetter(Text$1, "verticalAlign", TOP); /** * get/set line height. The default is 1. * @name Konva.Text#lineHeight * @method * @param {Number} lineHeight * @returns {Number} * @example * // get line height * var lineHeight = text.lineHeight(); * * // set the line height * text.lineHeight(2); */ Factory.addGetterSetter(Text$1, "lineHeight", 1, getNumberValidator()); /** * get/set wrap. Can be "word", "char", or "none". Default is "word". * In "word" wrapping any word still can be wrapped if it can't be placed in the required width * without breaks. * @name Konva.Text#wrap * @method * @param {String} wrap * @returns {String} * @example * // get wrap * var wrap = text.wrap(); * * // set wrap * text.wrap('word'); */ Factory.addGetterSetter(Text$1, "wrap", WORD); /** * get/set ellipsis. Can be true or false. Default is false. If ellipsis is true, * Konva cuts the text that does not fit and ends it with "…" (one character). * That needs a fixed height or wrap set to "none" * @name Konva.Text#ellipsis * @method * @param {Boolean} ellipsis * @returns {Boolean} * @example * // get ellipsis param, returns true or false * var ellipsis = text.ellipsis(); * * // set ellipsis * text.ellipsis(true); */ Factory.addGetterSetter(Text$1, "ellipsis", false, getBooleanValidator()); /** * set letter spacing property. Default value is 0. * @name Konva.Text#letterSpacing * @method * @param {Number} letterSpacing */ Factory.addGetterSetter(Text$1, "letterSpacing", 0, getNumberValidator()); /** * get/set text * @name Konva.Text#text * @method * @param {String} text * @returns {String} * @example * // get text * var text = text.text(); * * // set text * text.text('Hello world!'); */ Factory.addGetterSetter(Text$1, "text", "", getStringValidator()); /** * get/set text decoration of a text. Possible values are 'underline', 'line-through' or combination of these values separated by space * @name Konva.Text#textDecoration * @method * @param {String} textDecoration * @returns {String} * @example * // get text decoration * var textDecoration = text.textDecoration(); * * // underline text * text.textDecoration('underline'); * * // strike text * text.textDecoration('line-through'); * * // underline and strike text * text.textDecoration('underline line-through'); */ Factory.addGetterSetter(Text$1, "textDecoration", ""); /** * get/set text underline decoration offset. Offset for underline line. Default is calculated based on font size. * @name Konva.Text#underlineOffset * @method * @param {Number} underlineOffset * @returns {Number} * @example * // get underline offset * var underlineOffset = text.underlineOffset(); * * // set underline offset * text.underlineOffset(5); */ Factory.addGetterSetter(Text$1, "underlineOffset", void 0, getNumberValidator()); /** * get/set per-character render hook. The callback is invoked for each grapheme before drawing, except for RTL text. * It can mutate the provided context (e.g. translate, rotate, change styles) and should return void. * Note: per-character rendering may disable native kerning/ligatures. * @name Konva.Text#charRenderFunc * @method * @param {Function} charRenderFunc * @returns {Function} * @example * // apply small x-translation and a custom color to every second character * text.charRenderFunc(function(props) { * if (props.index % 2 === 1) { * props.context.translate(2, 0); * props.context.fillStyle = 'red'; * } * }); */ Factory.addGetterSetter(Text$1, "charRenderFunc", void 0); //#endregion //#region node_modules/konva/lib/shapes/Label.js var CHANGE_EVENTS = [ ...Text$1.prototype._attrsAffectingSize, "width", "height", "pointerDirection", "pointerWidth", "pointerHeight" ].map((attr) => attr + "Change.konva").join(" "); var NONE = "none"; var UP = "up"; var RIGHT = "right"; var DOWN = "down"; var LEFT = "left"; /** * Label constructor.  Labels are groups that contain a Text and Tag shape * @constructor * @memberof Konva * @param {Object} config * @@nodeParams * @example * // create label * var label = new Konva.Label({ * x: 100, * y: 100, * draggable: true * }); * * // add a tag to the label * label.add(new Konva.Tag({ * fill: '#bbb', * stroke: '#333', * shadowColor: 'black', * shadowBlur: 10, * shadowOffset: { x: 10, y: 10 }, * shadowOpacity: 0.2, * lineJoin: 'round', * pointerDirection: 'up', * pointerWidth: 20, * pointerHeight: 20, * cornerRadius: 5 * })); * * // add text to the label * label.add(new Konva.Text({ * text: 'Hello World!', * fontSize: 50, * lineHeight: 1.2, * padding: 10, * fill: 'green' * })); */ var Label$1 = class extends Group$1 { constructor(config) { super(config); this._sync = this._sync.bind(this); this.on("add.konva", function(evt) { evt.child.off(CHANGE_EVENTS, this._sync).on(CHANGE_EVENTS, this._sync); this._sync(); }); } /** * get Text shape for the label. You need to access the Text shape in order to update * the text properties * @name Konva.Label#getText * @method * @example * label.getText().fill('red') */ getText() { return this.find("Text")[0]; } /** * get Tag shape for the label. You need to access the Tag shape in order to update * the pointer properties and the corner radius * @name Konva.Label#getTag * @method */ getTag() { return this.find("Tag")[0]; } getWidth() { return this.getText().width(); } getHeight() { return this.getText().height(); } _sync() { let text = this.getText(), tag = this.getTag(), width, height, pointerDirection, pointerWidth, x, y, pointerHeight; if (text && tag) { width = text.width(); height = text.height(); pointerDirection = tag.pointerDirection(); pointerWidth = tag.pointerWidth(); pointerHeight = tag.pointerHeight(); x = 0; y = 0; switch (pointerDirection) { case UP: x = width / 2; y = -1 * pointerHeight; break; case RIGHT: x = width + pointerWidth; y = height / 2; break; case DOWN: x = width / 2; y = height + pointerHeight; break; case LEFT: x = -1 * pointerWidth; y = height / 2; } tag.setAttrs({ x: -1 * x, y: -1 * y, width, height }); text.setAttrs({ x: -1 * x, y: -1 * y }); } } }; Label$1.prototype.className = "Label"; _registerNode(Label$1); /** * Tag constructor.  A Tag can be configured * to have a pointer element that points up, right, down, or left * @constructor * @memberof Konva * @param {Object} config * @param {String} [config.pointerDirection] can be up, right, down, left, or none; the default * is none. When a pointer is present, the positioning of the label is relative to the tip of the pointer. * @param {Number} [config.pointerWidth] * @param {Number} [config.pointerHeight] * @param {Number} [config.cornerRadius] */ var Tag$1 = class extends Shape$1 { _sceneFunc(context) { const width = this.width(), height = this.height(), pointerDirection = this.pointerDirection(), pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), cornerRadius = this.cornerRadius(); const [topLeft, topRight, bottomRight, bottomLeft] = Util._cornerRadii(cornerRadius, width, height); context.beginPath(); context.moveTo(topLeft, 0); if (pointerDirection === UP) { context.lineTo((width - pointerWidth) / 2, 0); context.lineTo(width / 2, -1 * pointerHeight); context.lineTo((width + pointerWidth) / 2, 0); } context.lineTo(width - topRight, 0); context.arc(width - topRight, topRight, topRight, Math.PI * 3 / 2, 0, false); if (pointerDirection === RIGHT) { context.lineTo(width, (height - pointerHeight) / 2); context.lineTo(width + pointerWidth, height / 2); context.lineTo(width, (height + pointerHeight) / 2); } context.lineTo(width, height - bottomRight); context.arc(width - bottomRight, height - bottomRight, bottomRight, 0, Math.PI / 2, false); if (pointerDirection === DOWN) { context.lineTo((width + pointerWidth) / 2, height); context.lineTo(width / 2, height + pointerHeight); context.lineTo((width - pointerWidth) / 2, height); } context.lineTo(bottomLeft, height); context.arc(bottomLeft, height - bottomLeft, bottomLeft, Math.PI / 2, Math.PI, false); if (pointerDirection === LEFT) { context.lineTo(0, (height + pointerHeight) / 2); context.lineTo(-1 * pointerWidth, height / 2); context.lineTo(0, (height - pointerHeight) / 2); } context.lineTo(0, topLeft); context.arc(topLeft, topLeft, topLeft, Math.PI, Math.PI * 3 / 2, false); context.closePath(); context.fillStrokeShape(this); } getSelfRect() { const pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), direction = this.pointerDirection(), width = this.width(), height = this.height(); if (direction === UP || direction === DOWN) return { x: Math.min(0, (width - pointerWidth) / 2), y: direction === UP ? -pointerHeight : 0, width: Math.max(width, pointerWidth), height: height + pointerHeight }; if (direction === LEFT || direction === RIGHT) return { x: direction === LEFT ? -pointerWidth : 0, y: Math.min(0, (height - pointerHeight) / 2), width: width + pointerWidth, height: Math.max(height, pointerHeight) }; return { x: 0, y: 0, width, height }; } }; Tag$1.prototype.className = "Tag"; _registerNode(Tag$1, true); /** * get/set pointer direction * @name Konva.Tag#pointerDirection * @method * @param {String} pointerDirection can be up, right, down, left, or none. The default is none. * @returns {String} * @example * tag.pointerDirection('right'); */ Factory.addGetterSetter(Tag$1, "pointerDirection", NONE); /** * get/set pointer width * @name Konva.Tag#pointerWidth * @method * @param {Number} pointerWidth * @returns {Number} * @example * tag.pointerWidth(20); */ Factory.addGetterSetter(Tag$1, "pointerWidth", 0, getNumberValidator()); /** * get/set pointer height * @method * @name Konva.Tag#pointerHeight * @param {Number} pointerHeight * @returns {Number} * @example * tag.pointerHeight(20); */ Factory.addGetterSetter(Tag$1, "pointerHeight", 0, getNumberValidator()); /** * get/set cornerRadius * @name Konva.Tag#cornerRadius * @method * @param {Number} cornerRadius * @returns {Number} * @example * tag.cornerRadius(20); * * // set different corner radius values * // top-left, top-right, bottom-right, bottom-left * tag.cornerRadius([0, 10, 20, 30]); */ Factory.addGetterSetter(Tag$1, "cornerRadius", 0, getNumberOrArrayOfNumbersValidator(4)); //#endregion //#region node_modules/konva/lib/shapes/Rect.js /** * Rect constructor * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {Number} [config.cornerRadius] * @@shapeParams * @@nodeParams * @example * var rect = new Konva.Rect({ * width: 100, * height: 50, * fill: 'red', * stroke: 'black', * strokeWidth: 5 * }); */ var Rect$1 = class extends Shape$1 { _getStrokePadding() { return super._getStrokePadding(this.strokeScaleEnabled() ? 1 : void 0); } _sceneFunc(context) { const cornerRadius = this.cornerRadius(), width = this.width(), height = this.height(); context.beginPath(); if (!cornerRadius) context.rect(0, 0, width, height); else Util.drawRoundedRectPath(context, width, height, cornerRadius); context.closePath(); context.fillStrokeShape(this); } }; Rect$1.prototype.className = "Rect"; _registerNode(Rect$1, true); /** * get/set corner radius * @method * @name Konva.Rect#cornerRadius * @param {Number} cornerRadius * @returns {Number} * @example * // get corner radius * var cornerRadius = rect.cornerRadius(); * * // set corner radius * rect.cornerRadius(10); * * // set different corner radius values * // top-left, top-right, bottom-right, bottom-left * rect.cornerRadius([0, 10, 20, 30]); */ Factory.addGetterSetter(Rect$1, "cornerRadius", 0, getNumberOrArrayOfNumbersValidator(4)); //#endregion //#region node_modules/konva/lib/shapes/RegularPolygon.js /** * RegularPolygon constructor. Examples include triangles, squares, pentagons, hexagons, etc. * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {Number} [config.cornerRadius] * @param {Number} config.sides * @param {Number} config.radius * @@shapeParams * @@nodeParams * @example * var hexagon = new Konva.RegularPolygon({ * x: 100, * y: 200, * sides: 6, * radius: 70, * fill: 'red', * stroke: 'black', * strokeWidth: 4 * }); */ var RegularPolygon$1 = class extends Shape$1 { _sceneFunc(context) { const points = this._getPoints(), radius = this.radius(), sides = this.sides(), cornerRadius = this.cornerRadius(); if (!points.length) return; context.beginPath(); if (!cornerRadius) { context.moveTo(points[0].x, points[0].y); for (let n = 1; n < points.length; n++) context.lineTo(points[n].x, points[n].y); } else Util.drawRoundedPolygonPath(context, points, sides, radius, cornerRadius); context.closePath(); context.fillStrokeShape(this); } _getPoints() { const sides = this.attrs.sides; const radius = this.attrs.radius || 0; const points = []; for (let n = 0; n < sides; n++) points.push({ x: radius * Math.sin(n * 2 * Math.PI / sides), y: -1 * radius * Math.cos(n * 2 * Math.PI / sides) }); return points; } getSelfRect() { const points = this._getPoints(); if (!points.length) return { x: 0, y: 0, width: 0, height: 0 }; let minX = points[0].x; let maxX = points[0].x; let minY = points[0].y; let maxY = points[0].y; points.forEach((point) => { minX = Math.min(minX, point.x); maxX = Math.max(maxX, point.x); minY = Math.min(minY, point.y); maxY = Math.max(maxY, point.y); }); return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; } getWidth() { return this.radius() * 2; } getHeight() { return this.radius() * 2; } setWidth(width) { this.radius(width / 2); } setHeight(height) { this.radius(height / 2); } }; RegularPolygon$1.prototype.className = "RegularPolygon"; RegularPolygon$1.prototype._centroid = true; RegularPolygon$1.prototype._attrsAffectingSize = ["radius", "sides"]; _registerNode(RegularPolygon$1, true); /** * get/set radius * @method * @name Konva.RegularPolygon#radius * @param {Number} radius * @returns {Number} * @example * // get radius * var radius = shape.radius(); * * // set radius * shape.radius(10); */ Factory.addGetterSetter(RegularPolygon$1, "radius", 0, getNumberValidator()); /** * get/set sides * @method * @name Konva.RegularPolygon#sides * @param {Number} sides * @returns {Number} * @example * // get sides * var sides = shape.sides(); * * // set sides * shape.sides(10); */ Factory.addGetterSetter(RegularPolygon$1, "sides", 0, getNumberValidator()); /** * get/set corner radius * @method * @name Konva.RegularPolygon#cornerRadius * @param {Number} cornerRadius * @returns {Number} * @example * // get corner radius * var cornerRadius = poly.cornerRadius(); * * // set corner radius * poly.cornerRadius(10); * * // set different corner radius values (pentagon) * poly.cornerRadius([0, 10, 20, 30, 40]); */ Factory.addGetterSetter(RegularPolygon$1, "cornerRadius", 0, getNumberOrArrayOfNumbersValidator(4)); //#endregion //#region node_modules/konva/lib/shapes/Ring.js var PIx2 = Math.PI * 2; /** * Ring constructor * @constructor * @augments Konva.Shape * @memberof Konva * @param {Object} config * @param {Number} config.innerRadius * @param {Number} config.outerRadius * @@shapeParams * @@nodeParams * @example * var ring = new Konva.Ring({ * innerRadius: 40, * outerRadius: 80, * fill: 'red', * stroke: 'black', * strokeWidth: 5 * }); */ var Ring$1 = class extends Shape$1 { _getStrokePadding() { return super._getStrokePadding(1); } _sceneFunc(context) { const innerRadius = Math.abs(this.innerRadius()), outerRadius = Math.abs(this.outerRadius()); context.beginPath(); context.arc(0, 0, innerRadius, 0, PIx2, false); context.moveTo(outerRadius, 0); context.arc(0, 0, outerRadius, PIx2, 0, true); context.closePath(); context.fillStrokeShape(this); } getSelfRect() { const radius = Math.max(Math.abs(this.innerRadius()), Math.abs(this.outerRadius())); return { x: -radius, y: -radius, width: radius * 2, height: radius * 2 }; } getWidth() { return Math.abs(this.outerRadius()) * 2; } getHeight() { return Math.abs(this.outerRadius()) * 2; } setWidth(width) { this.outerRadius(width / 2); } setHeight(height) { this.outerRadius(height / 2); } }; Ring$1.prototype.className = "Ring"; Ring$1.prototype._centroid = true; Ring$1.prototype._attrsAffectingSize = ["innerRadius", "outerRadius"]; _registerNode(Ring$1, true); /** * get/set innerRadius * @method * @name Konva.Ring#innerRadius * @param {Number} innerRadius * @returns {Number} * @example * // get inner radius * var innerRadius = ring.innerRadius(); * * // set inner radius * ring.innerRadius(20); */ Factory.addGetterSetter(Ring$1, "innerRadius", 0, getNumberValidator()); /** * get/set outerRadius * @name Konva.Ring#outerRadius * @method * @param {Number} outerRadius * @returns {Number} * @example * // get outer radius * var outerRadius = ring.outerRadius(); * * // set outer radius * ring.outerRadius(20); */ Factory.addGetterSetter(Ring$1, "outerRadius", 0, getNumberValidator()); //#endregion //#region node_modules/konva/lib/shapes/Sprite.js /** * Sprite constructor * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {String} config.animation animation key * @param {Object} config.animations animation map * @param {Integer} [config.frameIndex] animation frame index * @param {Image} config.image image object * @param {Integer} [config.frameRate] animation frame rate * @@shapeParams * @@nodeParams * @example * var imageObj = new Image(); * imageObj.onload = function() { * var sprite = new Konva.Sprite({ * x: 200, * y: 100, * image: imageObj, * animation: 'standing', * animations: { * standing: [ * // x, y, width, height (6 frames) * 0, 0, 49, 109, * 52, 0, 49, 109, * 105, 0, 49, 109, * 158, 0, 49, 109, * 210, 0, 49, 109, * 262, 0, 49, 109 * ], * kicking: [ * // x, y, width, height (6 frames) * 0, 109, 45, 98, * 45, 109, 45, 98, * 95, 109, 63, 98, * 156, 109, 70, 98, * 229, 109, 60, 98, * 287, 109, 41, 98 * ] * }, * frameRate: 7, * frameIndex: 0 * }); * }; * imageObj.src = '/path/to/image.jpg' */ var Sprite$1 = class extends Shape$1 { constructor(config) { super(config); this._updated = true; this.anim = new Animation(() => { const updated = this._updated; this._updated = false; return updated; }); this.on("animationChange.konva", function() { this.frameIndex(0); }); this.on("frameIndexChange.konva", function() { this._updated = true; }); this.on("frameRateChange.konva", function() { if (!this.anim.isRunning()) return; clearInterval(this.interval); this._setInterval(); }); } _getFrame() { var _a, _b; const anim = this.animation(), set = (_a = this.animations()) === null || _a === void 0 ? void 0 : _a[anim], index = this.frameIndex(), ix4 = index * 4; if (!set || !Number.isInteger(index) || ix4 < 0 || ix4 + 4 > set.length) return; const offset = ((_b = this.frameOffsets()) === null || _b === void 0 ? void 0 : _b[anim]) || []; return { x: set[ix4], y: set[ix4 + 1], width: set[ix4 + 2], height: set[ix4 + 3], offsetX: offset[index * 2] || 0, offsetY: offset[index * 2 + 1] || 0 }; } _getStrokePadding() { return super._getStrokePadding(this.strokeScaleEnabled() ? 1 : void 0); } _sceneFunc(context) { const frame = this._getFrame(); if (!frame) return; const { x, y, width, height, offsetX, offsetY } = frame; const image = this.image(); if (this.hasFill() || this.hasStroke()) { context.beginPath(); context.rect(offsetX, offsetY, width, height); context.closePath(); context.fillStrokeShape(this); } if (image) context.drawImage(image, x, y, width, height, offsetX, offsetY, width, height); } _hitFunc(context) { const { x, y, width, height } = this.getSelfRect(); context.beginPath(); context.rect(x, y, width, height); context.closePath(); context.fillShape(this); } getSelfRect() { const frame = this._getFrame(); return frame ? { x: frame.offsetX, y: frame.offsetY, width: frame.width, height: frame.height } : { x: 0, y: 0, width: 0, height: 0 }; } _useBufferCanvas(forceFill, opacity = this.getAbsoluteOpacity()) { return super._useBufferCanvas(true, opacity); } _setInterval() { const that = this; this.interval = setInterval(function() { that._updateIndex(); }, 1e3 / this.frameRate()); } /** * start sprite animation * @method * @name Konva.Sprite#start */ start() { if (this.isRunning()) return; const layer = this.getLayer(); this.anim.setLayers(layer); this._setInterval(); this.anim.start(); } /** * stop sprite animation * @method * @name Konva.Sprite#stop */ stop() { this.anim.stop(); clearInterval(this.interval); } destroy() { this.stop(); return super.destroy(); } /** * determine if animation of sprite is running or not. returns true or false * @method * @name Konva.Sprite#isRunning * @returns {Boolean} */ isRunning() { return this.anim.isRunning(); } _updateIndex() { var _a; const index = this.frameIndex(), set = (_a = this.animations()) === null || _a === void 0 ? void 0 : _a[this.animation()], len = set ? set.length / 4 : 0; this.frameIndex(index < len - 1 ? index + 1 : 0); } }; Sprite$1.prototype.className = "Sprite"; _registerNode(Sprite$1, true); Factory.addGetterSetter(Sprite$1, "animation"); /** * get/set animation key * @name Konva.Sprite#animation * @method * @param {String} anim animation key * @returns {String} * @example * // get animation key * var animation = sprite.animation(); * * // set animation key * sprite.animation('kicking'); */ Factory.addGetterSetter(Sprite$1, "animations"); /** * get/set animations map * @name Konva.Sprite#animations * @method * @param {Object} animations * @returns {Object} * @example * // get animations map * var animations = sprite.animations(); * * // set animations map * sprite.animations({ * standing: [ * // x, y, width, height (6 frames) * 0, 0, 49, 109, * 52, 0, 49, 109, * 105, 0, 49, 109, * 158, 0, 49, 109, * 210, 0, 49, 109, * 262, 0, 49, 109 * ], * kicking: [ * // x, y, width, height (6 frames) * 0, 109, 45, 98, * 45, 109, 45, 98, * 95, 109, 63, 98, * 156, 109, 70, 98, * 229, 109, 60, 98, * 287, 109, 41, 98 * ] * }); */ Factory.addGetterSetter(Sprite$1, "frameOffsets"); /** * get/set frame offsets map * @name Konva.Sprite#frameOffsets * @method * @param {Object} frameOffsets * @returns {Object} * @example * // get frame offsets map * var offsets = sprite.frameOffsets(); * * // set frame offsets map * sprite.frameOffsets({ * standing: [ * // x, y (6 frames) * 0, 0, * 0, 0, * 5, 0, * 0, 0, * 0, 3, * 2, 0 * ], * kicking: [ * // x, y (6 frames) * 0, 5, * 5, 0, * 10, 0, * 0, 0, * 2, 1, * 0, 0 * ] * }); */ Factory.addGetterSetter(Sprite$1, "image"); /** * get/set image * @name Konva.Sprite#image * @method * @param {Image} image * @returns {Image} * @example * // get image * var image = sprite.image(); * * // set image * sprite.image(imageObj); */ Factory.addGetterSetter(Sprite$1, "frameIndex", 0, getNumberValidator()); /** * set/set animation frame index * @name Konva.Sprite#frameIndex * @method * @param {Integer} frameIndex * @returns {Integer} * @example * // get animation frame index * var frameIndex = sprite.frameIndex(); * * // set animation frame index * sprite.frameIndex(3); */ Factory.addGetterSetter(Sprite$1, "frameRate", 17, getNumberValidator()); /** * get/set frame rate in frames per second. Increase this number to make the sprite * animation run faster, and decrease the number to make the sprite animation run slower * The default is 17 frames per second * @name Konva.Sprite#frameRate * @method * @param {Integer} frameRate * @returns {Integer} * @example * // get frame rate * var frameRate = sprite.frameRate(); * * // set frame rate to 2 frames per second * sprite.frameRate(2); */ Factory.backCompat(Sprite$1, { index: "frameIndex", getIndex: "getFrameIndex", setIndex: "setFrameIndex" }); //#endregion //#region node_modules/konva/lib/shapes/Star.js /** * Star constructor * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {Integer} config.numPoints * @param {Number} config.innerRadius * @param {Number} config.outerRadius * @@shapeParams * @@nodeParams * @example * var star = new Konva.Star({ * x: 100, * y: 200, * numPoints: 5, * innerRadius: 70, * outerRadius: 70, * fill: 'red', * stroke: 'black', * strokeWidth: 4 * }); */ var Star$1 = class extends Shape$1 { _sceneFunc(context) { const innerRadius = this.innerRadius(), outerRadius = this.outerRadius(), numPoints = this.numPoints(); context.beginPath(); context.moveTo(0, 0 - outerRadius); for (let n = 1; n < numPoints * 2; n++) { const radius = n % 2 === 0 ? outerRadius : innerRadius; const x = radius * Math.sin(n * Math.PI / numPoints); const y = -1 * radius * Math.cos(n * Math.PI / numPoints); context.lineTo(x, y); } context.closePath(); context.fillStrokeShape(this); } getSelfRect() { const radius = Math.max(Math.abs(this.innerRadius()), Math.abs(this.outerRadius())); return { x: -radius, y: -radius, width: radius * 2, height: radius * 2 }; } getWidth() { return this.outerRadius() * 2; } getHeight() { return this.outerRadius() * 2; } setWidth(width) { this.outerRadius(width / 2); } setHeight(height) { this.outerRadius(height / 2); } }; Star$1.prototype.className = "Star"; Star$1.prototype._centroid = true; Star$1.prototype._attrsAffectingSize = ["innerRadius", "outerRadius"]; _registerNode(Star$1, true); /** * get/set number of points * @name Konva.Star#numPoints * @method * @param {Number} numPoints * @returns {Number} * @example * // get inner radius * var numPoints = star.numPoints(); * * // set inner radius * star.numPoints(20); */ Factory.addGetterSetter(Star$1, "numPoints", 5, getNumberValidator()); /** * get/set innerRadius * @name Konva.Star#innerRadius * @method * @param {Number} innerRadius * @returns {Number} * @example * // get inner radius * var innerRadius = star.innerRadius(); * * // set inner radius * star.innerRadius(20); */ Factory.addGetterSetter(Star$1, "innerRadius", 0, getNumberValidator()); /** * get/set outerRadius * @name Konva.Star#outerRadius * @method * @param {Number} outerRadius * @returns {Number} * @example * // get inner radius * var outerRadius = star.outerRadius(); * * // set inner radius * star.outerRadius(20); */ Factory.addGetterSetter(Star$1, "outerRadius", 0, getNumberValidator()); //#endregion //#region node_modules/konva/lib/shapes/TextPath.js var EMPTY_STRING = ""; var NORMAL = "normal"; function _fillFunc(context) { context.fillText(this.partialText, 0, 0); } function _strokeFunc(context) { context.strokeText(this.partialText, 0, 0); } /** * Path constructor. * @author Jason Follas * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {String} [config.fontFamily] default is Arial * @param {Number} [config.fontSize] default is 12 * @param {String} [config.fontStyle] Can be 'normal', 'italic', or 'bold', '500' or even 'italic bold'. 'normal' is the default. * @param {String} [config.fontVariant] can be normal or small-caps. Default is normal * @param {String} [config.textBaseline] Can be 'top', 'bottom', 'middle', 'alphabetic', 'hanging'. Default is middle * @param {String} config.text * @param {String} config.data SVG data string * @param {Function} config.kerningFunc a getter for kerning values for the specified characters * @@shapeParams * @@nodeParams * @example * var kerningPairs = { * 'A': { * ' ': -0.05517578125, * 'T': -0.07421875, * 'V': -0.07421875 * } * 'V': { * ',': -0.091796875, * ":": -0.037109375, * ";": -0.037109375, * "A": -0.07421875 * } * } * var textpath = new Konva.TextPath({ * x: 100, * y: 50, * fill: '#333', * fontSize: '24', * fontFamily: 'Arial', * text: 'All the world\'s a stage, and all the men and women merely players.', * data: 'M10,10 C0,0 10,150 100,100 S300,150 400,50', * kerningFunc(leftChar, rightChar) { * return kerningPairs.hasOwnProperty(leftChar) ? pairs[leftChar][rightChar] || 0 : 0 * } * }); */ var TextPath$1 = class extends Shape$1 { constructor(config) { super(config); this.dataArray = []; this._readDataAttribute(); this._setTextData(); } _getTextPathLength() { return Path$1.getPathLength(this.dataArray); } _getPointAtLength(length, cursor) { if (!this.attrs.data) return null; if (length > this.pathLength) return null; return Path$1.getPointAtLengthOfDataArray(length, this.dataArray, cursor); } _readDataAttribute() { this.dataArray = Path$1.parsePathData(this.attrs.data); this.pathLength = this._getTextPathLength(); } _sceneFunc(context) { context.setAttr("font", this._getContextFont()); context.setAttr("textBaseline", this.textBaseline()); context.setAttr("textAlign", "left"); context.save(); const textDecoration = this.textDecoration(); const fill = this.fill(); const fontSize = this.fontSize(); const glyphInfo = this.glyphInfo; const hasUnderline = textDecoration.indexOf("underline") !== -1; const hasLineThrough = textDecoration.indexOf("line-through") !== -1; if (hasUnderline) context.beginPath(); for (let i = 0; i < glyphInfo.length; i++) { context.save(); const p0 = glyphInfo[i].p0; context.translate(p0.x, p0.y); context.rotate(glyphInfo[i].rotation); this.partialText = glyphInfo[i].text; context.fillStrokeShape(this); if (hasUnderline) { if (i === 0) context.moveTo(0, fontSize / 2 + 1); context.lineTo(glyphInfo[i].width, fontSize / 2 + 1); } context.restore(); } if (hasUnderline) { context.strokeStyle = fill; context.lineWidth = getDecorationLineWidth(fontSize); context.stroke(); } if (hasLineThrough) { context.beginPath(); for (let i = 0; i < glyphInfo.length; i++) { context.save(); const p0 = glyphInfo[i].p0; context.translate(p0.x, p0.y); context.rotate(glyphInfo[i].rotation); if (i === 0) context.moveTo(0, 0); context.lineTo(glyphInfo[i].width, 0); context.restore(); } context.strokeStyle = fill; context.lineWidth = getDecorationLineWidth(fontSize); context.stroke(); } context.restore(); } _hitFunc(context) { context.beginPath(); const glyphInfo = this.glyphInfo; if (glyphInfo.length >= 1) { const p0 = glyphInfo[0].p0; context.moveTo(p0.x, p0.y); } for (let i = 0; i < glyphInfo.length; i++) { const p1 = glyphInfo[i].p1; context.lineTo(p1.x, p1.y); } context.setAttr("lineWidth", this.fontSize()); context.setAttr("strokeStyle", this.colorKey); context.stroke(); } /** * get text width in pixels * @method * @name Konva.TextPath#getTextWidth */ getTextWidth() { return this.textWidth; } getTextHeight() { Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."); return this.textHeight; } setText(text) { return Text$1.prototype.setText.call(this, text); } _getContextFont() { return Text$1.prototype._getContextFont.call(this); } _getTextSize(text) { const _context = getDummyContext(); _context.save(); _context.font = this._getContextFont(); _context.fontKerning = "auto"; const metrics = _context.measureText(text); _context.restore(); return { width: metrics.width, height: parseInt(`${this.fontSize()}`, 10) }; } _setTextData() { const charArr = stringToArray(this.text()); if (this.direction() === "rtl") charArr.reverse(); const kerningFunc = this.kerningFunc(); const chars = []; let width = 0; for (let i = 0; i < charArr.length; i++) { let kern = 0; if (kerningFunc && i > 0) try { kern = kerningFunc(charArr[i - 1], charArr[i]) * this.fontSize(); } catch (e) {} chars.push({ char: charArr[i], width: this._getTextSize(charArr[i]).width, kern }); width += chars[i].width + kern; } const { width: fullTextWidth, height } = this._getTextSize(this.attrs.text); this.textWidth = width; this.textHeight = height; this.glyphInfo = []; if (!this.attrs.data) return null; const letterSpacing = this.letterSpacing(); const align = this.align(); const numberOfSpaces = align === "justify" ? this.text().split(" ").length - 1 : 0; const kerningAdjustment = Math.max(0, width - fullTextWidth); const textWidth = Math.max(this.textWidth + (charArr.length - 1) * letterSpacing, 0); let offset = 0; if (align === "center") offset = Math.max(0, this.pathLength / 2 - textWidth / 2); if (align === "right") offset = Math.max(0, this.pathLength - textWidth); let offsetToGlyph = offset; const cursor = this.dataArray.some((segment, index) => index > 0 && segment.command === "M") ? void 0 : { index: 0, offset: 0 }; for (let i = 0; i < chars.length; i++) { offsetToGlyph += chars[i].kern; const charStartPoint = this._getPointAtLength(offsetToGlyph, cursor); if (!charStartPoint) return; const char = chars[i].char; let glyphWidth = chars[i].width + (i < chars.length - 1 ? letterSpacing : 0); if (char === " " && align === "justify") glyphWidth += (this.pathLength - textWidth) / numberOfSpaces; const charEndLength = offsetToGlyph + glyphWidth; const charEndPoint = this._getPointAtLength(charEndLength > this.pathLength && charEndLength - this.pathLength <= kerningAdjustment ? this.pathLength : charEndLength, cursor); if (!charEndPoint) return; const width = Path$1.getLineLength(charStartPoint.x, charStartPoint.y, charEndPoint.x, charEndPoint.y); const rotation = Math.atan2(charEndPoint.y - charStartPoint.y, charEndPoint.x - charStartPoint.x); this.glyphInfo.push({ text: charArr[i], rotation, p0: charStartPoint, p1: charEndPoint, width }); offsetToGlyph += glyphWidth; } } getSelfRect() { if (!this.glyphInfo.length) return { x: 0, y: 0, width: 0, height: 0 }; const points = []; this.glyphInfo.forEach(function(info) { points.push(info.p0.x); points.push(info.p0.y); points.push(info.p1.x); points.push(info.p1.y); }); const rect = Util._getPointsRect(points); const fontSize = this.fontSize(); return { x: rect.x - fontSize / 2, y: rect.y - fontSize / 2, width: rect.width + fontSize, height: rect.height + fontSize }; } getStrokeScaleEnabled() { return true; } _getSelfRectForDrawing() { const rect = this.getSelfRect(), pad = this.fontSize(); return { x: rect.x - pad, y: rect.y - pad, width: rect.width + pad * 2, height: rect.height + pad * 2 }; } }; TextPath$1.prototype._fillFunc = _fillFunc; TextPath$1.prototype._strokeFunc = _strokeFunc; TextPath$1.prototype._fillFuncHit = _fillFunc; TextPath$1.prototype._strokeFuncHit = _strokeFunc; TextPath$1.prototype.className = "TextPath"; TextPath$1.prototype._attrsAffectingSize = [ "text", "fontSize", "data", "align", "letterSpacing", "kerningFunc", "fontFamily", "fontStyle", "fontVariant", "direction" ]; _registerNode(TextPath$1, true); TextPath$1.prototype.on("dataChange.konva", function() { this._readDataAttribute(); this._setTextData(); }); TextPath$1.prototype.on(TextPath$1.prototype._attrsAffectingSize.filter((attr) => attr !== "data").map((attr) => attr + "Change.konva").join(" "), function() { this._setTextData(); }); /** * get/set SVG path data string. This method * also automatically parses the data string * into a data array. Currently supported SVG data: * M, m, L, l, H, h, V, v, Q, q, T, t, C, c, S, s, A, a, Z, z * @name Konva.TextPath#data * @method * @param {String} data svg path string * @returns {String} * @example * // get data * var data = shape.data(); * * // set data * shape.data('M200,100h100v50z'); */ Factory.addGetterSetter(TextPath$1, "data"); /** * get/set font family * @name Konva.TextPath#fontFamily * @method * @param {String} fontFamily * @returns {String} * @example * // get font family * var fontFamily = shape.fontFamily(); * * // set font family * shape.fontFamily('Arial'); */ Factory.addGetterSetter(TextPath$1, "fontFamily", "Arial"); /** * get/set font size in pixels * @name Konva.TextPath#fontSize * @method * @param {Number} fontSize * @returns {Number} * @example * // get font size * var fontSize = shape.fontSize(); * * // set font size to 22px * shape.fontSize(22); */ Factory.addGetterSetter(TextPath$1, "fontSize", 12, getNumberValidator()); /** * get/set font style. Can be 'normal', 'italic', or 'bold', '500' or even 'italic bold'. 'normal' is the default. * @name Konva.TextPath#fontStyle * @method * @param {String} fontStyle * @returns {String} * @example * // get font style * var fontStyle = shape.fontStyle(); * * // set font style * shape.fontStyle('bold'); */ Factory.addGetterSetter(TextPath$1, "fontStyle", NORMAL); /** * get/set horizontal align of text. Can be 'left', 'center', 'right' or 'justify' * @name Konva.TextPath#align * @method * @param {String} align * @returns {String} * @example * // get text align * var align = text.align(); * * // center text * text.align('center'); * * // align text to right * text.align('right'); */ Factory.addGetterSetter(TextPath$1, "align", "left"); /** * get/set letter spacing. The default is 0. * @name Konva.TextPath#letterSpacing * @method * @param {Number} letterSpacing * @returns {Number} * @example * // get letter spacing value * var letterSpacing = shape.letterSpacing(); * * // set the letter spacing value * shape.letterSpacing(2); */ Factory.addGetterSetter(TextPath$1, "letterSpacing", 0, getNumberValidator()); /** * get/set text baseline. The default is 'middle'. Can be 'top', 'bottom', 'middle', 'alphabetic', 'hanging' * @name Konva.TextPath#textBaseline * @method * @param {String} textBaseline * @returns {String} * @example * // get current text baseline * var textBaseline = shape.textBaseline(); * * // set new text baseline * shape.textBaseline('top'); */ Factory.addGetterSetter(TextPath$1, "textBaseline", "middle"); /** * get/set font variant. Can be 'normal' or 'small-caps'. 'normal' is the default. * @name Konva.TextPath#fontVariant * @method * @param {String} fontVariant * @returns {String} * @example * // get font variant * var fontVariant = shape.fontVariant(); * * // set font variant * shape.fontVariant('small-caps'); */ Factory.addGetterSetter(TextPath$1, "fontVariant", NORMAL); /** * get/set text * @name Konva.TextPath#getText * @method * @param {String} text * @returns {String} * @example * // get text * var text = text.text(); * * // set text * text.text('Hello world!'); */ Factory.addGetterSetter(TextPath$1, "text", EMPTY_STRING); /** * get/set text decoration of a text. Can be '', 'underline', 'line-through', or a combination like 'underline line-through'. * @name Konva.TextPath#textDecoration * @method * @param {String} textDecoration * @returns {String} * @example * // get text decoration * var textDecoration = shape.textDecoration(); * * // underline text * shape.textDecoration('underline'); * * // line-through text * shape.textDecoration('line-through'); * * // combine both * shape.textDecoration('underline line-through'); */ Factory.addGetterSetter(TextPath$1, "textDecoration", ""); /** * get/set kerning function. * @name Konva.TextPath#kerningFunc * @method * @param {String} kerningFunc * @returns {String} * @example * // get text decoration * var kerningFunc = text.kerningFunc(); * * // center text * text.kerningFunc(function(leftChar, rightChar) { * return 1; * }); */ Factory.addGetterSetter(TextPath$1, "kerningFunc", void 0); /** * get/set text direction. Can be 'inherit', 'ltr' or 'rtl'. Default is 'inherit'. * * Setting `'rtl'` reverses the per-glyph layout order along the path, so * Hebrew/Arabic strings read correctly when scanned right-to-left. This is a * pragmatic fix limited by canvas TextPath rendering: each glyph is still * drawn independently, so Arabic cursive joining and full Unicode bidi * reordering of mixed-direction text are not supported. For best results, * pair `direction: 'rtl'` with `align: 'right'` so the text starts at the * end of the path. * @name Konva.TextPath#direction * @method * @param {String} direction * @returns {String} * @example * // get direction * var direction = textpath.direction(); * * // set direction * textpath.direction('rtl'); */ Factory.addGetterSetter(TextPath$1, "direction", "inherit"); //#endregion //#region node_modules/konva/lib/shapes/Transformer.js var EVENTS_NAME = "tr-konva"; var ATTR_CHANGE_LIST = [ "resizeEnabledChange", "rotateAnchorOffsetChange", "rotateAnchorAngleChange", "rotateEnabledChange", "rotateModeChange", "enabledAnchorsChange", "anchorSizeChange", "borderEnabledChange", "shouldOverdrawWholeAreaChange", "borderStrokeChange", "borderStrokeWidthChange", "borderDashChange", "anchorStrokeChange", "anchorStrokeWidthChange", "anchorFillChange", "anchorCornerRadiusChange", "ignoreStrokeChange", "anchorStyleFuncChange", "paddingChange" ].map((e) => e + `.${EVENTS_NAME}`).join(" "); var NODES_RECT = "nodesRect"; var TRANSFORM_CHANGE_STR = [ "widthChange", "heightChange", "scaleXChange", "scaleYChange", "skewXChange", "skewYChange", "rotationChange", "offsetXChange", "offsetYChange", "transformsEnabledChange", "strokeWidthChange", "strokeChange", "selfRectFuncChange", "strokeLinearGradientColorStopsChange", "strokeScaleEnabledChange", "strokeEnabledChange", "draggableChange" ]; var ANGLES = { "top-left": -45, "top-center": 0, "top-right": 45, "middle-right": -90, "middle-left": 90, "bottom-left": -135, "bottom-center": 180, "bottom-right": 135 }; var TOUCH_DEVICE = "ontouchstart" in Konva$2._global; var ROTATE_ZONE_NAMES = [ "rotater-top-left", "rotater-top-right", "rotater-bottom-left", "rotater-bottom-right" ]; function isRotateAnchor(anchorName) { return anchorName.startsWith("rotater"); } var SHIFT_ROTATION_STEP = Math.PI / 12; function getRotateZoneCursor(deg, fallback) { const svg = ``; return `url("data:image/svg+xml,${encodeURIComponent(svg)}") 12 12, ${fallback}`; } function getCursor(anchorName, rad, rotateCursor) { if (anchorName === "rotater") return rotateCursor; if (isRotateAnchor(anchorName)) { const corner = anchorName.slice(8); return getRotateZoneCursor(Math.round(Util.radToDeg(rad) + ANGLES[corner] - 45), rotateCursor); } rad += Util.degToRad(ANGLES[anchorName] || 0); const angle = (Util.radToDeg(rad) % 360 + 360) % 360; if (Util._inRange(angle, 337.5, 360) || Util._inRange(angle, 0, 22.5)) return "ns-resize"; else if (Util._inRange(angle, 22.5, 67.5)) return "nesw-resize"; else if (Util._inRange(angle, 67.5, 112.5)) return "ew-resize"; else if (Util._inRange(angle, 112.5, 157.5)) return "nwse-resize"; else if (Util._inRange(angle, 157.5, 202.5)) return "ns-resize"; else if (Util._inRange(angle, 202.5, 247.5)) return "nesw-resize"; else if (Util._inRange(angle, 247.5, 292.5)) return "ew-resize"; else if (Util._inRange(angle, 292.5, 337.5)) return "nwse-resize"; else { Util.error("Transformer has unknown angle for cursor detection: " + angle); return "pointer"; } } var ANCHORS_NAMES = [ "top-left", "top-center", "top-right", "middle-right", "middle-left", "bottom-left", "bottom-center", "bottom-right" ]; function getCenter(shape) { return { x: shape.x + shape.width / 2 * Math.cos(shape.rotation) + shape.height / 2 * Math.sin(-shape.rotation), y: shape.y + shape.height / 2 * Math.cos(shape.rotation) + shape.width / 2 * Math.sin(shape.rotation) }; } function rotateAroundPoint(shape, angleRad, point) { const x = point.x + (shape.x - point.x) * Math.cos(angleRad) - (shape.y - point.y) * Math.sin(angleRad); const y = point.y + (shape.x - point.x) * Math.sin(angleRad) + (shape.y - point.y) * Math.cos(angleRad); return { ...shape, rotation: shape.rotation + angleRad, x, y }; } function rotateAroundCenter(shape, deltaRad) { return rotateAroundPoint(shape, deltaRad, getCenter(shape)); } function getSnap(snaps, newRotationRad, tol) { let snapped = newRotationRad; let nearest = tol; for (let i = 0; i < snaps.length; i++) { const angle = Konva$2.getAngle(snaps[i]); const absDiff = Math.abs(angle - newRotationRad) % (Math.PI * 2); const dif = Math.min(absDiff, Math.PI * 2 - absDiff); if (dif < nearest) { nearest = dif; snapped = angle; } } return snapped; } function getRotaterLine(tr, width, height) { const rad = Util.degToRad(tr.rotateAnchorAngle()); const dirX = Math.sin(rad); const dirY = -Math.cos(rad); const cx = width / 2; const cy = height / 2; let t = Infinity; if (dirY < 0) t = Math.min(t, -cy / dirY); else if (dirY > 0) t = Math.min(t, (height - cy) / dirY); if (dirX < 0) t = Math.min(t, -cx / dirX); else if (dirX > 0) t = Math.min(t, (width - cx) / dirX); const edgeX = cx + dirX * t; const edgeY = cy + dirY * t; const offset = tr.rotateAnchorOffset() + tr.padding(); return { edgeX, edgeY, endX: edgeX + dirX * offset, endY: edgeY + dirY * offset }; } var activeTransformers = /* @__PURE__ */ new Set(); /** * Transformer constructor. Transformer is a special type of group that allow you transform Konva * primitives and shapes. Transforming tool is not changing `width` and `height` properties of nodes * when you resize them. Instead it changes `scaleX` and `scaleY` properties. * @constructor * @memberof Konva * @param {Object} config * @param {Boolean} [config.resizeEnabled] Default is true * @param {Boolean} [config.rotateEnabled] Default is true * @param {Boolean} [config.rotateLineVisible] Default is true * @param {Array} [config.rotationSnaps] Array of angles for rotation snaps. Default is [] * @param {Number} [config.rotationSnapTolerance] Snapping tolerance. If closer than this it will snap. Default is 5 * @param {Number} [config.rotateAnchorOffset] Default is 50 * @param {Number} [config.rotateAnchorAngle] Angle of the rotate anchor around the box, in degrees. Default is 0 (top) * @param {String} [config.rotateAnchorCursor] Default is crosshair * @param {String} [config.rotateMode] How the user rotates: 'handle' (the rotate anchor), 'corners' (invisible zones just outside the corners) or 'both'. Default is 'handle' * @param {Number} [config.padding] Default is 0 * @param {Boolean} [config.borderEnabled] Should we draw border? Default is true * @param {String} [config.borderStroke] Border stroke color * @param {Number} [config.borderStrokeWidth] Border stroke size * @param {Array} [config.borderDash] Array for border dash. * @param {String} [config.anchorFill] Anchor fill color * @param {String} [config.anchorStroke] Anchor stroke color * @param {Number} [config.anchorCornerRadius] Anchor corner radius * @param {Number} [config.anchorStrokeWidth] Anchor stroke size * @param {Number} [config.anchorSize] Default is 10 * @param {Boolean} [config.keepRatio] Should we keep ratio when we are moving edges? Default is true * @param {String} [config.shiftBehavior] How does transformer react on shift key press when we are moving edges? 'none' also turns off the Shift rotation snap. Default is 'default' * @param {Boolean} [config.centeredScaling] Should we resize relative to node's center? Default is false * @param {Array} [config.enabledAnchors] Array of names of enabled handles * @param {Boolean} [config.flipEnabled] Can we flip/mirror shape on transform?. True by default * @param {Function} [config.boundBoxFunc] Bounding box function, see {@link Konva.Transformer#boundBoxFunc} * @param {Function} [config.anchorDragBoundFunc] Function bounding the position of a dragged anchor, see {@link Konva.Transformer#anchorDragBoundFunc} * @param {Function} [config.anchorStyleFunc] Function styling every anchor, see {@link Konva.Transformer#anchorStyleFunc} * @param {Boolean} [config.ignoreStroke] Should we ignore stroke size? Default is false * @param {Boolean} [config.useSingleNodeRotation] When just one node attached, should we use its rotation for transformer? * @param {Boolean} [config.shouldOverdrawWholeArea] Should we fill whole transformer area with fake transparent shape to enable dragging from empty spaces? * @example * var transformer = new Konva.Transformer({ * nodes: [rectangle], * rotateAnchorOffset: 60, * enabledAnchors: ['top-left', 'top-right', 'bottom-left', 'bottom-right'] * }); * layer.add(transformer); */ var Transformer$1 = class extends Group$1 { static _isLayerTransforming(layer) { for (const tr of activeTransformers) if (tr.getLayer() === layer || tr._nodes.some((node) => node.getLayer() === layer)) return true; return false; } constructor(config) { super(config); this._movingAnchorName = null; this._anchors = {}; this._transforming = false; this._fitting = false; this._transformWindow = null; this._elementsCreated = false; this._updatePending = false; this._createElements(); this._handleMouseMove = this._handleMouseMove.bind(this); this._handleMouseUp = this._handleMouseUp.bind(this); this.update = this.update.bind(this); this._syncUpdate = this._syncUpdate.bind(this); this.on(ATTR_CHANGE_LIST, (event) => { if (event.type === "ignoreStrokeChange") this._resetTransformCache(); this.update(); }); this.on(`rotationChange.${EVENTS_NAME}`, () => this._clearCache(NODES_RECT)); if (this.getNode()) this.update(); } /** * alias to `tr.nodes([shape])`/ This method is deprecated and will be removed soon. * @method * @name Konva.Transformer#attachTo * @returns {Konva.Transformer} * @example * transformer.attachTo(shape); */ attachTo(node) { this.setNode(node); return this; } setNode(node) { Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."); return this.setNodes([node]); } getNode() { return this._nodes && this._nodes[0]; } _getEventNamespace() { return EVENTS_NAME + this._id; } setNodes(nodes = []) { if (this._nodes && this._nodes.length) this.detach(); const selected = new Set(nodes); for (const node of selected) if (node.isAncestorOf(this)) { Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"); selected.delete(node); } const filteredNodes = Array.from(selected).filter((node) => { for (let parent = node.getParent(); parent; parent = parent.getParent()) if (selected.has(parent)) return false; return true; }); this._nodes = nodes = filteredNodes; this._resetRotation(); this._nodes.forEach((node) => { const onChange = () => { var _a; if (this._fitting) { (_a = this._nodeRectCache) === null || _a === void 0 || _a.delete(node); return; } if (this.nodes().length === 1 && this.useSingleNodeRotation()) this.rotation(this.nodes()[0].getAbsoluteRotation()); this._resetTransformCache(node); if (!this.isDragging()) this._scheduleUpdate(); }; if (node._attrsAffectingSize.length) { const additionalEvents = node._attrsAffectingSize.map((prop) => prop + "Change." + this._getEventNamespace()).join(" "); node.on(additionalEvents, onChange); } node.on(TRANSFORM_CHANGE_STR.map((e) => e + `.${this._getEventNamespace()}`).join(" "), onChange); node.on(`absoluteTransformChange.${this._getEventNamespace()}`, onChange); if (node instanceof Container) node._addSubtreeObserver(this); node.on(`destroy.${this._getEventNamespace()}`, () => { this._removeNode(node); }); this._proxyDrag(node); }); this._resetTransformCache(); if (this._elementsCreated) this.update(); return this; } _proxyDrag(node) { let lastPos; node.on(`dragstart.${this._getEventNamespace()}`, (e) => { lastPos = node.getAbsolutePosition(); if (!this.isDragging() && node !== this._back) this.startDrag(e, false); }); node.on(`dragmove.${this._getEventNamespace()}`, (e) => { if (!lastPos) return; const abs = node.getAbsolutePosition(); const dx = abs.x - lastPos.x; const dy = abs.y - lastPos.y; this.nodes().forEach((otherNode) => { if (otherNode === node) return; if (otherNode.isDragging()) return; const otherAbs = otherNode.getAbsolutePosition(); otherNode.setAbsolutePosition({ x: otherAbs.x + dx, y: otherAbs.y + dy }); otherNode.startDrag(e); }); lastPos = null; }); } _detachNode(node) { node.off("." + this._getEventNamespace()); node._removeSubtreeObserver(this); } _resetRotation() { const single = this._nodes.length === 1 && this.useSingleNodeRotation(); this.rotation(single ? this._nodes[0].getAbsoluteRotation() : 0); } _removeNode(node) { this._detachNode(node); this._nodes = this._nodes.filter((n) => n !== node); this._resetRotation(); this._resetTransformCache(node); this._scheduleUpdate(); } getNodes() { return this._nodes || []; } /** * return the name of current active anchor * @method * @name Konva.Transformer#getActiveAnchor * @returns {String | Null} * @example * transformer.getActiveAnchor(); */ getActiveAnchor() { return this._movingAnchorName; } /** * detach transformer from an attached node * @method * @name Konva.Transformer#detach * @returns {Konva.Transformer} * @example * transformer.detach(); */ detach() { var _a, _b; (_a = this._nodes) === null || _a === void 0 || _a.forEach((node) => this._detachNode(node)); this._nodes = []; this._updatePending = false; this._resetTransformCache(); (_b = this.getLayer()) === null || _b === void 0 || _b.batchDraw(); } /** * bind events to the Transformer. You can use events: `transform`, `transformstart`, `transformend`, `dragstart`, `dragmove`, `dragend` * @method * @name Konva.Transformer#on * @param {String} evtStr e.g. 'transform' * @param {Function} handler The handler function. The first argument of that function is event object. Event object has `target` as main target of the event, `currentTarget` as current node listener and `evt` as native browser event. * @returns {Konva.Transformer} * @example * // add click listener * tr.on('transformstart', function() { * console.log('transform started'); * }); */ _resetTransformCache(changedNode) { var _a, _b; if (changedNode) (_a = this._nodeRectCache) === null || _a === void 0 || _a.delete(changedNode); else (_b = this._nodeRectCache) === null || _b === void 0 || _b.clear(); this._clearCache(NODES_RECT); this._clearCache("transform"); this._clearSelfAndDescendantCache("absoluteTransform"); } _onSubtreeChange(node) { var _a, _b; if (this._fitting) return; if (!this._updatePending || !!this._cache[NODES_RECT]) this._resetTransformCache(node); if (Node._updateBatchDepth > 0) { this._scheduleUpdate(); return; } if (!this._updatePending) { this._updatePending = true; Util.requestAnimFrame(this._syncUpdate, (_a = this.getStage()) === null || _a === void 0 ? void 0 : _a._getOwnerWindow()); (_b = this.getLayer()) === null || _b === void 0 || _b.batchDraw(); } } _syncUpdate() { if (this._updatePending && !this._fitting && !this.isDragging()) this._update(); } drawScene(can, top) { this._syncUpdate(); return super.drawScene(can, top); } drawHit(can, top) { this._syncUpdate(); return super.drawHit(can, top); } _getNodeRect() { return this._getCache(NODES_RECT, this.__getNodeRect); } __getNodeRect() { var _a; if (!this.getNode()) return { x: -1e8, y: -1e8, width: 0, height: 0, rotation: 0 }; const rotation = Konva$2.getAngle(this.rotation()); const ignoreStroke = this.ignoreStroke(); const tr = new Transform(); tr.rotate(-rotation); const cache = this._nodeRectCache || (this._nodeRectCache = /* @__PURE__ */ new Map()); let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity; for (const node of this.nodes()) { const cacheable = node instanceof Shape$1 && node.getSelfRect === Shape$1.prototype.getSelfRect && !node.attrs.selfRectFunc && !node._hasCachedAncestor(); const width = cacheable ? node.width() : 0; const height = cacheable ? node.height() : 0; if (cacheable) (_a = node._attrsVersion) !== null && _a !== void 0 || (node._attrsVersion = 0); let bounds = cacheable ? cache.get(node) : void 0; if (!bounds || bounds.rotation !== rotation || bounds.ignoreStroke !== ignoreStroke || bounds.version !== node._attrsVersion || bounds.width !== width || bounds.height !== height) { let trans = node.getAbsoluteTransform(); const [a, b, c, d] = trans.getMatrix(); const collapsed = a * d - b * c === 0; const box = node.getClientRect({ skipTransform: !collapsed, skipShadow: true, skipStroke: ignoreStroke }); const points = [ { x: box.x, y: box.y }, { x: box.x + box.width, y: box.y }, { x: box.x + box.width, y: box.y + box.height }, { x: box.x, y: box.y + box.height } ]; if (collapsed) trans = new Transform(); bounds = { rotation, ignoreStroke, width, height, version: node._attrsVersion || 0, minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity }; for (const point of points) { const projected = tr.point(trans.point(point)); bounds.minX = Math.min(bounds.minX, projected.x); bounds.minY = Math.min(bounds.minY, projected.y); bounds.maxX = Math.max(bounds.maxX, projected.x); bounds.maxY = Math.max(bounds.maxY, projected.y); } if (cacheable) cache.set(node, bounds); } minX = Math.min(minX, bounds.minX); minY = Math.min(minY, bounds.minY); maxX = Math.max(maxX, bounds.maxX); maxY = Math.max(maxY, bounds.maxY); } tr.invert(); const p = tr.point({ x: minX, y: minY }); return { x: p.x, y: p.y, width: maxX - minX, height: maxY - minY, rotation: Konva$2.getAngle(this.rotation()) }; } getX() { return this._getNodeRect().x; } getY() { return this._getNodeRect().y; } getWidth() { return this._getNodeRect().width; } getHeight() { return this._getNodeRect().height; } _createElements() { this._createBack(); ROTATE_ZONE_NAMES.forEach((name) => { this._createAnchor(name, "_rotate-zone").setAttrs({ fill: "transparent", strokeEnabled: false, visible: false }); }); ANCHORS_NAMES.forEach((name) => { this._createAnchor(name); }); this._createAnchor("rotater"); this._elementsCreated = true; } _createAnchor(name, className = "_anchor") { const anchor = new Rect$1({ stroke: "rgb(0, 161, 255)", fill: "white", strokeWidth: 1, name: name + " " + className, dragDistance: 0, draggable: true, hitStrokeWidth: TOUCH_DEVICE ? 10 : "auto" }); this._anchors[name] = anchor; const self = this; anchor.on("mousedown touchstart", function(e) { self._handleMouseDown(e); }); anchor.on("dragstart", (e) => { anchor.stopDrag(); e.cancelBubble = true; }); anchor.on("dragend", (e) => { e.cancelBubble = true; }); anchor.on("mouseenter", () => { if (this.isTransforming()) return; this._setAnchorCursor(name); this._cursorChange = true; }); anchor.on("mouseout", () => { this._cursorChange = false; if (this.isTransforming()) return; anchor.getStage().content && (anchor.getStage().content.style.cursor = ""); }); this.add(anchor); return anchor; } _setAnchorCursor(name, rad = Konva$2.getAngle(this.rotation())) { var _a; const content = (_a = this.getStage()) === null || _a === void 0 ? void 0 : _a.content; if (content) content.style.cursor = getCursor(name, rad, this.rotateAnchorCursor()); } _createBack() { const back = new Shape$1({ name: "back", width: 0, height: 0, sceneFunc(ctx, shape) { const tr = shape.getParent(); if (!tr.borderEnabled()) return; const padding = tr.padding(); const width = shape.width(); const height = shape.height(); ctx.beginPath(); ctx.rect(-padding, -padding, width + padding * 2, height + padding * 2); if (tr.rotateEnabled() && tr.rotateLineVisible() && tr.rotateMode() !== "corners") { const line = getRotaterLine(tr, width, height); ctx.moveTo(line.edgeX, line.edgeY); ctx.lineTo(line.endX, line.endY); } ctx.fillStrokeShape(shape); }, hitFunc: (ctx, shape) => { if (!this.shouldOverdrawWholeArea()) return; const padding = this.padding(); ctx.beginPath(); ctx.rect(-padding, -padding, shape.width() + padding * 2, shape.height() + padding * 2); ctx.fillStrokeShape(shape); } }); this._back = back; this.add(back); this._proxyDrag(back); back.on("dragstart", (e) => { e.cancelBubble = true; }); back.on("dragmove", (e) => { e.cancelBubble = true; }); back.on("dragend", (e) => { e.cancelBubble = true; }); this.on("dragmove", (e) => { this.update(); }); } _handleMouseDown(e) { var _a, _b; if (e.evt.button !== void 0 && !Konva$2.dragButtons.includes(e.evt.button)) return; if (this._transforming) return; this._movingAnchorName = e.target.name().split(" ")[0]; const attrs = this._getNodeRect(); const width = attrs.width; const height = attrs.height; const hypotenuse = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)); this.sin = Math.abs(height / hypotenuse); this.cos = Math.abs(width / hypotenuse); const win = (_a = this.getStage()) === null || _a === void 0 ? void 0 : _a._getOwnerWindow(); this._transformWindow = win || null; if (win) { win.addEventListener("mousemove", this._handleMouseMove); win.addEventListener("touchmove", this._handleMouseMove); win.addEventListener("mouseup", this._handleMouseUp, true); win.addEventListener("touchend", this._handleMouseUp, true); win.addEventListener("touchcancel", this._handleMouseUp, true); } this._transforming = true; this._pointerId = (_b = e.pointerId) !== null && _b !== void 0 ? _b : Util._getFirstPointerId(e.evt); const ap = e.target.getAbsolutePosition(); const pos = e.target.getStage()._getPointerById(this._pointerId); this._anchorDragOffset = { x: pos.x - ap.x, y: pos.y - ap.y }; if (isRotateAnchor(this._movingAnchorName)) { const center = getCenter(attrs); this._rotateStart = { pointerAngle: Math.atan2(pos.y - center.y, pos.x - center.x), rotation: attrs.rotation }; } activeTransformers.add(this); this._fire("transformstart", { evt: e.evt, target: this.getNode() }); this._nodes.forEach((target) => { target._fire("transformstart", { evt: e.evt, target }); }); } _handleMouseMove(e) { var _a; (_a = this.getStage()) === null || _a === void 0 || _a._batchEvents(() => this._moveTransform(e)); } _moveTransform(e) { this._syncUpdate(); let x, y, newHypotenuse; const anchorNode = this._anchors[this._movingAnchorName]; const stage = anchorNode.getStage(); stage.setPointersPositions(e); const pp = stage._getPointerById(this._pointerId); if (!pp) return; let newNodePos = { x: pp.x - this._anchorDragOffset.x, y: pp.y - this._anchorDragOffset.y }; const oldAbs = anchorNode.getAbsolutePosition(); if (this.anchorDragBoundFunc()) newNodePos = this.anchorDragBoundFunc()(oldAbs, newNodePos, e); anchorNode.setAbsolutePosition(newNodePos); const newAbs = anchorNode.getAbsolutePosition(); if (oldAbs.x === newAbs.x && oldAbs.y === newAbs.y) return; if (isRotateAnchor(this._movingAnchorName)) { const attrs = this._getNodeRect(); const center = getCenter(attrs); const start = this._rotateStart; const point = { x: newAbs.x + this._anchorDragOffset.x, y: newAbs.y + this._anchorDragOffset.y }; const pointerAngle = Math.atan2(point.y - center.y, point.x - center.x); const newRotation = start.rotation + pointerAngle - start.pointerAngle; let snappedRot; if (e.shiftKey && this.shiftBehavior() !== "none") snappedRot = Math.round(newRotation / SHIFT_ROTATION_STEP) * SHIFT_ROTATION_STEP; else { const tol = Konva$2.getAngle(this.rotationSnapTolerance()); snappedRot = getSnap(this.rotationSnaps(), newRotation, tol); } if (this._movingAnchorName !== "rotater") this._setAnchorCursor(this._movingAnchorName, snappedRot); const shape = rotateAroundCenter(attrs, snappedRot - attrs.rotation); this._fitNodesInto(shape, e); return; } const shiftBehavior = this.shiftBehavior(); let keepProportion; if (shiftBehavior === "inverted") keepProportion = this.keepRatio() && !e.shiftKey; else if (shiftBehavior === "none") keepProportion = this.keepRatio(); else keepProportion = this.keepRatio() || e.shiftKey; let centeredScaling = this.centeredScaling() || e.altKey; let anchorProjected = false; if (this._movingAnchorName === "top-left") { if (keepProportion) { anchorProjected = true; const comparePoint = centeredScaling ? { x: this.width() / 2, y: this.height() / 2 } : { x: this._anchors["bottom-right"].x(), y: this._anchors["bottom-right"].y() }; newHypotenuse = Math.sqrt(Math.pow(comparePoint.x - anchorNode.x(), 2) + Math.pow(comparePoint.y - anchorNode.y(), 2)); const reverseX = this._anchors["top-left"].x() > comparePoint.x ? -1 : 1; const reverseY = this._anchors["top-left"].y() > comparePoint.y ? -1 : 1; x = newHypotenuse * this.cos * reverseX; y = newHypotenuse * this.sin * reverseY; this._anchors["top-left"].x(comparePoint.x - x); this._anchors["top-left"].y(comparePoint.y - y); } } else if (this._movingAnchorName === "top-center") this._anchors["top-left"].y(anchorNode.y()); else if (this._movingAnchorName === "top-right") { if (keepProportion) { anchorProjected = true; const comparePoint = centeredScaling ? { x: this.width() / 2, y: this.height() / 2 } : { x: this._anchors["bottom-left"].x(), y: this._anchors["bottom-left"].y() }; newHypotenuse = Math.sqrt(Math.pow(anchorNode.x() - comparePoint.x, 2) + Math.pow(comparePoint.y - anchorNode.y(), 2)); const reverseX = this._anchors["top-right"].x() < comparePoint.x ? -1 : 1; const reverseY = this._anchors["top-right"].y() > comparePoint.y ? -1 : 1; x = newHypotenuse * this.cos * reverseX; y = newHypotenuse * this.sin * reverseY; this._anchors["top-right"].x(comparePoint.x + x); this._anchors["top-right"].y(comparePoint.y - y); } var pos = anchorNode.position(); this._anchors["top-left"].y(pos.y); this._anchors["bottom-right"].x(pos.x); } else if (this._movingAnchorName === "middle-left") this._anchors["top-left"].x(anchorNode.x()); else if (this._movingAnchorName === "middle-right") this._anchors["bottom-right"].x(anchorNode.x()); else if (this._movingAnchorName === "bottom-left") { if (keepProportion) { anchorProjected = true; const comparePoint = centeredScaling ? { x: this.width() / 2, y: this.height() / 2 } : { x: this._anchors["top-right"].x(), y: this._anchors["top-right"].y() }; newHypotenuse = Math.sqrt(Math.pow(comparePoint.x - anchorNode.x(), 2) + Math.pow(anchorNode.y() - comparePoint.y, 2)); const reverseX = comparePoint.x < anchorNode.x() ? -1 : 1; const reverseY = anchorNode.y() < comparePoint.y ? -1 : 1; x = newHypotenuse * this.cos * reverseX; y = newHypotenuse * this.sin * reverseY; anchorNode.x(comparePoint.x - x); anchorNode.y(comparePoint.y + y); } pos = anchorNode.position(); this._anchors["top-left"].x(pos.x); this._anchors["bottom-right"].y(pos.y); } else if (this._movingAnchorName === "bottom-center") this._anchors["bottom-right"].y(anchorNode.y()); else if (this._movingAnchorName === "bottom-right") { if (keepProportion) { anchorProjected = true; const comparePoint = centeredScaling ? { x: this.width() / 2, y: this.height() / 2 } : { x: this._anchors["top-left"].x(), y: this._anchors["top-left"].y() }; newHypotenuse = Math.sqrt(Math.pow(anchorNode.x() - comparePoint.x, 2) + Math.pow(anchorNode.y() - comparePoint.y, 2)); const reverseX = this._anchors["bottom-right"].x() < comparePoint.x ? -1 : 1; const reverseY = this._anchors["bottom-right"].y() < comparePoint.y ? -1 : 1; x = newHypotenuse * this.cos * reverseX; y = newHypotenuse * this.sin * reverseY; this._anchors["bottom-right"].x(comparePoint.x + x); this._anchors["bottom-right"].y(comparePoint.y + y); } } else console.error(/* @__PURE__ */ new Error("Wrong position argument of selection resizer: " + this._movingAnchorName)); centeredScaling = this.centeredScaling() || e.altKey; if (centeredScaling) { const topLeft = this._anchors["top-left"]; const bottomRight = this._anchors["bottom-right"]; const topOffsetX = topLeft.x(); const topOffsetY = topLeft.y(); const bottomOffsetX = this.getWidth() - bottomRight.x(); const bottomOffsetY = this.getHeight() - bottomRight.y(); bottomRight.move({ x: -topOffsetX, y: -topOffsetY }); topLeft.move({ x: bottomOffsetX, y: bottomOffsetY }); } const absPos = this._anchors["top-left"].getAbsolutePosition(); x = absPos.x; y = absPos.y; const width = this._anchors["bottom-right"].x() - this._anchors["top-left"].x(); const height = this._anchors["bottom-right"].y() - this._anchors["top-left"].y(); this._fitNodesInto({ x, y, width, height, rotation: Konva$2.getAngle(this.rotation()) }, e, anchorProjected); } _handleMouseUp(e) { const stage = this.getStage(); if (stage) { stage.setPointersPositions(e); if (!stage._changedPointerPositions.some((p) => p.id === this._pointerId)) return; } if (stage) stage._batchEvents(() => this._removeEvents(e)); else this._removeEvents(e); } getAbsoluteTransform(top) { const at = this.getTransform(); return top ? top.getAbsoluteTransform().copy().invert().multiply(at) : at; } _removeEvents(e) { var _a, _b; if (this._transforming) { this._transforming = false; const content = (_a = this.getStage()) === null || _a === void 0 ? void 0 : _a.content; if (content && !this._cursorChange) content.style.cursor = ""; const win = this._transformWindow; this._transformWindow = null; if (win) { win.removeEventListener("mousemove", this._handleMouseMove); win.removeEventListener("touchmove", this._handleMouseMove); win.removeEventListener("mouseup", this._handleMouseUp, true); win.removeEventListener("touchend", this._handleMouseUp, true); win.removeEventListener("touchcancel", this._handleMouseUp, true); } const node = this.getNode(); activeTransformers.delete(this); this._fire("transformend", { evt: e, target: node }); (_b = this.getLayer()) === null || _b === void 0 || _b.batchDraw(); if (node) this._nodes.forEach((target) => { var _a; target._fire("transformend", { evt: e, target }); (_a = target.getLayer()) === null || _a === void 0 || _a.batchDraw(); }); this._movingAnchorName = null; } } _fitNodesInto(newAttrs, evt, anchorProjected = false) { this._fitting = true; try { return this._doFitNodesInto(newAttrs, evt, anchorProjected); } finally { this._fitting = false; } } _doFitNodesInto(newAttrs, evt, anchorProjected = false) { const oldAttrs = this._getNodeRect(); const minSize = 1; if (!oldAttrs.width || !oldAttrs.height || Util._inRange(newAttrs.width, -this.padding() * 2 - minSize, minSize) || Util._inRange(newAttrs.height, -this.padding() * 2 - minSize, minSize)) { this.update(); return; } const t = new Transform(); t.rotate(Konva$2.getAngle(this.rotation())); const flipPadding = anchorProjected ? 0 : this.padding() * 2; let widthFlip = null; let heightFlip = null; if (this._movingAnchorName && newAttrs.width < 0 && this._movingAnchorName.indexOf("left") >= 0) { const offset = t.point({ x: -flipPadding, y: 0 }); newAttrs.x += offset.x; newAttrs.y += offset.y; newAttrs.width += flipPadding; widthFlip = { axis: "width", from: "left", to: "right", offset }; } else if (this._movingAnchorName && newAttrs.width < 0 && this._movingAnchorName.indexOf("right") >= 0) { const offset = t.point({ x: flipPadding, y: 0 }); newAttrs.width += flipPadding; widthFlip = { axis: "width", from: "right", to: "left", offset }; } if (this._movingAnchorName && newAttrs.height < 0 && this._movingAnchorName.indexOf("top") >= 0) { const offset = t.point({ x: 0, y: -flipPadding }); newAttrs.x += offset.x; newAttrs.y += offset.y; newAttrs.height += flipPadding; heightFlip = { axis: "height", from: "top", to: "bottom", offset }; } else if (this._movingAnchorName && newAttrs.height < 0 && this._movingAnchorName.indexOf("bottom") >= 0) { const offset = t.point({ x: 0, y: flipPadding }); newAttrs.height += flipPadding; heightFlip = { axis: "height", from: "bottom", to: "top", offset }; } if (this.boundBoxFunc()) { const bounded = this.boundBoxFunc()(oldAttrs, newAttrs); if (bounded) newAttrs = bounded; else Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!"); } for (const flip of [widthFlip, heightFlip]) if (flip && newAttrs[flip.axis] < 0 && this._movingAnchorName) { this._movingAnchorName = this._movingAnchorName.replace(flip.from, flip.to); this._anchorDragOffset.x -= flip.offset.x; this._anchorDragOffset.y -= flip.offset.y; } const baseSize = 1e7; const oldTr = new Transform(); oldTr.translate(oldAttrs.x, oldAttrs.y); oldTr.rotate(oldAttrs.rotation); oldTr.scale(oldAttrs.width / baseSize, oldAttrs.height / baseSize); const newTr = new Transform(); const newScaleX = newAttrs.width / baseSize; const newScaleY = newAttrs.height / baseSize; if (this.flipEnabled() === false) { newTr.translate(newAttrs.x, newAttrs.y); newTr.rotate(newAttrs.rotation); newTr.translate(newAttrs.width < 0 ? newAttrs.width : 0, newAttrs.height < 0 ? newAttrs.height : 0); newTr.scale(Math.abs(newScaleX), Math.abs(newScaleY)); } else { newTr.translate(newAttrs.x, newAttrs.y); newTr.rotate(newAttrs.rotation); newTr.scale(newScaleX, newScaleY); } const delta = newTr.multiply(oldTr.invert()); const layersToDraw = /* @__PURE__ */ new Set(); this._nodes.forEach((node) => { if (!node.getStage()) return; const parentTransform = node.getParent().getAbsoluteTransform(); const localTransform = node.getTransform().copy(); localTransform.translate(node.offsetX(), node.offsetY()); const newLocalTransform = new Transform(); newLocalTransform.multiply(parentTransform.copy().invert()).multiply(delta).multiply(parentTransform).multiply(localTransform); const attrs = newLocalTransform.decompose(); node.setAttrs(attrs); const layer = node.getLayer(); if (layer) layersToDraw.add(layer); }); this.rotation(Util._getRotation(newAttrs.rotation)); this._nodes.forEach((node) => { this._fire("transform", { evt, target: node }); node._fire("transform", { evt, target: node }); }); this._resetTransformCache(); this.update(); layersToDraw.add(this.getLayer()); layersToDraw.forEach((layer) => layer && layer.batchDraw()); } _scheduleUpdate() { this._updatePending = true; Node._runAfterUpdateBatch(this._syncUpdate); } /** * force update of Konva.Transformer. * The transformer follows attribute changes of attached nodes and, for an attached group, any change of its descendants. * Use it after a change that sets no attribute, for example a `Line` points array mutated in place * or a custom `getSelfRect()` that depends on outside state. * @method * @name Konva.Transformer#forceUpdate */ forceUpdate() { this._resetTransformCache(); this.update(); } update() { this._lastNodeRect = void 0; this._update(); } _update() { var _a; this._updatePending = false; const attrs = this._getNodeRect(); this._updateElements(attrs); const draggable = this.nodes().some((node) => node.draggable()); if (this._back.draggable() !== draggable) this._back.draggable(draggable); const styleFunc = this.anchorStyleFunc(); if (styleFunc) Object.values(this._anchors).forEach((node) => node.hasName("_anchor") && styleFunc(node)); (_a = this.getLayer()) === null || _a === void 0 || _a.batchDraw(); } _updateElements(attrs) { const previous = this._lastNodeRect; if (previous && !this.anchorStyleFunc() && attrs.x === previous.x && attrs.y === previous.y && attrs.width === previous.width && attrs.height === previous.height && attrs.rotation === previous.rotation) return; this._lastNodeRect = { ...attrs }; const width = attrs.width; const height = attrs.height; const enabledAnchors = this.enabledAnchors(); const resizeEnabled = this.resizeEnabled(); const padding = this.padding(); const anchorSize = this.anchorSize(); Object.values(this._anchors).filter((node) => node.hasName("_anchor")).forEach((node) => { node.setAttrs({ width: anchorSize, height: anchorSize, offsetX: anchorSize / 2, offsetY: anchorSize / 2, stroke: this.anchorStroke(), strokeWidth: this.anchorStrokeWidth(), fill: this.anchorFill(), cornerRadius: this.anchorCornerRadius() }); }); this._anchors["top-left"].setAttrs({ x: 0, y: 0, offsetX: anchorSize / 2 + padding, offsetY: anchorSize / 2 + padding, visible: resizeEnabled && enabledAnchors.indexOf("top-left") >= 0 }); this._anchors["top-center"].setAttrs({ x: width / 2, y: 0, offsetY: anchorSize / 2 + padding, visible: resizeEnabled && enabledAnchors.indexOf("top-center") >= 0 }); this._anchors["top-right"].setAttrs({ x: width, y: 0, offsetX: anchorSize / 2 - padding, offsetY: anchorSize / 2 + padding, visible: resizeEnabled && enabledAnchors.indexOf("top-right") >= 0 }); this._anchors["middle-left"].setAttrs({ x: 0, y: height / 2, offsetX: anchorSize / 2 + padding, visible: resizeEnabled && enabledAnchors.indexOf("middle-left") >= 0 }); this._anchors["middle-right"].setAttrs({ x: width, y: height / 2, offsetX: anchorSize / 2 - padding, visible: resizeEnabled && enabledAnchors.indexOf("middle-right") >= 0 }); this._anchors["bottom-left"].setAttrs({ x: 0, y: height, offsetX: anchorSize / 2 + padding, offsetY: anchorSize / 2 - padding, visible: resizeEnabled && enabledAnchors.indexOf("bottom-left") >= 0 }); this._anchors["bottom-center"].setAttrs({ x: width / 2, y: height, offsetY: anchorSize / 2 - padding, visible: resizeEnabled && enabledAnchors.indexOf("bottom-center") >= 0 }); this._anchors["bottom-right"].setAttrs({ x: width, y: height, offsetX: anchorSize / 2 - padding, offsetY: anchorSize / 2 - padding, visible: resizeEnabled && enabledAnchors.indexOf("bottom-right") >= 0 }); const rotateMode = this.rotateMode(); const rotaterLine = getRotaterLine(this, width, height); this._anchors["rotater"].setAttrs({ x: rotaterLine.endX, y: rotaterLine.endY, visible: this.rotateEnabled() && rotateMode !== "corners" }); const zoneSize = anchorSize * 2; const zonesVisible = this.rotateEnabled() && rotateMode !== "handle"; const near = -padding - zoneSize; ROTATE_ZONE_NAMES.forEach((name) => { this._anchors[name].setAttrs({ x: name.includes("left") ? near : width + padding, y: name.includes("top") ? near : height + padding, width: zoneSize, height: zoneSize, visible: zonesVisible }); }); this._back.setAttrs({ width, height, visible: this.borderEnabled() || this.shouldOverdrawWholeArea(), stroke: this.borderStroke(), strokeWidth: this.borderStrokeWidth(), dash: this.borderDash(), x: 0, y: 0 }); } /** * determine if transformer is in active transform * @method * @name Konva.Transformer#isTransforming * @returns {Boolean} */ isTransforming() { return this._transforming; } /** * Stop active transform action * @method * @name Konva.Transformer#stopTransform * @returns {Boolean} */ stopTransform() { if (this._transforming) this._removeEvents(); } destroy() { if (this.getStage() && this._cursorChange) this.getStage().content && (this.getStage().content.style.cursor = ""); Group$1.prototype.destroy.call(this); this.detach(); this._removeEvents(); return this; } add(...children) { if (this._elementsCreated) { Util.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."); return this; } return super.add(...children); } toObject() { return Node.prototype.toObject.call(this); } clone(obj) { return Node.prototype.clone.call(this, obj); } getClientRect(config) { this._syncUpdate(); if (this.nodes().length > 0) return super.getClientRect(config); else return { x: 0, y: 0, width: 0, height: 0 }; } }; Transformer$1.isTransforming = () => { return activeTransformers.size > 0; }; function validateAnchors(val) { if (!(val instanceof Array)) Util.warn("enabledAnchors value should be an array"); if (val instanceof Array) val.forEach(function(name) { if (ANCHORS_NAMES.indexOf(name) === -1) Util.warn("Unknown anchor name: " + name + ". Available names are: " + ANCHORS_NAMES.join(", ")); }); return val || []; } Transformer$1.prototype.className = "Transformer"; _registerNode(Transformer$1); /** * get/set enabled handlers * @name Konva.Transformer#enabledAnchors * @method * @param {Array} array * @returns {Array} * @example * // get list of handlers * var enabledAnchors = transformer.enabledAnchors(); * * // set handlers * transformer.enabledAnchors(['top-left', 'top-center', 'top-right', 'middle-right', 'middle-left', 'bottom-left', 'bottom-center', 'bottom-right']); */ Factory.addGetterSetter(Transformer$1, "enabledAnchors", ANCHORS_NAMES, validateAnchors); /** * get/set flip enabled * @name Konva.Transformer#flipEnabled * @method * @param {Boolean} flag * @returns {Boolean} * @example * // get flip enabled property * var flipEnabled = transformer.flipEnabled(); * * // set flip enabled property * transformer.flipEnabled(false); */ Factory.addGetterSetter(Transformer$1, "flipEnabled", true, getBooleanValidator()); /** * get/set resize ability. If false it will automatically hide resizing handlers * @name Konva.Transformer#resizeEnabled * @method * @param {Boolean} enabled * @returns {Boolean} * @example * // get * var resizeEnabled = transformer.resizeEnabled(); * * // set * transformer.resizeEnabled(false); */ Factory.addGetterSetter(Transformer$1, "resizeEnabled", true); /** * get/set anchor size. Default is 10 * @name Konva.Transformer#anchorSize * @method * @param {Number} size * @returns {Number} * @example * // get * var anchorSize = transformer.anchorSize(); * * // set * transformer.anchorSize(20) */ Factory.addGetterSetter(Transformer$1, "anchorSize", 10, getNumberValidator()); /** * get/set ability to rotate. * @name Konva.Transformer#rotateEnabled * @method * @param {Boolean} enabled * @returns {Boolean} * @example * // get * var rotateEnabled = transformer.rotateEnabled(); * * // set * transformer.rotateEnabled(false); */ Factory.addGetterSetter(Transformer$1, "rotateEnabled", true); /** * get/set visibility of a little line that connects transformer and rotate anchor. * @name Konva.Transformer#rotateLineVisible * @method * @param {Boolean} enabled * @returns {Boolean} * @example * // get * var rotateLineVisible = transformer.rotateLineVisible(); * * // set * transformer.rotateLineVisible(false); */ Factory.addGetterSetter(Transformer$1, "rotateLineVisible", true); /** * get/set rotation snaps angles. * @name Konva.Transformer#rotationSnaps * @method * @param {Array} array * @returns {Array} * @example * // get * var rotationSnaps = transformer.rotationSnaps(); * * // set * transformer.rotationSnaps([0, 90, 180, 270]); */ Factory.addGetterSetter(Transformer$1, "rotationSnaps", []); /** * get/set distance for rotation handler * @name Konva.Transformer#rotateAnchorOffset * @method * @param {Number} offset * @returns {Number} * @example * // get * var rotateAnchorOffset = transformer.rotateAnchorOffset(); * * // set * transformer.rotateAnchorOffset(100); */ Factory.addGetterSetter(Transformer$1, "rotateAnchorOffset", 50, getNumberValidator()); /** * get/set the angle (in degrees) of the rotation anchor position around the bounding box. * 0 = top-center (default), 90 = middle-right, 180 = bottom-center, -90 = middle-left * @name Konva.Transformer#rotateAnchorAngle * @method * @param {Number} angle * @returns {Number} * @example * // get * var rotateAnchorAngle = transformer.rotateAnchorAngle(); * * // set rotation anchor to the right side * transformer.rotateAnchorAngle(90); * * // set rotation anchor to the bottom * transformer.rotateAnchorAngle(180); */ Factory.addGetterSetter(Transformer$1, "rotateAnchorAngle", 0, getNumberValidator()); /** * get/set rotation anchor cursor * @name Konva.Transformer#rotateAnchorCursor * @method * @param {String} cursorName * @returns {String} * @example * // get * var currentRotationAnchorCursor = transformer.rotateAnchorCursor(); * * // set * transformer.rotateAnchorCursor('grab'); */ Factory.addGetterSetter(Transformer$1, "rotateAnchorCursor", "crosshair"); /** * get/set how the user rotates the nodes. 'handle' shows the rotate anchor, * 'corners' makes invisible zones just outside the box corners rotate, * 'both' enables both. Hold Shift while rotating to snap to 15 degree steps, unless shiftBehavior is 'none'. * While a corner zone rotates, `getActiveAnchor()` returns its name, such as 'rotater-top-left'. * @name Konva.Transformer#rotateMode * @method * @param {String} mode * @returns {String} * @example * // get * var rotateMode = transformer.rotateMode(); * * // set * transformer.rotateMode('corners'); */ Factory.addGetterSetter(Transformer$1, "rotateMode", "handle"); /** * get/set distance for rotation tolerance * @name Konva.Transformer#rotationSnapTolerance * @method * @param {Number} tolerance * @returns {Number} * @example * // get * var rotationSnapTolerance = transformer.rotationSnapTolerance(); * * // set * transformer.rotationSnapTolerance(100); */ Factory.addGetterSetter(Transformer$1, "rotationSnapTolerance", 5, getNumberValidator()); /** * get/set visibility of border * @name Konva.Transformer#borderEnabled * @method * @param {Boolean} enabled * @returns {Boolean} * @example * // get * var borderEnabled = transformer.borderEnabled(); * * // set * transformer.borderEnabled(false); */ Factory.addGetterSetter(Transformer$1, "borderEnabled", true); /** * get/set anchor stroke color * @name Konva.Transformer#anchorStroke * @method * @param {String} strokeColor * @returns {String} * @example * // get * var anchorStroke = transformer.anchorStroke(); * * // set * transformer.anchorStroke('red'); */ Factory.addGetterSetter(Transformer$1, "anchorStroke", "rgb(0, 161, 255)"); /** * get/set anchor stroke width * @name Konva.Transformer#anchorStrokeWidth * @method * @param {Number} anchorStrokeWidth * @returns {Number} * @example * // get * var anchorStrokeWidth = transformer.anchorStrokeWidth(); * * // set * transformer.anchorStrokeWidth(3); */ Factory.addGetterSetter(Transformer$1, "anchorStrokeWidth", 1, getNumberValidator()); /** * get/set anchor fill color * @name Konva.Transformer#anchorFill * @method * @param {String} anchorFill * @returns {String} * @example * // get * var anchorFill = transformer.anchorFill(); * * // set * transformer.anchorFill('red'); */ Factory.addGetterSetter(Transformer$1, "anchorFill", "white"); /** * get/set anchor corner radius * @name Konva.Transformer#anchorCornerRadius * @method * @param {Number} radius * @returns {Number} * @example * // get * var anchorCornerRadius = transformer.anchorCornerRadius(); * * // set * transformer.anchorCornerRadius(3); */ Factory.addGetterSetter(Transformer$1, "anchorCornerRadius", 0, getNumberValidator()); /** * get/set border stroke color * @name Konva.Transformer#borderStroke * @method * @param {Boolean} enabled * @returns {Boolean} * @example * // get * var borderStroke = transformer.borderStroke(); * * // set * transformer.borderStroke('red'); */ Factory.addGetterSetter(Transformer$1, "borderStroke", "rgb(0, 161, 255)"); /** * get/set border stroke width * @name Konva.Transformer#borderStrokeWidth * @method * @param {Number} strokeWidth * @returns {Number} * @example * // get * var borderStrokeWidth = transformer.borderStrokeWidth(); * * // set * transformer.borderStrokeWidth(3); */ Factory.addGetterSetter(Transformer$1, "borderStrokeWidth", 1, getNumberValidator()); /** * get/set border dash array * @name Konva.Transformer#borderDash * @method * @param {Array} dash array * @returns {Array} * @example * // get * var borderDash = transformer.borderDash(); * * // set * transformer.borderDash([2, 2]); */ Factory.addGetterSetter(Transformer$1, "borderDash"); /** * get/set should we keep ratio while resize anchors at corners * @name Konva.Transformer#keepRatio * @method * @param {Boolean} keepRatio * @returns {Boolean} * @example * // get * var keepRatio = transformer.keepRatio(); * * // set * transformer.keepRatio(false); */ Factory.addGetterSetter(Transformer$1, "keepRatio", true); /** * get/set how to react on skift key while resizing anchors at corners * @name Konva.Transformer#shiftBehavior * @method * @param {String} shiftBehavior * @returns {String} * @example * // get * var shiftBehavior = transformer.shiftBehavior(); * * // set * transformer.shiftBehavior('none'); */ Factory.addGetterSetter(Transformer$1, "shiftBehavior", "default"); /** * get/set should we resize relative to node's center? * @name Konva.Transformer#centeredScaling * @method * @param {Boolean} centeredScaling * @returns {Boolean} * @example * // get * var centeredScaling = transformer.centeredScaling(); * * // set * transformer.centeredScaling(true); */ Factory.addGetterSetter(Transformer$1, "centeredScaling", false); /** * get/set should we think about stroke while resize? Good to use when a shape has strokeScaleEnabled = false * default is false * @name Konva.Transformer#ignoreStroke * @method * @param {Boolean} ignoreStroke * @returns {Boolean} * @example * // get * var ignoreStroke = transformer.ignoreStroke(); * * // set * transformer.ignoreStroke(true); */ Factory.addGetterSetter(Transformer$1, "ignoreStroke", false); /** * get/set padding * @name Konva.Transformer#padding * @method * @param {Number} padding * @returns {Number} * @example * // get * var padding = transformer.padding(); * * // set * transformer.padding(10); */ Factory.addGetterSetter(Transformer$1, "padding", 0, getNumberValidator()); /** * get/set attached nodes of the Transformer. Transformer will adapt to their size and listen to their events * @method * @name Konva.Transformer#nodes * @returns {Konva.Node} * @example * // get * const nodes = transformer.nodes(); * * // set * transformer.nodes([rect, circle]); * * // push new item: * const oldNodes = transformer.nodes(); * const newNodes = oldNodes.concat([newShape]); * // it is important to set new array instance (and concat method above will create it) * transformer.nodes(newNodes); */ Factory.addGetterSetter(Transformer$1, "nodes"); Factory.addGetterSetter(Transformer$1, "node"); /** * get/set bounding box function. **IMPORTANT!** boundBoxFunc operates in absolute coordinates. * Both boxes are `{ x, y, width, height, rotation }`, with the rotation in radians. * @name Konva.Transformer#boundBoxFunc * @method * @param {Function} func * @returns {Function} * @example * // get * var boundBoxFunc = transformer.boundBoxFunc(); * * // set * transformer.boundBoxFunc(function(oldBox, newBox) { * // width and height of the boxes are corresponding to total absolute width and height of all nodes combined * // so it includes scale of the node. * if (newBox.width > 200) { * return oldBox; * } * return newBox; * }); */ Factory.addGetterSetter(Transformer$1, "boundBoxFunc"); /** * get/set dragging func for transformer anchors * @name Konva.Transformer#anchorDragBoundFunc * @method * @param {Function} func * @returns {Function} * @example * // get * var anchorDragBoundFunc = transformer.anchorDragBoundFunc(); * * // set * transformer.anchorDragBoundFunc(function(oldAbsPos, newAbsPos, event) { * return { * x: 0, * y: newAbsolutePosition.y * } * }); */ Factory.addGetterSetter(Transformer$1, "anchorDragBoundFunc"); /** * get/set styling function for transformer anchors to overwrite default styles * @name Konva.Transformer#anchorStyleFunc * @method * @param {Function} func * @returns {Function} * @example * // get * var anchorStyleFunc = transformer.anchorStyleFunc(); * * // set * transformer.anchorStyleFunc(function(anchor) { * // anchor is a simple Konva.Rect instance * // it will be executed AFTER all attributes are set, like 'anchorStrokeWidth' or 'anchorFill' * if (anchor.hasName('rotater')) { * // make rotater anchor filled black and looks like a circle * anchor.fill('black'); * anchor.cornerRadius(anchor.width() / 2); * } * }); */ Factory.addGetterSetter(Transformer$1, "anchorStyleFunc"); /** * using this setting you can drag transformer group by dragging empty space between attached nodes * shouldOverdrawWholeArea = true may temporary disable all events on attached nodes * @name Konva.Transformer#shouldOverdrawWholeArea * @method * @param {Boolean} shouldOverdrawWholeArea * @returns {Boolean} * @example * // get * var shouldOverdrawWholeArea = transformer.shouldOverdrawWholeArea(); * * // set * transformer.shouldOverdrawWholeArea(true); */ Factory.addGetterSetter(Transformer$1, "shouldOverdrawWholeArea", false); /** * If you have just one attached node to Transformer it will set its initial rotation to the rotation of that node. * In some cases you may need to set a different rotation. * @name Konva.Transformer#useSingleNodeRotation * @method * @param {Boolean} useSingleNodeRotation * @returns {Boolean} * @example * // set flag to false * transformer.useSingleNodeRotation(false); * // attach a shape * transformer.nodes([shape]); * transformer.rotation(45); * transformer.update(); */ Factory.addGetterSetter(Transformer$1, "useSingleNodeRotation", true); Factory.backCompat(Transformer$1, { lineEnabled: "borderEnabled", rotateHandlerOffset: "rotateAnchorOffset", enabledHandlers: "enabledAnchors" }); //#endregion //#region node_modules/konva/lib/shapes/Wedge.js /** * Wedge constructor * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {Number} config.angle in degrees * @param {Number} config.radius * @param {Boolean} [config.clockwise] * @@shapeParams * @@nodeParams * @example * // draw a wedge that's pointing downwards * var wedge = new Konva.Wedge({ * radius: 40, * fill: 'red', * stroke: 'black', * strokeWidth: 5, * angle: 60, * rotation: -120 * }); */ var Wedge$1 = class extends Shape$1 { _sceneFunc(context) { context.beginPath(); context.arc(0, 0, Math.abs(this.radius()), 0, Konva$2.getAngle(this.angle()), this.clockwise()); context.lineTo(0, 0); context.closePath(); context.fillStrokeShape(this); } getWidth() { return Math.abs(this.radius()) * 2; } getHeight() { return Math.abs(this.radius()) * 2; } setWidth(width) { this.radius(width / 2); } setHeight(height) { this.radius(height / 2); } }; Wedge$1.prototype.className = "Wedge"; Wedge$1.prototype._centroid = true; Wedge$1.prototype._attrsAffectingSize = ["radius"]; _registerNode(Wedge$1, true); /** * get/set radius * @name Konva.Wedge#radius * @method * @param {Number} radius * @returns {Number} * @example * // get radius * var radius = wedge.radius(); * * // set radius * wedge.radius(10); */ Factory.addGetterSetter(Wedge$1, "radius", 0, getNumberValidator()); /** * get/set angle in degrees * @name Konva.Wedge#angle * @method * @param {Number} angle * @returns {Number} * @example * // get angle * var angle = wedge.angle(); * * // set angle * wedge.angle(20); */ Factory.addGetterSetter(Wedge$1, "angle", 0, getNumberValidator()); /** * get/set clockwise flag * @name Konva.Wedge#clockwise * @method * @param {Boolean} clockwise * @returns {Boolean} * @example * // get clockwise flag * var clockwise = wedge.clockwise(); * * // draw wedge counter-clockwise * wedge.clockwise(false); * * // draw wedge clockwise * wedge.clockwise(true); */ Factory.addGetterSetter(Wedge$1, "clockwise", false); Factory.backCompat(Wedge$1, { angleDeg: "angle", getAngleDeg: "getAngle", setAngleDeg: "setAngle" }); //#endregion //#region node_modules/konva/lib/filters/Blur.js /* StackBlur - a fast almost Gaussian Blur For Canvas Version: 0.5 Author: Mario Klingemann Contact: mario@quasimondo.com Website: http://www.quasimondo.com/StackBlurForCanvas Twitter: @quasimondo In case you find this class useful - especially in commercial projects - I am not totally unhappy for a small donation to my PayPal account mario@quasimondo.de Or support me on flattr: https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript Copyright (c) 2010 Mario Klingemann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * @license MIT */ function BlurStack() { this.r = 0; this.g = 0; this.b = 0; this.a = 0; this.next = null; } var mul_table = [ 512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259 ]; var shg_table = [ 9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 ]; function premultiply(channel, alpha) { return alpha === 255 ? channel : channel * alpha / 255; } var MAX_RADIUS = 180; function filterGaussBlurRGBA(imageData, radius) { const pixels = imageData.data, width = imageData.width, height = imageData.height; let p, yi, yw, r_sum, g_sum, b_sum, a_sum, r_out_sum, g_out_sum, b_out_sum, a_out_sum, r_in_sum, g_in_sum, b_in_sum, a_in_sum, pr, pg, pb, pa, rbs; const div = radius + radius + 1, widthMinus1 = width - 1, heightMinus1 = height - 1, radiusPlus1 = radius + 1, sumFactor = radiusPlus1 * (radiusPlus1 + 1) / 2, stackStart = new BlurStack(), normalization = radius <= MAX_RADIUS ? mul_table[radius] / 2 ** shg_table[radius] : 1 / (radiusPlus1 * radiusPlus1); let stackEnd = null, stack = stackStart, stackIn = null, stackOut = null; for (let i = 1; i < div; i++) { stack = stack.next = new BlurStack(); if (i === radiusPlus1) stackEnd = stack; } stack.next = stackStart; yw = yi = 0; for (let y = 0; y < height; y++) { r_in_sum = g_in_sum = b_in_sum = a_in_sum = r_sum = g_sum = b_sum = a_sum = 0; pa = pixels[yi + 3]; pr = premultiply(pixels[yi], pa); pg = premultiply(pixels[yi + 1], pa); pb = premultiply(pixels[yi + 2], pa); r_out_sum = radiusPlus1 * pr; g_out_sum = radiusPlus1 * pg; b_out_sum = radiusPlus1 * pb; a_out_sum = radiusPlus1 * pa; r_sum += sumFactor * pr; g_sum += sumFactor * pg; b_sum += sumFactor * pb; a_sum += sumFactor * pa; stack = stackStart; for (let i = 0; i < radiusPlus1; i++) { stack.r = pr; stack.g = pg; stack.b = pb; stack.a = pa; stack = stack.next; } for (let i = 1; i < radiusPlus1; i++) { p = yi + ((widthMinus1 < i ? widthMinus1 : i) << 2); pa = pixels[p + 3]; r_sum += (stack.r = pr = premultiply(pixels[p], pa)) * (rbs = radiusPlus1 - i); g_sum += (stack.g = pg = premultiply(pixels[p + 1], pa)) * rbs; b_sum += (stack.b = pb = premultiply(pixels[p + 2], pa)) * rbs; a_sum += (stack.a = pa) * rbs; r_in_sum += pr; g_in_sum += pg; b_in_sum += pb; a_in_sum += pa; stack = stack.next; } stackIn = stackStart; stackOut = stackEnd; for (let x = 0; x < width; x++) { pixels[yi] = Math.floor(r_sum * normalization); pixels[yi + 1] = Math.floor(g_sum * normalization); pixels[yi + 2] = Math.floor(b_sum * normalization); pixels[yi + 3] = Math.floor(a_sum * normalization); r_sum -= r_out_sum; g_sum -= g_out_sum; b_sum -= b_out_sum; a_sum -= a_out_sum; r_out_sum -= stackIn.r; g_out_sum -= stackIn.g; b_out_sum -= stackIn.b; a_out_sum -= stackIn.a; p = yw + ((p = x + radius + 1) < widthMinus1 ? p : widthMinus1) << 2; pa = pixels[p + 3]; r_in_sum += stackIn.r = premultiply(pixels[p], pa); g_in_sum += stackIn.g = premultiply(pixels[p + 1], pa); b_in_sum += stackIn.b = premultiply(pixels[p + 2], pa); a_in_sum += stackIn.a = pa; r_sum += r_in_sum; g_sum += g_in_sum; b_sum += b_in_sum; a_sum += a_in_sum; stackIn = stackIn.next; r_out_sum += pr = stackOut.r; g_out_sum += pg = stackOut.g; b_out_sum += pb = stackOut.b; a_out_sum += pa = stackOut.a; r_in_sum -= pr; g_in_sum -= pg; b_in_sum -= pb; a_in_sum -= pa; stackOut = stackOut.next; yi += 4; } yw += width; } for (let x = 0; x < width; x++) { g_in_sum = b_in_sum = a_in_sum = r_in_sum = g_sum = b_sum = a_sum = r_sum = 0; yi = x << 2; r_out_sum = radiusPlus1 * (pr = pixels[yi]); g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]); b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]); a_out_sum = radiusPlus1 * (pa = pixels[yi + 3]); r_sum += sumFactor * pr; g_sum += sumFactor * pg; b_sum += sumFactor * pb; a_sum += sumFactor * pa; stack = stackStart; for (let i = 0; i < radiusPlus1; i++) { stack.r = pr; stack.g = pg; stack.b = pb; stack.a = pa; stack = stack.next; } let yp = Math.min(1, heightMinus1) * width; for (let i = 1; i <= radius; i++) { yi = yp + x << 2; r_sum += (stack.r = pr = pixels[yi]) * (rbs = radiusPlus1 - i); g_sum += (stack.g = pg = pixels[yi + 1]) * rbs; b_sum += (stack.b = pb = pixels[yi + 2]) * rbs; a_sum += (stack.a = pa = pixels[yi + 3]) * rbs; r_in_sum += pr; g_in_sum += pg; b_in_sum += pb; a_in_sum += pa; stack = stack.next; if (i < heightMinus1) yp += width; } yi = x; stackIn = stackStart; stackOut = stackEnd; for (let y = 0; y < height; y++) { p = yi << 2; pixels[p + 3] = pa = Math.floor(a_sum * normalization); if (pa > 0) { pa = 255 / pa; pixels[p] = Math.floor(r_sum * normalization) * pa; pixels[p + 1] = Math.floor(g_sum * normalization) * pa; pixels[p + 2] = Math.floor(b_sum * normalization) * pa; } else pixels[p] = pixels[p + 1] = pixels[p + 2] = 0; r_sum -= r_out_sum; g_sum -= g_out_sum; b_sum -= b_out_sum; a_sum -= a_out_sum; r_out_sum -= stackIn.r; g_out_sum -= stackIn.g; b_out_sum -= stackIn.b; a_out_sum -= stackIn.a; p = x + ((p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1) * width << 2; r_sum += r_in_sum += stackIn.r = pixels[p]; g_sum += g_in_sum += stackIn.g = pixels[p + 1]; b_sum += b_in_sum += stackIn.b = pixels[p + 2]; a_sum += a_in_sum += stackIn.a = pixels[p + 3]; stackIn = stackIn.next; r_out_sum += pr = stackOut.r; g_out_sum += pg = stackOut.g; b_out_sum += pb = stackOut.b; a_out_sum += pa = stackOut.a; r_in_sum -= pr; g_in_sum -= pg; b_in_sum -= pb; a_in_sum -= pa; stackOut = stackOut.next; yi += width; } } } /** * Blur Filter * @function * @name Blur * @memberof Konva.Filters * @param {Object} imageData * @example * node.cache(); * node.filters([Konva.Filters.Blur]); * node.blurRadius(10); */ var Blur = function Blur(imageData, pixelRatio = 1) { const radius = Math.round(Math.min(this.blurRadius(), MAX_RADIUS) * pixelRatio); if (radius > 0) filterGaussBlurRGBA(imageData, radius); }; Factory.addGetterSetter(Node, "blurRadius", 0, getNumberValidator(), Factory.afterSetFilter); /** * get/set blur radius. Use with {@link Konva.Filters.Blur} filter * @name Konva.Node#blurRadius * @method * @param {Integer} radius * @returns {Integer} */ //#endregion //#region node_modules/konva/lib/filters/Brighten.js /** * Brighten Filter. * @deprecated Use {@link Konva.Filters.Brightness} instead for CSS-compatible behavior. * This filter uses additive brightness adjustment (adds a constant value to RGB channels). * @function * @memberof Konva.Filters * @param {Object} imageData * @example * node.cache(); * node.filters([Konva.Filters.Brighten]); * node.brightness(0.8); */ var Brighten = function(imageData) { const brightness = this.brightness() * 255, data = imageData.data, len = data.length; for (let i = 0; i < len; i += 4) { data[i] += brightness; data[i + 1] += brightness; data[i + 2] += brightness; } }; Factory.addGetterSetter(Node, "brightness", 0, getNumberValidator(), Factory.afterSetFilter); /** * get/set filter brightness. With {@link Konva.Filters.Brighten} it is a number between -1 and 1 * added to every channel: positive values brighten the pixels and negative values darken them. * With {@link Konva.Filters.Brightness} it is a CSS-like multiplier: 1 is no change, 1.5 is 50% brighter. * Both filters leave pixels unchanged when the attribute is unset. An explicit 0 makes Brightness black. * @name Konva.Node#brightness * @method * @param {Number} brightness * @returns {Number} */ //#endregion //#region node_modules/konva/lib/filters/Brightness.js /** * Brightness Filter. * CSS-compatible brightness multiplier. An unset brightness leaves pixels unchanged. * @function * @memberof Konva.Filters * @param {Object} imageData * @example * node.cache(); * node.filters([Konva.Filters.Brightness]); * node.brightness(1.5); // 50% brighter (CSS-compatible) */ var Brightness = function(imageData) { const brightness = this.attrs.brightness === void 0 ? 1 : this.brightness(), data = imageData.data, len = data.length; for (let i = 0; i < len; i += 4) { data[i] = Math.min(255, data[i] * brightness); data[i + 1] = Math.min(255, data[i + 1] * brightness); data[i + 2] = Math.min(255, data[i + 2] * brightness); } }; //#endregion //#region node_modules/konva/lib/filters/Contrast.js /** * Contrast Filter. * @function * @memberof Konva.Filters * @param {Object} imageData * @example * node.cache(); * node.filters([Konva.Filters.Contrast]); * node.contrast(10); */ var Contrast = function(imageData) { const adjust = Math.pow((this.contrast() + 100) / 100, 2); const data = imageData.data, nPixels = data.length; let red = 150, green = 150, blue = 150; for (let i = 0; i < nPixels; i += 4) { red = data[i]; green = data[i + 1]; blue = data[i + 2]; red /= 255; red -= .5; red *= adjust; red += .5; red *= 255; green /= 255; green -= .5; green *= adjust; green += .5; green *= 255; blue /= 255; blue -= .5; blue *= adjust; blue += .5; blue *= 255; red = red < 0 ? 0 : red > 255 ? 255 : red; green = green < 0 ? 0 : green > 255 ? 255 : green; blue = blue < 0 ? 0 : blue > 255 ? 255 : blue; data[i] = red; data[i + 1] = green; data[i + 2] = blue; } }; /** * get/set filter contrast. The contrast is a number between -100 and 100. * Use with {@link Konva.Filters.Contrast} filter. * @name Konva.Node#contrast * @method * @param {Number} contrast value between -100 and 100 * @returns {Number} */ Factory.addGetterSetter(Node, "contrast", 0, getNumberValidator(), Factory.afterSetFilter); //#endregion //#region node_modules/konva/lib/filters/Emboss.js /** * Emboss Filter. * @function * @memberof Konva.Filters * @param {Object} imageData * @example * node.cache(); * node.filters([Konva.Filters.Emboss]); * node.embossStrength(0.8); * node.embossWhiteLevel(0.3); * node.embossDirection('right'); * node.embossBlend(true); */ var Emboss = function(imageData) { var _a, _b, _c, _d, _e, _f, _g, _h, _j; const data = imageData.data; const w = imageData.width; const h = imageData.height; const strength01 = Math.min(1, Math.max(0, (_b = (_a = this.embossStrength) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : .5)); const whiteLevel01 = Math.min(1, Math.max(0, (_d = (_c = this.embossWhiteLevel) === null || _c === void 0 ? void 0 : _c.call(this)) !== null && _d !== void 0 ? _d : .5)); const directionDeg = (_g = { "top-left": 315, top: 270, "top-right": 225, right: 180, "bottom-right": 135, bottom: 90, "bottom-left": 45, left: 0 }[(_f = (_e = this.embossDirection) === null || _e === void 0 ? void 0 : _e.call(this)) !== null && _f !== void 0 ? _f : "top-left"]) !== null && _g !== void 0 ? _g : 315; const blend = !!((_j = (_h = this.embossBlend) === null || _h === void 0 ? void 0 : _h.call(this)) !== null && _j !== void 0 ? _j : false); const strength = strength01 * 10; const bias = whiteLevel01 * 255; const dirRad = directionDeg * Math.PI / 180; const cx = Math.cos(dirRad); const cy = Math.sin(dirRad); const SCALE = 128 / 1020 * strength; const lum = new Float32Array(w * h); for (let p = 0, i = 0; i < data.length; i += 4, p++) lum[p] = .2126 * data[i] + .7152 * data[i + 1] + .0722 * data[i + 2]; const Gx = [ -1, 0, 1, -2, 0, 2, -1, 0, 1 ]; const Gy = [ -1, -2, -1, 0, 0, 0, 1, 2, 1 ]; const clamp8 = (v) => v < 0 ? 0 : v > 255 ? 255 : v; for (let y = 0; y < h; y++) for (let x = 0; x < w; x++) { let sx = 0, sy = 0, k = 0; for (let dy = -1; dy <= 1; dy++) { const row = Math.max(0, Math.min(h - 1, y + dy)) * w; for (let dx = -1; dx <= 1; dx++, k++) { const sample = lum[row + Math.max(0, Math.min(w - 1, x + dx))]; sx += sample * Gx[k]; sy += sample * Gy[k]; } } const p = y * w + x; const outGray = clamp8(bias + (cx * sx + cy * sy) * SCALE); const o = p * 4; if (blend) { const delta = outGray - bias; data[o] = clamp8(data[o] + delta); data[o + 1] = clamp8(data[o + 1] + delta); data[o + 2] = clamp8(data[o + 2] + delta); } else data[o] = data[o + 1] = data[o + 2] = outGray; } return imageData; }; Factory.addGetterSetter(Node, "embossStrength", .5, getNumberValidator(), Factory.afterSetFilter); /** * get/set emboss strength. Use with {@link Konva.Filters.Emboss} filter. * @name Konva.Node#embossStrength * @method * @param {Number} level between 0 and 1. Default is 0.5 * @returns {Number} */ Factory.addGetterSetter(Node, "embossWhiteLevel", .5, getNumberValidator(), Factory.afterSetFilter); /** * get/set emboss white level. Use with {@link Konva.Filters.Emboss} filter. * @name Konva.Node#embossWhiteLevel * @method * @param {Number} embossWhiteLevel between 0 and 1. Default is 0.5 * @returns {Number} */ Factory.addGetterSetter(Node, "embossDirection", "top-left", void 0, Factory.afterSetFilter); /** * get/set emboss direction. Use with {@link Konva.Filters.Emboss} filter. * @name Konva.Node#embossDirection * @method * @param {String} embossDirection can be top-left, top, top-right, right, bottom-right, bottom, bottom-left or left * The default is top-left * @returns {String} */ Factory.addGetterSetter(Node, "embossBlend", false, void 0, Factory.afterSetFilter); /** * get/set emboss blend. Use with {@link Konva.Filters.Emboss} filter. * @name Konva.Node#embossBlend * @method * @param {Boolean} embossBlend * @returns {Boolean} */ //#endregion //#region node_modules/konva/lib/filters/Enhance.js function remap(fromValue, fromMin, fromMax, toMin, toMax) { const fromRange = fromMax - fromMin, toRange = toMax - toMin; if (fromRange === 0) return toMin + toRange / 2; if (toRange === 0) return toMin; let toValue = (fromValue - fromMin) / fromRange; toValue = toRange * toValue + toMin; return toValue; } /** * Enhance Filter. Adjusts the colors so that they span the widest * possible range (ie 0-255). Performs w*h pixel reads and w*h pixel * writes. * @function * @name Enhance * @memberof Konva.Filters * @param {Object} imageData * @author ippo615 * @example * node.cache(); * node.filters([Konva.Filters.Enhance]); * node.enhance(0.4); */ var Enhance = function(imageData) { const data = imageData.data, nSubPixels = data.length; let rMin = data[0], rMax = rMin, r, gMin = data[1], gMax = gMin, g, bMin = data[2], bMax = bMin, b; const enhanceAmount = this.enhance(); if (enhanceAmount === 0) return; for (let i = 0; i < nSubPixels; i += 4) { r = data[i + 0]; if (r < rMin) rMin = r; else if (r > rMax) rMax = r; g = data[i + 1]; if (g < gMin) gMin = g; else if (g > gMax) gMax = g; b = data[i + 2]; if (b < bMin) bMin = b; else if (b > bMax) bMax = b; } if (rMax === rMin) { rMax = 255; rMin = 0; } if (gMax === gMin) { gMax = 255; gMin = 0; } if (bMax === bMin) { bMax = 255; bMin = 0; } let rGoalMax, rGoalMin, gGoalMax, gGoalMin, bGoalMax, bGoalMin; if (enhanceAmount > 0) { rGoalMax = rMax + enhanceAmount * (255 - rMax); rGoalMin = rMin - enhanceAmount * (rMin - 0); gGoalMax = gMax + enhanceAmount * (255 - gMax); gGoalMin = gMin - enhanceAmount * (gMin - 0); bGoalMax = bMax + enhanceAmount * (255 - bMax); bGoalMin = bMin - enhanceAmount * (bMin - 0); } else { const rMid = (rMax + rMin) * .5; rGoalMax = rMax + enhanceAmount * (rMax - rMid); rGoalMin = rMin + enhanceAmount * (rMin - rMid); const gMid = (gMax + gMin) * .5; gGoalMax = gMax + enhanceAmount * (gMax - gMid); gGoalMin = gMin + enhanceAmount * (gMin - gMid); const bMid = (bMax + bMin) * .5; bGoalMax = bMax + enhanceAmount * (bMax - bMid); bGoalMin = bMin + enhanceAmount * (bMin - bMid); } for (let i = 0; i < nSubPixels; i += 4) { data[i + 0] = remap(data[i + 0], rMin, rMax, rGoalMin, rGoalMax); data[i + 1] = remap(data[i + 1], gMin, gMax, gGoalMin, gGoalMax); data[i + 2] = remap(data[i + 2], bMin, bMax, bGoalMin, bGoalMax); } }; /** * get/set enhance. Use with {@link Konva.Filters.Enhance} filter. -1 to 1 values * @name Konva.Node#enhance * @method * @param {Float} amount * @returns {Float} */ Factory.addGetterSetter(Node, "enhance", 0, getNumberValidator(), Factory.afterSetFilter); //#endregion //#region node_modules/konva/lib/filters/Grayscale.js /** * Grayscale Filter * @function * @memberof Konva.Filters * @param {Object} imageData * @example * node.cache(); * node.filters([Konva.Filters.Grayscale]); */ var Grayscale = function(imageData) { const data = imageData.data, len = data.length; for (let i = 0; i < len; i += 4) { const brightness = .34 * data[i] + .5 * data[i + 1] + .16 * data[i + 2]; data[i] = brightness; data[i + 1] = brightness; data[i + 2] = brightness; } }; //#endregion //#region node_modules/konva/lib/filters/HSL.js Factory.addGetterSetter(Node, "hue", 0, getNumberValidator(), Factory.afterSetFilter); /** * get/set hsv hue in degrees. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter. * @name Konva.Node#hue * @method * @param {Number} hue value between 0 and 359 * @returns {Number} */ Factory.addGetterSetter(Node, "saturation", 0, getNumberValidator(), Factory.afterSetFilter); /** * get/set hsv saturation. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter. * @name Konva.Node#saturation * @method * @param {Number} saturation 0 is no change, -1.0 halves the saturation, 1.0 doubles, etc.. * @returns {Number} */ Factory.addGetterSetter(Node, "luminance", 0, getNumberValidator(), Factory.afterSetFilter); /** * get/set hsl luminance. Use with {@link Konva.Filters.HSL} filter. * @name Konva.Node#luminance * @method * @param {Number} value from -1 to 1 * @returns {Number} */ /** * HSL Filter. Adjusts the hue, saturation and luminance (or lightness) * @function * @memberof Konva.Filters * @param {Object} imageData * @author ippo615 * @example * image.filters([Konva.Filters.HSL]); * image.luminance(0.2); */ var HSL = function(imageData) { const data = imageData.data, nPixels = data.length, v = 1, s = Math.pow(2, this.saturation()), h = (this.hue() % 360 + 360) % 360, l = this.luminance() * 127; const vsu = v * s * Math.cos(h * Math.PI / 180), vsw = v * s * Math.sin(h * Math.PI / 180); const rr = .299 * v + .701 * vsu + .168 * vsw, rg = .587 * v - .587 * vsu + .33 * vsw, rb = .114 * v - .114 * vsu - .497 * vsw; const gr = .299 * v - .299 * vsu - .328 * vsw, gg = .587 * v + .413 * vsu + .035 * vsw, gb = .114 * v - .114 * vsu + .292 * vsw; const br = .299 * v - .3 * vsu + 1.25 * vsw, bg = .587 * v - .588 * vsu - 1.05 * vsw, bb = .114 * v + .886 * vsu - .203 * vsw; let r, g, b, a; for (let i = 0; i < nPixels; i += 4) { r = data[i + 0]; g = data[i + 1]; b = data[i + 2]; a = data[i + 3]; data[i + 0] = rr * r + rg * g + rb * b + l; data[i + 1] = gr * r + gg * g + gb * b + l; data[i + 2] = br * r + bg * g + bb * b + l; data[i + 3] = a; } }; //#endregion //#region node_modules/konva/lib/filters/HSV.js /** * HSV Filter. Adjusts the hue, saturation and value * @function * @name HSV * @memberof Konva.Filters * @param {Object} imageData * @author ippo615 * @example * image.filters([Konva.Filters.HSV]); * image.value(1); // twice as bright */ var HSV = function(imageData) { const data = imageData.data, nPixels = data.length, v = Math.pow(2, this.value()), s = Math.pow(2, this.saturation()), h = (this.hue() % 360 + 360) % 360; const vsu = v * s * Math.cos(h * Math.PI / 180), vsw = v * s * Math.sin(h * Math.PI / 180); const rr = .299 * v + .701 * vsu + .168 * vsw, rg = .587 * v - .587 * vsu + .33 * vsw, rb = .114 * v - .114 * vsu - .497 * vsw; const gr = .299 * v - .299 * vsu - .328 * vsw, gg = .587 * v + .413 * vsu + .035 * vsw, gb = .114 * v - .114 * vsu + .292 * vsw; const br = .299 * v - .3 * vsu + 1.25 * vsw, bg = .587 * v - .588 * vsu - 1.05 * vsw, bb = .114 * v + .886 * vsu - .203 * vsw; for (let i = 0; i < nPixels; i += 4) { const r = data[i + 0]; const g = data[i + 1]; const b = data[i + 2]; const a = data[i + 3]; data[i + 0] = rr * r + rg * g + rb * b; data[i + 1] = gr * r + gg * g + gb * b; data[i + 2] = br * r + bg * g + bb * b; data[i + 3] = a; } }; Factory.addGetterSetter(Node, "hue", 0, getNumberValidator(), Factory.afterSetFilter); /** * get/set hsv hue in degrees. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter. * @name Konva.Node#hue * @method * @param {Number} hue value between 0 and 359 * @returns {Number} */ Factory.addGetterSetter(Node, "saturation", 0, getNumberValidator(), Factory.afterSetFilter); /** * get/set hsv saturation. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter. * @name Konva.Node#saturation * @method * @param {Number} saturation 0 is no change, -1.0 halves the saturation, 1.0 doubles, etc.. * @returns {Number} */ Factory.addGetterSetter(Node, "value", 0, getNumberValidator(), Factory.afterSetFilter); /** * get/set hsv value. Use with {@link Konva.Filters.HSV} filter. * @name Konva.Node#value * @method * @param {Number} value 0 is no change, -1.0 halves the value, 1.0 doubles, etc.. * @returns {Number} */ //#endregion //#region node_modules/konva/lib/filters/Invert.js /** * Invert Filter * @function * @memberof Konva.Filters * @param {Object} imageData * @example * node.cache(); * node.filters([Konva.Filters.Invert]); */ var Invert = function(imageData) { const data = imageData.data, len = data.length; for (let i = 0; i < len; i += 4) { data[i] = 255 - data[i]; data[i + 1] = 255 - data[i + 1]; data[i + 2] = 255 - data[i + 2]; } }; //#endregion //#region node_modules/konva/lib/filters/Kaleidoscope.js var ToPolar = function(src, dst, opt) { const srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2; let rMax = Math.sqrt(xMid * xMid + yMid * yMid); let x = xSize - xMid; let y = ySize - yMid; const rad = Math.sqrt(x * x + y * y); rMax = rad > rMax ? rad : rMax; const rSize = ySize, tSize = xSize; const conversion = 360 / tSize * Math.PI / 180; for (let theta = 0; theta < tSize; theta += 1) { const sin = Math.sin(theta * conversion); const cos = Math.cos(theta * conversion); for (let radius = 0; radius < rSize; radius += 1) { x = Math.floor(xMid + rMax * radius / rSize * cos); y = Math.floor(yMid + rMax * radius / rSize * sin); let i = (y * xSize + x) * 4; const r = srcPixels[i + 0]; const g = srcPixels[i + 1]; const b = srcPixels[i + 2]; const a = srcPixels[i + 3]; i = (theta + radius * xSize) * 4; dstPixels[i + 0] = r; dstPixels[i + 1] = g; dstPixels[i + 2] = b; dstPixels[i + 3] = a; } } }; var FromPolar = function(src, dst, opt) { const srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2; let rMax = Math.sqrt(xMid * xMid + yMid * yMid); let x = xSize - xMid; let y = ySize - yMid; const rad = Math.sqrt(x * x + y * y); rMax = rad > rMax ? rad : rMax; const rSize = ySize, tSize = xSize, phaseShift = opt.polarRotation || 0; let x1, y1; for (x = 0; x < xSize; x += 1) for (y = 0; y < ySize; y += 1) { const dx = x - xMid; const dy = y - yMid; const radius = Math.sqrt(dx * dx + dy * dy) * rSize / rMax; let theta = (Math.atan2(dy, dx) * 180 / Math.PI + 360 + phaseShift) % 360; theta = theta * tSize / 360; x1 = Math.floor(theta); y1 = Math.floor(radius); let i = (y1 * xSize + x1) * 4; const r = srcPixels[i + 0]; const g = srcPixels[i + 1]; const b = srcPixels[i + 2]; const a = srcPixels[i + 3]; i = (y * xSize + x) * 4; dstPixels[i + 0] = r; dstPixels[i + 1] = g; dstPixels[i + 2] = b; dstPixels[i + 3] = a; } }; /** * Kaleidoscope Filter. * @function * @name Kaleidoscope * @author ippo615 * @memberof Konva.Filters * @example * node.cache(); * node.filters([Konva.Filters.Kaleidoscope]); * node.kaleidoscopePower(3); * node.kaleidoscopeAngle(45); */ var Kaleidoscope = function(imageData) { const xSize = imageData.width, ySize = imageData.height; let x, y, xoff, i, r, g, b, a, srcPos, dstPos; let power = Math.round(this.kaleidoscopePower()); const angle = Math.round(this.kaleidoscopeAngle()); const offset = Math.floor(xSize * ((angle % 360 + 360) % 360) / 360); if (power < 1) return; const scratchData = { width: xSize, height: ySize, data: new Uint8ClampedArray(xSize * ySize * 4) }; ToPolar(imageData, scratchData, { polarCenterX: xSize / 2, polarCenterY: ySize / 2 }); let minSectionSize = xSize / Math.pow(2, power); while (minSectionSize <= 8) { minSectionSize = minSectionSize * 2; power -= 1; } minSectionSize = Math.ceil(minSectionSize); let sectionSize = minSectionSize; let xStart = 0, xEnd = sectionSize, xDelta = 1; if (offset + minSectionSize > xSize) { xStart = sectionSize; xEnd = 0; xDelta = -1; } for (y = 0; y < ySize; y += 1) for (x = xStart; x !== xEnd; x += xDelta) { xoff = Math.round(x + offset) % xSize; srcPos = (xSize * y + xoff) * 4; r = scratchData.data[srcPos + 0]; g = scratchData.data[srcPos + 1]; b = scratchData.data[srcPos + 2]; a = scratchData.data[srcPos + 3]; dstPos = (xSize * y + x) * 4; scratchData.data[dstPos + 0] = r; scratchData.data[dstPos + 1] = g; scratchData.data[dstPos + 2] = b; scratchData.data[dstPos + 3] = a; } for (y = 0; y < ySize; y += 1) { sectionSize = Math.floor(minSectionSize); for (i = 0; i < power; i += 1) { for (x = 0; x < sectionSize + 1; x += 1) { srcPos = (xSize * y + x) * 4; r = scratchData.data[srcPos + 0]; g = scratchData.data[srcPos + 1]; b = scratchData.data[srcPos + 2]; a = scratchData.data[srcPos + 3]; dstPos = (xSize * y + sectionSize * 2 - x - 1) * 4; scratchData.data[dstPos + 0] = r; scratchData.data[dstPos + 1] = g; scratchData.data[dstPos + 2] = b; scratchData.data[dstPos + 3] = a; } sectionSize *= 2; } } FromPolar(scratchData, imageData, { polarRotation: 0 }); }; /** * get/set kaleidoscope power. Use with {@link Konva.Filters.Kaleidoscope} filter. * @name Konva.Node#kaleidoscopePower * @method * @param {Integer} power of kaleidoscope * @returns {Integer} */ Factory.addGetterSetter(Node, "kaleidoscopePower", 2, getNumberValidator(), Factory.afterSetFilter); /** * get/set kaleidoscope angle. Use with {@link Konva.Filters.Kaleidoscope} filter. * @name Konva.Node#kaleidoscopeAngle * @method * @param {Integer} degrees * @returns {Integer} */ Factory.addGetterSetter(Node, "kaleidoscopeAngle", 0, getNumberValidator(), Factory.afterSetFilter); //#endregion //#region node_modules/konva/lib/filters/Mask.js function pixelAt(idata, x, y) { let idx = (y * idata.width + x) * 4; const d = []; d.push(idata.data[idx++], idata.data[idx++], idata.data[idx++], idata.data[idx++]); return d; } function rgbDistance(p1, p2) { return Math.sqrt(Math.pow(p1[0] - p2[0], 2) + Math.pow(p1[1] - p2[1], 2) + Math.pow(p1[2] - p2[2], 2)); } function rgbMean(pTab) { const m = [ 0, 0, 0 ]; for (let i = 0; i < pTab.length; i++) { m[0] += pTab[i][0]; m[1] += pTab[i][1]; m[2] += pTab[i][2]; } m[0] /= pTab.length; m[1] /= pTab.length; m[2] /= pTab.length; return m; } function backgroundMask(idata, threshold) { const rgbv_no = pixelAt(idata, 0, 0); const rgbv_ne = pixelAt(idata, idata.width - 1, 0); const rgbv_so = pixelAt(idata, 0, idata.height - 1); const rgbv_se = pixelAt(idata, idata.width - 1, idata.height - 1); if (rgbDistance(rgbv_no, rgbv_ne) < threshold && rgbDistance(rgbv_ne, rgbv_se) < threshold && rgbDistance(rgbv_se, rgbv_so) < threshold && rgbDistance(rgbv_so, rgbv_no) < threshold) { const mean = rgbMean([ rgbv_ne, rgbv_no, rgbv_se, rgbv_so ]); const mask = []; for (let i = 0; i < idata.width * idata.height; i++) { const d = rgbDistance(mean, [ idata.data[i * 4], idata.data[i * 4 + 1], idata.data[i * 4 + 2] ]); mask[i] = d < threshold ? 0 : 255; } return mask; } } function applyMask(idata, mask) { for (let i = 0; i < idata.width * idata.height; i++) idata.data[4 * i + 3] = mask[i]; } function erodeMask(mask, sw, sh) { const weights = [ 1, 1, 1, 1, 0, 1, 1, 1, 1 ]; const side = Math.round(Math.sqrt(weights.length)); const halfSide = Math.floor(side / 2); const maskResult = []; for (let y = 0; y < sh; y++) for (let x = 0; x < sw; x++) { const so = y * sw + x; let a = 0; for (let cy = 0; cy < side; cy++) for (let cx = 0; cx < side; cx++) { const scy = y + cy - halfSide; const scx = x + cx - halfSide; if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) { const srcOff = scy * sw + scx; const wt = weights[cy * side + cx]; a += mask[srcOff] * wt; } } maskResult[so] = a === 2040 ? 255 : 0; } return maskResult; } function dilateMask(mask, sw, sh) { const weights = [ 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; const side = Math.round(Math.sqrt(weights.length)); const halfSide = Math.floor(side / 2); const maskResult = []; for (let y = 0; y < sh; y++) for (let x = 0; x < sw; x++) { const so = y * sw + x; let a = 0; for (let cy = 0; cy < side; cy++) for (let cx = 0; cx < side; cx++) { const scy = y + cy - halfSide; const scx = x + cx - halfSide; if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) { const srcOff = scy * sw + scx; const wt = weights[cy * side + cx]; a += mask[srcOff] * wt; } } maskResult[so] = a >= 1020 ? 255 : 0; } return maskResult; } function smoothEdgeMask(mask, sw, sh) { const weights = [ 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9 ]; const side = Math.round(Math.sqrt(weights.length)); const halfSide = Math.floor(side / 2); const maskResult = []; for (let y = 0; y < sh; y++) for (let x = 0; x < sw; x++) { const so = y * sw + x; let a = 0; for (let cy = 0; cy < side; cy++) for (let cx = 0; cx < side; cx++) { const scy = y + cy - halfSide; const scx = x + cx - halfSide; if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) { const srcOff = scy * sw + scx; const wt = weights[cy * side + cx]; a += mask[srcOff] * wt; } } maskResult[so] = a; } return maskResult; } /** * Mask Filter * @function * @name Mask * @memberof Konva.Filters * @param {Object} imageData * @example * node.cache(); * node.filters([Konva.Filters.Mask]); * node.threshold(200); */ var Mask = function(imageData) { var _a; let mask = backgroundMask(imageData, (_a = this.attrs.threshold) !== null && _a !== void 0 ? _a : 10); if (mask) { mask = erodeMask(mask, imageData.width, imageData.height); mask = dilateMask(mask, imageData.width, imageData.height); mask = smoothEdgeMask(mask, imageData.width, imageData.height); applyMask(imageData, mask); } return imageData; }; Factory.addGetterSetter(Node, "threshold", .5, getNumberValidator(), Factory.afterSetFilter); //#endregion //#region node_modules/konva/lib/filters/Noise.js /** * Noise Filter. Randomly adds or substracts to the color channels * @function * @name Noise * @memberof Konva.Filters * @param {Object} imageData * @author ippo615 * @example * node.cache(); * node.filters([Konva.Filters.Noise]); * node.noise(0.8); */ var Noise = function(imageData) { const amount = this.noise() * 255, data = imageData.data, nPixels = data.length, half = amount / 2; for (let i = 0; i < nPixels; i += 4) { data[i + 0] += half - 2 * half * Math.random(); data[i + 1] += half - 2 * half * Math.random(); data[i + 2] += half - 2 * half * Math.random(); } }; Factory.addGetterSetter(Node, "noise", .2, getNumberValidator(), Factory.afterSetFilter); /** * get/set noise amount. Must be a value between 0 and 1. Use with {@link Konva.Filters.Noise} filter. * @name Konva.Node#noise * @method * @param {Number} noise * @returns {Number} */ //#endregion //#region node_modules/konva/lib/filters/Pixelate.js /** * Pixelate Filter. Averages groups of pixels and redraws * them as larger pixels * @function * @name Pixelate * @memberof Konva.Filters * @param {Object} imageData * @author ippo615 * @example * node.cache(); * node.filters([Konva.Filters.Pixelate]); * node.pixelSize(10); */ var Pixelate = function(imageData, pixelRatio = 1) { let pixelSize = Math.ceil(this.pixelSize() * pixelRatio), width = imageData.width, height = imageData.height, nBinsX = Math.ceil(width / pixelSize), nBinsY = Math.ceil(height / pixelSize), data = imageData.data; if (pixelSize <= 0) { Util.error("pixelSize value can not be <= 0"); return; } for (let xBin = 0; xBin < nBinsX; xBin += 1) for (let yBin = 0; yBin < nBinsY; yBin += 1) { let red = 0; let green = 0; let blue = 0; let alpha = 0; const xBinStart = xBin * pixelSize; const xBinEnd = Math.min(xBinStart + pixelSize, width); const yBinStart = yBin * pixelSize; const yBinEnd = Math.min(yBinStart + pixelSize, height); for (let x = xBinStart; x < xBinEnd; x += 1) for (let y = yBinStart; y < yBinEnd; y += 1) { const i = (width * y + x) * 4; const a = data[i + 3]; red += data[i + 0] * a; green += data[i + 1] * a; blue += data[i + 2] * a; alpha += a; } if (alpha) { red = red / alpha; green = green / alpha; blue = blue / alpha; } alpha = alpha / ((xBinEnd - xBinStart) * (yBinEnd - yBinStart)); for (let x = xBinStart; x < xBinEnd; x += 1) for (let y = yBinStart; y < yBinEnd; y += 1) { const i = (width * y + x) * 4; data[i + 0] = red; data[i + 1] = green; data[i + 2] = blue; data[i + 3] = alpha; } } }; Factory.addGetterSetter(Node, "pixelSize", 8, getNumberValidator(), Factory.afterSetFilter); /** * get/set pixel size. Use with {@link Konva.Filters.Pixelate} filter. * @name Konva.Node#pixelSize * @method * @param {Integer} pixelSize * @returns {Integer} */ //#endregion //#region node_modules/konva/lib/filters/Posterize.js /** * Posterize Filter. Adjusts the channels so that there are no more * than n different values for that channel. This is also applied * to the alpha channel. * @function * @name Posterize * @author ippo615 * @memberof Konva.Filters * @param {Object} imageData * @example * node.cache(); * node.filters([Konva.Filters.Posterize]); * node.levels(0.8); // between 0 and 1 */ var Posterize = function(imageData) { const levels = Math.round(this.levels() * 254) + 1, data = imageData.data, len = data.length, scale = 255 / levels; for (let i = 0; i < len; i += 1) data[i] = Math.floor(data[i] / scale) * scale; }; Factory.addGetterSetter(Node, "levels", .5, getNumberValidator(), Factory.afterSetFilter); /** * get/set levels. Must be a number between 0 and 1. Use with {@link Konva.Filters.Posterize} filter. * @name Konva.Node#levels * @method * @param {Number} level between 0 and 1 * @returns {Number} */ //#endregion //#region node_modules/konva/lib/filters/RGB.js /** * RGB Filter * @function * @name RGB * @memberof Konva.Filters * @param {Object} imageData * @author ippo615 * @example * node.cache(); * node.filters([Konva.Filters.RGB]); * node.blue(120); * node.green(200); */ var RGB = function(imageData) { const data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(); for (let i = 0; i < nPixels; i += 4) { const brightness = (.34 * data[i] + .5 * data[i + 1] + .16 * data[i + 2]) / 255; data[i] = brightness * red; data[i + 1] = brightness * green; data[i + 2] = brightness * blue; data[i + 3] = data[i + 3]; } }; Factory.addGetterSetter(Node, "red", 0, RGBComponent, Factory.afterSetFilter); /** * get/set filter red value. Use with {@link Konva.Filters.RGB} or {@link Konva.Filters.RGBA} filter. * @name red * @method * @memberof Konva.Node.prototype * @param {Integer} red value between 0 and 255 * @returns {Integer} */ Factory.addGetterSetter(Node, "green", 0, RGBComponent, Factory.afterSetFilter); /** * get/set filter green value. Use with {@link Konva.Filters.RGB} or {@link Konva.Filters.RGBA} filter. * @name green * @method * @memberof Konva.Node.prototype * @param {Integer} green value between 0 and 255 * @returns {Integer} */ Factory.addGetterSetter(Node, "blue", 0, RGBComponent, Factory.afterSetFilter); /** * get/set filter blue value. Use with {@link Konva.Filters.RGB} or {@link Konva.Filters.RGBA} filter. * @name blue * @method * @memberof Konva.Node.prototype * @param {Integer} blue value between 0 and 255 * @returns {Integer} */ //#endregion //#region node_modules/konva/lib/filters/RGBA.js /** * RGBA Filter * @function * @name RGBA * @memberof Konva.Filters * @param {Object} imageData * @author codefo * @example * node.cache(); * node.filters([Konva.Filters.RGBA]); * node.blue(120); * node.green(200); * node.alpha(0.3); */ var RGBA = function(imageData) { const data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), alpha = this.alpha(); for (let i = 0; i < nPixels; i += 4) { const ia = 1 - alpha; data[i] = red * alpha + data[i] * ia; data[i + 1] = green * alpha + data[i + 1] * ia; data[i + 2] = blue * alpha + data[i + 2] * ia; } }; Factory.addGetterSetter(Node, "alpha", 1, (val) => Math.min(1, Math.max(0, val)), Factory.afterSetFilter); /** * get/set filter alpha value. Use with {@link Konva.Filters.RGBA} filter. * @name alpha * @method * @memberof Konva.Node.prototype * @param {Float} alpha value between 0 and 1 * @returns {Float} */ //#endregion //#region node_modules/konva/lib/filters/Sepia.js /** * @function * @name Sepia * @memberof Konva.Filters * @param {Object} imageData * @example * node.cache(); * node.filters([Konva.Filters.Sepia]); */ var Sepia = function(imageData) { const data = imageData.data, nPixels = data.length; for (let i = 0; i < nPixels; i += 4) { const r = data[i + 0]; const g = data[i + 1]; const b = data[i + 2]; data[i + 0] = Math.min(255, r * .393 + g * .769 + b * .189); data[i + 1] = Math.min(255, r * .349 + g * .686 + b * .168); data[i + 2] = Math.min(255, r * .272 + g * .534 + b * .131); } }; //#endregion //#region node_modules/konva/lib/filters/Solarize.js /** * Solarize Filter * @function * @name Solarize * @memberof Konva.Filters * @param {Object} imageData * @example * node.cache(); * node.filters([Konva.Filters.Solarize]); */ var Solarize = function(imageData) { const threshold = 128; const d = imageData.data; for (let i = 0; i < d.length; i += 4) { const r = d[i], g = d[i + 1], b = d[i + 2]; if (.2126 * r + .7152 * g + .0722 * b >= threshold) { d[i] = 255 - r; d[i + 1] = 255 - g; d[i + 2] = 255 - b; } } return imageData; }; //#endregion //#region node_modules/konva/lib/filters/Threshold.js /** * Threshold Filter. Pushes any value above the mid point to * the max and any value below the mid point to the min. * This affects the alpha channel. * @function * @name Threshold * @memberof Konva.Filters * @param {Object} imageData * @author ippo615 * @example * node.cache(); * node.filters([Konva.Filters.Threshold]); * node.threshold(0.1); */ var Threshold = function(imageData) { const level = this.threshold() * 255, data = imageData.data, len = data.length; for (let i = 0; i < len; i += 1) data[i] = data[i] < level ? 0 : 255; }; Factory.addGetterSetter(Node, "threshold", .5, getNumberValidator(), Factory.afterSetFilter); Konva$1.Util._assign(Konva$1, { Arc: Arc$1, Arrow: Arrow$1, Circle: Circle$1, Ellipse: Ellipse$1, Image: Image$1, Label: Label$1, Tag: Tag$1, Line: Line$1, Path: Path$1, Rect: Rect$1, RegularPolygon: RegularPolygon$1, Ring: Ring$1, Sprite: Sprite$1, Star: Star$1, Text: Text$1, TextPath: TextPath$1, Transformer: Transformer$1, Wedge: Wedge$1, /** * @namespace Filters * @memberof Konva */ Filters: { Blur, Brightness, Brighten, Contrast, Emboss, Enhance, Grayscale, HSL, HSV, Invert, Kaleidoscope, Mask, Noise, Pixelate, Posterize, RGB, RGBA, Sepia, Solarize, Threshold } }); //#endregion //#region node_modules/konva/lib/Core.js var import_react = /* @__PURE__ */ __toESM(require_react(), 1); var import_react_dom = require_react_dom(); var Core_default = Konva$1; //#endregion //#region node_modules/react-reconciler/cjs/react-reconciler.development.js /** * @license React * react-reconciler.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var require_react_reconciler_development = /* @__PURE__ */ __commonJSMin(((exports, module) => { module.exports = function($$$config) { function findHook(fiber, id) { for (fiber = fiber.memoizedState; null !== fiber && 0 < id;) fiber = fiber.next, id--; return fiber; } function copyWithSetImpl(obj, path, index, value) { if (index >= path.length) return value; var key = path[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj); updated[key] = copyWithSetImpl(obj[key], path, index + 1, value); return updated; } function copyWithRename(obj, oldPath, newPath) { if (oldPath.length !== newPath.length) console.warn("copyWithRename() expects paths of the same length"); else { for (var i = 0; i < newPath.length - 1; i++) if (oldPath[i] !== newPath[i]) { console.warn("copyWithRename() expects paths to be the same except for the deepest key"); return; } return copyWithRenameImpl(obj, oldPath, newPath, 0); } } function copyWithRenameImpl(obj, oldPath, newPath, index) { var oldKey = oldPath[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj); index + 1 === oldPath.length ? (updated[newPath[index]] = updated[oldKey], isArrayImpl(updated) ? updated.splice(oldKey, 1) : delete updated[oldKey]) : updated[oldKey] = copyWithRenameImpl(obj[oldKey], oldPath, newPath, index + 1); return updated; } function copyWithDeleteImpl(obj, path, index) { var key = path[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj); if (index + 1 === path.length) return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated; updated[key] = copyWithDeleteImpl(obj[key], path, index + 1); return updated; } function shouldSuspendImpl() { return !1; } function shouldErrorImpl() { return null; } function createFiber(tag, pendingProps, key, mode) { return new FiberNode(tag, pendingProps, key, mode); } function scheduleRoot(root, element) { root.context === emptyContextObject && (updateContainerSync(element, root, null, null), flushSyncWork()); } function scheduleRefresh(root, update) { if (null !== resolveFamily) { var staleFamilies = update.staleFamilies; update = update.updatedFamilies; flushPendingEffects(); scheduleFibersWithFamiliesRecursively(root.current, update, staleFamilies); flushSyncWork(); } } function setRefreshHandler(handler) { resolveFamily = handler; } function warnInvalidHookAccess() { console.error("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks"); } function warnInvalidContextAccess() { console.error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."); } function noop() {} function warnForMissingKey() {} function setToSortedString(set) { var array = []; set.forEach(function(value) { array.push(value); }); return array.sort().join(", "); } function getNearestMountedFiber(fiber) { for (var node = fiber, nextNode = node; nextNode && !nextNode.alternate;) node = nextNode, 0 !== (node.flags & 4098) && (fiber = node.return), nextNode = node.return; for (; node.return;) node = node.return; return 3 === node.tag ? fiber : null; } function assertIsMounted(fiber) { if (getNearestMountedFiber(fiber) !== fiber) throw Error("Unable to find node on an unmounted component."); } function findCurrentFiberUsingSlowPath(fiber) { var alternate = fiber.alternate; if (!alternate) { alternate = getNearestMountedFiber(fiber); if (null === alternate) throw Error("Unable to find node on an unmounted component."); return alternate !== fiber ? null : fiber; } for (var a = fiber, b = alternate;;) { var parentA = a.return; if (null === parentA) break; var parentB = parentA.alternate; if (null === parentB) { b = parentA.return; if (null !== b) { a = b; continue; } break; } if (parentA.child === parentB.child) { for (parentB = parentA.child; parentB;) { if (parentB === a) return assertIsMounted(parentA), fiber; if (parentB === b) return assertIsMounted(parentA), alternate; parentB = parentB.sibling; } throw Error("Unable to find node on an unmounted component."); } if (a.return !== b.return) a = parentA, b = parentB; else { for (var didFindChild = !1, _child = parentA.child; _child;) { if (_child === a) { didFindChild = !0; a = parentA; b = parentB; break; } if (_child === b) { didFindChild = !0; b = parentA; a = parentB; break; } _child = _child.sibling; } if (!didFindChild) { for (_child = parentB.child; _child;) { if (_child === a) { didFindChild = !0; a = parentB; b = parentA; break; } if (_child === b) { didFindChild = !0; b = parentB; a = parentA; break; } _child = _child.sibling; } if (!didFindChild) throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue."); } } if (a.alternate !== b) throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue."); } if (3 !== a.tag) throw Error("Unable to find node on an unmounted component."); return a.stateNode.current === a ? fiber : alternate; } function findCurrentHostFiber(parent) { parent = findCurrentFiberUsingSlowPath(parent); return null !== parent ? findCurrentHostFiberImpl(parent) : null; } function findCurrentHostFiberImpl(node) { var tag = node.tag; if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node; for (node = node.child; null !== node;) { tag = findCurrentHostFiberImpl(node); if (null !== tag) return tag; node = node.sibling; } return null; } function findCurrentHostFiberWithNoPortalsImpl(node) { var tag = node.tag; if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node; for (node = node.child; null !== node;) { if (4 !== node.tag && (tag = findCurrentHostFiberWithNoPortalsImpl(node), null !== tag)) return tag; node = node.sibling; } return null; } function getIteratorFn(maybeIterable) { if (null === maybeIterable || "object" !== typeof maybeIterable) return null; maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"]; return "function" === typeof maybeIterable ? maybeIterable : null; } function getComponentNameFromType(type) { if (null == type) return null; if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null; if ("string" === typeof type) return type; switch (type) { case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PROFILER_TYPE: return "Profiler"; case REACT_STRICT_MODE_TYPE: return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; case REACT_ACTIVITY_TYPE: return "Activity"; case REACT_VIEW_TRANSITION_TYPE: return "ViewTransition"; } if ("object" === typeof type) switch ("number" === typeof type.tag && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) { case REACT_PORTAL_TYPE: return "Portal"; case REACT_CONTEXT_TYPE: return type.displayName || "Context"; case REACT_CONSUMER_TYPE: return (type._context.displayName || "Context") + ".Consumer"; case REACT_FORWARD_REF_TYPE: var innerType = type.render; type = type.displayName; type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"); return type; case REACT_MEMO_TYPE: return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo"; case REACT_LAZY_TYPE: innerType = type._payload; type = type._init; try { return getComponentNameFromType(type(innerType)); } catch (x) {} } return null; } function getComponentNameFromFiber(fiber) { var type = fiber.type; switch (fiber.tag) { case 31: return "Activity"; case 24: return "Cache"; case 9: return (type._context.displayName || "Context") + ".Consumer"; case 10: return type.displayName || "Context"; case 18: return "DehydratedFragment"; case 11: return fiber = type.render, fiber = fiber.displayName || fiber.name || "", type.displayName || ("" !== fiber ? "ForwardRef(" + fiber + ")" : "ForwardRef"); case 7: return "Fragment"; case 26: case 27: case 5: return type; case 4: return "Portal"; case 3: return "Root"; case 6: return "Text"; case 16: return getComponentNameFromType(type); case 8: return type === REACT_STRICT_MODE_TYPE ? "StrictMode" : "Mode"; case 22: if (null !== fiber.return) return getComponentNameFromFiber(fiber.return); break; case 12: return "Profiler"; case 21: return "Scope"; case 13: return "Suspense"; case 19: return "SuspenseList"; case 25: return "TracingMarker"; case 30: return "ViewTransition"; case 1: case 0: case 14: case 15: if ("function" === typeof type) return type.displayName || type.name || null; if ("string" === typeof type) return type; break; case 29: type = fiber._debugInfo; if (null != type) { for (var i = type.length - 1; 0 <= i; i--) if ("string" === typeof type[i].name) return type[i].name; } if (null !== fiber.return) return getComponentNameFromFiber(fiber.return); } return null; } function createCursor(defaultValue) { return { current: defaultValue }; } function pop(cursor, fiber) { 0 > index$jscomp$0 ? console.error("Unexpected pop.") : (fiber !== fiberStack[index$jscomp$0] && console.error("Unexpected Fiber popped."), cursor.current = valueStack[index$jscomp$0], valueStack[index$jscomp$0] = null, fiberStack[index$jscomp$0] = null, index$jscomp$0--); } function push(cursor, value, fiber) { index$jscomp$0++; valueStack[index$jscomp$0] = cursor.current; fiberStack[index$jscomp$0] = fiber; cursor.current = value; } function clz32Fallback(x) { x >>>= 0; return 0 === x ? 32 : 31 - (log$1(x) / LN2 | 0) | 0; } function getHighestPriorityLanes(lanes) { var pendingSyncLanes = lanes & 42; if (0 !== pendingSyncLanes) return pendingSyncLanes; switch (lanes & -lanes) { case 1: return 1; case 2: return 2; case 4: return 4; case 8: return 8; case 16: return 16; case 32: return 32; case 64: return 64; case 128: return 128; case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: return lanes & -lanes; case 262144: case 524288: case 1048576: case 2097152: return lanes & 3932160; case 4194304: case 8388608: case 16777216: case 33554432: return lanes & 62914560; case 67108864: return 67108864; case 134217728: return 134217728; case 268435456: return 268435456; case 536870912: return 536870912; case 1073741824: return 0; default: return console.error("Should have found matching lanes. This is a bug in React."), lanes; } } function getNextLanes(root, wipLanes, rootHasPendingCommit) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes; root = root.warmLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? (pendingLanes = nonIdlePendingLanes & ~suspendedLanes, 0 !== pendingLanes ? nextLanes = getHighestPriorityLanes(pendingLanes) : (pingedLanes &= nonIdlePendingLanes, 0 !== pingedLanes ? nextLanes = getHighestPriorityLanes(pingedLanes) : rootHasPendingCommit || (rootHasPendingCommit = nonIdlePendingLanes & ~root, 0 !== rootHasPendingCommit && (nextLanes = getHighestPriorityLanes(rootHasPendingCommit))))) : (nonIdlePendingLanes = pendingLanes & ~suspendedLanes, 0 !== nonIdlePendingLanes ? nextLanes = getHighestPriorityLanes(nonIdlePendingLanes) : 0 !== pingedLanes ? nextLanes = getHighestPriorityLanes(pingedLanes) : rootHasPendingCommit || (rootHasPendingCommit = pendingLanes & ~root, 0 !== rootHasPendingCommit && (nextLanes = getHighestPriorityLanes(rootHasPendingCommit)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && (suspendedLanes = nextLanes & -nextLanes, rootHasPendingCommit = wipLanes & -wipLanes, suspendedLanes >= rootHasPendingCommit || 32 === suspendedLanes && 0 !== (rootHasPendingCommit & 4194048)) ? wipLanes : nextLanes; } function checkIfRootIsPrerendering(root, renderLanes) { return 0 === (root.pendingLanes & ~(root.suspendedLanes & ~root.pingedLanes) & renderLanes); } function getEntangledLanes(root, renderLanes) { 0 !== (renderLanes & 8) && (renderLanes |= renderLanes & 32); var allEntangledLanes = root.entangledLanes; if (0 !== allEntangledLanes) for (root = root.entanglements, allEntangledLanes &= renderLanes; 0 < allEntangledLanes;) { var index = 31 - clz32(allEntangledLanes), lane = 1 << index; renderLanes |= root[index]; allEntangledLanes &= ~lane; } return renderLanes; } function computeExpirationTime(lane, currentTime) { switch (lane) { case 1: case 2: case 4: case 8: case 64: return currentTime + 250; case 16: case 32: case 128: case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: return currentTime + 5e3; case 4194304: case 8388608: case 16777216: case 33554432: return -1; case 67108864: case 134217728: case 268435456: case 536870912: case 1073741824: return -1; default: return console.error("Should have found matching lanes. This is a bug in React."), -1; } } function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); return lane; } function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } function markRootUpdated$1(root, updateLane) { root.pendingLanes |= updateLane; 268435456 !== updateLane && (root.suspendedLanes = 0, root.pingedLanes = 0, root.warmLanes = 0); } function markRootFinished(root, finishedLanes, remainingLanes, spawnedLane, updatedLanes, suspendedRetryLanes) { var previouslyPendingLanes = root.pendingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; root.pingedLanes = 0; root.warmLanes = 0; root.expiredLanes &= remainingLanes; root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; var entanglements = root.entanglements, expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; for (remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes;) { var index = 31 - clz32(remainingLanes), lane = 1 << index; entanglements[index] = 0; expirationTimes[index] = -1; var hiddenUpdatesForLane = hiddenUpdates[index]; if (null !== hiddenUpdatesForLane) for (hiddenUpdates[index] = null, index = 0; index < hiddenUpdatesForLane.length; index++) { var update = hiddenUpdatesForLane[index]; null !== update && (update.lane &= -536870913); } remainingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); 0 !== suspendedRetryLanes && 0 === updatedLanes && 0 !== root.tag && (root.suspendedLanes |= suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; root.suspendedLanes &= ~spawnedLane; var spawnedLaneIndex = 31 - clz32(spawnedLane); root.entangledLanes |= spawnedLane; root.entanglements[spawnedLaneIndex] = root.entanglements[spawnedLaneIndex] | 1073741824 | entangledLanes & 261930; } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = root.entangledLanes |= entangledLanes; for (root = root.entanglements; rootEntangledLanes;) { var index = 31 - clz32(rootEntangledLanes), lane = 1 << index; lane & entangledLanes | root[index] & entangledLanes && (root[index] |= entangledLanes); rootEntangledLanes &= ~lane; } } function getBumpedLaneForHydration(root, renderLanes) { var renderLane = renderLanes & -renderLanes; renderLane = 0 !== (renderLane & 42) ? 1 : getBumpedLaneForHydrationByLane(renderLane); return 0 !== (renderLane & (root.suspendedLanes | renderLanes)) ? 0 : renderLane; } function getBumpedLaneForHydrationByLane(lane) { switch (lane) { case 2: lane = 1; break; case 8: lane = 4; break; case 32: lane = 16; break; case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: case 4194304: case 8388608: case 16777216: case 33554432: lane = 128; break; case 268435456: lane = 134217728; break; default: lane = 0; } return lane; } function addFiberToLanesMap(root, fiber, lanes) { if (isDevToolsPresent) for (root = root.pendingUpdatersLaneMap; 0 < lanes;) { var index = 31 - clz32(lanes), lane = 1 << index; root[index].add(fiber); lanes &= ~lane; } } function movePendingFibersToMemoized(root, lanes) { if (isDevToolsPresent) for (var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap, memoizedUpdaters = root.memoizedUpdaters; 0 < lanes;) { var index = 31 - clz32(lanes); root = 1 << index; index = pendingUpdatersLaneMap[index]; 0 < index.size && (index.forEach(function(fiber) { var alternate = fiber.alternate; null !== alternate && memoizedUpdaters.has(alternate) || memoizedUpdaters.add(fiber); }), index.clear()); lanes &= ~root; } } function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes ? 8 < lanes ? 0 !== (lanes & 134217727) ? 32 : 268435456 : 8 : 2; } function injectInternals(internals) { if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; if (hook.isDisabled) return !0; if (!hook.supportsFiber) return console.error("The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://react.dev/link/react-devtools"), !0; try { rendererID = hook.inject(internals), injectedHook = hook; } catch (err) { console.error("React instrumentation encountered an error: %o.", err); } return hook.checkDCE ? !0 : !1; } function setIsStrictModeForDevtools(newIsStrictMode) { "function" === typeof log && unstable_setDisableYieldValue(newIsStrictMode); if (injectedHook && "function" === typeof injectedHook.setStrictMode) try { injectedHook.setStrictMode(rendererID, newIsStrictMode); } catch (err) { hasLoggedError || (hasLoggedError = !0, console.error("React instrumentation encountered an error: %o", err)); } } function getViewTransitionName(props, instance) { if (null != props.name && "auto" !== props.name) return props.name; if (null !== instance.autoName) return instance.autoName; props = pendingEffectsRoot.identifierPrefix; var globalClientId = globalClientIdCounter$1++; props = "_" + props + "t_" + globalClientId.toString(32) + "_"; return instance.autoName = props; } function getClassNameByType(classByType) { if (null == classByType || "string" === typeof classByType) return classByType; var className = null, activeTypes = pendingTransitionTypes; if (null !== activeTypes) for (var i = 0; i < activeTypes.length; i++) { var match = classByType[activeTypes[i]]; if (null != match) { if ("none" === match) return "none"; className = null == className ? match : className + (" " + match); } } return null == className ? classByType.default : className; } function getViewTransitionClassName(defaultClass, eventClass) { defaultClass = getClassNameByType(defaultClass); eventClass = getClassNameByType(eventClass); return null == eventClass ? "auto" === defaultClass ? null : defaultClass : "auto" === eventClass ? null : eventClass; } function is(x, y) { return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; } function getArrayKind(array) { for (var kind = 0, i = 0; i < array.length && 100 > i; i++) { var value = array[i]; if ("object" === typeof value && null !== value) if (isArrayImpl(value) && 2 === value.length && "string" === typeof value[0]) { if (0 !== kind && 3 !== kind) return 1; kind = 3; } else return 1; else { if ("function" === typeof value || "string" === typeof value && 50 < value.length || 0 !== kind && 2 !== kind || "bigint" === typeof value) return 1; kind = 2; } } return kind; } function addObjectToProperties(object, properties, indent, prefix) { if (!ArrayBuffer.isView(object)) { var addedProperties = 0, key; for (key in object) if (hasOwnProperty.call(object, key) && "_" !== key[0] && (addedProperties++, addValueToProperties(key, object[key], properties, indent, prefix), 100 <= addedProperties)) { properties.push([prefix + "\xA0\xA0".repeat(indent) + "Only 100 properties are shown. React will not log more properties of this object.", ""]); break; } } } function readReactElementTypeof(value) { return "$$typeof" in value && hasOwnProperty.call(value, "$$typeof") ? value.$$typeof : void 0; } function addValueToProperties(propertyName, value, properties, indent, prefix) { switch (typeof value) { case "object": if (null === value) { value = "null"; break; } else { if (readReactElementTypeof(value) === REACT_ELEMENT_TYPE) { var typeName = getComponentNameFromType(value.type) || "…", key = value.key; value = value.props; var propsKeys = Object.keys(value), propsLength = propsKeys.length; if (null == key && 0 === propsLength) { value = "<" + typeName + " />"; break; } if (3 > indent || 1 === propsLength && "children" === propsKeys[0] && null == key) { value = "<" + typeName + " … />"; break; } properties.push([prefix + "\xA0\xA0".repeat(indent) + propertyName, "<" + typeName]); null !== key && addValueToProperties("key", key, properties, indent + 1, prefix); propertyName = !1; key = 0; for (var propKey in value) if (key++, "children" === propKey ? null != value.children && (!isArrayImpl(value.children) || 0 < value.children.length) && (propertyName = !0) : hasOwnProperty.call(value, propKey) && "_" !== propKey[0] && addValueToProperties(propKey, value[propKey], properties, indent + 1, prefix), 100 <= key) break; properties.push(["", propertyName ? ">…" : "/>"]); return; } typeName = Object.prototype.toString.call(value); typeName = typeName.slice(8, typeName.length - 1); if (ArrayBuffer.isView(value)) { value = value.length; value = "number" === typeof value ? typeName + "(" + value + ")" : typeName; break; } if ("Array" === typeName) { if (propKey = 100 < value.length, key = getArrayKind(value), 2 === key || 0 === key) { value = JSON.stringify(propKey ? value.slice(0, 100).concat("…") : value); break; } else if (3 === key) { properties.push([prefix + "\xA0\xA0".repeat(indent) + propertyName, ""]); for (propertyName = 0; propertyName < value.length && 100 > propertyName; propertyName++) typeName = value[propertyName], addValueToProperties(typeName[0], typeName[1], properties, indent + 1, prefix); propKey && addValueToProperties(100 .toString(), "…", properties, indent + 1, prefix); return; } } if ("Promise" === typeName) { if ("fulfilled" === value.status) { if (typeName = properties.length, addValueToProperties(propertyName, value.value, properties, indent, prefix), properties.length > typeName) { properties = properties[typeName]; properties[1] = "Promise<" + (properties[1] || "Object") + ">"; return; } } else if ("rejected" === value.status && (typeName = properties.length, addValueToProperties(propertyName, value.reason, properties, indent, prefix), properties.length > typeName)) { properties = properties[typeName]; properties[1] = "Rejected Promise<" + properties[1] + ">"; return; } properties.push(["\xA0\xA0".repeat(indent) + propertyName, "Promise"]); return; } "Object" === typeName && (propKey = Object.getPrototypeOf(value)) && "function" === typeof propKey.constructor && (typeName = propKey.constructor.name); properties.push([prefix + "\xA0\xA0".repeat(indent) + propertyName, "Object" === typeName ? 3 > indent ? "" : "…" : typeName]); 3 > indent && addObjectToProperties(value, properties, indent + 1, prefix); return; } case "function": value = value.name; value = "" === value || "string" !== typeof value ? "() => {}" : value + "() {}"; break; case "string": value = "This object has been omitted by React in the console log to avoid sending too much data from the server. Try logging smaller or more specific objects." === value ? "…" : JSON.stringify(1024 <= value.length ? value.slice(0, 1023) + "…" : value); break; case "undefined": value = "undefined"; break; case "boolean": value = value ? "true" : "false"; break; default: value = String(value); } properties.push([prefix + "\xA0\xA0".repeat(indent) + propertyName, value]); } function addObjectDiffToProperties(prev, next, properties, indent) { var isDeeplyEqual = !0, prevPropertiesChecked = 0; for (key in prev) { if (100 < prevPropertiesChecked) { properties.push(["Previous object has more than 100 properties. React will not attempt to diff objects with too many properties.", ""]); isDeeplyEqual = !1; break; } key in next || (properties.push(["-\xA0" + "\xA0\xA0".repeat(indent) + key, "…"]), isDeeplyEqual = !1); prevPropertiesChecked++; } prevPropertiesChecked = 0; for (var _key in next) { if (100 < prevPropertiesChecked) { properties.push(["Next object has more than 100 properties. React will not attempt to diff objects with too many properties.", ""]); isDeeplyEqual = !1; break; } if (_key in prev) { var key = prev[_key]; var nextValue = next[_key]; if (key !== nextValue) { if (0 === indent && "children" === _key) { isDeeplyEqual = "\xA0\xA0".repeat(indent) + _key; properties.push(["-\xA0" + isDeeplyEqual, "…"], ["+\xA0" + isDeeplyEqual, "…"]); isDeeplyEqual = !1; continue; } if (!(3 <= indent)) { if ("object" === typeof key && "object" === typeof nextValue && null !== key && null !== nextValue && readReactElementTypeof(key) === readReactElementTypeof(nextValue)) if (readReactElementTypeof(nextValue) === REACT_ELEMENT_TYPE) { if (key.type === nextValue.type && key.key === nextValue.key) { key = getComponentNameFromType(nextValue.type) || "…"; isDeeplyEqual = "\xA0\xA0".repeat(indent) + _key; key = "<" + key + " … />"; properties.push(["-\xA0" + isDeeplyEqual, key], ["+\xA0" + isDeeplyEqual, key]); isDeeplyEqual = !1; continue; } } else { var prevKind = Object.prototype.toString.call(key), nextKind = Object.prototype.toString.call(nextValue); if (prevKind === nextKind && ("[object Object]" === nextKind || "[object Array]" === nextKind)) { prevKind = [" \xA0" + "\xA0\xA0".repeat(indent) + _key, "[object Array]" === nextKind ? "Array" : ""]; properties.push(prevKind); nextKind = properties.length; addObjectDiffToProperties(key, nextValue, properties, indent + 1) ? nextKind === properties.length && (prevKind[1] = "Referentially unequal but deeply equal objects. Consider memoization.") : isDeeplyEqual = !1; continue; } } else if ("function" === typeof key && "function" === typeof nextValue && key.name === nextValue.name && key.length === nextValue.length && (prevKind = Function.prototype.toString.call(key), nextKind = Function.prototype.toString.call(nextValue), prevKind === nextKind)) { key = "" === nextValue.name ? "() => {}" : nextValue.name + "() {}"; properties.push([" \xA0" + "\xA0\xA0".repeat(indent) + _key, key + " Referentially unequal function closure. Consider memoization."]); continue; } } addValueToProperties(_key, key, properties, indent, "-\xA0"); addValueToProperties(_key, nextValue, properties, indent, "+\xA0"); isDeeplyEqual = !1; } } else properties.push(["+\xA0" + "\xA0\xA0".repeat(indent) + _key, "…"]), isDeeplyEqual = !1; prevPropertiesChecked++; } return isDeeplyEqual; } function setCurrentTrackFromLanes(lanes) { currentTrack = lanes & 63 ? "Blocking" : lanes & 64 ? "Gesture" : lanes & 4194176 ? "Transition" : lanes & 62914560 ? "Suspense" : lanes & 2080374784 ? "Idle" : "Other"; } function logComponentTrigger(fiber, startTime, endTime, trigger) { supportsUserTiming && (reusableComponentOptions.start = startTime, reusableComponentOptions.end = endTime, reusableComponentDevToolDetails.color = "warning", reusableComponentDevToolDetails.tooltipText = trigger, reusableComponentDevToolDetails.properties = null, (fiber = fiber._debugTask) ? fiber.run(performance.measure.bind(performance, trigger, reusableComponentOptions)) : performance.measure(trigger, reusableComponentOptions), performance.clearMeasures(trigger)); } function logComponentReappeared(fiber, startTime, endTime) { logComponentTrigger(fiber, startTime, endTime, "Reconnect"); } function logComponentRender(fiber, startTime, endTime, wasHydrated, committedLanes) { var name = getComponentNameFromFiber(fiber); if (null !== name && supportsUserTiming) { var alternate = fiber.alternate, selfTime = fiber.actualDuration; if (null === alternate || alternate.child !== fiber.child) for (var child = fiber.child; null !== child; child = child.sibling) selfTime -= child.actualDuration; selfTime = .5 > selfTime ? wasHydrated ? "tertiary-light" : "primary-light" : 10 > selfTime ? wasHydrated ? "tertiary" : "primary" : 100 > selfTime ? wasHydrated ? "tertiary-dark" : "primary-dark" : "error"; var props = fiber.memoizedProps; wasHydrated = fiber._debugTask; null !== props && null !== alternate && alternate.memoizedProps !== props ? (child = [reusableChangedPropsEntry], props = addObjectDiffToProperties(alternate.memoizedProps, props, child, 0), 1 < child.length ? (props && !alreadyWarnedForDeepEquality && 0 === (alternate.lanes & committedLanes) && 100 < fiber.actualDuration ? (alreadyWarnedForDeepEquality = !0, child[0] = reusableDeeplyEqualPropsEntry, reusableComponentDevToolDetails.color = "warning", reusableComponentDevToolDetails.tooltipText = "This component received deeply equal props. It might benefit from useMemo or the React Compiler in its owner.") : (reusableComponentDevToolDetails.color = selfTime, reusableComponentDevToolDetails.tooltipText = name), reusableComponentDevToolDetails.properties = child, reusableComponentOptions.start = startTime, reusableComponentOptions.end = endTime, fiber = "​" + name, null != wasHydrated ? wasHydrated.run(performance.measure.bind(performance, fiber, reusableComponentOptions)) : performance.measure(fiber, reusableComponentOptions), performance.clearMeasures(fiber)) : null != wasHydrated ? wasHydrated.run(console.timeStamp.bind(console, name, startTime, endTime, "Components âš›", void 0, selfTime)) : console.timeStamp(name, startTime, endTime, "Components âš›", void 0, selfTime)) : null != wasHydrated ? wasHydrated.run(console.timeStamp.bind(console, name, startTime, endTime, "Components âš›", void 0, selfTime)) : console.timeStamp(name, startTime, endTime, "Components âš›", void 0, selfTime); } } function logComponentErrored(fiber, startTime, endTime, errors) { if (supportsUserTiming) { var name = getComponentNameFromFiber(fiber); if (null !== name) { for (var debugTask = null, properties = [], i = 0; i < errors.length; i++) { var capturedValue = errors[i]; null == debugTask && null !== capturedValue.source && (debugTask = capturedValue.source._debugTask); capturedValue = capturedValue.value; properties.push(["Error", "object" === typeof capturedValue && null !== capturedValue && "string" === typeof capturedValue.message ? String(capturedValue.message) : String(capturedValue)]); } null !== fiber.key && addValueToProperties("key", fiber.key, properties, 0, ""); null !== fiber.memoizedProps && addObjectToProperties(fiber.memoizedProps, properties, 0, ""); debugTask ??= fiber._debugTask; fiber = { start: startTime, end: endTime, detail: { devtools: { color: "error", track: "Components âš›", tooltipText: 13 === fiber.tag ? "Hydration failed" : "Error boundary caught an error", properties } } }; name = "​" + name; debugTask ? debugTask.run(performance.measure.bind(performance, name, fiber)) : performance.measure(name, fiber); performance.clearMeasures(name); } } } function logComponentEffect(fiber, startTime, endTime, selfTime, errors) { if (null !== errors) { if (supportsUserTiming) { var name = getComponentNameFromFiber(fiber); if (null !== name) { selfTime = []; for (var i = 0; i < errors.length; i++) { var error = errors[i].value; selfTime.push(["Error", "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error)]); } null !== fiber.key && addValueToProperties("key", fiber.key, selfTime, 0, ""); null !== fiber.memoizedProps && addObjectToProperties(fiber.memoizedProps, selfTime, 0, ""); startTime = { start: startTime, end: endTime, detail: { devtools: { color: "error", track: "Components âš›", tooltipText: "A lifecycle or effect errored", properties: selfTime } } }; fiber = fiber._debugTask; endTime = "​" + name; fiber ? fiber.run(performance.measure.bind(performance, endTime, startTime)) : performance.measure(endTime, startTime); performance.clearMeasures(endTime); } } } else name = getComponentNameFromFiber(fiber), null !== name && supportsUserTiming && (errors = 1 > selfTime ? "secondary-light" : 100 > selfTime ? "secondary" : 500 > selfTime ? "secondary-dark" : "error", (fiber = fiber._debugTask) ? fiber.run(console.timeStamp.bind(console, name, startTime, endTime, "Components âš›", void 0, errors)) : console.timeStamp(name, startTime, endTime, "Components âš›", void 0, errors)); } function logSuspendedRenderPhase(startTime, endTime, lanes, debugTask) { !supportsUserTiming || endTime <= startTime || (lanes = (lanes & 738197653) === lanes ? "tertiary-dark" : "primary-dark", debugTask ? debugTask.run(console.timeStamp.bind(console, "Prewarm", startTime, endTime, currentTrack, "Scheduler âš›", lanes)) : console.timeStamp("Prewarm", startTime, endTime, currentTrack, "Scheduler âš›", lanes)); } function logSuspendedWithDelayPhase(startTime, endTime, lanes, debugTask) { !supportsUserTiming || endTime <= startTime || (lanes = (lanes & 738197653) === lanes ? "tertiary-dark" : "primary-dark", debugTask ? debugTask.run(console.timeStamp.bind(console, "Suspended", startTime, endTime, currentTrack, "Scheduler âš›", lanes)) : console.timeStamp("Suspended", startTime, endTime, currentTrack, "Scheduler âš›", lanes)); } function logErroredRenderPhase(startTime, endTime, lanes, debugTask) { !supportsUserTiming || endTime <= startTime || (debugTask ? debugTask.run(console.timeStamp.bind(console, "Errored", startTime, endTime, currentTrack, "Scheduler âš›", "error")) : console.timeStamp("Errored", startTime, endTime, currentTrack, "Scheduler âš›", "error")); } function logSuspendedCommitPhase(startTime, endTime, reason, debugTask) { !supportsUserTiming || endTime <= startTime || (debugTask ? debugTask.run(console.timeStamp.bind(console, reason, startTime, endTime, currentTrack, "Scheduler âš›", "secondary-light")) : console.timeStamp(reason, startTime, endTime, currentTrack, "Scheduler âš›", "secondary-light")); } function logCommitErrored(startTime, endTime, errors, passive, debugTask) { if (supportsUserTiming && !(endTime <= startTime)) { for (var properties = [], i = 0; i < errors.length; i++) { var error = errors[i].value; properties.push(["Error", "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error)]); } startTime = { start: startTime, end: endTime, detail: { devtools: { color: "error", track: currentTrack, trackGroup: "Scheduler âš›", tooltipText: passive ? "Remaining Effects Errored" : "Commit Errored", properties } } }; debugTask ? debugTask.run(performance.measure.bind(performance, "Errored", startTime)) : performance.measure("Errored", startTime); performance.clearMeasures("Errored"); } } function logCommitPhase(startTime, endTime, errors, abortedViewTransition, debugTask) { null !== errors ? logCommitErrored(startTime, endTime, errors, !1, debugTask) : !supportsUserTiming || endTime <= startTime || (debugTask ? debugTask.run(console.timeStamp.bind(console, abortedViewTransition ? "Commit Interrupted View Transition" : "Commit", startTime, endTime, currentTrack, "Scheduler âš›", abortedViewTransition ? "error" : "secondary-dark")) : console.timeStamp(abortedViewTransition ? "Commit Interrupted View Transition" : "Commit", startTime, endTime, currentTrack, "Scheduler âš›", abortedViewTransition ? "error" : "secondary-dark")); } function logAnimatingPhase(startTime, endTime, debugTask) { !supportsUserTiming || endTime <= startTime || (debugTask ? debugTask.run(console.timeStamp.bind(console, "Animating", startTime, endTime, currentTrack, "Scheduler âš›", "secondary-dark")) : console.timeStamp("Animating", startTime, endTime, currentTrack, "Scheduler âš›", "secondary-dark")); } function disabledLog() {} function disableLogs() { if (0 === disabledDepth) { prevLog = console.log; prevInfo = console.info; prevWarn = console.warn; prevError = console.error; prevGroup = console.group; prevGroupCollapsed = console.groupCollapsed; prevGroupEnd = console.groupEnd; var props = { configurable: !0, enumerable: !0, value: disabledLog, writable: !0 }; Object.defineProperties(console, { info: props, log: props, warn: props, error: props, group: props, groupCollapsed: props, groupEnd: props }); } disabledDepth++; } function reenableLogs() { disabledDepth--; if (0 === disabledDepth) { var props = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: assign({}, props, { value: prevLog }), info: assign({}, props, { value: prevInfo }), warn: assign({}, props, { value: prevWarn }), error: assign({}, props, { value: prevError }), group: assign({}, props, { value: prevGroup }), groupCollapsed: assign({}, props, { value: prevGroupCollapsed }), groupEnd: assign({}, props, { value: prevGroupEnd }) }); } 0 > disabledDepth && console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } function formatOwnerStack(error) { var prevPrepareStackTrace = Error.prepareStackTrace; Error.prepareStackTrace = void 0; error = error.stack; Error.prepareStackTrace = prevPrepareStackTrace; error.startsWith("Error: react-stack-top-frame\n") && (error = error.slice(29)); prevPrepareStackTrace = error.indexOf("\n"); -1 !== prevPrepareStackTrace && (error = error.slice(prevPrepareStackTrace + 1)); prevPrepareStackTrace = error.indexOf("react_stack_bottom_frame"); -1 !== prevPrepareStackTrace && (prevPrepareStackTrace = error.lastIndexOf("\n", prevPrepareStackTrace)); if (-1 !== prevPrepareStackTrace) error = error.slice(0, prevPrepareStackTrace); else return ""; return error; } function describeBuiltInComponentFrame(name) { if (void 0 === prefix) try { throw Error(); } catch (x) { var match = x.stack.trim().match(/\n( *(at )?)/); prefix = match && match[1] || ""; suffix = -1 < x.stack.indexOf("\n at") ? " ()" : -1 < x.stack.indexOf("@") ? "@unknown:0:0" : ""; } return "\n" + prefix + name + suffix; } function describeNativeComponentFrame(fn, construct) { if (!fn || reentry) return ""; var frame = componentFrameCache.get(fn); if (void 0 !== frame) return frame; reentry = !0; frame = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var previousDispatcher = null; previousDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = null; disableLogs(); try { var RunInRootFrame = { DetermineComponentFrameRoot: function() { try { if (construct) { var Fake = function() { throw Error(); }; Object.defineProperty(Fake.prototype, "props", { set: function() { throw Error(); } }); if ("object" === typeof Reflect && Reflect.construct) { try { Reflect.construct(Fake, []); } catch (x) { var control = x; } Reflect.construct(fn, [], Fake); } else { try { Fake.call(); } catch (x$0) { control = x$0; } Fake = !1; try { var prevProps = Object.getOwnPropertyDescriptor(fn.prototype, "props"); Object.defineProperty(fn.prototype, "props", { configurable: !0, set: function() { throw Error(); } }); Fake = !0; new fn(); } finally { Fake && (void 0 !== prevProps ? Object.defineProperty(fn.prototype, "props", prevProps) : delete fn.prototype.props); } } } else { try { throw Error(); } catch (x$1) { control = x$1; } (Fake = fn()) && "function" === typeof Fake.catch && Fake.catch(function() {}); } } catch (sample) { if (sample && control && "string" === typeof sample.stack) return [sample.stack, control.stack]; } return [null, null]; } }; RunInRootFrame.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot"; var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, "name"); namePropDescriptor && namePropDescriptor.configurable && Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, "name", { value: "DetermineComponentFrameRoot" }); var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), sampleStack = _RunInRootFrame$Deter[0], controlStack = _RunInRootFrame$Deter[1]; if (sampleStack && controlStack) { var sampleLines = sampleStack.split("\n"), controlLines = controlStack.split("\n"); for (_RunInRootFrame$Deter = namePropDescriptor = 0; namePropDescriptor < sampleLines.length && !sampleLines[namePropDescriptor].includes("DetermineComponentFrameRoot");) namePropDescriptor++; for (; _RunInRootFrame$Deter < controlLines.length && !controlLines[_RunInRootFrame$Deter].includes("DetermineComponentFrameRoot");) _RunInRootFrame$Deter++; if (namePropDescriptor === sampleLines.length || _RunInRootFrame$Deter === controlLines.length) for (namePropDescriptor = sampleLines.length - 1, _RunInRootFrame$Deter = controlLines.length - 1; 1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter && sampleLines[namePropDescriptor] !== controlLines[_RunInRootFrame$Deter];) _RunInRootFrame$Deter--; for (; 1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter; namePropDescriptor--, _RunInRootFrame$Deter--) if (sampleLines[namePropDescriptor] !== controlLines[_RunInRootFrame$Deter]) { if (1 !== namePropDescriptor || 1 !== _RunInRootFrame$Deter) do if (namePropDescriptor--, _RunInRootFrame$Deter--, 0 > _RunInRootFrame$Deter || sampleLines[namePropDescriptor] !== controlLines[_RunInRootFrame$Deter]) { var _frame = "\n" + sampleLines[namePropDescriptor].replace(" at new ", " at "); fn.displayName && _frame.includes("") && (_frame = _frame.replace("", fn.displayName)); "function" === typeof fn && componentFrameCache.set(fn, _frame); return _frame; } while (1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter); break; } } } finally { reentry = !1, ReactSharedInternals.H = previousDispatcher, reenableLogs(), Error.prepareStackTrace = frame; } sampleLines = (sampleLines = fn ? fn.displayName || fn.name : "") ? describeBuiltInComponentFrame(sampleLines) : ""; "function" === typeof fn && componentFrameCache.set(fn, sampleLines); return sampleLines; } function describeFiber(fiber, childFiber) { switch (fiber.tag) { case 26: case 27: case 5: return describeBuiltInComponentFrame(fiber.type); case 16: return describeBuiltInComponentFrame("Lazy"); case 13: return fiber.child !== childFiber && null !== childFiber ? describeBuiltInComponentFrame("Suspense Fallback") : describeBuiltInComponentFrame("Suspense"); case 19: return describeBuiltInComponentFrame("SuspenseList"); case 0: case 15: return describeNativeComponentFrame(fiber.type, !1); case 11: return describeNativeComponentFrame(fiber.type.render, !1); case 1: return describeNativeComponentFrame(fiber.type, !0); case 31: return describeBuiltInComponentFrame("Activity"); case 30: return describeBuiltInComponentFrame("ViewTransition"); default: return ""; } } function getStackByFiberInDevAndProd(workInProgress) { try { var info = "", previous = null; do { info += describeFiber(workInProgress, previous); var debugInfo = workInProgress._debugInfo; if (debugInfo) for (var i = debugInfo.length - 1; 0 <= i; i--) { var entry = debugInfo[i]; if ("string" === typeof entry.name) { var JSCompiler_temp_const = info; a: { var name = entry.name, env = entry.env, location = entry.debugLocation; if (null != location) { var childStack = formatOwnerStack(location), idx = childStack.lastIndexOf("\n"), lastLine = -1 === idx ? childStack : childStack.slice(idx + 1); if (-1 !== lastLine.indexOf(name)) { var JSCompiler_inline_result = "\n" + lastLine; break a; } } JSCompiler_inline_result = describeBuiltInComponentFrame(name + (env ? " [" + env + "]" : "")); } info = JSCompiler_temp_const + JSCompiler_inline_result; } } previous = workInProgress; workInProgress = workInProgress.return; } while (workInProgress); return info; } catch (x) { return "\nError generating stack: " + x.message + "\n" + x.stack; } } function describeFunctionComponentFrameWithoutLineNumber(fn) { return (fn = fn ? fn.displayName || fn.name : "") ? describeBuiltInComponentFrame(fn) : ""; } function createCapturedValueAtFiber(value, source) { if ("object" === typeof value && null !== value) { var existing = CapturedStacks.get(value); if (void 0 !== existing) return existing; source = { value, source, stack: getStackByFiberInDevAndProd(source) }; CapturedStacks.set(value, source); return source; } return { value, source, stack: getStackByFiberInDevAndProd(source) }; } function pushTreeFork(workInProgress, totalChildren) { warnIfNotHydrating(); forkStack[forkStackIndex++] = treeForkCount; forkStack[forkStackIndex++] = treeForkProvider; treeForkProvider = workInProgress; treeForkCount = totalChildren; } function pushTreeId(workInProgress, totalChildren, index) { warnIfNotHydrating(); idStack[idStackIndex++] = treeContextId; idStack[idStackIndex++] = treeContextOverflow; idStack[idStackIndex++] = treeContextProvider; treeContextProvider = workInProgress; var baseIdWithLeadingBit = treeContextId; workInProgress = treeContextOverflow; var baseLength = 32 - clz32(baseIdWithLeadingBit) - 1; baseIdWithLeadingBit &= ~(1 << baseLength); index += 1; var length = 32 - clz32(totalChildren) + baseLength; if (30 < length) { var numberOfOverflowBits = baseLength - baseLength % 5; length = (baseIdWithLeadingBit & (1 << numberOfOverflowBits) - 1).toString(32); baseIdWithLeadingBit >>= numberOfOverflowBits; baseLength -= numberOfOverflowBits; treeContextId = 1 << 32 - clz32(totalChildren) + baseLength | index << baseLength | baseIdWithLeadingBit; treeContextOverflow = length + workInProgress; } else treeContextId = 1 << length | index << baseLength | baseIdWithLeadingBit, treeContextOverflow = workInProgress; } function pushMaterializedTreeId(workInProgress) { warnIfNotHydrating(); null !== workInProgress.return && (pushTreeFork(workInProgress, 1), pushTreeId(workInProgress, 1, 0)); } function popTreeContext(workInProgress) { for (; workInProgress === treeForkProvider;) treeForkProvider = forkStack[--forkStackIndex], forkStack[forkStackIndex] = null, treeForkCount = forkStack[--forkStackIndex], forkStack[forkStackIndex] = null; for (; workInProgress === treeContextProvider;) treeContextProvider = idStack[--idStackIndex], idStack[idStackIndex] = null, treeContextOverflow = idStack[--idStackIndex], idStack[idStackIndex] = null, treeContextId = idStack[--idStackIndex], idStack[idStackIndex] = null; } function getSuspendedTreeContext() { warnIfNotHydrating(); return null !== treeContextProvider ? { id: treeContextId, overflow: treeContextOverflow } : null; } function restoreSuspendedTreeContext(workInProgress, suspendedContext) { warnIfNotHydrating(); idStack[idStackIndex++] = treeContextId; idStack[idStackIndex++] = treeContextOverflow; idStack[idStackIndex++] = treeContextProvider; treeContextId = suspendedContext.id; treeContextOverflow = suspendedContext.overflow; treeContextProvider = workInProgress; } function warnIfNotHydrating() { isHydrating || console.error("Expected to be hydrating. This is a bug in React. Please file an issue."); } function requiredContext(c) { null === c && console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."); return c; } function pushHostContainer(fiber, nextRootInstance) { push(rootInstanceStackCursor, nextRootInstance, fiber); push(contextFiberStackCursor, fiber, fiber); push(contextStackCursor, null, fiber); nextRootInstance = getRootHostContext(nextRootInstance); pop(contextStackCursor, fiber); push(contextStackCursor, nextRootInstance, fiber); } function popHostContainer(fiber) { pop(contextStackCursor, fiber); pop(contextFiberStackCursor, fiber); pop(rootInstanceStackCursor, fiber); } function getHostContext() { return requiredContext(contextStackCursor.current); } function pushHostContext(fiber) { var stateHook = fiber.memoizedState; null !== stateHook && (stateHook = stateHook.memoizedState, isPrimaryRenderer ? HostTransitionContext._currentValue = stateHook : HostTransitionContext._currentValue2 = stateHook, push(hostTransitionProviderCursor, fiber, fiber)); stateHook = requiredContext(contextStackCursor.current); var nextContext = getChildHostContext(stateHook, fiber.type); stateHook !== nextContext && (push(contextFiberStackCursor, fiber, fiber), push(contextStackCursor, nextContext, fiber)); } function popHostContext(fiber) { contextFiberStackCursor.current === fiber && (pop(contextStackCursor, fiber), pop(contextFiberStackCursor, fiber)); hostTransitionProviderCursor.current === fiber && (pop(hostTransitionProviderCursor, fiber), isPrimaryRenderer ? HostTransitionContext._currentValue = NotPendingTransition : HostTransitionContext._currentValue2 = NotPendingTransition); } function findNotableNode(node, indent) { return void 0 === node.serverProps && 0 === node.serverTail.length && 1 === node.children.length && 3 < node.distanceFromLeaf && node.distanceFromLeaf > 15 - indent ? findNotableNode(node.children[0], indent) : node; } function indentation(indent) { return " " + " ".repeat(indent); } function added(indent) { return "+ " + " ".repeat(indent); } function removed(indent) { return "- " + " ".repeat(indent); } function describeFiberType(fiber) { switch (fiber.tag) { case 26: case 27: case 5: return fiber.type; case 16: return "Lazy"; case 31: return "Activity"; case 13: return "Suspense"; case 19: return "SuspenseList"; case 0: case 15: return fiber = fiber.type, fiber.displayName || fiber.name || null; case 11: return fiber = fiber.type.render, fiber.displayName || fiber.name || null; case 1: return fiber = fiber.type, fiber.displayName || fiber.name || null; default: return null; } } function describeTextNode(content, maxLength) { return needsEscaping.test(content) ? (content = JSON.stringify(content), content.length > maxLength - 2 ? 8 > maxLength ? "{\"...\"}" : "{" + content.slice(0, maxLength - 7) + "...\"}" : "{" + content + "}") : content.length > maxLength ? 5 > maxLength ? "{\"...\"}" : content.slice(0, maxLength - 3) + "..." : content; } function describeTextDiff(clientText, serverProps, indent) { var maxLength = 120 - 2 * indent; if (null === serverProps) return added(indent) + describeTextNode(clientText, maxLength) + "\n"; if ("string" === typeof serverProps) { for (var firstDiff = 0; firstDiff < serverProps.length && firstDiff < clientText.length && serverProps.charCodeAt(firstDiff) === clientText.charCodeAt(firstDiff); firstDiff++); firstDiff > maxLength - 8 && 10 < firstDiff && (clientText = "..." + clientText.slice(firstDiff - 8), serverProps = "..." + serverProps.slice(firstDiff - 8)); return added(indent) + describeTextNode(clientText, maxLength) + "\n" + removed(indent) + describeTextNode(serverProps, maxLength) + "\n"; } return indentation(indent) + describeTextNode(clientText, maxLength) + "\n"; } function objectName(object) { return Object.prototype.toString.call(object).replace(/^\[object (.*)\]$/, function(m, p0) { return p0; }); } function describeValue(value, maxLength) { switch (typeof value) { case "string": return value = JSON.stringify(value), value.length > maxLength ? 5 > maxLength ? "\"...\"" : value.slice(0, maxLength - 4) + "...\"" : value; case "object": if (null === value) return "null"; if (isArrayImpl(value)) return "[...]"; if (value.$$typeof === REACT_ELEMENT_TYPE) return (maxLength = getComponentNameFromType(value.type)) ? "<" + maxLength + ">" : "<...>"; var name = objectName(value); if ("Object" === name) { name = ""; maxLength -= 2; for (var propName in value) if (value.hasOwnProperty(propName)) { var jsonPropName = JSON.stringify(propName); jsonPropName !== "\"" + propName + "\"" && (propName = jsonPropName); maxLength -= propName.length - 2; jsonPropName = describeValue(value[propName], 15 > maxLength ? maxLength : 15); maxLength -= jsonPropName.length; if (0 > maxLength) { name += "" === name ? "..." : ", ..."; break; } name += ("" === name ? "" : ",") + propName + ":" + jsonPropName; } return "{" + name + "}"; } return name; case "function": return (maxLength = value.displayName || value.name) ? "function " + maxLength : "function"; default: return String(value); } } function describePropValue(value, maxLength) { return "string" !== typeof value || needsEscaping.test(value) ? "{" + describeValue(value, maxLength - 2) + "}" : value.length > maxLength - 2 ? 5 > maxLength ? "\"...\"" : "\"" + value.slice(0, maxLength - 5) + "...\"" : "\"" + value + "\""; } function describeExpandedElement(type, props, rowPrefix) { var remainingRowLength = 120 - rowPrefix.length - type.length, properties = [], propName; for (propName in props) if (props.hasOwnProperty(propName) && "children" !== propName) { var propValue = describePropValue(props[propName], 120 - rowPrefix.length - propName.length - 1); remainingRowLength -= propName.length + propValue.length + 2; properties.push(propName + "=" + propValue); } return 0 === properties.length ? rowPrefix + "<" + type + ">\n" : 0 < remainingRowLength ? rowPrefix + "<" + type + " " + properties.join(" ") + ">\n" : rowPrefix + "<" + type + "\n" + rowPrefix + " " + properties.join("\n" + rowPrefix + " ") + "\n" + rowPrefix + ">\n"; } function describePropertiesDiff(clientObject, serverObject, indent) { var properties = "", remainingServerProperties = assign({}, serverObject), propName; for (propName in clientObject) if (clientObject.hasOwnProperty(propName)) { delete remainingServerProperties[propName]; var maxLength = 120 - 2 * indent - propName.length - 2, clientPropValue = describeValue(clientObject[propName], maxLength); serverObject.hasOwnProperty(propName) ? (maxLength = describeValue(serverObject[propName], maxLength), properties += added(indent) + propName + ": " + clientPropValue + "\n", properties += removed(indent) + propName + ": " + maxLength + "\n") : properties += added(indent) + propName + ": " + clientPropValue + "\n"; } for (var _propName in remainingServerProperties) remainingServerProperties.hasOwnProperty(_propName) && (clientObject = describeValue(remainingServerProperties[_propName], 120 - 2 * indent - _propName.length - 2), properties += removed(indent) + _propName + ": " + clientObject + "\n"); return properties; } function describeElementDiff(type, clientProps, serverProps, indent) { var content = "", serverPropNames = /* @__PURE__ */ new Map(); for (propName$jscomp$0 in serverProps) serverProps.hasOwnProperty(propName$jscomp$0) && serverPropNames.set(propName$jscomp$0.toLowerCase(), propName$jscomp$0); if (1 === serverPropNames.size && serverPropNames.has("children")) content += describeExpandedElement(type, clientProps, indentation(indent)); else { for (var _propName2 in clientProps) if (clientProps.hasOwnProperty(_propName2) && "children" !== _propName2) { var maxLength$jscomp$0 = 120 - 2 * (indent + 1) - _propName2.length - 1, serverPropName = serverPropNames.get(_propName2.toLowerCase()); if (void 0 !== serverPropName) { serverPropNames.delete(_propName2.toLowerCase()); var propName$jscomp$0 = clientProps[_propName2]; serverPropName = serverProps[serverPropName]; var clientPropValue = describePropValue(propName$jscomp$0, maxLength$jscomp$0); maxLength$jscomp$0 = describePropValue(serverPropName, maxLength$jscomp$0); "object" === typeof propName$jscomp$0 && null !== propName$jscomp$0 && "object" === typeof serverPropName && null !== serverPropName && "Object" === objectName(propName$jscomp$0) && "Object" === objectName(serverPropName) && (2 < Object.keys(propName$jscomp$0).length || 2 < Object.keys(serverPropName).length || -1 < clientPropValue.indexOf("...") || -1 < maxLength$jscomp$0.indexOf("...")) ? content += indentation(indent + 1) + _propName2 + "={{\n" + describePropertiesDiff(propName$jscomp$0, serverPropName, indent + 2) + indentation(indent + 1) + "}}\n" : (content += added(indent + 1) + _propName2 + "=" + clientPropValue + "\n", content += removed(indent + 1) + _propName2 + "=" + maxLength$jscomp$0 + "\n"); } else content += indentation(indent + 1) + _propName2 + "=" + describePropValue(clientProps[_propName2], maxLength$jscomp$0) + "\n"; } serverPropNames.forEach(function(propName) { if ("children" !== propName) { var maxLength = 120 - 2 * (indent + 1) - propName.length - 1; content += removed(indent + 1) + propName + "=" + describePropValue(serverProps[propName], maxLength) + "\n"; } }); content = "" === content ? indentation(indent) + "<" + type + ">\n" : indentation(indent) + "<" + type + "\n" + content + indentation(indent) + ">\n"; } type = serverProps.children; clientProps = clientProps.children; if ("string" === typeof type || "number" === typeof type || "bigint" === typeof type) { serverPropNames = ""; if ("string" === typeof clientProps || "number" === typeof clientProps || "bigint" === typeof clientProps) serverPropNames = "" + clientProps; content += describeTextDiff(serverPropNames, "" + type, indent + 1); } else if ("string" === typeof clientProps || "number" === typeof clientProps || "bigint" === typeof clientProps) content = null == type ? content + describeTextDiff("" + clientProps, null, indent + 1) : content + describeTextDiff("" + clientProps, void 0, indent + 1); return content; } function describeSiblingFiber(fiber, indent) { var type = describeFiberType(fiber); if (null === type) { type = ""; for (fiber = fiber.child; fiber;) type += describeSiblingFiber(fiber, indent), fiber = fiber.sibling; return type; } return indentation(indent) + "<" + type + ">\n"; } function describeNode(node, indent) { var skipToNode = findNotableNode(node, indent); if (skipToNode !== node && (1 !== node.children.length || node.children[0] !== skipToNode)) return indentation(indent) + "...\n" + describeNode(skipToNode, indent + 1); skipToNode = ""; var debugInfo = node.fiber._debugInfo; if (debugInfo) for (var i = 0; i < debugInfo.length; i++) { var serverComponentName = debugInfo[i].name; "string" === typeof serverComponentName && (skipToNode += indentation(indent) + "<" + serverComponentName + ">\n", indent++); } debugInfo = ""; i = node.fiber.pendingProps; if (6 === node.fiber.tag) debugInfo = describeTextDiff(i, node.serverProps, indent), indent++; else if (serverComponentName = describeFiberType(node.fiber), null !== serverComponentName) if (void 0 === node.serverProps) { debugInfo = indent; var maxLength = 120 - 2 * debugInfo - serverComponentName.length - 2, content = ""; for (propName in i) if (i.hasOwnProperty(propName) && "children" !== propName) { var propValue = describePropValue(i[propName], 15); maxLength -= propName.length + propValue.length + 2; if (0 > maxLength) { content += " ..."; break; } content += " " + propName + "=" + propValue; } debugInfo = indentation(debugInfo) + "<" + serverComponentName + content + ">\n"; indent++; } else null === node.serverProps ? (debugInfo = describeExpandedElement(serverComponentName, i, added(indent)), indent++) : "string" === typeof node.serverProps ? console.error("Should not have matched a non HostText fiber to a Text node. This is a bug in React.") : (debugInfo = describeElementDiff(serverComponentName, i, node.serverProps, indent), indent++); var propName = ""; i = node.fiber.child; for (serverComponentName = 0; i && serverComponentName < node.children.length;) maxLength = node.children[serverComponentName], maxLength.fiber === i ? (propName += describeNode(maxLength, indent), serverComponentName++) : propName += describeSiblingFiber(i, indent), i = i.sibling; i && 0 < node.children.length && (propName += indentation(indent) + "...\n"); i = node.serverTail; null === node.serverProps && indent--; for (node = 0; node < i.length; node++) serverComponentName = i[node], propName = "string" === typeof serverComponentName ? propName + (removed(indent) + describeTextNode(serverComponentName, 120 - 2 * indent) + "\n") : propName + describeExpandedElement(serverComponentName.type, serverComponentName.props, removed(indent)); return skipToNode + debugInfo + propName; } function describeDiff(rootNode) { try { return "\n\n" + describeNode(rootNode, 0); } catch (x) { return ""; } } function getCurrentFiberStackInDev() { if (null === current) return ""; var workInProgress = current; try { var info = ""; 6 === workInProgress.tag && (workInProgress = workInProgress.return); switch (workInProgress.tag) { case 26: case 27: case 5: info += describeBuiltInComponentFrame(workInProgress.type); break; case 13: info += describeBuiltInComponentFrame("Suspense"); break; case 19: info += describeBuiltInComponentFrame("SuspenseList"); break; case 31: info += describeBuiltInComponentFrame("Activity"); break; case 30: info += describeBuiltInComponentFrame("ViewTransition"); break; case 0: case 15: case 1: workInProgress._debugOwner || "" !== info || (info += describeFunctionComponentFrameWithoutLineNumber(workInProgress.type)); break; case 11: workInProgress._debugOwner || "" !== info || (info += describeFunctionComponentFrameWithoutLineNumber(workInProgress.type.render)); } for (; workInProgress;) if ("number" === typeof workInProgress.tag) { var fiber = workInProgress; workInProgress = fiber._debugOwner; var debugStack = fiber._debugStack; if (workInProgress && debugStack) { var formattedStack = formatOwnerStack(debugStack); "" !== formattedStack && (info += "\n" + formattedStack); } } else if (null != workInProgress.debugStack) { var ownerStack = workInProgress.debugStack; (workInProgress = workInProgress.owner) && ownerStack && (info += "\n" + formatOwnerStack(ownerStack)); } else break; var JSCompiler_inline_result = info; } catch (x) { JSCompiler_inline_result = "\nError generating stack: " + x.message + "\n" + x.stack; } return JSCompiler_inline_result; } function runWithFiberInDEV(fiber, callback, arg0, arg1, arg2, arg3, arg4) { var previousFiber = current; setCurrentFiber(fiber); try { return null !== fiber && fiber._debugTask ? fiber._debugTask.run(callback.bind(null, arg0, arg1, arg2, arg3, arg4)) : callback(arg0, arg1, arg2, arg3, arg4); } finally { setCurrentFiber(previousFiber); } throw Error("runWithFiberInDEV should never be called in production. This is a bug in React."); } function setCurrentFiber(fiber) { ReactSharedInternals.getCurrentStack = null === fiber ? null : getCurrentFiberStackInDev; isRendering = !1; current = fiber; } function buildHydrationDiffNode(fiber, distanceFromLeaf) { if (null === fiber.return) { if (null === hydrationDiffRootDEV) hydrationDiffRootDEV = { fiber, children: [], serverProps: void 0, serverTail: [], distanceFromLeaf }; else { if (hydrationDiffRootDEV.fiber !== fiber) throw Error("Saw multiple hydration diff roots in a pass. This is a bug in React."); hydrationDiffRootDEV.distanceFromLeaf > distanceFromLeaf && (hydrationDiffRootDEV.distanceFromLeaf = distanceFromLeaf); } return hydrationDiffRootDEV; } var siblings = buildHydrationDiffNode(fiber.return, distanceFromLeaf + 1).children; if (0 < siblings.length && siblings[siblings.length - 1].fiber === fiber) return siblings = siblings[siblings.length - 1], siblings.distanceFromLeaf > distanceFromLeaf && (siblings.distanceFromLeaf = distanceFromLeaf), siblings; distanceFromLeaf = { fiber, children: [], serverProps: void 0, serverTail: [], distanceFromLeaf }; siblings.push(distanceFromLeaf); return distanceFromLeaf; } function warnIfHydrating() { isHydrating && console.error("We should not be hydrating here. This is a bug in React. Please file a bug."); } function warnNonHydratedInstance(fiber, rejectedCandidate) { didSuspendOrErrorDEV || (fiber = buildHydrationDiffNode(fiber, 0), fiber.serverProps = null, null !== rejectedCandidate && (rejectedCandidate = describeHydratableInstanceForDevWarnings(rejectedCandidate), fiber.serverTail.push(rejectedCandidate))); } function throwOnHydrationMismatch(fiber) { var fromText = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : !1, diff = "", diffRoot = hydrationDiffRootDEV; null !== diffRoot && (hydrationDiffRootDEV = null, diff = describeDiff(diffRoot)); queueHydrationError(createCapturedValueAtFiber(Error("Hydration failed because the server rendered " + (fromText ? "text" : "HTML") + " didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:\n\n- A server/client branch `if (typeof window !== 'undefined')`.\n- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.\n- Date formatting in a user's locale which doesn't match the server.\n- External changing data without sending a snapshot of it along with the HTML.\n- Invalid HTML tag nesting.\n\nIt can also happen if the client has a browser extension installed which messes with the HTML before React loaded.\n\nhttps://react.dev/link/hydration-mismatch" + diff), fiber)); throw HydrationMismatchException; } function prepareToHydrateHostInstance(fiber, hostContext) { if (!supportsHydration) throw Error("Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."); hydrateInstance(fiber.stateNode, fiber.type, fiber.memoizedProps, hostContext, fiber) || throwOnHydrationMismatch(fiber, !0); } function popToNextHostParent(fiber) { for (hydrationParentFiber = fiber.return; hydrationParentFiber;) switch (hydrationParentFiber.tag) { case 5: case 31: case 13: rootOrSingletonContext = !1; return; case 27: case 3: rootOrSingletonContext = !0; return; default: hydrationParentFiber = hydrationParentFiber.return; } } function popHydrationState(fiber) { if (!supportsHydration || fiber !== hydrationParentFiber) return !1; if (!isHydrating) return popToNextHostParent(fiber), isHydrating = !0, !1; var tag = fiber.tag; supportsSingletons ? 3 !== tag && 27 !== tag && (5 !== tag || shouldDeleteUnhydratedTailInstances(fiber.type) && !shouldSetTextContent(fiber.type, fiber.memoizedProps)) && nextHydratableInstance && (warnIfUnhydratedTailNodes(fiber), throwOnHydrationMismatch(fiber)) : 3 !== tag && (5 !== tag || shouldDeleteUnhydratedTailInstances(fiber.type) && !shouldSetTextContent(fiber.type, fiber.memoizedProps)) && nextHydratableInstance && (warnIfUnhydratedTailNodes(fiber), throwOnHydrationMismatch(fiber)); popToNextHostParent(fiber); if (13 === tag) { if (!supportsHydration) throw Error("Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."); fiber = fiber.memoizedState; fiber = null !== fiber ? fiber.dehydrated : null; if (!fiber) throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."); nextHydratableInstance = getNextHydratableInstanceAfterSuspenseInstance(fiber); } else if (31 === tag) { fiber = fiber.memoizedState; fiber = null !== fiber ? fiber.dehydrated : null; if (!fiber) throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."); nextHydratableInstance = getNextHydratableInstanceAfterActivityInstance(fiber); } else nextHydratableInstance = supportsSingletons && 27 === tag ? getNextHydratableSiblingAfterSingleton(fiber.type, nextHydratableInstance) : hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null; return !0; } function warnIfUnhydratedTailNodes(fiber) { for (var nextInstance = nextHydratableInstance; nextInstance;) { var diffNode = buildHydrationDiffNode(fiber, 0), description = describeHydratableInstanceForDevWarnings(nextInstance); diffNode.serverTail.push(description); nextInstance = "Suspense" === description.type ? getNextHydratableInstanceAfterSuspenseInstance(nextInstance) : getNextHydratableSibling(nextInstance); } } function resetHydrationState() { supportsHydration && (nextHydratableInstance = hydrationParentFiber = null, didSuspendOrErrorDEV = isHydrating = !1); } function upgradeHydrationErrorsToRecoverable() { var queuedErrors = hydrationErrors; null !== queuedErrors && (null === workInProgressRootRecoverableErrors ? workInProgressRootRecoverableErrors = queuedErrors : workInProgressRootRecoverableErrors.push.apply(workInProgressRootRecoverableErrors, queuedErrors), hydrationErrors = null); return queuedErrors; } function queueHydrationError(error) { null === hydrationErrors ? hydrationErrors = [error] : hydrationErrors.push(error); } function emitPendingHydrationWarnings() { var diffRoot = hydrationDiffRootDEV; if (null !== diffRoot) { hydrationDiffRootDEV = null; for (var diff = describeDiff(diffRoot); 0 < diffRoot.children.length;) diffRoot = diffRoot.children[0]; runWithFiberInDEV(diffRoot.fiber, function() { console.error("A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:\n\n- A server/client branch `if (typeof window !== 'undefined')`.\n- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.\n- Date formatting in a user's locale which doesn't match the server.\n- External changing data without sending a snapshot of it along with the HTML.\n- Invalid HTML tag nesting.\n\nIt can also happen if the client has a browser extension installed which messes with the HTML before React loaded.\n\n%s%s", "https://react.dev/link/hydration-mismatch", diff); }); } } function resetContextDependencies() { lastContextDependency = currentlyRenderingFiber$1 = null; isDisallowedContextReadInDEV = !1; } function pushProvider(providerFiber, context, nextValue) { isPrimaryRenderer ? (push(valueCursor, context._currentValue, providerFiber), context._currentValue = nextValue, push(rendererCursorDEV, context._currentRenderer, providerFiber), void 0 !== context._currentRenderer && null !== context._currentRenderer && context._currentRenderer !== rendererSigil && console.error("Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."), context._currentRenderer = rendererSigil) : (push(valueCursor, context._currentValue2, providerFiber), context._currentValue2 = nextValue, push(renderer2CursorDEV, context._currentRenderer2, providerFiber), void 0 !== context._currentRenderer2 && null !== context._currentRenderer2 && context._currentRenderer2 !== rendererSigil && console.error("Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."), context._currentRenderer2 = rendererSigil); } function popProvider(context, providerFiber) { var currentValue = valueCursor.current; isPrimaryRenderer ? (context._currentValue = currentValue, currentValue = rendererCursorDEV.current, pop(rendererCursorDEV, providerFiber), context._currentRenderer = currentValue) : (context._currentValue2 = currentValue, currentValue = renderer2CursorDEV.current, pop(renderer2CursorDEV, providerFiber), context._currentRenderer2 = currentValue); pop(valueCursor, providerFiber); } function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { for (; null !== parent;) { var alternate = parent.alternate; (parent.childLanes & renderLanes) !== renderLanes ? (parent.childLanes |= renderLanes, null !== alternate && (alternate.childLanes |= renderLanes)) : null !== alternate && (alternate.childLanes & renderLanes) !== renderLanes && (alternate.childLanes |= renderLanes); if (parent === propagationRoot) break; parent = parent.return; } parent !== propagationRoot && console.error("Expected to find the propagation root when scheduling context work. This error is likely caused by a bug in React. Please file an issue."); } function propagateContextChanges(workInProgress, contexts, renderLanes, forcePropagateEntireTree) { var fiber = workInProgress.child; null !== fiber && (fiber.return = workInProgress); for (; null !== fiber;) { var list = fiber.dependencies; if (null !== list) { var nextFiber = fiber.child; list = list.firstContext; a: for (; null !== list;) { var dependency = list; list = fiber; for (var i = 0; i < contexts.length; i++) if (dependency.context === contexts[i]) { list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); scheduleContextWorkOnParentPath(list.return, renderLanes, workInProgress); forcePropagateEntireTree || (nextFiber = null); break a; } list = dependency.next; } } else if (18 === fiber.tag) { nextFiber = fiber.return; if (null === nextFiber) throw Error("We just came from a parent so we must have had a parent. This is a bug in React."); nextFiber.lanes |= renderLanes; list = nextFiber.alternate; null !== list && (list.lanes |= renderLanes); scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); nextFiber = null; } else 13 === fiber.tag && null !== fiber.memoizedState && null === fiber.memoizedState.dehydrated ? (fiber.lanes |= renderLanes, nextFiber = fiber.alternate, null !== nextFiber && (nextFiber.lanes |= renderLanes), scheduleContextWorkOnParentPath(fiber.return, renderLanes, workInProgress), nextFiber = fiber.child, nextFiber = null !== nextFiber ? nextFiber.sibling : null) : nextFiber = fiber.child; if (null !== nextFiber) nextFiber.return = fiber; else for (nextFiber = fiber; null !== nextFiber;) { if (nextFiber === workInProgress) { nextFiber = null; break; } fiber = nextFiber.sibling; if (null !== fiber) { fiber.return = nextFiber.return; nextFiber = fiber; break; } nextFiber = nextFiber.return; } fiber = nextFiber; } } function propagateParentContextChanges(current, workInProgress, renderLanes, forcePropagateEntireTree) { current = null; for (var parent = workInProgress, isInsidePropagationBailout = !1; null !== parent;) { if (!isInsidePropagationBailout) { if (0 !== (parent.flags & 524288)) isInsidePropagationBailout = !0; else if (0 !== (parent.flags & 262144)) break; } if (10 === parent.tag) { var currentParent = parent.alternate; if (null === currentParent) throw Error("Should have a current fiber. This is a bug in React."); currentParent = currentParent.memoizedProps; if (null !== currentParent) { var context = parent.type; objectIs(parent.pendingProps.value, currentParent.value) || (null !== current ? current.push(context) : current = [context]); } } else if (parent === hostTransitionProviderCursor.current) { currentParent = parent.alternate; if (null === currentParent) throw Error("Should have a current fiber. This is a bug in React."); currentParent.memoizedState.memoizedState !== parent.memoizedState.memoizedState && (null !== current ? current.push(HostTransitionContext) : current = [HostTransitionContext]); } parent = parent.return; } null !== current && propagateContextChanges(workInProgress, current, renderLanes, forcePropagateEntireTree); workInProgress.flags |= 262144; return null !== current; } function checkIfContextChanged(currentDependencies) { for (currentDependencies = currentDependencies.firstContext; null !== currentDependencies;) { var context = currentDependencies.context; if (!objectIs(isPrimaryRenderer ? context._currentValue : context._currentValue2, currentDependencies.memoizedValue)) return !0; currentDependencies = currentDependencies.next; } return !1; } function prepareToReadContext(workInProgress) { currentlyRenderingFiber$1 = workInProgress; lastContextDependency = null; workInProgress = workInProgress.dependencies; null !== workInProgress && (workInProgress.firstContext = null); } function readContext(context) { isDisallowedContextReadInDEV && console.error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."); return readContextForConsumer(currentlyRenderingFiber$1, context); } function readContextDuringReconciliation(consumer, context) { null === currentlyRenderingFiber$1 && prepareToReadContext(consumer); return readContextForConsumer(consumer, context); } function readContextForConsumer(consumer, context) { var value = isPrimaryRenderer ? context._currentValue : context._currentValue2; context = { context, memoizedValue: value, next: null }; if (null === lastContextDependency) { if (null === consumer) throw Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."); lastContextDependency = context; consumer.dependencies = { lanes: 0, firstContext: context, _debugThenableState: null }; consumer.flags |= 524288; } else lastContextDependency = lastContextDependency.next = context; return value; } function createCache() { return { controller: new AbortControllerLocal(), data: /* @__PURE__ */ new Map(), refCount: 0 }; } function retainCache(cache) { cache.controller.signal.aborted && console.warn("A cache instance was retained after it was already freed. This likely indicates a bug in React."); cache.refCount++; } function releaseCache(cache) { cache.refCount--; 0 > cache.refCount && console.warn("A cache instance was released after it was already freed. This likely indicates a bug in React."); 0 === cache.refCount && scheduleCallback$2(NormalPriority, function() { cache.controller.abort(); }); } function queueTransitionTypes(root, transitionTypes) { if (0 !== (root.pendingLanes & 4194048)) { var queued = root.transitionTypes; null === queued && (queued = root.transitionTypes = []); for (root = 0; root < transitionTypes.length; root++) { var transitionType = transitionTypes[root]; -1 === queued.indexOf(transitionType) && queued.push(transitionType); } } } function claimQueuedTransitionTypes(root) { var claimed = root.transitionTypes; root.transitionTypes = null; return claimed; } function startUpdateTimerByLane(lane, method, fiber) { if (0 !== (lane & 127)) 0 > blockingUpdateTime && (blockingUpdateTime = now(), blockingUpdateTask = createTask(method), blockingUpdateMethodName = method, null != fiber && (blockingUpdateComponentName = getComponentNameFromFiber(fiber)), isAlreadyRendering() && (componentEffectSpawnedUpdate = !0, blockingUpdateType = 1), lane = resolveEventTimeStamp(), method = resolveEventType(), lane !== blockingEventRepeatTime || method !== blockingEventType ? blockingEventRepeatTime = -1.1 : null !== method && (blockingUpdateType = 1), blockingEventTime = lane, blockingEventType = method); else if (0 !== (lane & 4194048) && 0 > transitionUpdateTime && (transitionUpdateTime = now(), transitionUpdateTask = createTask(method), transitionUpdateMethodName = method, null != fiber && (transitionUpdateComponentName = getComponentNameFromFiber(fiber)), 0 > transitionStartTime)) { lane = resolveEventTimeStamp(); method = resolveEventType(); if (lane !== transitionEventRepeatTime || method !== transitionEventType) transitionEventRepeatTime = -1.1; transitionEventTime = lane; transitionEventType = method; } } function startHostActionTimer(fiber) { if (0 > blockingUpdateTime) { blockingUpdateTime = now(); blockingUpdateTask = null != fiber._debugTask ? fiber._debugTask : null; isAlreadyRendering() && (blockingUpdateType = 1); var newEventTime = resolveEventTimeStamp(), newEventType = resolveEventType(); newEventTime !== blockingEventRepeatTime || newEventType !== blockingEventType ? blockingEventRepeatTime = -1.1 : null !== newEventType && (blockingUpdateType = 1); blockingEventTime = newEventTime; blockingEventType = newEventType; } if (0 > transitionUpdateTime && (transitionUpdateTime = now(), transitionUpdateTask = null != fiber._debugTask ? fiber._debugTask : null, 0 > transitionStartTime)) { fiber = resolveEventTimeStamp(); newEventTime = resolveEventType(); if (fiber !== transitionEventRepeatTime || newEventTime !== transitionEventType) transitionEventRepeatTime = -1.1; transitionEventTime = fiber; transitionEventType = newEventTime; } } function pushNestedEffectDurations() { var prevEffectDuration = profilerEffectDuration; profilerEffectDuration = 0; return prevEffectDuration; } function popNestedEffectDurations(prevEffectDuration) { var elapsedTime = profilerEffectDuration; profilerEffectDuration = prevEffectDuration; return elapsedTime; } function bubbleNestedEffectDurations(prevEffectDuration) { var elapsedTime = profilerEffectDuration; profilerEffectDuration += prevEffectDuration; return elapsedTime; } function resetComponentEffectTimers() { componentEffectEndTime = componentEffectStartTime = -1.1; } function pushComponentEffectStart() { var prevEffectStart = componentEffectStartTime; componentEffectStartTime = -1.1; return prevEffectStart; } function popComponentEffectStart(prevEffectStart) { 0 <= prevEffectStart && (componentEffectStartTime = prevEffectStart); } function pushComponentEffectDuration() { var prevEffectDuration = componentEffectDuration; componentEffectDuration = -0; return prevEffectDuration; } function popComponentEffectDuration(prevEffectDuration) { 0 <= prevEffectDuration && (componentEffectDuration = prevEffectDuration); } function pushComponentEffectErrors() { var prevErrors = componentEffectErrors; componentEffectErrors = null; return prevErrors; } function pushComponentEffectDidSpawnUpdate() { var prev = componentEffectSpawnedUpdate; componentEffectSpawnedUpdate = !1; return prev; } function startProfilerTimer(fiber) { profilerStartTime = now(); 0 > fiber.actualStartTime && (fiber.actualStartTime = profilerStartTime); } function stopProfilerTimerIfRunningAndRecordDuration(fiber) { if (0 <= profilerStartTime) { var elapsedTime = now() - profilerStartTime; fiber.actualDuration += elapsedTime; fiber.selfBaseDuration = elapsedTime; profilerStartTime = -1; } } function stopProfilerTimerIfRunningAndRecordIncompleteDuration(fiber) { if (0 <= profilerStartTime) { var elapsedTime = now() - profilerStartTime; fiber.actualDuration += elapsedTime; profilerStartTime = -1; } } function recordEffectDuration() { if (0 <= profilerStartTime) { var endTime = now(), elapsedTime = endTime - profilerStartTime; profilerStartTime = -1; profilerEffectDuration += elapsedTime; componentEffectDuration += elapsedTime; componentEffectEndTime = endTime; } } function recordEffectError(errorInfo) { null === componentEffectErrors && (componentEffectErrors = []); componentEffectErrors.push(errorInfo); null === commitErrors && (commitErrors = []); commitErrors.push(errorInfo); } function startEffectTimer() { profilerStartTime = now(); 0 > componentEffectStartTime && (componentEffectStartTime = profilerStartTime); } function transferActualDuration(fiber) { for (var child = fiber.child; child;) fiber.actualDuration += child.actualDuration, child = child.sibling; } function noop$1() {} function ensureRootIsScheduled(root) { root !== lastScheduledRoot && null === root.next && (null === lastScheduledRoot ? firstScheduledRoot = lastScheduledRoot = root : lastScheduledRoot = lastScheduledRoot.next = root); mightHavePendingSyncWork = !0; null !== ReactSharedInternals.actQueue ? didScheduleMicrotask_act || (didScheduleMicrotask_act = !0, scheduleImmediateRootScheduleTask()) : didScheduleMicrotask || (didScheduleMicrotask = !0, scheduleImmediateRootScheduleTask()); } function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { if (!isFlushingWork && mightHavePendingSyncWork) { isFlushingWork = !0; do { var didPerformSomeWork = !1; for (var root = firstScheduledRoot; null !== root;) { if (!onlyLegacy) if (0 !== syncTransitionLanes) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) var nextLanes = 0; else { var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes; nextLanes = (1 << 31 - clz32(42 | syncTransitionLanes) + 1) - 1; nextLanes &= pendingLanes & ~(suspendedLanes & ~pingedLanes); nextLanes = nextLanes & 201326741 ? nextLanes & 201326741 | 1 : nextLanes ? nextLanes | 2 : 0; } 0 !== nextLanes && (didPerformSomeWork = !0, performSyncWorkOnRoot(root, nextLanes)); } else nextLanes = workInProgressRootRenderLanes, nextLanes = getNextLanes(root, root === workInProgressRoot ? nextLanes : 0, null !== root.cancelPendingCommit || root.timeoutHandle !== noTimeout), 0 === (nextLanes & 3) || checkIfRootIsPrerendering(root, nextLanes) || (didPerformSomeWork = !0, performSyncWorkOnRoot(root, nextLanes)); root = root.next; } } while (didPerformSomeWork); isFlushingWork = !1; } } function processRootScheduleInImmediateTask() { trackSchedulerEvent(); processRootScheduleInMicrotask(); } function processRootScheduleInMicrotask() { mightHavePendingSyncWork = didScheduleMicrotask_act = didScheduleMicrotask = !1; var syncTransitionLanes = 0; 0 !== currentEventTransitionLane && shouldAttemptEagerTransition() && (syncTransitionLanes = currentEventTransitionLane); for (var currentTime = now$1(), prev = null, root = firstScheduledRoot; null !== root;) { var next = root.next, nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); if (0 === nextLanes) root.next = null, null === prev ? firstScheduledRoot = next : prev.next = next, null === next && (lastScheduledRoot = prev); else if (prev = root, 0 !== syncTransitionLanes || 0 !== (nextLanes & 3)) mightHavePendingSyncWork = !0; root = next; } pendingEffectsStatus !== NO_PENDING_EFFECTS && pendingEffectsStatus !== PENDING_PASSIVE_PHASE || flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1); 0 !== currentEventTransitionLane && (currentEventTransitionLane = 0); } function scheduleTaskForRootDuringMicrotask(root, currentTime) { for (var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, lanes = root.pendingLanes & -62914561; 0 < lanes;) { var index = 31 - clz32(lanes), lane = 1 << index, expirationTime = expirationTimes[index]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) expirationTimes[index] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } currentTime = workInProgressRoot; suspendedLanes = workInProgressRootRenderLanes; suspendedLanes = getNextLanes(root, root === currentTime ? suspendedLanes : 0, null !== root.cancelPendingCommit || root.timeoutHandle !== noTimeout); pingedLanes = root.callbackNode; if (0 === suspendedLanes || root === currentTime && (workInProgressSuspendedReason === SuspendedOnData || workInProgressSuspendedReason === SuspendedOnAction) || null !== root.cancelPendingCommit) return null !== pingedLanes && cancelCallback(pingedLanes), root.callbackNode = null, root.callbackPriority = 0; if (0 === (suspendedLanes & 3) || checkIfRootIsPrerendering(root, suspendedLanes)) { currentTime = suspendedLanes & -suspendedLanes; if (currentTime !== root.callbackPriority || null !== ReactSharedInternals.actQueue && pingedLanes !== fakeActCallbackNode$1) cancelCallback(pingedLanes); else return currentTime; switch (lanesToEventPriority(suspendedLanes)) { case 2: case 8: suspendedLanes = UserBlockingPriority; break; case 32: suspendedLanes = NormalPriority$1; break; case 268435456: suspendedLanes = IdlePriority; break; default: suspendedLanes = NormalPriority$1; } pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); null !== ReactSharedInternals.actQueue ? (ReactSharedInternals.actQueue.push(pingedLanes), suspendedLanes = fakeActCallbackNode$1) : suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes); root.callbackPriority = currentTime; root.callbackNode = suspendedLanes; return currentTime; } null !== pingedLanes && cancelCallback(pingedLanes); root.callbackPriority = 2; root.callbackNode = null; return 2; } function performWorkOnRootViaSchedulerTask(root, didTimeout) { nestedUpdateScheduled = currentUpdateIsNested = !1; trackSchedulerEvent(); if (pendingEffectsStatus !== NO_PENDING_EFFECTS && pendingEffectsStatus !== PENDING_PASSIVE_PHASE) return root.callbackNode = null, root.callbackPriority = 0, null; var originalCallbackNode = root.callbackNode; pendingDelayedCommitReason === IMMEDIATE_COMMIT && (pendingDelayedCommitReason = DELAYED_PASSIVE_COMMIT); if (flushPendingEffects() && root.callbackNode !== originalCallbackNode) return null; var workInProgressRootRenderLanes$jscomp$0 = workInProgressRootRenderLanes; workInProgressRootRenderLanes$jscomp$0 = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes$jscomp$0 : 0, null !== root.cancelPendingCommit || root.timeoutHandle !== noTimeout); if (0 === workInProgressRootRenderLanes$jscomp$0) return null; performWorkOnRoot(root, workInProgressRootRenderLanes$jscomp$0, didTimeout); scheduleTaskForRootDuringMicrotask(root, now$1()); return null != root.callbackNode && root.callbackNode === originalCallbackNode ? performWorkOnRootViaSchedulerTask.bind(null, root) : null; } function performSyncWorkOnRoot(root, lanes) { if (flushPendingEffects()) return null; currentUpdateIsNested = nestedUpdateScheduled; nestedUpdateScheduled = !1; performWorkOnRoot(root, lanes, !0); } function cancelCallback(callbackNode) { callbackNode !== fakeActCallbackNode$1 && null !== callbackNode && cancelCallback$1(callbackNode); } function scheduleImmediateRootScheduleTask() { null !== ReactSharedInternals.actQueue && ReactSharedInternals.actQueue.push(function() { processRootScheduleInMicrotask(); return null; }); supportsMicrotasks ? scheduleMicrotask(function() { (executionContext & (RenderContext | CommitContext)) !== NoContext ? scheduleCallback$3(ImmediatePriority, processRootScheduleInImmediateTask) : processRootScheduleInMicrotask(); }) : scheduleCallback$3(ImmediatePriority, processRootScheduleInImmediateTask); } function requestTransitionLane() { if (0 === currentEventTransitionLane) { var actionScopeLane = currentEntangledLane; 0 === actionScopeLane && (actionScopeLane = nextTransitionUpdateLane, nextTransitionUpdateLane <<= 1, 0 === (nextTransitionUpdateLane & 261888) && (nextTransitionUpdateLane = 256)); currentEventTransitionLane = actionScopeLane; } return currentEventTransitionLane; } function entangleAsyncAction(transition, thenable) { if (null === currentEntangledListeners) { var entangledListeners = currentEntangledListeners = []; currentEntangledPendingCount = 0; currentEntangledLane = requestTransitionLane(); currentEntangledActionThenable = { status: "pending", value: void 0, then: function(resolve) { entangledListeners.push(resolve); } }; } currentEntangledPendingCount++; thenable.then(pingEngtangledActionScope, pingEngtangledActionScope); return thenable; } function pingEngtangledActionScope() { if (0 === --currentEntangledPendingCount && (-1 < transitionUpdateTime || (transitionStartTime = -1.1), entangledTransitionTypes = null, null !== currentEntangledListeners)) { null !== currentEntangledActionThenable && (currentEntangledActionThenable.status = "fulfilled"); var listeners = currentEntangledListeners; currentEntangledListeners = null; currentEntangledLane = 0; currentEntangledActionThenable = null; for (var i = 0; i < listeners.length; i++) (0, listeners[i])(); } } function chainThenableValue(thenable, result) { var listeners = [], thenableWithOverride = { status: "pending", value: null, reason: null, then: function(resolve) { listeners.push(resolve); } }; thenable.then(function() { thenableWithOverride.status = "fulfilled"; thenableWithOverride.value = result; for (var i = 0; i < listeners.length; i++) (0, listeners[i])(result); }, function(error) { thenableWithOverride.status = "rejected"; thenableWithOverride.reason = error; for (error = 0; error < listeners.length; error++) (0, listeners[error])(void 0); }); return thenableWithOverride; } function peekCacheFromPool() { var cacheResumedFromPreviousRender = resumedCache.current; return null !== cacheResumedFromPreviousRender ? cacheResumedFromPreviousRender : workInProgressRoot.pooledCache; } function pushTransition(offscreenWorkInProgress, prevCachePool) { null === prevCachePool ? push(resumedCache, resumedCache.current, offscreenWorkInProgress) : push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); } function getSuspendedCache() { var cacheFromPool = peekCacheFromPool(); return null === cacheFromPool ? null : { parent: isPrimaryRenderer ? CacheContext._currentValue : CacheContext._currentValue2, pool: cacheFromPool }; } function shallowEqual(objA, objB) { if (objectIs(objA, objB)) return !0; if ("object" !== typeof objA || null === objA || "object" !== typeof objB || null === objB) return !1; var keysA = Object.keys(objA), keysB = Object.keys(objB); if (keysA.length !== keysB.length) return !1; for (keysB = 0; keysB < keysA.length; keysB++) { var currentKey = keysA[keysB]; if (!hasOwnProperty.call(objB, currentKey) || !objectIs(objA[currentKey], objB[currentKey])) return !1; } return !0; } function createThenableState() { return { didWarnAboutUncachedPromise: !1, thenables: [] }; } function isThenableResolved(thenable) { thenable = thenable.status; return "fulfilled" === thenable || "rejected" === thenable; } function trackUsedThenable(thenableState, thenable, index, fiber) { null !== ReactSharedInternals.actQueue && (ReactSharedInternals.didUsePromise = !0); var trackedThenables = thenableState.thenables; index = trackedThenables[index]; void 0 === index ? trackedThenables.push(thenable) : index !== thenable && (thenableState.didWarnAboutUncachedPromise || (thenableState.didWarnAboutUncachedPromise = !0, console.error("A component was suspended by an uncached promise. Creating promises inside a Client Component or hook is not yet supported, except via a Suspense-compatible library or framework.")), thenable.then(noop$1, noop$1), thenable = index); if (void 0 === thenable._debugInfo) { thenableState = performance.now(); trackedThenables = thenable.displayName; var ioInfo = { name: "string" === typeof trackedThenables ? trackedThenables : "Promise", start: thenableState, end: thenableState, value: thenable }; thenable._debugInfo = [{ awaited: ioInfo }]; "fulfilled" !== thenable.status && "rejected" !== thenable.status && (thenableState = function() { ioInfo.end = performance.now(); }, thenable.then(thenableState, thenableState)); } switch (thenable.status) { case "fulfilled": return thenable.value; case "rejected": fiber = thenable.reason; checkIfUseWrappedInAsyncCatch(fiber); if (void 0 === fiber && !("reason" in thenable)) throw Error("A rejected Promise was passed to React without a `reason` property. React threw a generic error from where the Promise was used to assist in identifying the problematic Promise. Make sure that instrumented Promises correctly set the `reason` property when setting `status` to `'rejected'`."); throw fiber; default: if ("string" === typeof thenable.status) thenable.then(noop$1, noop$1); else { thenableState = workInProgressRoot; if (null !== thenableState && 100 < thenableState.shellSuspendCounter) throw Error("An unknown Component is an async Client Component. Only Server Components can be async at the moment. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server."); thenableState = thenable; thenableState.status = "pending"; thenableState.then(function(fulfilledValue) { if ("pending" === thenable.status) { var fulfilledThenable = thenable; fulfilledThenable.status = "fulfilled"; fulfilledThenable.value = fulfilledValue; } }, function(error) { if ("pending" === thenable.status) { var rejectedThenable = thenable; rejectedThenable.status = "rejected"; rejectedThenable.reason = error; } }); } switch (thenable.status) { case "fulfilled": return thenable.value; case "rejected": throw fiber = thenable.reason, checkIfUseWrappedInAsyncCatch(fiber), fiber; } suspendedThenable = thenable; needsToResetSuspendedThenableDEV = !0; didIssueUseWarning || null === fiber || null !== fiber.alternate || (lastSuspendedFiber = fiber, lastSuspendedStack = Error("This library called use() to suspend in a previous render but did not call use() when it finished. This indicates an incorrect use of use(). Learn more: https://react.dev/warnings/conditional-use-of-use")); throw SuspenseException; } } function resolveLazy(lazyType) { try { return callLazyInitInDEV(lazyType); } catch (x) { if (null !== x && "object" === typeof x && "function" === typeof x.then) throw suspendedThenable = x, needsToResetSuspendedThenableDEV = !0, SuspenseException; throw x; } } function getSuspendedThenable() { if (null === suspendedThenable) throw Error("Expected a suspended thenable. This is a bug in React. Please file an issue."); var thenable = suspendedThenable; suspendedThenable = null; needsToResetSuspendedThenableDEV = !1; return thenable; } function checkIfUseWrappedInAsyncCatch(rejectedReason) { if (rejectedReason === SuspenseException || rejectedReason === SuspenseActionException) throw Error("Hooks are not supported inside an async component. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server."); } function areSameKeyPath(a, b) { return a === b ? !0 : a.tag !== b.tag || a.type !== b.type || a.key !== b.key || a.index !== b.index || 3 === a.tag && a.stateNode !== b.stateNode || null === a.return || null === b.return ? !1 : areSameKeyPath(a.return, b.return); } function pushDebugInfo(debugInfo) { var previousDebugInfo = currentDebugInfo; null != debugInfo && (currentDebugInfo = null === previousDebugInfo ? debugInfo : previousDebugInfo.concat(debugInfo)); return previousDebugInfo; } function getCurrentDebugTask() { var debugInfo = currentDebugInfo; if (null != debugInfo) { for (var i = debugInfo.length - 1; 0 <= i; i--) if (null != debugInfo[i].name) { var debugTask = debugInfo[i].debugTask; if (null != debugTask) return debugTask; } } return null; } function validateFragmentProps(element, fiber, returnFiber) { for (var keys = Object.keys(element.props), i = 0; i < keys.length; i++) { var key = keys[i]; if ("children" !== key && "key" !== key && "ref" !== key) { null === fiber && (fiber = createFiberFromElement(element, returnFiber.mode, 0), fiber._debugInfo = currentDebugInfo, fiber.return = returnFiber); runWithFiberInDEV(fiber, function(erroredKey) { console.error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key`, `ref`, and `children` props.", erroredKey); }, key); break; } } } function unwrapThenable(thenable) { var index = thenableIndexCounter$1; thenableIndexCounter$1 += 1; null === thenableState$1 && (thenableState$1 = createThenableState()); return trackUsedThenable(thenableState$1, thenable, index, null); } function coerceRef(workInProgress, element) { element = element.props.ref; workInProgress.ref = void 0 !== element ? element : null; } function throwOnInvalidObjectTypeImpl(returnFiber, newChild) { if (newChild.$$typeof === REACT_LEGACY_ELEMENT_TYPE) throw Error("A React Element from an older version of React was rendered. This is not supported. It can happen if:\n- Multiple copies of the \"react\" package is used.\n- A library pre-bundled an old copy of \"react\" or \"react/jsx-runtime\".\n- A compiler tries to \"inline\" JSX instead of using the runtime."); returnFiber = Object.prototype.toString.call(newChild); throw Error("Objects are not valid as a React child (found: " + ("[object Object]" === returnFiber ? "object with keys {" + Object.keys(newChild).join(", ") + "}" : returnFiber) + "). If you meant to render a collection of children, use an array instead."); } function throwOnInvalidObjectType(returnFiber, newChild) { var debugTask = getCurrentDebugTask(); null !== debugTask ? debugTask.run(throwOnInvalidObjectTypeImpl.bind(null, returnFiber, newChild)) : throwOnInvalidObjectTypeImpl(returnFiber, newChild); } function warnOnFunctionTypeImpl(returnFiber, invalidChild) { var parentName = getComponentNameFromFiber(returnFiber) || "Component"; ownerHasFunctionTypeWarning[parentName] || (ownerHasFunctionTypeWarning[parentName] = !0, invalidChild = invalidChild.displayName || invalidChild.name || "Component", 3 === returnFiber.tag ? console.error("Functions are not valid as a React child. This may happen if you return %s instead of <%s /> from render. Or maybe you meant to call this function rather than return it.\n root.render(%s)", invalidChild, invalidChild, invalidChild) : console.error("Functions are not valid as a React child. This may happen if you return %s instead of <%s /> from render. Or maybe you meant to call this function rather than return it.\n <%s>{%s}", invalidChild, invalidChild, parentName, invalidChild, parentName)); } function warnOnFunctionType(returnFiber, invalidChild) { var debugTask = getCurrentDebugTask(); null !== debugTask ? debugTask.run(warnOnFunctionTypeImpl.bind(null, returnFiber, invalidChild)) : warnOnFunctionTypeImpl(returnFiber, invalidChild); } function warnOnSymbolTypeImpl(returnFiber, invalidChild) { var parentName = getComponentNameFromFiber(returnFiber) || "Component"; ownerHasSymbolTypeWarning[parentName] || (ownerHasSymbolTypeWarning[parentName] = !0, invalidChild = String(invalidChild), 3 === returnFiber.tag ? console.error("Symbols are not valid as a React child.\n root.render(%s)", invalidChild) : console.error("Symbols are not valid as a React child.\n <%s>%s", parentName, invalidChild, parentName)); } function warnOnSymbolType(returnFiber, invalidChild) { var debugTask = getCurrentDebugTask(); null !== debugTask ? debugTask.run(warnOnSymbolTypeImpl.bind(null, returnFiber, invalidChild)) : warnOnSymbolTypeImpl(returnFiber, invalidChild); } function createChildReconciler(shouldTrackSideEffects) { function deleteChild(returnFiber, childToDelete) { if (shouldTrackSideEffects) { var deletions = returnFiber.deletions; null === deletions ? (returnFiber.deletions = [childToDelete], returnFiber.flags |= 16) : deletions.push(childToDelete); } } function deleteRemainingChildren(returnFiber, currentFirstChild) { if (!shouldTrackSideEffects) return null; for (; null !== currentFirstChild;) deleteChild(returnFiber, currentFirstChild), currentFirstChild = currentFirstChild.sibling; return null; } function mapRemainingChildren(currentFirstChild) { for (var existingChildren = /* @__PURE__ */ new Map(); null !== currentFirstChild;) null === currentFirstChild.key ? existingChildren.set(currentFirstChild.index, currentFirstChild) : existingChildren.set(currentFirstChild.key, currentFirstChild), currentFirstChild = currentFirstChild.sibling; return existingChildren; } function useFiber(fiber, pendingProps) { fiber = createWorkInProgress(fiber, pendingProps); fiber.index = 0; fiber.sibling = null; return fiber; } function placeChild(newFiber, lastPlacedIndex, newIndex) { newFiber.index = newIndex; if (!shouldTrackSideEffects) return newFiber.flags |= 1048576, lastPlacedIndex; newIndex = newFiber.alternate; if (null !== newIndex) return newIndex = newIndex.index, newIndex < lastPlacedIndex ? (newFiber.flags |= 2, lastPlacedIndex) : newIndex; newFiber.flags |= 134217730; return lastPlacedIndex; } function placeSingleChild(newFiber) { shouldTrackSideEffects && null === newFiber.alternate && (newFiber.flags |= 134217730); return newFiber; } function updateTextNode(returnFiber, current, textContent, lanes) { if (null === current || 6 !== current.tag) return current = createFiberFromText(textContent, returnFiber.mode, lanes), current.return = returnFiber, current._debugOwner = returnFiber, current._debugTask = returnFiber._debugTask, current._debugInfo = currentDebugInfo, current; current = useFiber(current, textContent); current.return = returnFiber; current._debugInfo = currentDebugInfo; return current; } function updateElement(returnFiber, current, element, lanes) { var elementType = element.type; if (elementType === REACT_FRAGMENT_TYPE) return current = updateFragment(returnFiber, current, element.props.children, lanes, element.key), coerceRef(current, element), validateFragmentProps(element, current, returnFiber), current; if (null !== current && (current.elementType === elementType || isCompatibleFamilyForHotReloading(current, element) || "object" === typeof elementType && null !== elementType && elementType.$$typeof === REACT_LAZY_TYPE && resolveLazy(elementType) === current.type)) return current = useFiber(current, element.props), coerceRef(current, element), current.return = returnFiber, current._debugOwner = element._owner, current._debugInfo = currentDebugInfo, current; current = createFiberFromElement(element, returnFiber.mode, lanes); coerceRef(current, element); current.return = returnFiber; current._debugInfo = currentDebugInfo; return current; } function updatePortal(returnFiber, current, portal, lanes) { if (null === current || 4 !== current.tag || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) return current = createFiberFromPortal(portal, returnFiber.mode, lanes), current.return = returnFiber, current._debugInfo = currentDebugInfo, current; current = useFiber(current, portal.children || []); current.return = returnFiber; current._debugInfo = currentDebugInfo; return current; } function updateFragment(returnFiber, current, fragment, lanes, key) { if (null === current || 7 !== current.tag) return current = createFiberFromFragment(fragment, returnFiber.mode, lanes, key), current.return = returnFiber, current._debugOwner = returnFiber, current._debugTask = returnFiber._debugTask, current._debugInfo = currentDebugInfo, current; current = useFiber(current, fragment); current.return = returnFiber; current._debugInfo = currentDebugInfo; return current; } function createChild(returnFiber, newChild, lanes) { if ("string" === typeof newChild && "" !== newChild || "number" === typeof newChild || "bigint" === typeof newChild) return newChild = createFiberFromText("" + newChild, returnFiber.mode, lanes), newChild.return = returnFiber, newChild._debugOwner = returnFiber, newChild._debugTask = returnFiber._debugTask, newChild._debugInfo = currentDebugInfo, newChild; if ("object" === typeof newChild && null !== newChild) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: return lanes = createFiberFromElement(newChild, returnFiber.mode, lanes), coerceRef(lanes, newChild), lanes.return = returnFiber, returnFiber = pushDebugInfo(newChild._debugInfo), lanes._debugInfo = currentDebugInfo, currentDebugInfo = returnFiber, lanes; case REACT_PORTAL_TYPE: return newChild = createFiberFromPortal(newChild, returnFiber.mode, lanes), newChild.return = returnFiber, newChild._debugInfo = currentDebugInfo, newChild; case REACT_LAZY_TYPE: var _prevDebugInfo = pushDebugInfo(newChild._debugInfo); newChild = resolveLazy(newChild); returnFiber = createChild(returnFiber, newChild, lanes); currentDebugInfo = _prevDebugInfo; return returnFiber; } if (isArrayImpl(newChild) || getIteratorFn(newChild)) return lanes = createFiberFromFragment(newChild, returnFiber.mode, lanes, null), lanes.return = returnFiber, lanes._debugOwner = returnFiber, lanes._debugTask = returnFiber._debugTask, returnFiber = pushDebugInfo(newChild._debugInfo), lanes._debugInfo = currentDebugInfo, currentDebugInfo = returnFiber, lanes; if ("function" === typeof newChild.then) return _prevDebugInfo = pushDebugInfo(newChild._debugInfo), returnFiber = createChild(returnFiber, unwrapThenable(newChild), lanes), currentDebugInfo = _prevDebugInfo, returnFiber; if (newChild.$$typeof === REACT_CONTEXT_TYPE) return createChild(returnFiber, readContextDuringReconciliation(returnFiber, newChild), lanes); throwOnInvalidObjectType(returnFiber, newChild); } "function" === typeof newChild && warnOnFunctionType(returnFiber, newChild); "symbol" === typeof newChild && warnOnSymbolType(returnFiber, newChild); return null; } function updateSlot(returnFiber, oldFiber, newChild, lanes) { var key = null !== oldFiber ? oldFiber.key : null; if ("string" === typeof newChild && "" !== newChild || "number" === typeof newChild || "bigint" === typeof newChild) return null !== key ? null : updateTextNode(returnFiber, oldFiber, "" + newChild, lanes); if ("object" === typeof newChild && null !== newChild) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: return newChild.key === key ? (key = pushDebugInfo(newChild._debugInfo), returnFiber = updateElement(returnFiber, oldFiber, newChild, lanes), currentDebugInfo = key, returnFiber) : null; case REACT_PORTAL_TYPE: return newChild.key === key ? updatePortal(returnFiber, oldFiber, newChild, lanes) : null; case REACT_LAZY_TYPE: return key = pushDebugInfo(newChild._debugInfo), newChild = resolveLazy(newChild), returnFiber = updateSlot(returnFiber, oldFiber, newChild, lanes), currentDebugInfo = key, returnFiber; } if (isArrayImpl(newChild) || getIteratorFn(newChild)) { if (null !== key) return null; key = pushDebugInfo(newChild._debugInfo); returnFiber = updateFragment(returnFiber, oldFiber, newChild, lanes, null); currentDebugInfo = key; return returnFiber; } if ("function" === typeof newChild.then) return key = pushDebugInfo(newChild._debugInfo), returnFiber = updateSlot(returnFiber, oldFiber, unwrapThenable(newChild), lanes), currentDebugInfo = key, returnFiber; if (newChild.$$typeof === REACT_CONTEXT_TYPE) return updateSlot(returnFiber, oldFiber, readContextDuringReconciliation(returnFiber, newChild), lanes); throwOnInvalidObjectType(returnFiber, newChild); } "function" === typeof newChild && warnOnFunctionType(returnFiber, newChild); "symbol" === typeof newChild && warnOnSymbolType(returnFiber, newChild); return null; } function updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes) { if ("string" === typeof newChild && "" !== newChild || "number" === typeof newChild || "bigint" === typeof newChild) return existingChildren = existingChildren.get(newIdx) || null, updateTextNode(returnFiber, existingChildren, "" + newChild, lanes); if ("object" === typeof newChild && null !== newChild) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: return newIdx = existingChildren.get(null === newChild.key ? newIdx : newChild.key) || null, existingChildren = pushDebugInfo(newChild._debugInfo), returnFiber = updateElement(returnFiber, newIdx, newChild, lanes), currentDebugInfo = existingChildren, returnFiber; case REACT_PORTAL_TYPE: return existingChildren = existingChildren.get(null === newChild.key ? newIdx : newChild.key) || null, updatePortal(returnFiber, existingChildren, newChild, lanes); case REACT_LAZY_TYPE: var _prevDebugInfo7 = pushDebugInfo(newChild._debugInfo); newChild = resolveLazy(newChild); returnFiber = updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes); currentDebugInfo = _prevDebugInfo7; return returnFiber; } if (isArrayImpl(newChild) || getIteratorFn(newChild)) return newIdx = existingChildren.get(newIdx) || null, existingChildren = pushDebugInfo(newChild._debugInfo), returnFiber = updateFragment(returnFiber, newIdx, newChild, lanes, null), currentDebugInfo = existingChildren, returnFiber; if ("function" === typeof newChild.then) return _prevDebugInfo7 = pushDebugInfo(newChild._debugInfo), returnFiber = updateFromMap(existingChildren, returnFiber, newIdx, unwrapThenable(newChild), lanes), currentDebugInfo = _prevDebugInfo7, returnFiber; if (newChild.$$typeof === REACT_CONTEXT_TYPE) return updateFromMap(existingChildren, returnFiber, newIdx, readContextDuringReconciliation(returnFiber, newChild), lanes); throwOnInvalidObjectType(returnFiber, newChild); } "function" === typeof newChild && warnOnFunctionType(returnFiber, newChild); "symbol" === typeof newChild && warnOnSymbolType(returnFiber, newChild); return null; } function warnOnInvalidKey(returnFiber, workInProgress, child, knownKeys) { if ("object" !== typeof child || null === child) return knownKeys; switch (child.$$typeof) { case REACT_ELEMENT_TYPE: case REACT_PORTAL_TYPE: warnForMissingKey(returnFiber, workInProgress, child); var key = child.key; if ("string" !== typeof key) break; if (null === knownKeys) { knownKeys = /* @__PURE__ */ new Set(); knownKeys.add(key); break; } if (!knownKeys.has(key)) { knownKeys.add(key); break; } runWithFiberInDEV(workInProgress, function() { console.error("Encountered two children with the same key, `%s`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.", key); }); break; case REACT_LAZY_TYPE: child = resolveLazy(child), warnOnInvalidKey(returnFiber, workInProgress, child, knownKeys); } return knownKeys; } function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, lanes) { for (var knownKeys = null, resultingFirstChild = null, previousNewFiber = null, oldFiber = currentFirstChild, newIdx = currentFirstChild = 0, nextOldFiber = null; null !== oldFiber && newIdx < newChildren.length; newIdx++) { oldFiber.index > newIdx ? (nextOldFiber = oldFiber, oldFiber = null) : nextOldFiber = oldFiber.sibling; var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], lanes); if (null === newFiber) { null === oldFiber && (oldFiber = nextOldFiber); break; } knownKeys = warnOnInvalidKey(returnFiber, newFiber, newChildren[newIdx], knownKeys); shouldTrackSideEffects && oldFiber && null === newFiber.alternate && deleteChild(returnFiber, oldFiber); currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx); null === previousNewFiber ? resultingFirstChild = newFiber : previousNewFiber.sibling = newFiber; previousNewFiber = newFiber; oldFiber = nextOldFiber; } if (newIdx === newChildren.length) return deleteRemainingChildren(returnFiber, oldFiber), isHydrating && pushTreeFork(returnFiber, newIdx), resultingFirstChild; if (null === oldFiber) { for (; newIdx < newChildren.length; newIdx++) oldFiber = createChild(returnFiber, newChildren[newIdx], lanes), null !== oldFiber && (knownKeys = warnOnInvalidKey(returnFiber, oldFiber, newChildren[newIdx], knownKeys), currentFirstChild = placeChild(oldFiber, currentFirstChild, newIdx), null === previousNewFiber ? resultingFirstChild = oldFiber : previousNewFiber.sibling = oldFiber, previousNewFiber = oldFiber); isHydrating && pushTreeFork(returnFiber, newIdx); return resultingFirstChild; } for (oldFiber = mapRemainingChildren(oldFiber); newIdx < newChildren.length; newIdx++) nextOldFiber = updateFromMap(oldFiber, returnFiber, newIdx, newChildren[newIdx], lanes), null !== nextOldFiber && (knownKeys = warnOnInvalidKey(returnFiber, nextOldFiber, newChildren[newIdx], knownKeys), shouldTrackSideEffects && (newFiber = nextOldFiber.alternate, null !== newFiber && oldFiber.delete(null === newFiber.key ? newIdx : newFiber.key)), currentFirstChild = placeChild(nextOldFiber, currentFirstChild, newIdx), null === previousNewFiber ? resultingFirstChild = nextOldFiber : previousNewFiber.sibling = nextOldFiber, previousNewFiber = nextOldFiber); shouldTrackSideEffects && oldFiber.forEach(function(child) { return deleteChild(returnFiber, child); }); isHydrating && pushTreeFork(returnFiber, newIdx); return resultingFirstChild; } function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildren, lanes) { if (null == newChildren) throw Error("An iterable object provided no iterator."); for (var resultingFirstChild = null, previousNewFiber = null, oldFiber = currentFirstChild, newIdx = currentFirstChild = 0, nextOldFiber = null, knownKeys = null, step = newChildren.next(); null !== oldFiber && !step.done; newIdx++, step = newChildren.next()) { oldFiber.index > newIdx ? (nextOldFiber = oldFiber, oldFiber = null) : nextOldFiber = oldFiber.sibling; var newFiber = updateSlot(returnFiber, oldFiber, step.value, lanes); if (null === newFiber) { null === oldFiber && (oldFiber = nextOldFiber); break; } knownKeys = warnOnInvalidKey(returnFiber, newFiber, step.value, knownKeys); shouldTrackSideEffects && oldFiber && null === newFiber.alternate && deleteChild(returnFiber, oldFiber); currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx); null === previousNewFiber ? resultingFirstChild = newFiber : previousNewFiber.sibling = newFiber; previousNewFiber = newFiber; oldFiber = nextOldFiber; } if (step.done) return deleteRemainingChildren(returnFiber, oldFiber), isHydrating && pushTreeFork(returnFiber, newIdx), resultingFirstChild; if (null === oldFiber) { for (; !step.done; newIdx++, step = newChildren.next()) oldFiber = createChild(returnFiber, step.value, lanes), null !== oldFiber && (knownKeys = warnOnInvalidKey(returnFiber, oldFiber, step.value, knownKeys), currentFirstChild = placeChild(oldFiber, currentFirstChild, newIdx), null === previousNewFiber ? resultingFirstChild = oldFiber : previousNewFiber.sibling = oldFiber, previousNewFiber = oldFiber); isHydrating && pushTreeFork(returnFiber, newIdx); return resultingFirstChild; } for (oldFiber = mapRemainingChildren(oldFiber); !step.done; newIdx++, step = newChildren.next()) nextOldFiber = updateFromMap(oldFiber, returnFiber, newIdx, step.value, lanes), null !== nextOldFiber && (knownKeys = warnOnInvalidKey(returnFiber, nextOldFiber, step.value, knownKeys), shouldTrackSideEffects && (step = nextOldFiber.alternate, null !== step && oldFiber.delete(null === step.key ? newIdx : step.key)), currentFirstChild = placeChild(nextOldFiber, currentFirstChild, newIdx), null === previousNewFiber ? resultingFirstChild = nextOldFiber : previousNewFiber.sibling = nextOldFiber, previousNewFiber = nextOldFiber); shouldTrackSideEffects && oldFiber.forEach(function(child) { return deleteChild(returnFiber, child); }); isHydrating && pushTreeFork(returnFiber, newIdx); return resultingFirstChild; } function reconcileChildFibersImpl(returnFiber, currentFirstChild, newChild, lanes) { "object" === typeof newChild && null !== newChild && newChild.type === REACT_FRAGMENT_TYPE && null === newChild.key && void 0 === newChild.props.ref && (validateFragmentProps(newChild, null, returnFiber), newChild = newChild.props.children); if ("object" === typeof newChild && null !== newChild) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: var prevDebugInfo = pushDebugInfo(newChild._debugInfo); a: { for (var key = newChild.key; null !== currentFirstChild;) { if (currentFirstChild.key === key) { key = newChild.type; if (key === REACT_FRAGMENT_TYPE) { if (7 === currentFirstChild.tag) { deleteRemainingChildren(returnFiber, currentFirstChild.sibling); lanes = useFiber(currentFirstChild, newChild.props.children); coerceRef(lanes, newChild); lanes.return = returnFiber; lanes._debugOwner = newChild._owner; lanes._debugInfo = currentDebugInfo; validateFragmentProps(newChild, lanes, returnFiber); returnFiber = lanes; break a; } } else if (currentFirstChild.elementType === key || isCompatibleFamilyForHotReloading(currentFirstChild, newChild) || "object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && resolveLazy(key) === currentFirstChild.type) { deleteRemainingChildren(returnFiber, currentFirstChild.sibling); lanes = useFiber(currentFirstChild, newChild.props); coerceRef(lanes, newChild); lanes.return = returnFiber; lanes._debugOwner = newChild._owner; lanes._debugInfo = currentDebugInfo; returnFiber = lanes; break a; } deleteRemainingChildren(returnFiber, currentFirstChild); break; } else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } newChild.type === REACT_FRAGMENT_TYPE ? (lanes = createFiberFromFragment(newChild.props.children, returnFiber.mode, lanes, newChild.key), coerceRef(lanes, newChild), lanes.return = returnFiber, lanes._debugOwner = returnFiber, lanes._debugTask = returnFiber._debugTask, lanes._debugInfo = currentDebugInfo, validateFragmentProps(newChild, lanes, returnFiber), returnFiber = lanes) : (lanes = createFiberFromElement(newChild, returnFiber.mode, lanes), coerceRef(lanes, newChild), lanes.return = returnFiber, lanes._debugInfo = currentDebugInfo, returnFiber = lanes); } returnFiber = placeSingleChild(returnFiber); currentDebugInfo = prevDebugInfo; return returnFiber; case REACT_PORTAL_TYPE: a: { prevDebugInfo = newChild; for (newChild = prevDebugInfo.key; null !== currentFirstChild;) { if (currentFirstChild.key === newChild) if (4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === prevDebugInfo.containerInfo && currentFirstChild.stateNode.implementation === prevDebugInfo.implementation) { deleteRemainingChildren(returnFiber, currentFirstChild.sibling); lanes = useFiber(currentFirstChild, prevDebugInfo.children || []); lanes.return = returnFiber; returnFiber = lanes; break a; } else { deleteRemainingChildren(returnFiber, currentFirstChild); break; } else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } lanes = createFiberFromPortal(prevDebugInfo, returnFiber.mode, lanes); lanes.return = returnFiber; returnFiber = lanes; } return placeSingleChild(returnFiber); case REACT_LAZY_TYPE: return prevDebugInfo = pushDebugInfo(newChild._debugInfo), newChild = resolveLazy(newChild), returnFiber = reconcileChildFibersImpl(returnFiber, currentFirstChild, newChild, lanes), currentDebugInfo = prevDebugInfo, returnFiber; } if (isArrayImpl(newChild)) return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, lanes); if (getIteratorFn(newChild)) { prevDebugInfo = newChild; newChild = getIteratorFn(prevDebugInfo); if ("function" !== typeof newChild) throw Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue."); key = newChild.call(prevDebugInfo); if (key === prevDebugInfo) { if (0 !== returnFiber.tag || "[object GeneratorFunction]" !== Object.prototype.toString.call(returnFiber.type) || "[object Generator]" !== Object.prototype.toString.call(key)) didWarnAboutGenerators || console.error("Using Iterators as children is unsupported and will likely yield unexpected results because enumerating a generator mutates it. You may convert it to an array with `Array.from()` or the `[...spread]` operator before rendering. You can also use an Iterable that can iterate multiple times over the same items."), didWarnAboutGenerators = !0; } else prevDebugInfo.entries !== newChild || didWarnAboutMaps || (console.error("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), didWarnAboutMaps = !0); return reconcileChildrenIterator(returnFiber, currentFirstChild, key, lanes); } if ("function" === typeof newChild.then) return prevDebugInfo = pushDebugInfo(newChild._debugInfo), returnFiber = reconcileChildFibersImpl(returnFiber, currentFirstChild, unwrapThenable(newChild), lanes), currentDebugInfo = prevDebugInfo, returnFiber; if (newChild.$$typeof === REACT_CONTEXT_TYPE) return reconcileChildFibersImpl(returnFiber, currentFirstChild, readContextDuringReconciliation(returnFiber, newChild), lanes); throwOnInvalidObjectType(returnFiber, newChild); } if ("string" === typeof newChild && "" !== newChild || "number" === typeof newChild || "bigint" === typeof newChild) return prevDebugInfo = "" + newChild, null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), lanes = useFiber(currentFirstChild, prevDebugInfo), lanes.return = returnFiber, returnFiber = lanes) : (deleteRemainingChildren(returnFiber, currentFirstChild), lanes = createFiberFromText(prevDebugInfo, returnFiber.mode, lanes), lanes.return = returnFiber, lanes._debugOwner = returnFiber, lanes._debugTask = returnFiber._debugTask, lanes._debugInfo = currentDebugInfo, returnFiber = lanes), placeSingleChild(returnFiber); "function" === typeof newChild && warnOnFunctionType(returnFiber, newChild); "symbol" === typeof newChild && warnOnSymbolType(returnFiber, newChild); return deleteRemainingChildren(returnFiber, currentFirstChild); } return function(returnFiber, currentFirstChild, newChild, lanes) { var prevDebugInfo = currentDebugInfo; currentDebugInfo = null; try { thenableIndexCounter$1 = 0; var firstChildFiber = reconcileChildFibersImpl(returnFiber, currentFirstChild, newChild, lanes); thenableState$1 = null; return firstChildFiber; } catch (x) { if (x === SuspenseException || x === SuspenseActionException) throw x; var fiber = createFiber(29, x, null, returnFiber.mode); fiber.lanes = lanes; fiber.return = returnFiber; var debugInfo = fiber._debugInfo = currentDebugInfo; fiber._debugOwner = returnFiber._debugOwner; fiber._debugTask = returnFiber._debugTask; if (null != debugInfo) { for (var i = debugInfo.length - 1; 0 <= i; i--) if ("string" === typeof debugInfo[i].stack) { fiber._debugOwner = debugInfo[i]; fiber._debugTask = debugInfo[i].debugTask; break; } } return fiber; } finally { currentDebugInfo = prevDebugInfo; } }; } function validateSuspenseListNestedChild(childSlot, index) { var isAnArray = isArrayImpl(childSlot); childSlot = !isAnArray && "function" === typeof getIteratorFn(childSlot); return isAnArray || childSlot ? (isAnArray = isAnArray ? "array" : "iterable", console.error("A nested %s was passed to row #%s in . Wrap it in an additional SuspenseList to configure its revealOrder: ... {%s} ... ", isAnArray, index, isAnArray), !1) : !0; } function finishQueueingConcurrentUpdates() { for (var endIndex = concurrentQueuesIndex, i = concurrentlyUpdatedLanes = concurrentQueuesIndex = 0; i < endIndex;) { var fiber = concurrentQueues[i]; concurrentQueues[i++] = null; var queue = concurrentQueues[i]; concurrentQueues[i++] = null; var update = concurrentQueues[i]; concurrentQueues[i++] = null; var lane = concurrentQueues[i]; concurrentQueues[i++] = null; if (null !== queue && null !== update) { var pending = queue.pending; null === pending ? update.next = update : (update.next = pending.next, pending.next = update); queue.pending = update; } 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); } } function enqueueUpdate$1(fiber, queue, update, lane) { concurrentQueues[concurrentQueuesIndex++] = fiber; concurrentQueues[concurrentQueuesIndex++] = queue; concurrentQueues[concurrentQueuesIndex++] = update; concurrentQueues[concurrentQueuesIndex++] = lane; concurrentlyUpdatedLanes |= lane; fiber.lanes |= lane; fiber = fiber.alternate; null !== fiber && (fiber.lanes |= lane); } function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { enqueueUpdate$1(fiber, queue, update, lane); return getRootForUpdatedFiber(fiber); } function enqueueConcurrentRenderForLane(fiber, lane) { enqueueUpdate$1(fiber, null, null, lane); return getRootForUpdatedFiber(fiber); } function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { sourceFiber.lanes |= lane; var alternate = sourceFiber.alternate; null !== alternate && (alternate.lanes |= lane); for (var isHidden = !1, parent = sourceFiber.return; null !== parent;) parent.childLanes |= lane, alternate = parent.alternate, null !== alternate && (alternate.childLanes |= lane), 22 === parent.tag && (sourceFiber = parent.stateNode, null === sourceFiber || sourceFiber._visibility & OffscreenVisible || (isHidden = !0)), sourceFiber = parent, parent = parent.return; return 3 === sourceFiber.tag ? (parent = sourceFiber.stateNode, isHidden && null !== update && (isHidden = 31 - clz32(lane), sourceFiber = parent.hiddenUpdates, alternate = sourceFiber[isHidden], null === alternate ? sourceFiber[isHidden] = [update] : alternate.push(update), update.lane = lane | 536870912), parent) : null; } function getRootForUpdatedFiber(sourceFiber) { if (nestedUpdateCount > NESTED_UPDATE_LIMIT) throw nestedPassiveUpdateCount = nestedUpdateCount = 0, rootWithPassiveNestedUpdates = rootWithNestedUpdates = null, Error("Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops."); nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT && (nestedPassiveUpdateCount = 0, rootWithPassiveNestedUpdates = null, console.error("Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.")); null === sourceFiber.alternate && 0 !== (sourceFiber.flags & 4098) && warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); for (var node = sourceFiber, parent = node.return; null !== parent;) null === node.alternate && 0 !== (node.flags & 4098) && warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber), node = parent, parent = node.return; return 3 === node.tag ? node.stateNode : null; } function initializeUpdateQueue(fiber) { fiber.updateQueue = { baseState: fiber.memoizedState, firstBaseUpdate: null, lastBaseUpdate: null, shared: { pending: null, lanes: 0, hiddenCallbacks: null }, callbacks: null }; } function cloneUpdateQueue(current, workInProgress) { current = current.updateQueue; workInProgress.updateQueue === current && (workInProgress.updateQueue = { baseState: current.baseState, firstBaseUpdate: current.firstBaseUpdate, lastBaseUpdate: current.lastBaseUpdate, shared: current.shared, callbacks: null }); } function createUpdate(lane) { return { lane, tag: UpdateState, payload: null, callback: null, next: null }; } function enqueueUpdate(fiber, update, lane) { var updateQueue = fiber.updateQueue; if (null === updateQueue) return null; updateQueue = updateQueue.shared; if (currentlyProcessingQueue === updateQueue && !didWarnUpdateInsideUpdate) { var componentName = getComponentNameFromFiber(fiber); console.error("An update (setState, replaceState, or forceUpdate) was scheduled from inside an update function. Update functions should be pure, with zero side-effects. Consider using componentDidUpdate or a callback.\n\nPlease update the following component: %s", componentName); didWarnUpdateInsideUpdate = !0; } if ((executionContext & RenderContext) !== NoContext) return componentName = updateQueue.pending, null === componentName ? update.next = update : (update.next = componentName.next, componentName.next = update), updateQueue.pending = update, update = getRootForUpdatedFiber(fiber), markUpdateLaneFromFiberToRoot(fiber, null, lane), update; enqueueUpdate$1(fiber, updateQueue, update, lane); return getRootForUpdatedFiber(fiber); } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; if (null !== fiber && (fiber = fiber.shared, 0 !== (lane & 4194048))) { var queueLanes = fiber.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; fiber.lanes = lane; markRootEntangled(root, lane); } } function enqueueCapturedUpdate(workInProgress, capturedUpdate) { var queue = workInProgress.updateQueue, current = workInProgress.alternate; if (null !== current && (current = current.updateQueue, queue === current)) { var newFirst = null, newLast = null; queue = queue.firstBaseUpdate; if (null !== queue) { do { var clone = { lane: queue.lane, tag: queue.tag, payload: queue.payload, callback: null, next: null }; null === newLast ? newFirst = newLast = clone : newLast = newLast.next = clone; queue = queue.next; } while (null !== queue); null === newLast ? newFirst = newLast = capturedUpdate : newLast = newLast.next = capturedUpdate; } else newFirst = newLast = capturedUpdate; queue = { baseState: current.baseState, firstBaseUpdate: newFirst, lastBaseUpdate: newLast, shared: current.shared, callbacks: current.callbacks }; workInProgress.updateQueue = queue; return; } workInProgress = queue.lastBaseUpdate; null === workInProgress ? queue.firstBaseUpdate = capturedUpdate : workInProgress.next = capturedUpdate; queue.lastBaseUpdate = capturedUpdate; } function suspendIfUpdateReadFromEntangledAsyncAction() { if (didReadFromEntangledAsyncAction) { var entangledActionThenable = currentEntangledActionThenable; if (null !== entangledActionThenable) throw entangledActionThenable; } } function processUpdateQueue(workInProgress, props, instance$jscomp$0, renderLanes) { didReadFromEntangledAsyncAction = !1; var queue = workInProgress.updateQueue; hasForceUpdate = !1; currentlyProcessingQueue = queue.shared; var firstBaseUpdate = queue.firstBaseUpdate, lastBaseUpdate = queue.lastBaseUpdate, pendingQueue = queue.shared.pending; if (null !== pendingQueue) { queue.shared.pending = null; var lastPendingUpdate = pendingQueue, firstPendingUpdate = lastPendingUpdate.next; lastPendingUpdate.next = null; null === lastBaseUpdate ? firstBaseUpdate = firstPendingUpdate : lastBaseUpdate.next = firstPendingUpdate; lastBaseUpdate = lastPendingUpdate; var current = workInProgress.alternate; null !== current && (current = current.updateQueue, pendingQueue = current.lastBaseUpdate, pendingQueue !== lastBaseUpdate && (null === pendingQueue ? current.firstBaseUpdate = firstPendingUpdate : pendingQueue.next = firstPendingUpdate, current.lastBaseUpdate = lastPendingUpdate)); } if (null !== firstBaseUpdate) { var newState = queue.baseState; lastBaseUpdate = 0; current = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { var updateLane = pendingQueue.lane & -536870913, isHiddenUpdate = updateLane !== pendingQueue.lane; if (isHiddenUpdate ? (workInProgressRootRenderLanes & updateLane) === updateLane : (renderLanes & updateLane) === updateLane) { 0 !== updateLane && updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); null !== current && (current = current.next = { lane: 0, tag: pendingQueue.tag, payload: pendingQueue.payload, callback: null, next: null }); a: { updateLane = workInProgress; var partialState = pendingQueue; var nextProps = props, instance = instance$jscomp$0; switch (partialState.tag) { case ReplaceState: partialState = partialState.payload; if ("function" === typeof partialState) { isDisallowedContextReadInDEV = !0; var nextState = partialState.call(instance, newState, nextProps); if (updateLane.mode & 8) { setIsStrictModeForDevtools(!0); try { partialState.call(instance, newState, nextProps); } finally { setIsStrictModeForDevtools(!1); } } isDisallowedContextReadInDEV = !1; newState = nextState; break a; } newState = partialState; break a; case CaptureUpdate: updateLane.flags = updateLane.flags & -65537 | 128; case UpdateState: nextState = partialState.payload; if ("function" === typeof nextState) { isDisallowedContextReadInDEV = !0; partialState = nextState.call(instance, newState, nextProps); if (updateLane.mode & 8) { setIsStrictModeForDevtools(!0); try { nextState.call(instance, newState, nextProps); } finally { setIsStrictModeForDevtools(!1); } } isDisallowedContextReadInDEV = !1; } else partialState = nextState; if (null === partialState || void 0 === partialState) break a; newState = assign({}, newState, partialState); break a; case ForceUpdate: hasForceUpdate = !0; } } updateLane = pendingQueue.callback; null !== updateLane && (workInProgress.flags |= 64, isHiddenUpdate && (workInProgress.flags |= 8192), isHiddenUpdate = queue.callbacks, null === isHiddenUpdate ? queue.callbacks = [updateLane] : isHiddenUpdate.push(updateLane)); } else isHiddenUpdate = { lane: updateLane, tag: pendingQueue.tag, payload: pendingQueue.payload, callback: pendingQueue.callback, next: null }, null === current ? (firstPendingUpdate = current = isHiddenUpdate, lastPendingUpdate = newState) : current = current.next = isHiddenUpdate, lastBaseUpdate |= updateLane; pendingQueue = pendingQueue.next; if (null === pendingQueue) if (pendingQueue = queue.shared.pending, null === pendingQueue) break; else isHiddenUpdate = pendingQueue, pendingQueue = isHiddenUpdate.next, isHiddenUpdate.next = null, queue.lastBaseUpdate = isHiddenUpdate, queue.shared.pending = null; } while (1); null === current && (lastPendingUpdate = newState); queue.baseState = lastPendingUpdate; queue.firstBaseUpdate = firstPendingUpdate; queue.lastBaseUpdate = current; null === firstBaseUpdate && (queue.shared.lanes = 0); workInProgressRootSkippedLanes |= lastBaseUpdate; workInProgress.lanes = lastBaseUpdate; workInProgress.memoizedState = newState; } currentlyProcessingQueue = null; } function callCallback(callback, context) { if ("function" !== typeof callback) throw Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback); callback.call(context); } function commitHiddenCallbacks(updateQueue, context) { var hiddenCallbacks = updateQueue.shared.hiddenCallbacks; if (null !== hiddenCallbacks) for (updateQueue.shared.hiddenCallbacks = null, updateQueue = 0; updateQueue < hiddenCallbacks.length; updateQueue++) callCallback(hiddenCallbacks[updateQueue], context); } function commitCallbacks(updateQueue, context) { var callbacks = updateQueue.callbacks; if (null !== callbacks) for (updateQueue.callbacks = null, updateQueue = 0; updateQueue < callbacks.length; updateQueue++) callCallback(callbacks[updateQueue], context); } function pushHiddenContext(fiber, context) { var prevEntangledRenderLanes = entangledRenderLanes; push(prevEntangledRenderLanesCursor, prevEntangledRenderLanes, fiber); push(currentTreeHiddenStackCursor, context, fiber); entangledRenderLanes = prevEntangledRenderLanes | context.baseLanes; } function reuseHiddenContextOnStack(fiber) { push(prevEntangledRenderLanesCursor, entangledRenderLanes, fiber); push(currentTreeHiddenStackCursor, currentTreeHiddenStackCursor.current, fiber); } function popHiddenContext(fiber) { entangledRenderLanes = prevEntangledRenderLanesCursor.current; pop(currentTreeHiddenStackCursor, fiber); pop(prevEntangledRenderLanesCursor, fiber); } function pushPrimaryTreeSuspenseHandler(handler) { var current = handler.alternate; push(suspenseStackCursor, suspenseStackCursor.current & SubtreeSuspenseContextMask, handler); push(suspenseHandlerStackCursor, handler, handler); null === shellBoundary && (null === current || null !== currentTreeHiddenStackCursor.current ? shellBoundary = handler : null !== current.memoizedState && (shellBoundary = handler)); } function pushDehydratedActivitySuspenseHandler(fiber) { push(suspenseStackCursor, suspenseStackCursor.current, fiber); push(suspenseHandlerStackCursor, fiber, fiber); null === shellBoundary && (shellBoundary = fiber); } function pushOffscreenSuspenseHandler(fiber) { 22 === fiber.tag ? (push(suspenseStackCursor, suspenseStackCursor.current, fiber), push(suspenseHandlerStackCursor, fiber, fiber), null === shellBoundary && (shellBoundary = fiber)) : reuseSuspenseHandlerOnStack(fiber); } function reuseSuspenseHandlerOnStack(fiber) { push(suspenseStackCursor, suspenseStackCursor.current, fiber); push(suspenseHandlerStackCursor, suspenseHandlerStackCursor.current, fiber); } function popSuspenseHandler(fiber) { pop(suspenseHandlerStackCursor, fiber); shellBoundary === fiber && (shellBoundary = null); pop(suspenseStackCursor, fiber); } function pushSuspenseListContext(fiber, newContext) { push(suspenseHandlerStackCursor, suspenseHandlerStackCursor.current, fiber); push(suspenseStackCursor, newContext, fiber); } function popSuspenseListContext(fiber) { pop(suspenseStackCursor, fiber); pop(suspenseHandlerStackCursor, fiber); shellBoundary === fiber && (shellBoundary = null); } function findFirstSuspended(row) { for (var node = row; null !== node;) { if (13 === node.tag) { var state = node.memoizedState; if (null !== state && (state = state.dehydrated, null === state || isSuspenseInstancePending(state) || isSuspenseInstanceFallback(state))) return node; } else if (19 === node.tag && "independent" !== node.memoizedProps.revealOrder) { if (0 !== (node.flags & 128)) return node; } else if (null !== node.child) { node.child.return = node; node = node.child; continue; } if (node === row) break; for (; null === node.sibling;) { if (null === node.return || node.return === row) return null; node = node.return; } node.sibling.return = node.return; node = node.sibling; } return null; } function mountHookTypesDev() { var hookName = currentHookNameInDev; null === hookTypesDev ? hookTypesDev = [hookName] : hookTypesDev.push(hookName); } function updateHookTypesDev() { var hookName = currentHookNameInDev; if (null !== hookTypesDev && (hookTypesUpdateIndexDev++, hookTypesDev[hookTypesUpdateIndexDev] !== hookName)) { var componentName = getComponentNameFromFiber(currentlyRenderingFiber); if (!didWarnAboutMismatchedHooksForComponent.has(componentName) && (didWarnAboutMismatchedHooksForComponent.add(componentName), null !== hookTypesDev)) { for (var table = "", i = 0; i <= hookTypesUpdateIndexDev; i++) { var oldHookName = hookTypesDev[i], newHookName = i === hookTypesUpdateIndexDev ? hookName : oldHookName; for (oldHookName = i + 1 + ". " + oldHookName; 30 > oldHookName.length;) oldHookName += " "; oldHookName += newHookName + "\n"; table += oldHookName; } console.error("React has detected a change in the order of Hooks called by %s. This will lead to bugs and errors if not fixed. For more information, read the Rules of Hooks: https://react.dev/link/rules-of-hooks\n\n Previous render Next render\n ------------------------------------------------------\n%s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", componentName, table); } } } function checkDepsAreArrayDev(deps) { void 0 === deps || null === deps || isArrayImpl(deps) || console.error("%s received a final argument that is not an array (instead, received `%s`). When specified, the final argument must be an array.", currentHookNameInDev, typeof deps); } function warnOnUseFormStateInDev() { var componentName = getComponentNameFromFiber(currentlyRenderingFiber); didWarnAboutUseFormState.has(componentName) || (didWarnAboutUseFormState.add(componentName), console.error("ReactDOM.useFormState has been renamed to React.useActionState. Please update %s to use React.useActionState.", componentName)); } function throwInvalidHookError() { throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."); } function areHookInputsEqual(nextDeps, prevDeps) { if (ignorePreviousDependencies) return !1; if (null === prevDeps) return console.error("%s received a final argument during this render, but not during the previous render. Even though the final argument is optional, its type cannot change between renders.", currentHookNameInDev), !1; nextDeps.length !== prevDeps.length && console.error("The final argument passed to %s changed size between renders. The order and size of this array must remain constant.\n\nPrevious: %s\nIncoming: %s", currentHookNameInDev, "[" + prevDeps.join(", ") + "]", "[" + nextDeps.join(", ") + "]"); for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) if (!objectIs(nextDeps[i], prevDeps[i])) return !1; return !0; } function renderWithHooks(current, workInProgress, Component, props, secondArg, nextRenderLanes) { renderLanes = nextRenderLanes; currentlyRenderingFiber = workInProgress; hookTypesDev = null !== current ? current._debugHookTypes : null; hookTypesUpdateIndexDev = -1; ignorePreviousDependencies = null !== current && current.type !== workInProgress.type; if ("[object AsyncFunction]" === Object.prototype.toString.call(Component) || "[object AsyncGeneratorFunction]" === Object.prototype.toString.call(Component)) nextRenderLanes = getComponentNameFromFiber(currentlyRenderingFiber), didWarnAboutAsyncClientComponent.has(nextRenderLanes) || (didWarnAboutAsyncClientComponent.add(nextRenderLanes), console.error("%s is an async Client Component. Only Server Components can be async at the moment. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server.", null === nextRenderLanes ? "An unknown Component" : "<" + nextRenderLanes + ">")); workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; ReactSharedInternals.H = null !== current && null !== current.memoizedState ? HooksDispatcherOnUpdateInDEV : null !== hookTypesDev ? HooksDispatcherOnMountWithHookTypesInDEV : HooksDispatcherOnMountInDEV; shouldDoubleInvokeUserFnsInHooksDEV = nextRenderLanes = (workInProgress.mode & 8) !== NoMode; var children = callComponentInDEV(Component, props, secondArg); shouldDoubleInvokeUserFnsInHooksDEV = !1; didScheduleRenderPhaseUpdateDuringThisPass && (children = renderWithHooksAgain(workInProgress, Component, props, secondArg)); if (nextRenderLanes) { setIsStrictModeForDevtools(!0); try { children = renderWithHooksAgain(workInProgress, Component, props, secondArg); } finally { setIsStrictModeForDevtools(!1); } } finishRenderingHooks(current, workInProgress); return children; } function finishRenderingHooks(current, workInProgress) { workInProgress._debugHookTypes = hookTypesDev; null === workInProgress.dependencies ? null !== thenableState && (workInProgress.dependencies = { lanes: 0, firstContext: null, _debugThenableState: thenableState }) : workInProgress.dependencies._debugThenableState = thenableState; var thenableState$jscomp$0 = thenableState; null !== lastSuspendedFiber && areSameKeyPath(lastSuspendedFiber, workInProgress) && (null !== thenableState$jscomp$0 || null === lastSuspendedStack || didIssueUseWarning || (didIssueUseWarning = !0, console.error(lastSuspendedStack)), lastSuspendedStack = lastSuspendedFiber = null); ReactSharedInternals.H = ContextOnlyDispatcher; thenableState$jscomp$0 = null !== currentHook && null !== currentHook.next; renderLanes = 0; hookTypesDev = currentHookNameInDev = workInProgressHook = currentHook = currentlyRenderingFiber = null; hookTypesUpdateIndexDev = -1; null !== current && (current.flags & 1206910976) !== (workInProgress.flags & 1206910976) && console.error("Internal React error: Expected static flag was missing. Please notify the React team."); didScheduleRenderPhaseUpdate = !1; thenableIndexCounter = 0; thenableState = null; if (thenableState$jscomp$0) throw Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement."); null === current || didReceiveUpdate || (current = current.dependencies, null !== current && checkIfContextChanged(current) && (didReceiveUpdate = !0)); needsToResetSuspendedThenableDEV ? (needsToResetSuspendedThenableDEV = !1, current = !0) : current = !1; current && (workInProgress = getComponentNameFromFiber(workInProgress) || "Unknown", didWarnAboutUseWrappedInTryCatch.has(workInProgress) || didWarnAboutAsyncClientComponent.has(workInProgress) || (didWarnAboutUseWrappedInTryCatch.add(workInProgress), console.error("`use` was called from inside a try/catch block. This is not allowed and can lead to unexpected behavior. To handle errors triggered by `use`, wrap your component in a error boundary."))); } function renderWithHooksAgain(workInProgress, Component, props, secondArg) { currentlyRenderingFiber = workInProgress; var numberOfReRenders = 0; do { didScheduleRenderPhaseUpdateDuringThisPass && (thenableState = null); thenableIndexCounter = 0; didScheduleRenderPhaseUpdateDuringThisPass = !1; if (numberOfReRenders >= RE_RENDER_LIMIT) throw Error("Too many re-renders. React limits the number of renders to prevent an infinite loop."); numberOfReRenders += 1; ignorePreviousDependencies = !1; workInProgressHook = currentHook = null; if (null != workInProgress.updateQueue) { var children = workInProgress.updateQueue; children.lastEffect = null; children.events = null; children.stores = null; null != children.memoCache && (children.memoCache.index = 0); } hookTypesUpdateIndexDev = -1; ReactSharedInternals.H = HooksDispatcherOnRerenderInDEV; children = callComponentInDEV(Component, props, secondArg); } while (didScheduleRenderPhaseUpdateDuringThisPass); return children; } function TransitionAwareHostComponent() { var dispatcher = ReactSharedInternals.H, maybeThenable = dispatcher.useState()[0]; maybeThenable = "function" === typeof maybeThenable.then ? useThenable(maybeThenable) : maybeThenable; dispatcher = dispatcher.useState()[0]; (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && (currentlyRenderingFiber.flags |= 1024); return maybeThenable; } function checkDidRenderIdHook() { var didRenderIdHook = 0 !== localIdCounter; localIdCounter = 0; return didRenderIdHook; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; workInProgress.flags = (workInProgress.mode & 16) !== NoMode ? workInProgress.flags & -805308421 : workInProgress.flags & -2053; current.lanes &= ~lanes; } function resetHooksOnUnwind(workInProgress) { if (didScheduleRenderPhaseUpdate) { for (workInProgress = workInProgress.memoizedState; null !== workInProgress;) { var queue = workInProgress.queue; null !== queue && (queue.pending = null); workInProgress = workInProgress.next; } didScheduleRenderPhaseUpdate = !1; } renderLanes = 0; hookTypesDev = workInProgressHook = currentHook = currentlyRenderingFiber = null; hookTypesUpdateIndexDev = -1; currentHookNameInDev = null; didScheduleRenderPhaseUpdateDuringThisPass = !1; thenableIndexCounter = localIdCounter = 0; thenableState = null; } function mountWorkInProgressHook() { var hook = { memoizedState: null, baseState: null, baseQueue: null, queue: null, next: null }; null === workInProgressHook ? currentlyRenderingFiber.memoizedState = workInProgressHook = hook : workInProgressHook = workInProgressHook.next = hook; return workInProgressHook; } function updateWorkInProgressHook() { if (null === currentHook) { var nextCurrentHook = currentlyRenderingFiber.alternate; nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; } else nextCurrentHook = currentHook.next; var nextWorkInProgressHook = null === workInProgressHook ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; if (null !== nextWorkInProgressHook) workInProgressHook = nextWorkInProgressHook, currentHook = nextCurrentHook; else { if (null === nextCurrentHook) { if (null === currentlyRenderingFiber.alternate) throw Error("Update hook called on initial render. This is likely a bug in React. Please file an issue."); throw Error("Rendered more hooks than during the previous render."); } currentHook = nextCurrentHook; nextCurrentHook = { memoizedState: currentHook.memoizedState, baseState: currentHook.baseState, baseQueue: currentHook.baseQueue, queue: currentHook.queue, next: null }; null === workInProgressHook ? currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook : workInProgressHook = workInProgressHook.next = nextCurrentHook; } return workInProgressHook; } function createFunctionComponentUpdateQueue() { return { lastEffect: null, events: null, stores: null, memoCache: null }; } function useThenable(thenable) { var index = thenableIndexCounter; thenableIndexCounter += 1; null === thenableState && (thenableState = createThenableState()); thenable = trackUsedThenable(thenableState, thenable, index, currentlyRenderingFiber); index = currentlyRenderingFiber; null === (null === workInProgressHook ? index.memoizedState : workInProgressHook.next) && (index = index.alternate, ReactSharedInternals.H = null !== index && null !== index.memoizedState ? HooksDispatcherOnUpdateInDEV : HooksDispatcherOnMountInDEV); return thenable; } function use(usable) { if (null !== usable && "object" === typeof usable) { if ("function" === typeof usable.then) return useThenable(usable); if (usable.$$typeof === REACT_RECOVERABLE_TYPE) return; if (usable.$$typeof === REACT_CONTEXT_TYPE) return readContext(usable); } throw Error("An unsupported type was passed to use(): " + String(usable)); } function useMemoCache(size) { var memoCache = null, updateQueue = currentlyRenderingFiber.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { var current = currentlyRenderingFiber.alternate; null !== current && (current = current.updateQueue, null !== current && (current = current.memoCache, null != current && (memoCache = { data: current.data.map(function(array) { return array.slice(); }), index: 0 }))); } memoCache ??= { data: [], index: 0 }; null === updateQueue && (updateQueue = createFunctionComponentUpdateQueue(), currentlyRenderingFiber.updateQueue = updateQueue); updateQueue.memoCache = memoCache; updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue || ignorePreviousDependencies) for (updateQueue = memoCache.data[memoCache.index] = Array(size), current = 0; current < size; current++) updateQueue[current] = REACT_MEMO_CACHE_SENTINEL; else updateQueue.length !== size && console.error("Expected a constant size argument for each invocation of useMemoCache. The previous cache was allocated with size %s but size %s was requested.", updateQueue.length, size); memoCache.index++; return updateQueue; } function basicStateReducer(state, action) { return "function" === typeof action ? action(state) : action; } function mountReducer(reducer, initialArg, init) { var hook = mountWorkInProgressHook(); if (void 0 !== init) { var initialState = init(initialArg); if (shouldDoubleInvokeUserFnsInHooksDEV) { setIsStrictModeForDevtools(!0); try { init(initialArg); } finally { setIsStrictModeForDevtools(!1); } } } else initialState = initialArg; hook.memoizedState = hook.baseState = initialState; reducer = { pending: null, lanes: 0, dispatch: null, lastRenderedReducer: reducer, lastRenderedState: initialState }; hook.queue = reducer; reducer = reducer.dispatch = dispatchReducerAction.bind(null, currentlyRenderingFiber, reducer); return [hook.memoizedState, reducer]; } function updateReducer(reducer) { return updateReducerImpl(updateWorkInProgressHook(), currentHook, reducer); } function updateReducerImpl(hook, current, reducer) { var queue = hook.queue; if (null === queue) throw Error("Should have a queue. You are likely calling Hooks conditionally, which is not allowed. (https://react.dev/link/invalid-hook-call)"); queue.lastRenderedReducer = reducer; var baseQueue = hook.baseQueue, pendingQueue = queue.pending; if (null !== pendingQueue) { if (null !== baseQueue) { var baseFirst = baseQueue.next; baseQueue.next = pendingQueue.next; pendingQueue.next = baseFirst; } current.baseQueue !== baseQueue && console.error("Internal error: Expected work-in-progress queue to be a clone. This is a bug in React."); current.baseQueue = baseQueue = pendingQueue; queue.pending = null; } pendingQueue = hook.baseState; if (null === baseQueue) hook.memoizedState = pendingQueue; else { current = baseQueue.next; var newBaseQueueFirst = baseFirst = null, newBaseQueueLast = null, update = current, didReadFromEntangledAsyncAction = !1; do { var updateLane = update.lane & -536870913; if (updateLane !== update.lane ? (workInProgressRootRenderLanes & updateLane) === updateLane : (renderLanes & updateLane) === updateLane) { var revertLane = update.revertLane; if (0 === revertLane) null !== newBaseQueueLast && (newBaseQueueLast = newBaseQueueLast.next = { lane: 0, revertLane: 0, gesture: null, action: update.action, hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }), updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); continue; } else updateLane = { lane: 0, revertLane: update.revertLane, gesture: null, action: update.action, hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }, null === newBaseQueueLast ? (newBaseQueueFirst = newBaseQueueLast = updateLane, baseFirst = pendingQueue) : newBaseQueueLast = newBaseQueueLast.next = updateLane, currentlyRenderingFiber.lanes |= revertLane, workInProgressRootSkippedLanes |= revertLane; updateLane = update.action; shouldDoubleInvokeUserFnsInHooksDEV && reducer(pendingQueue, updateLane); pendingQueue = update.hasEagerState ? update.eagerState : reducer(pendingQueue, updateLane); } else revertLane = { lane: updateLane, revertLane: update.revertLane, gesture: update.gesture, action: update.action, hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }, null === newBaseQueueLast ? (newBaseQueueFirst = newBaseQueueLast = revertLane, baseFirst = pendingQueue) : newBaseQueueLast = newBaseQueueLast.next = revertLane, currentlyRenderingFiber.lanes |= updateLane, workInProgressRootSkippedLanes |= updateLane; update = update.next; } while (null !== update && update !== current); null === newBaseQueueLast ? baseFirst = pendingQueue : newBaseQueueLast.next = newBaseQueueFirst; if (!objectIs(pendingQueue, hook.memoizedState) && (didReceiveUpdate = !0, didReadFromEntangledAsyncAction && (reducer = currentEntangledActionThenable, null !== reducer))) throw reducer; hook.memoizedState = pendingQueue; hook.baseState = baseFirst; hook.baseQueue = newBaseQueueLast; queue.lastRenderedState = pendingQueue; } null === baseQueue && (queue.lanes = 0); return [hook.memoizedState, queue.dispatch]; } function rerenderReducer(reducer) { var hook = updateWorkInProgressHook(), queue = hook.queue; if (null === queue) throw Error("Should have a queue. You are likely calling Hooks conditionally, which is not allowed. (https://react.dev/link/invalid-hook-call)"); queue.lastRenderedReducer = reducer; var dispatch = queue.dispatch, lastRenderPhaseUpdate = queue.pending, newState = hook.memoizedState; if (null !== lastRenderPhaseUpdate) { queue.pending = null; var update = lastRenderPhaseUpdate = lastRenderPhaseUpdate.next; do newState = reducer(newState, update.action), update = update.next; while (update !== lastRenderPhaseUpdate); objectIs(newState, hook.memoizedState) || (didReceiveUpdate = !0); hook.memoizedState = newState; null === hook.baseQueue && (hook.baseState = newState); queue.lastRenderedState = newState; } return [newState, dispatch]; } function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); if (isHydrating) { if (void 0 === getServerSnapshot) throw Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering."); var nextSnapshot = getServerSnapshot(); didWarnUncachedGetSnapshot || nextSnapshot === getServerSnapshot() || (console.error("The result of getServerSnapshot should be cached to avoid an infinite loop"), didWarnUncachedGetSnapshot = !0); } else { nextSnapshot = getSnapshot(); didWarnUncachedGetSnapshot || (getServerSnapshot = getSnapshot(), objectIs(nextSnapshot, getServerSnapshot) || (console.error("The result of getSnapshot should be cached to avoid an infinite loop"), didWarnUncachedGetSnapshot = !0)); if (null === workInProgressRoot) throw Error("Expected a work-in-progress root. This is a bug in React. Please file an issue."); 0 !== (workInProgressRootRenderLanes & 127) || pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); } hook.memoizedState = nextSnapshot; getServerSnapshot = { value: nextSnapshot, getSnapshot }; hook.queue = getServerSnapshot; mountEffect(subscribeToStore.bind(null, fiber, getServerSnapshot, subscribe), [subscribe]); fiber.flags |= 2048; pushSimpleEffect(HasEffect | Passive, { destroy: void 0 }, updateStoreInstance.bind(null, fiber, getServerSnapshot, nextSnapshot, getSnapshot), null); return nextSnapshot; } function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), isHydrating$jscomp$0 = isHydrating; if (isHydrating$jscomp$0) { if (void 0 === getServerSnapshot) throw Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering."); getServerSnapshot = getServerSnapshot(); } else if (getServerSnapshot = getSnapshot(), !didWarnUncachedGetSnapshot) { var cachedSnapshot = getSnapshot(); objectIs(getServerSnapshot, cachedSnapshot) || (console.error("The result of getSnapshot should be cached to avoid an infinite loop"), didWarnUncachedGetSnapshot = !0); } if (cachedSnapshot = !objectIs((currentHook || hook).memoizedState, getServerSnapshot)) hook.memoizedState = getServerSnapshot, didReceiveUpdate = !0; hook = hook.queue; updateEffectImpl(2048, Passive, subscribeToStore.bind(null, fiber, hook, subscribe), [subscribe]); subscribe = hook.getSnapshot !== getSnapshot || cachedSnapshot || null !== workInProgressHook && (workInProgressHook.memoizedState.tag & HasEffect) !== NoFlags; pushSimpleEffect(subscribe ? HasEffect | Passive : Passive, { destroy: void 0 }, updateStoreInstance.bind(null, fiber, hook, getServerSnapshot, getSnapshot), null); if (subscribe) { fiber.flags |= 2048; if (null === workInProgressRoot) throw Error("Expected a work-in-progress root. This is a bug in React. Please file an issue."); isHydrating$jscomp$0 || 0 !== (renderLanes & 127) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } return getServerSnapshot; } function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= 16384; fiber = { getSnapshot, value: renderedSnapshot }; getSnapshot = currentlyRenderingFiber.updateQueue; null === getSnapshot ? (getSnapshot = createFunctionComponentUpdateQueue(), currentlyRenderingFiber.updateQueue = getSnapshot, getSnapshot.stores = [fiber]) : (renderedSnapshot = getSnapshot.stores, null === renderedSnapshot ? getSnapshot.stores = [fiber] : renderedSnapshot.push(fiber)); } function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) { inst.value = nextSnapshot; inst.getSnapshot = getSnapshot; checkIfSnapshotChanged(inst) && forceStoreRerender(fiber); } function subscribeToStore(fiber, inst, subscribe) { return subscribe(function() { checkIfSnapshotChanged(inst) && (startUpdateTimerByLane(2, "updateSyncExternalStore()", fiber), forceStoreRerender(fiber)); }); } function checkIfSnapshotChanged(inst) { var latestGetSnapshot = inst.getSnapshot; inst = inst.value; try { var nextValue = latestGetSnapshot(); return !objectIs(inst, nextValue); } catch (error) { return !0; } } function forceStoreRerender(fiber) { var root = enqueueConcurrentRenderForLane(fiber, 2); null !== root && scheduleUpdateOnFiber(root, fiber, 2); } function mountStateImpl(initialState) { var hook = mountWorkInProgressHook(); if ("function" === typeof initialState) { var initialStateInitializer = initialState; initialState = initialStateInitializer(); if (shouldDoubleInvokeUserFnsInHooksDEV) { setIsStrictModeForDevtools(!0); try { initialStateInitializer(); } finally { setIsStrictModeForDevtools(!1); } } } hook.memoizedState = hook.baseState = initialState; hook.queue = { pending: null, lanes: 0, dispatch: null, lastRenderedReducer: basicStateReducer, lastRenderedState: initialState }; return hook; } function mountState(initialState) { initialState = mountStateImpl(initialState); var queue = initialState.queue, dispatch = dispatchSetState.bind(null, currentlyRenderingFiber, queue); queue.dispatch = dispatch; return [initialState.memoizedState, dispatch]; } function mountOptimistic(passthrough) { var hook = mountWorkInProgressHook(); hook.memoizedState = hook.baseState = passthrough; var queue = { pending: null, lanes: 0, dispatch: null, lastRenderedReducer: null, lastRenderedState: null }; hook.queue = queue; hook = dispatchOptimisticSetState.bind(null, currentlyRenderingFiber, !0, queue); queue.dispatch = hook; return [passthrough, hook]; } function updateOptimistic(passthrough, reducer) { return updateOptimisticImpl(updateWorkInProgressHook(), currentHook, passthrough, reducer); } function updateOptimisticImpl(hook, current, passthrough, reducer) { hook.baseState = passthrough; return updateReducerImpl(hook, currentHook, "function" === typeof reducer ? reducer : basicStateReducer); } function rerenderOptimistic(passthrough, reducer) { var hook = updateWorkInProgressHook(); if (null !== currentHook) return updateOptimisticImpl(hook, currentHook, passthrough, reducer); hook.baseState = passthrough; return [passthrough, hook.queue.dispatch]; } function dispatchActionState(fiber, actionQueue, setPendingState, setState, payload) { if (isRenderPhaseUpdate(fiber)) throw Error("Cannot update action state while rendering."); fiber = actionQueue.action; if (null !== fiber) { var actionNode = { payload, action: fiber, next: null, isTransition: !0, status: "pending", value: null, reason: null, listeners: [], then: function(listener) { actionNode.listeners.push(listener); } }; null !== ReactSharedInternals.T ? setPendingState(!0) : actionNode.isTransition = !1; setState(actionNode); setPendingState = actionQueue.pending; null === setPendingState ? (actionNode.next = actionQueue.pending = actionNode, runActionStateAction(actionQueue, actionNode)) : (actionNode.next = setPendingState.next, actionQueue.pending = setPendingState.next = actionNode); } } function runActionStateAction(actionQueue, node) { var action = node.action, payload = node.payload, prevState = actionQueue.state; if (node.isTransition) { var prevTransition = ReactSharedInternals.T, currentTransition = {}; currentTransition.types = null !== prevTransition ? prevTransition.types : null; currentTransition._updatedFibers = /* @__PURE__ */ new Set(); ReactSharedInternals.T = currentTransition; try { var returnValue = action(prevState, payload), onStartTransitionFinish = ReactSharedInternals.S; null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue); handleActionReturnValue(actionQueue, node, returnValue); } catch (error) { onActionError(actionQueue, node, error); } finally { null !== prevTransition && null !== currentTransition.types && (null !== prevTransition.types && prevTransition.types !== currentTransition.types && console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition, null === prevTransition && currentTransition._updatedFibers && (actionQueue = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < actionQueue && console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")); } } else try { currentTransition = action(prevState, payload), handleActionReturnValue(actionQueue, node, currentTransition); } catch (error$2) { onActionError(actionQueue, node, error$2); } } function handleActionReturnValue(actionQueue, node, returnValue) { null !== returnValue && "object" === typeof returnValue && "function" === typeof returnValue.then ? (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(function(nextState) { onActionSuccess(actionQueue, node, nextState); }, function(error) { return onActionError(actionQueue, node, error); }), node.isTransition || console.error("An async function with useActionState was called outside of a transition. This is likely not what you intended (for example, isPending will not update correctly). Either call the returned function inside startTransition, or pass it to an `action` or `formAction` prop.")) : onActionSuccess(actionQueue, node, returnValue); } function onActionSuccess(actionQueue, actionNode, nextState) { actionNode.status = "fulfilled"; actionNode.value = nextState; notifyActionListeners(actionNode); actionQueue.state = nextState; actionNode = actionQueue.pending; null !== actionNode && (nextState = actionNode.next, nextState === actionNode ? actionQueue.pending = null : (nextState = nextState.next, actionNode.next = nextState, runActionStateAction(actionQueue, nextState))); } function onActionError(actionQueue, actionNode, error) { var last = actionQueue.pending; actionQueue.pending = null; if (null !== last) { last = last.next; do actionNode.status = "rejected", actionNode.reason = error, notifyActionListeners(actionNode), actionNode = actionNode.next; while (actionNode !== last); } actionQueue.action = null; } function notifyActionListeners(actionNode) { actionNode = actionNode.listeners; for (var i = 0; i < actionNode.length; i++) (0, actionNode[i])(); } function actionStateReducer(oldState, newState) { return newState; } function mountActionState(action, initialStateProp) { if (isHydrating) { var ssrFormState = workInProgressRoot.formState; if (null !== ssrFormState) { a: { var isMatching = currentlyRenderingFiber; if (isHydrating) { if (nextHydratableInstance) { var markerInstance = canHydrateFormStateMarker(nextHydratableInstance, rootOrSingletonContext); if (markerInstance) { nextHydratableInstance = getNextHydratableSibling(markerInstance); isMatching = isFormStateMarkerMatching(markerInstance); break a; } } throwOnHydrationMismatch(isMatching); } isMatching = !1; } isMatching && (initialStateProp = ssrFormState[0]); } } ssrFormState = mountWorkInProgressHook(); ssrFormState.memoizedState = ssrFormState.baseState = initialStateProp; isMatching = { pending: null, lanes: 0, dispatch: null, lastRenderedReducer: actionStateReducer, lastRenderedState: initialStateProp }; ssrFormState.queue = isMatching; ssrFormState = dispatchSetState.bind(null, currentlyRenderingFiber, isMatching); isMatching.dispatch = ssrFormState; isMatching = mountStateImpl(!1); var setPendingState = dispatchOptimisticSetState.bind(null, currentlyRenderingFiber, !1, isMatching.queue); isMatching = mountWorkInProgressHook(); markerInstance = { state: initialStateProp, dispatch: null, action, pending: null }; isMatching.queue = markerInstance; ssrFormState = dispatchActionState.bind(null, currentlyRenderingFiber, markerInstance, setPendingState, ssrFormState); markerInstance.dispatch = ssrFormState; isMatching.memoizedState = action; return [ initialStateProp, ssrFormState, !1 ]; } function updateActionState(action) { return updateActionStateImpl(updateWorkInProgressHook(), currentHook, action); } function updateActionStateImpl(stateHook, currentStateHook, action) { currentStateHook = updateReducerImpl(stateHook, currentStateHook, actionStateReducer)[0]; stateHook = updateReducer(basicStateReducer)[0]; if ("object" === typeof currentStateHook && null !== currentStateHook && "function" === typeof currentStateHook.then) try { var state = useThenable(currentStateHook); } catch (x) { if (x === SuspenseException) throw SuspenseActionException; throw x; } else state = currentStateHook; currentStateHook = updateWorkInProgressHook(); var actionQueue = currentStateHook.queue, dispatch = actionQueue.dispatch; action !== currentStateHook.memoizedState && (currentlyRenderingFiber.flags |= 2048, pushSimpleEffect(HasEffect | Passive, { destroy: void 0 }, actionStateActionEffect.bind(null, actionQueue, action), null)); return [ state, dispatch, stateHook ]; } function actionStateActionEffect(actionQueue, action) { actionQueue.action = action; } function rerenderActionState(action) { var stateHook = updateWorkInProgressHook(), currentStateHook = currentHook; if (null !== currentStateHook) return updateActionStateImpl(stateHook, currentStateHook, action); updateWorkInProgressHook(); stateHook = stateHook.memoizedState; currentStateHook = updateWorkInProgressHook(); var dispatch = currentStateHook.queue.dispatch; currentStateHook.memoizedState = action; return [ stateHook, dispatch, !1 ]; } function pushSimpleEffect(tag, inst, create, deps) { tag = { tag, create, deps, inst, next: null }; inst = currentlyRenderingFiber.updateQueue; null === inst && (inst = createFunctionComponentUpdateQueue(), currentlyRenderingFiber.updateQueue = inst); create = inst.lastEffect; null === create ? inst.lastEffect = tag.next = tag : (deps = create.next, create.next = tag, tag.next = deps, inst.lastEffect = tag); return tag; } function mountRef(initialValue) { var hook = mountWorkInProgressHook(); initialValue = { current: initialValue }; return hook.memoizedState = initialValue; } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); currentlyRenderingFiber.flags |= fiberFlags; hook.memoizedState = pushSimpleEffect(HasEffect | hookFlags, { destroy: void 0 }, create, void 0 === deps ? null : deps); } function updateEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = updateWorkInProgressHook(); deps = void 0 === deps ? null : deps; var inst = hook.memoizedState.inst; null !== currentHook && null !== deps && areHookInputsEqual(deps, currentHook.memoizedState.deps) ? hook.memoizedState = pushSimpleEffect(hookFlags, inst, create, deps) : (currentlyRenderingFiber.flags |= fiberFlags, hook.memoizedState = pushSimpleEffect(HasEffect | hookFlags, inst, create, deps)); } function mountEffect(create, deps) { (currentlyRenderingFiber.mode & 16) !== NoMode ? mountEffectImpl(545261568, Passive, create, deps) : mountEffectImpl(8390656, Passive, create, deps); } function useEffectEventImpl(payload) { currentlyRenderingFiber.flags |= 4; var componentUpdateQueue = currentlyRenderingFiber.updateQueue; if (null === componentUpdateQueue) componentUpdateQueue = createFunctionComponentUpdateQueue(), currentlyRenderingFiber.updateQueue = componentUpdateQueue, componentUpdateQueue.events = [payload]; else { var events = componentUpdateQueue.events; null === events ? componentUpdateQueue.events = [payload] : events.push(payload); } } function mountEvent(callback) { var hook = mountWorkInProgressHook(), ref = { impl: callback }; hook.memoizedState = ref; return function() { if ((executionContext & RenderContext) !== NoContext) throw Error("A function wrapped in useEffectEvent can't be called during rendering."); return ref.impl.apply(void 0, arguments); }; } function updateEvent(callback) { var ref = updateWorkInProgressHook().memoizedState; useEffectEventImpl({ ref, nextImpl: callback }); return function() { if ((executionContext & RenderContext) !== NoContext) throw Error("A function wrapped in useEffectEvent can't be called during rendering."); return ref.impl.apply(void 0, arguments); }; } function mountLayoutEffect(create, deps) { var fiberFlags = 4194308; (currentlyRenderingFiber.mode & 16) !== NoMode && (fiberFlags |= 268435456); return mountEffectImpl(fiberFlags, Layout, create, deps); } function imperativeHandleEffect(create, ref) { if ("function" === typeof ref) { create = create(); var refCleanup = ref(create); return function() { "function" === typeof refCleanup ? refCleanup() : ref(null); }; } if (null !== ref && void 0 !== ref) return ref.hasOwnProperty("current") || console.error("Expected useImperativeHandle() first argument to either be a ref callback or React.createRef() object. Instead received: %s.", "an object with keys {" + Object.keys(ref).join(", ") + "}"), create = create(), ref.current = create, function() { ref.current = null; }; } function mountImperativeHandle(ref, create, deps) { "function" !== typeof create && console.error("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.", null !== create ? typeof create : "null"); deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; var fiberFlags = 4194308; (currentlyRenderingFiber.mode & 16) !== NoMode && (fiberFlags |= 268435456); mountEffectImpl(fiberFlags, Layout, imperativeHandleEffect.bind(null, create, ref), deps); } function updateImperativeHandle(ref, create, deps) { "function" !== typeof create && console.error("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.", null !== create ? typeof create : "null"); deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; updateEffectImpl(4, Layout, imperativeHandleEffect.bind(null, create, ref), deps); } function mountCallback(callback, deps) { mountWorkInProgressHook().memoizedState = [callback, void 0 === deps ? null : deps]; return callback; } function updateCallback(callback, deps) { var hook = updateWorkInProgressHook(); deps = void 0 === deps ? null : deps; var prevState = hook.memoizedState; if (null !== deps && areHookInputsEqual(deps, prevState[1])) return prevState[0]; hook.memoizedState = [callback, deps]; return callback; } function mountMemo(nextCreate, deps) { var hook = mountWorkInProgressHook(); deps = void 0 === deps ? null : deps; var nextValue = nextCreate(); if (shouldDoubleInvokeUserFnsInHooksDEV) { setIsStrictModeForDevtools(!0); try { nextCreate(); } finally { setIsStrictModeForDevtools(!1); } } hook.memoizedState = [nextValue, deps]; return nextValue; } function updateMemo(nextCreate, deps) { var hook = updateWorkInProgressHook(); deps = void 0 === deps ? null : deps; var prevState = hook.memoizedState; if (null !== deps && areHookInputsEqual(deps, prevState[1])) return prevState[0]; prevState = nextCreate(); if (shouldDoubleInvokeUserFnsInHooksDEV) { setIsStrictModeForDevtools(!0); try { nextCreate(); } finally { setIsStrictModeForDevtools(!1); } } hook.memoizedState = [prevState, deps]; return prevState; } function mountDeferredValue(value, initialValue) { return mountDeferredValueImpl(mountWorkInProgressHook(), value, initialValue); } function updateDeferredValue(value, initialValue) { return updateDeferredValueImpl(updateWorkInProgressHook(), currentHook.memoizedState, value, initialValue); } function rerenderDeferredValue(value, initialValue) { var hook = updateWorkInProgressHook(); return null === currentHook ? mountDeferredValueImpl(hook, value, initialValue) : updateDeferredValueImpl(hook, currentHook.memoizedState, value, initialValue); } function mountDeferredValueImpl(hook, value, initialValue) { if (void 0 === initialValue || 0 !== (renderLanes & 1073741824) && 0 === (workInProgressRootRenderLanes & 261930)) return hook.memoizedState = value; hook.memoizedState = initialValue; hook = requestDeferredLane(); currentlyRenderingFiber.lanes |= hook; workInProgressRootSkippedLanes |= hook; return initialValue; } function updateDeferredValueImpl(hook, prevValue, value, initialValue) { if (objectIs(value, prevValue)) return value; if (null !== currentTreeHiddenStackCursor.current) return hook = mountDeferredValueImpl(hook, value, initialValue), objectIs(hook, prevValue) || (didReceiveUpdate = !0), hook; if (0 === (renderLanes & 106) || 0 !== (renderLanes & 1073741824) && 0 === (workInProgressRootRenderLanes & 261930)) return didReceiveUpdate = !0, hook.memoizedState = value; hook = requestDeferredLane(); currentlyRenderingFiber.lanes |= hook; workInProgressRootSkippedLanes |= hook; return prevValue; } function releaseAsyncTransition() { ReactSharedInternals.asyncTransitions--; } function startTransition(fiber, queue, pendingState, finishedState, callback) { var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(0 !== previousPriority && 8 > previousPriority ? previousPriority : 8); var prevTransition = ReactSharedInternals.T, currentTransition = {}; currentTransition.types = null !== prevTransition ? prevTransition.types : null; currentTransition._updatedFibers = /* @__PURE__ */ new Set(); ReactSharedInternals.T = currentTransition; dispatchOptimisticSetState(fiber, !1, queue, pendingState); try { var returnValue = callback(), onStartTransitionFinish = ReactSharedInternals.S; null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue); if (null !== returnValue && "object" === typeof returnValue && "function" === typeof returnValue.then) { ReactSharedInternals.asyncTransitions++; returnValue.then(releaseAsyncTransition, releaseAsyncTransition); var thenableForFinishedState = chainThenableValue(returnValue, finishedState); dispatchSetStateInternal(fiber, queue, thenableForFinishedState, requestUpdateLane(fiber)); } else dispatchSetStateInternal(fiber, queue, finishedState, requestUpdateLane(fiber)); } catch (error) { dispatchSetStateInternal(fiber, queue, { then: function() {}, status: "rejected", reason: error }, requestUpdateLane(fiber)); } finally { setCurrentUpdatePriority(previousPriority), null !== prevTransition && null !== currentTransition.types && (null !== prevTransition.types && prevTransition.types !== currentTransition.types && console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition, null === prevTransition && currentTransition._updatedFibers && (fiber = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < fiber && console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")); } } function ensureFormComponentIsStateful(formFiber) { var existingStateHook = formFiber.memoizedState; if (null !== existingStateHook) return existingStateHook; existingStateHook = { memoizedState: NotPendingTransition, baseState: NotPendingTransition, baseQueue: null, queue: { pending: null, lanes: 0, dispatch: null, lastRenderedReducer: basicStateReducer, lastRenderedState: NotPendingTransition }, next: null }; var initialResetState = {}; existingStateHook.next = { memoizedState: initialResetState, baseState: initialResetState, baseQueue: null, queue: { pending: null, lanes: 0, dispatch: null, lastRenderedReducer: basicStateReducer, lastRenderedState: initialResetState }, next: null }; formFiber.memoizedState = existingStateHook; formFiber = formFiber.alternate; null !== formFiber && (formFiber.memoizedState = existingStateHook); return existingStateHook; } function mountTransition() { var stateHook = mountStateImpl(!1); stateHook = startTransition.bind(null, currentlyRenderingFiber, stateHook.queue, !0, !1); mountWorkInProgressHook().memoizedState = stateHook; return [!1, stateHook]; } function updateTransition() { var booleanOrThenable = updateReducer(basicStateReducer)[0], start = updateWorkInProgressHook().memoizedState; return ["boolean" === typeof booleanOrThenable ? booleanOrThenable : useThenable(booleanOrThenable), start]; } function rerenderTransition() { var booleanOrThenable = rerenderReducer(basicStateReducer)[0], start = updateWorkInProgressHook().memoizedState; return ["boolean" === typeof booleanOrThenable ? booleanOrThenable : useThenable(booleanOrThenable), start]; } function useHostTransitionStatus() { return readContext(HostTransitionContext); } function mountId() { var hook = mountWorkInProgressHook(), identifierPrefix = workInProgressRoot.identifierPrefix; if (isHydrating) { var treeId = treeContextOverflow; var idWithLeadingBit = treeContextId; treeId = (idWithLeadingBit & ~(1 << 32 - clz32(idWithLeadingBit) - 1)).toString(32) + treeId; identifierPrefix = "_" + identifierPrefix + "R_" + treeId; treeId = localIdCounter++; 0 < treeId && (identifierPrefix += "H" + treeId.toString(32)); identifierPrefix += "_"; } else treeId = globalClientIdCounter++, identifierPrefix = "_" + identifierPrefix + "r_" + treeId.toString(32) + "_"; return hook.memoizedState = identifierPrefix; } function mountRefresh() { return mountWorkInProgressHook().memoizedState = refreshCache.bind(null, currentlyRenderingFiber); } function refreshCache(fiber, seedKey) { for (var provider = fiber.return; null !== provider;) { switch (provider.tag) { case 24: case 3: var lane = requestUpdateLane(provider), refreshUpdate = createUpdate(lane), root = enqueueUpdate(provider, refreshUpdate, lane); null !== root && (startUpdateTimerByLane(lane, "refresh()", fiber), scheduleUpdateOnFiber(root, provider, lane), entangleTransitions(root, provider, lane)); fiber = createCache(); null !== seedKey && void 0 !== seedKey && null !== root && console.error("The seed argument is not enabled outside experimental channels."); refreshUpdate.payload = { cache: fiber }; return; } provider = provider.return; } } function dispatchReducerAction(fiber, queue, action) { var args = arguments; "function" === typeof args[3] && console.error("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect()."); args = requestUpdateLane(fiber); var update = { lane: args, revertLane: 0, gesture: null, action, hasEagerState: !1, eagerState: null, next: null }; isRenderPhaseUpdate(fiber) ? enqueueRenderPhaseUpdate(queue, update) : (update = enqueueConcurrentHookUpdate(fiber, queue, update, args), null !== update && (startUpdateTimerByLane(args, "dispatch()", fiber), scheduleUpdateOnFiber(update, fiber, args), entangleTransitionUpdate(update, queue, args))); } function dispatchSetState(fiber, queue, action) { var args = arguments; "function" === typeof args[3] && console.error("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect()."); args = requestUpdateLane(fiber); dispatchSetStateInternal(fiber, queue, action, args) && startUpdateTimerByLane(args, "setState()", fiber); } function dispatchSetStateInternal(fiber, queue, action, lane) { var update = { lane, revertLane: 0, gesture: null, action, hasEagerState: !1, eagerState: null, next: null }; if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, update); else { var alternate = fiber.alternate; if (0 === fiber.lanes && (null === alternate || 0 === alternate.lanes) && (alternate = queue.lastRenderedReducer, null !== alternate)) { var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { var currentState = queue.lastRenderedState, eagerState = alternate(currentState, action); update.hasEagerState = !0; update.eagerState = eagerState; if (objectIs(eagerState, currentState)) return enqueueUpdate$1(fiber, queue, update, 0), null === workInProgressRoot && finishQueueingConcurrentUpdates(), !1; } catch (error) {} finally { ReactSharedInternals.H = prevDispatcher; } } action = enqueueConcurrentHookUpdate(fiber, queue, update, lane); if (null !== action) return scheduleUpdateOnFiber(action, fiber, lane), entangleTransitionUpdate(action, queue, lane), !0; } return !1; } function dispatchOptimisticSetState(fiber, throwIfDuringRender, queue, action) { null === ReactSharedInternals.T && 0 === currentEntangledLane && console.error("An optimistic state update occurred outside a transition or action. To fix, move the update to an action, or wrap with startTransition."); action = { lane: 2, revertLane: requestTransitionLane(), gesture: null, action, hasEagerState: !1, eagerState: null, next: null }; if (isRenderPhaseUpdate(fiber)) { if (throwIfDuringRender) throw Error("Cannot update optimistic state while rendering."); console.error("Cannot call startTransition while rendering."); } else throwIfDuringRender = enqueueConcurrentHookUpdate(fiber, queue, action, 2), null !== throwIfDuringRender && (startUpdateTimerByLane(2, "setOptimistic()", fiber), scheduleUpdateOnFiber(throwIfDuringRender, fiber, 2)); } function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return fiber === currentlyRenderingFiber || null !== alternate && alternate === currentlyRenderingFiber; } function enqueueRenderPhaseUpdate(queue, update) { didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0; var pending = queue.pending; null === pending ? update.next = update : (update.next = pending.next, pending.next = update); queue.pending = update; } function entangleTransitionUpdate(root, queue, lane) { if (0 !== (lane & 4194048)) { var queueLanes = queue.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; queue.lanes = lane; markRootEntangled(root, lane); } } function warnOnInvalidCallback(callback) { if (null !== callback && "function" !== typeof callback) { var key = String(callback); didWarnOnInvalidCallback.has(key) || (didWarnOnInvalidCallback.add(key), console.error("Expected the last optional `callback` argument to be a function. Instead received: %s.", callback)); } } function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) { var prevState = workInProgress.memoizedState, partialState = getDerivedStateFromProps(nextProps, prevState); if (workInProgress.mode & 8) { setIsStrictModeForDevtools(!0); try { partialState = getDerivedStateFromProps(nextProps, prevState); } finally { setIsStrictModeForDevtools(!1); } } void 0 === partialState && (ctor = getComponentNameFromType(ctor) || "Component", didWarnAboutUndefinedDerivedState.has(ctor) || (didWarnAboutUndefinedDerivedState.add(ctor), console.error("%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. You have returned undefined.", ctor))); prevState = null === partialState || void 0 === partialState ? prevState : assign({}, prevState, partialState); workInProgress.memoizedState = prevState; 0 === workInProgress.lanes && (workInProgress.updateQueue.baseState = prevState); } function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) { var instance = workInProgress.stateNode; if ("function" === typeof instance.shouldComponentUpdate) { oldProps = instance.shouldComponentUpdate(newProps, newState, nextContext); if (workInProgress.mode & 8) { setIsStrictModeForDevtools(!0); try { oldProps = instance.shouldComponentUpdate(newProps, newState, nextContext); } finally { setIsStrictModeForDevtools(!1); } } void 0 === oldProps && console.error("%s.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false.", getComponentNameFromType(ctor) || "Component"); return oldProps; } return ctor.prototype && ctor.prototype.isPureReactComponent ? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState) : !0; } function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) { var oldState = instance.state; "function" === typeof instance.componentWillReceiveProps && instance.componentWillReceiveProps(newProps, nextContext); "function" === typeof instance.UNSAFE_componentWillReceiveProps && instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); instance.state !== oldState && (workInProgress = getComponentNameFromFiber(workInProgress) || "Component", didWarnAboutStateAssignmentForComponent.has(workInProgress) || (didWarnAboutStateAssignmentForComponent.add(workInProgress), console.error("%s.componentWillReceiveProps(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.", workInProgress)), classComponentUpdater.enqueueReplaceState(instance, instance.state, null)); } function resolveClassComponentProps(Component, baseProps) { var newProps = baseProps; if ("ref" in baseProps) { newProps = {}; for (var propName in baseProps) "ref" !== propName && (newProps[propName] = baseProps[propName]); } if (Component = Component.defaultProps) { newProps === baseProps && (newProps = assign({}, newProps)); for (var _propName in Component) void 0 === newProps[_propName] && (newProps[_propName] = Component[_propName]); } return newProps; } function logUncaughtError(root, errorInfo) { try { componentName = errorInfo.source ? getComponentNameFromFiber(errorInfo.source) : null; errorBoundaryName = null; var error = errorInfo.value; if (null !== ReactSharedInternals.actQueue) ReactSharedInternals.thrownErrors.push(error); else { var onUncaughtError = root.onUncaughtError; onUncaughtError(error, { componentStack: errorInfo.stack }); } } catch (e) { setTimeout(function() { throw e; }); } } function logCaughtError(root, boundary, errorInfo) { try { componentName = errorInfo.source ? getComponentNameFromFiber(errorInfo.source) : null; errorBoundaryName = getComponentNameFromFiber(boundary); var onCaughtError = root.onCaughtError; onCaughtError(errorInfo.value, { componentStack: errorInfo.stack, errorBoundary: 1 === boundary.tag ? boundary.stateNode : null }); } catch (e) { setTimeout(function() { throw e; }); } } function createRootErrorUpdate(root, errorInfo, lane) { lane = createUpdate(lane); lane.tag = CaptureUpdate; lane.payload = { element: null }; lane.callback = function() { runWithFiberInDEV(errorInfo.source, logUncaughtError, root, errorInfo); }; return lane; } function createClassErrorUpdate(lane) { lane = createUpdate(lane); lane.tag = CaptureUpdate; return lane; } function initializeClassErrorUpdate(update, root, fiber, errorInfo) { var getDerivedStateFromError = fiber.type.getDerivedStateFromError; if ("function" === typeof getDerivedStateFromError) { var error = errorInfo.value; update.payload = function() { return getDerivedStateFromError(error); }; update.callback = function() { markFailedErrorBoundaryForHotReloading(fiber); runWithFiberInDEV(errorInfo.source, logCaughtError, root, fiber, errorInfo); }; } var inst = fiber.stateNode; null !== inst && "function" === typeof inst.componentDidCatch && (update.callback = function() { markFailedErrorBoundaryForHotReloading(fiber); runWithFiberInDEV(errorInfo.source, logCaughtError, root, fiber, errorInfo); "function" !== typeof getDerivedStateFromError && (null === legacyErrorBoundariesThatAlreadyFailed ? legacyErrorBoundariesThatAlreadyFailed = /* @__PURE__ */ new Set([this]) : legacyErrorBoundariesThatAlreadyFailed.add(this)); callComponentDidCatchInDEV(this, errorInfo); "function" === typeof getDerivedStateFromError || 0 === (fiber.lanes & 2) && console.error("%s: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.", getComponentNameFromFiber(fiber) || "Unknown"); }); } function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes) { sourceFiber.flags |= 32768; isDevToolsPresent && restorePendingUpdaters(root, rootRenderLanes); if (null !== value && "object" === typeof value && "function" === typeof value.then) { returnFiber = sourceFiber.alternate; null !== returnFiber && propagateParentContextChanges(returnFiber, sourceFiber, rootRenderLanes, !0); isHydrating && (didSuspendOrErrorDEV = !0); sourceFiber = suspenseHandlerStackCursor.current; if (null !== sourceFiber) { switch (sourceFiber.tag) { case 31: case 13: case 19: return null === shellBoundary ? renderDidSuspendDelayIfPossible() : null === sourceFiber.alternate && workInProgressRootExitStatus === RootInProgress && (workInProgressRootExitStatus = RootSuspended), sourceFiber.flags &= -257, sourceFiber.flags |= 65536, sourceFiber.lanes = rootRenderLanes, value === noopSuspenseyCommitThenable ? sourceFiber.flags |= 16384 : (returnFiber = sourceFiber.updateQueue, null === returnFiber ? sourceFiber.updateQueue = /* @__PURE__ */ new Set([value]) : returnFiber.add(value), attachPingListener(root, value, rootRenderLanes)), !1; case 22: return sourceFiber.flags |= 65536, value === noopSuspenseyCommitThenable ? sourceFiber.flags |= 16384 : (returnFiber = sourceFiber.updateQueue, null === returnFiber ? (returnFiber = { transitions: null, markerInstances: null, retryQueue: /* @__PURE__ */ new Set([value]) }, sourceFiber.updateQueue = returnFiber) : (sourceFiber = returnFiber.retryQueue, null === sourceFiber ? returnFiber.retryQueue = /* @__PURE__ */ new Set([value]) : sourceFiber.add(value)), attachPingListener(root, value, rootRenderLanes)), !1; } throw Error("Unexpected Suspense handler tag (" + sourceFiber.tag + "). This is a bug in React."); } attachPingListener(root, value, rootRenderLanes); renderDidSuspendDelayIfPossible(); return !1; } if (isHydrating) return didSuspendOrErrorDEV = !0, returnFiber = suspenseHandlerStackCursor.current, null !== returnFiber ? (19 === returnFiber.tag && console.error("SuspenseList should never catch while hydrating. This is a bug in React."), 0 === (returnFiber.flags & 65536) && (returnFiber.flags |= 256), returnFiber.flags |= 65536, returnFiber.lanes = rootRenderLanes, value !== HydrationMismatchException && queueHydrationError(createCapturedValueAtFiber(Error("There was an error while hydrating but React was able to recover by instead client rendering from the nearest Suspense boundary.", { cause: value }), sourceFiber))) : (value !== HydrationMismatchException && queueHydrationError(createCapturedValueAtFiber(Error("There was an error while hydrating but React was able to recover by instead client rendering the entire root.", { cause: value }), sourceFiber)), root = root.current.alternate, root.flags |= 65536, rootRenderLanes &= -rootRenderLanes, root.lanes |= rootRenderLanes, value = createCapturedValueAtFiber(value, sourceFiber), rootRenderLanes = createRootErrorUpdate(root.stateNode, value, rootRenderLanes), enqueueCapturedUpdate(root, rootRenderLanes), workInProgressRootExitStatus !== RootSuspendedWithDelay && (workInProgressRootExitStatus = RootErrored)), !1; var error = createCapturedValueAtFiber(Error("There was an error during concurrent rendering but React was able to recover by instead synchronously rendering the entire root.", { cause: value }), sourceFiber); null === workInProgressRootConcurrentErrors ? workInProgressRootConcurrentErrors = [error] : workInProgressRootConcurrentErrors.push(error); workInProgressRootExitStatus !== RootSuspendedWithDelay && (workInProgressRootExitStatus = RootErrored); if (null === returnFiber) return !0; value = createCapturedValueAtFiber(value, sourceFiber); sourceFiber = returnFiber; do { switch (sourceFiber.tag) { case 3: return sourceFiber.flags |= 65536, root = rootRenderLanes & -rootRenderLanes, sourceFiber.lanes |= root, root = createRootErrorUpdate(sourceFiber.stateNode, value, root), enqueueCapturedUpdate(sourceFiber, root), !1; case 1: returnFiber = sourceFiber.type; error = sourceFiber.stateNode; if (0 === (sourceFiber.flags & 128) && ("function" === typeof returnFiber.getDerivedStateFromError || null !== error && "function" === typeof error.componentDidCatch && (null === legacyErrorBoundariesThatAlreadyFailed || !legacyErrorBoundariesThatAlreadyFailed.has(error)))) return sourceFiber.flags |= 65536, rootRenderLanes &= -rootRenderLanes, sourceFiber.lanes |= rootRenderLanes, rootRenderLanes = createClassErrorUpdate(rootRenderLanes), initializeClassErrorUpdate(rootRenderLanes, root, sourceFiber, value), enqueueCapturedUpdate(sourceFiber, rootRenderLanes), !1; break; case 22: if (null !== sourceFiber.memoizedState) return sourceFiber.flags |= 65536, !1; } sourceFiber = sourceFiber.return; } while (null !== sourceFiber); return !1; } function reconcileChildren(current, workInProgress, nextChildren, renderLanes) { workInProgress.child = null === current ? mountChildFibers(workInProgress, null, nextChildren, renderLanes) : reconcileChildFibers(workInProgress, current.child, nextChildren, renderLanes); } function updateForwardRef(current, workInProgress, Component, nextProps, renderLanes) { Component = Component.render; var resolvedRender = resolveTypeForHotReloading(Component); resolvedRender !== Component && (Component = resolvedRender, null !== current && (didReceiveUpdate = !0)); resolvedRender = workInProgress.ref; if ("ref" in nextProps) { var propsWithoutRef = {}; for (var key in nextProps) "ref" !== key && (propsWithoutRef[key] = nextProps[key]); } else propsWithoutRef = nextProps; prepareToReadContext(workInProgress); nextProps = renderWithHooks(current, workInProgress, Component, propsWithoutRef, resolvedRender, renderLanes); key = checkDidRenderIdHook(); if (null !== current && !didReceiveUpdate) return bailoutHooks(current, workInProgress, renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); isHydrating && key && pushMaterializedTreeId(workInProgress); workInProgress.flags |= 1; reconcileChildren(current, workInProgress, nextProps, renderLanes); return workInProgress.child; } function updateMemoComponent(current, workInProgress, Component, nextProps, renderLanes) { if (null === current) { var type = Component.type; if ("function" === typeof type && !shouldConstruct(type) && void 0 === type.defaultProps && null === Component.compare) return Component = resolveTypeForHotReloading(type), workInProgress.tag = 15, workInProgress.type = Component, validateFunctionComponentInDev(workInProgress, type), updateSimpleMemoComponent(current, workInProgress, Component, nextProps, renderLanes); current = createFiberFromTypeAndProps(Component.type, null, nextProps, workInProgress, workInProgress.mode, renderLanes); current.ref = workInProgress.ref; current.return = workInProgress; return workInProgress.child = current; } type = current.child; if (!checkScheduledUpdateOrContext(current, renderLanes)) { var prevProps = type.memoizedProps; Component = Component.compare; Component = null !== Component ? Component : shallowEqual; if (Component(prevProps, nextProps) && current.ref === workInProgress.ref) return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } workInProgress.flags |= 1; current = createWorkInProgress(type, nextProps); current.ref = workInProgress.ref; current.return = workInProgress; return workInProgress.child = current; } function updateSimpleMemoComponent(current, workInProgress, Component, nextProps, renderLanes) { if (null !== current) { var prevProps = current.memoizedProps; if (shallowEqual(prevProps, nextProps) && current.ref === workInProgress.ref && workInProgress.type === current.type) if (didReceiveUpdate = !1, workInProgress.pendingProps = nextProps = prevProps, checkScheduledUpdateOrContext(current, renderLanes)) 0 !== (current.flags & 131072) && (didReceiveUpdate = !0); else return workInProgress.lanes = current.lanes, bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } return updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes); } function updateOffscreenComponent(current, workInProgress, renderLanes, nextProps) { var nextChildren = nextProps.children, prevState = null !== current ? current.memoizedState : null; null === current && null === workInProgress.stateNode && (workInProgress.stateNode = { _visibility: OffscreenVisible, _pendingMarkers: null, _retryCache: null, _transitions: null }); if ("hidden" === nextProps.mode) { if (0 !== (workInProgress.flags & 128)) { prevState = null !== prevState ? prevState.baseLanes | renderLanes : renderLanes; if (null !== current) { nextProps = workInProgress.child = current.child; for (nextChildren = 0; null !== nextProps;) nextChildren = nextChildren | nextProps.lanes | nextProps.childLanes, nextProps = nextProps.sibling; nextProps = nextChildren & ~prevState; } else nextProps = 0, workInProgress.child = null; return deferHiddenOffscreenComponent(current, workInProgress, prevState, renderLanes, nextProps); } if (0 !== (renderLanes & 536870912)) workInProgress.memoizedState = { baseLanes: 0, cachePool: null }, null !== current && pushTransition(workInProgress, null !== prevState ? prevState.cachePool : null), null !== prevState ? pushHiddenContext(workInProgress, prevState) : reuseHiddenContextOnStack(workInProgress), pushOffscreenSuspenseHandler(workInProgress); else return nextProps = workInProgress.lanes = 536870912, deferHiddenOffscreenComponent(current, workInProgress, null !== prevState ? prevState.baseLanes | renderLanes : renderLanes, renderLanes, nextProps); } else null !== prevState ? (pushTransition(workInProgress, prevState.cachePool), pushHiddenContext(workInProgress, prevState), reuseSuspenseHandlerOnStack(workInProgress), workInProgress.memoizedState = null) : (null !== current && pushTransition(workInProgress, null), reuseHiddenContextOnStack(workInProgress), reuseSuspenseHandlerOnStack(workInProgress)); reconcileChildren(current, workInProgress, nextChildren, renderLanes); return workInProgress.child; } function bailoutOffscreenComponent(current, workInProgress) { null !== current && 22 === current.tag || null !== workInProgress.stateNode || (workInProgress.stateNode = { _visibility: OffscreenVisible, _pendingMarkers: null, _retryCache: null, _transitions: null }); return workInProgress.sibling; } function deferHiddenOffscreenComponent(current, workInProgress, nextBaseLanes, renderLanes, remainingChildLanes) { var JSCompiler_inline_result = peekCacheFromPool(); JSCompiler_inline_result = null === JSCompiler_inline_result ? null : { parent: isPrimaryRenderer ? CacheContext._currentValue : CacheContext._currentValue2, pool: JSCompiler_inline_result }; workInProgress.memoizedState = { baseLanes: nextBaseLanes, cachePool: JSCompiler_inline_result }; null !== current && pushTransition(workInProgress, null); reuseHiddenContextOnStack(workInProgress); pushOffscreenSuspenseHandler(workInProgress); null !== current && propagateParentContextChanges(current, workInProgress, renderLanes, !0); workInProgress.childLanes = remainingChildLanes; return null; } function mountActivityChildren(workInProgress, nextProps) { var hiddenProp = nextProps.hidden; void 0 !== hiddenProp && console.error(" doesn't accept a hidden prop. Use mode=\"hidden\" instead.\n- \n+ ", !0 === hiddenProp ? "hidden" : !1 === hiddenProp ? "hidden={false}" : "hidden={...}", hiddenProp ? "mode=\"hidden\"" : "mode=\"visible\""); nextProps = mountWorkInProgressOffscreenFiber({ mode: nextProps.mode, children: nextProps.children }, workInProgress.mode); nextProps.ref = workInProgress.ref; workInProgress.child = nextProps; nextProps.return = workInProgress; return nextProps; } function retryActivityComponentWithoutHydrating(current, workInProgress, renderLanes) { reconcileChildFibers(workInProgress, current.child, null, renderLanes); current = mountActivityChildren(workInProgress, workInProgress.pendingProps); current.flags |= 2; popSuspenseHandler(workInProgress); workInProgress.memoizedState = null; return current; } function updateActivityComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps, didSuspend = 0 !== (workInProgress.flags & 128); workInProgress.flags &= -129; if (null === current) { if (isHydrating) { if ("hidden" === nextProps.mode) return current = mountActivityChildren(workInProgress, nextProps), workInProgress.lanes = 536870912, current.memoizedState = { baseLanes: 0, cachePool: null }, bailoutOffscreenComponent(null, current); pushDehydratedActivitySuspenseHandler(workInProgress); (current = nextHydratableInstance) ? (renderLanes = canHydrateActivityInstance(current, rootOrSingletonContext), null !== renderLanes && (nextProps = { dehydrated: renderLanes, treeContext: getSuspendedTreeContext(), retryLane: 536870912, hydrationErrors: null }, workInProgress.memoizedState = nextProps, nextProps = createFiberFromDehydratedFragment(renderLanes), nextProps.return = workInProgress, workInProgress.child = nextProps, hydrationParentFiber = workInProgress, nextHydratableInstance = null)) : renderLanes = null; if (null === renderLanes) throw warnNonHydratedInstance(workInProgress, current), throwOnHydrationMismatch(workInProgress); workInProgress.lanes = 536870912; return null; } return mountActivityChildren(workInProgress, nextProps); } var prevState = current.memoizedState; if (null !== prevState) { var activityInstance = prevState.dehydrated; pushDehydratedActivitySuspenseHandler(workInProgress); if (didSuspend) if (workInProgress.flags & 256) workInProgress.flags &= -257, workInProgress = retryActivityComponentWithoutHydrating(current, workInProgress, renderLanes); else if (null !== workInProgress.memoizedState) workInProgress.child = current.child, workInProgress.flags |= 128, workInProgress = null; else throw Error("Client rendering an Activity suspended it again. This is a bug in React."); else if (warnIfHydrating(), 0 !== (renderLanes & 536870912) && markRenderDerivedCause(workInProgress), didReceiveUpdate || propagateParentContextChanges(current, workInProgress, renderLanes, !1), didSuspend = 0 !== (renderLanes & current.childLanes), didReceiveUpdate || didSuspend) { if (null === currentTreeHiddenStackCursor.current) { nextProps = workInProgressRoot; if (null !== nextProps && (activityInstance = getBumpedLaneForHydration(nextProps, renderLanes), 0 !== activityInstance && activityInstance !== prevState.retryLane)) throw prevState.retryLane = activityInstance, enqueueConcurrentRenderForLane(current, activityInstance), scheduleUpdateOnFiber(nextProps, current, activityInstance), SelectiveHydrationException; renderDidSuspendDelayIfPossible(); } workInProgress = retryActivityComponentWithoutHydrating(current, workInProgress, renderLanes); } else current = prevState.treeContext, supportsHydration && (nextHydratableInstance = getFirstHydratableChildWithinActivityInstance(activityInstance), hydrationParentFiber = workInProgress, isHydrating = !0, hydrationErrors = null, didSuspendOrErrorDEV = !1, hydrationDiffRootDEV = null, rootOrSingletonContext = !1, null !== current && restoreSuspendedTreeContext(workInProgress, current)), workInProgress = mountActivityChildren(workInProgress, nextProps), workInProgress.flags |= 134221824; return workInProgress; } prevState = current.child; nextProps = { mode: nextProps.mode, children: nextProps.children }; 0 !== (renderLanes & 536870912) && 0 !== (renderLanes & current.lanes) && markRenderDerivedCause(workInProgress); current = createWorkInProgress(prevState, nextProps); current.ref = workInProgress.ref; workInProgress.child = current; current.return = workInProgress; return current; } function markRef(current, workInProgress) { var ref = workInProgress.ref; if (null === ref) null !== current && null !== current.ref && (workInProgress.flags |= 4194816); else { if ("function" !== typeof ref && "object" !== typeof ref) throw Error("Expected ref to be a function, an object returned by React.createRef(), or undefined/null."); if (null === current || current.ref !== ref) workInProgress.flags |= 4194816; } } function updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes) { if (Component.prototype && "function" === typeof Component.prototype.render) { var componentName = getComponentNameFromType(Component) || "Unknown"; didWarnAboutBadClass[componentName] || (console.error("The <%s /> component appears to have a render method, but doesn't extend React.Component. This is likely to cause errors. Change %s to extend React.Component instead.", componentName, componentName), didWarnAboutBadClass[componentName] = !0); } workInProgress.mode & 8 && ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null); null === current && (validateFunctionComponentInDev(workInProgress, workInProgress.type), Component.contextTypes && (componentName = getComponentNameFromType(Component) || "Unknown", didWarnAboutContextTypes[componentName] || (didWarnAboutContextTypes[componentName] = !0, console.error("%s uses the legacy contextTypes API which was removed in React 19. Use React.createContext() with React.useContext() instead. (https://react.dev/link/legacy-context)", componentName)))); prepareToReadContext(workInProgress); Component = renderWithHooks(current, workInProgress, Component, nextProps, void 0, renderLanes); nextProps = checkDidRenderIdHook(); if (null !== current && !didReceiveUpdate) return bailoutHooks(current, workInProgress, renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); isHydrating && nextProps && pushMaterializedTreeId(workInProgress); workInProgress.flags |= 1; reconcileChildren(current, workInProgress, Component, renderLanes); return workInProgress.child; } function replayFunctionComponent(current, workInProgress, nextProps, Component, secondArg, renderLanes) { prepareToReadContext(workInProgress); hookTypesUpdateIndexDev = -1; ignorePreviousDependencies = null !== current && current.type !== workInProgress.type; workInProgress.updateQueue = null; nextProps = renderWithHooksAgain(workInProgress, Component, nextProps, secondArg); finishRenderingHooks(current, workInProgress); Component = checkDidRenderIdHook(); if (null !== current && !didReceiveUpdate) return bailoutHooks(current, workInProgress, renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); isHydrating && Component && pushMaterializedTreeId(workInProgress); workInProgress.flags |= 1; reconcileChildren(current, workInProgress, nextProps, renderLanes); return workInProgress.child; } function updateClassComponent(current, workInProgress, Component, nextProps, renderLanes) { switch (shouldErrorImpl(workInProgress)) { case !1: var _instance = workInProgress.stateNode, state = new workInProgress.type(workInProgress.memoizedProps, _instance.context).state; _instance.updater.enqueueSetState(_instance, state, null); break; case !0: workInProgress.flags |= 128; workInProgress.flags |= 65536; _instance = Error("Simulated error coming from DevTools"); var lane = renderLanes & -renderLanes; workInProgress.lanes |= lane; state = workInProgressRoot; if (null === state) throw Error("Expected a work-in-progress root. This is a bug in React. Please file an issue."); lane = createClassErrorUpdate(lane); initializeClassErrorUpdate(lane, state, workInProgress, createCapturedValueAtFiber(_instance, workInProgress)); enqueueCapturedUpdate(workInProgress, lane); } prepareToReadContext(workInProgress); if (null === workInProgress.stateNode) { state = emptyContextObject; _instance = Component.contextType; "contextType" in Component && null !== _instance && (void 0 === _instance || _instance.$$typeof !== REACT_CONTEXT_TYPE) && !didWarnAboutInvalidateContextType.has(Component) && (didWarnAboutInvalidateContextType.add(Component), lane = void 0 === _instance ? " However, it is set to undefined. This can be caused by a typo or by mixing up named and default imports. This can also happen due to a circular dependency, so try moving the createContext() call to a separate file." : "object" !== typeof _instance ? " However, it is set to a " + typeof _instance + "." : _instance.$$typeof === REACT_CONSUMER_TYPE ? " Did you accidentally pass the Context.Consumer instead?" : " However, it is set to an object with keys {" + Object.keys(_instance).join(", ") + "}.", console.error("%s defines an invalid contextType. contextType should point to the Context object returned by React.createContext().%s", getComponentNameFromType(Component) || "Component", lane)); "object" === typeof _instance && null !== _instance && (state = readContext(_instance)); _instance = new Component(nextProps, state); if (workInProgress.mode & 8) { setIsStrictModeForDevtools(!0); try { _instance = new Component(nextProps, state); } finally { setIsStrictModeForDevtools(!1); } } state = workInProgress.memoizedState = null !== _instance.state && void 0 !== _instance.state ? _instance.state : null; _instance.updater = classComponentUpdater; workInProgress.stateNode = _instance; _instance._reactInternals = workInProgress; _instance._reactInternalInstance = fakeInternalInstance; "function" === typeof Component.getDerivedStateFromProps && null === state && (state = getComponentNameFromType(Component) || "Component", didWarnAboutUninitializedState.has(state) || (didWarnAboutUninitializedState.add(state), console.error("`%s` uses `getDerivedStateFromProps` but its initial state is %s. This is not recommended. Instead, define the initial state by assigning an object to `this.state` in the constructor of `%s`. This ensures that `getDerivedStateFromProps` arguments have a consistent shape.", state, null === _instance.state ? "null" : "undefined", state))); if ("function" === typeof Component.getDerivedStateFromProps || "function" === typeof _instance.getSnapshotBeforeUpdate) { var foundWillUpdateName = lane = state = null; "function" === typeof _instance.componentWillMount && !0 !== _instance.componentWillMount.__suppressDeprecationWarning ? state = "componentWillMount" : "function" === typeof _instance.UNSAFE_componentWillMount && (state = "UNSAFE_componentWillMount"); "function" === typeof _instance.componentWillReceiveProps && !0 !== _instance.componentWillReceiveProps.__suppressDeprecationWarning ? lane = "componentWillReceiveProps" : "function" === typeof _instance.UNSAFE_componentWillReceiveProps && (lane = "UNSAFE_componentWillReceiveProps"); "function" === typeof _instance.componentWillUpdate && !0 !== _instance.componentWillUpdate.__suppressDeprecationWarning ? foundWillUpdateName = "componentWillUpdate" : "function" === typeof _instance.UNSAFE_componentWillUpdate && (foundWillUpdateName = "UNSAFE_componentWillUpdate"); if (null !== state || null !== lane || null !== foundWillUpdateName) { _instance = getComponentNameFromType(Component) || "Component"; var newApiName = "function" === typeof Component.getDerivedStateFromProps ? "getDerivedStateFromProps()" : "getSnapshotBeforeUpdate()"; didWarnAboutLegacyLifecyclesAndDerivedState.has(_instance) || (didWarnAboutLegacyLifecyclesAndDerivedState.add(_instance), console.error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://react.dev/link/unsafe-component-lifecycles", _instance, newApiName, null !== state ? "\n " + state : "", null !== lane ? "\n " + lane : "", null !== foundWillUpdateName ? "\n " + foundWillUpdateName : "")); } } _instance = workInProgress.stateNode; state = getComponentNameFromType(Component) || "Component"; _instance.render || (Component.prototype && "function" === typeof Component.prototype.render ? console.error("No `render` method found on the %s instance: did you accidentally return an object from the constructor?", state) : console.error("No `render` method found on the %s instance: you may have forgotten to define `render`.", state)); !_instance.getInitialState || _instance.getInitialState.isReactClassApproved || _instance.state || console.error("getInitialState was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?", state); _instance.getDefaultProps && !_instance.getDefaultProps.isReactClassApproved && console.error("getDefaultProps was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Use a static property to define defaultProps instead.", state); _instance.contextType && console.error("contextType was defined as an instance property on %s. Use a static property to define contextType instead.", state); Component.childContextTypes && !didWarnAboutChildContextTypes.has(Component) && (didWarnAboutChildContextTypes.add(Component), console.error("%s uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead. (https://react.dev/link/legacy-context)", state)); Component.contextTypes && !didWarnAboutContextTypes$1.has(Component) && (didWarnAboutContextTypes$1.add(Component), console.error("%s uses the legacy contextTypes API which was removed in React 19. Use React.createContext() with static contextType instead. (https://react.dev/link/legacy-context)", state)); "function" === typeof _instance.componentShouldUpdate && console.error("%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.", state); Component.prototype && Component.prototype.isPureReactComponent && "undefined" !== typeof _instance.shouldComponentUpdate && console.error("%s has a method called shouldComponentUpdate(). shouldComponentUpdate should not be used when extending React.PureComponent. Please extend React.Component if shouldComponentUpdate is used.", getComponentNameFromType(Component) || "A pure component"); "function" === typeof _instance.componentDidUnmount && console.error("%s has a method called componentDidUnmount(). But there is no such lifecycle method. Did you mean componentWillUnmount()?", state); "function" === typeof _instance.componentDidReceiveProps && console.error("%s has a method called componentDidReceiveProps(). But there is no such lifecycle method. If you meant to update the state in response to changing props, use componentWillReceiveProps(). If you meant to fetch data or run side-effects or mutations after React has updated the UI, use componentDidUpdate().", state); "function" === typeof _instance.componentWillRecieveProps && console.error("%s has a method called componentWillRecieveProps(). Did you mean componentWillReceiveProps()?", state); "function" === typeof _instance.UNSAFE_componentWillRecieveProps && console.error("%s has a method called UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?", state); lane = _instance.props !== nextProps; void 0 !== _instance.props && lane && console.error("When calling super() in `%s`, make sure to pass up the same props that your component's constructor was passed.", state); _instance.defaultProps && console.error("Setting defaultProps as an instance property on %s is not supported and will be ignored. Instead, define defaultProps as a static property on %s.", state, state); "function" !== typeof _instance.getSnapshotBeforeUpdate || "function" === typeof _instance.componentDidUpdate || didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(Component) || (didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(Component), console.error("%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). This component defines getSnapshotBeforeUpdate() only.", getComponentNameFromType(Component))); "function" === typeof _instance.getDerivedStateFromProps && console.error("%s: getDerivedStateFromProps() is defined as an instance method and will be ignored. Instead, declare it as a static method.", state); "function" === typeof _instance.getDerivedStateFromError && console.error("%s: getDerivedStateFromError() is defined as an instance method and will be ignored. Instead, declare it as a static method.", state); "function" === typeof Component.getSnapshotBeforeUpdate && console.error("%s: getSnapshotBeforeUpdate() is defined as a static method and will be ignored. Instead, declare it as an instance method.", state); (lane = _instance.state) && ("object" !== typeof lane || isArrayImpl(lane)) && console.error("%s.state: must be set to an object or null", state); "function" === typeof _instance.getChildContext && "object" !== typeof Component.childContextTypes && console.error("%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().", state); _instance = workInProgress.stateNode; _instance.props = nextProps; _instance.state = workInProgress.memoizedState; _instance.refs = {}; initializeUpdateQueue(workInProgress); state = Component.contextType; _instance.context = "object" === typeof state && null !== state ? readContext(state) : emptyContextObject; _instance.state === nextProps && (state = getComponentNameFromType(Component) || "Component", didWarnAboutDirectlyAssigningPropsToState.has(state) || (didWarnAboutDirectlyAssigningPropsToState.add(state), console.error("%s: It is not recommended to assign props directly to state because updates to props won't be reflected in state. In most cases, it is better to use props directly.", state))); workInProgress.mode & 8 && ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, _instance); ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, _instance); _instance.state = workInProgress.memoizedState; state = Component.getDerivedStateFromProps; "function" === typeof state && (applyDerivedStateFromProps(workInProgress, Component, state, nextProps), _instance.state = workInProgress.memoizedState); "function" === typeof Component.getDerivedStateFromProps || "function" === typeof _instance.getSnapshotBeforeUpdate || "function" !== typeof _instance.UNSAFE_componentWillMount && "function" !== typeof _instance.componentWillMount || (state = _instance.state, "function" === typeof _instance.componentWillMount && _instance.componentWillMount(), "function" === typeof _instance.UNSAFE_componentWillMount && _instance.UNSAFE_componentWillMount(), state !== _instance.state && (console.error("%s.componentWillMount(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.", getComponentNameFromFiber(workInProgress) || "Component"), classComponentUpdater.enqueueReplaceState(_instance, _instance.state, null)), processUpdateQueue(workInProgress, nextProps, _instance, renderLanes), suspendIfUpdateReadFromEntangledAsyncAction(), _instance.state = workInProgress.memoizedState); "function" === typeof _instance.componentDidMount && (workInProgress.flags |= 4194308); (workInProgress.mode & 16) !== NoMode && (workInProgress.flags |= 268435456); _instance = !0; } else if (null === current) { _instance = workInProgress.stateNode; var unresolvedOldProps = workInProgress.memoizedProps; lane = resolveClassComponentProps(Component, unresolvedOldProps); _instance.props = lane; var oldContext = _instance.context; foundWillUpdateName = Component.contextType; state = emptyContextObject; "object" === typeof foundWillUpdateName && null !== foundWillUpdateName && (state = readContext(foundWillUpdateName)); newApiName = Component.getDerivedStateFromProps; foundWillUpdateName = "function" === typeof newApiName || "function" === typeof _instance.getSnapshotBeforeUpdate; unresolvedOldProps = workInProgress.pendingProps !== unresolvedOldProps; foundWillUpdateName || "function" !== typeof _instance.UNSAFE_componentWillReceiveProps && "function" !== typeof _instance.componentWillReceiveProps || (unresolvedOldProps || oldContext !== state) && callComponentWillReceiveProps(workInProgress, _instance, nextProps, state); hasForceUpdate = !1; var oldState = workInProgress.memoizedState; _instance.state = oldState; processUpdateQueue(workInProgress, nextProps, _instance, renderLanes); suspendIfUpdateReadFromEntangledAsyncAction(); oldContext = workInProgress.memoizedState; unresolvedOldProps || oldState !== oldContext || hasForceUpdate ? ("function" === typeof newApiName && (applyDerivedStateFromProps(workInProgress, Component, newApiName, nextProps), oldContext = workInProgress.memoizedState), (lane = hasForceUpdate || checkShouldComponentUpdate(workInProgress, Component, lane, nextProps, oldState, oldContext, state)) ? (foundWillUpdateName || "function" !== typeof _instance.UNSAFE_componentWillMount && "function" !== typeof _instance.componentWillMount || ("function" === typeof _instance.componentWillMount && _instance.componentWillMount(), "function" === typeof _instance.UNSAFE_componentWillMount && _instance.UNSAFE_componentWillMount()), "function" === typeof _instance.componentDidMount && (workInProgress.flags |= 4194308), (workInProgress.mode & 16) !== NoMode && (workInProgress.flags |= 268435456)) : ("function" === typeof _instance.componentDidMount && (workInProgress.flags |= 4194308), (workInProgress.mode & 16) !== NoMode && (workInProgress.flags |= 268435456), workInProgress.memoizedProps = nextProps, workInProgress.memoizedState = oldContext), _instance.props = nextProps, _instance.state = oldContext, _instance.context = state, _instance = lane) : ("function" === typeof _instance.componentDidMount && (workInProgress.flags |= 4194308), (workInProgress.mode & 16) !== NoMode && (workInProgress.flags |= 268435456), _instance = !1); } else { _instance = workInProgress.stateNode; cloneUpdateQueue(current, workInProgress); state = workInProgress.memoizedProps; foundWillUpdateName = resolveClassComponentProps(Component, state); _instance.props = foundWillUpdateName; newApiName = workInProgress.pendingProps; oldState = _instance.context; oldContext = Component.contextType; lane = emptyContextObject; "object" === typeof oldContext && null !== oldContext && (lane = readContext(oldContext)); unresolvedOldProps = Component.getDerivedStateFromProps; (oldContext = "function" === typeof unresolvedOldProps || "function" === typeof _instance.getSnapshotBeforeUpdate) || "function" !== typeof _instance.UNSAFE_componentWillReceiveProps && "function" !== typeof _instance.componentWillReceiveProps || (state !== newApiName || oldState !== lane) && callComponentWillReceiveProps(workInProgress, _instance, nextProps, lane); hasForceUpdate = !1; oldState = workInProgress.memoizedState; _instance.state = oldState; processUpdateQueue(workInProgress, nextProps, _instance, renderLanes); suspendIfUpdateReadFromEntangledAsyncAction(); var newState = workInProgress.memoizedState; state !== newApiName || oldState !== newState || hasForceUpdate || null !== current && null !== current.dependencies && checkIfContextChanged(current.dependencies) ? ("function" === typeof unresolvedOldProps && (applyDerivedStateFromProps(workInProgress, Component, unresolvedOldProps, nextProps), newState = workInProgress.memoizedState), (foundWillUpdateName = hasForceUpdate || checkShouldComponentUpdate(workInProgress, Component, foundWillUpdateName, nextProps, oldState, newState, lane) || null !== current && null !== current.dependencies && checkIfContextChanged(current.dependencies)) ? (oldContext || "function" !== typeof _instance.UNSAFE_componentWillUpdate && "function" !== typeof _instance.componentWillUpdate || ("function" === typeof _instance.componentWillUpdate && _instance.componentWillUpdate(nextProps, newState, lane), "function" === typeof _instance.UNSAFE_componentWillUpdate && _instance.UNSAFE_componentWillUpdate(nextProps, newState, lane)), "function" === typeof _instance.componentDidUpdate && (workInProgress.flags |= 4), "function" === typeof _instance.getSnapshotBeforeUpdate && (workInProgress.flags |= 1024)) : ("function" !== typeof _instance.componentDidUpdate || state === current.memoizedProps && oldState === current.memoizedState || (workInProgress.flags |= 4), "function" !== typeof _instance.getSnapshotBeforeUpdate || state === current.memoizedProps && oldState === current.memoizedState || (workInProgress.flags |= 1024), workInProgress.memoizedProps = nextProps, workInProgress.memoizedState = newState), _instance.props = nextProps, _instance.state = newState, _instance.context = lane, _instance = foundWillUpdateName) : ("function" !== typeof _instance.componentDidUpdate || state === current.memoizedProps && oldState === current.memoizedState || (workInProgress.flags |= 4), "function" !== typeof _instance.getSnapshotBeforeUpdate || state === current.memoizedProps && oldState === current.memoizedState || (workInProgress.flags |= 1024), _instance = !1); } lane = _instance; markRef(current, workInProgress); state = 0 !== (workInProgress.flags & 128); if (lane || state) { lane = workInProgress.stateNode; setCurrentFiber(workInProgress); if (state && "function" !== typeof Component.getDerivedStateFromError) Component = null, profilerStartTime = -1; else if (Component = callRenderInDEV(lane), workInProgress.mode & 8) { setIsStrictModeForDevtools(!0); try { callRenderInDEV(lane); } finally { setIsStrictModeForDevtools(!1); } } workInProgress.flags |= 1; null !== current && state ? (workInProgress.child = reconcileChildFibers(workInProgress, current.child, null, renderLanes), workInProgress.child = reconcileChildFibers(workInProgress, null, Component, renderLanes)) : reconcileChildren(current, workInProgress, Component, renderLanes); workInProgress.memoizedState = lane.state; current = workInProgress.child; } else current = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); renderLanes = workInProgress.stateNode; _instance && renderLanes.props !== nextProps && (didWarnAboutReassigningProps || console.error("It looks like %s is reassigning its own `this.props` while rendering. This is not supported and can lead to confusing bugs.", getComponentNameFromFiber(workInProgress) || "a component"), didWarnAboutReassigningProps = !0); return current; } function mountHostRootWithoutHydrating(current, workInProgress, nextChildren, renderLanes) { resetHydrationState(); workInProgress.flags |= 256; reconcileChildren(current, workInProgress, nextChildren, renderLanes); return workInProgress.child; } function validateFunctionComponentInDev(workInProgress, Component) { Component && Component.childContextTypes && console.error("childContextTypes cannot be defined on a function component.\n %s.childContextTypes = ...", Component.displayName || Component.name || "Component"); "function" === typeof Component.getDerivedStateFromProps && (workInProgress = getComponentNameFromType(Component) || "Unknown", didWarnAboutGetDerivedStateOnFunctionComponent[workInProgress] || (console.error("%s: Function components do not support getDerivedStateFromProps.", workInProgress), didWarnAboutGetDerivedStateOnFunctionComponent[workInProgress] = !0)); "object" === typeof Component.contextType && null !== Component.contextType && (Component = getComponentNameFromType(Component) || "Unknown", didWarnAboutContextTypeOnFunctionComponent[Component] || (console.error("%s: Function components do not support contextType.", Component), didWarnAboutContextTypeOnFunctionComponent[Component] = !0)); } function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: getSuspendedCache() }; } function getRemainingWorkInPrimaryTree(current, primaryTreeDidDefer, renderLanes) { current = null !== current ? current.childLanes & ~renderLanes : 0; primaryTreeDidDefer && (current |= workInProgressDeferredLane); return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); var showFallback = !1, didSuspend = 0 !== (workInProgress.flags & 128), JSCompiler_temp; (JSCompiler_temp = didSuspend) || (JSCompiler_temp = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); JSCompiler_temp && (showFallback = !0, workInProgress.flags &= -129); JSCompiler_temp = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { showFallback ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); (current = nextHydratableInstance) ? (renderLanes = canHydrateSuspenseInstance(current, rootOrSingletonContext), null !== renderLanes && (JSCompiler_temp = { dehydrated: renderLanes, treeContext: getSuspendedTreeContext(), retryLane: 536870912, hydrationErrors: null }, workInProgress.memoizedState = JSCompiler_temp, JSCompiler_temp = createFiberFromDehydratedFragment(renderLanes), JSCompiler_temp.return = workInProgress, workInProgress.child = JSCompiler_temp, hydrationParentFiber = workInProgress, nextHydratableInstance = null)) : renderLanes = null; if (null === renderLanes) throw warnNonHydratedInstance(workInProgress, current), throwOnHydrationMismatch(workInProgress); isSuspenseInstanceFallback(renderLanes) ? workInProgress.lanes = 32 : workInProgress.lanes = 536870912; return null; } didSuspend = nextProps.children; nextProps = nextProps.fallback; if (showFallback) return reuseSuspenseHandlerOnStack(workInProgress), showFallback = workInProgress.mode, didSuspend = mountWorkInProgressOffscreenFiber({ mode: "hidden", children: didSuspend }, showFallback), nextProps = createFiberFromFragment(nextProps, showFallback, renderLanes, null), didSuspend.return = workInProgress, nextProps.return = workInProgress, didSuspend.sibling = nextProps, workInProgress.child = didSuspend, nextProps = workInProgress.child, nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes), nextProps.childLanes = getRemainingWorkInPrimaryTree(current, JSCompiler_temp, renderLanes), workInProgress.memoizedState = SUSPENDED_MARKER, bailoutOffscreenComponent(null, nextProps); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren(workInProgress, didSuspend); } var prevState = current.memoizedState; if (null !== prevState) { var _dehydrated2 = prevState.dehydrated; if (null !== _dehydrated2) return updateDehydratedSuspenseComponent(current, workInProgress, didSuspend, JSCompiler_temp, nextProps, _dehydrated2, prevState, renderLanes); } if (showFallback) return reuseSuspenseHandlerOnStack(workInProgress), showFallback = nextProps.fallback, didSuspend = workInProgress.mode, prevState = current.child, _dehydrated2 = prevState.sibling, nextProps = createWorkInProgress(prevState, { mode: "hidden", children: nextProps.children }), nextProps.subtreeFlags = prevState.subtreeFlags & 1206910976, null !== _dehydrated2 ? showFallback = createWorkInProgress(_dehydrated2, showFallback) : (showFallback = createFiberFromFragment(showFallback, didSuspend, renderLanes, null), showFallback.flags |= 2), showFallback.return = workInProgress, nextProps.return = workInProgress, nextProps.sibling = showFallback, workInProgress.child = nextProps, bailoutOffscreenComponent(null, nextProps), nextProps = workInProgress.child, showFallback = current.child.memoizedState, null === showFallback ? showFallback = mountSuspenseOffscreenState(renderLanes) : (didSuspend = showFallback.cachePool, null !== didSuspend ? (prevState = isPrimaryRenderer ? CacheContext._currentValue : CacheContext._currentValue2, didSuspend = didSuspend.parent !== prevState ? { parent: prevState, pool: prevState } : didSuspend) : didSuspend = getSuspendedCache(), showFallback = { baseLanes: showFallback.baseLanes | renderLanes, cachePool: didSuspend }), nextProps.memoizedState = showFallback, nextProps.childLanes = getRemainingWorkInPrimaryTree(current, JSCompiler_temp, renderLanes), workInProgress.memoizedState = SUSPENDED_MARKER, bailoutOffscreenComponent(current.child, nextProps); null !== prevState && (renderLanes & 62914560) === renderLanes && 0 !== (renderLanes & current.lanes) && markRenderDerivedCause(workInProgress); pushPrimaryTreeSuspenseHandler(workInProgress); renderLanes = current.child; current = renderLanes.sibling; renderLanes = createWorkInProgress(renderLanes, { mode: "visible", children: nextProps.children }); renderLanes.return = workInProgress; renderLanes.sibling = null; null !== current && (JSCompiler_temp = workInProgress.deletions, null === JSCompiler_temp ? (workInProgress.deletions = [current], workInProgress.flags |= 16) : JSCompiler_temp.push(current)); workInProgress.child = renderLanes; workInProgress.memoizedState = null; return renderLanes; } function mountSuspensePrimaryChildren(workInProgress, primaryChildren) { primaryChildren = mountWorkInProgressOffscreenFiber({ mode: "visible", children: primaryChildren }, workInProgress.mode); primaryChildren.return = workInProgress; return workInProgress.child = primaryChildren; } function mountWorkInProgressOffscreenFiber(offscreenProps, mode) { offscreenProps = createFiber(22, offscreenProps, null, mode); offscreenProps.lanes = 0; return offscreenProps; } function retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes) { reconcileChildFibers(workInProgress, current.child, null, renderLanes); current = mountSuspensePrimaryChildren(workInProgress, workInProgress.pendingProps.children); current.flags |= 2; workInProgress.memoizedState = null; return current; } function updateDehydratedSuspenseComponent(current, workInProgress, didSuspend, didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, renderLanes) { if (didSuspend) { if (workInProgress.flags & 256) return pushPrimaryTreeSuspenseHandler(workInProgress), workInProgress.flags &= -257, retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes); if (null !== workInProgress.memoizedState) return reuseSuspenseHandlerOnStack(workInProgress), workInProgress.child = current.child, workInProgress.flags |= 128, null; reuseSuspenseHandlerOnStack(workInProgress); suspenseInstance = nextProps.fallback; suspenseState = workInProgress.mode; nextProps = mountWorkInProgressOffscreenFiber({ mode: "visible", children: nextProps.children }, suspenseState); suspenseInstance = createFiberFromFragment(suspenseInstance, suspenseState, renderLanes, null); suspenseInstance.flags |= 2; nextProps.return = workInProgress; suspenseInstance.return = workInProgress; nextProps.sibling = suspenseInstance; workInProgress.child = nextProps; reconcileChildFibers(workInProgress, current.child, null, renderLanes); nextProps = workInProgress.child; nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes); nextProps.childLanes = getRemainingWorkInPrimaryTree(current, didPrimaryChildrenDefer, renderLanes); workInProgress.memoizedState = SUSPENDED_MARKER; return bailoutOffscreenComponent(null, nextProps); } pushPrimaryTreeSuspenseHandler(workInProgress); warnIfHydrating(); 0 !== (renderLanes & 536870912) && markRenderDerivedCause(workInProgress); if (isSuspenseInstanceFallback(suspenseInstance)) return suspenseState = getSuspenseInstanceFallbackErrorDetails(suspenseInstance), didPrimaryChildrenDefer = suspenseState.digest, suspenseInstance = suspenseState.message, nextProps = suspenseState.stack, suspenseState = suspenseState.componentStack, didPrimaryChildrenDefer !== REACT_RECOVERABLE_DIGEST && (suspenseInstance = suspenseInstance ? Error(suspenseInstance) : Error("The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering."), suspenseInstance.stack = nextProps || "", suspenseInstance.digest = didPrimaryChildrenDefer, didPrimaryChildrenDefer = void 0 === suspenseState ? null : suspenseState, nextProps = { value: suspenseInstance, source: null, stack: didPrimaryChildrenDefer }, "string" === typeof didPrimaryChildrenDefer && CapturedStacks.set(suspenseInstance, nextProps), queueHydrationError(nextProps)), retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes); didReceiveUpdate || propagateParentContextChanges(current, workInProgress, renderLanes, !1); didPrimaryChildrenDefer = 0 !== (renderLanes & current.childLanes); if (didReceiveUpdate || didPrimaryChildrenDefer) { if (null !== currentTreeHiddenStackCursor.current) return retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes); didPrimaryChildrenDefer = workInProgressRoot; if (null !== didPrimaryChildrenDefer && (nextProps = getBumpedLaneForHydration(didPrimaryChildrenDefer, renderLanes), 0 !== nextProps && nextProps !== suspenseState.retryLane)) throw suspenseState.retryLane = nextProps, enqueueConcurrentRenderForLane(current, nextProps), scheduleUpdateOnFiber(didPrimaryChildrenDefer, current, nextProps), SelectiveHydrationException; isSuspenseInstancePending(suspenseInstance) || renderDidSuspendDelayIfPossible(); return retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes); } if (isSuspenseInstancePending(suspenseInstance)) return workInProgress.flags |= 192, workInProgress.child = current.child, null; current = suspenseState.treeContext; supportsHydration && (nextHydratableInstance = getFirstHydratableChildWithinSuspenseInstance(suspenseInstance), hydrationParentFiber = workInProgress, isHydrating = !0, hydrationErrors = null, didSuspendOrErrorDEV = !1, hydrationDiffRootDEV = null, rootOrSingletonContext = !1, null !== current && restoreSuspendedTreeContext(workInProgress, current)); workInProgress = mountSuspensePrimaryChildren(workInProgress, nextProps.children); workInProgress.flags |= 134221824; return workInProgress; } function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) { fiber.lanes |= renderLanes; var alternate = fiber.alternate; null !== alternate && (alternate.lanes |= renderLanes); scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot); } function findLastContentRow(firstChild) { for (var lastContentRow = null; null !== firstChild;) { var currentRow = firstChild.alternate; null !== currentRow && null === findFirstSuspended(currentRow) && (lastContentRow = firstChild); firstChild = firstChild.sibling; } return lastContentRow; } function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, treeForkCount) { var renderState = workInProgress.memoizedState; null === renderState ? workInProgress.memoizedState = { isBackwards, rendering: null, renderingStartTime: 0, last: lastContentRow, tail, tailMode, treeForkCount } : (renderState.isBackwards = isBackwards, renderState.rendering = null, renderState.renderingStartTime = 0, renderState.last = lastContentRow, renderState.tail = tail, renderState.tailMode = tailMode, renderState.treeForkCount = treeForkCount); } function reverseChildren(fiber) { var row = fiber.child; for (fiber.child = null; null !== row;) { var nextRow = row.sibling; row.sibling = fiber.child; fiber.child = row; row = nextRow; } } function updateSuspenseListComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps, revealOrder = nextProps.revealOrder, tailMode = nextProps.tail, newChildren = nextProps.children, suspenseContext = suspenseStackCursor.current; if (workInProgress.flags & 128) return pushSuspenseListContext(workInProgress, suspenseContext), null; (nextProps = 0 !== (suspenseContext & ForceSuspenseFallback)) ? (suspenseContext = suspenseContext & SubtreeSuspenseContextMask | ForceSuspenseFallback, workInProgress.flags |= 128) : suspenseContext &= SubtreeSuspenseContextMask; pushSuspenseListContext(workInProgress, suspenseContext); suspenseContext = null == revealOrder ? "null" : revealOrder; if (null != revealOrder && "forwards" !== revealOrder && "backwards" !== revealOrder && "unstable_legacy-backwards" !== revealOrder && "together" !== revealOrder && "independent" !== revealOrder && !didWarnAboutRevealOrder[suspenseContext]) if (didWarnAboutRevealOrder[suspenseContext] = !0, "string" === typeof revealOrder) switch (revealOrder.toLowerCase()) { case "together": case "forwards": case "backwards": case "independent": console.error("\"%s\" is not a valid value for revealOrder on . Use lowercase \"%s\" instead.", revealOrder, revealOrder.toLowerCase()); break; case "forward": case "backward": console.error("\"%s\" is not a valid value for revealOrder on . React uses the -s suffix in the spelling. Use \"%ss\" instead.", revealOrder, revealOrder.toLowerCase()); break; default: console.error("\"%s\" is not a supported revealOrder on . Did you mean \"independent\", \"together\", \"forwards\" or \"backwards\"?", revealOrder); } else console.error("%s is not a supported value for revealOrder on . Did you mean \"independent\", \"together\", \"forwards\" or \"backwards\"?", revealOrder); suspenseContext = null == tailMode ? "null" : tailMode; didWarnAboutTailOptions[suspenseContext] || null == tailMode || ("visible" !== tailMode && "collapsed" !== tailMode && "hidden" !== tailMode ? (didWarnAboutTailOptions[suspenseContext] = !0, console.error("\"%s\" is not a supported value for tail on . Did you mean \"visible\", \"collapsed\" or \"hidden\"?", tailMode)) : null != revealOrder && "forwards" !== revealOrder && "backwards" !== revealOrder && "unstable_legacy-backwards" !== revealOrder && (didWarnAboutTailOptions[suspenseContext] = !0, console.error(" is only valid if revealOrder is \"forwards\" (default) or \"backwards\". Did you mean to specify revealOrder=\"forwards\"?", tailMode))); a: if ((null == revealOrder || "forwards" === revealOrder || "backwards" === revealOrder || "unstable_legacy-backwards" === revealOrder) && void 0 !== newChildren && null !== newChildren && !1 !== newChildren) if (isArrayImpl(newChildren)) { for (suspenseContext = 0; suspenseContext < newChildren.length; suspenseContext++) if (!validateSuspenseListNestedChild(newChildren[suspenseContext], suspenseContext)) break a; } else if (suspenseContext = getIteratorFn(newChildren), "function" === typeof suspenseContext) { if (suspenseContext = suspenseContext.call(newChildren)) for (var step = suspenseContext.next(), _i = 0; !step.done; step = suspenseContext.next()) { if (!validateSuspenseListNestedChild(step.value, _i)) break a; _i++; } } else console.error("A single row was passed to a . This is not useful since it needs multiple rows. Did you mean to pass multiple children or an array?", revealOrder); "backwards" === revealOrder && null !== current ? (reverseChildren(current), reconcileChildren(current, workInProgress, newChildren, renderLanes), reverseChildren(current)) : reconcileChildren(current, workInProgress, newChildren, renderLanes); isHydrating ? (warnIfNotHydrating(), newChildren = treeForkCount) : newChildren = 0; if (!nextProps && null !== current && 0 !== (current.flags & 128)) a: for (current = workInProgress.child; null !== current;) { if (13 === current.tag) null !== current.memoizedState && scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress); else if (19 === current.tag) scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress); else if (null !== current.child) { current.child.return = current; current = current.child; continue; } if (current === workInProgress) break a; for (; null === current.sibling;) { if (null === current.return || current.return === workInProgress) break a; current = current.return; } current.sibling.return = current.return; current = current.sibling; } switch (revealOrder) { case "backwards": renderLanes = findLastContentRow(workInProgress.child); null === renderLanes ? (revealOrder = workInProgress.child, workInProgress.child = null) : (revealOrder = renderLanes.sibling, renderLanes.sibling = null, reverseChildren(workInProgress)); initSuspenseListRenderState(workInProgress, !0, revealOrder, null, tailMode, newChildren); break; case "unstable_legacy-backwards": renderLanes = null; revealOrder = workInProgress.child; for (workInProgress.child = null; null !== revealOrder;) { current = revealOrder.alternate; if (null !== current && null === findFirstSuspended(current)) { workInProgress.child = revealOrder; break; } current = revealOrder.sibling; revealOrder.sibling = renderLanes; renderLanes = revealOrder; revealOrder = current; } initSuspenseListRenderState(workInProgress, !0, renderLanes, null, tailMode, newChildren); break; case "together": initSuspenseListRenderState(workInProgress, !1, null, null, void 0, newChildren); break; case "independent": workInProgress.memoizedState = null; break; default: renderLanes = findLastContentRow(workInProgress.child), null === renderLanes ? (revealOrder = workInProgress.child, workInProgress.child = null) : (revealOrder = renderLanes.sibling, renderLanes.sibling = null), initSuspenseListRenderState(workInProgress, !1, revealOrder, renderLanes, tailMode, newChildren); } return workInProgress.child; } function updateContextProvider(current, workInProgress, renderLanes) { var context = workInProgress.type, newProps = workInProgress.pendingProps, newValue = newProps.value; "value" in newProps || hasWarnedAboutUsingNoValuePropOnContextProvider || (hasWarnedAboutUsingNoValuePropOnContextProvider = !0, console.error("The `value` prop is required for the ``. Did you misspell it or forget to pass it?")); pushProvider(workInProgress, context, newValue); reconcileChildren(current, workInProgress, newProps.children, renderLanes); return workInProgress.child; } function bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) { null !== current && (workInProgress.dependencies = current.dependencies); profilerStartTime = -1; workInProgressRootSkippedLanes |= workInProgress.lanes; if (0 === (renderLanes & workInProgress.childLanes)) if (null !== current) { if (propagateParentContextChanges(current, workInProgress, renderLanes, !1), 0 === (renderLanes & workInProgress.childLanes)) return null; } else return null; if (null !== current && workInProgress.child !== current.child) throw Error("Resuming work not yet implemented."); if (null !== workInProgress.child) { current = workInProgress.child; renderLanes = createWorkInProgress(current, current.pendingProps); workInProgress.child = renderLanes; for (renderLanes.return = workInProgress; null !== current.sibling;) current = current.sibling, renderLanes = renderLanes.sibling = createWorkInProgress(current, current.pendingProps), renderLanes.return = workInProgress; renderLanes.sibling = null; } return workInProgress.child; } function checkScheduledUpdateOrContext(current, renderLanes) { if (0 !== (current.lanes & renderLanes)) return !0; current = current.dependencies; return null !== current && checkIfContextChanged(current) ? !0 : !1; } function attemptEarlyBailoutIfNoScheduledUpdate(current, workInProgress, renderLanes) { switch (workInProgress.tag) { case 3: pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); pushProvider(workInProgress, CacheContext, current.memoizedState.cache); resetHydrationState(); break; case 27: case 5: pushHostContext(workInProgress); break; case 4: pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); break; case 10: pushProvider(workInProgress, workInProgress.type, workInProgress.memoizedProps.value); break; case 12: 0 !== (renderLanes & workInProgress.childLanes) && (workInProgress.flags |= 4); workInProgress.flags |= 2048; var stateNode = workInProgress.stateNode; stateNode.effectDuration = -0; stateNode.passiveEffectDuration = -0; break; case 31: if (null !== workInProgress.memoizedState) return workInProgress.flags |= 128, pushDehydratedActivitySuspenseHandler(workInProgress), null; break; case 13: stateNode = workInProgress.memoizedState; if (null !== stateNode) { if (null !== stateNode.dehydrated) return pushPrimaryTreeSuspenseHandler(workInProgress), workInProgress.flags |= 128, null; stateNode = propagateParentContextChanges(current, workInProgress, renderLanes, !1); var primaryChildLanes = workInProgress.child.childLanes; if (stateNode || 0 !== (renderLanes & primaryChildLanes)) return updateSuspenseComponent(current, workInProgress, renderLanes); pushPrimaryTreeSuspenseHandler(workInProgress); current = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); return null !== current ? current.sibling : null; } pushPrimaryTreeSuspenseHandler(workInProgress); break; case 19: if (workInProgress.flags & 128) return updateSuspenseListComponent(current, workInProgress, renderLanes); primaryChildLanes = 0 !== (current.flags & 128); stateNode = 0 !== (renderLanes & workInProgress.childLanes); stateNode || (propagateParentContextChanges(current, workInProgress, renderLanes, !1), stateNode = 0 !== (renderLanes & workInProgress.childLanes)); if (primaryChildLanes) { if (stateNode) return updateSuspenseListComponent(current, workInProgress, renderLanes); workInProgress.flags |= 128; } primaryChildLanes = workInProgress.memoizedState; null !== primaryChildLanes && (primaryChildLanes.rendering = null, primaryChildLanes.tail = null, primaryChildLanes.lastEffect = null); pushSuspenseListContext(workInProgress, suspenseStackCursor.current); if (stateNode) break; else return null; case 22: return workInProgress.lanes = 0, updateOffscreenComponent(current, workInProgress, renderLanes, workInProgress.pendingProps); case 24: pushProvider(workInProgress, CacheContext, current.memoizedState.cache); } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } function beginWork(current, workInProgress, renderLanes) { if (workInProgress._debugNeedsRemount && null !== current) { renderLanes = createFiberFromTypeAndProps(resolveTypeForHotReloading(workInProgress.elementType), workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes); renderLanes._debugStack = workInProgress._debugStack; renderLanes._debugTask = workInProgress._debugTask; var returnFiber = workInProgress.return; if (null === returnFiber) throw Error("Cannot swap the root fiber."); current.alternate = null; workInProgress.alternate = null; renderLanes.index = workInProgress.index; renderLanes.sibling = workInProgress.sibling; renderLanes.return = workInProgress.return; renderLanes.ref = workInProgress.ref; renderLanes._debugInfo = workInProgress._debugInfo; if (workInProgress === returnFiber.child) returnFiber.child = renderLanes; else { var prevSibling = returnFiber.child; if (null === prevSibling) throw Error("Expected parent to have a child."); for (; prevSibling.sibling !== workInProgress;) if (prevSibling = prevSibling.sibling, null === prevSibling) throw Error("Expected to find the previous sibling."); prevSibling.sibling = renderLanes; } workInProgress = returnFiber.deletions; null === workInProgress ? (returnFiber.deletions = [current], returnFiber.flags |= 16) : workInProgress.push(current); renderLanes.flags |= 134217730; return renderLanes; } if (null !== current) if (current.memoizedProps !== workInProgress.pendingProps || workInProgress.type !== current.type) didReceiveUpdate = !0; else { if (!checkScheduledUpdateOrContext(current, renderLanes) && 0 === (workInProgress.flags & 128)) return didReceiveUpdate = !1, attemptEarlyBailoutIfNoScheduledUpdate(current, workInProgress, renderLanes); didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; } else { didReceiveUpdate = !1; if (returnFiber = isHydrating) warnIfNotHydrating(), returnFiber = 0 !== (workInProgress.flags & 1048576); returnFiber && (returnFiber = workInProgress.index, warnIfNotHydrating(), pushTreeId(workInProgress, treeForkCount, returnFiber)); } workInProgress.lanes = 0; switch (workInProgress.tag) { case 16: a: if (returnFiber = workInProgress.pendingProps, current = resolveLazy(workInProgress.elementType), current = resolveTypeForHotReloading(current), workInProgress.type = current, "function" === typeof current) shouldConstruct(current) ? (returnFiber = resolveClassComponentProps(current, returnFiber), workInProgress.tag = 1, workInProgress = updateClassComponent(null, workInProgress, current, returnFiber, renderLanes)) : (workInProgress.tag = 0, validateFunctionComponentInDev(workInProgress, current), workInProgress = updateFunctionComponent(null, workInProgress, current, returnFiber, renderLanes)); else { if (void 0 !== current && null !== current) { if (prevSibling = current.$$typeof, prevSibling === REACT_FORWARD_REF_TYPE) { workInProgress.tag = 11; workInProgress = updateForwardRef(null, workInProgress, current, returnFiber, renderLanes); break a; } else if (prevSibling === REACT_MEMO_TYPE) { workInProgress.tag = 14; workInProgress = updateMemoComponent(null, workInProgress, current, returnFiber, renderLanes); break a; } else if (prevSibling === REACT_CONTEXT_TYPE) { workInProgress.tag = 10; workInProgress.type = current; workInProgress = updateContextProvider(null, workInProgress, renderLanes); break a; } } workInProgress = ""; null !== current && "object" === typeof current && current.$$typeof === REACT_LAZY_TYPE && (workInProgress = " Did you wrap a component in React.lazy() more than once?"); current = getComponentNameFromType(current) || current; throw Error("Element type is invalid. Received a promise that resolves to: " + current + ". Lazy element type must resolve to a class or function." + workInProgress); } return workInProgress; case 0: return updateFunctionComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, renderLanes); case 1: return returnFiber = workInProgress.type, prevSibling = resolveClassComponentProps(returnFiber, workInProgress.pendingProps), updateClassComponent(current, workInProgress, returnFiber, prevSibling, renderLanes); case 3: a: { pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); if (null === current) throw Error("Should have a current fiber. This is a bug in React."); var nextProps = workInProgress.pendingProps; prevSibling = workInProgress.memoizedState; returnFiber = prevSibling.element; cloneUpdateQueue(current, workInProgress); processUpdateQueue(workInProgress, nextProps, null, renderLanes); var nextState = workInProgress.memoizedState; nextProps = nextState.cache; pushProvider(workInProgress, CacheContext, nextProps); nextProps !== prevSibling.cache && propagateContextChanges(workInProgress, [CacheContext], renderLanes, !0); suspendIfUpdateReadFromEntangledAsyncAction(); nextProps = nextState.element; if (supportsHydration && prevSibling.isDehydrated) if (prevSibling = { element: nextProps, isDehydrated: !1, cache: nextState.cache }, workInProgress.updateQueue.baseState = prevSibling, workInProgress.memoizedState = prevSibling, workInProgress.flags & 256) { workInProgress = mountHostRootWithoutHydrating(current, workInProgress, nextProps, renderLanes); break a; } else if (nextProps !== returnFiber) { returnFiber = createCapturedValueAtFiber(Error("This root received an early update, before anything was able hydrate. Switched the entire root to client rendering."), workInProgress); queueHydrationError(returnFiber); workInProgress = mountHostRootWithoutHydrating(current, workInProgress, nextProps, renderLanes); break a; } else for (supportsHydration && (nextHydratableInstance = getFirstHydratableChildWithinContainer(workInProgress.stateNode.containerInfo), hydrationParentFiber = workInProgress, isHydrating = !0, hydrationErrors = null, didSuspendOrErrorDEV = !1, hydrationDiffRootDEV = null, rootOrSingletonContext = !0), current = mountChildFibers(workInProgress, null, nextProps, renderLanes), workInProgress.child = current; current;) current.flags = current.flags & -3 | 134221824, current = current.sibling; else { resetHydrationState(); if (nextProps === returnFiber) { workInProgress = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); break a; } reconcileChildren(current, workInProgress, nextProps, renderLanes); } workInProgress = workInProgress.child; } return workInProgress; case 26: if (supportsResources) return markRef(current, workInProgress), null === current ? (current = getResource(workInProgress.type, null, workInProgress.pendingProps, null)) ? workInProgress.memoizedState = current : isHydrating || (workInProgress.stateNode = createHoistableInstance(workInProgress.type, workInProgress.pendingProps, requiredContext(rootInstanceStackCursor.current), workInProgress)) : workInProgress.memoizedState = getResource(workInProgress.type, current.memoizedProps, workInProgress.pendingProps, current.memoizedState), null; case 27: if (supportsSingletons) return pushHostContext(workInProgress), null === current && supportsSingletons && isHydrating && (prevSibling = requiredContext(rootInstanceStackCursor.current), returnFiber = getHostContext(), prevSibling = workInProgress.stateNode = resolveSingletonInstance(workInProgress.type, workInProgress.pendingProps, prevSibling, returnFiber, !1), didSuspendOrErrorDEV || (returnFiber = diffHydratedPropsForDevWarnings(prevSibling, workInProgress.type, workInProgress.pendingProps, returnFiber), null !== returnFiber && (buildHydrationDiffNode(workInProgress, 0).serverProps = returnFiber)), hydrationParentFiber = workInProgress, rootOrSingletonContext = !0, nextHydratableInstance = getFirstHydratableChildWithinSingleton(workInProgress.type, prevSibling, nextHydratableInstance)), reconcileChildren(current, workInProgress, workInProgress.pendingProps.children, renderLanes), markRef(current, workInProgress), null === current && (workInProgress.flags |= 4194304), workInProgress.child; case 5: return null === current && isHydrating && (nextProps = getHostContext(), returnFiber = validateHydratableInstance(workInProgress.type, workInProgress.pendingProps, nextProps), prevSibling = nextHydratableInstance, (nextState = !prevSibling) || (nextState = canHydrateInstance(prevSibling, workInProgress.type, workInProgress.pendingProps, rootOrSingletonContext), null !== nextState ? (workInProgress.stateNode = nextState, didSuspendOrErrorDEV || (nextProps = diffHydratedPropsForDevWarnings(nextState, workInProgress.type, workInProgress.pendingProps, nextProps), null !== nextProps && (buildHydrationDiffNode(workInProgress, 0).serverProps = nextProps)), hydrationParentFiber = workInProgress, nextHydratableInstance = getFirstHydratableChild(nextState), rootOrSingletonContext = !1, nextProps = !0) : nextProps = !1, nextState = !nextProps), nextState && (returnFiber && warnNonHydratedInstance(workInProgress, prevSibling), throwOnHydrationMismatch(workInProgress))), pushHostContext(workInProgress), prevSibling = workInProgress.type, nextProps = workInProgress.pendingProps, nextState = null !== current ? current.memoizedProps : null, returnFiber = nextProps.children, shouldSetTextContent(prevSibling, nextProps) ? returnFiber = null : null !== nextState && shouldSetTextContent(prevSibling, nextState) && (workInProgress.flags |= 32), null !== workInProgress.memoizedState && (prevSibling = renderWithHooks(current, workInProgress, TransitionAwareHostComponent, null, null, renderLanes), isPrimaryRenderer ? HostTransitionContext._currentValue = prevSibling : HostTransitionContext._currentValue2 = prevSibling), markRef(current, workInProgress), reconcileChildren(current, workInProgress, returnFiber, renderLanes), workInProgress.child; case 6: return null === current && isHydrating && (current = workInProgress.pendingProps, renderLanes = getHostContext(), current = validateHydratableTextInstance(current, renderLanes), renderLanes = nextHydratableInstance, (returnFiber = !renderLanes) || (returnFiber = canHydrateTextInstance(renderLanes, workInProgress.pendingProps, rootOrSingletonContext), null !== returnFiber ? (workInProgress.stateNode = returnFiber, hydrationParentFiber = workInProgress, nextHydratableInstance = null, returnFiber = !0) : returnFiber = !1, returnFiber = !returnFiber), returnFiber && (current && warnNonHydratedInstance(workInProgress, renderLanes), throwOnHydrationMismatch(workInProgress))), null; case 13: return updateSuspenseComponent(current, workInProgress, renderLanes); case 4: return pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo), returnFiber = workInProgress.pendingProps, null === current ? workInProgress.child = reconcileChildFibers(workInProgress, null, returnFiber, renderLanes) : reconcileChildren(current, workInProgress, returnFiber, renderLanes), workInProgress.child; case 11: return updateForwardRef(current, workInProgress, workInProgress.type, workInProgress.pendingProps, renderLanes); case 7: return returnFiber = workInProgress.pendingProps, markRef(current, workInProgress), reconcileChildren(current, workInProgress, returnFiber, renderLanes), workInProgress.child; case 8: return reconcileChildren(current, workInProgress, workInProgress.pendingProps.children, renderLanes), workInProgress.child; case 12: return workInProgress.flags |= 4, workInProgress.flags |= 2048, returnFiber = workInProgress.stateNode, returnFiber.effectDuration = -0, returnFiber.passiveEffectDuration = -0, reconcileChildren(current, workInProgress, workInProgress.pendingProps.children, renderLanes), workInProgress.child; case 10: return updateContextProvider(current, workInProgress, renderLanes); case 9: return prevSibling = workInProgress.type._context, returnFiber = workInProgress.pendingProps.children, "function" !== typeof returnFiber && console.error("A context consumer was rendered with multiple children, or a child that isn't a function. A context consumer expects a single child that is a function. If you did pass a function, make sure there is no trailing or leading whitespace around it."), prepareToReadContext(workInProgress), prevSibling = readContext(prevSibling), returnFiber = callComponentInDEV(returnFiber, prevSibling, void 0), workInProgress.flags |= 1, reconcileChildren(current, workInProgress, returnFiber, renderLanes), workInProgress.child; case 14: return updateMemoComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, renderLanes); case 15: return updateSimpleMemoComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, renderLanes); case 19: return updateSuspenseListComponent(current, workInProgress, renderLanes); case 31: return updateActivityComponent(current, workInProgress, renderLanes); case 22: return updateOffscreenComponent(current, workInProgress, renderLanes, workInProgress.pendingProps); case 24: return prepareToReadContext(workInProgress), returnFiber = readContext(CacheContext), null === current ? (prevSibling = peekCacheFromPool(), null === prevSibling && (prevSibling = workInProgressRoot, nextProps = createCache(), prevSibling.pooledCache = nextProps, retainCache(nextProps), null !== nextProps && (prevSibling.pooledCacheLanes |= renderLanes), prevSibling = nextProps), workInProgress.memoizedState = { parent: returnFiber, cache: prevSibling }, initializeUpdateQueue(workInProgress), pushProvider(workInProgress, CacheContext, prevSibling)) : (0 !== (current.lanes & renderLanes) && (cloneUpdateQueue(current, workInProgress), processUpdateQueue(workInProgress, null, null, renderLanes), suspendIfUpdateReadFromEntangledAsyncAction()), prevSibling = current.memoizedState, nextProps = workInProgress.memoizedState, prevSibling.parent !== returnFiber ? (prevSibling = { parent: returnFiber, cache: returnFiber }, workInProgress.memoizedState = prevSibling, 0 === workInProgress.lanes && (workInProgress.memoizedState = workInProgress.updateQueue.baseState = prevSibling), pushProvider(workInProgress, CacheContext, returnFiber)) : (returnFiber = nextProps.cache, pushProvider(workInProgress, CacheContext, returnFiber), returnFiber !== prevSibling.cache && propagateContextChanges(workInProgress, [CacheContext], renderLanes, !0))), reconcileChildren(current, workInProgress, workInProgress.pendingProps.children, renderLanes), workInProgress.child; case 30: return null === workInProgress.stateNode && (workInProgress.stateNode = { autoName: null, paired: null, clones: null, ref: null }), returnFiber = workInProgress.pendingProps, null != returnFiber.name && "auto" !== returnFiber.name ? workInProgress.flags |= null === current ? 18882560 : 18874368 : isHydrating && pushMaterializedTreeId(workInProgress), void 0 !== returnFiber.className && (prevSibling = "string" === typeof returnFiber.className ? JSON.stringify(returnFiber.className) : "{...}", didWarnAboutClassNameOnViewTransition[prevSibling] || (didWarnAboutClassNameOnViewTransition[prevSibling] = !0, console.error(" doesn't accept a \"className\" prop. It has been renamed to \"default\".\n- \n+ ", prevSibling, prevSibling))), null !== current && current.memoizedProps.name !== returnFiber.name ? workInProgress.flags |= 4194816 : markRef(current, workInProgress), reconcileChildren(current, workInProgress, returnFiber.children, renderLanes), workInProgress.child; case 29: throw workInProgress.pendingProps; } throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."); } function markUpdate(workInProgress) { workInProgress.flags |= 4; } function markCloned(workInProgress) { supportsPersistence && (workInProgress.flags |= 8); } function doesRequireClone(current, completedWork) { if (null !== current && current.child === completedWork.child) return !1; if (0 !== (completedWork.flags & 16)) return !0; for (current = completedWork.child; null !== current;) { if (0 !== (current.flags & 8218) || 0 !== (current.subtreeFlags & 8218)) return !0; current = current.sibling; } return !1; } function appendAllChildren(parent, workInProgress, needsVisibilityToggle, isHidden) { if (supportsMutation) for (needsVisibilityToggle = workInProgress.child; null !== needsVisibilityToggle;) { if (5 === needsVisibilityToggle.tag || 6 === needsVisibilityToggle.tag) appendInitialChild(parent, needsVisibilityToggle.stateNode); else if (!(4 === needsVisibilityToggle.tag || supportsSingletons && 27 === needsVisibilityToggle.tag) && null !== needsVisibilityToggle.child) { needsVisibilityToggle.child.return = needsVisibilityToggle; needsVisibilityToggle = needsVisibilityToggle.child; continue; } if (needsVisibilityToggle === workInProgress) break; for (; null === needsVisibilityToggle.sibling;) { if (null === needsVisibilityToggle.return || needsVisibilityToggle.return === workInProgress) return; needsVisibilityToggle = needsVisibilityToggle.return; } needsVisibilityToggle.sibling.return = needsVisibilityToggle.return; needsVisibilityToggle = needsVisibilityToggle.sibling; } else if (supportsPersistence) for (var _node = workInProgress.child; null !== _node;) { if (5 === _node.tag) { var instance = _node.stateNode; needsVisibilityToggle && isHidden && (instance = cloneHiddenInstance(instance, _node.type, _node.memoizedProps)); appendInitialChild(parent, instance); } else if (6 === _node.tag) instance = _node.stateNode, needsVisibilityToggle && isHidden && (instance = cloneHiddenTextInstance(instance, _node.memoizedProps)), appendInitialChild(parent, instance); else if (4 !== _node.tag) { if (22 === _node.tag && null !== _node.memoizedState) instance = _node.child, null !== instance && (instance.return = _node), appendAllChildren(parent, _node, !0, !0); else if (null !== _node.child) { _node.child.return = _node; _node = _node.child; continue; } } if (_node === workInProgress) break; for (; null === _node.sibling;) { if (null === _node.return || _node.return === workInProgress) return; _node = _node.return; } _node.sibling.return = _node.return; _node = _node.sibling; } } function appendAllChildrenToContainer(containerChildSet, workInProgress, needsVisibilityToggle, isHidden) { var hasOffscreenComponentChild = !1; if (supportsPersistence) for (var node = workInProgress.child; null !== node;) { if (5 === node.tag) { var instance = node.stateNode; needsVisibilityToggle && isHidden && (instance = cloneHiddenInstance(instance, node.type, node.memoizedProps)); appendChildToContainerChildSet(containerChildSet, instance); } else if (6 === node.tag) instance = node.stateNode, needsVisibilityToggle && isHidden && (instance = cloneHiddenTextInstance(instance, node.memoizedProps)), appendChildToContainerChildSet(containerChildSet, instance); else if (4 !== node.tag) { if (22 === node.tag && null !== node.memoizedState) hasOffscreenComponentChild = node.child, null !== hasOffscreenComponentChild && (hasOffscreenComponentChild.return = node), appendAllChildrenToContainer(containerChildSet, node, !0, !0), hasOffscreenComponentChild = !0; else if (null !== node.child) { node.child.return = node; node = node.child; continue; } } if (node === workInProgress) break; for (; null === node.sibling;) { if (null === node.return || node.return === workInProgress) return hasOffscreenComponentChild; node = node.return; } node.sibling.return = node.return; node = node.sibling; } return hasOffscreenComponentChild; } function updateHostContainer(current, workInProgress) { if (supportsPersistence && doesRequireClone(current, workInProgress)) { current = workInProgress.stateNode; var container = current.containerInfo, newChildSet = createContainerChildSet(); appendAllChildrenToContainer(newChildSet, workInProgress, !1, !1); current.pendingChildren = newChildSet; markUpdate(workInProgress); finalizeContainerChildren(container, newChildSet); } } function updateHostComponent(current, workInProgress, type, newProps) { if (supportsMutation) current.memoizedProps !== newProps && markUpdate(workInProgress); else if (supportsPersistence) { var currentInstance = current.stateNode, _oldProps = current.memoizedProps; if ((current = doesRequireClone(current, workInProgress)) || _oldProps !== newProps) { var currentHostContext = getHostContext(); _oldProps = cloneInstance(currentInstance, type, _oldProps, newProps, !current, null); _oldProps === currentInstance ? workInProgress.stateNode = currentInstance : (markCloned(workInProgress), finalizeInitialChildren(_oldProps, type, newProps, currentHostContext) && markUpdate(workInProgress), workInProgress.stateNode = _oldProps, current && appendAllChildren(_oldProps, workInProgress, !1, !1)); } else workInProgress.stateNode = currentInstance; } } function preloadInstanceAndSuspendIfNeeded(workInProgress, type, oldProps, newProps, renderLanes) { if ((workInProgress.mode & 32) !== NoMode && (null === oldProps ? maySuspendCommit(type, newProps) : maySuspendCommitOnUpdate(type, oldProps, newProps))) { if (workInProgress.flags |= 16777216, (renderLanes & 335544128) === renderLanes || maySuspendCommitInSyncRender(type, newProps)) if (preloadInstance(workInProgress.stateNode, type, newProps)) workInProgress.flags |= 8192; else if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; else throw suspendedThenable = noopSuspenseyCommitThenable, SuspenseyCommitException; } else workInProgress.flags &= -16777217; } function preloadResourceAndSuspendIfNeeded(workInProgress, resource) { if (mayResourceSuspendCommit(resource)) { if (workInProgress.flags |= 16777216, !preloadResource(resource)) if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; else throw suspendedThenable = noopSuspenseyCommitThenable, SuspenseyCommitException; } else workInProgress.flags &= -16777217; } function scheduleRetryEffect(workInProgress, retryQueue) { null !== retryQueue && (workInProgress.flags |= 4); workInProgress.flags & 16384 && (retryQueue = 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912, workInProgress.lanes |= retryQueue, workInProgressSuspendedRetryLanes |= retryQueue); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { if (!isHydrating) switch (renderState.tailMode) { case "visible": break; case "collapsed": for (var tailNode = renderState.tail, lastTailNode = null; null !== tailNode;) null !== tailNode.alternate && (lastTailNode = tailNode), tailNode = tailNode.sibling; null === lastTailNode ? hasRenderedATailFallback || null === renderState.tail ? renderState.tail = null : renderState.tail.sibling = null : lastTailNode.sibling = null; break; default: hasRenderedATailFallback = renderState.tail; for (tailNode = null; null !== hasRenderedATailFallback;) null !== hasRenderedATailFallback.alternate && (tailNode = hasRenderedATailFallback), hasRenderedATailFallback = hasRenderedATailFallback.sibling; null === tailNode ? renderState.tail = null : tailNode.sibling = null; } } function bubbleProperties(completedWork) { var didBailout = null !== completedWork.alternate && completedWork.alternate.child === completedWork.child, newChildLanes = 0, subtreeFlags = 0; if (didBailout) if ((completedWork.mode & 2) !== NoMode) { for (var _treeBaseDuration = completedWork.selfBaseDuration, _child2 = completedWork.child; null !== _child2;) newChildLanes |= _child2.lanes | _child2.childLanes, subtreeFlags |= _child2.subtreeFlags & 1206910976, subtreeFlags |= _child2.flags & 1206910976, _treeBaseDuration += _child2.treeBaseDuration, _child2 = _child2.sibling; completedWork.treeBaseDuration = _treeBaseDuration; } else for (_treeBaseDuration = completedWork.child; null !== _treeBaseDuration;) newChildLanes |= _treeBaseDuration.lanes | _treeBaseDuration.childLanes, subtreeFlags |= _treeBaseDuration.subtreeFlags & 1206910976, subtreeFlags |= _treeBaseDuration.flags & 1206910976, _treeBaseDuration.return = completedWork, _treeBaseDuration = _treeBaseDuration.sibling; else if ((completedWork.mode & 2) !== NoMode) { _treeBaseDuration = completedWork.actualDuration; _child2 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child;) newChildLanes |= child.lanes | child.childLanes, subtreeFlags |= child.subtreeFlags, subtreeFlags |= child.flags, _treeBaseDuration += child.actualDuration, _child2 += child.treeBaseDuration, child = child.sibling; completedWork.actualDuration = _treeBaseDuration; completedWork.treeBaseDuration = _child2; } else for (_treeBaseDuration = completedWork.child; null !== _treeBaseDuration;) newChildLanes |= _treeBaseDuration.lanes | _treeBaseDuration.childLanes, subtreeFlags |= _treeBaseDuration.subtreeFlags, subtreeFlags |= _treeBaseDuration.flags, _treeBaseDuration.return = completedWork, _treeBaseDuration = _treeBaseDuration.sibling; completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; } function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; popTreeContext(workInProgress); switch (workInProgress.tag) { case 16: case 15: case 0: case 11: case 7: case 8: case 12: case 9: case 14: return bubbleProperties(workInProgress), null; case 1: return bubbleProperties(workInProgress), null; case 3: renderLanes = workInProgress.stateNode; newProps = null; null !== current && (newProps = current.memoizedState.cache); workInProgress.memoizedState.cache !== newProps && (workInProgress.flags |= 2048); popProvider(CacheContext, workInProgress); popHostContainer(workInProgress); renderLanes.pendingContext && (renderLanes.context = renderLanes.pendingContext, renderLanes.pendingContext = null); if (null === current || null === current.child) popHydrationState(workInProgress) ? (emitPendingHydrationWarnings(), markUpdate(workInProgress)) : null === current || current.memoizedState.isDehydrated && 0 === (workInProgress.flags & 256) || (workInProgress.flags |= 1024, upgradeHydrationErrorsToRecoverable()); updateHostContainer(current, workInProgress); bubbleProperties(workInProgress); return null; case 26: if (supportsResources) { var type = workInProgress.type, nextResource = workInProgress.memoizedState; null === current ? (markUpdate(workInProgress), null !== nextResource ? (bubbleProperties(workInProgress), preloadResourceAndSuspendIfNeeded(workInProgress, nextResource)) : (bubbleProperties(workInProgress), preloadInstanceAndSuspendIfNeeded(workInProgress, type, null, newProps, renderLanes))) : nextResource ? nextResource !== current.memoizedState ? (markUpdate(workInProgress), bubbleProperties(workInProgress), preloadResourceAndSuspendIfNeeded(workInProgress, nextResource)) : (bubbleProperties(workInProgress), workInProgress.flags &= -16777217) : (nextResource = current.memoizedProps, supportsMutation ? nextResource !== newProps && markUpdate(workInProgress) : updateHostComponent(current, workInProgress, type, newProps), bubbleProperties(workInProgress), preloadInstanceAndSuspendIfNeeded(workInProgress, type, nextResource, newProps, renderLanes)); return null; } case 27: if (supportsSingletons) { popHostContext(workInProgress); renderLanes = requiredContext(rootInstanceStackCursor.current); type = workInProgress.type; if (null !== current && null != workInProgress.stateNode) supportsMutation ? current.memoizedProps !== newProps && markUpdate(workInProgress) : updateHostComponent(current, workInProgress, type, newProps); else { if (!newProps) { if (null === workInProgress.stateNode) throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue."); bubbleProperties(workInProgress); workInProgress.subtreeFlags &= -33554433; return null; } current = getHostContext(); popHydrationState(workInProgress) ? prepareToHydrateHostInstance(workInProgress, current) : (current = resolveSingletonInstance(type, newProps, renderLanes, current, !0), workInProgress.stateNode = current, markUpdate(workInProgress)); } bubbleProperties(workInProgress); workInProgress.subtreeFlags &= -33554433; return null; } case 5: popHostContext(workInProgress); type = workInProgress.type; if (null !== current && null != workInProgress.stateNode) updateHostComponent(current, workInProgress, type, newProps); else { if (!newProps) { if (null === workInProgress.stateNode) throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue."); bubbleProperties(workInProgress); workInProgress.subtreeFlags &= -33554433; return null; } nextResource = getHostContext(); if (popHydrationState(workInProgress)) prepareToHydrateHostInstance(workInProgress, nextResource), finalizeHydratedChildren(workInProgress.stateNode, type, newProps, nextResource) && (workInProgress.flags |= 64); else { var _rootContainerInstance = requiredContext(rootInstanceStackCursor.current); _rootContainerInstance = createInstance(type, newProps, _rootContainerInstance, nextResource, workInProgress); markCloned(workInProgress); appendAllChildren(_rootContainerInstance, workInProgress, !1, !1); workInProgress.stateNode = _rootContainerInstance; finalizeInitialChildren(_rootContainerInstance, type, newProps, nextResource) && markUpdate(workInProgress); } } bubbleProperties(workInProgress); workInProgress.subtreeFlags &= -33554433; preloadInstanceAndSuspendIfNeeded(workInProgress, workInProgress.type, null === current ? null : current.memoizedProps, workInProgress.pendingProps, renderLanes); return null; case 6: if (current && null != workInProgress.stateNode) renderLanes = current.memoizedProps, supportsMutation ? renderLanes !== newProps && markUpdate(workInProgress) : supportsPersistence && (renderLanes !== newProps ? (current = requiredContext(rootInstanceStackCursor.current), renderLanes = getHostContext(), markCloned(workInProgress), workInProgress.stateNode = createTextInstance(newProps, current, renderLanes, workInProgress)) : workInProgress.stateNode = current.stateNode); else { if ("string" !== typeof newProps && null === workInProgress.stateNode) throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue."); current = requiredContext(rootInstanceStackCursor.current); renderLanes = getHostContext(); if (popHydrationState(workInProgress)) { if (!supportsHydration) throw Error("Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."); current = workInProgress.stateNode; renderLanes = workInProgress.memoizedProps; type = !didSuspendOrErrorDEV; newProps = null; nextResource = hydrationParentFiber; if (null !== nextResource) switch (nextResource.tag) { case 3: type && (type = diffHydratedTextForDevWarnings(current, renderLanes, newProps), null !== type && (buildHydrationDiffNode(workInProgress, 0).serverProps = type)); break; case 27: case 5: newProps = nextResource.memoizedProps, type && (type = diffHydratedTextForDevWarnings(current, renderLanes, newProps), null !== type && (buildHydrationDiffNode(workInProgress, 0).serverProps = type)); } hydrateTextInstance(current, renderLanes, workInProgress, newProps) || throwOnHydrationMismatch(workInProgress, !0); } else markCloned(workInProgress), workInProgress.stateNode = createTextInstance(newProps, current, renderLanes, workInProgress); } bubbleProperties(workInProgress); return null; case 31: renderLanes = workInProgress.memoizedState; if (null === current || null !== current.memoizedState) { newProps = popHydrationState(workInProgress); if (null !== renderLanes) { if (null === current) { if (!newProps) throw Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React."); if (!supportsHydration) throw Error("Expected prepareToHydrateHostActivityInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."); current = workInProgress.memoizedState; current = null !== current ? current.dehydrated : null; if (!current) throw Error("Expected to have a hydrated activity instance. This error is likely caused by a bug in React. Please file an issue."); hydrateActivityInstance(current, workInProgress); bubbleProperties(workInProgress); (workInProgress.mode & 2) !== NoMode && null !== renderLanes && (current = workInProgress.child, null !== current && (workInProgress.treeBaseDuration -= current.treeBaseDuration)); } else emitPendingHydrationWarnings(), resetHydrationState(), 0 === (workInProgress.flags & 128) && (renderLanes = workInProgress.memoizedState = null), workInProgress.flags |= 4, bubbleProperties(workInProgress), (workInProgress.mode & 2) !== NoMode && null !== renderLanes && (current = workInProgress.child, null !== current && (workInProgress.treeBaseDuration -= current.treeBaseDuration)); current = !1; } else renderLanes = upgradeHydrationErrorsToRecoverable(), null !== current && null !== current.memoizedState && (current.memoizedState.hydrationErrors = renderLanes), current = !0; if (!current) { if (workInProgress.flags & 256) return popSuspenseHandler(workInProgress), workInProgress; popSuspenseHandler(workInProgress); return null; } if (0 !== (workInProgress.flags & 128)) throw Error("Client rendering an Activity suspended it again. This is a bug in React."); } bubbleProperties(workInProgress); return null; case 13: newProps = workInProgress.memoizedState; if (null === current || null !== current.memoizedState && null !== current.memoizedState.dehydrated) { type = newProps; nextResource = popHydrationState(workInProgress); if (null !== type && null !== type.dehydrated) { if (null === current) { if (!nextResource) throw Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React."); if (!supportsHydration) throw Error("Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."); nextResource = workInProgress.memoizedState; nextResource = null !== nextResource ? nextResource.dehydrated : null; if (!nextResource) throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."); hydrateSuspenseInstance(nextResource, workInProgress); bubbleProperties(workInProgress); (workInProgress.mode & 2) !== NoMode && null !== type && (type = workInProgress.child, null !== type && (workInProgress.treeBaseDuration -= type.treeBaseDuration)); } else emitPendingHydrationWarnings(), resetHydrationState(), 0 === (workInProgress.flags & 128) && (type = workInProgress.memoizedState = null), workInProgress.flags |= 4, bubbleProperties(workInProgress), (workInProgress.mode & 2) !== NoMode && null !== type && (type = workInProgress.child, null !== type && (workInProgress.treeBaseDuration -= type.treeBaseDuration)); type = !1; } else type = upgradeHydrationErrorsToRecoverable(), null !== current && null !== current.memoizedState && (current.memoizedState.hydrationErrors = type), type = !0; if (!type) { if (workInProgress.flags & 256) return popSuspenseHandler(workInProgress), workInProgress; popSuspenseHandler(workInProgress); return null; } } popSuspenseHandler(workInProgress); if (0 !== (workInProgress.flags & 128)) return workInProgress.lanes = renderLanes, (workInProgress.mode & 2) !== NoMode && transferActualDuration(workInProgress), workInProgress; renderLanes = null !== newProps; current = null !== current && null !== current.memoizedState; renderLanes && (newProps = workInProgress.child, type = null, null !== newProps.alternate && null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (type = newProps.alternate.memoizedState.cachePool.pool), nextResource = null, null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && (nextResource = newProps.memoizedState.cachePool.pool), nextResource !== type && (newProps.flags |= 2048)); renderLanes !== current && renderLanes && (workInProgress.child.flags |= 8192); scheduleRetryEffect(workInProgress, workInProgress.updateQueue); bubbleProperties(workInProgress); (workInProgress.mode & 2) !== NoMode && renderLanes && (current = workInProgress.child, null !== current && (workInProgress.treeBaseDuration -= current.treeBaseDuration)); return null; case 4: return popHostContainer(workInProgress), updateHostContainer(current, workInProgress), null === current && preparePortalMount(workInProgress.stateNode.containerInfo), workInProgress.flags |= 67108864, bubbleProperties(workInProgress), null; case 10: return popProvider(workInProgress.type, workInProgress), bubbleProperties(workInProgress), null; case 19: popSuspenseListContext(workInProgress); newProps = workInProgress.memoizedState; if (null === newProps) return bubbleProperties(workInProgress), null; type = 0 !== (workInProgress.flags & 128); nextResource = newProps.rendering; if (null === nextResource) if (type) cutOffTailIfNeeded(newProps, !1); else { if (workInProgressRootExitStatus !== RootInProgress || null !== current && 0 !== (current.flags & 128)) for (current = workInProgress.child; null !== current;) { nextResource = findFirstSuspended(current); if (null !== nextResource) { workInProgress.flags |= 128; cutOffTailIfNeeded(newProps, !1); current = nextResource.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; current = renderLanes; for (renderLanes = workInProgress.child; null !== renderLanes;) resetWorkInProgress(renderLanes, current), renderLanes = renderLanes.sibling; pushSuspenseListContext(workInProgress, suspenseStackCursor.current & SubtreeSuspenseContextMask | ForceSuspenseFallback); isHydrating && pushTreeFork(workInProgress, newProps.treeForkCount); return workInProgress.child; } current = current.sibling; } null !== newProps.tail && now$1() > workInProgressRootRenderTargetTime && (workInProgress.flags |= 128, type = !0, cutOffTailIfNeeded(newProps, !1), workInProgress.lanes = 4194304); } else { if (!type) if (current = findFirstSuspended(nextResource), null !== current) { if (workInProgress.flags |= 128, type = !0, current = current.updateQueue, workInProgress.updateQueue = current, scheduleRetryEffect(workInProgress, current), cutOffTailIfNeeded(newProps, !0), null === newProps.tail && "collapsed" !== newProps.tailMode && "visible" !== newProps.tailMode && !nextResource.alternate && !isHydrating) return bubbleProperties(workInProgress), null; } else 2 * now$1() - newProps.renderingStartTime > workInProgressRootRenderTargetTime && 536870912 !== renderLanes && (workInProgress.flags |= 128, type = !0, cutOffTailIfNeeded(newProps, !1), workInProgress.lanes = 4194304); newProps.isBackwards ? (nextResource.sibling = workInProgress.child, workInProgress.child = nextResource) : (current = newProps.last, null !== current ? current.sibling = nextResource : workInProgress.child = nextResource, newProps.last = nextResource); } if (null !== newProps.tail) { current = newProps.tail; a: { for (renderLanes = current; null !== renderLanes;) { if (null !== renderLanes.alternate) { renderLanes = !1; break a; } renderLanes = renderLanes.sibling; } renderLanes = !0; } newProps.rendering = current; newProps.tail = current.sibling; newProps.renderingStartTime = now$1(); current.sibling = null; nextResource = suspenseStackCursor.current; nextResource = type ? nextResource & SubtreeSuspenseContextMask | ForceSuspenseFallback : nextResource & SubtreeSuspenseContextMask; "visible" === newProps.tailMode || "collapsed" === newProps.tailMode || !renderLanes || isHydrating ? pushSuspenseListContext(workInProgress, nextResource) : (renderLanes = nextResource, push(suspenseHandlerStackCursor, workInProgress, workInProgress), push(suspenseStackCursor, renderLanes, workInProgress), null === shellBoundary && (shellBoundary = workInProgress)); isHydrating && pushTreeFork(workInProgress, newProps.treeForkCount); return current; } bubbleProperties(workInProgress); return null; case 22: case 23: return popSuspenseHandler(workInProgress), popHiddenContext(workInProgress), newProps = null !== workInProgress.memoizedState, null !== current ? null !== current.memoizedState !== newProps && (workInProgress.flags |= 8192) : newProps && (workInProgress.flags |= 8192), newProps ? 0 !== (renderLanes & 536870912) && 0 === (workInProgress.flags & 128) && (bubbleProperties(workInProgress), workInProgress.subtreeFlags & 6 && (workInProgress.flags |= 8192)) : bubbleProperties(workInProgress), renderLanes = workInProgress.updateQueue, null !== renderLanes && scheduleRetryEffect(workInProgress, renderLanes.retryQueue), renderLanes = null, null !== current && null !== current.memoizedState && null !== current.memoizedState.cachePool && (renderLanes = current.memoizedState.cachePool.pool), newProps = null, null !== workInProgress.memoizedState && null !== workInProgress.memoizedState.cachePool && (newProps = workInProgress.memoizedState.cachePool.pool), newProps !== renderLanes && (workInProgress.flags |= 2048), null !== current && pop(resumedCache, workInProgress), null; case 24: return renderLanes = null, null !== current && (renderLanes = current.memoizedState.cache), workInProgress.memoizedState.cache !== renderLanes && (workInProgress.flags |= 2048), popProvider(CacheContext, workInProgress), bubbleProperties(workInProgress), null; case 25: return null; case 30: return workInProgress.flags |= 33554432, bubbleProperties(workInProgress), null; } throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."); } function unwindWork(current, workInProgress) { popTreeContext(workInProgress); switch (workInProgress.tag) { case 1: return current = workInProgress.flags, current & 65536 ? (workInProgress.flags = current & -65537 | 128, (workInProgress.mode & 2) !== NoMode && transferActualDuration(workInProgress), workInProgress) : null; case 3: return popProvider(CacheContext, workInProgress), popHostContainer(workInProgress), current = workInProgress.flags, 0 !== (current & 65536) && 0 === (current & 128) ? (workInProgress.flags = current & -65537 | 128, workInProgress) : null; case 26: case 27: case 5: return popHostContext(workInProgress), null; case 31: if (null !== workInProgress.memoizedState) { popSuspenseHandler(workInProgress); if (null === workInProgress.alternate) throw Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue."); resetHydrationState(); } current = workInProgress.flags; return current & 65536 ? (workInProgress.flags = current & -65537 | 128, (workInProgress.mode & 2) !== NoMode && transferActualDuration(workInProgress), workInProgress) : null; case 13: popSuspenseHandler(workInProgress); current = workInProgress.memoizedState; if (null !== current && null !== current.dehydrated) { if (null === workInProgress.alternate) throw Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue."); resetHydrationState(); } current = workInProgress.flags; return current & 65536 ? (workInProgress.flags = current & -65537 | 128, (workInProgress.mode & 2) !== NoMode && transferActualDuration(workInProgress), workInProgress) : null; case 19: return popSuspenseListContext(workInProgress), current = workInProgress.flags, current & 65536 ? (workInProgress.flags = current & -65537 | 128, current = workInProgress.memoizedState, null !== current && (current.rendering = null, current.tail = null), workInProgress.flags |= 4, workInProgress) : null; case 4: return popHostContainer(workInProgress), null; case 10: return popProvider(workInProgress.type, workInProgress), null; case 22: case 23: return popSuspenseHandler(workInProgress), popHiddenContext(workInProgress), null !== current && pop(resumedCache, workInProgress), current = workInProgress.flags, current & 65536 ? (workInProgress.flags = current & -65537 | 128, (workInProgress.mode & 2) !== NoMode && transferActualDuration(workInProgress), workInProgress) : null; case 24: return popProvider(CacheContext, workInProgress), null; case 25: return null; default: return null; } } function unwindInterruptedWork(current, interruptedWork) { popTreeContext(interruptedWork); switch (interruptedWork.tag) { case 3: popProvider(CacheContext, interruptedWork); popHostContainer(interruptedWork); break; case 26: case 27: case 5: popHostContext(interruptedWork); break; case 4: popHostContainer(interruptedWork); break; case 31: null !== interruptedWork.memoizedState && popSuspenseHandler(interruptedWork); break; case 13: popSuspenseHandler(interruptedWork); break; case 19: popSuspenseListContext(interruptedWork); break; case 10: popProvider(interruptedWork.type, interruptedWork); break; case 22: case 23: popSuspenseHandler(interruptedWork); popHiddenContext(interruptedWork); null !== current && pop(resumedCache, interruptedWork); break; case 24: popProvider(CacheContext, interruptedWork); } } function shouldProfile(current) { return (current.mode & 2) !== NoMode; } function commitHookLayoutEffects(finishedWork, hookFlags) { shouldProfile(finishedWork) ? (startEffectTimer(), commitHookEffectListMount(hookFlags, finishedWork), recordEffectDuration()) : commitHookEffectListMount(hookFlags, finishedWork); } function commitHookLayoutUnmountEffects(finishedWork, nearestMountedAncestor, hookFlags) { shouldProfile(finishedWork) ? (startEffectTimer(), commitHookEffectListUnmount(hookFlags, finishedWork, nearestMountedAncestor), recordEffectDuration()) : commitHookEffectListUnmount(hookFlags, finishedWork, nearestMountedAncestor); } function commitHookEffectListMount(flags, finishedWork) { try { var updateQueue = finishedWork.updateQueue, lastEffect = null !== updateQueue ? updateQueue.lastEffect : null; if (null !== lastEffect) { var firstEffect = lastEffect.next; updateQueue = firstEffect; do { if ((updateQueue.tag & flags) === flags && (lastEffect = void 0, (flags & Insertion) !== NoFlags && (isRunningInsertionEffect = !0), lastEffect = runWithFiberInDEV(finishedWork, callCreateInDEV, updateQueue), (flags & Insertion) !== NoFlags && (isRunningInsertionEffect = !1), void 0 !== lastEffect && "function" !== typeof lastEffect)) { var hookName = void 0; hookName = 0 !== (updateQueue.tag & Layout) ? "useLayoutEffect" : 0 !== (updateQueue.tag & Insertion) ? "useInsertionEffect" : "useEffect"; var addendum = void 0; addendum = null === lastEffect ? " You returned null. If your effect does not require clean up, return undefined (or nothing)." : "function" === typeof lastEffect.then ? "\n\nIt looks like you wrote " + hookName + "(async () => ...) or returned a Promise. Instead, write the async function inside your effect and call it immediately:\n\n" + hookName + "(() => {\n async function fetchData() {\n // You can await here\n const response = await MyAPI.getData(someId);\n // ...\n }\n fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://react.dev/link/hooks-data-fetching" : " You returned: " + lastEffect; runWithFiberInDEV(finishedWork, function(n, a) { console.error("%s must not return anything besides a function, which is used for clean-up.%s", n, a); }, hookName, addendum); } updateQueue = updateQueue.next; } while (updateQueue !== firstEffect); } } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } function commitHookEffectListUnmount(flags, finishedWork, nearestMountedAncestor) { try { var updateQueue = finishedWork.updateQueue, lastEffect = null !== updateQueue ? updateQueue.lastEffect : null; if (null !== lastEffect) { var firstEffect = lastEffect.next; updateQueue = firstEffect; do { if ((updateQueue.tag & flags) === flags) { var inst = updateQueue.inst, destroy = inst.destroy; void 0 !== destroy && (inst.destroy = void 0, (flags & Insertion) !== NoFlags && (isRunningInsertionEffect = !0), lastEffect = finishedWork, runWithFiberInDEV(lastEffect, callDestroyInDEV, lastEffect, nearestMountedAncestor, destroy), (flags & Insertion) !== NoFlags && (isRunningInsertionEffect = !1)); } updateQueue = updateQueue.next; } while (updateQueue !== firstEffect); } } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } function commitHookPassiveMountEffects(finishedWork, hookFlags) { shouldProfile(finishedWork) ? (startEffectTimer(), commitHookEffectListMount(hookFlags, finishedWork), recordEffectDuration()) : commitHookEffectListMount(hookFlags, finishedWork); } function commitHookPassiveUnmountEffects(finishedWork, nearestMountedAncestor, hookFlags) { shouldProfile(finishedWork) ? (startEffectTimer(), commitHookEffectListUnmount(hookFlags, finishedWork, nearestMountedAncestor), recordEffectDuration()) : commitHookEffectListUnmount(hookFlags, finishedWork, nearestMountedAncestor); } function commitClassCallbacks(finishedWork) { var updateQueue = finishedWork.updateQueue; if (null !== updateQueue) { var instance = finishedWork.stateNode; finishedWork.type.defaultProps || "ref" in finishedWork.memoizedProps || didWarnAboutReassigningProps || (instance.props !== finishedWork.memoizedProps && console.error("Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance"), instance.state !== finishedWork.memoizedState && console.error("Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance")); try { runWithFiberInDEV(finishedWork, commitCallbacks, updateQueue, instance); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } } function callGetSnapshotBeforeUpdates(instance, prevProps, prevState) { return instance.getSnapshotBeforeUpdate(prevProps, prevState); } function commitClassSnapshot(finishedWork, current) { var prevProps = current.memoizedProps, prevState = current.memoizedState; current = finishedWork.stateNode; finishedWork.type.defaultProps || "ref" in finishedWork.memoizedProps || didWarnAboutReassigningProps || (current.props !== finishedWork.memoizedProps && console.error("Expected %s props to match memoized props before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance"), current.state !== finishedWork.memoizedState && console.error("Expected %s state to match memoized state before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance")); try { var resolvedPrevProps = resolveClassComponentProps(finishedWork.type, prevProps); var snapshot = runWithFiberInDEV(finishedWork, callGetSnapshotBeforeUpdates, current, resolvedPrevProps, prevState); prevProps = didWarnAboutUndefinedSnapshotBeforeUpdate; void 0 !== snapshot || prevProps.has(finishedWork.type) || (prevProps.add(finishedWork.type), runWithFiberInDEV(finishedWork, function() { console.error("%s.getSnapshotBeforeUpdate(): A snapshot value (or null) must be returned. You have returned undefined.", getComponentNameFromFiber(finishedWork)); })); current.__reactInternalSnapshotBeforeUpdate = snapshot; } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } function safelyCallComponentWillUnmount(current, nearestMountedAncestor, instance) { instance.props = resolveClassComponentProps(current.type, current.memoizedProps); instance.state = current.memoizedState; shouldProfile(current) ? (startEffectTimer(), runWithFiberInDEV(current, callComponentWillUnmountInDEV, current, nearestMountedAncestor, instance), recordEffectDuration()) : runWithFiberInDEV(current, callComponentWillUnmountInDEV, current, nearestMountedAncestor, instance); } function commitAttachRef(finishedWork) { var ref = finishedWork.ref; if (null !== ref) { switch (finishedWork.tag) { case 26: case 27: case 5: var instanceToUse = getPublicInstance(finishedWork.stateNode); break; case 30: instanceToUse = finishedWork.stateNode; var name = getViewTransitionName(finishedWork.memoizedProps, instanceToUse); if (null === instanceToUse.ref || instanceToUse.ref.name !== name) instanceToUse.ref = createViewTransitionInstance(name); instanceToUse = instanceToUse.ref; break; case 7: null === finishedWork.stateNode && (finishedWork.stateNode = createFragmentInstance(finishedWork)); instanceToUse = finishedWork.stateNode; break; default: instanceToUse = finishedWork.stateNode; } if ("function" === typeof ref) if (shouldProfile(finishedWork)) try { startEffectTimer(), finishedWork.refCleanup = ref(instanceToUse); } finally { recordEffectDuration(); } else finishedWork.refCleanup = ref(instanceToUse); else "string" === typeof ref ? console.error("String refs are no longer supported.") : ref.hasOwnProperty("current") || console.error("Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().", getComponentNameFromFiber(finishedWork)), ref.current = instanceToUse; } } function safelyAttachRef(current, nearestMountedAncestor) { try { runWithFiberInDEV(current, commitAttachRef, current); } catch (error) { captureCommitPhaseError(current, nearestMountedAncestor, error); } } function safelyDetachRef(current, nearestMountedAncestor) { var ref = current.ref, refCleanup = current.refCleanup; if (null !== ref) if ("function" === typeof refCleanup) try { if (shouldProfile(current)) try { startEffectTimer(), runWithFiberInDEV(current, refCleanup); } finally { recordEffectDuration(current); } else runWithFiberInDEV(current, refCleanup); } catch (error) { captureCommitPhaseError(current, nearestMountedAncestor, error); } finally { current.refCleanup = null, current = current.alternate, null != current && (current.refCleanup = null); } else if ("function" === typeof ref) try { if (shouldProfile(current)) try { startEffectTimer(), runWithFiberInDEV(current, ref, null); } finally { recordEffectDuration(current); } else runWithFiberInDEV(current, ref, null); } catch (error$3) { captureCommitPhaseError(current, nearestMountedAncestor, error$3); } else ref.current = null; } function commitProfiler(finishedWork, current, commitStartTime, effectDuration) { var _finishedWork$memoize = finishedWork.memoizedProps, id = _finishedWork$memoize.id, onCommit = _finishedWork$memoize.onCommit; _finishedWork$memoize = _finishedWork$memoize.onRender; current = null === current ? "mount" : "update"; currentUpdateIsNested && (current = "nested-update"); "function" === typeof _finishedWork$memoize && _finishedWork$memoize(id, current, finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitStartTime); "function" === typeof onCommit && onCommit(id, current, effectDuration, commitStartTime); } function commitProfilerPostCommitImpl(finishedWork, current, commitStartTime, passiveEffectDuration) { var _finishedWork$memoize2 = finishedWork.memoizedProps; finishedWork = _finishedWork$memoize2.id; _finishedWork$memoize2 = _finishedWork$memoize2.onPostCommit; current = null === current ? "mount" : "update"; currentUpdateIsNested && (current = "nested-update"); "function" === typeof _finishedWork$memoize2 && _finishedWork$memoize2(finishedWork, current, passiveEffectDuration, commitStartTime); } function pushMutationContext() { var prev = viewTransitionMutationContext; viewTransitionMutationContext = !1; return prev; } function commitNewChildToFragmentInstances(fiber, parentFragmentInstances) { if ((5 === fiber.tag || 27 === fiber.tag || 6 === fiber.tag) && null === fiber.alternate && null !== parentFragmentInstances) for (var i = 0; i < parentFragmentInstances.length; i++) commitNewChildToFragmentInstance(fiber.stateNode, parentFragmentInstances[i]); } function commitFragmentInstanceInsertionEffects(fiber) { for (var parent = fiber.return; null !== parent;) { isFragmentInstanceParent(parent) && commitNewChildToFragmentInstance(fiber.stateNode, parent.stateNode); if (isFragmentInstanceHostBoundary(parent)) break; parent = parent.return; } } function commitFragmentInstanceDeletionEffects(fiber) { for (var parent = fiber.return; null !== parent;) { isFragmentInstanceParent(parent) && deleteChildFromFragmentInstance(fiber.stateNode, parent.stateNode); if (isFragmentInstanceHostBoundary(parent)) break; parent = parent.return; } } function isFragmentInstanceHostBoundary(fiber) { return 5 === fiber.tag || 3 === fiber.tag || (supportsSingletons ? 27 === fiber.tag : !1); } function isFragmentInstanceParent(fiber) { return fiber && 7 === fiber.tag && null !== fiber.stateNode; } function commitHostMount(finishedWork) { var type = finishedWork.type, props = finishedWork.memoizedProps, instance = finishedWork.stateNode; try { runWithFiberInDEV(finishedWork, commitMount, instance, type, props, finishedWork); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } function commitHostUpdate(finishedWork, newProps, oldProps) { try { runWithFiberInDEV(finishedWork, commitUpdate, finishedWork.stateNode, finishedWork.type, oldProps, newProps, finishedWork); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } function isHostParent(fiber) { return 5 === fiber.tag || 3 === fiber.tag || (supportsResources ? 26 === fiber.tag : !1) || (supportsSingletons ? 27 === fiber.tag && isSingletonScope(fiber.type) : !1) || 4 === fiber.tag; } function getHostSibling(fiber) { a: for (;;) { for (; null === fiber.sibling;) { if (null === fiber.return || isHostParent(fiber.return)) return null; fiber = fiber.return; } fiber.sibling.return = fiber.return; for (fiber = fiber.sibling; 5 !== fiber.tag && 6 !== fiber.tag && 18 !== fiber.tag;) { if (supportsSingletons && 27 === fiber.tag && isSingletonScope(fiber.type)) continue a; if (fiber.flags & 2) continue a; if (null === fiber.child || 4 === fiber.tag) continue a; else fiber.child.return = fiber, fiber = fiber.child; } if (!(fiber.flags & 2)) return fiber.stateNode; } } function insertOrAppendPlacementNodeIntoContainer(node, before, parent, parentFragmentInstances) { var tag = node.tag; if (5 === tag || 6 === tag) tag = node.stateNode, before ? insertInContainerBefore(parent, tag, before) : appendChildToContainer(parent, tag), commitNewChildToFragmentInstances(node, parentFragmentInstances), viewTransitionMutationContext = !0; else if (4 !== tag && (supportsSingletons && 27 === tag && (commitNewChildToFragmentInstances(node, parentFragmentInstances), parentFragmentInstances = null, isSingletonScope(node.type) && (parent = node.stateNode, before = null)), node = node.child, null !== node)) for (insertOrAppendPlacementNodeIntoContainer(node, before, parent, parentFragmentInstances), node = node.sibling; null !== node;) insertOrAppendPlacementNodeIntoContainer(node, before, parent, parentFragmentInstances), node = node.sibling; } function insertOrAppendPlacementNode(node, before, parent, parentFragmentInstances) { var tag = node.tag; if (5 === tag || 6 === tag) tag = node.stateNode, before ? insertBefore(parent, tag, before) : appendChild(parent, tag), commitNewChildToFragmentInstances(node, parentFragmentInstances), viewTransitionMutationContext = !0; else if (4 !== tag && (supportsSingletons && 27 === tag && (commitNewChildToFragmentInstances(node, parentFragmentInstances), parentFragmentInstances = null, isSingletonScope(node.type) && (parent = node.stateNode)), node = node.child, null !== node)) for (insertOrAppendPlacementNode(node, before, parent, parentFragmentInstances), node = node.sibling; null !== node;) insertOrAppendPlacementNode(node, before, parent, parentFragmentInstances), node = node.sibling; } function commitPlacement(finishedWork) { for (var hostParentFiber, parentFiber = finishedWork.return; null !== parentFiber;) { if (isHostParent(parentFiber)) { hostParentFiber = parentFiber; break; } parentFiber = parentFiber.return; } parentFiber = null; for (var parent = finishedWork.return; null !== parent;) { if (isFragmentInstanceParent(parent)) { var fragmentInstance = parent.stateNode; null === parentFiber ? parentFiber = [fragmentInstance] : parentFiber.push(fragmentInstance); } if (isFragmentInstanceHostBoundary(parent)) break; parent = parent.return; } if (supportsMutation) { if (null == hostParentFiber) throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."); switch (hostParentFiber.tag) { case 27: if (supportsSingletons) { hostParentFiber = hostParentFiber.stateNode; parent = getHostSibling(finishedWork); insertOrAppendPlacementNode(finishedWork, parent, hostParentFiber, parentFiber); break; } case 5: parent = hostParentFiber.stateNode; hostParentFiber.flags & 32 && (resetTextContent(parent), hostParentFiber.flags &= -33); hostParentFiber = getHostSibling(finishedWork); insertOrAppendPlacementNode(finishedWork, hostParentFiber, parent, parentFiber); break; case 3: case 4: hostParentFiber = hostParentFiber.stateNode.containerInfo; parent = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer(finishedWork, parent, hostParentFiber, parentFiber); break; default: throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue."); } } else commitImmutablePlacementNodeToFragmentInstances(finishedWork, parentFiber); } function commitImmutablePlacementNodeToFragmentInstances(finishedWork, parentFragmentInstances) { if (5 === finishedWork.tag || supportsSingletons && 27 === finishedWork.tag) commitNewChildToFragmentInstances(finishedWork, parentFragmentInstances); else if (4 !== finishedWork.tag && (finishedWork = finishedWork.child, null !== finishedWork)) for (commitImmutablePlacementNodeToFragmentInstances(finishedWork, parentFragmentInstances), finishedWork = finishedWork.sibling; null !== finishedWork;) commitImmutablePlacementNodeToFragmentInstances(finishedWork, parentFragmentInstances), finishedWork = finishedWork.sibling; } function commitHostPortalContainerChildren(portal, finishedWork, pendingChildren) { portal = portal.containerInfo; try { runWithFiberInDEV(finishedWork, replaceContainerChildren, portal, pendingChildren); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } function commitHostSingletonAcquisition(finishedWork) { var singleton = finishedWork.stateNode, props = finishedWork.memoizedProps; try { runWithFiberInDEV(finishedWork, acquireSingletonInstance, finishedWork.type, props, singleton, finishedWork); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } function trackEnterViewTransitions(placement) { if (30 === placement.tag || 0 !== (placement.subtreeFlags & 33554432)) shouldStartViewTransition = !0; } function pushViewTransitionCancelableScope() { var prevChildren = viewTransitionCancelableChildren; viewTransitionCancelableChildren = null; return prevChildren; } function applyViewTransitionToHostInstances(fiber, name, className, collectMeasurements, stopAtNestedViewTransitions) { viewTransitionHostInstanceIdx = 0; (name = applyViewTransitionToHostInstancesRecursive(fiber.child, name, className, collectMeasurements, stopAtNestedViewTransitions)) && null != fiber._debugTask && null === animatingTask && (animatingTask = fiber._debugTask); return name; } function applyViewTransitionToHostInstancesRecursive(child, name, className, collectMeasurements, stopAtNestedViewTransitions) { if (!supportsMutation) return !1; for (var inViewport = !1; null !== child;) { if (5 === child.tag) { var _instance = child.stateNode; if (null !== collectMeasurements) { var measurement = measureInstance(_instance); collectMeasurements.push(measurement); wasInstanceInViewport(measurement) && (inViewport = !0); } else inViewport || wasInstanceInViewport(measureInstance(_instance)) && (inViewport = !0); shouldStartViewTransition = !0; applyViewTransitionName(_instance, 0 === viewTransitionHostInstanceIdx ? name : name + "_" + viewTransitionHostInstanceIdx, className); viewTransitionHostInstanceIdx++; } else if (22 !== child.tag || null === child.memoizedState) 30 === child.tag && stopAtNestedViewTransitions || applyViewTransitionToHostInstancesRecursive(child.child, name, className, collectMeasurements, stopAtNestedViewTransitions) && (inViewport = !0); child = child.sibling; } return inViewport; } function restoreViewTransitionOnHostInstances(child, stopAtNestedViewTransitions) { if (supportsMutation) for (; null !== child;) { if (5 === child.tag) restoreViewTransitionName(child.stateNode, child.memoizedProps); else if (22 !== child.tag || null === child.memoizedState) 30 === child.tag && stopAtNestedViewTransitions || restoreViewTransitionOnHostInstances(child.child, stopAtNestedViewTransitions); child = child.sibling; } } function commitAppearingPairViewTransitions(placement) { if (0 !== (placement.subtreeFlags & 18874368)) for (placement = placement.child; null !== placement;) { if (22 !== placement.tag || null === placement.memoizedState) { if (commitAppearingPairViewTransitions(placement), 30 === placement.tag && 0 !== (placement.flags & 18874368) && placement.stateNode.paired) { var props = placement.memoizedProps; if (null == props.name || "auto" === props.name) throw Error("Found a pair with an auto name. This is a bug in React."); var name = props.name; props = getViewTransitionClassName(props.default, props.share); "none" !== props && (applyViewTransitionToHostInstances(placement, name, props, null, !1) || restoreViewTransitionOnHostInstances(placement.child, !1)); } } placement = placement.sibling; } } function commitEnterViewTransitions(placement, gesture) { if (30 === placement.tag) { var state = placement.stateNode, props = placement.memoizedProps, name = getViewTransitionName(props, state), className = getViewTransitionClassName(props.default, state.paired ? props.share : props.enter); "none" !== className ? applyViewTransitionToHostInstances(placement, name, className, null, !1) ? (commitAppearingPairViewTransitions(placement), state.paired || gesture || scheduleViewTransitionEvent(placement, props.onEnter)) : restoreViewTransitionOnHostInstances(placement.child, !1) : commitAppearingPairViewTransitions(placement); } else if (0 !== (placement.subtreeFlags & 33554432)) for (placement = placement.child; null !== placement;) commitEnterViewTransitions(placement, gesture), placement = placement.sibling; else commitAppearingPairViewTransitions(placement); } function commitDeletedPairViewTransitions(deletion) { if (null !== appearingViewTransitions && 0 !== appearingViewTransitions.size) { var pairs = appearingViewTransitions; if (0 !== (deletion.subtreeFlags & 18874368)) for (deletion = deletion.child; null !== deletion;) { if (22 !== deletion.tag || null === deletion.memoizedState) { if (30 === deletion.tag && 0 !== (deletion.flags & 18874368)) { var props = deletion.memoizedProps, name = props.name; if (null != name && "auto" !== name) { var pair = pairs.get(name); if (void 0 !== pair) { var className = getViewTransitionClassName(props.default, props.share); "none" !== className && (applyViewTransitionToHostInstances(deletion, name, className, null, !1) ? (className = deletion.stateNode, pair.paired = className, className.paired = pair, scheduleViewTransitionEvent(deletion, props.onShare)) : restoreViewTransitionOnHostInstances(deletion.child, !1)); pairs.delete(name); if (0 === pairs.size) break; } } } commitDeletedPairViewTransitions(deletion); } deletion = deletion.sibling; } } } function commitExitViewTransitions(deletion) { if (30 === deletion.tag) { var props = deletion.memoizedProps, name = getViewTransitionName(props, deletion.stateNode), pair = null !== appearingViewTransitions ? appearingViewTransitions.get(name) : void 0, className = getViewTransitionClassName(props.default, void 0 !== pair ? props.share : props.exit); "none" !== className && (applyViewTransitionToHostInstances(deletion, name, className, null, !1) ? void 0 !== pair ? (className = deletion.stateNode, pair.paired = className, className.paired = pair, appearingViewTransitions.delete(name), scheduleViewTransitionEvent(deletion, props.onShare)) : scheduleViewTransitionEvent(deletion, props.onExit) : restoreViewTransitionOnHostInstances(deletion.child, !1)); null !== appearingViewTransitions && commitDeletedPairViewTransitions(deletion); } else if (0 !== (deletion.subtreeFlags & 33554432)) for (deletion = deletion.child; null !== deletion;) commitExitViewTransitions(deletion), deletion = deletion.sibling; else null !== appearingViewTransitions && commitDeletedPairViewTransitions(deletion); } function commitNestedViewTransitions(changedParent) { for (changedParent = changedParent.child; null !== changedParent;) { if (30 === changedParent.tag) { var props = changedParent.memoizedProps, name = getViewTransitionName(props, changedParent.stateNode); props = getViewTransitionClassName(props.default, props.update); changedParent.flags &= -5; "none" !== props && applyViewTransitionToHostInstances(changedParent, name, props, changedParent.memoizedState = [], !1); } else 0 !== (changedParent.subtreeFlags & 33554432) && commitNestedViewTransitions(changedParent); changedParent = changedParent.sibling; } } function restorePairedViewTransitions(parent) { if (0 !== (parent.subtreeFlags & 18874368)) for (parent = parent.child; null !== parent;) { if (22 !== parent.tag || null === parent.memoizedState) { if (30 === parent.tag && 0 !== (parent.flags & 18874368)) { var instance = parent.stateNode; null !== instance.paired && (instance.paired = null, restoreViewTransitionOnHostInstances(parent.child, !1)); } restorePairedViewTransitions(parent); } parent = parent.sibling; } } function restoreEnterOrExitViewTransitions(fiber) { if (30 === fiber.tag) fiber.stateNode.paired = null, restoreViewTransitionOnHostInstances(fiber.child, !1), restorePairedViewTransitions(fiber); else if (0 !== (fiber.subtreeFlags & 33554432)) for (fiber = fiber.child; null !== fiber;) restoreEnterOrExitViewTransitions(fiber), fiber = fiber.sibling; else restorePairedViewTransitions(fiber); } function restoreNestedViewTransitions(changedParent) { for (changedParent = changedParent.child; null !== changedParent;) 30 === changedParent.tag ? restoreViewTransitionOnHostInstances(changedParent.child, !1) : 0 !== (changedParent.subtreeFlags & 33554432) && restoreNestedViewTransitions(changedParent), changedParent = changedParent.sibling; } function measureViewTransitionHostInstancesRecursive(parentViewTransition, child, newName, oldName, className, previousMeasurements, stopAtNestedViewTransitions) { if (!supportsMutation) return !1; for (var inViewport = !1; null !== child;) { if (5 === child.tag) { var _instance2 = child.stateNode; if (null !== previousMeasurements && viewTransitionHostInstanceIdx < previousMeasurements.length) { var previousMeasurement = previousMeasurements[viewTransitionHostInstanceIdx], nextMeasurement = measureInstance(_instance2); if (wasInstanceInViewport(previousMeasurement) || wasInstanceInViewport(nextMeasurement)) inViewport = !0; 0 === (parentViewTransition.flags & 4) && hasInstanceChanged(previousMeasurement, nextMeasurement) && (parentViewTransition.flags |= 4); hasInstanceAffectedParent(previousMeasurement, nextMeasurement) && (parentViewTransition.flags |= 32); } else parentViewTransition.flags |= 32; 0 !== (parentViewTransition.flags & 4) && applyViewTransitionName(_instance2, 0 === viewTransitionHostInstanceIdx ? newName : newName + "_" + viewTransitionHostInstanceIdx, className); inViewport && 0 !== (parentViewTransition.flags & 4) || (null === viewTransitionCancelableChildren && (viewTransitionCancelableChildren = []), viewTransitionCancelableChildren.push(_instance2, 0 === viewTransitionHostInstanceIdx ? oldName : oldName + "_" + viewTransitionHostInstanceIdx, child.memoizedProps)); viewTransitionHostInstanceIdx++; } else if (22 !== child.tag || null === child.memoizedState) 30 === child.tag && stopAtNestedViewTransitions ? parentViewTransition.flags |= child.flags & 32 : measureViewTransitionHostInstancesRecursive(parentViewTransition, child.child, newName, oldName, className, previousMeasurements, stopAtNestedViewTransitions) && (inViewport = !0); child = child.sibling; } return inViewport; } function measureNestedViewTransitions(changedParent, gesture) { for (changedParent = changedParent.child; null !== changedParent;) { if (30 === changedParent.tag) { var props = changedParent.memoizedProps, state = changedParent.stateNode, name = getViewTransitionName(props, state), className = getViewTransitionClassName(props.default, props.update); if (gesture) { state = state.clones; var previousMeasurements = null === state ? null : state.map(measureClonedInstance); } else previousMeasurements = changedParent.memoizedState, changedParent.memoizedState = null; state = changedParent; var child = changedParent.child, newName = name; viewTransitionHostInstanceIdx = 0; className = measureViewTransitionHostInstancesRecursive(state, child, newName, name, className, previousMeasurements, !1); 0 !== (changedParent.flags & 4) && className && (gesture || scheduleViewTransitionEvent(changedParent, props.onUpdate)); } else 0 !== (changedParent.subtreeFlags & 33554432) && measureNestedViewTransitions(changedParent, gesture); changedParent = changedParent.sibling; } } function trackNamedViewTransition(fiber) { var name = fiber.memoizedProps.name; if (null != name && "auto" !== name) { var existing = mountedNamedViewTransitions.get(name); if (void 0 !== existing) { if (existing !== fiber && existing !== fiber.alternate && !didWarnAboutName[name]) { didWarnAboutName[name] = !0; var stringifiedName = JSON.stringify(name); runWithFiberInDEV(fiber, function() { console.error("There are two components with the same name mounted at the same time. This is not supported and will cause View Transitions to error. Try to use a more unique name e.g. by using a namespace prefix and adding the id of an item to the name.", stringifiedName); }); runWithFiberInDEV(existing, function() { console.error("The existing duplicate has this stack trace.", stringifiedName); }); } } else mountedNamedViewTransitions.set(name, fiber); } } function untrackNamedViewTransition(fiber) { var name = fiber.memoizedProps.name; if (null != name && "auto" !== name) { var existing = mountedNamedViewTransitions.get(name); void 0 === existing || existing !== fiber && existing !== fiber.alternate || mountedNamedViewTransitions.delete(name); } } function isHydratingParent(current, finishedWork) { return 31 === finishedWork.tag ? (finishedWork = finishedWork.memoizedState, null !== current.memoizedState && null === finishedWork) : 13 === finishedWork.tag ? (current = current.memoizedState, finishedWork = finishedWork.memoizedState, null !== current && null !== current.dehydrated && (null === finishedWork || null === finishedWork.dehydrated)) : 3 === finishedWork.tag ? current.memoizedState.isDehydrated && 0 === (finishedWork.flags & 256) : !1; } function commitBeforeMutationEffects(root, firstChild, committedLanes) { prepareForCommit(root.containerInfo); root = (committedLanes & 335544064) === committedLanes; nextEffect = firstChild; for (firstChild = root ? 9270 : 1024; null !== nextEffect;) { committedLanes = nextEffect; if (root) { var deletions = committedLanes.deletions; if (null !== deletions) for (var i = 0; i < deletions.length; i++) root && commitExitViewTransitions(deletions[i]); } if (null === committedLanes.alternate && 0 !== (committedLanes.flags & 2)) root && trackEnterViewTransitions(committedLanes), commitBeforeMutationEffects_complete(root); else { if (22 === committedLanes.tag) { if (deletions = committedLanes.alternate, null !== committedLanes.memoizedState) { null !== deletions && null === deletions.memoizedState && root && commitExitViewTransitions(deletions); commitBeforeMutationEffects_complete(root); continue; } else if (null !== deletions && null !== deletions.memoizedState) { root && trackEnterViewTransitions(committedLanes); commitBeforeMutationEffects_complete(root); continue; } } deletions = committedLanes.child; 0 !== (committedLanes.subtreeFlags & firstChild) && null !== deletions ? (deletions.return = committedLanes, nextEffect = deletions) : (root && commitNestedViewTransitions(committedLanes), commitBeforeMutationEffects_complete(root)); } } appearingViewTransitions = null; } function commitBeforeMutationEffects_complete(isViewTransitionEligible$jscomp$0) { for (; null !== nextEffect;) { var fiber = nextEffect, finishedWork = fiber, isViewTransitionEligible = isViewTransitionEligible$jscomp$0, current = finishedWork.alternate, flags = finishedWork.flags; switch (finishedWork.tag) { case 0: case 11: case 15: break; case 1: 0 !== (flags & 1024) && null !== current && commitClassSnapshot(finishedWork, current); break; case 3: 0 !== (flags & 1024) && supportsMutation && clearContainer(finishedWork.stateNode.containerInfo); break; case 5: case 26: case 27: case 6: case 4: case 17: break; case 30: isViewTransitionEligible && null !== current && (isViewTransitionEligible = current, current = finishedWork, finishedWork = getViewTransitionName(isViewTransitionEligible.memoizedProps, isViewTransitionEligible.stateNode), current = current.memoizedProps, current = getViewTransitionClassName(current.default, current.update), "none" !== current && applyViewTransitionToHostInstances(isViewTransitionEligible, finishedWork, current, isViewTransitionEligible.memoizedState = [], !0)); break; default: if (0 !== (flags & 1024)) throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."); } isViewTransitionEligible = fiber.sibling; if (null !== isViewTransitionEligible) { isViewTransitionEligible.return = fiber.return; nextEffect = isViewTransitionEligible; break; } nextEffect = fiber.return; } } function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { var prevEffectStart = pushComponentEffectStart(), prevEffectDuration = pushComponentEffectDuration(), prevEffectErrors = pushComponentEffectErrors(), prevEffectDidSpawnUpdate = pushComponentEffectDidSpawnUpdate(), flags = finishedWork.flags; switch (finishedWork.tag) { case 0: case 11: case 15: recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); flags & 4 && commitHookLayoutEffects(finishedWork, Layout | HasEffect); break; case 1: recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); if (flags & 4) if (finishedRoot = finishedWork.stateNode, null === current) finishedWork.type.defaultProps || "ref" in finishedWork.memoizedProps || didWarnAboutReassigningProps || (finishedRoot.props !== finishedWork.memoizedProps && console.error("Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance"), finishedRoot.state !== finishedWork.memoizedState && console.error("Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance")), shouldProfile(finishedWork) ? (startEffectTimer(), runWithFiberInDEV(finishedWork, callComponentDidMountInDEV, finishedWork, finishedRoot), recordEffectDuration()) : runWithFiberInDEV(finishedWork, callComponentDidMountInDEV, finishedWork, finishedRoot); else { var prevProps = resolveClassComponentProps(finishedWork.type, current.memoizedProps); current = current.memoizedState; finishedWork.type.defaultProps || "ref" in finishedWork.memoizedProps || didWarnAboutReassigningProps || (finishedRoot.props !== finishedWork.memoizedProps && console.error("Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance"), finishedRoot.state !== finishedWork.memoizedState && console.error("Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance")); shouldProfile(finishedWork) ? (startEffectTimer(), runWithFiberInDEV(finishedWork, callComponentDidUpdateInDEV, finishedWork, finishedRoot, prevProps, current, finishedRoot.__reactInternalSnapshotBeforeUpdate), recordEffectDuration()) : runWithFiberInDEV(finishedWork, callComponentDidUpdateInDEV, finishedWork, finishedRoot, prevProps, current, finishedRoot.__reactInternalSnapshotBeforeUpdate); } flags & 64 && commitClassCallbacks(finishedWork); flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); break; case 3: current = pushNestedEffectDurations(); recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); if (flags & 64 && (flags = finishedWork.updateQueue, null !== flags)) { prevProps = null; if (null !== finishedWork.child) switch (finishedWork.child.tag) { case 27: case 5: prevProps = getPublicInstance(finishedWork.child.stateNode); break; case 1: prevProps = finishedWork.child.stateNode; } try { runWithFiberInDEV(finishedWork, commitCallbacks, flags, prevProps); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } finishedRoot.effectDuration += popNestedEffectDurations(current); break; case 27: supportsSingletons && null === current && flags & 4 && commitHostSingletonAcquisition(finishedWork); case 26: case 5: recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); if (null === current) { if (flags & 4) commitHostMount(finishedWork); else if (flags & 64) { finishedRoot = finishedWork.type; current = finishedWork.memoizedProps; prevProps = finishedWork.stateNode; try { runWithFiberInDEV(finishedWork, commitHydratedInstance, prevProps, finishedRoot, current, finishedWork); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } } flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); break; case 12: if (flags & 4) { flags = pushNestedEffectDurations(); recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); finishedRoot = finishedWork.stateNode; finishedRoot.effectDuration += bubbleNestedEffectDurations(flags); try { runWithFiberInDEV(finishedWork, commitProfiler, finishedWork, current, commitStartTime, finishedRoot.effectDuration); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } else recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); break; case 31: recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); flags & 4 && commitActivityHydrationCallbacks(finishedRoot, finishedWork); break; case 13: recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); flags & 4 && commitSuspenseHydrationCallbacks(finishedRoot, finishedWork); flags & 64 && (finishedRoot = finishedWork.memoizedState, null !== finishedRoot && (finishedRoot = finishedRoot.dehydrated, null !== finishedRoot && (flags = retryDehydratedSuspenseBoundary.bind(null, finishedWork), registerSuspenseInstanceRetry(finishedRoot, flags)))); break; case 22: flags = null !== finishedWork.memoizedState || offscreenSubtreeIsHidden; if (!flags) { var newOffscreenSubtreeWasHidden = null !== current && null !== current.memoizedState || offscreenSubtreeWasHidden; current = offscreenSubtreeIsHidden; prevProps = offscreenSubtreeWasHidden; offscreenSubtreeIsHidden = flags; (offscreenSubtreeWasHidden = newOffscreenSubtreeWasHidden) && !prevProps ? (flags = supportsSingletons ? IncludeHostSingletons : NoLayoutEffectTraversalFlags, 0 !== (finishedWork.subtreeFlags & 8772) && (flags |= IncludeWorkInProgressEffects), recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, flags), (finishedWork.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && .05 < componentEffectEndTime - componentEffectStartTime && logComponentReappeared(finishedWork, componentEffectStartTime, componentEffectEndTime)) : recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); offscreenSubtreeIsHidden = current; offscreenSubtreeWasHidden = prevProps; } break; case 30: flags & 18874368 && trackNamedViewTransition(finishedWork); recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); break; case 7: flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); default: recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); } (finishedWork.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && ((componentEffectSpawnedUpdate || .05 < componentEffectDuration) && logComponentEffect(finishedWork, componentEffectStartTime, componentEffectEndTime, componentEffectDuration, componentEffectErrors), null === finishedWork.alternate && null !== finishedWork.return && null !== finishedWork.return.alternate && .05 < componentEffectEndTime - componentEffectStartTime && (isHydratingParent(finishedWork.return.alternate, finishedWork.return) || logComponentTrigger(finishedWork, componentEffectStartTime, componentEffectEndTime, "Mount"))); popComponentEffectStart(prevEffectStart); popComponentEffectDuration(prevEffectDuration); componentEffectErrors = prevEffectErrors; componentEffectSpawnedUpdate = prevEffectDidSpawnUpdate; } function hideOrUnhideAllChildren(parentFiber, isHidden) { if (supportsMutation) for (parentFiber = parentFiber.child; null !== parentFiber;) hideOrUnhideAllChildrenOnFiber(parentFiber, isHidden), parentFiber = parentFiber.sibling; } function hideOrUnhideAllChildrenOnFiber(fiber, isHidden) { if (supportsMutation) switch (fiber.tag) { case 5: case 26: try { var instance = fiber.stateNode; isHidden ? runWithFiberInDEV(fiber, hideInstance, instance) : runWithFiberInDEV(fiber, unhideInstance, fiber.stateNode, fiber.memoizedProps); } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } hideOrUnhideNearestPortals(fiber, isHidden); break; case 6: try { var instance$jscomp$0 = fiber.stateNode; isHidden ? runWithFiberInDEV(fiber, hideTextInstance, instance$jscomp$0) : runWithFiberInDEV(fiber, unhideTextInstance, instance$jscomp$0, fiber.memoizedProps); viewTransitionMutationContext = !0; } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } break; case 18: try { var instance$jscomp$1 = fiber.stateNode; isHidden ? runWithFiberInDEV(fiber, hideDehydratedBoundary, instance$jscomp$1) : runWithFiberInDEV(fiber, unhideDehydratedBoundary, fiber.stateNode); } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } break; case 22: case 23: null === fiber.memoizedState && hideOrUnhideAllChildren(fiber, isHidden); break; default: hideOrUnhideAllChildren(fiber, isHidden); } } function hideOrUnhideNearestPortals(parentFiber, isHidden$jscomp$0) { if (supportsMutation && parentFiber.subtreeFlags & 67108864) for (parentFiber = parentFiber.child; null !== parentFiber;) { var fiber = parentFiber, isHidden = isHidden$jscomp$0; if (supportsMutation) switch (fiber.tag) { case 4: hideOrUnhideAllChildrenOnFiber(fiber, isHidden); break; case 22: null === fiber.memoizedState && hideOrUnhideNearestPortals(fiber, isHidden); break; default: hideOrUnhideNearestPortals(fiber, isHidden); } parentFiber = parentFiber.sibling; } } function detachFiberAfterEffects(fiber) { var alternate = fiber.alternate; null !== alternate && (fiber.alternate = null, detachFiberAfterEffects(alternate)); fiber.child = null; fiber.deletions = null; fiber.sibling = null; 5 === fiber.tag && (alternate = fiber.stateNode, null !== alternate && detachDeletedInstance(alternate)); fiber.stateNode = null; fiber._debugOwner = null; fiber.return = null; fiber.dependencies = null; fiber.memoizedProps = null; fiber.memoizedState = null; fiber.pendingProps = null; fiber.stateNode = null; fiber.updateQueue = null; } function recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, parent) { for (parent = parent.child; null !== parent;) commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, parent), parent = parent.sibling; } function commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, deletedFiber) { if (injectedHook && "function" === typeof injectedHook.onCommitFiberUnmount) try { injectedHook.onCommitFiberUnmount(rendererID, deletedFiber); } catch (err) { hasLoggedError || (hasLoggedError = !0, console.error("React instrumentation encountered an error: %o", err)); } var prevEffectStart = pushComponentEffectStart(), prevEffectDuration = pushComponentEffectDuration(), prevEffectErrors = pushComponentEffectErrors(), prevEffectDidSpawnUpdate = pushComponentEffectDidSpawnUpdate(); switch (deletedFiber.tag) { case 26: if (supportsResources) { offscreenSubtreeWasHidden || safelyDetachRef(deletedFiber, nearestMountedAncestor); recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); deletedFiber.memoizedState ? releaseResource(deletedFiber.memoizedState) : deletedFiber.stateNode && (offscreenSubtreeWasHidden || unmountHoistable(deletedFiber.stateNode)); break; } case 27: if (supportsSingletons) { offscreenSubtreeWasHidden || safelyDetachRef(deletedFiber, nearestMountedAncestor); commitFragmentInstanceDeletionEffects(deletedFiber); var prevHostParent = hostParent, prevHostParentIsContainer = hostParentIsContainer; isSingletonScope(deletedFiber.type) && (hostParent = deletedFiber.stateNode, hostParentIsContainer = !1); recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); runWithFiberInDEV(deletedFiber, releaseSingletonInstance, deletedFiber.stateNode, deletedFiber.type, deletedFiber.memoizedProps); hostParent = prevHostParent; hostParentIsContainer = prevHostParentIsContainer; break; } case 5: offscreenSubtreeWasHidden || safelyDetachRef(deletedFiber, nearestMountedAncestor), commitFragmentInstanceDeletionEffects(deletedFiber); case 6: 6 === deletedFiber.tag && commitFragmentInstanceDeletionEffects(deletedFiber); if (supportsMutation) { if (prevHostParent = hostParent, prevHostParentIsContainer = hostParentIsContainer, hostParent = null, recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber), hostParent = prevHostParent, hostParentIsContainer = prevHostParentIsContainer, null !== hostParent) if (hostParentIsContainer) try { runWithFiberInDEV(deletedFiber, removeChildFromContainer, hostParent, deletedFiber.stateNode), viewTransitionMutationContext = !0; } catch (error) { captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); } else try { runWithFiberInDEV(deletedFiber, removeChild, hostParent, deletedFiber.stateNode), viewTransitionMutationContext = !0; } catch (error) { captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); } } else recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); break; case 18: supportsMutation && null !== hostParent && (hostParentIsContainer ? clearSuspenseBoundaryFromContainer(hostParent, deletedFiber.stateNode) : clearSuspenseBoundary(hostParent, deletedFiber.stateNode)); break; case 4: supportsMutation ? (prevHostParent = hostParent, prevHostParentIsContainer = hostParentIsContainer, hostParent = deletedFiber.stateNode.containerInfo, hostParentIsContainer = !0, recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber), hostParent = prevHostParent, hostParentIsContainer = prevHostParentIsContainer) : (supportsPersistence && commitHostPortalContainerChildren(deletedFiber.stateNode, deletedFiber, createContainerChildSet()), recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber)); break; case 0: case 11: case 14: case 15: commitHookEffectListUnmount(Insertion, deletedFiber, nearestMountedAncestor); offscreenSubtreeWasHidden || commitHookLayoutUnmountEffects(deletedFiber, nearestMountedAncestor, Layout); recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); break; case 1: offscreenSubtreeWasHidden || (safelyDetachRef(deletedFiber, nearestMountedAncestor), prevHostParent = deletedFiber.stateNode, "function" === typeof prevHostParent.componentWillUnmount && safelyCallComponentWillUnmount(deletedFiber, nearestMountedAncestor, prevHostParent)); recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); break; case 21: recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); break; case 22: offscreenSubtreeWasHidden = (prevHostParent = offscreenSubtreeWasHidden) || null !== deletedFiber.memoizedState; recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); offscreenSubtreeWasHidden = prevHostParent; break; case 30: deletedFiber.flags & 18874368 && untrackNamedViewTransition(deletedFiber); safelyDetachRef(deletedFiber, nearestMountedAncestor); recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); break; case 7: offscreenSubtreeWasHidden || safelyDetachRef(deletedFiber, nearestMountedAncestor); recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); break; default: recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); } (deletedFiber.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && (componentEffectSpawnedUpdate || .05 < componentEffectDuration) && logComponentEffect(deletedFiber, componentEffectStartTime, componentEffectEndTime, componentEffectDuration, componentEffectErrors); popComponentEffectStart(prevEffectStart); popComponentEffectDuration(prevEffectDuration); componentEffectErrors = prevEffectErrors; componentEffectSpawnedUpdate = prevEffectDidSpawnUpdate; } function commitActivityHydrationCallbacks(finishedRoot, finishedWork) { if (supportsHydration && null === finishedWork.memoizedState && (finishedRoot = finishedWork.alternate, null !== finishedRoot && (finishedRoot = finishedRoot.memoizedState, null !== finishedRoot))) { finishedRoot = finishedRoot.dehydrated; try { runWithFiberInDEV(finishedWork, commitHydratedActivityInstance, finishedRoot); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } } function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { if (supportsHydration && null === finishedWork.memoizedState && (finishedRoot = finishedWork.alternate, null !== finishedRoot && (finishedRoot = finishedRoot.memoizedState, null !== finishedRoot && (finishedRoot = finishedRoot.dehydrated, null !== finishedRoot)))) try { runWithFiberInDEV(finishedWork, commitHydratedSuspenseInstance, finishedRoot); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } function getRetryCache(finishedWork) { switch (finishedWork.tag) { case 31: case 13: case 19: var retryCache = finishedWork.stateNode; null === retryCache && (retryCache = finishedWork.stateNode = new PossiblyWeakSet()); return retryCache; case 22: return finishedWork = finishedWork.stateNode, retryCache = finishedWork._retryCache, null === retryCache && (retryCache = finishedWork._retryCache = new PossiblyWeakSet()), retryCache; default: throw Error("Unexpected Suspense handler tag (" + finishedWork.tag + "). This is a bug in React."); } } function attachSuspenseRetryListeners(finishedWork, wakeables) { var retryCache = getRetryCache(finishedWork); wakeables.forEach(function(wakeable) { if (!retryCache.has(wakeable)) { retryCache.add(wakeable); if (isDevToolsPresent) if (null !== inProgressLanes && null !== inProgressRoot) restorePendingUpdaters(inProgressRoot, inProgressLanes); else throw Error("Expected finished root and lanes to be set. This is a bug in React."); var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); wakeable.then(retry, retry); } }); } function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber, lanes) { var deletions = parentFiber.deletions; if (null !== deletions) for (var i = 0; i < deletions.length; i++) { var root = root$jscomp$0, returnFiber = parentFiber, deletedFiber = deletions[i], prevEffectStart = pushComponentEffectStart(); if (supportsMutation) { var parent = returnFiber; a: for (; null !== parent;) { switch (parent.tag) { case 27: if (supportsSingletons) { if (isSingletonScope(parent.type)) { hostParent = parent.stateNode; hostParentIsContainer = !1; break a; } break; } case 5: hostParent = parent.stateNode; hostParentIsContainer = !1; break a; case 3: case 4: hostParent = parent.stateNode.containerInfo; hostParentIsContainer = !0; break a; } parent = parent.return; } if (null === hostParent) throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."); commitDeletionEffectsOnFiber(root, returnFiber, deletedFiber); hostParent = null; hostParentIsContainer = !1; } else commitDeletionEffectsOnFiber(root, returnFiber, deletedFiber); (deletedFiber.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && .05 < componentEffectEndTime - componentEffectStartTime && logComponentTrigger(deletedFiber, componentEffectStartTime, componentEffectEndTime, "Unmount"); popComponentEffectStart(prevEffectStart); root = deletedFiber; returnFiber = root.alternate; null !== returnFiber && (returnFiber.return = null); root.return = null; } if (parentFiber.subtreeFlags & 13886) for (parentFiber = parentFiber.child; null !== parentFiber;) commitMutationEffectsOnFiber(parentFiber, root$jscomp$0, lanes), parentFiber = parentFiber.sibling; } function commitMutationEffectsOnFiber(finishedWork, root, lanes) { var prevEffectStart = pushComponentEffectStart(), prevEffectDuration = pushComponentEffectDuration(), prevEffectErrors = pushComponentEffectErrors(), prevEffectDidSpawnUpdate = pushComponentEffectDidSpawnUpdate(), current = finishedWork.alternate, flags = finishedWork.flags; switch (finishedWork.tag) { case 0: case 11: case 14: case 15: if (flags & 4 && (current = finishedWork.updateQueue, current = null !== current ? current.events : null, null !== current)) for (var ii = 0; ii < current.length; ii++) { var _eventPayloads$ii2 = current[ii]; _eventPayloads$ii2.ref.impl = _eventPayloads$ii2.nextImpl; } recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); flags & 4 && (commitHookEffectListUnmount(Insertion | HasEffect, finishedWork, finishedWork.return), commitHookEffectListMount(Insertion | HasEffect, finishedWork), commitHookLayoutUnmountEffects(finishedWork, finishedWork.return, Layout | HasEffect)); break; case 1: recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); flags & 512 && (offscreenSubtreeWasHidden || null === current || safelyDetachRef(current, current.return)); flags & 64 && offscreenSubtreeIsHidden && (root = finishedWork.updateQueue, null !== root && (flags = root.callbacks, null !== flags && (lanes = root.shared.hiddenCallbacks, root.shared.hiddenCallbacks = null === lanes ? flags : lanes.concat(flags)))); break; case 26: if (supportsResources) { ii = currentHoistableRoot; recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); flags & 512 && (offscreenSubtreeWasHidden || null === current || safelyDetachRef(current, current.return)); flags & 4 && (lanes = null !== current ? current.memoizedState : null, flags = finishedWork.memoizedState, null === current ? null === flags ? null === finishedWork.stateNode ? finishedWork.stateNode = offscreenSubtreeIsHidden ? createHoistableInstance(finishedWork.type, finishedWork.memoizedProps, root.containerInfo, finishedWork) : hydrateHoistable(ii, finishedWork.type, finishedWork.memoizedProps, finishedWork) : offscreenSubtreeIsHidden || mountHoistable(ii, finishedWork.type, finishedWork.stateNode) : finishedWork.stateNode = acquireResource(ii, flags, finishedWork.memoizedProps) : lanes !== flags ? (null === lanes ? (root = current.stateNode, null === root || offscreenSubtreeWasHidden || unmountHoistable(root)) : releaseResource(lanes), null === flags ? offscreenSubtreeIsHidden || mountHoistable(ii, finishedWork.type, finishedWork.stateNode) : acquireResource(ii, flags, finishedWork.memoizedProps)) : null === flags && null !== finishedWork.stateNode && commitHostUpdate(finishedWork, finishedWork.memoizedProps, current.memoizedProps)); break; } case 27: if (supportsSingletons) { recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); flags & 512 && (offscreenSubtreeWasHidden || null === current || safelyDetachRef(current, current.return)); null !== current && flags & 4 && commitHostUpdate(finishedWork, finishedWork.memoizedProps, current.memoizedProps); break; } case 5: ii = offscreenDirectParentIsHidden; offscreenDirectParentIsHidden = !1; recursivelyTraverseMutationEffects(root, finishedWork, lanes); offscreenDirectParentIsHidden = ii; commitReconciliationEffects(finishedWork); flags & 512 && (offscreenSubtreeWasHidden || null === current || safelyDetachRef(current, current.return)); if (supportsMutation) { if (finishedWork.flags & 32) { root = finishedWork.stateNode; try { runWithFiberInDEV(finishedWork, resetTextContent, root), viewTransitionMutationContext = !0; } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } flags & 4 && null != finishedWork.stateNode && (root = finishedWork.memoizedProps, commitHostUpdate(finishedWork, root, null !== current ? current.memoizedProps : root)); flags & 1024 && (needsFormReset = !0, "form" !== finishedWork.type && console.error("Unexpected host component type. Expected a form. This is a bug in React.")); } else supportsPersistence && null !== finishedWork.alternate && (finishedWork.alternate.stateNode = finishedWork.stateNode); break; case 6: recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & 4 && supportsMutation) { if (null === finishedWork.stateNode) throw Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue."); root = finishedWork.memoizedProps; flags = null !== current ? current.memoizedProps : root; lanes = finishedWork.stateNode; try { runWithFiberInDEV(finishedWork, commitTextUpdate, lanes, flags, root), viewTransitionMutationContext = !0; } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } break; case 3: ii = pushNestedEffectDurations(); viewTransitionMutationContext = !1; supportsResources ? (prepareToCommitHoistables(), _eventPayloads$ii2 = currentHoistableRoot, currentHoistableRoot = getHoistableRoot(root.containerInfo), recursivelyTraverseMutationEffects(root, finishedWork, lanes), currentHoistableRoot = _eventPayloads$ii2) : recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & 4) { if (supportsMutation && supportsHydration && null !== current && current.memoizedState.isDehydrated) try { runWithFiberInDEV(finishedWork, commitHydratedContainer, root.containerInfo); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } if (supportsPersistence) { flags = root.containerInfo; lanes = root.pendingChildren; try { runWithFiberInDEV(finishedWork, replaceContainerChildren, flags, lanes), viewTransitionMutationContext = !0; } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } } needsFormReset && (needsFormReset = !1, recursivelyResetForms(finishedWork)); root.effectDuration += popNestedEffectDurations(ii); viewTransitionMutationContext = !1; break; case 4: current = offscreenDirectParentIsHidden; offscreenDirectParentIsHidden = offscreenSubtreeIsHidden; ii = pushMutationContext(); supportsResources ? (_eventPayloads$ii2 = currentHoistableRoot, currentHoistableRoot = getHoistableRoot(finishedWork.stateNode.containerInfo), recursivelyTraverseMutationEffects(root, finishedWork, lanes), commitReconciliationEffects(finishedWork), currentHoistableRoot = _eventPayloads$ii2) : (recursivelyTraverseMutationEffects(root, finishedWork, lanes), commitReconciliationEffects(finishedWork)); viewTransitionMutationContext && inUpdateViewTransition && (rootViewTransitionAffected = !0); viewTransitionMutationContext = ii; offscreenDirectParentIsHidden = current; flags & 4 && supportsPersistence && commitHostPortalContainerChildren(finishedWork.stateNode, finishedWork, finishedWork.stateNode.pendingChildren); break; case 12: flags = pushNestedEffectDurations(); recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); finishedWork.stateNode.effectDuration += bubbleNestedEffectDurations(flags); break; case 31: recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); flags & 4 && (root = finishedWork.updateQueue, null !== root && (finishedWork.updateQueue = null, attachSuspenseRetryListeners(finishedWork, root))); break; case 13: recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); finishedWork.child.flags & 8192 && null !== finishedWork.memoizedState !== (null !== current && null !== current.memoizedState) && (globalMostRecentFallbackTime = now$1()); flags & 4 && (root = finishedWork.updateQueue, null !== root && (finishedWork.updateQueue = null, attachSuspenseRetryListeners(finishedWork, root))); break; case 22: ii = null !== finishedWork.memoizedState; _eventPayloads$ii2 = null !== current && null !== current.memoizedState; var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden, _prevOffscreenDirectParentIsHidden2 = offscreenDirectParentIsHidden; offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden || ii; offscreenDirectParentIsHidden = _prevOffscreenDirectParentIsHidden2 || ii; offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || _eventPayloads$ii2; recursivelyTraverseMutationEffects(root, finishedWork, lanes); offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; offscreenDirectParentIsHidden = _prevOffscreenDirectParentIsHidden2; offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; _eventPayloads$ii2 && !ii && !prevOffscreenSubtreeIsHidden && !prevOffscreenSubtreeWasHidden && (finishedWork.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && .05 < componentEffectEndTime - componentEffectStartTime && logComponentReappeared(finishedWork, componentEffectStartTime, componentEffectEndTime); commitReconciliationEffects(finishedWork); flags & 8192 && (root = finishedWork.stateNode, root._visibility = ii ? root._visibility & ~OffscreenVisible : root._visibility | OffscreenVisible, !ii || null === current || _eventPayloads$ii2 || offscreenSubtreeIsHidden || offscreenSubtreeWasHidden || (root = supportsSingletons ? IncludeHostSingletons : NoLayoutEffectTraversalFlags, lanes = _eventPayloads$ii2 || offscreenSubtreeWasHidden, current = offscreenSubtreeIsHidden, _eventPayloads$ii2 = offscreenSubtreeWasHidden, offscreenSubtreeIsHidden = ii || offscreenSubtreeIsHidden, offscreenSubtreeWasHidden = lanes, recursivelyTraverseDisappearLayoutEffects(finishedWork, root), (finishedWork.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && .05 < componentEffectEndTime - componentEffectStartTime && logComponentTrigger(finishedWork, componentEffectStartTime, componentEffectEndTime, "Disconnect"), offscreenSubtreeIsHidden = current, offscreenSubtreeWasHidden = _eventPayloads$ii2), supportsMutation && (ii || !offscreenDirectParentIsHidden) && hideOrUnhideAllChildren(finishedWork, ii)); flags & 4 && (root = finishedWork.updateQueue, null !== root && (flags = root.retryQueue, null !== flags && (root.retryQueue = null, attachSuspenseRetryListeners(finishedWork, flags)))); break; case 19: recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); flags & 4 && (root = finishedWork.updateQueue, null !== root && (finishedWork.updateQueue = null, attachSuspenseRetryListeners(finishedWork, root))); break; case 30: flags & 512 && (offscreenSubtreeWasHidden || null === current || safelyDetachRef(current, current.return)); flags = pushMutationContext(); ii = inUpdateViewTransition; _eventPayloads$ii2 = (lanes & 335544064) === lanes; prevOffscreenSubtreeIsHidden = finishedWork.memoizedProps; inUpdateViewTransition = _eventPayloads$ii2 && "none" !== getViewTransitionClassName(prevOffscreenSubtreeIsHidden.default, prevOffscreenSubtreeIsHidden.update); recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); _eventPayloads$ii2 && null !== current && viewTransitionMutationContext && (finishedWork.flags |= 4); inUpdateViewTransition = ii; viewTransitionMutationContext = flags; break; case 21: break; case 7: flags & 512 && (offscreenSubtreeWasHidden || null === current || safelyDetachRef(current, current.return)), current && null !== current.stateNode && updateFragmentInstanceFiber(finishedWork, current.stateNode); default: recursivelyTraverseMutationEffects(root, finishedWork, lanes), commitReconciliationEffects(finishedWork); } (finishedWork.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && ((componentEffectSpawnedUpdate || .05 < componentEffectDuration) && logComponentEffect(finishedWork, componentEffectStartTime, componentEffectEndTime, componentEffectDuration, componentEffectErrors), null === finishedWork.alternate && null !== finishedWork.return && null !== finishedWork.return.alternate && .05 < componentEffectEndTime - componentEffectStartTime && (isHydratingParent(finishedWork.return.alternate, finishedWork.return) || logComponentTrigger(finishedWork, componentEffectStartTime, componentEffectEndTime, "Mount"))); popComponentEffectStart(prevEffectStart); popComponentEffectDuration(prevEffectDuration); componentEffectErrors = prevEffectErrors; componentEffectSpawnedUpdate = prevEffectDidSpawnUpdate; } function commitReconciliationEffects(finishedWork) { var flags = finishedWork.flags; if (flags & 2) { try { runWithFiberInDEV(finishedWork, commitPlacement, finishedWork); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } finishedWork.flags &= -3; } flags & 4096 && (finishedWork.flags &= -4097); } function recursivelyResetForms(parentFiber) { if (parentFiber.subtreeFlags & 1024) for (parentFiber = parentFiber.child; null !== parentFiber;) { var fiber = parentFiber; recursivelyResetForms(fiber); 5 === fiber.tag && fiber.flags & 1024 && resetFormInstance(fiber.stateNode); parentFiber = parentFiber.sibling; } } function recursivelyTraverseAfterMutationEffects(root, parentFiber) { if (parentFiber.subtreeFlags & 9270) for (parentFiber = parentFiber.child; null !== parentFiber;) commitAfterMutationEffectsOnFiber(parentFiber, root), parentFiber = parentFiber.sibling; else measureNestedViewTransitions(parentFiber, !1); } function commitAfterMutationEffectsOnFiber(finishedWork, root) { var current = finishedWork.alternate; if (null === current) commitEnterViewTransitions(finishedWork, !1); else switch (finishedWork.tag) { case 3: rootViewTransitionNameCanceled = viewTransitionContextChanged = !1; pushViewTransitionCancelableScope(); recursivelyTraverseAfterMutationEffects(root, finishedWork); if (!viewTransitionContextChanged && !rootViewTransitionAffected) { finishedWork = viewTransitionCancelableChildren; if (null !== finishedWork) for (var i = 0; i < finishedWork.length; i += 3) cancelViewTransitionName(finishedWork[i], finishedWork[i + 1], finishedWork[i + 2]); cancelRootViewTransitionName(root.containerInfo); rootViewTransitionNameCanceled = !0; } viewTransitionCancelableChildren = null; break; case 5: recursivelyTraverseAfterMutationEffects(root, finishedWork); break; case 4: i = viewTransitionContextChanged; viewTransitionContextChanged = !1; recursivelyTraverseAfterMutationEffects(root, finishedWork); viewTransitionContextChanged && (rootViewTransitionAffected = !0); viewTransitionContextChanged = i; break; case 22: null === finishedWork.memoizedState && (null !== current.memoizedState ? commitEnterViewTransitions(finishedWork, !1) : recursivelyTraverseAfterMutationEffects(root, finishedWork)); break; case 30: i = viewTransitionContextChanged; var prevCancelableChildren = pushViewTransitionCancelableScope(); viewTransitionContextChanged = !1; recursivelyTraverseAfterMutationEffects(root, finishedWork); viewTransitionContextChanged && (finishedWork.flags |= 4); var props = finishedWork.memoizedProps, state = finishedWork.stateNode; root = getViewTransitionName(props, state); state = getViewTransitionName(current.memoizedProps, state); var className = getViewTransitionClassName(props.default, props.update); "none" === className ? current = !1 : (props = current.memoizedState, current.memoizedState = null, current = finishedWork.child, viewTransitionHostInstanceIdx = 0, current = measureViewTransitionHostInstancesRecursive(finishedWork, current, root, state, className, props, !0), viewTransitionHostInstanceIdx !== (null === props ? 0 : props.length) && (finishedWork.flags |= 32)); 0 !== (finishedWork.flags & 4) && current ? (scheduleViewTransitionEvent(finishedWork, finishedWork.memoizedProps.onUpdate), viewTransitionCancelableChildren = prevCancelableChildren) : null !== prevCancelableChildren && (prevCancelableChildren.push.apply(prevCancelableChildren, viewTransitionCancelableChildren), viewTransitionCancelableChildren = prevCancelableChildren); viewTransitionContextChanged = 0 !== (finishedWork.flags & 32) ? !0 : i; break; default: recursivelyTraverseAfterMutationEffects(root, finishedWork); } } function recursivelyTraverseLayoutEffects(root, parentFiber) { if (parentFiber.subtreeFlags & 8772) for (parentFiber = parentFiber.child; null !== parentFiber;) commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber), parentFiber = parentFiber.sibling; } function disappearLayoutEffects(finishedWork, layoutEffectTraversalFlags) { var prevEffectStart = pushComponentEffectStart(), prevEffectDuration = pushComponentEffectDuration(), prevEffectErrors = pushComponentEffectErrors(), prevEffectDidSpawnUpdate = pushComponentEffectDidSpawnUpdate(); switch (finishedWork.tag) { case 0: case 11: case 14: case 15: commitHookLayoutUnmountEffects(finishedWork, finishedWork.return, Layout); recursivelyTraverseDisappearLayoutEffects(finishedWork, layoutEffectTraversalFlags); break; case 1: safelyDetachRef(finishedWork, finishedWork.return); var instance = finishedWork.stateNode; "function" === typeof instance.componentWillUnmount && safelyCallComponentWillUnmount(finishedWork, finishedWork.return, instance); recursivelyTraverseDisappearLayoutEffects(finishedWork, layoutEffectTraversalFlags); break; case 27: supportsSingletons && (layoutEffectTraversalFlags & IncludeHostSingletons) !== NoLayoutEffectTraversalFlags && runWithFiberInDEV(finishedWork, releaseSingletonInstance, finishedWork.stateNode, finishedWork.type, finishedWork.memoizedProps); case 5: safelyDetachRef(finishedWork, finishedWork.return); 5 !== finishedWork.tag && 27 !== finishedWork.tag || commitFragmentInstanceDeletionEffects(finishedWork); recursivelyTraverseDisappearLayoutEffects(finishedWork, layoutEffectTraversalFlags); break; case 6: commitFragmentInstanceDeletionEffects(finishedWork); break; case 26: safelyDetachRef(finishedWork, finishedWork.return); supportsResources && (instance = finishedWork.stateNode, null !== finishedWork.memoizedState || null === instance || offscreenSubtreeWasHidden || unmountHoistable(instance)); recursivelyTraverseDisappearLayoutEffects(finishedWork, layoutEffectTraversalFlags); break; case 22: null === finishedWork.memoizedState && recursivelyTraverseDisappearLayoutEffects(finishedWork, layoutEffectTraversalFlags); break; case 30: finishedWork.flags & 18874368 && untrackNamedViewTransition(finishedWork); safelyDetachRef(finishedWork, finishedWork.return); recursivelyTraverseDisappearLayoutEffects(finishedWork, layoutEffectTraversalFlags); break; case 7: safelyDetachRef(finishedWork, finishedWork.return); default: recursivelyTraverseDisappearLayoutEffects(finishedWork, layoutEffectTraversalFlags); } (finishedWork.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && (componentEffectSpawnedUpdate || .05 < componentEffectDuration) && logComponentEffect(finishedWork, componentEffectStartTime, componentEffectEndTime, componentEffectDuration, componentEffectErrors); popComponentEffectStart(prevEffectStart); popComponentEffectDuration(prevEffectDuration); componentEffectErrors = prevEffectErrors; componentEffectSpawnedUpdate = prevEffectDidSpawnUpdate; } function recursivelyTraverseDisappearLayoutEffects(parentFiber, layoutEffectTraversalFlags) { for (parentFiber = parentFiber.child; null !== parentFiber;) disappearLayoutEffects(parentFiber, layoutEffectTraversalFlags), parentFiber = parentFiber.sibling; } function reappearLayoutEffects(finishedRoot, current, finishedWork, layoutEffectTraversalFlags) { var prevEffectStart = pushComponentEffectStart(), prevEffectDuration = pushComponentEffectDuration(), prevEffectErrors = pushComponentEffectErrors(), prevEffectDidSpawnUpdate = pushComponentEffectDidSpawnUpdate(), flags = finishedWork.flags, includeWorkInProgressEffects = (layoutEffectTraversalFlags & IncludeWorkInProgressEffects) !== NoLayoutEffectTraversalFlags; switch (finishedWork.tag) { case 0: case 11: case 15: recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, layoutEffectTraversalFlags); commitHookLayoutEffects(finishedWork, Layout); break; case 1: recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, layoutEffectTraversalFlags); current = finishedWork.stateNode; "function" === typeof current.componentDidMount && runWithFiberInDEV(finishedWork, callComponentDidMountInDEV, finishedWork, current); current = finishedWork.updateQueue; if (null !== current) { finishedRoot = finishedWork.stateNode; try { runWithFiberInDEV(finishedWork, commitHiddenCallbacks, current, finishedRoot); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } includeWorkInProgressEffects && flags & 64 && commitClassCallbacks(finishedWork); safelyAttachRef(finishedWork, finishedWork.return); break; case 27: supportsSingletons && (layoutEffectTraversalFlags & IncludeHostSingletons) !== NoLayoutEffectTraversalFlags && commitHostSingletonAcquisition(finishedWork); case 5: 5 !== finishedWork.tag && 27 !== finishedWork.tag || commitFragmentInstanceInsertionEffects(finishedWork); recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, layoutEffectTraversalFlags); includeWorkInProgressEffects && null === current && flags & 4 && commitHostMount(finishedWork); safelyAttachRef(finishedWork, finishedWork.return); break; case 6: commitFragmentInstanceInsertionEffects(finishedWork); break; case 26: if (supportsResources) { var instance = finishedWork.stateNode; null !== finishedWork.memoizedState || null === instance || offscreenSubtreeIsHidden || mountHoistable(getHoistableRoot(instance.ownerDocument), finishedWork.type, instance); } recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, layoutEffectTraversalFlags); includeWorkInProgressEffects && null === current && flags & 4 && commitHostMount(finishedWork); safelyAttachRef(finishedWork, finishedWork.return); break; case 12: if (includeWorkInProgressEffects && flags & 4) { flags = pushNestedEffectDurations(); recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, layoutEffectTraversalFlags); includeWorkInProgressEffects = finishedWork.stateNode; includeWorkInProgressEffects.effectDuration += bubbleNestedEffectDurations(flags); try { runWithFiberInDEV(finishedWork, commitProfiler, finishedWork, current, commitStartTime, includeWorkInProgressEffects.effectDuration); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } else recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, layoutEffectTraversalFlags); break; case 31: recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, layoutEffectTraversalFlags); includeWorkInProgressEffects && flags & 4 && commitActivityHydrationCallbacks(finishedRoot, finishedWork); break; case 13: recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, layoutEffectTraversalFlags); includeWorkInProgressEffects && flags & 4 && commitSuspenseHydrationCallbacks(finishedRoot, finishedWork); break; case 22: null === finishedWork.memoizedState && recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, layoutEffectTraversalFlags); safelyAttachRef(finishedWork, finishedWork.return); break; case 30: recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, layoutEffectTraversalFlags); flags & 18874368 && trackNamedViewTransition(finishedWork); safelyAttachRef(finishedWork, finishedWork.return); break; case 7: safelyAttachRef(finishedWork, finishedWork.return); default: recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, layoutEffectTraversalFlags); } (finishedWork.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && (componentEffectSpawnedUpdate || .05 < componentEffectDuration) && logComponentEffect(finishedWork, componentEffectStartTime, componentEffectEndTime, componentEffectDuration, componentEffectErrors); popComponentEffectStart(prevEffectStart); popComponentEffectDuration(prevEffectDuration); componentEffectErrors = prevEffectErrors; componentEffectSpawnedUpdate = prevEffectDidSpawnUpdate; } function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, layoutEffectTraversalFlags) { layoutEffectTraversalFlags = 0 !== (parentFiber.subtreeFlags & 8772) ? layoutEffectTraversalFlags : layoutEffectTraversalFlags & ~IncludeWorkInProgressEffects; for (parentFiber = parentFiber.child; null !== parentFiber;) reappearLayoutEffects(finishedRoot, parentFiber.alternate, parentFiber, layoutEffectTraversalFlags), parentFiber = parentFiber.sibling; } function commitOffscreenPassiveMountEffects(current, finishedWork) { var previousCache = null; null !== current && null !== current.memoizedState && null !== current.memoizedState.cachePool && (previousCache = current.memoizedState.cachePool.pool); current = null; null !== finishedWork.memoizedState && null !== finishedWork.memoizedState.cachePool && (current = finishedWork.memoizedState.cachePool.pool); current !== previousCache && (null != current && retainCache(current), null != previousCache && releaseCache(previousCache)); } function commitCachePassiveMountEffect(current, finishedWork) { current = null; null !== finishedWork.alternate && (current = finishedWork.alternate.memoizedState.cache); finishedWork = finishedWork.memoizedState.cache; finishedWork !== current && (retainCache(finishedWork), null != current && releaseCache(current)); } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions, endTime) { var isViewTransitionEligible = (committedLanes & 335544064) === committedLanes; if (parentFiber.subtreeFlags & (isViewTransitionEligible ? 10262 : 10256) || 0 !== parentFiber.actualDuration && (null === parentFiber.alternate || parentFiber.alternate.child !== parentFiber.child)) for (parentFiber = parentFiber.child; null !== parentFiber;) isViewTransitionEligible = parentFiber.sibling, commitPassiveMountOnFiber(root, parentFiber, committedLanes, committedTransitions, null !== isViewTransitionEligible ? isViewTransitionEligible.actualStartTime : endTime), parentFiber = isViewTransitionEligible; else isViewTransitionEligible && restoreNestedViewTransitions(parentFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime) { var prevEffectStart = pushComponentEffectStart(), prevEffectDuration = pushComponentEffectDuration(), prevEffectErrors = pushComponentEffectErrors(), prevEffectDidSpawnUpdate = pushComponentEffectDidSpawnUpdate(), prevDeepEquality = alreadyWarnedForDeepEquality, isViewTransitionEligible = (committedLanes & 335544064) === committedLanes; isViewTransitionEligible && null === finishedWork.alternate && null !== finishedWork.return && null !== finishedWork.return.alternate && restoreEnterOrExitViewTransitions(finishedWork); var flags = finishedWork.flags; switch (finishedWork.tag) { case 0: case 11: case 15: (finishedWork.mode & 2) !== NoMode && 0 < finishedWork.actualStartTime && 0 !== (finishedWork.flags & 1) && logComponentRender(finishedWork, finishedWork.actualStartTime, endTime, inHydratedSubtree, committedLanes); recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime); flags & 2048 && commitHookPassiveMountEffects(finishedWork, Passive | HasEffect); break; case 1: (finishedWork.mode & 2) !== NoMode && 0 < finishedWork.actualStartTime && (0 !== (finishedWork.flags & 128) ? logComponentErrored(finishedWork, finishedWork.actualStartTime, endTime, []) : 0 !== (finishedWork.flags & 1) && logComponentRender(finishedWork, finishedWork.actualStartTime, endTime, inHydratedSubtree, committedLanes)); recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime); break; case 3: var prevProfilerEffectDuration = pushNestedEffectDurations(), wasInHydratedSubtree = inHydratedSubtree; inHydratedSubtree = null !== finishedWork.alternate && finishedWork.alternate.memoizedState.isDehydrated && 0 === (finishedWork.flags & 256); recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime); inHydratedSubtree = wasInHydratedSubtree; isViewTransitionEligible && supportsMutation && rootViewTransitionNameCanceled && restoreRootViewTransitionName(finishedRoot.containerInfo); flags & 2048 && (committedLanes = null, null !== finishedWork.alternate && (committedLanes = finishedWork.alternate.memoizedState.cache), committedTransitions = finishedWork.memoizedState.cache, committedTransitions !== committedLanes && (retainCache(committedTransitions), null != committedLanes && releaseCache(committedLanes))); finishedRoot.passiveEffectDuration += popNestedEffectDurations(prevProfilerEffectDuration); break; case 12: if (flags & 2048) { flags = pushNestedEffectDurations(); recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime); finishedRoot = finishedWork.stateNode; finishedRoot.passiveEffectDuration += bubbleNestedEffectDurations(flags); try { runWithFiberInDEV(finishedWork, commitProfilerPostCommitImpl, finishedWork, finishedWork.alternate, commitStartTime, finishedRoot.passiveEffectDuration); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } else recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime); break; case 31: flags = inHydratedSubtree; isViewTransitionEligible = null !== finishedWork.alternate ? finishedWork.alternate.memoizedState : null; prevProfilerEffectDuration = finishedWork.memoizedState; null !== isViewTransitionEligible && null === prevProfilerEffectDuration ? (prevProfilerEffectDuration = finishedWork.deletions, null !== prevProfilerEffectDuration && 0 < prevProfilerEffectDuration.length && 18 === prevProfilerEffectDuration[0].tag ? (inHydratedSubtree = !1, isViewTransitionEligible = isViewTransitionEligible.hydrationErrors, null !== isViewTransitionEligible && logComponentErrored(finishedWork, finishedWork.actualStartTime, endTime, isViewTransitionEligible)) : inHydratedSubtree = !0) : inHydratedSubtree = !1; recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime); inHydratedSubtree = flags; break; case 13: flags = inHydratedSubtree; isViewTransitionEligible = null !== finishedWork.alternate ? finishedWork.alternate.memoizedState : null; prevProfilerEffectDuration = finishedWork.memoizedState; null === isViewTransitionEligible || null === isViewTransitionEligible.dehydrated || null !== prevProfilerEffectDuration && null !== prevProfilerEffectDuration.dehydrated ? inHydratedSubtree = !1 : (prevProfilerEffectDuration = finishedWork.deletions, null !== prevProfilerEffectDuration && 0 < prevProfilerEffectDuration.length && 18 === prevProfilerEffectDuration[0].tag ? (inHydratedSubtree = !1, isViewTransitionEligible = isViewTransitionEligible.hydrationErrors, null !== isViewTransitionEligible && logComponentErrored(finishedWork, finishedWork.actualStartTime, endTime, isViewTransitionEligible)) : inHydratedSubtree = !0); recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime); inHydratedSubtree = flags; break; case 23: break; case 22: wasInHydratedSubtree = finishedWork.stateNode; prevProfilerEffectDuration = finishedWork.alternate; null !== finishedWork.memoizedState ? (isViewTransitionEligible && null !== prevProfilerEffectDuration && null === prevProfilerEffectDuration.memoizedState && restoreEnterOrExitViewTransitions(prevProfilerEffectDuration), wasInHydratedSubtree._visibility & OffscreenPassiveEffectsConnected ? recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime) : recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime)) : (isViewTransitionEligible && null !== prevProfilerEffectDuration && null !== prevProfilerEffectDuration.memoizedState && restoreEnterOrExitViewTransitions(finishedWork), wasInHydratedSubtree._visibility & OffscreenPassiveEffectsConnected ? recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime) : (wasInHydratedSubtree._visibility |= OffscreenPassiveEffectsConnected, recursivelyTraverseReconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, 0 !== (finishedWork.subtreeFlags & 10256) || 0 !== finishedWork.actualDuration && (null === finishedWork.alternate || finishedWork.alternate.child !== finishedWork.child), endTime), (finishedWork.mode & 2) === NoMode || inHydratedSubtree || (finishedRoot = finishedWork.actualStartTime, 0 <= finishedRoot && .05 < endTime - finishedRoot && logComponentReappeared(finishedWork, finishedRoot, endTime), 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && .05 < componentEffectEndTime - componentEffectStartTime && logComponentReappeared(finishedWork, componentEffectStartTime, componentEffectEndTime)))); flags & 2048 && commitOffscreenPassiveMountEffects(prevProfilerEffectDuration, finishedWork); break; case 24: recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime); flags & 2048 && commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); break; case 30: isViewTransitionEligible && (flags = finishedWork.alternate, null !== flags && (restoreViewTransitionOnHostInstances(flags.child, !0), restoreViewTransitionOnHostInstances(finishedWork.child, !0))); recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime); break; default: recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime); } if ((finishedWork.mode & 2) !== NoMode) { if (finishedRoot = !inHydratedSubtree && null === finishedWork.alternate && null !== finishedWork.return && null !== finishedWork.return.alternate) committedLanes = finishedWork.actualStartTime, 0 <= committedLanes && .05 < endTime - committedLanes && logComponentTrigger(finishedWork, committedLanes, endTime, "Mount"); 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && ((componentEffectSpawnedUpdate || .05 < componentEffectDuration) && logComponentEffect(finishedWork, componentEffectStartTime, componentEffectEndTime, componentEffectDuration, componentEffectErrors), finishedRoot && .05 < componentEffectEndTime - componentEffectStartTime && logComponentTrigger(finishedWork, componentEffectStartTime, componentEffectEndTime, "Mount")); } popComponentEffectStart(prevEffectStart); popComponentEffectDuration(prevEffectDuration); componentEffectErrors = prevEffectErrors; componentEffectSpawnedUpdate = prevEffectDidSpawnUpdate; alreadyWarnedForDeepEquality = prevDeepEquality; } function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, committedLanes, committedTransitions, includeWorkInProgressEffects, endTime) { includeWorkInProgressEffects = includeWorkInProgressEffects && (0 !== (parentFiber.subtreeFlags & 10256) || 0 !== parentFiber.actualDuration && (null === parentFiber.alternate || parentFiber.alternate.child !== parentFiber.child)); for (parentFiber = parentFiber.child; null !== parentFiber;) { var nextSibling = parentFiber.sibling; reconnectPassiveEffects(finishedRoot, parentFiber, committedLanes, committedTransitions, includeWorkInProgressEffects, null !== nextSibling ? nextSibling.actualStartTime : endTime); parentFiber = nextSibling; } } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, includeWorkInProgressEffects, endTime) { var prevEffectStart = pushComponentEffectStart(), prevEffectDuration = pushComponentEffectDuration(), prevEffectErrors = pushComponentEffectErrors(), prevEffectDidSpawnUpdate = pushComponentEffectDidSpawnUpdate(), prevDeepEquality = alreadyWarnedForDeepEquality; includeWorkInProgressEffects && (finishedWork.mode & 2) !== NoMode && 0 < finishedWork.actualStartTime && 0 !== (finishedWork.flags & 1) && logComponentRender(finishedWork, finishedWork.actualStartTime, endTime, inHydratedSubtree, committedLanes); var flags = finishedWork.flags; switch (finishedWork.tag) { case 0: case 11: case 15: recursivelyTraverseReconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, includeWorkInProgressEffects, endTime); commitHookPassiveMountEffects(finishedWork, Passive); break; case 23: break; case 22: var _instance4 = finishedWork.stateNode; null !== finishedWork.memoizedState ? _instance4._visibility & OffscreenPassiveEffectsConnected ? recursivelyTraverseReconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, includeWorkInProgressEffects, endTime) : recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, endTime) : (_instance4._visibility |= OffscreenPassiveEffectsConnected, recursivelyTraverseReconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, includeWorkInProgressEffects, endTime)); includeWorkInProgressEffects && flags & 2048 && commitOffscreenPassiveMountEffects(finishedWork.alternate, finishedWork); break; case 24: recursivelyTraverseReconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, includeWorkInProgressEffects, endTime); includeWorkInProgressEffects && flags & 2048 && commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); break; default: recursivelyTraverseReconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, includeWorkInProgressEffects, endTime); } (finishedWork.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && (componentEffectSpawnedUpdate || .05 < componentEffectDuration) && logComponentEffect(finishedWork, componentEffectStartTime, componentEffectEndTime, componentEffectDuration, componentEffectErrors); popComponentEffectStart(prevEffectStart); popComponentEffectDuration(prevEffectDuration); componentEffectErrors = prevEffectErrors; componentEffectSpawnedUpdate = prevEffectDidSpawnUpdate; alreadyWarnedForDeepEquality = prevDeepEquality; } function recursivelyTraverseAtomicPassiveEffects(finishedRoot$jscomp$0, parentFiber, committedLanes$jscomp$0, committedTransitions$jscomp$0, endTime$jscomp$0) { if (parentFiber.subtreeFlags & 10256 || 0 !== parentFiber.actualDuration && (null === parentFiber.alternate || parentFiber.alternate.child !== parentFiber.child)) for (var child = parentFiber.child; null !== child;) { parentFiber = child.sibling; var finishedRoot = finishedRoot$jscomp$0, committedLanes = committedLanes$jscomp$0, committedTransitions = committedTransitions$jscomp$0, endTime = null !== parentFiber ? parentFiber.actualStartTime : endTime$jscomp$0, prevDeepEquality = alreadyWarnedForDeepEquality; (child.mode & 2) !== NoMode && 0 < child.actualStartTime && 0 !== (child.flags & 1) && logComponentRender(child, child.actualStartTime, endTime, inHydratedSubtree, committedLanes); var flags = child.flags; switch (child.tag) { case 22: recursivelyTraverseAtomicPassiveEffects(finishedRoot, child, committedLanes, committedTransitions, endTime); flags & 2048 && commitOffscreenPassiveMountEffects(child.alternate, child); break; case 24: recursivelyTraverseAtomicPassiveEffects(finishedRoot, child, committedLanes, committedTransitions, endTime); flags & 2048 && commitCachePassiveMountEffect(child.alternate, child); break; default: recursivelyTraverseAtomicPassiveEffects(finishedRoot, child, committedLanes, committedTransitions, endTime); } alreadyWarnedForDeepEquality = prevDeepEquality; child = parentFiber; } } function recursivelyAccumulateSuspenseyCommit(parentFiber, committedLanes, suspendedState) { if (parentFiber.subtreeFlags & suspenseyCommitFlag) for (parentFiber = parentFiber.child; null !== parentFiber;) accumulateSuspenseyCommitOnFiber(parentFiber, committedLanes, suspendedState), parentFiber = parentFiber.sibling; } function accumulateSuspenseyCommitOnFiber(fiber, committedLanes, suspendedState) { switch (fiber.tag) { case 26: recursivelyAccumulateSuspenseyCommit(fiber, committedLanes, suspendedState); if (fiber.flags & suspenseyCommitFlag) if (null !== fiber.memoizedState) suspendResource(suspendedState, currentHoistableRoot, fiber.memoizedState, fiber.memoizedProps); else { var instance = fiber.stateNode, type = fiber.type; fiber = fiber.memoizedProps; ((committedLanes & 335544128) === committedLanes || maySuspendCommitInSyncRender(type, fiber)) && suspendInstance(suspendedState, instance, type, fiber); } break; case 5: recursivelyAccumulateSuspenseyCommit(fiber, committedLanes, suspendedState); fiber.flags & suspenseyCommitFlag && (instance = fiber.stateNode, type = fiber.type, fiber = fiber.memoizedProps, ((committedLanes & 335544128) === committedLanes || maySuspendCommitInSyncRender(type, fiber)) && suspendInstance(suspendedState, instance, type, fiber)); break; case 3: case 4: supportsResources ? (instance = currentHoistableRoot, currentHoistableRoot = getHoistableRoot(fiber.stateNode.containerInfo), recursivelyAccumulateSuspenseyCommit(fiber, committedLanes, suspendedState), currentHoistableRoot = instance) : recursivelyAccumulateSuspenseyCommit(fiber, committedLanes, suspendedState); break; case 22: null === fiber.memoizedState && (instance = fiber.alternate, null !== instance && null !== instance.memoizedState ? (instance = suspenseyCommitFlag, suspenseyCommitFlag = 16777216, recursivelyAccumulateSuspenseyCommit(fiber, committedLanes, suspendedState), suspenseyCommitFlag = instance) : recursivelyAccumulateSuspenseyCommit(fiber, committedLanes, suspendedState)); break; case 30: 0 !== (fiber.flags & suspenseyCommitFlag) && (instance = fiber.memoizedProps.name, null != instance && "auto" !== instance && (type = fiber.stateNode, type.paired = null, null === appearingViewTransitions && (appearingViewTransitions = /* @__PURE__ */ new Map()), appearingViewTransitions.set(instance, type))); recursivelyAccumulateSuspenseyCommit(fiber, committedLanes, suspendedState); break; default: recursivelyAccumulateSuspenseyCommit(fiber, committedLanes, suspendedState); } } function detachAlternateSiblings(parentFiber) { var previousFiber = parentFiber.alternate; if (null !== previousFiber && (parentFiber = previousFiber.child, null !== parentFiber)) { previousFiber.child = null; do previousFiber = parentFiber.sibling, parentFiber.sibling = null, parentFiber = previousFiber; while (null !== parentFiber); } } function recursivelyTraversePassiveUnmountEffects(parentFiber) { var deletions = parentFiber.deletions; if (0 !== (parentFiber.flags & 16)) { if (null !== deletions) for (var i = 0; i < deletions.length; i++) { var childToDelete = deletions[i], prevEffectStart = pushComponentEffectStart(); nextEffect = childToDelete; commitPassiveUnmountEffectsInsideOfDeletedTree_begin(childToDelete, parentFiber); (childToDelete.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && .05 < componentEffectEndTime - componentEffectStartTime && logComponentTrigger(childToDelete, componentEffectStartTime, componentEffectEndTime, "Unmount"); popComponentEffectStart(prevEffectStart); } detachAlternateSiblings(parentFiber); } if (parentFiber.subtreeFlags & 10256) for (parentFiber = parentFiber.child; null !== parentFiber;) commitPassiveUnmountOnFiber(parentFiber), parentFiber = parentFiber.sibling; } function commitPassiveUnmountOnFiber(finishedWork) { var prevEffectStart = pushComponentEffectStart(), prevEffectDuration = pushComponentEffectDuration(), prevEffectErrors = pushComponentEffectErrors(), prevEffectDidSpawnUpdate = pushComponentEffectDidSpawnUpdate(); switch (finishedWork.tag) { case 0: case 11: case 15: recursivelyTraversePassiveUnmountEffects(finishedWork); finishedWork.flags & 2048 && commitHookPassiveUnmountEffects(finishedWork, finishedWork.return, Passive | HasEffect); break; case 3: var prevProfilerEffectDuration = pushNestedEffectDurations(); recursivelyTraversePassiveUnmountEffects(finishedWork); finishedWork.stateNode.passiveEffectDuration += popNestedEffectDurations(prevProfilerEffectDuration); break; case 12: prevProfilerEffectDuration = pushNestedEffectDurations(); recursivelyTraversePassiveUnmountEffects(finishedWork); finishedWork.stateNode.passiveEffectDuration += bubbleNestedEffectDurations(prevProfilerEffectDuration); break; case 22: prevProfilerEffectDuration = finishedWork.stateNode; null !== finishedWork.memoizedState && prevProfilerEffectDuration._visibility & OffscreenPassiveEffectsConnected && (null === finishedWork.return || 13 !== finishedWork.return.tag) ? (prevProfilerEffectDuration._visibility &= ~OffscreenPassiveEffectsConnected, recursivelyTraverseDisconnectPassiveEffects(finishedWork), (finishedWork.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && .05 < componentEffectEndTime - componentEffectStartTime && logComponentTrigger(finishedWork, componentEffectStartTime, componentEffectEndTime, "Disconnect")) : recursivelyTraversePassiveUnmountEffects(finishedWork); break; default: recursivelyTraversePassiveUnmountEffects(finishedWork); } (finishedWork.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && (componentEffectSpawnedUpdate || .05 < componentEffectDuration) && logComponentEffect(finishedWork, componentEffectStartTime, componentEffectEndTime, componentEffectDuration, componentEffectErrors); popComponentEffectStart(prevEffectStart); popComponentEffectDuration(prevEffectDuration); componentEffectSpawnedUpdate = prevEffectDidSpawnUpdate; componentEffectErrors = prevEffectErrors; } function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { var deletions = parentFiber.deletions; if (0 !== (parentFiber.flags & 16)) { if (null !== deletions) for (var i = 0; i < deletions.length; i++) { var childToDelete = deletions[i], prevEffectStart = pushComponentEffectStart(); nextEffect = childToDelete; commitPassiveUnmountEffectsInsideOfDeletedTree_begin(childToDelete, parentFiber); (childToDelete.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && .05 < componentEffectEndTime - componentEffectStartTime && logComponentTrigger(childToDelete, componentEffectStartTime, componentEffectEndTime, "Unmount"); popComponentEffectStart(prevEffectStart); } detachAlternateSiblings(parentFiber); } for (parentFiber = parentFiber.child; null !== parentFiber;) disconnectPassiveEffect(parentFiber), parentFiber = parentFiber.sibling; } function disconnectPassiveEffect(finishedWork) { var prevEffectStart = pushComponentEffectStart(), prevEffectDuration = pushComponentEffectDuration(), prevEffectErrors = pushComponentEffectErrors(), prevEffectDidSpawnUpdate = pushComponentEffectDidSpawnUpdate(); switch (finishedWork.tag) { case 0: case 11: case 15: commitHookPassiveUnmountEffects(finishedWork, finishedWork.return, Passive); recursivelyTraverseDisconnectPassiveEffects(finishedWork); break; case 22: var instance = finishedWork.stateNode; instance._visibility & OffscreenPassiveEffectsConnected && (instance._visibility &= ~OffscreenPassiveEffectsConnected, recursivelyTraverseDisconnectPassiveEffects(finishedWork)); break; default: recursivelyTraverseDisconnectPassiveEffects(finishedWork); } (finishedWork.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && (componentEffectSpawnedUpdate || .05 < componentEffectDuration) && logComponentEffect(finishedWork, componentEffectStartTime, componentEffectEndTime, componentEffectDuration, componentEffectErrors); popComponentEffectStart(prevEffectStart); popComponentEffectDuration(prevEffectDuration); componentEffectSpawnedUpdate = prevEffectDidSpawnUpdate; componentEffectErrors = prevEffectErrors; } function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot, nearestMountedAncestor$jscomp$0) { for (; null !== nextEffect;) { var fiber = nextEffect, current = fiber, nearestMountedAncestor = nearestMountedAncestor$jscomp$0, prevEffectStart = pushComponentEffectStart(), prevEffectDuration = pushComponentEffectDuration(), prevEffectErrors = pushComponentEffectErrors(), prevEffectDidSpawnUpdate = pushComponentEffectDidSpawnUpdate(); switch (current.tag) { case 0: case 11: case 15: commitHookPassiveUnmountEffects(current, nearestMountedAncestor, Passive); break; case 23: case 22: null !== current.memoizedState && null !== current.memoizedState.cachePool && (nearestMountedAncestor = current.memoizedState.cachePool.pool, null != nearestMountedAncestor && retainCache(nearestMountedAncestor)); break; case 24: releaseCache(current.memoizedState.cache); } (current.mode & 2) !== NoMode && 0 <= componentEffectStartTime && 0 <= componentEffectEndTime && (componentEffectSpawnedUpdate || .05 < componentEffectDuration) && logComponentEffect(current, componentEffectStartTime, componentEffectEndTime, componentEffectDuration, componentEffectErrors); popComponentEffectStart(prevEffectStart); popComponentEffectDuration(prevEffectDuration); componentEffectSpawnedUpdate = prevEffectDidSpawnUpdate; componentEffectErrors = prevEffectErrors; current = fiber.child; if (null !== current) current.return = fiber, nextEffect = current; else a: for (fiber = deletedSubtreeRoot; null !== nextEffect;) { current = nextEffect; prevEffectStart = current.sibling; prevEffectDuration = current.return; detachFiberAfterEffects(current); if (current === fiber) { nextEffect = null; break a; } if (null !== prevEffectStart) { prevEffectStart.return = prevEffectDuration; nextEffect = prevEffectStart; break a; } nextEffect = prevEffectDuration; } } } function findFiberRootForHostRoot(hostRoot) { var maybeFiber = getInstanceFromNode(hostRoot); if (null != maybeFiber) { if ("string" !== typeof maybeFiber.memoizedProps["data-testname"]) throw Error("Invalid host root specified. Should be either a React container or a node with a testname attribute."); return maybeFiber; } hostRoot = findFiberRoot(hostRoot); if (null === hostRoot) throw Error("Could not find React container within specified host subtree."); return hostRoot.stateNode.current; } function matchSelector(fiber$jscomp$0, selector) { var tag = fiber$jscomp$0.tag; switch (selector.$$typeof) { case COMPONENT_TYPE: if (fiber$jscomp$0.type === selector.value) return !0; break; case HAS_PSEUDO_CLASS_TYPE: a: { selector = selector.value; fiber$jscomp$0 = [fiber$jscomp$0, 0]; for (tag = 0; tag < fiber$jscomp$0.length;) { var fiber = fiber$jscomp$0[tag++], tag$jscomp$0 = fiber.tag, selectorIndex = fiber$jscomp$0[tag++], selector$jscomp$0 = selector[selectorIndex]; if (5 !== tag$jscomp$0 && 26 !== tag$jscomp$0 && 27 !== tag$jscomp$0 || !isHiddenSubtree(fiber)) { for (; null != selector$jscomp$0 && matchSelector(fiber, selector$jscomp$0);) selectorIndex++, selector$jscomp$0 = selector[selectorIndex]; if (selectorIndex === selector.length) { selector = !0; break a; } else for (fiber = fiber.child; null !== fiber;) fiber$jscomp$0.push(fiber, selectorIndex), fiber = fiber.sibling; } } selector = !1; } return selector; case ROLE_TYPE: if ((5 === tag || 26 === tag || 27 === tag) && matchAccessibilityRole(fiber$jscomp$0.stateNode, selector.value)) return !0; break; case TEXT_TYPE: if (5 === tag || 6 === tag || 26 === tag || 27 === tag) { if (fiber$jscomp$0 = getTextContent(fiber$jscomp$0), null !== fiber$jscomp$0 && 0 <= fiber$jscomp$0.indexOf(selector.value)) return !0; } break; case TEST_NAME_TYPE: if (5 === tag || 26 === tag || 27 === tag) { if (fiber$jscomp$0 = fiber$jscomp$0.memoizedProps["data-testname"], "string" === typeof fiber$jscomp$0 && fiber$jscomp$0.toLowerCase() === selector.value.toLowerCase()) return !0; } break; default: throw Error("Invalid selector type specified."); } return !1; } function selectorToString(selector) { switch (selector.$$typeof) { case COMPONENT_TYPE: return "<" + (getComponentNameFromType(selector.value) || "Unknown") + ">"; case HAS_PSEUDO_CLASS_TYPE: return ":has(" + (selectorToString(selector) || "") + ")"; case ROLE_TYPE: return "[role=\"" + selector.value + "\"]"; case TEXT_TYPE: return "\"" + selector.value + "\""; case TEST_NAME_TYPE: return "[data-testname=\"" + selector.value + "\"]"; default: throw Error("Invalid selector type specified."); } } function findPaths(root, selectors) { var matchingFibers = []; root = [root, 0]; for (var index = 0; index < root.length;) { var fiber = root[index++], tag = fiber.tag, selectorIndex = root[index++], selector = selectors[selectorIndex]; if (5 !== tag && 26 !== tag && 27 !== tag || !isHiddenSubtree(fiber)) { for (; null != selector && matchSelector(fiber, selector);) selectorIndex++, selector = selectors[selectorIndex]; if (selectorIndex === selectors.length) matchingFibers.push(fiber); else for (fiber = fiber.child; null !== fiber;) root.push(fiber, selectorIndex), fiber = fiber.sibling; } } return matchingFibers; } function findAllNodes(hostRoot, selectors) { if (!supportsTestSelectors) throw Error("Test selector API is not supported by this renderer."); hostRoot = findFiberRootForHostRoot(hostRoot); hostRoot = findPaths(hostRoot, selectors); selectors = []; hostRoot = Array.from(hostRoot); for (var index = 0; index < hostRoot.length;) { var node = hostRoot[index++], tag = node.tag; if (5 === tag || 26 === tag || 27 === tag) isHiddenSubtree(node) || selectors.push(node.stateNode); else for (node = node.child; null !== node;) hostRoot.push(node), node = node.sibling; } return selectors; } function onCommitRoot() { supportsTestSelectors && commitHooks.forEach(function(commitHook) { return commitHook(); }); } function isConcurrentActEnvironment() { var isReactActEnvironmentGlobal = "undefined" !== typeof IS_REACT_ACT_ENVIRONMENT ? IS_REACT_ACT_ENVIRONMENT : void 0; isReactActEnvironmentGlobal || null === ReactSharedInternals.actQueue || console.error("The current testing environment is not configured to support act(...)"); return isReactActEnvironmentGlobal; } function requestUpdateLane(fiber) { if ((executionContext & RenderContext) !== NoContext && 0 !== workInProgressRootRenderLanes) return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; var transition = ReactSharedInternals.T; if (null !== transition) return transition._updatedFibers || (transition._updatedFibers = /* @__PURE__ */ new Set()), transition._updatedFibers.add(fiber), null !== lastSuspendedFiber && 2 === resolveUpdatePriority() && (lastSuspendedFiber = null), requestTransitionLane(); fiber = resolveUpdatePriority(); 2 === fiber && (lastSuspendedFiber = null); return fiber; } function requestDeferredLane() { if (0 === workInProgressDeferredLane) if (0 === (workInProgressRootRenderLanes & 536870912) || isHydrating) { var lane = nextTransitionDeferredLane; nextTransitionDeferredLane <<= 1; 0 === (nextTransitionDeferredLane & 3932160) && (nextTransitionDeferredLane = 262144); workInProgressDeferredLane = lane; } else workInProgressDeferredLane = 536870912; lane = suspenseHandlerStackCursor.current; null !== lane && (lane.flags |= 32); return workInProgressDeferredLane; } function scheduleViewTransitionEvent(fiber, callback) { if (null != callback) { var state = fiber.stateNode, instance = state.ref; null === instance && (instance = state.ref = createViewTransitionInstance(getViewTransitionName(fiber.memoizedProps, state))); null === pendingViewTransitionEvents && (pendingViewTransitionEvents = []); pendingViewTransitionEvents.push(callback.bind(null, instance)); } } function scheduleUpdateOnFiber(root, fiber, lane) { isRunningInsertionEffect && console.error("useInsertionEffect must not schedule updates."); isFlushingPassiveEffects && (didScheduleUpdateDuringPassiveEffects = !0); if (root === workInProgressRoot && (workInProgressSuspendedReason === SuspendedOnData || workInProgressSuspendedReason === SuspendedOnAction) || null !== root.cancelPendingCommit) prepareFreshStack(root, 0), markRootSuspended(root, workInProgressRootRenderLanes, workInProgressDeferredLane, !1); markRootUpdated$1(root, lane); if ((executionContext & RenderContext) !== NoContext && root === workInProgressRoot) { if (isRendering) switch (fiber.tag) { case 0: case 11: case 15: root = workInProgress && getComponentNameFromFiber(workInProgress) || "Unknown"; didWarnAboutUpdateInRenderForAnotherComponent.has(root) || (didWarnAboutUpdateInRenderForAnotherComponent.add(root), fiber = getComponentNameFromFiber(fiber) || "Unknown", console.error("Cannot update a component (`%s`) while rendering a different component (`%s`). To locate the bad setState() call inside `%s`, follow the stack trace as described in https://react.dev/link/setstate-in-render", fiber, root, root)); break; case 1: didWarnAboutUpdateInRender || (console.error("Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state."), didWarnAboutUpdateInRender = !0); } } else isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), warnIfUpdatesNotWrappedWithActDEV(fiber), root === workInProgressRoot && ((executionContext & RenderContext) === NoContext && (workInProgressRootInterleavedUpdatedLanes |= lane), workInProgressRootExitStatus === RootSuspendedWithDelay && markRootSuspended(root, workInProgressRootRenderLanes, workInProgressDeferredLane, !1)), ensureRootIsScheduled(root); } function performWorkOnRoot(root, lanes, forceSync) { if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); if (0 !== workInProgressRootRenderLanes && null !== workInProgress) { var yieldedFiber = workInProgress, yieldEndTime = now$1(); switch (yieldReason) { case SuspendedOnImmediate: case SuspendedOnData: var startTime = yieldStartTime; supportsUserTiming && ((yieldedFiber = yieldedFiber._debugTask) ? yieldedFiber.run(console.timeStamp.bind(console, "Suspended", startTime, yieldEndTime, "Components âš›", void 0, "primary-light")) : console.timeStamp("Suspended", startTime, yieldEndTime, "Components âš›", void 0, "primary-light")); break; case SuspendedOnAction: startTime = yieldStartTime; supportsUserTiming && ((yieldedFiber = yieldedFiber._debugTask) ? yieldedFiber.run(console.timeStamp.bind(console, "Action", startTime, yieldEndTime, "Components âš›", void 0, "primary-light")) : console.timeStamp("Action", startTime, yieldEndTime, "Components âš›", void 0, "primary-light")); break; default: supportsUserTiming && (yieldedFiber = yieldEndTime - yieldStartTime, 3 > yieldedFiber || console.timeStamp("Blocked", yieldStartTime, yieldEndTime, "Components âš›", void 0, 5 > yieldedFiber ? "primary-light" : 10 > yieldedFiber ? "primary" : 100 > yieldedFiber ? "primary-dark" : "error")); } } startTime = (forceSync = !forceSync && 0 === (lanes & 127) && 0 === (lanes & root.expiredLanes) || checkIfRootIsPrerendering(root, lanes)) ? renderRootConcurrent(root, lanes) : renderRootSync(root, lanes, !0); var renderWasConcurrent = forceSync; do { if (startTime === RootInProgress) { workInProgressRootIsPrerendering && !forceSync && markRootSuspended(root, lanes, 0, !1); lanes = workInProgressSuspendedReason; yieldStartTime = now(); yieldReason = lanes; break; } else { yieldedFiber = now$1(); yieldEndTime = root.current.alternate; if (renderWasConcurrent && !isRenderConsistentWithExternalStores(yieldEndTime)) { setCurrentTrackFromLanes(lanes); yieldEndTime = renderStartTime; startTime = yieldedFiber; !supportsUserTiming || startTime <= yieldEndTime || (workInProgressUpdateTask ? workInProgressUpdateTask.run(console.timeStamp.bind(console, "Teared Render", yieldEndTime, startTime, currentTrack, "Scheduler âš›", "error")) : console.timeStamp("Teared Render", yieldEndTime, startTime, currentTrack, "Scheduler âš›", "error")); finalizeRender(lanes, yieldedFiber); startTime = renderRootSync(root, lanes, !1); renderWasConcurrent = !1; continue; } if (startTime === RootErrored) { renderWasConcurrent = lanes; if (root.errorRecoveryDisabledLanes & renderWasConcurrent) var errorRetryLanes = 0; else errorRetryLanes = root.pendingLanes & -536870913, errorRetryLanes = 0 !== errorRetryLanes ? errorRetryLanes : errorRetryLanes & 536870912 ? 536870912 : 0; if (0 !== errorRetryLanes) { setCurrentTrackFromLanes(lanes); logErroredRenderPhase(renderStartTime, yieldedFiber, lanes, workInProgressUpdateTask); finalizeRender(lanes, yieldedFiber); lanes = errorRetryLanes; a: { yieldedFiber = root; startTime = renderWasConcurrent; renderWasConcurrent = workInProgressRootConcurrentErrors; var wasRootDehydrated = supportsHydration && yieldedFiber.current.memoizedState.isDehydrated; wasRootDehydrated && (prepareFreshStack(yieldedFiber, errorRetryLanes).flags |= 256); errorRetryLanes = renderRootSync(yieldedFiber, errorRetryLanes, !1); if (errorRetryLanes !== RootErrored && errorRetryLanes !== RootSuspendedAtTheShell) { if (workInProgressRootDidAttachPingListener && !wasRootDehydrated) { yieldedFiber.errorRecoveryDisabledLanes |= startTime; workInProgressRootInterleavedUpdatedLanes |= startTime; startTime = RootSuspendedWithDelay; break a; } yieldedFiber = workInProgressRootRecoverableErrors; workInProgressRootRecoverableErrors = renderWasConcurrent; null !== yieldedFiber && (null === workInProgressRootRecoverableErrors ? workInProgressRootRecoverableErrors = yieldedFiber : workInProgressRootRecoverableErrors.push.apply(workInProgressRootRecoverableErrors, yieldedFiber)); } startTime = errorRetryLanes; } renderWasConcurrent = !1; if (startTime !== RootErrored) continue; else yieldedFiber = now$1(); } } if (startTime === RootFatalErrored) { setCurrentTrackFromLanes(lanes); logErroredRenderPhase(renderStartTime, yieldedFiber, lanes, workInProgressUpdateTask); finalizeRender(lanes, yieldedFiber); prepareFreshStack(root, 0); markRootSuspended(root, lanes, 0, !0); break; } a: { forceSync = root; switch (startTime) { case RootInProgress: case RootFatalErrored: throw Error("Root did not complete. This is a bug in React."); case RootSuspendedWithDelay: if ((lanes & 4194048) !== lanes && (lanes & 62914560) !== lanes) break; case RootSuspendedAtTheShell: setCurrentTrackFromLanes(lanes); logSuspendedRenderPhase(renderStartTime, yieldedFiber, lanes, workInProgressUpdateTask); finalizeRender(lanes, yieldedFiber); yieldEndTime = lanes; 0 !== (yieldEndTime & 127) ? blockingSuspendedTime = yieldedFiber : 0 !== (yieldEndTime & 4194048) && (transitionSuspendedTime = yieldedFiber); markRootSuspended(forceSync, lanes, workInProgressDeferredLane, !workInProgressRootDidSkipSuspendedSiblings); break a; case RootErrored: workInProgressRootRecoverableErrors = null; break; case RootSuspended: case RootCompleted: break; default: throw Error("Unknown root exit status."); } if (null !== ReactSharedInternals.actQueue) completeRoot(forceSync, yieldEndTime, lanes, workInProgressRootRecoverableErrors, workInProgressTransitions, workInProgressRootDidIncludeRecursiveRenderUpdate, workInProgressDeferredLane, workInProgressRootInterleavedUpdatedLanes, workInProgressSuspendedRetryLanes, workInProgressRootDidSkipSuspendedSiblings, startTime, null, null, renderStartTime, yieldedFiber); else { if ((lanes & 62914560) === lanes && (renderWasConcurrent = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now$1(), 10 < renderWasConcurrent)) { markRootSuspended(forceSync, lanes, workInProgressDeferredLane, !workInProgressRootDidSkipSuspendedSiblings); if (0 !== getNextLanes(forceSync, 0, !0)) break a; pendingEffectsLanes = lanes; forceSync.timeoutHandle = scheduleTimeout(completeRootWhenReady.bind(null, forceSync, yieldEndTime, workInProgressRootRecoverableErrors, workInProgressTransitions, workInProgressRootDidIncludeRecursiveRenderUpdate, lanes, workInProgressDeferredLane, workInProgressRootInterleavedUpdatedLanes, workInProgressSuspendedRetryLanes, workInProgressRootDidSkipSuspendedSiblings, startTime, "Throttled", renderStartTime, yieldedFiber), renderWasConcurrent); break a; } completeRootWhenReady(forceSync, yieldEndTime, workInProgressRootRecoverableErrors, workInProgressTransitions, workInProgressRootDidIncludeRecursiveRenderUpdate, lanes, workInProgressDeferredLane, workInProgressRootInterleavedUpdatedLanes, workInProgressSuspendedRetryLanes, workInProgressRootDidSkipSuspendedSiblings, startTime, null, renderStartTime, yieldedFiber); } } } break; } while (1); ensureRootIsScheduled(root); } function completeRootWhenReady(root, finishedWork, recoverableErrors, transitions, didIncludeRenderPhaseUpdate, lanes, spawnedLane, updatedLanes, suspendedRetryLanes, didSkipSuspendedSiblings, exitStatus, suspendedCommitReason, completedRenderStartTime, completedRenderEndTime) { root.timeoutHandle = noTimeout; var subtreeFlags = finishedWork.subtreeFlags, isViewTransitionEligible = (lanes & 335544064) === lanes, suspendedState = null; if (isViewTransitionEligible || subtreeFlags & 8192 || 16785408 === (subtreeFlags & 16785408)) { if (suspendedState = startSuspendingCommit(), appearingViewTransitions = null, accumulateSuspenseyCommitOnFiber(finishedWork, lanes, suspendedState), isViewTransitionEligible && suspendOnActiveViewTransition(suspendedState, root.containerInfo), subtreeFlags = (lanes & 62914560) === lanes ? globalMostRecentFallbackTime - now$1() : (lanes & 4194048) === lanes ? globalMostRecentTransitionTime - now$1() : 0, subtreeFlags = waitForCommitToBeReady(suspendedState, subtreeFlags), null !== subtreeFlags) { pendingEffectsLanes = lanes; root.cancelPendingCommit = subtreeFlags(completeRoot.bind(null, root, finishedWork, lanes, recoverableErrors, transitions, didIncludeRenderPhaseUpdate, spawnedLane, updatedLanes, suspendedRetryLanes, didSkipSuspendedSiblings, exitStatus, suspendedState, getSuspendedCommitReason(suspendedState, root.containerInfo), completedRenderStartTime, completedRenderEndTime)); markRootSuspended(root, lanes, spawnedLane, !didSkipSuspendedSiblings); return; } } completeRoot(root, finishedWork, lanes, recoverableErrors, transitions, didIncludeRenderPhaseUpdate, spawnedLane, updatedLanes, suspendedRetryLanes, didSkipSuspendedSiblings, exitStatus, suspendedState, suspendedCommitReason, completedRenderStartTime, completedRenderEndTime); } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork;;) { var tag = node.tag; if ((0 === tag || 11 === tag || 15 === tag) && node.flags & 16384 && (tag = node.updateQueue, null !== tag && (tag = tag.stores, null !== tag))) for (var i = 0; i < tag.length; i++) { var check = tag[i], getSnapshot = check.getSnapshot; check = check.value; try { if (!objectIs(getSnapshot(), check)) return !1; } catch (error) { return !1; } } tag = node.child; if (node.subtreeFlags & 16384 && null !== tag) tag.return = node, node = tag; else { if (node === finishedWork) break; for (; null === node.sibling;) { if (null === node.return || node.return === finishedWork) return !0; node = node.return; } node.sibling.return = node.return; node = node.sibling; } } return !0; } function markRootSuspended(root, suspendedLanes, spawnedLane, didAttemptEntireTree) { suspendedLanes = getEntangledLanes(root, suspendedLanes); suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; didAttemptEntireTree && (root.warmLanes |= suspendedLanes); didAttemptEntireTree = root.expirationTimes; for (var lanes = suspendedLanes; 0 < lanes;) { var index = 31 - clz32(lanes), lane = 1 << index; didAttemptEntireTree[index] = -1; lanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } function flushSyncWork() { return (executionContext & (RenderContext | CommitContext)) === NoContext ? (flushSyncWorkAcrossRoots_impl(0, !1), !1) : !0; } function isAlreadyRendering() { return (executionContext & (RenderContext | CommitContext)) !== NoContext; } function resetWorkInProgressStack() { if (null !== workInProgress) { if (workInProgressSuspendedReason === NotSuspended) var interruptedWork = workInProgress.return; else interruptedWork = workInProgress, resetContextDependencies(), resetHooksOnUnwind(interruptedWork), thenableState$1 = null, thenableIndexCounter$1 = 0, interruptedWork = workInProgress; for (; null !== interruptedWork;) unwindInterruptedWork(interruptedWork.alternate, interruptedWork), interruptedWork = interruptedWork.return; workInProgress = null; } } function finalizeRender(lanes, finalizationTime) { 0 !== (lanes & 127) && (blockingClampTime = finalizationTime); 0 !== (lanes & 4194048) && (transitionClampTime = finalizationTime); 0 !== (lanes & 62914560) && (retryClampTime = finalizationTime); 0 !== (lanes & 2080374784) && (idleClampTime = finalizationTime); } function prepareFreshStack(root, lanes) { supportsUserTiming && (console.timeStamp("Blocking Track", .003, .003, "Blocking", "Scheduler âš›", "primary-light"), console.timeStamp("Transition Track", .003, .003, "Transition", "Scheduler âš›", "primary-light"), console.timeStamp("Suspense Track", .003, .003, "Suspense", "Scheduler âš›", "primary-light"), console.timeStamp("Idle Track", .003, .003, "Idle", "Scheduler âš›", "primary-light")); var previousRenderStartTime = renderStartTime; renderStartTime = now(); if (0 !== workInProgressRootRenderLanes && 0 < previousRenderStartTime) { setCurrentTrackFromLanes(workInProgressRootRenderLanes); if (workInProgressRootExitStatus === RootSuspended || workInProgressRootExitStatus === RootSuspendedWithDelay) logSuspendedRenderPhase(previousRenderStartTime, renderStartTime, lanes, workInProgressUpdateTask); else { var endTime = renderStartTime, debugTask = workInProgressUpdateTask; if (supportsUserTiming && !(endTime <= previousRenderStartTime)) { var color = (lanes & 738197653) === lanes ? "tertiary-dark" : "primary-dark", label = (lanes & 536870912) === lanes ? "Prewarm" : (lanes & 201326741) === lanes ? "Interrupted Hydration" : "Interrupted Render"; debugTask ? debugTask.run(console.timeStamp.bind(console, label, previousRenderStartTime, endTime, currentTrack, "Scheduler âš›", color)) : console.timeStamp(label, previousRenderStartTime, endTime, currentTrack, "Scheduler âš›", color); } } finalizeRender(workInProgressRootRenderLanes, renderStartTime); } previousRenderStartTime = workInProgressUpdateTask; workInProgressUpdateTask = null; if (0 !== (lanes & 127)) { workInProgressUpdateTask = blockingUpdateTask; debugTask = 0 <= blockingUpdateTime && blockingUpdateTime < blockingClampTime ? blockingClampTime : blockingUpdateTime; endTime = 0 <= blockingEventTime && blockingEventTime < blockingClampTime ? blockingClampTime : blockingEventTime; color = 0 <= endTime ? endTime : 0 <= debugTask ? debugTask : renderStartTime; 0 <= blockingSuspendedTime ? (setCurrentTrackFromLanes(2), logSuspendedWithDelayPhase(blockingSuspendedTime, color, lanes, previousRenderStartTime)) : 0 !== (animatingLanes & 127) && (setCurrentTrackFromLanes(2), logAnimatingPhase(blockingClampTime, color, animatingTask)); previousRenderStartTime = debugTask; var eventTime = endTime, eventType = blockingEventType, eventIsRepeat = 0 < blockingEventRepeatTime, isSpawnedUpdate = 1 === blockingUpdateType, isPingedUpdate = 2 === blockingUpdateType; debugTask = renderStartTime; endTime = blockingUpdateTask; color = blockingUpdateMethodName; label = blockingUpdateComponentName; if (supportsUserTiming) { currentTrack = "Blocking"; 0 < previousRenderStartTime ? previousRenderStartTime > debugTask && (previousRenderStartTime = debugTask) : previousRenderStartTime = debugTask; 0 < eventTime ? eventTime > previousRenderStartTime && (eventTime = previousRenderStartTime) : eventTime = previousRenderStartTime; if (null !== eventType && previousRenderStartTime > eventTime) { var color$jscomp$0 = eventIsRepeat ? "secondary-light" : "warning"; endTime ? endTime.run(console.timeStamp.bind(console, eventIsRepeat ? "Consecutive" : "Event: " + eventType, eventTime, previousRenderStartTime, currentTrack, "Scheduler âš›", color$jscomp$0)) : console.timeStamp(eventIsRepeat ? "Consecutive" : "Event: " + eventType, eventTime, previousRenderStartTime, currentTrack, "Scheduler âš›", color$jscomp$0); } debugTask > previousRenderStartTime && (eventTime = isSpawnedUpdate ? "error" : (lanes & 738197653) === lanes ? "tertiary-light" : "primary-light", isSpawnedUpdate = isPingedUpdate ? "Promise Resolved" : isSpawnedUpdate ? "Cascading Update" : 5 < debugTask - previousRenderStartTime ? "Update Blocked" : "Update", isPingedUpdate = [], null != label && isPingedUpdate.push(["Component name", label]), null != color && isPingedUpdate.push(["Method name", color]), previousRenderStartTime = { start: previousRenderStartTime, end: debugTask, detail: { devtools: { properties: isPingedUpdate, track: currentTrack, trackGroup: "Scheduler âš›", color: eventTime } } }, endTime ? endTime.run(performance.measure.bind(performance, isSpawnedUpdate, previousRenderStartTime)) : performance.measure(isSpawnedUpdate, previousRenderStartTime), performance.clearMeasures(isSpawnedUpdate)); } blockingUpdateTime = -1.1; blockingUpdateType = 0; blockingUpdateComponentName = blockingUpdateMethodName = null; blockingSuspendedTime = -1.1; blockingEventRepeatTime = blockingEventTime; blockingEventTime = -1.1; blockingClampTime = now(); } 0 !== (lanes & 4194048) && (workInProgressUpdateTask = transitionUpdateTask, debugTask = 0 <= transitionStartTime && transitionStartTime < transitionClampTime ? transitionClampTime : transitionStartTime, previousRenderStartTime = 0 <= transitionUpdateTime && transitionUpdateTime < transitionClampTime ? transitionClampTime : transitionUpdateTime, endTime = 0 <= transitionEventTime && transitionEventTime < transitionClampTime ? transitionClampTime : transitionEventTime, color = 0 <= endTime ? endTime : 0 <= previousRenderStartTime ? previousRenderStartTime : renderStartTime, 0 <= transitionSuspendedTime ? (setCurrentTrackFromLanes(256), logSuspendedWithDelayPhase(transitionSuspendedTime, color, lanes, workInProgressUpdateTask)) : 0 !== (animatingLanes & 4194048) && (setCurrentTrackFromLanes(256), logAnimatingPhase(transitionClampTime, color, animatingTask)), isPingedUpdate = endTime, eventTime = transitionEventType, eventType = 0 < transitionEventRepeatTime, eventIsRepeat = 2 === transitionUpdateType, color = renderStartTime, endTime = transitionUpdateTask, label = transitionUpdateMethodName, isSpawnedUpdate = transitionUpdateComponentName, supportsUserTiming && (currentTrack = "Transition", 0 < previousRenderStartTime ? previousRenderStartTime > color && (previousRenderStartTime = color) : previousRenderStartTime = color, 0 < debugTask ? debugTask > previousRenderStartTime && (debugTask = previousRenderStartTime) : debugTask = previousRenderStartTime, 0 < isPingedUpdate ? isPingedUpdate > debugTask && (isPingedUpdate = debugTask) : isPingedUpdate = debugTask, debugTask > isPingedUpdate && null !== eventTime && (color$jscomp$0 = eventType ? "secondary-light" : "warning", endTime ? endTime.run(console.timeStamp.bind(console, eventType ? "Consecutive" : "Event: " + eventTime, isPingedUpdate, debugTask, currentTrack, "Scheduler âš›", color$jscomp$0)) : console.timeStamp(eventType ? "Consecutive" : "Event: " + eventTime, isPingedUpdate, debugTask, currentTrack, "Scheduler âš›", color$jscomp$0)), previousRenderStartTime > debugTask && (endTime ? endTime.run(console.timeStamp.bind(console, "Action", debugTask, previousRenderStartTime, currentTrack, "Scheduler âš›", "primary-dark")) : console.timeStamp("Action", debugTask, previousRenderStartTime, currentTrack, "Scheduler âš›", "primary-dark")), color > previousRenderStartTime && (debugTask = eventIsRepeat ? "Promise Resolved" : 5 < color - previousRenderStartTime ? "Update Blocked" : "Update", isPingedUpdate = [], null != isSpawnedUpdate && isPingedUpdate.push(["Component name", isSpawnedUpdate]), null != label && isPingedUpdate.push(["Method name", label]), previousRenderStartTime = { start: previousRenderStartTime, end: color, detail: { devtools: { properties: isPingedUpdate, track: currentTrack, trackGroup: "Scheduler âš›", color: "primary-light" } } }, endTime ? endTime.run(performance.measure.bind(performance, debugTask, previousRenderStartTime)) : performance.measure(debugTask, previousRenderStartTime), performance.clearMeasures(debugTask))), transitionUpdateTime = transitionStartTime = -1.1, transitionUpdateType = 0, transitionSuspendedTime = -1.1, transitionEventRepeatTime = transitionEventTime, transitionEventTime = -1.1, transitionClampTime = now()); 0 !== (lanes & 62914560) && 0 !== (animatingLanes & 62914560) && (setCurrentTrackFromLanes(4194304), logAnimatingPhase(retryClampTime, renderStartTime, animatingTask)); 0 !== (lanes & 2080374784) && 0 !== (animatingLanes & 2080374784) && (setCurrentTrackFromLanes(268435456), logAnimatingPhase(idleClampTime, renderStartTime, animatingTask)); previousRenderStartTime = root.timeoutHandle; previousRenderStartTime !== noTimeout && (root.timeoutHandle = noTimeout, cancelTimeout(previousRenderStartTime)); previousRenderStartTime = root.cancelPendingCommit; null !== previousRenderStartTime && (root.cancelPendingCommit = null, previousRenderStartTime()); pendingEffectsLanes = 0; resetWorkInProgressStack(); workInProgressRoot = root; workInProgress = previousRenderStartTime = createWorkInProgress(root.current, null); workInProgressRootRenderLanes = lanes; workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; workInProgressRootDidSkipSuspendedSiblings = !1; workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = RootInProgress; workInProgressSuspendedRetryLanes = workInProgressDeferredLane = workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; workInProgressRootDidIncludeRecursiveRenderUpdate = !1; entangledRenderLanes = getEntangledLanes(root, lanes); finishQueueingConcurrentUpdates(); root = getCurrentTime(); 1e3 < root - lastResetTime && (ReactSharedInternals.recentlyCreatedOwnerStacks = 0, lastResetTime = root); ReactStrictModeWarnings.discardPendingWarnings(); return previousRenderStartTime; } function handleThrow(root, thrownValue) { currentlyRenderingFiber = null; ReactSharedInternals.H = ContextOnlyDispatcher; ReactSharedInternals.getCurrentStack = null; isRendering = !1; current = null; thrownValue === SuspenseException || thrownValue === SuspenseActionException ? (thrownValue = getSuspendedThenable(), workInProgressSuspendedReason = SuspendedOnImmediate) : thrownValue === SuspenseyCommitException ? (thrownValue = getSuspendedThenable(), workInProgressSuspendedReason = SuspendedOnInstance) : workInProgressSuspendedReason = thrownValue === SelectiveHydrationException ? SuspendedOnHydration : null !== thrownValue && "object" === typeof thrownValue && "function" === typeof thrownValue.then ? SuspendedOnDeprecatedThrowPromise : SuspendedOnError; workInProgressThrownValue = thrownValue; var erroredWork = workInProgress; null === erroredWork ? (workInProgressRootExitStatus = RootFatalErrored, logUncaughtError(root, createCapturedValueAtFiber(thrownValue, root.current))) : erroredWork.mode & 2 && stopProfilerTimerIfRunningAndRecordDuration(erroredWork); } function shouldRemainOnPreviousScreen() { var handler = suspenseHandlerStackCursor.current; return null === handler ? !0 : (workInProgressRootRenderLanes & 4194048) === workInProgressRootRenderLanes ? null === shellBoundary ? !0 : !1 : (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes || 0 !== (workInProgressRootRenderLanes & 536870912) ? handler === shellBoundary : !1; } function pushDispatcher() { var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = ContextOnlyDispatcher; return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; } function pushAsyncDispatcher() { var prevAsyncDispatcher = ReactSharedInternals.A; ReactSharedInternals.A = DefaultAsyncDispatcher; return prevAsyncDispatcher; } function markRenderDerivedCause(fiber) { null === workInProgressUpdateTask && (workInProgressUpdateTask = null == fiber._debugTask ? null : fiber._debugTask); } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = RootSuspendedWithDelay; workInProgressRootDidSkipSuspendedSiblings || (workInProgressRootRenderLanes & 4194048) !== workInProgressRootRenderLanes && null !== suspenseHandlerStackCursor.current || (workInProgressRootIsPrerendering = !0); 0 === (workInProgressRootSkippedLanes & 134217727) && 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) || null === workInProgressRoot || markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes, workInProgressDeferredLane, !1); } function renderRootSync(root, lanes, shouldYieldForPrerendering) { var prevExecutionContext = executionContext; executionContext |= RenderContext; var prevDispatcher = pushDispatcher(), prevAsyncDispatcher = pushAsyncDispatcher(); if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { if (isDevToolsPresent) { var memoizedUpdaters = root.memoizedUpdaters; 0 < memoizedUpdaters.size && (restorePendingUpdaters(root, workInProgressRootRenderLanes), memoizedUpdaters.clear()); movePendingFibersToMemoized(root, lanes); } workInProgressTransitions = null; prepareFreshStack(root, lanes); } lanes = !1; memoizedUpdaters = workInProgressRootExitStatus; a: do try { if (workInProgressSuspendedReason !== NotSuspended && null !== workInProgress) { var unitOfWork = workInProgress, thrownValue = workInProgressThrownValue; switch (workInProgressSuspendedReason) { case SuspendedOnHydration: resetWorkInProgressStack(); memoizedUpdaters = RootSuspendedAtTheShell; break a; case SuspendedOnImmediate: case SuspendedOnData: case SuspendedOnAction: case SuspendedOnDeprecatedThrowPromise: null === suspenseHandlerStackCursor.current && (lanes = !0); var reason = workInProgressSuspendedReason; workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, unitOfWork, thrownValue, reason); if (shouldYieldForPrerendering && workInProgressRootIsPrerendering) { memoizedUpdaters = RootInProgress; break a; } break; default: reason = workInProgressSuspendedReason, workInProgressSuspendedReason = NotSuspended, workInProgressThrownValue = null, throwAndUnwindWorkLoop(root, unitOfWork, thrownValue, reason); } } workLoopSync(); memoizedUpdaters = workInProgressRootExitStatus; break; } catch (thrownValue$4) { handleThrow(root, thrownValue$4); } while (1); lanes && root.shellSuspendCounter++; resetContextDependencies(); executionContext = prevExecutionContext; ReactSharedInternals.H = prevDispatcher; ReactSharedInternals.A = prevAsyncDispatcher; null === workInProgress && (workInProgressRoot = null, workInProgressRootRenderLanes = 0, finishQueueingConcurrentUpdates()); return memoizedUpdaters; } function workLoopSync() { for (; null !== workInProgress;) performUnitOfWork(workInProgress); } function renderRootConcurrent(root, lanes) { var prevExecutionContext = executionContext; executionContext |= RenderContext; var prevDispatcher = pushDispatcher(), prevAsyncDispatcher = pushAsyncDispatcher(); if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { if (isDevToolsPresent) { var memoizedUpdaters = root.memoizedUpdaters; 0 < memoizedUpdaters.size && (restorePendingUpdaters(root, workInProgressRootRenderLanes), memoizedUpdaters.clear()); movePendingFibersToMemoized(root, lanes); } workInProgressTransitions = null; workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS; prepareFreshStack(root, lanes); } else workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); a: do try { if (workInProgressSuspendedReason !== NotSuspended && null !== workInProgress) b: switch (lanes = workInProgress, memoizedUpdaters = workInProgressThrownValue, workInProgressSuspendedReason) { case SuspendedOnError: workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters, SuspendedOnError); break; case SuspendedOnData: case SuspendedOnAction: if (isThenableResolved(memoizedUpdaters)) { workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; replaySuspendedUnitOfWork(lanes); break; } lanes = function() { workInProgressSuspendedReason !== SuspendedOnData && workInProgressSuspendedReason !== SuspendedOnAction || workInProgressRoot !== root || (workInProgressSuspendedReason = SuspendedAndReadyToContinue); ensureRootIsScheduled(root); }; memoizedUpdaters.then(lanes, lanes); break a; case SuspendedOnImmediate: workInProgressSuspendedReason = SuspendedAndReadyToContinue; break a; case SuspendedOnInstance: workInProgressSuspendedReason = SuspendedOnInstanceAndReadyToContinue; break a; case SuspendedAndReadyToContinue: isThenableResolved(memoizedUpdaters) ? (workInProgressSuspendedReason = NotSuspended, workInProgressThrownValue = null, replaySuspendedUnitOfWork(lanes)) : (workInProgressSuspendedReason = NotSuspended, workInProgressThrownValue = null, throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters, SuspendedAndReadyToContinue)); break; case SuspendedOnInstanceAndReadyToContinue: var resource = null; switch (workInProgress.tag) { case 26: resource = workInProgress.memoizedState; case 5: case 27: var hostFiber = workInProgress, type = hostFiber.type, props = hostFiber.pendingProps; if (resource ? preloadResource(resource) : preloadInstance(hostFiber.stateNode, type, props)) { workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; var sibling = hostFiber.sibling; if (null !== sibling) workInProgress = sibling; else { var returnFiber = hostFiber.return; null !== returnFiber ? (workInProgress = returnFiber, completeUnitOfWork(returnFiber)) : workInProgress = null; } break b; } break; default: console.error("Unexpected type of fiber triggered a suspensey commit. This is a bug in React."); } workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters, SuspendedOnInstanceAndReadyToContinue); break; case SuspendedOnDeprecatedThrowPromise: workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters, SuspendedOnDeprecatedThrowPromise); break; case SuspendedOnHydration: resetWorkInProgressStack(); workInProgressRootExitStatus = RootSuspendedAtTheShell; break a; default: throw Error("Unexpected SuspendedReason. This is a bug in React."); } null !== ReactSharedInternals.actQueue ? workLoopSync() : workLoopConcurrentByScheduler(); break; } catch (thrownValue$5) { handleThrow(root, thrownValue$5); } while (1); resetContextDependencies(); ReactSharedInternals.H = prevDispatcher; ReactSharedInternals.A = prevAsyncDispatcher; executionContext = prevExecutionContext; if (null !== workInProgress) return RootInProgress; workInProgressRoot = null; workInProgressRootRenderLanes = 0; finishQueueingConcurrentUpdates(); return workInProgressRootExitStatus; } function workLoopConcurrentByScheduler() { for (; null !== workInProgress && !shouldYield();) performUnitOfWork(workInProgress); } function performUnitOfWork(unitOfWork) { var current = unitOfWork.alternate; (unitOfWork.mode & 2) !== NoMode ? (startProfilerTimer(unitOfWork), current = runWithFiberInDEV(unitOfWork, beginWork, current, unitOfWork, entangledRenderLanes), stopProfilerTimerIfRunningAndRecordDuration(unitOfWork)) : current = runWithFiberInDEV(unitOfWork, beginWork, current, unitOfWork, entangledRenderLanes); unitOfWork.memoizedProps = unitOfWork.pendingProps; null === current ? completeUnitOfWork(unitOfWork) : workInProgress = current; } function replaySuspendedUnitOfWork(unitOfWork) { var next = runWithFiberInDEV(unitOfWork, replayBeginWork, unitOfWork); unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : workInProgress = next; } function replayBeginWork(unitOfWork) { var current = unitOfWork.alternate, isProfilingMode = (unitOfWork.mode & 2) !== NoMode; isProfilingMode && startProfilerTimer(unitOfWork); switch (unitOfWork.tag) { case 15: case 0: current = replayFunctionComponent(current, unitOfWork, unitOfWork.pendingProps, unitOfWork.type, void 0, workInProgressRootRenderLanes); break; case 11: current = replayFunctionComponent(current, unitOfWork, unitOfWork.pendingProps, unitOfWork.type.render, unitOfWork.ref, workInProgressRootRenderLanes); break; case 5: resetHooksOnUnwind(unitOfWork); var fiber = unitOfWork; supportsHydration && fiber === hydrationParentFiber && (isHydrating ? (popToNextHostParent(fiber), 5 === fiber.tag && null != fiber.stateNode && (nextHydratableInstance = fiber.stateNode)) : (popToNextHostParent(fiber), isHydrating = !0)); default: unwindInterruptedWork(current, unitOfWork), unitOfWork = workInProgress = resetWorkInProgress(unitOfWork, entangledRenderLanes), current = beginWork(current, unitOfWork, entangledRenderLanes); } isProfilingMode && stopProfilerTimerIfRunningAndRecordDuration(unitOfWork); return current; } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue, suspendedReason) { resetContextDependencies(); resetHooksOnUnwind(unitOfWork); thenableState$1 = null; thenableIndexCounter$1 = 0; var returnFiber = unitOfWork.return; try { if (throwException(root, returnFiber, unitOfWork, thrownValue, workInProgressRootRenderLanes)) { workInProgressRootExitStatus = RootFatalErrored; logUncaughtError(root, createCapturedValueAtFiber(thrownValue, root.current)); workInProgress = null; return; } } catch (error) { if (null !== returnFiber) throw workInProgress = returnFiber, error; workInProgressRootExitStatus = RootFatalErrored; logUncaughtError(root, createCapturedValueAtFiber(thrownValue, root.current)); workInProgress = null; return; } if (unitOfWork.flags & 32768) { if (isHydrating || suspendedReason === SuspendedOnError) root = !0; else if (workInProgressRootIsPrerendering || 0 !== (workInProgressRootRenderLanes & 536870912)) root = !1; else if (workInProgressRootDidSkipSuspendedSiblings = root = !0, suspendedReason === SuspendedOnData || suspendedReason === SuspendedOnAction || suspendedReason === SuspendedOnImmediate || suspendedReason === SuspendedOnDeprecatedThrowPromise) suspendedReason = suspenseHandlerStackCursor.current, null !== suspendedReason && 13 === suspendedReason.tag && (suspendedReason.flags |= 16384); unwindUnitOfWork(unitOfWork, root); } else completeUnitOfWork(unitOfWork); } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { if (0 !== (completedWork.flags & 32768)) { unwindUnitOfWork(completedWork, workInProgressRootDidSkipSuspendedSiblings); return; } var current = completedWork.alternate; unitOfWork = completedWork.return; startProfilerTimer(completedWork); current = runWithFiberInDEV(completedWork, completeWork, current, completedWork, entangledRenderLanes); (completedWork.mode & 2) !== NoMode && stopProfilerTimerIfRunningAndRecordIncompleteDuration(completedWork); if (null !== current) { workInProgress = current; return; } completedWork = completedWork.sibling; if (null !== completedWork) { workInProgress = completedWork; return; } workInProgress = completedWork = unitOfWork; } while (null !== completedWork); workInProgressRootExitStatus === RootInProgress && (workInProgressRootExitStatus = RootCompleted); } function unwindUnitOfWork(unitOfWork, skipSiblings) { do { var next = unwindWork(unitOfWork.alternate, unitOfWork); if (null !== next) { next.flags &= 32767; workInProgress = next; return; } if ((unitOfWork.mode & 2) !== NoMode) { stopProfilerTimerIfRunningAndRecordIncompleteDuration(unitOfWork); next = unitOfWork.actualDuration; for (var child = unitOfWork.child; null !== child;) next += child.actualDuration, child = child.sibling; unitOfWork.actualDuration = next; } next = unitOfWork.return; null !== next && (next.flags |= 32768, next.subtreeFlags = 0, next.deletions = null); if (!skipSiblings && (unitOfWork = unitOfWork.sibling, null !== unitOfWork)) { workInProgress = unitOfWork; return; } workInProgress = unitOfWork = next; } while (null !== unitOfWork); workInProgressRootExitStatus = RootSuspendedAtTheShell; workInProgress = null; } function completeRoot(root, finishedWork, lanes, recoverableErrors, transitions, didIncludeRenderPhaseUpdate, spawnedLane, updatedLanes, suspendedRetryLanes, didSkipSuspendedSiblings, exitStatus, suspendedState, suspendedCommitReason, completedRenderStartTime, completedRenderEndTime) { root.cancelPendingCommit = null; do flushPendingEffects(); while (pendingEffectsStatus !== NO_PENDING_EFFECTS); ReactStrictModeWarnings.flushLegacyContextWarning(); ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); setCurrentTrackFromLanes(lanes); if (exitStatus === RootErrored) logErroredRenderPhase(completedRenderStartTime, completedRenderEndTime, lanes, workInProgressUpdateTask); else if (null !== recoverableErrors) { if (didSkipSuspendedSiblings = null !== finishedWork && null !== finishedWork.alternate && finishedWork.alternate.memoizedState.isDehydrated && 0 !== (finishedWork.flags & 256), didIncludeRenderPhaseUpdate = workInProgressUpdateTask, supportsUserTiming && !(completedRenderEndTime <= completedRenderStartTime)) { exitStatus = []; for (var i = 0; i < recoverableErrors.length; i++) { var error = recoverableErrors[i].value; exitStatus.push(["Recoverable Error", "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error)]); } completedRenderStartTime = { start: completedRenderStartTime, end: completedRenderEndTime, detail: { devtools: { color: "primary-dark", track: currentTrack, trackGroup: "Scheduler âš›", tooltipText: didSkipSuspendedSiblings ? "Hydration Failed" : "Recovered after Error", properties: exitStatus } } }; didIncludeRenderPhaseUpdate ? didIncludeRenderPhaseUpdate.run(performance.measure.bind(performance, "Recovered", completedRenderStartTime)) : performance.measure("Recovered", completedRenderStartTime); performance.clearMeasures("Recovered"); } } else didIncludeRenderPhaseUpdate = workInProgressUpdateTask, !supportsUserTiming || completedRenderEndTime <= completedRenderStartTime || (didSkipSuspendedSiblings = (lanes & 738197653) === lanes ? "tertiary-dark" : "primary-dark", exitStatus = (lanes & 536870912) === lanes ? "Prepared" : (lanes & 201326741) === lanes ? "Hydrated" : "Render", didIncludeRenderPhaseUpdate ? didIncludeRenderPhaseUpdate.run(console.timeStamp.bind(console, exitStatus, completedRenderStartTime, completedRenderEndTime, currentTrack, "Scheduler âš›", didSkipSuspendedSiblings)) : console.timeStamp(exitStatus, completedRenderStartTime, completedRenderEndTime, currentTrack, "Scheduler âš›", didSkipSuspendedSiblings)); if (null !== finishedWork) { 0 === lanes && console.error("finishedLanes should not be empty during a commit. This is a bug in React."); if (finishedWork === root.current) throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."); root === workInProgressRoot && (workInProgress = workInProgressRoot = null, workInProgressRootRenderLanes = 0); pendingFinishedWork = finishedWork; pendingEffectsRoot = root; pendingEffectsLanes = lanes; pendingPassiveTransitions = transitions; pendingRecoverableErrors = recoverableErrors; pendingEffectsRenderEndTime = completedRenderEndTime; pendingSuspendedCommitReason = suspendedCommitReason; pendingDelayedCommitReason = IMMEDIATE_COMMIT; pendingSuspendedViewTransitionReason = null; commitRoot(root, finishedWork, lanes, spawnedLane, updatedLanes, suspendedRetryLanes, suspendedState, suspendedCommitReason, completedRenderEndTime); } } function commitRoot(root, finishedWork, lanes, spawnedLane, updatedLanes, suspendedRetryLanes, suspendedState, suspendedCommitReason, completedRenderEndTime) { var remainingLanes = finishedWork.lanes | finishedWork.childLanes; pendingEffectsRemainingLanes = remainingLanes; remainingLanes |= concurrentlyUpdatedLanes; markRootFinished(root, lanes, remainingLanes, spawnedLane, updatedLanes, suspendedRetryLanes); pendingViewTransitionEvents = null; (lanes & 335544064) === lanes ? (pendingTransitionTypes = claimQueuedTransitionTypes(root), spawnedLane = 10262) : (pendingTransitionTypes = null, spawnedLane = 10256); 0 !== finishedWork.actualDuration || 0 !== (finishedWork.subtreeFlags & spawnedLane) || 0 !== (finishedWork.flags & spawnedLane) ? (root.callbackNode = null, root.callbackPriority = 0, scheduleCallback(NormalPriority$1, function() { trackSchedulerEvent(); pendingDelayedCommitReason === IMMEDIATE_COMMIT && (pendingDelayedCommitReason = DELAYED_PASSIVE_COMMIT); flushPassiveEffects(); return null; })) : (root.callbackNode = null, root.callbackPriority = 0); commitErrors = null; commitStartTime = now(); null !== suspendedCommitReason && logSuspendedCommitPhase(completedRenderEndTime, commitStartTime, suspendedCommitReason, workInProgressUpdateTask); shouldStartViewTransition = !1; suspendedCommitReason = 0 !== (finishedWork.flags & 13878); if (0 !== (finishedWork.subtreeFlags & 13878) || suspendedCommitReason) { suspendedCommitReason = ReactSharedInternals.T; ReactSharedInternals.T = null; completedRenderEndTime = getCurrentUpdatePriority(); setCurrentUpdatePriority(2); spawnedLane = executionContext; executionContext |= CommitContext; try { commitBeforeMutationEffects(root, finishedWork, lanes); } finally { executionContext = spawnedLane, setCurrentUpdatePriority(completedRenderEndTime), ReactSharedInternals.T = suspendedCommitReason; } } pendingEffectsStatus = PENDING_MUTATION_PHASE; shouldStartViewTransition ? (animatingLanes |= lanes, animatingTask = null, pendingViewTransition = startViewTransition(suspendedState, root.containerInfo, pendingTransitionTypes, flushMutationEffects, flushLayoutEffects, flushAfterMutationEffects, flushSpawnedWork, flushPassiveEffects, reportViewTransitionError, suspendedViewTransition, finishedViewTransition.bind(null, lanes))) : (flushMutationEffects(), flushLayoutEffects(), flushSpawnedWork()); } function reportViewTransitionError(error) { if (pendingEffectsStatus !== NO_PENDING_EFFECTS) { var onRecoverableError = pendingEffectsRoot.onRecoverableError; onRecoverableError(error, makeErrorInfo(null)); } } function suspendedViewTransition(reason) { commitEndTime = now(); logCommitPhase(null === pendingSuspendedCommitReason ? pendingEffectsRenderEndTime : commitStartTime, commitEndTime, commitErrors, pendingDelayedCommitReason === ABORTED_VIEW_TRANSITION_COMMIT, workInProgressUpdateTask); pendingSuspendedCommitReason = pendingSuspendedViewTransitionReason = reason; } function finishedViewTransition(lanes) { if (0 !== (animatingLanes & lanes)) { var task = animatingTask; animatingLanes &= ~lanes; animatingTask = null; 0 !== (lanes & 4194048) && 0 === (workInProgressRootRenderLanes & 4194048) && 0 === (pendingEffectsLanes & 4194048) && (setCurrentTrackFromLanes(256), logAnimatingPhase(transitionClampTime, now$1(), task)); 0 !== (lanes & 62914560) && 0 === (workInProgressRootRenderLanes & 62914560) && 0 === (pendingEffectsLanes & 62914560) && (setCurrentTrackFromLanes(4194304), logAnimatingPhase(retryClampTime, now$1(), task)); 0 !== (lanes & 2080374784) && 0 === (workInProgressRootRenderLanes & 2080374784) && 0 === (pendingEffectsLanes & 2080374784) && (setCurrentTrackFromLanes(268435456), logAnimatingPhase(idleClampTime, now$1(), task)); } } function flushAfterMutationEffects() { pendingEffectsStatus === PENDING_AFTER_MUTATION_PHASE && (pendingEffectsStatus = NO_PENDING_EFFECTS, commitAfterMutationEffectsOnFiber(pendingFinishedWork, pendingEffectsRoot), pendingEffectsStatus = PENDING_SPAWNED_WORK); } function flushMutationEffects() { if (pendingEffectsStatus === PENDING_MUTATION_PHASE) { pendingEffectsStatus = NO_PENDING_EFFECTS; var root = pendingEffectsRoot, finishedWork = pendingFinishedWork, lanes = pendingEffectsLanes, rootMutationHasEffect = 0 !== (finishedWork.flags & 13878); if (0 !== (finishedWork.subtreeFlags & 13878) || rootMutationHasEffect) { rootMutationHasEffect = ReactSharedInternals.T; ReactSharedInternals.T = null; var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(2); var prevExecutionContext = executionContext; executionContext |= CommitContext; try { inProgressLanes = lanes, inProgressRoot = root, inUpdateViewTransition = rootViewTransitionAffected = !1, resetComponentEffectTimers(), commitMutationEffectsOnFiber(finishedWork, root, lanes), inProgressRoot = inProgressLanes = null, resetAfterCommit(root.containerInfo); } finally { executionContext = prevExecutionContext, setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = rootMutationHasEffect; } } root.current = finishedWork; pendingEffectsStatus = PENDING_LAYOUT_PHASE; } } function flushLayoutEffects() { if (pendingEffectsStatus === PENDING_LAYOUT_PHASE) { pendingEffectsStatus = NO_PENDING_EFFECTS; var suspendedViewTransitionReason = pendingSuspendedViewTransitionReason; if (null !== suspendedViewTransitionReason) { commitStartTime = now(); var startTime = commitEndTime, endTime = commitStartTime; !supportsUserTiming || endTime <= startTime || (animatingTask ? animatingTask.run(console.timeStamp.bind(console, suspendedViewTransitionReason, startTime, endTime, currentTrack, "Scheduler âš›", "secondary-light")) : console.timeStamp(suspendedViewTransitionReason, startTime, endTime, currentTrack, "Scheduler âš›", "secondary-light")); } suspendedViewTransitionReason = pendingEffectsRoot; startTime = pendingFinishedWork; endTime = pendingEffectsLanes; var rootHasLayoutEffect = 0 !== (startTime.flags & 8772); if (0 !== (startTime.subtreeFlags & 8772) || rootHasLayoutEffect) { rootHasLayoutEffect = ReactSharedInternals.T; ReactSharedInternals.T = null; var _previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(2); var _prevExecutionContext = executionContext; executionContext |= CommitContext; try { inProgressLanes = endTime, inProgressRoot = suspendedViewTransitionReason, resetComponentEffectTimers(), commitLayoutEffectOnFiber(suspendedViewTransitionReason, startTime.alternate, startTime), inProgressRoot = inProgressLanes = null; } finally { executionContext = _prevExecutionContext, setCurrentUpdatePriority(_previousPriority), ReactSharedInternals.T = rootHasLayoutEffect; } } suspendedViewTransitionReason = pendingEffectsRenderEndTime; startTime = pendingSuspendedCommitReason; commitEndTime = now(); logCommitPhase(null === startTime ? suspendedViewTransitionReason : commitStartTime, commitEndTime, commitErrors, pendingDelayedCommitReason === ABORTED_VIEW_TRANSITION_COMMIT, workInProgressUpdateTask); pendingEffectsStatus = PENDING_AFTER_MUTATION_PHASE; } } function flushSpawnedWork() { if (pendingEffectsStatus === PENDING_SPAWNED_WORK || pendingEffectsStatus === PENDING_AFTER_MUTATION_PHASE) { if (pendingEffectsStatus === PENDING_SPAWNED_WORK) { var startViewTransitionStartTime = commitEndTime; commitEndTime = now(); var endTime = commitEndTime, abortedViewTransition = pendingDelayedCommitReason === ABORTED_VIEW_TRANSITION_COMMIT; !supportsUserTiming || endTime <= startViewTransitionStartTime || (animatingTask ? animatingTask.run(console.timeStamp.bind(console, abortedViewTransition ? "Interrupted View Transition" : "Starting Animation", startViewTransitionStartTime, endTime, currentTrack, "Scheduler âš›", abortedViewTransition ? "error" : "secondary-light")) : console.timeStamp(abortedViewTransition ? "Interrupted View Transition" : "Starting Animation", startViewTransitionStartTime, endTime, currentTrack, "Scheduler âš›", abortedViewTransition ? " error" : "secondary-light")); pendingDelayedCommitReason !== ABORTED_VIEW_TRANSITION_COMMIT && (pendingDelayedCommitReason = ANIMATION_STARTED_COMMIT); } pendingEffectsStatus = NO_PENDING_EFFECTS; startViewTransitionStartTime = pendingViewTransition; pendingViewTransition = null; requestPaint(); endTime = pendingEffectsRoot; var finishedWork = pendingFinishedWork; abortedViewTransition = pendingEffectsLanes; var recoverableErrors = pendingRecoverableErrors, passiveSubtreeMask = (abortedViewTransition & 335544064) === abortedViewTransition ? 10262 : 10256; (passiveSubtreeMask = 0 !== finishedWork.actualDuration || 0 !== (finishedWork.subtreeFlags & passiveSubtreeMask) || 0 !== (finishedWork.flags & passiveSubtreeMask)) ? pendingEffectsStatus = PENDING_PASSIVE_PHASE : (pendingEffectsStatus = NO_PENDING_EFFECTS, pendingFinishedWork = pendingEffectsRoot = null, releaseRootPooledCache(endTime, endTime.pendingLanes), nestedPassiveUpdateCount = 0, rootWithPassiveNestedUpdates = null); var remainingLanes = endTime.pendingLanes; 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); passiveSubtreeMask || commitDoubleInvokeEffectsInDEV(endTime); remainingLanes = lanesToEventPriority(abortedViewTransition); finishedWork = finishedWork.stateNode; if (injectedHook && "function" === typeof injectedHook.onCommitFiberRoot) try { var didError = 128 === (finishedWork.current.flags & 128); switch (remainingLanes) { case 2: var schedulerPriority = ImmediatePriority; break; case 8: schedulerPriority = UserBlockingPriority; break; case 32: schedulerPriority = NormalPriority$1; break; case 268435456: schedulerPriority = IdlePriority; break; default: schedulerPriority = NormalPriority$1; } injectedHook.onCommitFiberRoot(rendererID, finishedWork, schedulerPriority, didError); } catch (err) { hasLoggedError || (hasLoggedError = !0, console.error("React instrumentation encountered an error: %o", err)); } isDevToolsPresent && endTime.memoizedUpdaters.clear(); onCommitRoot(); if (null !== recoverableErrors) { didError = ReactSharedInternals.T; schedulerPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(2); ReactSharedInternals.T = null; try { var onRecoverableError = endTime.onRecoverableError; for (finishedWork = 0; finishedWork < recoverableErrors.length; finishedWork++) { var recoverableError = recoverableErrors[finishedWork], errorInfo = makeErrorInfo(recoverableError.stack); runWithFiberInDEV(recoverableError.source, onRecoverableError, recoverableError.value, errorInfo); } } finally { ReactSharedInternals.T = didError, setCurrentUpdatePriority(schedulerPriority); } } onRecoverableError = pendingViewTransitionEvents; recoverableError = pendingTransitionTypes; pendingTransitionTypes = null; if (null !== onRecoverableError && (pendingViewTransitionEvents = null, null === recoverableError && (recoverableError = []), null !== startViewTransitionStartTime)) for (errorInfo = 0; errorInfo < onRecoverableError.length; errorInfo++) recoverableErrors = (0, onRecoverableError[errorInfo])(recoverableError), void 0 !== recoverableErrors && addViewTransitionFinishedListener(startViewTransitionStartTime, recoverableErrors); 0 !== (pendingEffectsLanes & 3) && flushPendingEffects(); ensureRootIsScheduled(endTime); remainingLanes = endTime.pendingLanes; 0 !== (abortedViewTransition & 261930) && 0 !== (remainingLanes & 42) ? (nestedUpdateScheduled = !0, endTime === rootWithNestedUpdates ? nestedUpdateCount++ : (nestedUpdateCount = 0, rootWithNestedUpdates = endTime)) : (nestedUpdateCount = 0, rootWithNestedUpdates = null); passiveSubtreeMask || finalizeRender(abortedViewTransition, commitEndTime); supportsHydration && flushHydrationEvents(); flushSyncWorkAcrossRoots_impl(0, !1); } } function makeErrorInfo(componentStack) { componentStack = { componentStack }; Object.defineProperty(componentStack, "digest", { get: function() { console.error("You are accessing \"digest\" from the errorInfo object passed to onRecoverableError. This property is no longer provided as part of errorInfo but can be accessed as a property of the Error instance itself."); } }); return componentStack; } function releaseRootPooledCache(root, remainingLanes) { 0 === (root.pooledCacheLanes &= remainingLanes) && (remainingLanes = root.pooledCache, null != remainingLanes && (root.pooledCache = null, releaseCache(remainingLanes))); } function flushPendingEffects() { null !== pendingViewTransition && (stopViewTransition(pendingViewTransition), didWarnAboutInterruptedViewTransitions || (didWarnAboutInterruptedViewTransitions = !0, console.warn("A flushSync update cancelled a View Transition because it was called while the View Transition was still preparing. To preserve the synchronous semantics, React had to skip the View Transition. If you can, try to avoid flushSync() in a scenario that's likely to interfere.")), pendingViewTransition = null, pendingDelayedCommitReason = ABORTED_VIEW_TRANSITION_COMMIT); flushMutationEffects(); flushLayoutEffects(); flushSpawnedWork(); return flushPassiveEffects(); } function flushPassiveEffects() { if (pendingEffectsStatus !== PENDING_PASSIVE_PHASE) return !1; var root = pendingEffectsRoot, remainingLanes = pendingEffectsRemainingLanes; pendingEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingEffectsLanes), priority = 32 > renderPriority ? 32 : renderPriority; renderPriority = ReactSharedInternals.T; var previousPriority = getCurrentUpdatePriority(); try { setCurrentUpdatePriority(priority); ReactSharedInternals.T = null; var transitions = pendingPassiveTransitions; pendingPassiveTransitions = null; priority = pendingEffectsRoot; var lanes = pendingEffectsLanes; pendingEffectsStatus = NO_PENDING_EFFECTS; pendingFinishedWork = pendingEffectsRoot = null; pendingEffectsLanes = 0; if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Cannot flush passive effects while already rendering."); setCurrentTrackFromLanes(lanes); isFlushingPassiveEffects = !0; didScheduleUpdateDuringPassiveEffects = !1; var passiveEffectStartTime = 0; commitErrors = null; passiveEffectStartTime = now$1(); if (pendingDelayedCommitReason === ANIMATION_STARTED_COMMIT) logAnimatingPhase(commitEndTime, passiveEffectStartTime, animatingTask); else { var startTime = commitEndTime, endTime = passiveEffectStartTime, delayedUntilPaint = pendingDelayedCommitReason === DELAYED_PASSIVE_COMMIT; !supportsUserTiming || endTime <= startTime || (workInProgressUpdateTask ? workInProgressUpdateTask.run(console.timeStamp.bind(console, delayedUntilPaint ? "Waiting for Paint" : "Waiting", startTime, endTime, currentTrack, "Scheduler âš›", "secondary-light")) : console.timeStamp(delayedUntilPaint ? "Waiting for Paint" : "Waiting", startTime, endTime, currentTrack, "Scheduler âš›", "secondary-light")); } startTime = executionContext; executionContext |= CommitContext; var finishedWork = priority.current; resetComponentEffectTimers(); commitPassiveUnmountOnFiber(finishedWork); var finishedWork$jscomp$0 = priority.current; finishedWork = pendingEffectsRenderEndTime; resetComponentEffectTimers(); commitPassiveMountOnFiber(priority, finishedWork$jscomp$0, lanes, transitions, finishedWork); commitDoubleInvokeEffectsInDEV(priority); executionContext = startTime; var passiveEffectsEndTime = now$1(); finishedWork$jscomp$0 = passiveEffectStartTime; finishedWork = workInProgressUpdateTask; null !== commitErrors ? logCommitErrored(finishedWork$jscomp$0, passiveEffectsEndTime, commitErrors, !0, finishedWork) : !supportsUserTiming || passiveEffectsEndTime <= finishedWork$jscomp$0 || (finishedWork ? finishedWork.run(console.timeStamp.bind(console, "Remaining Effects", finishedWork$jscomp$0, passiveEffectsEndTime, currentTrack, "Scheduler âš›", "secondary-dark")) : console.timeStamp("Remaining Effects", finishedWork$jscomp$0, passiveEffectsEndTime, currentTrack, "Scheduler âš›", "secondary-dark")); finalizeRender(lanes, passiveEffectsEndTime); flushSyncWorkAcrossRoots_impl(0, !1); didScheduleUpdateDuringPassiveEffects ? priority === rootWithPassiveNestedUpdates ? nestedPassiveUpdateCount++ : (nestedPassiveUpdateCount = 0, rootWithPassiveNestedUpdates = priority) : nestedPassiveUpdateCount = 0; didScheduleUpdateDuringPassiveEffects = isFlushingPassiveEffects = !1; if (injectedHook && "function" === typeof injectedHook.onPostCommitFiberRoot) try { injectedHook.onPostCommitFiberRoot(rendererID, priority); } catch (err) { hasLoggedError || (hasLoggedError = !0, console.error("React instrumentation encountered an error: %o", err)); } var stateNode = priority.current.stateNode; stateNode.effectDuration = 0; stateNode.passiveEffectDuration = 0; return !0; } finally { setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = renderPriority, releaseRootPooledCache(root, remainingLanes); } } function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { sourceFiber = createCapturedValueAtFiber(error, sourceFiber); recordEffectError(sourceFiber); sourceFiber = createRootErrorUpdate(rootFiber.stateNode, sourceFiber, 2); rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); null !== rootFiber && (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); } function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { isRunningInsertionEffect = !1; if (3 === sourceFiber.tag) captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); else { for (; null !== nearestMountedAncestor;) { if (3 === nearestMountedAncestor.tag) { captureCommitPhaseErrorOnRoot(nearestMountedAncestor, sourceFiber, error); return; } if (1 === nearestMountedAncestor.tag) { var instance = nearestMountedAncestor.stateNode; if ("function" === typeof nearestMountedAncestor.type.getDerivedStateFromError || "function" === typeof instance.componentDidCatch && (null === legacyErrorBoundariesThatAlreadyFailed || !legacyErrorBoundariesThatAlreadyFailed.has(instance))) { sourceFiber = createCapturedValueAtFiber(error, sourceFiber); recordEffectError(sourceFiber); error = createClassErrorUpdate(2); instance = enqueueUpdate(nearestMountedAncestor, error, 2); null !== instance && (initializeClassErrorUpdate(error, instance, nearestMountedAncestor, sourceFiber), markRootUpdated$1(instance, 2), ensureRootIsScheduled(instance)); return; } } nearestMountedAncestor = nearestMountedAncestor.return; } console.error("Internal React error: Attempted to capture a commit phase error inside a detached tree. This indicates a bug in React. Potential causes include deleting the same fiber more than once, committing an already-finished tree, or an inconsistent return pointer.\n\nError message:\n\n%s", error); } } function attachPingListener(root, wakeable, lanes) { var pingCache = root.pingCache; if (null === pingCache) { pingCache = root.pingCache = new PossiblyWeakMap(); var threadIDs = /* @__PURE__ */ new Set(); pingCache.set(wakeable, threadIDs); } else threadIDs = pingCache.get(wakeable), void 0 === threadIDs && (threadIDs = /* @__PURE__ */ new Set(), pingCache.set(wakeable, threadIDs)); threadIDs.has(lanes) || (workInProgressRootDidAttachPingListener = !0, threadIDs.add(lanes), pingCache = pingSuspendedRoot.bind(null, root, wakeable, lanes), isDevToolsPresent && restorePendingUpdaters(root, lanes), wakeable.then(pingCache, pingCache)); } function pingSuspendedRoot(root, wakeable, pingedLanes) { var pingCache = root.pingCache; null !== pingCache && pingCache.delete(wakeable); root.pingedLanes |= root.suspendedLanes & pingedLanes; root.warmLanes &= ~pingedLanes; 0 !== (pingedLanes & 127) ? 0 > blockingUpdateTime && (blockingClampTime = blockingUpdateTime = now(), blockingUpdateTask = createTask("Promise Resolved"), blockingUpdateType = 2) : 0 !== (pingedLanes & 4194048) && 0 > transitionUpdateTime && (transitionClampTime = transitionUpdateTime = now(), transitionUpdateTask = createTask("Promise Resolved"), transitionUpdateType = 2); isConcurrentActEnvironment() && null === ReactSharedInternals.actQueue && console.error("A suspended resource finished loading inside a test, but the event was not wrapped in act(...).\n\nWhen testing, code that resolves suspended data should be wrapped into act(...):\n\nact(() => {\n /* finish loading suspended data */\n});\n/* assert on the output */\n\nThis ensures that you're testing the behavior the user would see in the browser. Learn more at https://react.dev/link/wrap-tests-with-act"); workInProgressRoot === root && (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes && now$1() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS ? (executionContext & RenderContext) === NoContext ? prepareFreshStack(root, 0) : workInProgressRootPingedLanes |= pingedLanes : workInProgressRootPingedLanes |= pingedLanes, workInProgressSuspendedRetryLanes === workInProgressRootRenderLanes && (workInProgressSuspendedRetryLanes = 0)); ensureRootIsScheduled(root); } function retryTimedOutBoundary(boundaryFiber, retryLane) { 0 === retryLane && (retryLane = claimNextRetryLane()); boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); null !== boundaryFiber && (markRootUpdated$1(boundaryFiber, retryLane), ensureRootIsScheduled(boundaryFiber)); } function retryDehydratedSuspenseBoundary(boundaryFiber) { var suspenseState = boundaryFiber.memoizedState, retryLane = 0; null !== suspenseState && (retryLane = suspenseState.retryLane); retryTimedOutBoundary(boundaryFiber, retryLane); } function resolveRetryWakeable(boundaryFiber, wakeable) { var retryLane = 0; switch (boundaryFiber.tag) { case 31: case 13: var retryCache = boundaryFiber.stateNode; var suspenseState = boundaryFiber.memoizedState; null !== suspenseState && (retryLane = suspenseState.retryLane); break; case 19: retryCache = boundaryFiber.stateNode; break; case 22: retryCache = boundaryFiber.stateNode._retryCache; break; default: throw Error("Pinged unknown suspense boundary type. This is probably a bug in React."); } null !== retryCache && retryCache.delete(wakeable); retryTimedOutBoundary(boundaryFiber, retryLane); } function recursivelyTraverseAndDoubleInvokeEffectsInDEV(root$jscomp$0, parentFiber, isInStrictMode) { if (0 !== (parentFiber.subtreeFlags & 134225920)) for (parentFiber = parentFiber.child; null !== parentFiber;) { var root = root$jscomp$0, fiber = parentFiber, isStrictModeFiber = fiber.type === REACT_STRICT_MODE_TYPE; isStrictModeFiber = isInStrictMode || isStrictModeFiber; 22 !== fiber.tag ? fiber.flags & 134217728 ? isStrictModeFiber && runWithFiberInDEV(fiber, doubleInvokeEffectsOnFiber, root, fiber) : recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isStrictModeFiber) : null === fiber.memoizedState && (isStrictModeFiber && fiber.flags & 134225920 ? runWithFiberInDEV(fiber, doubleInvokeEffectsOnFiber, root, fiber) : fiber.subtreeFlags & 134217728 && runWithFiberInDEV(fiber, recursivelyTraverseAndDoubleInvokeEffectsInDEV, root, fiber, isStrictModeFiber)); parentFiber = parentFiber.sibling; } } function doubleInvokeEffectsOnFiber(root, fiber) { setIsStrictModeForDevtools(!0); try { disappearLayoutEffects(fiber, NoLayoutEffectTraversalFlags), disconnectPassiveEffect(fiber), reappearLayoutEffects(root, fiber.alternate, fiber, NoLayoutEffectTraversalFlags), reconnectPassiveEffects(root, fiber, 0, null, !1, 0); } finally { setIsStrictModeForDevtools(!1); } } function commitDoubleInvokeEffectsInDEV(root) { var doubleInvokeEffects = !0; root.current.mode & 24 || (doubleInvokeEffects = !1); recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, root.current, doubleInvokeEffects); } function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { if ((executionContext & RenderContext) === NoContext) { var tag = fiber.tag; if (3 === tag || 1 === tag || 0 === tag || 11 === tag || 14 === tag || 15 === tag) { tag = getComponentNameFromFiber(fiber) || "ReactComponent"; if (null !== didWarnStateUpdateForNotYetMountedComponent) { if (didWarnStateUpdateForNotYetMountedComponent.has(tag)) return; didWarnStateUpdateForNotYetMountedComponent.add(tag); } else didWarnStateUpdateForNotYetMountedComponent = /* @__PURE__ */ new Set([tag]); runWithFiberInDEV(fiber, function() { console.error("Can't perform a React state update on a component that hasn't mounted yet. This indicates that you have a side-effect in your render function that asynchronously tries to update the component. Move this work to useEffect instead."); }); } } } function restorePendingUpdaters(root, lanes) { isDevToolsPresent && root.memoizedUpdaters.forEach(function(schedulingFiber) { addFiberToLanesMap(root, schedulingFiber, lanes); }); } function scheduleCallback(priorityLevel, callback) { var actQueue = ReactSharedInternals.actQueue; return null !== actQueue ? (actQueue.push(callback), fakeActCallbackNode) : scheduleCallback$3(priorityLevel, callback); } function warnIfUpdatesNotWrappedWithActDEV(fiber) { isConcurrentActEnvironment() && null === ReactSharedInternals.actQueue && runWithFiberInDEV(fiber, function() { console.error("An update to %s inside a test was not wrapped in act(...).\n\nWhen testing, code that causes React state updates should be wrapped into act(...):\n\nact(() => {\n /* fire events that update state */\n});\n/* assert on the output */\n\nThis ensures that you're testing the behavior the user would see in the browser. Learn more at https://react.dev/link/wrap-tests-with-act", getComponentNameFromFiber(fiber)); }); } function resolveTypeForHotReloading(type) { if (null === resolveFamily) return type; var family = resolveFamily(type); return void 0 === family ? type : family.current; } function isCompatibleFamilyForHotReloading(fiber, element) { if (null === resolveFamily) return !1; var resolve = resolveFamily, prevType = fiber.elementType; element = element.type; var needsCompareFamilies = !1, $$typeofNextType = "object" === typeof element && null !== element ? element.$$typeof : null; switch (fiber.tag) { case 1: "function" === typeof element && (needsCompareFamilies = !0); break; case 0: "function" === typeof element ? needsCompareFamilies = !0 : $$typeofNextType === REACT_LAZY_TYPE && (needsCompareFamilies = !0); break; case 11: $$typeofNextType === REACT_FORWARD_REF_TYPE ? needsCompareFamilies = !0 : $$typeofNextType === REACT_LAZY_TYPE && (needsCompareFamilies = !0); break; case 14: case 15: $$typeofNextType === REACT_MEMO_TYPE ? needsCompareFamilies = !0 : $$typeofNextType === REACT_LAZY_TYPE && (needsCompareFamilies = !0); break; default: return !1; } return needsCompareFamilies && (fiber = resolve(prevType), void 0 !== fiber && fiber === resolve(element)) ? !0 : !1; } function markFailedErrorBoundaryForHotReloading(fiber) { null !== resolveFamily && "function" === typeof WeakSet && (null === failedBoundaries && (failedBoundaries = /* @__PURE__ */ new WeakSet()), failedBoundaries.add(fiber)); } function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) { do { var _fiber = fiber, alternate = _fiber.alternate, child = _fiber.child, sibling = _fiber.sibling, tag = _fiber.tag, type = _fiber.type, elementType = _fiber.elementType, candidateType = null; _fiber = null; switch (tag) { case 0: case 1: candidateType = type; break; case 15: candidateType = type; _fiber = elementType; break; case 14: _fiber = elementType; break; case 11: candidateType = type.render, _fiber = elementType; } if (null === resolveFamily) throw Error("Expected resolveFamily to be set during hot reload."); var resolve = resolveFamily; type = elementType = !1; null !== candidateType && (candidateType = resolve(candidateType), void 0 !== candidateType && (staleFamilies.has(candidateType) ? type = !0 : updatedFamilies.has(candidateType) && (1 === tag ? type = !0 : elementType = !0))); type || null === _fiber || (tag = resolve(_fiber), void 0 !== tag && staleFamilies.has(tag) ? type = !0 : "object" === typeof _fiber && _fiber.$$typeof === REACT_LAZY_TYPE && (tag = _fiber._payload, 1 === tag._status && (tag = resolve(tag._result.default), void 0 !== tag && staleFamilies.has(tag) && (type = !0)))); null !== failedBoundaries && (failedBoundaries.has(fiber) || null !== alternate && failedBoundaries.has(alternate)) && (type = !0); type && (fiber._debugNeedsRemount = !0); if (type || elementType) alternate = enqueueConcurrentRenderForLane(fiber, 2), null !== alternate && scheduleUpdateOnFiber(alternate, fiber, 2); null === child || type || scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies); if (null === sibling) break; fiber = sibling; } while (1); } function FiberNode(tag, pendingProps, key, mode) { this.tag = tag; this.key = key; this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; this.index = 0; this.refCleanup = this.ref = null; this.pendingProps = pendingProps; this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; this.mode = mode; this.subtreeFlags = this.flags = 0; this.deletions = null; this.childLanes = this.lanes = 0; this.alternate = null; this.actualDuration = -0; this.actualStartTime = -1.1; this.treeBaseDuration = this.selfBaseDuration = -0; this._debugTask = this._debugStack = this._debugOwner = this._debugInfo = null; this._debugNeedsRemount = !1; this._debugHookTypes = null; hasBadMapPolyfill || "function" !== typeof Object.preventExtensions || Object.preventExtensions(this); } function shouldConstruct(Component) { Component = Component.prototype; return !(!Component || !Component.isReactComponent); } function createWorkInProgress(current, pendingProps) { var workInProgress = current.alternate; null === workInProgress ? (workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode), workInProgress.elementType = current.elementType, workInProgress.type = current.type, workInProgress.stateNode = current.stateNode, workInProgress._debugOwner = current._debugOwner, workInProgress._debugStack = current._debugStack, workInProgress._debugTask = current._debugTask, workInProgress._debugHookTypes = current._debugHookTypes, workInProgress.alternate = current, current.alternate = workInProgress) : (workInProgress.pendingProps = pendingProps, workInProgress.type = current.type, workInProgress.flags = 0, workInProgress.subtreeFlags = 0, workInProgress.deletions = null, workInProgress.actualDuration = -0, workInProgress.actualStartTime = -1.1); workInProgress.flags = current.flags & 1206910976; workInProgress.childLanes = current.childLanes; workInProgress.lanes = current.lanes; workInProgress.child = current.child; workInProgress.memoizedProps = current.memoizedProps; workInProgress.memoizedState = current.memoizedState; workInProgress.updateQueue = current.updateQueue; pendingProps = current.dependencies; workInProgress.dependencies = null === pendingProps ? null : { lanes: pendingProps.lanes, firstContext: pendingProps.firstContext, _debugThenableState: pendingProps._debugThenableState }; workInProgress.sibling = current.sibling; workInProgress.index = current.index; workInProgress.ref = current.ref; workInProgress.refCleanup = current.refCleanup; workInProgress.selfBaseDuration = current.selfBaseDuration; workInProgress.treeBaseDuration = current.treeBaseDuration; workInProgress._debugInfo = current._debugInfo; workInProgress._debugNeedsRemount = current._debugNeedsRemount; switch (workInProgress.tag) { case 0: case 15: case 14: case 1: case 11: workInProgress.type = resolveTypeForHotReloading(current.type); } return workInProgress; } function resetWorkInProgress(workInProgress, renderLanes) { workInProgress.flags &= 1206910978; var current = workInProgress.alternate; null === current ? (workInProgress.childLanes = 0, workInProgress.lanes = renderLanes, workInProgress.child = null, workInProgress.subtreeFlags = 0, workInProgress.memoizedProps = null, workInProgress.memoizedState = null, workInProgress.updateQueue = null, workInProgress.dependencies = null, workInProgress.stateNode = null, workInProgress.selfBaseDuration = 0, workInProgress.treeBaseDuration = 0) : (workInProgress.childLanes = current.childLanes, workInProgress.lanes = current.lanes, workInProgress.child = current.child, workInProgress.subtreeFlags = 0, workInProgress.deletions = null, workInProgress.memoizedProps = current.memoizedProps, workInProgress.memoizedState = current.memoizedState, workInProgress.updateQueue = current.updateQueue, workInProgress.type = current.type, renderLanes = current.dependencies, workInProgress.dependencies = null === renderLanes ? null : { lanes: renderLanes.lanes, firstContext: renderLanes.firstContext, _debugThenableState: renderLanes._debugThenableState }, workInProgress.selfBaseDuration = current.selfBaseDuration, workInProgress.treeBaseDuration = current.treeBaseDuration); return workInProgress; } function createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, lanes) { var fiberTag = 0; var resolvedType = resolveTypeForHotReloading(type); if ("function" === typeof resolvedType) shouldConstruct(resolvedType) && (fiberTag = 1); else if ("string" === typeof resolvedType) supportsResources && supportsSingletons ? (fiberTag = getHostContext(), fiberTag = isHostHoistableType(type, pendingProps, fiberTag) ? 26 : isHostSingletonType(type) ? 27 : 5) : supportsResources ? (fiberTag = getHostContext(), fiberTag = isHostHoistableType(type, pendingProps, fiberTag) ? 26 : 5) : fiberTag = supportsSingletons ? isHostSingletonType(type) ? 27 : 5 : 5; else a: switch (resolvedType) { case REACT_ACTIVITY_TYPE: return key = createFiber(31, pendingProps, key, mode), key.elementType = REACT_ACTIVITY_TYPE, key.lanes = lanes, key; case REACT_FRAGMENT_TYPE: return createFiberFromFragment(pendingProps.children, mode, lanes, key); case REACT_STRICT_MODE_TYPE: fiberTag = 8; mode |= 24; break; case REACT_PROFILER_TYPE: return type = pendingProps, owner = mode, "string" !== typeof type.id && console.error("Profiler must specify an \"id\" of type `string` as a prop. Received the type `%s` instead.", typeof type.id), key = createFiber(12, type, key, owner | 2), key.elementType = REACT_PROFILER_TYPE, key.lanes = lanes, key.stateNode = { effectDuration: 0, passiveEffectDuration: 0 }, key; case REACT_SUSPENSE_TYPE: return key = createFiber(13, pendingProps, key, mode), key.elementType = REACT_SUSPENSE_TYPE, key.lanes = lanes, key; case REACT_SUSPENSE_LIST_TYPE: return key = createFiber(19, pendingProps, key, mode), key.elementType = REACT_SUSPENSE_LIST_TYPE, key.lanes = lanes, key; case REACT_LEGACY_HIDDEN_TYPE: case REACT_VIEW_TRANSITION_TYPE: return type = mode | 32, key = createFiber(30, pendingProps, key, type), key.elementType = REACT_VIEW_TRANSITION_TYPE, key.lanes = lanes, key.stateNode = { autoName: null, paired: null, clones: null, ref: null }, key; default: if ("object" === typeof resolvedType && null !== resolvedType) switch (resolvedType.$$typeof) { case REACT_CONTEXT_TYPE: fiberTag = 10; break a; case REACT_CONSUMER_TYPE: fiberTag = 9; break a; case REACT_FORWARD_REF_TYPE: fiberTag = 11; break a; case REACT_MEMO_TYPE: fiberTag = 14; break a; case REACT_LAZY_TYPE: fiberTag = 16; resolvedType = null; break a; } pendingProps = ""; if (void 0 === type || "object" === typeof type && null !== type && 0 === Object.keys(type).length) pendingProps += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."; null === type ? resolvedType = "null" : isArrayImpl(type) ? resolvedType = "array" : void 0 !== type && type.$$typeof === REACT_ELEMENT_TYPE ? (resolvedType = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />", pendingProps = " Did you accidentally export a JSX literal instead of a component?") : resolvedType = typeof type; fiberTag = owner ? "number" === typeof owner.tag ? getComponentNameFromFiber(owner) : "string" === typeof owner.name ? owner.name : null : null; fiberTag && (pendingProps += "\n\nCheck the render method of `" + fiberTag + "`."); fiberTag = 29; pendingProps = Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (resolvedType + "." + pendingProps)); resolvedType = null; } key = createFiber(fiberTag, pendingProps, key, mode); key.elementType = type; key.type = resolvedType; key.lanes = lanes; key._debugOwner = owner; return key; } function createFiberFromElement(element, mode, lanes) { mode = createFiberFromTypeAndProps(element.type, element.key, element.props, element._owner, mode, lanes); mode._debugOwner = element._owner; mode._debugStack = element._debugStack; mode._debugTask = element._debugTask; return mode; } function createFiberFromFragment(elements, mode, lanes, key) { elements = createFiber(7, elements, key, mode); elements.lanes = lanes; return elements; } function createFiberFromText(content, mode, lanes) { content = createFiber(6, content, null, mode); content.lanes = lanes; return content; } function createFiberFromDehydratedFragment(dehydratedNode) { var fiber = createFiber(18, null, null, NoMode); fiber.stateNode = dehydratedNode; return fiber; } function createFiberFromPortal(portal, mode, lanes) { mode = createFiber(4, null !== portal.children ? portal.children : [], portal.key, mode); mode.lanes = lanes; mode.stateNode = { containerInfo: portal.containerInfo, pendingChildren: null, implementation: portal.implementation }; return mode; } function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator, formState) { this.tag = 1; this.containerInfo = containerInfo; this.pingCache = this.current = this.pendingChildren = null; this.timeoutHandle = noTimeout; this.callbackNode = this.next = this.pendingContext = this.context = this.cancelPendingCommit = null; this.callbackPriority = 0; this.expirationTimes = createLaneMap(-1); this.entangledLanes = this.shellSuspendCounter = this.errorRecoveryDisabledLanes = this.expiredLanes = this.warmLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; this.entanglements = createLaneMap(0); this.hiddenUpdates = createLaneMap(null); this.identifierPrefix = identifierPrefix; this.onUncaughtError = onUncaughtError; this.onCaughtError = onCaughtError; this.onRecoverableError = onRecoverableError; this.pooledCache = null; this.pooledCacheLanes = 0; this.formState = formState; this.transitionTypes = null; this.incompleteTransitions = /* @__PURE__ */ new Map(); this.passiveEffectDuration = this.effectDuration = -0; this.memoizedUpdaters = /* @__PURE__ */ new Set(); containerInfo = this.pendingUpdatersLaneMap = []; for (tag = 0; 31 > tag; tag++) containerInfo.push(/* @__PURE__ */ new Set()); this._debugRootType = hydrate ? "hydrateRoot()" : "createRoot()"; } function createFiberRoot(containerInfo, tag, hydrate, initialChildren, hydrationCallbacks, isStrictMode, identifierPrefix, formState, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator) { containerInfo = new FiberRootNode(containerInfo, tag, hydrate, identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator, formState); tag = 1; !0 === isStrictMode && (tag |= 24); isStrictMode = createFiber(3, null, null, tag | 2); containerInfo.current = isStrictMode; isStrictMode.stateNode = containerInfo; tag = createCache(); retainCache(tag); containerInfo.pooledCache = tag; retainCache(tag); isStrictMode.memoizedState = { element: initialChildren, isDehydrated: hydrate, cache: tag }; initializeUpdateQueue(isStrictMode); return containerInfo; } function testStringCoercion(value) { return "" + value; } function getContextForSubtree(parentComponent) { if (!parentComponent) return emptyContextObject; parentComponent = emptyContextObject; return parentComponent; } function updateContainerSync(element, container, parentComponent, callback) { updateContainerImpl(container.current, 2, element, container, parentComponent, callback); return 2; } function updateContainerImpl(rootFiber, lane, element, container, parentComponent, callback) { if (injectedHook && "function" === typeof injectedHook.onScheduleFiberRoot) try { injectedHook.onScheduleFiberRoot(rendererID, container, element); } catch (err) { hasLoggedError || (hasLoggedError = !0, console.error("React instrumentation encountered an error: %o", err)); } parentComponent = getContextForSubtree(parentComponent); null === container.context ? container.context = parentComponent : container.pendingContext = parentComponent; isRendering && null !== current && !didWarnAboutNestedUpdates && (didWarnAboutNestedUpdates = !0, console.error("Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate.\n\nCheck the render method of %s.", getComponentNameFromFiber(current) || "Unknown")); container = createUpdate(lane); container.payload = { element }; callback = void 0 === callback ? null : callback; null !== callback && ("function" !== typeof callback && console.error("Expected the last optional `callback` argument to be a function. Instead received: %s.", callback), container.callback = callback); element = enqueueUpdate(rootFiber, container, lane); null !== element && (startUpdateTimerByLane(lane, "root.render()", null), scheduleUpdateOnFiber(element, rootFiber, lane), entangleTransitions(element, rootFiber, lane)); } function markRetryLaneImpl(fiber, retryLane) { fiber = fiber.memoizedState; if (null !== fiber && null !== fiber.dehydrated) { var a = fiber.retryLane; fiber.retryLane = 0 !== a && a < retryLane ? a : retryLane; } } function markRetryLaneIfNotHydrated(fiber, retryLane) { markRetryLaneImpl(fiber, retryLane); (fiber = fiber.alternate) && markRetryLaneImpl(fiber, retryLane); } function getCurrentFiberForDevTools() { return current; } var exports = {}; var React = require_react(), Scheduler = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"); var REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"); var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), REACT_RECOVERABLE_TYPE = Symbol.for("react.recoverable"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_OPTIMISTIC_KEY = Symbol.for("react.optimistic_key"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance; $$$config.cloneMutableInstance; var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance; $$$config.cloneMutableTextInstance; var scheduleTimeout = $$$config.scheduleTimeout, cancelTimeout = $$$config.cancelTimeout, noTimeout = $$$config.noTimeout, isPrimaryRenderer = $$$config.isPrimaryRenderer; $$$config.warnsIfNotActing; var supportsMutation = $$$config.supportsMutation, supportsPersistence = $$$config.supportsPersistence, supportsHydration = $$$config.supportsHydration, getInstanceFromNode = $$$config.getInstanceFromNode; $$$config.beforeActiveInstanceBlur; var preparePortalMount = $$$config.preparePortalMount; $$$config.prepareScopeUpdate; $$$config.getInstanceFromScope; var setCurrentUpdatePriority = $$$config.setCurrentUpdatePriority, getCurrentUpdatePriority = $$$config.getCurrentUpdatePriority, resolveUpdatePriority = $$$config.resolveUpdatePriority, trackSchedulerEvent = $$$config.trackSchedulerEvent, resolveEventType = $$$config.resolveEventType, resolveEventTimeStamp = $$$config.resolveEventTimeStamp, shouldAttemptEagerTransition = $$$config.shouldAttemptEagerTransition, detachDeletedInstance = $$$config.detachDeletedInstance; $$$config.requestPostPaintCallback; var maySuspendCommit = $$$config.maySuspendCommit, maySuspendCommitOnUpdate = $$$config.maySuspendCommitOnUpdate, maySuspendCommitInSyncRender = $$$config.maySuspendCommitInSyncRender, preloadInstance = $$$config.preloadInstance, startSuspendingCommit = $$$config.startSuspendingCommit, suspendInstance = $$$config.suspendInstance, suspendOnActiveViewTransition = $$$config.suspendOnActiveViewTransition, waitForCommitToBeReady = $$$config.waitForCommitToBeReady, getSuspendedCommitReason = $$$config.getSuspendedCommitReason, NotPendingTransition = $$$config.NotPendingTransition, HostTransitionContext = $$$config.HostTransitionContext, resetFormInstance = $$$config.resetFormInstance, bindToConsole = $$$config.bindToConsole, supportsMicrotasks = $$$config.supportsMicrotasks, scheduleMicrotask = $$$config.scheduleMicrotask, supportsTestSelectors = $$$config.supportsTestSelectors, findFiberRoot = $$$config.findFiberRoot, getBoundingRect = $$$config.getBoundingRect, getTextContent = $$$config.getTextContent, isHiddenSubtree = $$$config.isHiddenSubtree, matchAccessibilityRole = $$$config.matchAccessibilityRole, setFocusIfFocusable = $$$config.setFocusIfFocusable, setupIntersectionObserver = $$$config.setupIntersectionObserver, appendChild = $$$config.appendChild, appendChildToContainer = $$$config.appendChildToContainer, commitTextUpdate = $$$config.commitTextUpdate, commitMount = $$$config.commitMount, commitUpdate = $$$config.commitUpdate, insertBefore = $$$config.insertBefore, insertInContainerBefore = $$$config.insertInContainerBefore, removeChild = $$$config.removeChild, removeChildFromContainer = $$$config.removeChildFromContainer, resetTextContent = $$$config.resetTextContent, hideInstance = $$$config.hideInstance, hideTextInstance = $$$config.hideTextInstance, unhideInstance = $$$config.unhideInstance, unhideTextInstance = $$$config.unhideTextInstance, applyViewTransitionName = $$$config.applyViewTransitionName, restoreViewTransitionName = $$$config.restoreViewTransitionName, cancelViewTransitionName = $$$config.cancelViewTransitionName, cancelRootViewTransitionName = $$$config.cancelRootViewTransitionName, restoreRootViewTransitionName = $$$config.restoreRootViewTransitionName; $$$config.cloneRootViewTransitionContainer; $$$config.removeRootViewTransitionClone; var measureInstance = $$$config.measureInstance, measureClonedInstance = $$$config.measureClonedInstance, wasInstanceInViewport = $$$config.wasInstanceInViewport, hasInstanceChanged = $$$config.hasInstanceChanged, hasInstanceAffectedParent = $$$config.hasInstanceAffectedParent, startViewTransition = $$$config.startViewTransition; $$$config.startGestureTransition; var stopViewTransition = $$$config.stopViewTransition, addViewTransitionFinishedListener = $$$config.addViewTransitionFinishedListener; $$$config.getCurrentGestureOffset; var createViewTransitionInstance = $$$config.createViewTransitionInstance, clearContainer = $$$config.clearContainer, createFragmentInstance = $$$config.createFragmentInstance, updateFragmentInstanceFiber = $$$config.updateFragmentInstanceFiber, commitNewChildToFragmentInstance = $$$config.commitNewChildToFragmentInstance, deleteChildFromFragmentInstance = $$$config.deleteChildFromFragmentInstance, cloneInstance = $$$config.cloneInstance, createContainerChildSet = $$$config.createContainerChildSet, appendChildToContainerChildSet = $$$config.appendChildToContainerChildSet, finalizeContainerChildren = $$$config.finalizeContainerChildren, replaceContainerChildren = $$$config.replaceContainerChildren, cloneHiddenInstance = $$$config.cloneHiddenInstance, cloneHiddenTextInstance = $$$config.cloneHiddenTextInstance, isSuspenseInstancePending = $$$config.isSuspenseInstancePending, isSuspenseInstanceFallback = $$$config.isSuspenseInstanceFallback, getSuspenseInstanceFallbackErrorDetails = $$$config.getSuspenseInstanceFallbackErrorDetails, registerSuspenseInstanceRetry = $$$config.registerSuspenseInstanceRetry, canHydrateFormStateMarker = $$$config.canHydrateFormStateMarker, isFormStateMarkerMatching = $$$config.isFormStateMarkerMatching, getNextHydratableSibling = $$$config.getNextHydratableSibling, getNextHydratableSiblingAfterSingleton = $$$config.getNextHydratableSiblingAfterSingleton, getFirstHydratableChild = $$$config.getFirstHydratableChild, getFirstHydratableChildWithinContainer = $$$config.getFirstHydratableChildWithinContainer, getFirstHydratableChildWithinActivityInstance = $$$config.getFirstHydratableChildWithinActivityInstance, getFirstHydratableChildWithinSuspenseInstance = $$$config.getFirstHydratableChildWithinSuspenseInstance, getFirstHydratableChildWithinSingleton = $$$config.getFirstHydratableChildWithinSingleton, canHydrateInstance = $$$config.canHydrateInstance, canHydrateTextInstance = $$$config.canHydrateTextInstance, canHydrateActivityInstance = $$$config.canHydrateActivityInstance, canHydrateSuspenseInstance = $$$config.canHydrateSuspenseInstance, hydrateInstance = $$$config.hydrateInstance, hydrateTextInstance = $$$config.hydrateTextInstance, hydrateActivityInstance = $$$config.hydrateActivityInstance, hydrateSuspenseInstance = $$$config.hydrateSuspenseInstance, getNextHydratableInstanceAfterActivityInstance = $$$config.getNextHydratableInstanceAfterActivityInstance, getNextHydratableInstanceAfterSuspenseInstance = $$$config.getNextHydratableInstanceAfterSuspenseInstance, commitHydratedInstance = $$$config.commitHydratedInstance, commitHydratedContainer = $$$config.commitHydratedContainer, commitHydratedActivityInstance = $$$config.commitHydratedActivityInstance, commitHydratedSuspenseInstance = $$$config.commitHydratedSuspenseInstance, finalizeHydratedChildren = $$$config.finalizeHydratedChildren, flushHydrationEvents = $$$config.flushHydrationEvents; $$$config.clearActivityBoundary; var clearSuspenseBoundary = $$$config.clearSuspenseBoundary; $$$config.clearActivityBoundaryFromContainer; var clearSuspenseBoundaryFromContainer = $$$config.clearSuspenseBoundaryFromContainer, hideDehydratedBoundary = $$$config.hideDehydratedBoundary, unhideDehydratedBoundary = $$$config.unhideDehydratedBoundary, shouldDeleteUnhydratedTailInstances = $$$config.shouldDeleteUnhydratedTailInstances, diffHydratedPropsForDevWarnings = $$$config.diffHydratedPropsForDevWarnings, diffHydratedTextForDevWarnings = $$$config.diffHydratedTextForDevWarnings, describeHydratableInstanceForDevWarnings = $$$config.describeHydratableInstanceForDevWarnings, validateHydratableInstance = $$$config.validateHydratableInstance, validateHydratableTextInstance = $$$config.validateHydratableTextInstance, supportsResources = $$$config.supportsResources, isHostHoistableType = $$$config.isHostHoistableType, getHoistableRoot = $$$config.getHoistableRoot, getResource = $$$config.getResource, acquireResource = $$$config.acquireResource, releaseResource = $$$config.releaseResource, hydrateHoistable = $$$config.hydrateHoistable, mountHoistable = $$$config.mountHoistable, unmountHoistable = $$$config.unmountHoistable, createHoistableInstance = $$$config.createHoistableInstance, prepareToCommitHoistables = $$$config.prepareToCommitHoistables, mayResourceSuspendCommit = $$$config.mayResourceSuspendCommit, preloadResource = $$$config.preloadResource, suspendResource = $$$config.suspendResource, supportsSingletons = $$$config.supportsSingletons, resolveSingletonInstance = $$$config.resolveSingletonInstance, acquireSingletonInstance = $$$config.acquireSingletonInstance, releaseSingletonInstance = $$$config.releaseSingletonInstance, isHostSingletonType = $$$config.isHostSingletonType, isSingletonScope = $$$config.isSingletonScope, valueStack = []; var fiberStack = []; var index$jscomp$0 = -1, emptyContextObject = {}; Object.freeze(emptyContextObject); var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, log$1 = Math.log, LN2 = Math.LN2, nextTransitionUpdateLane = 256, nextTransitionDeferredLane = 262144, nextRetryLane = 4194304, scheduleCallback$3 = Scheduler.unstable_scheduleCallback, cancelCallback$1 = Scheduler.unstable_cancelCallback, shouldYield = Scheduler.unstable_shouldYield, requestPaint = Scheduler.unstable_requestPaint, now$1 = Scheduler.unstable_now, ImmediatePriority = Scheduler.unstable_ImmediatePriority, UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, NormalPriority$1 = Scheduler.unstable_NormalPriority, IdlePriority = Scheduler.unstable_IdlePriority, log = Scheduler.log, unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue, rendererID = null, injectedHook = null, hasLoggedError = !1, isDevToolsPresent = "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__, globalClientIdCounter$1 = 0, lastResetTime = 0; if ("object" === typeof performance && "function" === typeof performance.now) { var localPerformance = performance; var getCurrentTime = function() { return localPerformance.now(); }; } else { var localDate = Date; getCurrentTime = function() { return localDate.now(); }; } var objectIs = "function" === typeof Object.is ? Object.is : is, reportGlobalError = "function" === typeof reportError ? reportError : function(error) { if ("object" === typeof window && "function" === typeof window.ErrorEvent) { var event = new window.ErrorEvent("error", { bubbles: !0, cancelable: !0, message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error), error }); if (!window.dispatchEvent(event)) return; } else if ("object" === typeof process && "function" === typeof process.emit) { process.emit("uncaughtException", error); return; } console.error(error); }, hasOwnProperty = Object.prototype.hasOwnProperty, supportsUserTiming = "undefined" !== typeof console && "function" === typeof console.timeStamp && "undefined" !== typeof performance && "function" === typeof performance.measure, currentTrack = "Blocking", alreadyWarnedForDeepEquality = !1, reusableComponentDevToolDetails = { color: "primary", properties: null, tooltipText: "", track: "Components âš›" }, reusableComponentOptions = { start: -0, end: -0, detail: { devtools: reusableComponentDevToolDetails } }, reusableChangedPropsEntry = ["Changed Props", ""], reusableDeeplyEqualPropsEntry = ["Changed Props", "This component received deeply equal props. It might benefit from useMemo or the React Compiler in its owner."], disabledDepth = 0, prevLog, prevInfo, prevWarn, prevError, prevGroup, prevGroupCollapsed, prevGroupEnd; disabledLog.__reactDisabledLog = !0; var prefix, suffix, reentry = !1; var componentFrameCache = new ("function" === typeof WeakMap ? WeakMap : Map)(); var CapturedStacks = /* @__PURE__ */ new WeakMap(), forkStack = [], forkStackIndex = 0, treeForkProvider = null, treeForkCount = 0, idStack = [], idStackIndex = 0, treeContextProvider = null, treeContextId = 1, treeContextOverflow = "", contextStackCursor = createCursor(null), contextFiberStackCursor = createCursor(null), rootInstanceStackCursor = createCursor(null), hostTransitionProviderCursor = createCursor(null), needsEscaping = /["'&<>\n\t]|^\s|\s$/, current = null, isRendering = !1, hydrationParentFiber = null, nextHydratableInstance = null, isHydrating = !1, didSuspendOrErrorDEV = !1, hydrationDiffRootDEV = null, hydrationErrors = null, rootOrSingletonContext = !1, HydrationMismatchException = Error("Hydration Mismatch Exception: This is not a real error, and should not leak into userspace. If you're seeing this, it's likely a bug in React."), NoMode = 0, valueCursor = createCursor(null); var rendererCursorDEV = createCursor(null); var renderer2CursorDEV = createCursor(null); var rendererSigil = {}; var currentlyRenderingFiber$1 = null, lastContextDependency = null, isDisallowedContextReadInDEV = !1, AbortControllerLocal = "undefined" !== typeof AbortController ? AbortController : function() { var listeners = [], signal = this.signal = { aborted: !1, addEventListener: function(type, listener) { listeners.push(listener); } }; this.abort = function() { signal.aborted = !0; listeners.forEach(function(listener) { return listener(); }); }; }, scheduleCallback$2 = Scheduler.unstable_scheduleCallback, NormalPriority = Scheduler.unstable_NormalPriority, CacheContext = { $$typeof: REACT_CONTEXT_TYPE, Consumer: null, Provider: null, _currentValue: null, _currentValue2: null, _threadCount: 0, _currentRenderer: null, _currentRenderer2: null }, entangledTransitionTypes = null, now = Scheduler.unstable_now, createTask = console.createTask ? console.createTask : function() { return null; }, renderStartTime = -0, commitStartTime = -0, commitEndTime = -0, commitErrors = null, profilerStartTime = -1.1, profilerEffectDuration = -0, componentEffectDuration = -0, componentEffectStartTime = -1.1, componentEffectEndTime = -1.1, componentEffectErrors = null, componentEffectSpawnedUpdate = !1, blockingClampTime = -0, blockingUpdateTime = -1.1, blockingUpdateTask = null, blockingUpdateType = 0, blockingUpdateMethodName = null, blockingUpdateComponentName = null, blockingEventTime = -1.1, blockingEventType = null, blockingEventRepeatTime = -1.1, blockingSuspendedTime = -1.1, transitionClampTime = -0, transitionStartTime = -1.1, transitionUpdateTime = -1.1, transitionUpdateType = 0, transitionUpdateTask = null, transitionUpdateMethodName = null, transitionUpdateComponentName = null, transitionEventTime = -1.1, transitionEventType = null, transitionEventRepeatTime = -1.1, transitionSuspendedTime = -1.1, retryClampTime = -0, idleClampTime = -0, animatingLanes = 0, animatingTask = null, yieldReason = 0, yieldStartTime = -1.1, currentUpdateIsNested = !1, nestedUpdateScheduled = !1, firstScheduledRoot = null, lastScheduledRoot = null, didScheduleMicrotask = !1, didScheduleMicrotask_act = !1, mightHavePendingSyncWork = !1, isFlushingWork = !1, currentEventTransitionLane = 0, fakeActCallbackNode$1 = {}, currentEntangledListeners = null, currentEntangledPendingCount = 0, currentEntangledLane = 0, currentEntangledActionThenable = null, prevOnStartTransitionFinish = ReactSharedInternals.S; ReactSharedInternals.S = function(transition, returnValue) { globalMostRecentTransitionTime = now$1(); if ("object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then) { if (0 > transitionStartTime && 0 > transitionUpdateTime) { transitionStartTime = now(); var newEventTime = resolveEventTimeStamp(), newEventType = resolveEventType(); if (newEventTime !== transitionEventRepeatTime || newEventType !== transitionEventType) transitionEventRepeatTime = -1.1; transitionEventTime = newEventTime; transitionEventType = newEventType; } entangleAsyncAction(transition, returnValue); } if (null !== entangledTransitionTypes) for (newEventTime = firstScheduledRoot; null !== newEventTime;) queueTransitionTypes(newEventTime, entangledTransitionTypes), newEventTime = newEventTime.next; newEventTime = transition.types; if (null !== newEventTime) { for (newEventType = firstScheduledRoot; null !== newEventType;) queueTransitionTypes(newEventType, newEventTime), newEventType = newEventType.next; if (0 !== currentEntangledLane) { newEventType = entangledTransitionTypes; null === newEventType && (newEventType = entangledTransitionTypes = []); for (var i = 0; i < newEventTime.length; i++) { var transitionType = newEventTime[i]; -1 === newEventType.indexOf(transitionType) && newEventType.push(transitionType); } } } null !== prevOnStartTransitionFinish && prevOnStartTransitionFinish(transition, returnValue); }; var resumedCache = createCursor(null), ReactStrictModeWarnings = { recordUnsafeLifecycleWarnings: function() {}, flushPendingUnsafeLifecycleWarnings: function() {}, recordLegacyContextWarning: function() {}, flushLegacyContextWarning: function() {}, discardPendingWarnings: function() {} }, pendingComponentWillMountWarnings = [], pendingUNSAFE_ComponentWillMountWarnings = [], pendingComponentWillReceivePropsWarnings = [], pendingUNSAFE_ComponentWillReceivePropsWarnings = [], pendingComponentWillUpdateWarnings = [], pendingUNSAFE_ComponentWillUpdateWarnings = [], didWarnAboutUnsafeLifecycles = /* @__PURE__ */ new Set(); ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function(fiber, instance) { didWarnAboutUnsafeLifecycles.has(fiber.type) || ("function" === typeof instance.componentWillMount && !0 !== instance.componentWillMount.__suppressDeprecationWarning && pendingComponentWillMountWarnings.push(fiber), fiber.mode & 8 && "function" === typeof instance.UNSAFE_componentWillMount && pendingUNSAFE_ComponentWillMountWarnings.push(fiber), "function" === typeof instance.componentWillReceiveProps && !0 !== instance.componentWillReceiveProps.__suppressDeprecationWarning && pendingComponentWillReceivePropsWarnings.push(fiber), fiber.mode & 8 && "function" === typeof instance.UNSAFE_componentWillReceiveProps && pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber), "function" === typeof instance.componentWillUpdate && !0 !== instance.componentWillUpdate.__suppressDeprecationWarning && pendingComponentWillUpdateWarnings.push(fiber), fiber.mode & 8 && "function" === typeof instance.UNSAFE_componentWillUpdate && pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber)); }; ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function() { var componentWillMountUniqueNames = /* @__PURE__ */ new Set(); 0 < pendingComponentWillMountWarnings.length && (pendingComponentWillMountWarnings.forEach(function(fiber) { componentWillMountUniqueNames.add(getComponentNameFromFiber(fiber) || "Component"); didWarnAboutUnsafeLifecycles.add(fiber.type); }), pendingComponentWillMountWarnings = []); var UNSAFE_componentWillMountUniqueNames = /* @__PURE__ */ new Set(); 0 < pendingUNSAFE_ComponentWillMountWarnings.length && (pendingUNSAFE_ComponentWillMountWarnings.forEach(function(fiber) { UNSAFE_componentWillMountUniqueNames.add(getComponentNameFromFiber(fiber) || "Component"); didWarnAboutUnsafeLifecycles.add(fiber.type); }), pendingUNSAFE_ComponentWillMountWarnings = []); var componentWillReceivePropsUniqueNames = /* @__PURE__ */ new Set(); 0 < pendingComponentWillReceivePropsWarnings.length && (pendingComponentWillReceivePropsWarnings.forEach(function(fiber) { componentWillReceivePropsUniqueNames.add(getComponentNameFromFiber(fiber) || "Component"); didWarnAboutUnsafeLifecycles.add(fiber.type); }), pendingComponentWillReceivePropsWarnings = []); var UNSAFE_componentWillReceivePropsUniqueNames = /* @__PURE__ */ new Set(); 0 < pendingUNSAFE_ComponentWillReceivePropsWarnings.length && (pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function(fiber) { UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentNameFromFiber(fiber) || "Component"); didWarnAboutUnsafeLifecycles.add(fiber.type); }), pendingUNSAFE_ComponentWillReceivePropsWarnings = []); var componentWillUpdateUniqueNames = /* @__PURE__ */ new Set(); 0 < pendingComponentWillUpdateWarnings.length && (pendingComponentWillUpdateWarnings.forEach(function(fiber) { componentWillUpdateUniqueNames.add(getComponentNameFromFiber(fiber) || "Component"); didWarnAboutUnsafeLifecycles.add(fiber.type); }), pendingComponentWillUpdateWarnings = []); var UNSAFE_componentWillUpdateUniqueNames = /* @__PURE__ */ new Set(); 0 < pendingUNSAFE_ComponentWillUpdateWarnings.length && (pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function(fiber) { UNSAFE_componentWillUpdateUniqueNames.add(getComponentNameFromFiber(fiber) || "Component"); didWarnAboutUnsafeLifecycles.add(fiber.type); }), pendingUNSAFE_ComponentWillUpdateWarnings = []); if (0 < UNSAFE_componentWillMountUniqueNames.size) { var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames); console.error("Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.\n\n* Move code with side effects to componentDidMount, and set initial state in the constructor.\n\nPlease update the following components: %s", sortedNames); } 0 < UNSAFE_componentWillReceivePropsUniqueNames.size && (sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames), console.error("Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://react.dev/link/derived-state\n\nPlease update the following components: %s", sortedNames)); 0 < UNSAFE_componentWillUpdateUniqueNames.size && (sortedNames = setToSortedString(UNSAFE_componentWillUpdateUniqueNames), console.error("Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n\nPlease update the following components: %s", sortedNames)); 0 < componentWillMountUniqueNames.size && (sortedNames = setToSortedString(componentWillMountUniqueNames), console.warn("componentWillMount has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.\n\n* Move code with side effects to componentDidMount, and set initial state in the constructor.\n* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: %s", sortedNames)); 0 < componentWillReceivePropsUniqueNames.size && (sortedNames = setToSortedString(componentWillReceivePropsUniqueNames), console.warn("componentWillReceiveProps has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://react.dev/link/derived-state\n* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: %s", sortedNames)); 0 < componentWillUpdateUniqueNames.size && (sortedNames = setToSortedString(componentWillUpdateUniqueNames), console.warn("componentWillUpdate has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: %s", sortedNames)); }; var pendingLegacyContextWarning = /* @__PURE__ */ new Map(), didWarnAboutLegacyContext = /* @__PURE__ */ new Set(); ReactStrictModeWarnings.recordLegacyContextWarning = function(fiber, instance) { var strictRoot = null; for (var node = fiber; null !== node;) node.mode & 8 && (strictRoot = node), node = node.return; null === strictRoot ? console.error("Expected to find a StrictMode component in a strict mode tree. This error is likely caused by a bug in React. Please file an issue.") : !didWarnAboutLegacyContext.has(fiber.type) && (node = pendingLegacyContextWarning.get(strictRoot), null != fiber.type.contextTypes || null != fiber.type.childContextTypes || null !== instance && "function" === typeof instance.getChildContext) && (void 0 === node && (node = [], pendingLegacyContextWarning.set(strictRoot, node)), node.push(fiber)); }; ReactStrictModeWarnings.flushLegacyContextWarning = function() { pendingLegacyContextWarning.forEach(function(fiberArray) { if (0 !== fiberArray.length) { var firstFiber = fiberArray[0], uniqueNames = /* @__PURE__ */ new Set(); fiberArray.forEach(function(fiber) { uniqueNames.add(getComponentNameFromFiber(fiber) || "Component"); didWarnAboutLegacyContext.add(fiber.type); }); var sortedNames = setToSortedString(uniqueNames); runWithFiberInDEV(firstFiber, function() { console.error("Legacy context API has been detected within a strict-mode tree.\n\nThe old API will be supported in all 16.x releases, but applications using it should migrate to the new version.\n\nPlease update the following components: %s\n\nLearn more about this warning here: https://react.dev/link/legacy-context", sortedNames); }); } }); }; ReactStrictModeWarnings.discardPendingWarnings = function() { pendingComponentWillMountWarnings = []; pendingUNSAFE_ComponentWillMountWarnings = []; pendingComponentWillReceivePropsWarnings = []; pendingUNSAFE_ComponentWillReceivePropsWarnings = []; pendingComponentWillUpdateWarnings = []; pendingUNSAFE_ComponentWillUpdateWarnings = []; pendingLegacyContextWarning = /* @__PURE__ */ new Map(); }; var REACT_RECOVERABLE_DIGEST = "", callComponent = { react_stack_bottom_frame: function(Component, props, secondArg) { var wasRendering = isRendering; isRendering = !0; try { return Component(props, secondArg); } finally { isRendering = wasRendering; } } }, callComponentInDEV = callComponent.react_stack_bottom_frame.bind(callComponent), callRender = { react_stack_bottom_frame: function(instance) { var wasRendering = isRendering; isRendering = !0; try { return instance.render(); } finally { isRendering = wasRendering; } } }, callRenderInDEV = callRender.react_stack_bottom_frame.bind(callRender), callComponentDidMount = { react_stack_bottom_frame: function(finishedWork, instance) { try { instance.componentDidMount(); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } }, callComponentDidMountInDEV = callComponentDidMount.react_stack_bottom_frame.bind(callComponentDidMount), callComponentDidUpdate = { react_stack_bottom_frame: function(finishedWork, instance, prevProps, prevState, snapshot) { try { instance.componentDidUpdate(prevProps, prevState, snapshot); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } }, callComponentDidUpdateInDEV = callComponentDidUpdate.react_stack_bottom_frame.bind(callComponentDidUpdate), callComponentDidCatch = { react_stack_bottom_frame: function(instance, errorInfo) { var stack = errorInfo.stack; instance.componentDidCatch(errorInfo.value, { componentStack: null !== stack ? stack : "" }); } }, callComponentDidCatchInDEV = callComponentDidCatch.react_stack_bottom_frame.bind(callComponentDidCatch), callComponentWillUnmount = { react_stack_bottom_frame: function(current, nearestMountedAncestor, instance) { try { instance.componentWillUnmount(); } catch (error) { captureCommitPhaseError(current, nearestMountedAncestor, error); } } }, callComponentWillUnmountInDEV = callComponentWillUnmount.react_stack_bottom_frame.bind(callComponentWillUnmount), callCreate = { react_stack_bottom_frame: function(effect) { var create = effect.create; effect = effect.inst; create = create(); return effect.destroy = create; } }, callCreateInDEV = callCreate.react_stack_bottom_frame.bind(callCreate), callDestroy = { react_stack_bottom_frame: function(current, nearestMountedAncestor, destroy) { try { destroy(); } catch (error) { captureCommitPhaseError(current, nearestMountedAncestor, error); } } }, callDestroyInDEV = callDestroy.react_stack_bottom_frame.bind(callDestroy), callLazyInit = { react_stack_bottom_frame: function(lazy) { var init = lazy._init; return init(lazy._payload); } }, callLazyInitInDEV = callLazyInit.react_stack_bottom_frame.bind(callLazyInit), SuspenseException = Error("Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`."), SuspenseyCommitException = Error("Suspense Exception: This is not a real error, and should not leak into userspace. If you're seeing this, it's likely a bug in React."), SuspenseActionException = Error("Suspense Exception: This is not a real error! It's an implementation detail of `useActionState` to interrupt the current render. You must either rethrow it immediately, or move the `useActionState` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary."), noopSuspenseyCommitThenable = { then: function() { console.error("Internal React error: A listener was unexpectedly attached to a \"noop\" thenable. This is a bug in React. Please file an issue."); } }, lastSuspendedFiber = null, lastSuspendedStack = null, didIssueUseWarning = !1, suspendedThenable = null, needsToResetSuspendedThenableDEV = !1, thenableState$1 = null, thenableIndexCounter$1 = 0, currentDebugInfo = null, didWarnAboutMaps; var didWarnAboutGenerators = didWarnAboutMaps = !1; var ownerHasKeyUseWarning = {}; var ownerHasFunctionTypeWarning = {}; var ownerHasSymbolTypeWarning = {}; warnForMissingKey = function(returnFiber, workInProgress, child) { if (null !== child && "object" === typeof child && child._store && (!child._store.validated && null == child.key || 2 === child._store.validated)) { if ("object" !== typeof child._store) throw Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue."); child._store.validated = 1; var componentName = getComponentNameFromFiber(returnFiber), componentKey = componentName || "null"; if (!ownerHasKeyUseWarning[componentKey]) { ownerHasKeyUseWarning[componentKey] = !0; child = child._owner; returnFiber = returnFiber._debugOwner; var currentComponentErrorInfo = ""; returnFiber && "number" === typeof returnFiber.tag && (componentKey = getComponentNameFromFiber(returnFiber)) && (currentComponentErrorInfo = "\n\nCheck the render method of `" + componentKey + "`."); currentComponentErrorInfo || componentName && (currentComponentErrorInfo = "\n\nCheck the top-level render call using <" + componentName + ">."); var childOwnerAppendix = ""; null != child && returnFiber !== child && (componentName = null, "number" === typeof child.tag ? componentName = getComponentNameFromFiber(child) : "string" === typeof child.name && (componentName = child.name), componentName && (childOwnerAppendix = " It was passed a child from " + componentName + ".")); runWithFiberInDEV(workInProgress, function() { console.error("Each child in a list should have a unique \"key\" prop.%s%s See https://react.dev/link/warning-keys for more information.", currentComponentErrorInfo, childOwnerAppendix); }); } } }; var reconcileChildFibers = createChildReconciler(!0), mountChildFibers = createChildReconciler(!1), OffscreenVisible = 1, OffscreenPassiveEffectsConnected = 2, concurrentQueues = [], concurrentQueuesIndex = 0, concurrentlyUpdatedLanes = 0, UpdateState = 0, ReplaceState = 1, ForceUpdate = 2, CaptureUpdate = 3, hasForceUpdate = !1; var didWarnUpdateInsideUpdate = !1; var currentlyProcessingQueue = null; var didReadFromEntangledAsyncAction = !1, currentTreeHiddenStackCursor = createCursor(null), prevEntangledRenderLanesCursor = createCursor(0), suspenseHandlerStackCursor = createCursor(null), shellBoundary = null, SubtreeSuspenseContextMask = 1, ForceSuspenseFallback = 2, suspenseStackCursor = createCursor(0), NoFlags = 0, HasEffect = 1, Insertion = 2, Layout = 4, Passive = 8, didWarnUncachedGetSnapshot; var didWarnAboutMismatchedHooksForComponent = /* @__PURE__ */ new Set(); var didWarnAboutUseWrappedInTryCatch = /* @__PURE__ */ new Set(); var didWarnAboutAsyncClientComponent = /* @__PURE__ */ new Set(); var didWarnAboutUseFormState = /* @__PURE__ */ new Set(); var renderLanes = 0, currentlyRenderingFiber = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, didScheduleRenderPhaseUpdateDuringThisPass = !1, shouldDoubleInvokeUserFnsInHooksDEV = !1, localIdCounter = 0, thenableIndexCounter = 0, thenableState = null, globalClientIdCounter = 0, RE_RENDER_LIMIT = 25, currentHookNameInDev = null, hookTypesDev = null, hookTypesUpdateIndexDev = -1, ignorePreviousDependencies = !1, ContextOnlyDispatcher = { readContext, use, useCallback: throwInvalidHookError, useContext: throwInvalidHookError, useEffect: throwInvalidHookError, useImperativeHandle: throwInvalidHookError, useLayoutEffect: throwInvalidHookError, useInsertionEffect: throwInvalidHookError, useMemo: throwInvalidHookError, useReducer: throwInvalidHookError, useRef: throwInvalidHookError, useState: throwInvalidHookError, useDebugValue: throwInvalidHookError, useDeferredValue: throwInvalidHookError, useTransition: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, useId: throwInvalidHookError, useHostTransitionStatus: throwInvalidHookError, useFormState: throwInvalidHookError, useActionState: throwInvalidHookError, useOptimistic: throwInvalidHookError, useMemoCache: throwInvalidHookError, useCacheRefresh: throwInvalidHookError, useEffectEvent: throwInvalidHookError }, HooksDispatcherOnMountInDEV = null, HooksDispatcherOnMountWithHookTypesInDEV = null, HooksDispatcherOnUpdateInDEV = null, HooksDispatcherOnRerenderInDEV = null, InvalidNestedHooksDispatcherOnMountInDEV = null, InvalidNestedHooksDispatcherOnUpdateInDEV = null, InvalidNestedHooksDispatcherOnRerenderInDEV = null; HooksDispatcherOnMountInDEV = { readContext: function(context) { return readContext(context); }, use, useCallback: function(callback, deps) { currentHookNameInDev = "useCallback"; mountHookTypesDev(); checkDepsAreArrayDev(deps); return mountCallback(callback, deps); }, useContext: function(context) { currentHookNameInDev = "useContext"; mountHookTypesDev(); return readContext(context); }, useEffect: function(create, deps) { currentHookNameInDev = "useEffect"; mountHookTypesDev(); checkDepsAreArrayDev(deps); return mountEffect(create, deps); }, useImperativeHandle: function(ref, create, deps) { currentHookNameInDev = "useImperativeHandle"; mountHookTypesDev(); checkDepsAreArrayDev(deps); return mountImperativeHandle(ref, create, deps); }, useInsertionEffect: function(create, deps) { currentHookNameInDev = "useInsertionEffect"; mountHookTypesDev(); checkDepsAreArrayDev(deps); mountEffectImpl(4, Insertion, create, deps); }, useLayoutEffect: function(create, deps) { currentHookNameInDev = "useLayoutEffect"; mountHookTypesDev(); checkDepsAreArrayDev(deps); return mountLayoutEffect(create, deps); }, useMemo: function(create, deps) { currentHookNameInDev = "useMemo"; mountHookTypesDev(); checkDepsAreArrayDev(deps); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { ReactSharedInternals.H = prevDispatcher; } }, useReducer: function(reducer, initialArg, init) { currentHookNameInDev = "useReducer"; mountHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { ReactSharedInternals.H = prevDispatcher; } }, useRef: function(initialValue) { currentHookNameInDev = "useRef"; mountHookTypesDev(); return mountRef(initialValue); }, useState: function(initialState) { currentHookNameInDev = "useState"; mountHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function() { currentHookNameInDev = "useDebugValue"; mountHookTypesDev(); }, useDeferredValue: function(value, initialValue) { currentHookNameInDev = "useDeferredValue"; mountHookTypesDev(); return mountDeferredValue(value, initialValue); }, useTransition: function() { currentHookNameInDev = "useTransition"; mountHookTypesDev(); return mountTransition(); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; mountHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); }, useId: function() { currentHookNameInDev = "useId"; mountHookTypesDev(); return mountId(); }, useFormState: function(action, initialState) { currentHookNameInDev = "useFormState"; mountHookTypesDev(); warnOnUseFormStateInDev(); return mountActionState(action, initialState); }, useActionState: function(action, initialState) { currentHookNameInDev = "useActionState"; mountHookTypesDev(); return mountActionState(action, initialState); }, useOptimistic: function(passthrough) { currentHookNameInDev = "useOptimistic"; mountHookTypesDev(); return mountOptimistic(passthrough); }, useHostTransitionStatus, useMemoCache, useCacheRefresh: function() { currentHookNameInDev = "useCacheRefresh"; mountHookTypesDev(); return mountRefresh(); }, useEffectEvent: function(callback) { currentHookNameInDev = "useEffectEvent"; mountHookTypesDev(); return mountEvent(callback); } }; HooksDispatcherOnMountWithHookTypesInDEV = { readContext: function(context) { return readContext(context); }, use, useCallback: function(callback, deps) { currentHookNameInDev = "useCallback"; updateHookTypesDev(); return mountCallback(callback, deps); }, useContext: function(context) { currentHookNameInDev = "useContext"; updateHookTypesDev(); return readContext(context); }, useEffect: function(create, deps) { currentHookNameInDev = "useEffect"; updateHookTypesDev(); return mountEffect(create, deps); }, useImperativeHandle: function(ref, create, deps) { currentHookNameInDev = "useImperativeHandle"; updateHookTypesDev(); return mountImperativeHandle(ref, create, deps); }, useInsertionEffect: function(create, deps) { currentHookNameInDev = "useInsertionEffect"; updateHookTypesDev(); mountEffectImpl(4, Insertion, create, deps); }, useLayoutEffect: function(create, deps) { currentHookNameInDev = "useLayoutEffect"; updateHookTypesDev(); return mountLayoutEffect(create, deps); }, useMemo: function(create, deps) { currentHookNameInDev = "useMemo"; updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { ReactSharedInternals.H = prevDispatcher; } }, useReducer: function(reducer, initialArg, init) { currentHookNameInDev = "useReducer"; updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { ReactSharedInternals.H = prevDispatcher; } }, useRef: function(initialValue) { currentHookNameInDev = "useRef"; updateHookTypesDev(); return mountRef(initialValue); }, useState: function(initialState) { currentHookNameInDev = "useState"; updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function() { currentHookNameInDev = "useDebugValue"; updateHookTypesDev(); }, useDeferredValue: function(value, initialValue) { currentHookNameInDev = "useDeferredValue"; updateHookTypesDev(); return mountDeferredValue(value, initialValue); }, useTransition: function() { currentHookNameInDev = "useTransition"; updateHookTypesDev(); return mountTransition(); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; updateHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); }, useId: function() { currentHookNameInDev = "useId"; updateHookTypesDev(); return mountId(); }, useActionState: function(action, initialState) { currentHookNameInDev = "useActionState"; updateHookTypesDev(); return mountActionState(action, initialState); }, useFormState: function(action, initialState) { currentHookNameInDev = "useFormState"; updateHookTypesDev(); warnOnUseFormStateInDev(); return mountActionState(action, initialState); }, useOptimistic: function(passthrough) { currentHookNameInDev = "useOptimistic"; updateHookTypesDev(); return mountOptimistic(passthrough); }, useHostTransitionStatus, useMemoCache, useCacheRefresh: function() { currentHookNameInDev = "useCacheRefresh"; updateHookTypesDev(); return mountRefresh(); }, useEffectEvent: function(callback) { currentHookNameInDev = "useEffectEvent"; updateHookTypesDev(); return mountEvent(callback); } }; HooksDispatcherOnUpdateInDEV = { readContext: function(context) { return readContext(context); }, use, useCallback: function(callback, deps) { currentHookNameInDev = "useCallback"; updateHookTypesDev(); return updateCallback(callback, deps); }, useContext: function(context) { currentHookNameInDev = "useContext"; updateHookTypesDev(); return readContext(context); }, useEffect: function(create, deps) { currentHookNameInDev = "useEffect"; updateHookTypesDev(); updateEffectImpl(2048, Passive, create, deps); }, useImperativeHandle: function(ref, create, deps) { currentHookNameInDev = "useImperativeHandle"; updateHookTypesDev(); return updateImperativeHandle(ref, create, deps); }, useInsertionEffect: function(create, deps) { currentHookNameInDev = "useInsertionEffect"; updateHookTypesDev(); return updateEffectImpl(4, Insertion, create, deps); }, useLayoutEffect: function(create, deps) { currentHookNameInDev = "useLayoutEffect"; updateHookTypesDev(); return updateEffectImpl(4, Layout, create, deps); }, useMemo: function(create, deps) { currentHookNameInDev = "useMemo"; updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { ReactSharedInternals.H = prevDispatcher; } }, useReducer: function(reducer, initialArg, init) { currentHookNameInDev = "useReducer"; updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateReducer(reducer, initialArg, init); } finally { ReactSharedInternals.H = prevDispatcher; } }, useRef: function() { currentHookNameInDev = "useRef"; updateHookTypesDev(); return updateWorkInProgressHook().memoizedState; }, useState: function() { currentHookNameInDev = "useState"; updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateReducer(basicStateReducer); } finally { ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function() { currentHookNameInDev = "useDebugValue"; updateHookTypesDev(); }, useDeferredValue: function(value, initialValue) { currentHookNameInDev = "useDeferredValue"; updateHookTypesDev(); return updateDeferredValue(value, initialValue); }, useTransition: function() { currentHookNameInDev = "useTransition"; updateHookTypesDev(); return updateTransition(); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); }, useId: function() { currentHookNameInDev = "useId"; updateHookTypesDev(); return updateWorkInProgressHook().memoizedState; }, useFormState: function(action) { currentHookNameInDev = "useFormState"; updateHookTypesDev(); warnOnUseFormStateInDev(); return updateActionState(action); }, useActionState: function(action) { currentHookNameInDev = "useActionState"; updateHookTypesDev(); return updateActionState(action); }, useOptimistic: function(passthrough, reducer) { currentHookNameInDev = "useOptimistic"; updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }, useHostTransitionStatus, useMemoCache, useCacheRefresh: function() { currentHookNameInDev = "useCacheRefresh"; updateHookTypesDev(); return updateWorkInProgressHook().memoizedState; }, useEffectEvent: function(callback) { currentHookNameInDev = "useEffectEvent"; updateHookTypesDev(); return updateEvent(callback); } }; HooksDispatcherOnRerenderInDEV = { readContext: function(context) { return readContext(context); }, use, useCallback: function(callback, deps) { currentHookNameInDev = "useCallback"; updateHookTypesDev(); return updateCallback(callback, deps); }, useContext: function(context) { currentHookNameInDev = "useContext"; updateHookTypesDev(); return readContext(context); }, useEffect: function(create, deps) { currentHookNameInDev = "useEffect"; updateHookTypesDev(); updateEffectImpl(2048, Passive, create, deps); }, useImperativeHandle: function(ref, create, deps) { currentHookNameInDev = "useImperativeHandle"; updateHookTypesDev(); return updateImperativeHandle(ref, create, deps); }, useInsertionEffect: function(create, deps) { currentHookNameInDev = "useInsertionEffect"; updateHookTypesDev(); return updateEffectImpl(4, Insertion, create, deps); }, useLayoutEffect: function(create, deps) { currentHookNameInDev = "useLayoutEffect"; updateHookTypesDev(); return updateEffectImpl(4, Layout, create, deps); }, useMemo: function(create, deps) { currentHookNameInDev = "useMemo"; updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return updateMemo(create, deps); } finally { ReactSharedInternals.H = prevDispatcher; } }, useReducer: function(reducer, initialArg, init) { currentHookNameInDev = "useReducer"; updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return rerenderReducer(reducer, initialArg, init); } finally { ReactSharedInternals.H = prevDispatcher; } }, useRef: function() { currentHookNameInDev = "useRef"; updateHookTypesDev(); return updateWorkInProgressHook().memoizedState; }, useState: function() { currentHookNameInDev = "useState"; updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return rerenderReducer(basicStateReducer); } finally { ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function() { currentHookNameInDev = "useDebugValue"; updateHookTypesDev(); }, useDeferredValue: function(value, initialValue) { currentHookNameInDev = "useDeferredValue"; updateHookTypesDev(); return rerenderDeferredValue(value, initialValue); }, useTransition: function() { currentHookNameInDev = "useTransition"; updateHookTypesDev(); return rerenderTransition(); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); }, useId: function() { currentHookNameInDev = "useId"; updateHookTypesDev(); return updateWorkInProgressHook().memoizedState; }, useFormState: function(action) { currentHookNameInDev = "useFormState"; updateHookTypesDev(); warnOnUseFormStateInDev(); return rerenderActionState(action); }, useActionState: function(action) { currentHookNameInDev = "useActionState"; updateHookTypesDev(); return rerenderActionState(action); }, useOptimistic: function(passthrough, reducer) { currentHookNameInDev = "useOptimistic"; updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }, useHostTransitionStatus, useMemoCache, useCacheRefresh: function() { currentHookNameInDev = "useCacheRefresh"; updateHookTypesDev(); return updateWorkInProgressHook().memoizedState; }, useEffectEvent: function(callback) { currentHookNameInDev = "useEffectEvent"; updateHookTypesDev(); return updateEvent(callback); } }; InvalidNestedHooksDispatcherOnMountInDEV = { readContext: function(context) { warnInvalidContextAccess(); return readContext(context); }, use: function(usable) { warnInvalidHookAccess(); return use(usable); }, useCallback: function(callback, deps) { currentHookNameInDev = "useCallback"; warnInvalidHookAccess(); mountHookTypesDev(); return mountCallback(callback, deps); }, useContext: function(context) { currentHookNameInDev = "useContext"; warnInvalidHookAccess(); mountHookTypesDev(); return readContext(context); }, useEffect: function(create, deps) { currentHookNameInDev = "useEffect"; warnInvalidHookAccess(); mountHookTypesDev(); return mountEffect(create, deps); }, useImperativeHandle: function(ref, create, deps) { currentHookNameInDev = "useImperativeHandle"; warnInvalidHookAccess(); mountHookTypesDev(); return mountImperativeHandle(ref, create, deps); }, useInsertionEffect: function(create, deps) { currentHookNameInDev = "useInsertionEffect"; warnInvalidHookAccess(); mountHookTypesDev(); mountEffectImpl(4, Insertion, create, deps); }, useLayoutEffect: function(create, deps) { currentHookNameInDev = "useLayoutEffect"; warnInvalidHookAccess(); mountHookTypesDev(); return mountLayoutEffect(create, deps); }, useMemo: function(create, deps) { currentHookNameInDev = "useMemo"; warnInvalidHookAccess(); mountHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { ReactSharedInternals.H = prevDispatcher; } }, useReducer: function(reducer, initialArg, init) { currentHookNameInDev = "useReducer"; warnInvalidHookAccess(); mountHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { ReactSharedInternals.H = prevDispatcher; } }, useRef: function(initialValue) { currentHookNameInDev = "useRef"; warnInvalidHookAccess(); mountHookTypesDev(); return mountRef(initialValue); }, useState: function(initialState) { currentHookNameInDev = "useState"; warnInvalidHookAccess(); mountHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function() { currentHookNameInDev = "useDebugValue"; warnInvalidHookAccess(); mountHookTypesDev(); }, useDeferredValue: function(value, initialValue) { currentHookNameInDev = "useDeferredValue"; warnInvalidHookAccess(); mountHookTypesDev(); return mountDeferredValue(value, initialValue); }, useTransition: function() { currentHookNameInDev = "useTransition"; warnInvalidHookAccess(); mountHookTypesDev(); return mountTransition(); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; warnInvalidHookAccess(); mountHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); }, useId: function() { currentHookNameInDev = "useId"; warnInvalidHookAccess(); mountHookTypesDev(); return mountId(); }, useFormState: function(action, initialState) { currentHookNameInDev = "useFormState"; warnInvalidHookAccess(); mountHookTypesDev(); return mountActionState(action, initialState); }, useActionState: function(action, initialState) { currentHookNameInDev = "useActionState"; warnInvalidHookAccess(); mountHookTypesDev(); return mountActionState(action, initialState); }, useOptimistic: function(passthrough) { currentHookNameInDev = "useOptimistic"; warnInvalidHookAccess(); mountHookTypesDev(); return mountOptimistic(passthrough); }, useMemoCache: function(size) { warnInvalidHookAccess(); return useMemoCache(size); }, useHostTransitionStatus, useCacheRefresh: function() { currentHookNameInDev = "useCacheRefresh"; mountHookTypesDev(); return mountRefresh(); }, useEffectEvent: function(callback) { currentHookNameInDev = "useEffectEvent"; warnInvalidHookAccess(); mountHookTypesDev(); return mountEvent(callback); } }; InvalidNestedHooksDispatcherOnUpdateInDEV = { readContext: function(context) { warnInvalidContextAccess(); return readContext(context); }, use: function(usable) { warnInvalidHookAccess(); return use(usable); }, useCallback: function(callback, deps) { currentHookNameInDev = "useCallback"; warnInvalidHookAccess(); updateHookTypesDev(); return updateCallback(callback, deps); }, useContext: function(context) { currentHookNameInDev = "useContext"; warnInvalidHookAccess(); updateHookTypesDev(); return readContext(context); }, useEffect: function(create, deps) { currentHookNameInDev = "useEffect"; warnInvalidHookAccess(); updateHookTypesDev(); updateEffectImpl(2048, Passive, create, deps); }, useImperativeHandle: function(ref, create, deps) { currentHookNameInDev = "useImperativeHandle"; warnInvalidHookAccess(); updateHookTypesDev(); return updateImperativeHandle(ref, create, deps); }, useInsertionEffect: function(create, deps) { currentHookNameInDev = "useInsertionEffect"; warnInvalidHookAccess(); updateHookTypesDev(); return updateEffectImpl(4, Insertion, create, deps); }, useLayoutEffect: function(create, deps) { currentHookNameInDev = "useLayoutEffect"; warnInvalidHookAccess(); updateHookTypesDev(); return updateEffectImpl(4, Layout, create, deps); }, useMemo: function(create, deps) { currentHookNameInDev = "useMemo"; warnInvalidHookAccess(); updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { ReactSharedInternals.H = prevDispatcher; } }, useReducer: function(reducer, initialArg, init) { currentHookNameInDev = "useReducer"; warnInvalidHookAccess(); updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateReducer(reducer, initialArg, init); } finally { ReactSharedInternals.H = prevDispatcher; } }, useRef: function() { currentHookNameInDev = "useRef"; warnInvalidHookAccess(); updateHookTypesDev(); return updateWorkInProgressHook().memoizedState; }, useState: function() { currentHookNameInDev = "useState"; warnInvalidHookAccess(); updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateReducer(basicStateReducer); } finally { ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function() { currentHookNameInDev = "useDebugValue"; warnInvalidHookAccess(); updateHookTypesDev(); }, useDeferredValue: function(value, initialValue) { currentHookNameInDev = "useDeferredValue"; warnInvalidHookAccess(); updateHookTypesDev(); return updateDeferredValue(value, initialValue); }, useTransition: function() { currentHookNameInDev = "useTransition"; warnInvalidHookAccess(); updateHookTypesDev(); return updateTransition(); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; warnInvalidHookAccess(); updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); }, useId: function() { currentHookNameInDev = "useId"; warnInvalidHookAccess(); updateHookTypesDev(); return updateWorkInProgressHook().memoizedState; }, useFormState: function(action) { currentHookNameInDev = "useFormState"; warnInvalidHookAccess(); updateHookTypesDev(); return updateActionState(action); }, useActionState: function(action) { currentHookNameInDev = "useActionState"; warnInvalidHookAccess(); updateHookTypesDev(); return updateActionState(action); }, useOptimistic: function(passthrough, reducer) { currentHookNameInDev = "useOptimistic"; warnInvalidHookAccess(); updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }, useMemoCache: function(size) { warnInvalidHookAccess(); return useMemoCache(size); }, useHostTransitionStatus, useCacheRefresh: function() { currentHookNameInDev = "useCacheRefresh"; updateHookTypesDev(); return updateWorkInProgressHook().memoizedState; }, useEffectEvent: function(callback) { currentHookNameInDev = "useEffectEvent"; warnInvalidHookAccess(); updateHookTypesDev(); return updateEvent(callback); } }; InvalidNestedHooksDispatcherOnRerenderInDEV = { readContext: function(context) { warnInvalidContextAccess(); return readContext(context); }, use: function(usable) { warnInvalidHookAccess(); return use(usable); }, useCallback: function(callback, deps) { currentHookNameInDev = "useCallback"; warnInvalidHookAccess(); updateHookTypesDev(); return updateCallback(callback, deps); }, useContext: function(context) { currentHookNameInDev = "useContext"; warnInvalidHookAccess(); updateHookTypesDev(); return readContext(context); }, useEffect: function(create, deps) { currentHookNameInDev = "useEffect"; warnInvalidHookAccess(); updateHookTypesDev(); updateEffectImpl(2048, Passive, create, deps); }, useImperativeHandle: function(ref, create, deps) { currentHookNameInDev = "useImperativeHandle"; warnInvalidHookAccess(); updateHookTypesDev(); return updateImperativeHandle(ref, create, deps); }, useInsertionEffect: function(create, deps) { currentHookNameInDev = "useInsertionEffect"; warnInvalidHookAccess(); updateHookTypesDev(); return updateEffectImpl(4, Insertion, create, deps); }, useLayoutEffect: function(create, deps) { currentHookNameInDev = "useLayoutEffect"; warnInvalidHookAccess(); updateHookTypesDev(); return updateEffectImpl(4, Layout, create, deps); }, useMemo: function(create, deps) { currentHookNameInDev = "useMemo"; warnInvalidHookAccess(); updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { ReactSharedInternals.H = prevDispatcher; } }, useReducer: function(reducer, initialArg, init) { currentHookNameInDev = "useReducer"; warnInvalidHookAccess(); updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return rerenderReducer(reducer, initialArg, init); } finally { ReactSharedInternals.H = prevDispatcher; } }, useRef: function() { currentHookNameInDev = "useRef"; warnInvalidHookAccess(); updateHookTypesDev(); return updateWorkInProgressHook().memoizedState; }, useState: function() { currentHookNameInDev = "useState"; warnInvalidHookAccess(); updateHookTypesDev(); var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return rerenderReducer(basicStateReducer); } finally { ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function() { currentHookNameInDev = "useDebugValue"; warnInvalidHookAccess(); updateHookTypesDev(); }, useDeferredValue: function(value, initialValue) { currentHookNameInDev = "useDeferredValue"; warnInvalidHookAccess(); updateHookTypesDev(); return rerenderDeferredValue(value, initialValue); }, useTransition: function() { currentHookNameInDev = "useTransition"; warnInvalidHookAccess(); updateHookTypesDev(); return rerenderTransition(); }, useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; warnInvalidHookAccess(); updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); }, useId: function() { currentHookNameInDev = "useId"; warnInvalidHookAccess(); updateHookTypesDev(); return updateWorkInProgressHook().memoizedState; }, useFormState: function(action) { currentHookNameInDev = "useFormState"; warnInvalidHookAccess(); updateHookTypesDev(); return rerenderActionState(action); }, useActionState: function(action) { currentHookNameInDev = "useActionState"; warnInvalidHookAccess(); updateHookTypesDev(); return rerenderActionState(action); }, useOptimistic: function(passthrough, reducer) { currentHookNameInDev = "useOptimistic"; warnInvalidHookAccess(); updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }, useMemoCache: function(size) { warnInvalidHookAccess(); return useMemoCache(size); }, useHostTransitionStatus, useCacheRefresh: function() { currentHookNameInDev = "useCacheRefresh"; updateHookTypesDev(); return updateWorkInProgressHook().memoizedState; }, useEffectEvent: function(callback) { currentHookNameInDev = "useEffectEvent"; warnInvalidHookAccess(); updateHookTypesDev(); return updateEvent(callback); } }; var fakeInternalInstance = {}; var didWarnAboutStateAssignmentForComponent = /* @__PURE__ */ new Set(); var didWarnAboutUninitializedState = /* @__PURE__ */ new Set(); var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = /* @__PURE__ */ new Set(); var didWarnAboutLegacyLifecyclesAndDerivedState = /* @__PURE__ */ new Set(); var didWarnAboutDirectlyAssigningPropsToState = /* @__PURE__ */ new Set(); var didWarnAboutUndefinedDerivedState = /* @__PURE__ */ new Set(); var didWarnAboutContextTypes$1 = /* @__PURE__ */ new Set(); var didWarnAboutChildContextTypes = /* @__PURE__ */ new Set(); var didWarnAboutInvalidateContextType = /* @__PURE__ */ new Set(); var didWarnOnInvalidCallback = /* @__PURE__ */ new Set(); Object.freeze(fakeInternalInstance); var classComponentUpdater = { enqueueSetState: function(inst, payload, callback) { inst = inst._reactInternals; var lane = requestUpdateLane(inst), update = createUpdate(lane); update.payload = payload; void 0 !== callback && null !== callback && (warnOnInvalidCallback(callback), update.callback = callback); payload = enqueueUpdate(inst, update, lane); null !== payload && (startUpdateTimerByLane(lane, "this.setState()", inst), scheduleUpdateOnFiber(payload, inst, lane), entangleTransitions(payload, inst, lane)); }, enqueueReplaceState: function(inst, payload, callback) { inst = inst._reactInternals; var lane = requestUpdateLane(inst), update = createUpdate(lane); update.tag = ReplaceState; update.payload = payload; void 0 !== callback && null !== callback && (warnOnInvalidCallback(callback), update.callback = callback); payload = enqueueUpdate(inst, update, lane); null !== payload && (startUpdateTimerByLane(lane, "this.replaceState()", inst), scheduleUpdateOnFiber(payload, inst, lane), entangleTransitions(payload, inst, lane)); }, enqueueForceUpdate: function(inst, callback) { inst = inst._reactInternals; var lane = requestUpdateLane(inst), update = createUpdate(lane); update.tag = ForceUpdate; void 0 !== callback && null !== callback && (warnOnInvalidCallback(callback), update.callback = callback); callback = enqueueUpdate(inst, update, lane); null !== callback && (startUpdateTimerByLane(lane, "this.forceUpdate()", inst), scheduleUpdateOnFiber(callback, inst, lane), entangleTransitions(callback, inst, lane)); } }, componentName = null, errorBoundaryName = null, SelectiveHydrationException = Error("This is not a real error. It's an implementation detail of React's selective hydration feature. If this leaks into userspace, it's a bug in React. Please file an issue."), didReceiveUpdate = !1; var didWarnAboutBadClass = {}; var didWarnAboutContextTypeOnFunctionComponent = {}; var didWarnAboutContextTypes = {}; var didWarnAboutGetDerivedStateOnFunctionComponent = {}; var didWarnAboutReassigningProps = !1; var didWarnAboutRevealOrder = {}; var didWarnAboutTailOptions = {}; var didWarnAboutClassNameOnViewTransition = {}; var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0, hydrationErrors: null }, hasWarnedAboutUsingNoValuePropOnContextProvider = !1, didWarnAboutUndefinedSnapshotBeforeUpdate = null; didWarnAboutUndefinedSnapshotBeforeUpdate = /* @__PURE__ */ new Set(); var viewTransitionMutationContext = !1, shouldStartViewTransition = !1, appearingViewTransitions = null, viewTransitionCancelableChildren = null, viewTransitionHostInstanceIdx = 0, mountedNamedViewTransitions = /* @__PURE__ */ new Map(), didWarnAboutName = {}, NoLayoutEffectTraversalFlags = 0, IncludeWorkInProgressEffects = 1, IncludeHostSingletons = 2, offscreenSubtreeIsHidden = !1, offscreenSubtreeWasHidden = !1, offscreenDirectParentIsHidden = !1, needsFormReset = !1, PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, nextEffect = null, inProgressLanes = null, inProgressRoot = null, viewTransitionContextChanged = !1, inUpdateViewTransition = !1, rootViewTransitionAffected = !1, rootViewTransitionNameCanceled = !1, hostParent = null, hostParentIsContainer = !1, currentHoistableRoot = null, inHydratedSubtree = !1, suspenseyCommitFlag = 8192, DefaultAsyncDispatcher = { getCacheForType: function(resourceType) { var cache = readContext(CacheContext), cacheForType = cache.data.get(resourceType); void 0 === cacheForType && (cacheForType = resourceType(), cache.data.set(resourceType, cacheForType)); return cacheForType; }, cacheSignal: function() { return readContext(CacheContext).controller.signal; }, getOwner: function() { return current; } }, COMPONENT_TYPE = 0, HAS_PSEUDO_CLASS_TYPE = 1, ROLE_TYPE = 2, TEST_NAME_TYPE = 3, TEXT_TYPE = 4; if ("function" === typeof Symbol && Symbol.for) { var symbolFor = Symbol.for; COMPONENT_TYPE = symbolFor("selector.component"); HAS_PSEUDO_CLASS_TYPE = symbolFor("selector.has_pseudo_class"); ROLE_TYPE = symbolFor("selector.role"); TEST_NAME_TYPE = symbolFor("selector.test_id"); TEXT_TYPE = symbolFor("selector.text"); } var commitHooks = [], PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, NoContext = 0, RenderContext = 2, CommitContext = 4, RootInProgress = 0, RootFatalErrored = 1, RootErrored = 2, RootSuspended = 3, RootSuspendedWithDelay = 4, RootSuspendedAtTheShell = 6, RootCompleted = 5, executionContext = NoContext, workInProgressRoot = null, workInProgress = null, workInProgressRootRenderLanes = 0, NotSuspended = 0, SuspendedOnError = 1, SuspendedOnData = 2, SuspendedOnImmediate = 3, SuspendedOnInstance = 4, SuspendedOnInstanceAndReadyToContinue = 5, SuspendedOnDeprecatedThrowPromise = 6, SuspendedAndReadyToContinue = 7, SuspendedOnHydration = 8, SuspendedOnAction = 9, workInProgressSuspendedReason = NotSuspended, workInProgressThrownValue = null, workInProgressRootDidSkipSuspendedSiblings = !1, workInProgressRootIsPrerendering = !1, workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = RootInProgress, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, workInProgressDeferredLane = 0, workInProgressSuspendedRetryLanes = 0, workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, workInProgressRootDidIncludeRecursiveRenderUpdate = !1, globalMostRecentFallbackTime = 0, globalMostRecentTransitionTime = 0, FALLBACK_THROTTLE_MS = 300, workInProgressRootRenderTargetTime = Infinity, RENDER_TIMEOUT_MS = 500, workInProgressTransitions = null, workInProgressUpdateTask = null, legacyErrorBoundariesThatAlreadyFailed = null, IMMEDIATE_COMMIT = 0, ABORTED_VIEW_TRANSITION_COMMIT = 1, DELAYED_PASSIVE_COMMIT = 2, ANIMATION_STARTED_COMMIT = 3, NO_PENDING_EFFECTS = 0, PENDING_MUTATION_PHASE = 1, PENDING_LAYOUT_PHASE = 2, PENDING_AFTER_MUTATION_PHASE = 3, PENDING_SPAWNED_WORK = 4, PENDING_PASSIVE_PHASE = 5, pendingEffectsStatus = 0, pendingEffectsRoot = null, pendingFinishedWork = null, pendingEffectsLanes = 0, pendingEffectsRemainingLanes = 0, pendingEffectsRenderEndTime = -0, pendingPassiveTransitions = null, pendingRecoverableErrors = null, pendingViewTransition = null, pendingViewTransitionEvents = null, pendingTransitionTypes = null, pendingSuspendedCommitReason = null, pendingDelayedCommitReason = IMMEDIATE_COMMIT, pendingSuspendedViewTransitionReason = null, NESTED_UPDATE_LIMIT = 50, nestedUpdateCount = 0, rootWithNestedUpdates = null, isFlushingPassiveEffects = !1, didScheduleUpdateDuringPassiveEffects = !1, NESTED_PASSIVE_UPDATE_LIMIT = 50, nestedPassiveUpdateCount = 0, rootWithPassiveNestedUpdates = null, isRunningInsertionEffect = !1, didWarnAboutInterruptedViewTransitions = !1, didWarnStateUpdateForNotYetMountedComponent = null, didWarnAboutUpdateInRender = !1; var didWarnAboutUpdateInRenderForAnotherComponent = /* @__PURE__ */ new Set(); var fakeActCallbackNode = {}, resolveFamily = null, failedBoundaries = null; var hasBadMapPolyfill = !1; try { Object.preventExtensions({}); } catch (e) { hasBadMapPolyfill = !0; } var didWarnAboutNestedUpdates = !1; var didWarnAboutFindNodeInStrictMode = {}; var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, scheduleRetry = null, setErrorHandler = null, setSuspenseHandler = null; overrideHookState = function(fiber, id, path, value) { id = findHook(fiber, id); null !== id && (path = copyWithSetImpl(id.memoizedState, path, 0, value), id.memoizedState = path, id.baseState = path, fiber.memoizedProps = assign({}, fiber.memoizedProps), path = enqueueConcurrentRenderForLane(fiber, 2), null !== path && scheduleUpdateOnFiber(path, fiber, 2)); }; overrideHookStateDeletePath = function(fiber, id, path) { id = findHook(fiber, id); null !== id && (path = copyWithDeleteImpl(id.memoizedState, path, 0), id.memoizedState = path, id.baseState = path, fiber.memoizedProps = assign({}, fiber.memoizedProps), path = enqueueConcurrentRenderForLane(fiber, 2), null !== path && scheduleUpdateOnFiber(path, fiber, 2)); }; overrideHookStateRenamePath = function(fiber, id, oldPath, newPath) { id = findHook(fiber, id); null !== id && (oldPath = copyWithRename(id.memoizedState, oldPath, newPath), id.memoizedState = oldPath, id.baseState = oldPath, fiber.memoizedProps = assign({}, fiber.memoizedProps), oldPath = enqueueConcurrentRenderForLane(fiber, 2), null !== oldPath && scheduleUpdateOnFiber(oldPath, fiber, 2)); }; overrideProps = function(fiber, path, value) { fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path, 0, value); fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps); path = enqueueConcurrentRenderForLane(fiber, 2); null !== path && scheduleUpdateOnFiber(path, fiber, 2); }; overridePropsDeletePath = function(fiber, path) { fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path, 0); fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps); path = enqueueConcurrentRenderForLane(fiber, 2); null !== path && scheduleUpdateOnFiber(path, fiber, 2); }; overridePropsRenamePath = function(fiber, oldPath, newPath) { fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath); fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps); oldPath = enqueueConcurrentRenderForLane(fiber, 2); null !== oldPath && scheduleUpdateOnFiber(oldPath, fiber, 2); }; scheduleUpdate = function(fiber) { var root = enqueueConcurrentRenderForLane(fiber, 2); null !== root && scheduleUpdateOnFiber(root, fiber, 2); }; scheduleRetry = function(fiber) { var lane = claimNextRetryLane(), root = enqueueConcurrentRenderForLane(fiber, lane); null !== root && scheduleUpdateOnFiber(root, fiber, lane); }; setErrorHandler = function(newShouldErrorImpl) { shouldErrorImpl = newShouldErrorImpl; }; setSuspenseHandler = function(newShouldSuspendImpl) { shouldSuspendImpl = newShouldSuspendImpl; }; exports.attemptContinuousHydration = function(fiber) { if (13 === fiber.tag || 31 === fiber.tag) { var root = enqueueConcurrentRenderForLane(fiber, 67108864); null !== root && scheduleUpdateOnFiber(root, fiber, 67108864); markRetryLaneIfNotHydrated(fiber, 67108864); } }; exports.attemptHydrationAtCurrentPriority = function(fiber) { if (13 === fiber.tag || 31 === fiber.tag) { var lane = requestUpdateLane(fiber); lane = getBumpedLaneForHydrationByLane(lane); var root = enqueueConcurrentRenderForLane(fiber, lane); null !== root && scheduleUpdateOnFiber(root, fiber, lane); markRetryLaneIfNotHydrated(fiber, lane); } }; exports.attemptSynchronousHydration = function(fiber) { switch (fiber.tag) { case 3: fiber = fiber.stateNode; if (fiber.current.memoizedState.isDehydrated) { var lanes = getHighestPriorityLanes(fiber.pendingLanes); if (0 !== lanes) { fiber.pendingLanes |= 2; for (fiber.entangledLanes |= 2; lanes;) { var lane = 1 << 31 - clz32(lanes); fiber.entanglements[1] |= lane; lanes &= ~lane; } ensureRootIsScheduled(fiber); (executionContext & (RenderContext | CommitContext)) === NoContext && (workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS, flushSyncWorkAcrossRoots_impl(0, !1)); } } break; case 31: case 13: lanes = enqueueConcurrentRenderForLane(fiber, 2), null !== lanes && scheduleUpdateOnFiber(lanes, fiber, 2), flushSyncWork(), markRetryLaneIfNotHydrated(fiber, 2); } }; exports.batchedUpdates = function(fn, a) { return fn(a); }; exports.createComponentSelector = function(component) { return { $$typeof: COMPONENT_TYPE, value: component }; }; exports.createContainer = function(containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator) { return createFiberRoot(containerInfo, tag, !1, null, hydrationCallbacks, isStrictMode, identifierPrefix, null, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator); }; exports.createHasPseudoClassSelector = function(selectors) { return { $$typeof: HAS_PSEUDO_CLASS_TYPE, value: selectors }; }; exports.createHydrationContainer = function(initialChildren, callback, containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator, transitionCallbacks, formState) { initialChildren = createFiberRoot(containerInfo, tag, !0, initialChildren, hydrationCallbacks, isStrictMode, identifierPrefix, formState, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator); initialChildren.context = getContextForSubtree(null); containerInfo = initialChildren.current; tag = requestUpdateLane(containerInfo); tag = getBumpedLaneForHydrationByLane(tag); hydrationCallbacks = createUpdate(tag); hydrationCallbacks.callback = void 0 !== callback && null !== callback ? callback : null; enqueueUpdate(containerInfo, hydrationCallbacks, tag); startUpdateTimerByLane(tag, "hydrateRoot()", null); callback = tag; initialChildren.current.lanes = callback; markRootUpdated$1(initialChildren, callback); ensureRootIsScheduled(initialChildren); return initialChildren; }; exports.createPortal = function(children, containerInfo, implementation) { var key = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null; if (null == key) key = null; else if (key === REACT_OPTIMISTIC_KEY) key = REACT_OPTIMISTIC_KEY; else { try { testStringCoercion(key); var JSCompiler_inline_result = !1; } catch (e$6) { JSCompiler_inline_result = !0; } JSCompiler_inline_result && (console.error("The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", "function" === typeof Symbol && Symbol.toStringTag && key[Symbol.toStringTag] || key.constructor.name || "Object"), testStringCoercion(key)); key = "" + key; } return { $$typeof: REACT_PORTAL_TYPE, key, children, containerInfo, implementation }; }; exports.createRoleSelector = function(role) { return { $$typeof: ROLE_TYPE, value: role }; }; exports.createTestNameSelector = function(id) { return { $$typeof: TEST_NAME_TYPE, value: id }; }; exports.createTextSelector = function(text) { return { $$typeof: TEXT_TYPE, value: text }; }; exports.defaultOnCaughtError = function(error) { var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component." : "The above error occurred in one of your React components.", recreateMessage = "React will try to recreate this component tree from scratch using the error boundary you provided, " + ((errorBoundaryName || "Anonymous") + "."); "object" === typeof error && null !== error && "string" === typeof error.environmentName ? bindToConsole("error", [ "%o\n\n%s\n\n%s\n", error, componentNameMessage, recreateMessage ], error.environmentName)() : console.error("%o\n\n%s\n\n%s\n", error, componentNameMessage, recreateMessage); }; exports.defaultOnRecoverableError = function(error) { reportGlobalError(error); }; exports.defaultOnUncaughtError = function(error) { reportGlobalError(error); console.warn("%s\n\n%s\n", componentName ? "An error occurred in the <" + componentName + "> component." : "An error occurred in one of your React components.", "Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://react.dev/link/error-boundaries to learn more about error boundaries."); }; exports.deferredUpdates = function(fn) { var prevTransition = ReactSharedInternals.T, previousPriority = getCurrentUpdatePriority(); try { return setCurrentUpdatePriority(32), ReactSharedInternals.T = null, fn(); } finally { setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition; } }; exports.discreteUpdates = function(fn, a, b, c, d) { var prevTransition = ReactSharedInternals.T, previousPriority = getCurrentUpdatePriority(); try { return setCurrentUpdatePriority(2), ReactSharedInternals.T = null, fn(a, b, c, d); } finally { setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition, executionContext === NoContext && (workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS); } }; exports.findAllNodes = findAllNodes; exports.findBoundingRects = function(hostRoot, selectors) { if (!supportsTestSelectors) throw Error("Test selector API is not supported by this renderer."); selectors = findAllNodes(hostRoot, selectors); hostRoot = []; for (var i = 0; i < selectors.length; i++) hostRoot.push(getBoundingRect(selectors[i])); for (selectors = hostRoot.length - 1; 0 < selectors; selectors--) { i = hostRoot[selectors]; for (var targetLeft = i.x, targetRight = targetLeft + i.width, targetTop = i.y, targetBottom = targetTop + i.height, j = selectors - 1; 0 <= j; j--) if (selectors !== j) { var otherRect = hostRoot[j], otherLeft = otherRect.x, otherRight = otherLeft + otherRect.width, otherTop = otherRect.y, otherBottom = otherTop + otherRect.height; if (targetLeft >= otherLeft && targetTop >= otherTop && targetRight <= otherRight && targetBottom <= otherBottom) { hostRoot.splice(selectors, 1); break; } else if (!(targetLeft !== otherLeft || i.width !== otherRect.width || otherBottom < targetTop || otherTop > targetBottom)) { otherTop > targetTop && (otherRect.height += otherTop - targetTop, otherRect.y = targetTop); otherBottom < targetBottom && (otherRect.height = targetBottom - otherTop); hostRoot.splice(selectors, 1); break; } else if (!(targetTop !== otherTop || i.height !== otherRect.height || otherRight < targetLeft || otherLeft > targetRight)) { otherLeft > targetLeft && (otherRect.width += otherLeft - targetLeft, otherRect.x = targetLeft); otherRight < targetRight && (otherRect.width = targetRight - otherLeft); hostRoot.splice(selectors, 1); break; } } } return hostRoot; }; exports.findHostInstance = function(component) { var fiber = component._reactInternals; if (void 0 === fiber) { if ("function" === typeof component.render) throw Error("Unable to find node on an unmounted component."); component = Object.keys(component).join(","); throw Error("Argument appears to not be a ReactComponent. Keys: " + component); } component = findCurrentHostFiber(fiber); return null === component ? null : getPublicInstance(component.stateNode); }; exports.findHostInstanceWithNoPortals = function(fiber) { fiber = findCurrentFiberUsingSlowPath(fiber); fiber = null !== fiber ? findCurrentHostFiberWithNoPortalsImpl(fiber) : null; return null === fiber ? null : getPublicInstance(fiber.stateNode); }; exports.findHostInstanceWithWarning = function(component, methodName) { var fiber = component._reactInternals; if (void 0 === fiber) { if ("function" === typeof component.render) throw Error("Unable to find node on an unmounted component."); component = Object.keys(component).join(","); throw Error("Argument appears to not be a ReactComponent. Keys: " + component); } component = findCurrentHostFiber(fiber); if (null === component) return null; if (component.mode & 8) { var componentName = getComponentNameFromFiber(fiber) || "Component"; didWarnAboutFindNodeInStrictMode[componentName] || (didWarnAboutFindNodeInStrictMode[componentName] = !0, runWithFiberInDEV(component, function() { fiber.mode & 8 ? console.error("%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://react.dev/link/strict-mode-find-node", methodName, methodName, componentName) : console.error("%s is deprecated in StrictMode. %s was passed an instance of %s which renders StrictMode children. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://react.dev/link/strict-mode-find-node", methodName, methodName, componentName); })); } return getPublicInstance(component.stateNode); }; exports.flushPassiveEffects = flushPendingEffects; exports.flushSyncFromReconciler = function(fn) { var prevExecutionContext = executionContext; executionContext |= 1; var prevTransition = ReactSharedInternals.T, previousPriority = getCurrentUpdatePriority(); try { if (setCurrentUpdatePriority(2), ReactSharedInternals.T = null, fn) return fn(); } finally { setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition, executionContext = prevExecutionContext, (executionContext & (RenderContext | CommitContext)) === NoContext && flushSyncWorkAcrossRoots_impl(0, !1); } }; exports.flushSyncWork = flushSyncWork; exports.focusWithin = function(hostRoot, selectors) { if (!supportsTestSelectors) throw Error("Test selector API is not supported by this renderer."); hostRoot = findFiberRootForHostRoot(hostRoot); selectors = findPaths(hostRoot, selectors); selectors = Array.from(selectors); for (hostRoot = 0; hostRoot < selectors.length;) { var fiber = selectors[hostRoot++], tag = fiber.tag; if (!isHiddenSubtree(fiber)) { if ((5 === tag || 26 === tag || 27 === tag) && setFocusIfFocusable(fiber.stateNode)) return !0; for (fiber = fiber.child; null !== fiber;) selectors.push(fiber), fiber = fiber.sibling; } } return !1; }; exports.getFindAllNodesFailureDescription = function(hostRoot, selectors) { if (!supportsTestSelectors) throw Error("Test selector API is not supported by this renderer."); var maxSelectorIndex = 0, matchedNames = []; hostRoot = [findFiberRootForHostRoot(hostRoot), 0]; for (var index = 0; index < hostRoot.length;) { var fiber = hostRoot[index++], tag = fiber.tag, selectorIndex = hostRoot[index++], selector = selectors[selectorIndex]; if (5 !== tag && 26 !== tag && 27 !== tag || !isHiddenSubtree(fiber)) { if (matchSelector(fiber, selector) && (matchedNames.push(selectorToString(selector)), selectorIndex++, selectorIndex > maxSelectorIndex && (maxSelectorIndex = selectorIndex)), selectorIndex < selectors.length) for (fiber = fiber.child; null !== fiber;) hostRoot.push(fiber, selectorIndex), fiber = fiber.sibling; } } if (maxSelectorIndex < selectors.length) { for (hostRoot = []; maxSelectorIndex < selectors.length; maxSelectorIndex++) hostRoot.push(selectorToString(selectors[maxSelectorIndex])); return "findAllNodes was able to match part of the selector:\n " + (matchedNames.join(" > ") + "\n\nNo matching component was found for:\n ") + hostRoot.join(" > "); } return null; }; exports.getPublicRootInstance = function(container) { container = container.current; if (!container.child) return null; switch (container.child.tag) { case 27: case 5: return getPublicInstance(container.child.stateNode); default: return container.child.stateNode; } }; exports.injectIntoDevTools = function() { var internals = { bundleType: 1, version: rendererVersion, rendererPackageName, currentDispatcherRef: ReactSharedInternals, reconcilerVersion: "19.3.0" }; null !== extraDevToolsConfig && (internals.rendererConfig = extraDevToolsConfig); internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; internals.overrideHookStateRenamePath = overrideHookStateRenamePath; internals.overrideProps = overrideProps; internals.overridePropsDeletePath = overridePropsDeletePath; internals.overridePropsRenamePath = overridePropsRenamePath; internals.scheduleUpdate = scheduleUpdate; internals.scheduleRetry = scheduleRetry; internals.setErrorHandler = setErrorHandler; internals.setSuspenseHandler = setSuspenseHandler; internals.scheduleRefresh = scheduleRefresh; internals.scheduleRoot = scheduleRoot; internals.setRefreshHandler = setRefreshHandler; internals.getCurrentFiber = getCurrentFiberForDevTools; return injectInternals(internals); }; exports.isAlreadyRendering = isAlreadyRendering; exports.observeVisibleRects = function(hostRoot, selectors, callback, options) { function commitHook() { var nextInstanceRoots = findAllNodes(hostRoot, selectors); instanceRoots.forEach(function(target) { 0 > nextInstanceRoots.indexOf(target) && unobserve(target); }); nextInstanceRoots.forEach(function(target) { 0 > instanceRoots.indexOf(target) && observe(target); }); } if (!supportsTestSelectors) throw Error("Test selector API is not supported by this renderer."); var instanceRoots = findAllNodes(hostRoot, selectors); callback = setupIntersectionObserver(instanceRoots, callback, options); var disconnect = callback.disconnect, observe = callback.observe, unobserve = callback.unobserve; commitHooks.push(commitHook); return { disconnect: function() { var index = commitHooks.indexOf(commitHook); 0 <= index && commitHooks.splice(index, 1); disconnect(); } }; }; exports.shouldError = function(fiber) { return shouldErrorImpl(fiber); }; exports.shouldSuspend = function(fiber) { return shouldSuspendImpl(fiber); }; exports.startHostTransition = function(formFiber, pendingState, action, formData) { if (5 !== formFiber.tag) throw Error("Expected the form instance to be a HostComponent. This is a bug in React."); var queue = ensureFormComponentIsStateful(formFiber).queue; startHostActionTimer(formFiber); startTransition(formFiber, queue, pendingState, NotPendingTransition, null === action ? noop : function() { null === ReactSharedInternals.T && console.error("requestFormReset was called outside a transition or action. To fix, move to an action, or wrap with startTransition."); var stateHook = ensureFormComponentIsStateful(formFiber); null === stateHook.next && (stateHook = formFiber.alternate.memoizedState); dispatchSetStateInternal(formFiber, stateHook.next.queue, {}, requestUpdateLane(formFiber)); return action(formData); }); }; exports.updateContainer = function(element, container, parentComponent, callback) { var current = container.current, lane = requestUpdateLane(current); updateContainerImpl(current, lane, element, container, parentComponent, callback); return lane; }; exports.updateContainerSync = updateContainerSync; return exports; }, module.exports.default = module.exports, Object.defineProperty(module.exports, "__esModule", { value: !0 }); })); //#endregion //#region node_modules/react-reconciler/index.js var require_react_reconciler = /* @__PURE__ */ __commonJSMin(((exports, module) => { module.exports = require_react_reconciler_development(); })); //#endregion //#region node_modules/react-reconciler/cjs/react-reconciler-constants.development.js /** * @license React * react-reconciler-constants.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var require_react_reconciler_constants_development = /* @__PURE__ */ __commonJSMin(((exports) => { exports.ConcurrentRoot = 1, exports.ContinuousEventPriority = 8, exports.DefaultEventPriority = 32, exports.DiscreteEventPriority = 2, exports.IdleEventPriority = 268435456, exports.LegacyRoot = 0, exports.NoEventPriority = 0; })); //#endregion //#region node_modules/react-reconciler/constants.js var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => { module.exports = require_react_reconciler_constants_development(); })); //#endregion //#region node_modules/react-konva/es/makeUpdates.js var import_react_reconciler = /* @__PURE__ */ __toESM(require_react_reconciler(), 1); var import_constants = require_constants(); var propsToSkip = { children: true, ref: true, key: true, style: true, forwardedRef: true, eventBatchFunc: true, unstable_applyCache: true, unstable_applyDrawHitFromCache: true }; var zIndexWarningShowed = false; var dragWarningShowed = false; var EVENTS_NAMESPACE = ".react-konva-event"; var useStrictMode$1 = false; function toggleStrictMode(value) { useStrictMode$1 = value; } var DRAGGABLE_WARNING = `ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. Position of a node will be changed during drag&drop, so you should update state of the react app as well. Consider to add onDragMove or onDragEnd events. For more info see: https://github.com/konvajs/react-konva/issues/256 `; var Z_INDEX_WARNING = `ReactKonva: You are using "zIndex" attribute for a Konva node. react-konva may get confused with ordering. Just define correct order of elements in your render function of a component. For more info see: https://github.com/konvajs/react-konva/issues/194 `; var EMPTY_PROPS = {}; function applyNodeProps(instance, props, oldProps = EMPTY_PROPS) { if (!zIndexWarningShowed && "zIndex" in props) { console.warn(Z_INDEX_WARNING); zIndexWarningShowed = true; } if (!dragWarningShowed && props.draggable) { var hasPosition = props.x !== void 0 || props.y !== void 0; var hasEvents = props.onDragEnd || props.onDragMove; if (hasPosition && !hasEvents) { console.warn(DRAGGABLE_WARNING); dragWarningShowed = true; } } var updatedProps = {}; var hasUpdates = false; for (var key in oldProps) { if (propsToSkip[key]) continue; var isEvent = key.slice(0, 2) === "on"; var propChanged = oldProps[key] !== props[key]; if (isEvent && propChanged) { var eventName = key.substr(2).toLowerCase(); if (eventName.substr(0, 7) === "content") eventName = "content" + eventName.substr(7, 1).toUpperCase() + eventName.substr(8); instance.off(eventName + EVENTS_NAMESPACE); } var toRemove = !props.hasOwnProperty(key); if (!isEvent && toRemove) { updatedProps[key] = void 0; hasUpdates = true; } } var strictUpdate = useStrictMode$1 || props._useStrictMode; const newEvents = {}; for (var key in props) { if (propsToSkip[key]) continue; var isEvent = key.slice(0, 2) === "on"; var toAdd = oldProps[key] !== props[key]; if (isEvent && toAdd) { var eventName = key.substr(2).toLowerCase(); if (eventName.substr(0, 7) === "content") eventName = "content" + eventName.substr(7, 1).toUpperCase() + eventName.substr(8); if (props[key]) newEvents[eventName] = props[key]; } if (!isEvent && (props[key] !== oldProps[key] || strictUpdate && props[key] !== instance.getAttr(key))) { hasUpdates = true; updatedProps[key] = props[key]; } } if (hasUpdates) { instance.setAttrs(updatedProps); updatePicture(instance); } for (var eventName in newEvents) { instance.off(eventName + EVENTS_NAMESPACE); instance.on(eventName + EVENTS_NAMESPACE, newEvents[eventName]); } } function updatePicture(node) { if (!Konva$2.autoDrawEnabled) { var drawingNode = node.getLayer() || node.getStage(); drawingNode && drawingNode.batchDraw(); } } //#endregion //#region node_modules/react-konva/es/EventBatch.js var import_scheduler = require_scheduler(); var pending = /* @__PURE__ */ new Set(); var pendingUnmounts = /* @__PURE__ */ new Set(); var enqueue = typeof queueMicrotask === "function" ? queueMicrotask : (callback) => Promise.resolve().then(callback); var depth = 0; var batches = /* @__PURE__ */ new WeakMap(); function addPendingUnmount(callback) { pendingUnmounts.add(callback); return () => { pendingUnmounts.delete(callback); }; } function prepareUnmounts() { for (const callback of pendingUnmounts) callback(); } function getEventBatch(batch) { if (!batch) return batchEvents; let wrapped = batches.get(batch); if (!wrapped) { wrapped = (run) => batchEvents(() => batch(run)); batches.set(batch, wrapped); } return wrapped; } function scheduleMicrotask(callback) { const run = () => { if (pending.delete(run)) { prepareUnmounts(); callback(); } }; pending.add(run); enqueue(run); } function batchEvents(callback) { if (depth) return callback(); depth++; try { (0, import_react_dom.flushSync)(callback); } finally { try { while (pending.size) (0, import_react_dom.flushSync)(() => { for (const run of pending) run(); }); } finally { depth--; } } } //#endregion //#region node_modules/react-konva/es/ReactKonvaHostConfig.js var ReactKonvaHostConfig_exports = /* @__PURE__ */ __exportAll({ HostTransitionContext: () => HostTransitionContext, NotPendingTransition: () => NotPendingTransition, afterActiveInstanceBlur: () => afterActiveInstanceBlur, appendChild: () => appendChild, appendChildToContainer: () => appendChildToContainer, appendInitialChild: () => appendInitialChild, beforeActiveInstanceBlur: () => beforeActiveInstanceBlur, bindToConsole: () => bindToConsole, cancelTimeout: () => cancelTimeout, clearContainer: () => clearContainer, commitMount: () => commitMount, commitNewChildToFragmentInstance: () => commitNewChildToFragmentInstance, commitTextUpdate: () => commitTextUpdate, commitUpdate: () => commitUpdate, createFragmentInstance: () => createFragmentInstance, createInstance: () => createInstance, createTextInstance: () => createTextInstance, createViewTransitionInstance: () => createViewTransitionInstance, deleteChildFromFragmentInstance: () => deleteChildFromFragmentInstance, detachDeletedInstance: () => detachDeletedInstance, finalizeInitialChildren: () => finalizeInitialChildren, getChildHostContext: () => getChildHostContext, getCurrentUpdatePriority: () => getCurrentUpdatePriority, getInstanceFromNode: () => getInstanceFromNode, getInstanceFromScope: () => getInstanceFromScope, getPublicInstance: () => getPublicInstance, getRootHostContext: () => getRootHostContext, getSuspendedCommitReason: () => getSuspendedCommitReason, hideInstance: () => hideInstance, hideTextInstance: () => hideTextInstance, idlePriority: () => import_scheduler.unstable_IdlePriority, insertBefore: () => insertBefore, insertInContainerBefore: () => insertInContainerBefore, isPrimaryRenderer: () => false, maySuspendCommit: () => maySuspendCommit, maySuspendCommitInSyncRender: () => maySuspendCommitInSyncRender, maySuspendCommitOnUpdate: () => maySuspendCommitOnUpdate, noTimeout: () => -1, now: () => import_scheduler.unstable_now, preloadInstance: () => preloadInstance, prepareForCommit: () => prepareForCommit, preparePortalMount: () => preparePortalMount, prepareScopeUpdate: () => prepareScopeUpdate, removeChild: () => removeChild, removeChildFromContainer: () => removeChildFromContainer, requestPostPaintCallback: () => requestPostPaintCallback, resetAfterCommit: () => resetAfterCommit, resetFormInstance: () => resetFormInstance, resetTextContent: () => resetTextContent, resolveEventTimeStamp: () => resolveEventTimeStamp, resolveEventType: () => resolveEventType, resolveUpdatePriority: () => resolveUpdatePriority, run: () => import_scheduler.unstable_runWithPriority, scheduleMicrotask: () => scheduleMicrotask, scheduleTimeout: () => scheduleTimeout, setCurrentUpdatePriority: () => setCurrentUpdatePriority, shouldAttemptEagerTransition: () => shouldAttemptEagerTransition, shouldSetTextContent: () => shouldSetTextContent, startSuspendingCommit: () => startSuspendingCommit, startViewTransition: () => startViewTransition, supportsHydration: () => false, supportsMicrotasks: () => true, supportsMutation: () => true, supportsPersistence: () => false, suspendInstance: () => suspendInstance, suspendOnActiveViewTransition: () => suspendOnActiveViewTransition, trackSchedulerEvent: () => trackSchedulerEvent, unhideInstance: () => unhideInstance, unhideTextInstance: () => unhideTextInstance, updateFragmentInstanceFiber: () => updateFragmentInstanceFiber, waitForCommitToBeReady: () => waitForCommitToBeReady, warnsIfNotActing: () => false }); var NO_CONTEXT = {}; Core_default.Node.prototype._applyProps = applyNodeProps; var currentUpdatePriority = import_constants.DefaultEventPriority; function appendInitialChild(parentInstance, child) { if (typeof child === "string") { console.error(`Do not use plain text as child of Konva.Node. You are using text: ${child}`); return; } parentInstance.add(child); updatePicture(parentInstance); } function createInstance(type, props, internalInstanceHandle) { let NodeClass = Core_default[type]; if (!NodeClass) { console.error(`Konva has no node with the type ${type}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${type}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`); NodeClass = Core_default.Group; } const propsWithoutEvents = {}; const propsWithOnlyEvents = {}; for (var key in props) { if (key === "ref") continue; if (key.slice(0, 2) === "on") propsWithOnlyEvents[key] = props[key]; else propsWithoutEvents[key] = props[key]; } const instance = new NodeClass(propsWithoutEvents); applyNodeProps(instance, propsWithOnlyEvents); return instance; } function createTextInstance(text, rootContainerInstance, internalInstanceHandle) { console.error(`Text components are not supported for now in ReactKonva. Your text is: "${text}"`); } function finalizeInitialChildren(domElement, type, props) { return false; } function getPublicInstance(instance) { return instance; } function createFragmentInstance() { return null; } function updateFragmentInstanceFiber() {} function commitNewChildToFragmentInstance() {} function deleteChildFromFragmentInstance() {} var finishUpdateBatch; function prepareForCommit() { finishUpdateBatch = Core_default.beginUpdateBatch?.(); return null; } function preparePortalMount() { return null; } function resetAfterCommit() { const finish = finishUpdateBatch; finishUpdateBatch = void 0; finish?.(); } function resetTextContent(domElement) {} function getRootHostContext() { return NO_CONTEXT; } function getChildHostContext() { return NO_CONTEXT; } var scheduleTimeout = setTimeout; var cancelTimeout = clearTimeout; function shouldSetTextContent(type, props) { return false; } function appendChild(parentInstance, child) { if (child.parent === parentInstance) child.moveToTop(); else parentInstance.add(child); updatePicture(parentInstance); } var appendChildToContainer = appendChild; function insertBefore(parentInstance, child, beforeChild) { child._remove(); parentInstance.add(child); child.setZIndex(beforeChild.getZIndex()); updatePicture(parentInstance); } var insertInContainerBefore = insertBefore; function removeChild(parentInstance, child) { child.destroy(); child.off(EVENTS_NAMESPACE); updatePicture(parentInstance); } var removeChildFromContainer = removeChild; function commitTextUpdate(textInstance, oldText, newText) { console.error(`Text components are not yet supported in ReactKonva. You text is: "${newText}"`); } function commitMount(instance, type, newProps) {} function commitUpdate(instance, type, oldProps, newProps) { applyNodeProps(instance, newProps, oldProps); } function hideInstance(instance) { instance.hide(); updatePicture(instance); } function hideTextInstance(textInstance) {} function unhideInstance(instance, props) { if (props.visible == null || props.visible) { instance.show(); updatePicture(instance); } } function unhideTextInstance(textInstance, text) {} function clearContainer(container) {} function detachDeletedInstance(instance) { instance.off(EVENTS_NAMESPACE); } function getInstanceFromNode() { return null; } function bindToConsole(methodName, args) { return console[methodName].bind(console, ...args); } function beforeActiveInstanceBlur() {} function afterActiveInstanceBlur() {} function prepareScopeUpdate() {} function getInstanceFromScope() { return null; } function setCurrentUpdatePriority(newPriority) { currentUpdatePriority = newPriority; } function getCurrentUpdatePriority() { return currentUpdatePriority; } function resolveUpdatePriority() { return import_constants.DiscreteEventPriority; } function shouldAttemptEagerTransition() { return false; } function trackSchedulerEvent() {} function resolveEventType() { return null; } function resolveEventTimeStamp() { return -1.1; } function requestPostPaintCallback() {} function maySuspendCommit() { throw new Error("ViewTransition is not supported inside a Stage. Place ViewTransition around Stage to animate its DOM container."); } var createViewTransitionInstance = maySuspendCommit; var maySuspendCommitOnUpdate = maySuspendCommit; var maySuspendCommitInSyncRender = maySuspendCommit; function startViewTransition(suspendedState, rootContainer, transitionTypes, mutationCallback, layoutCallback, afterMutationCallback, spawnedWorkCallback, passiveCallback, errorCallback, blockedCallback, finishedAnimation) { mutationCallback(); layoutCallback(); finishedAnimation?.(); spawnedWorkCallback(); return null; } function preloadInstance() { return true; } function startSuspendingCommit() {} function suspendInstance() {} function suspendOnActiveViewTransition() {} function waitForCommitToBeReady() { return null; } function getSuspendedCommitReason() { return null; } var NotPendingTransition = Object.freeze({ pending: false, data: null, method: null, action: null }); var HostTransitionContext = /* @__PURE__ */ import_react.createContext(NotPendingTransition); function resetFormInstance() {} /* @__PURE__ */ (() => { var e, t; return typeof window != "undefined" && (((e = window.document) == null ? void 0 : e.createElement) || ((t = window.navigator) == null ? void 0 : t.product) === "ReactNative"); })() ? import_react.useLayoutEffect : import_react.useEffect; function l(e, t, i) { if (!e) return; if (i(e) === !0) return e; let n = t ? e.return : e.child; for (; n;) { const o = l(n, t, i); if (o) return o; n = t ? null : n.sibling; } } function b(e) { try { return Object.defineProperties(e, { _currentRenderer: { get() { return null; }, set() {} }, _currentRenderer2: { get() { return null; }, set() {} } }); } catch (t) { return e; } } var p = /* @__PURE__ */ b(/* @__PURE__ */ import_react.createContext(null)); var h = class extends import_react.Component { render() { return /* @__PURE__ */ import_react.createElement(p.Provider, { value: this._reactInternals }, this.props.children); } }; function m() { const e = import_react.useContext(p); if (e === null) throw new Error("its-fine: useFiber must be called within a !"); const t = import_react.useId(); return import_react.useMemo(() => { for (const n of [e, e == null ? void 0 : e.alternate]) { if (!n) continue; const o = l(n, !1, (d) => { let s = d.memoizedState; for (; s;) { if (s.memoizedState === t) return !0; s = s.next; } }); if (o) return o; } }, [e, t]); } var w = Symbol.for("react.context"); var E = (e) => e !== null && typeof e == "object" && "$$typeof" in e && e.$$typeof === w; function g() { const e = m(), [t] = import_react.useState(() => /* @__PURE__ */ new Map()); t.clear(); let i = e; for (; i;) { const n = i.type; E(n) && n !== p && !t.has(n) && t.set(n, import_react.use(b(n))), i = i.return; } return t; } function M() { const e = g(); return import_react.useMemo(() => Array.from(e.keys()).reduce((t, i) => (n) => /* @__PURE__ */ import_react.createElement(t, null, /* @__PURE__ */ import_react.createElement(i.Provider, { ...n, value: e.get(i) })), (t) => /* @__PURE__ */ import_react.createElement(h, { ...t })), [e]); } //#endregion //#region node_modules/react-konva/es/ReactKonvaCore.js /** * Based on ReactArt.js * Copyright (c) 2017-present Lavrenov Anton. * All rights reserved. * * MIT */ var [reactMajor, reactMinor] = "19.3.1".split(".").map(Number); if (reactMajor !== 19 || reactMinor < 3) throw new Error("react-konva requires React 19.3 or later within React 19. Install matching versions of react and react-dom. For React 19.2, use react-konva 19.2. For React 18, use react-konva 18."); function SuspendCanvas({ promise }) { throw promise; } var StageWrap = (props) => { const container = import_react.useRef(null); const stage = import_react.useRef(null); const fiberRef = import_react.useRef(null); const children = import_react.useRef(null); const suspension = import_react.useRef(null); const identifierPrefix = import_react.useId(); const formStatus = (0, import_react_dom.useFormStatus)(); const previousProps = import_react.useRef({}); const oldProps = previousProps.current; const Bridge = M(); const isStrictMode = !!l(m(), true, (node) => node.type === import_react.StrictMode); const effectsDisconnected = import_react.useRef(false); const isUnmounting = import_react.useRef(false); const cancelUnmount = import_react.useRef(null); import_react.useInsertionEffect(() => { isUnmounting.current = false; return () => { isUnmounting.current = true; if (effectsDisconnected.current && stage.current) destroyStage(); }; }, []); const destroyStage = () => { cancelUnmount.current?.(); cancelUnmount.current = null; prepareUnmounts(); KonvaRenderer.flushSyncFromReconciler(() => { KonvaRenderer.updateContainer(null, fiberRef.current, null); }); stage.current?.destroy(); stage.current?.off(EVENTS_NAMESPACE); stage.current = null; suspension.current?.resolve(); suspension.current = null; }; const setCanvasVisibility = (mode) => { if (mode === "suspended") { if (!suspension.current) { let resolve; const promise = new Promise((done) => { resolve = done; }); suspension.current = { promise, resolve }; } } else { suspension.current?.resolve(); suspension.current = null; } KonvaRenderer.updateContainer(import_react.createElement(import_react.Activity, { mode: mode === "hidden" ? "hidden" : "visible", children: import_react.createElement(import_react.Suspense, { fallback: null }, children.current, suspension.current && import_react.createElement(SuspendCanvas, { promise: suspension.current.promise })) }), fiberRef.current, null); prepareUnmounts(); KonvaRenderer.flushSyncWork(); }; import_react.useLayoutEffect(() => { cancelUnmount.current?.(); cancelUnmount.current = null; if (!stage.current) { stage.current = new Core_default.Stage({ width: props.width, height: props.height, container: container.current }); fiberRef.current = KonvaRenderer.createContainer(stage.current, import_constants.ConcurrentRoot, null, isStrictMode, null, identifierPrefix, console.error, console.error, console.error, null, null); } return () => { if (!isUnmounting.current) { const unmount = () => { if (!isUnmounting.current) return; cancelUnmount.current?.(); cancelUnmount.current = null; KonvaRenderer.updateContainer(null, fiberRef.current, null); }; cancelUnmount.current = addPendingUnmount(unmount); setCanvasVisibility("suspended"); } else destroyStage(); }; }, []); import_react.useEffect(() => { effectsDisconnected.current = false; return () => { effectsDisconnected.current = true; if (!stage.current) return; if (isUnmounting.current) destroyStage(); else setCanvasVisibility("hidden"); }; }, []); import_react.useLayoutEffect(() => { if (typeof stage.current.eventBatchFunc === "function") stage.current.eventBatchFunc(getEventBatch(props.eventBatchFunc)); }, [props.eventBatchFunc]); import_react.useImperativeHandle(props.forwardedRef, () => stage.current, []); import_react.useLayoutEffect(() => { previousProps.current = props; applyNodeProps(stage.current, props, oldProps); children.current = import_react.createElement(HostTransitionContext.Provider, { value: formStatus }, import_react.createElement(Bridge, {}, props.children)); setCanvasVisibility("visible"); }); return import_react.createElement("div", { ref: container, id: props.id, accessKey: props.accessKey, className: props.className, role: props.role, style: props.style, tabIndex: props.tabIndex, title: props.title }); }; var Layer = "Layer"; var FastLayer = "FastLayer"; var Group = "Group"; var Label = "Label"; var Rect = "Rect"; var Circle = "Circle"; var Ellipse = "Ellipse"; var Wedge = "Wedge"; var Line = "Line"; var Sprite = "Sprite"; var Image = "Image"; var Text = "Text"; var TextPath = "TextPath"; var Star = "Star"; var Ring = "Ring"; var Arc = "Arc"; var Tag = "Tag"; var Path = "Path"; var RegularPolygon = "RegularPolygon"; var Arrow = "Arrow"; var Shape = "Shape"; var Transformer = "Transformer"; var version = "19.3.2"; var rendererConfig = { ...ReactKonvaHostConfig_exports, HostTransitionContext, rendererVersion: version, rendererPackageName: "react-konva", extraDevToolsConfig: null }; var KonvaRenderer = (0, import_react_reconciler.default)(rendererConfig); KonvaRenderer.injectIntoDevTools(); var Stage = import_react.forwardRef((props, ref) => { return import_react.createElement(h, {}, import_react.createElement(StageWrap, { ...props, forwardedRef: ref })); }); var useStrictMode = toggleStrictMode; //#endregion //#region node_modules/react-konva/es/ReactKonva.js /** * Based on ReactArt.js * Copyright (c) 2017-present Lavrenov Anton. * All rights reserved. * * MIT */ //#endregion export { Arc, Arrow, Circle, Ellipse, FastLayer, Group, Image, KonvaRenderer, Label, Layer, Line, Path, Rect, RegularPolygon, Ring, Shape, Sprite, Stage, Star, Tag, Text, TextPath, Transformer, Wedge, M as useContextBridge, useStrictMode, version };