@zyzgroup/core-web 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/zyzgroup_core_web.iife.js +20 -15
- package/dist/zyzgroup_core_web.iife.js.map +1 -1
- package/dist/zyzgroup_core_web.js +12184 -8658
- package/dist/zyzgroup_core_web.js.map +1 -1
- package/dist/zyzgroup_core_web.umd.cjs +20 -15
- package/dist/zyzgroup_core_web.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/types/packages/core-web/src/UPNG.d.ts.map +1 -0
- package/types/packages/core-web/src/animate.d.ts.map +1 -0
- package/types/packages/core-web/src/bom.d.ts.map +1 -0
- package/types/packages/core-web/src/cache.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/canvas2svg.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/index.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/KonvaApp.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/plugins/AlignmentPlugin.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/plugins/HistoryPlugin/HistoryPlugin.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/plugins/HistoryPlugin/commands/add-object-cmd.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/plugins/HistoryPlugin/commands/base.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/plugins/HistoryPlugin/commands/decompose-group-cmd.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/plugins/HistoryPlugin/commands/index.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/plugins/HistoryPlugin/commands/make-group-cmd.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/plugins/HistoryPlugin/commands/modified-object-cmd.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/plugins/HistoryPlugin/commands/move-zIndex-object-cmd.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/plugins/HistoryPlugin/commands/remove-object-cmd.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/plugins/SelectorPlugin.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/plugins/index.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/polyfill/ellipse.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/polyfill/image.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/polyfill/index.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/polyfill/line.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/polyfill/node.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/polyfill/rect.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/polyfill/regular-polygon.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/polyfill/text.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/services/Mouse.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/services/Tooler.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/services/index.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/services/types.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/tools/DiamondTool.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/tools/DrawingTool.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/tools/EllipseTool.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/tools/EraserTool.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/tools/ImageTool.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/tools/LineTool.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/tools/RectTool.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/tools/SelectTool.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/tools/TextTool.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/tools/index.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/konva/utils/index.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/arrow.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/ball.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/ball3d.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/box.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/light.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/line.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/point3d.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/segment.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/shapes.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/ship.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/slider.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/tree.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/triangle-light.d.ts.map +1 -0
- package/types/packages/core-web/src/canvas/shapes/triangle.d.ts.map +1 -0
- package/types/{color.d.ts → packages/core-web/src/color.d.ts} +1 -0
- package/types/packages/core-web/src/color.d.ts.map +1 -0
- package/types/packages/core-web/src/dom/DOMDetect.d.ts.map +1 -0
- package/types/packages/core-web/src/dom/DOMEvent.d.ts.map +1 -0
- package/types/packages/core-web/src/dom/DOMKey.d.ts.map +1 -0
- package/types/packages/core-web/src/dom/DOMMedia.d.ts.map +1 -0
- package/types/{dom → packages/core-web/src/dom}/DOMMouse.d.ts +2 -0
- package/types/packages/core-web/src/dom/DOMMouse.d.ts.map +1 -0
- package/types/packages/core-web/src/dom/DOMQuery.d.ts.map +1 -0
- package/types/{dom → packages/core-web/src/dom}/DOMScroll.d.ts +4 -0
- package/types/packages/core-web/src/dom/DOMScroll.d.ts.map +1 -0
- package/types/packages/core-web/src/dom/DOMUtil.d.ts +26 -0
- package/types/packages/core-web/src/dom/DOMUtil.d.ts.map +1 -0
- package/types/packages/core-web/src/dom/index.d.ts.map +1 -0
- package/types/packages/core-web/src/env.d.ts.map +1 -0
- package/types/packages/core-web/src/fetch.d.ts.map +1 -0
- package/types/packages/core-web/src/file.d.ts.map +1 -0
- package/types/{iframe.d.ts.map → packages/core-web/src/iframe.d.ts.map} +1 -1
- package/types/packages/core-web/src/image-gif.d.ts.map +1 -0
- package/types/packages/core-web/src/image.d.ts.map +1 -0
- package/types/{index.d.ts → packages/core-web/src/index.d.ts} +4 -3
- package/types/packages/core-web/src/index.d.ts.map +1 -0
- package/types/packages/core-web/src/jsonp.d.ts.map +1 -0
- package/types/packages/core-web/src/math/AnimateShape.d.ts.map +1 -0
- package/types/packages/core-web/src/math/Matrix.d.ts.map +1 -0
- package/types/packages/core-web/src/math/Point.d.ts.map +1 -0
- package/types/packages/core-web/src/math/Polygon.d.ts.map +1 -0
- package/types/packages/core-web/src/math/Rect.d.ts.map +1 -0
- package/types/packages/core-web/src/math/Vector.d.ts.map +1 -0
- package/types/packages/core-web/src/math/index.d.ts.map +1 -0
- package/types/packages/core-web/src/math/math.d.ts.map +1 -0
- package/types/packages/core-web/src/microTask.d.ts.map +1 -0
- package/types/packages/core-web/src/patch.d.ts.map +1 -0
- package/types/packages/core-web/src/position.d.ts.map +1 -0
- package/types/packages/core-web/src/qrcode.d.ts.map +1 -0
- package/types/packages/core-web/src/query.d.ts.map +1 -0
- package/types/packages/core-web/src/reactive.d.ts.map +1 -0
- package/types/packages/core-web/src/rem.d.ts.map +1 -0
- package/types/packages/core-web/src/scrollparent.d.ts.map +1 -0
- package/types/packages/core-web/src/svg/YZRaphael.d.ts +2 -0
- package/types/packages/core-web/src/svg/YZRaphael.d.ts.map +1 -0
- package/types/packages/core-web/src/svg/lib/a2c.d.ts.map +1 -0
- package/types/packages/core-web/src/svg/lib/abs-svg-path.d.ts.map +1 -0
- package/types/packages/core-web/src/svg/lib/is-svg-path.d.ts.map +1 -0
- package/types/packages/core-web/src/svg/lib/normalize-svg-path.d.ts.map +1 -0
- package/types/packages/core-web/src/svg/lib/parse-svg-path.d.ts.map +1 -0
- package/types/packages/core-web/src/svg/lib/platform-browser.d.ts.map +1 -0
- package/types/packages/core-web/src/svg/lib/platform-node.d.ts.map +1 -0
- package/types/packages/core-web/src/svg/lib/point-at-length.d.ts.map +1 -0
- package/types/packages/core-web/src/svg/lib/point-in-path.d.ts.map +1 -0
- package/types/{svg/index.d.ts → packages/core-web/src/svg/path.d.ts} +8 -2
- package/types/packages/core-web/src/svg/path.d.ts.map +1 -0
- package/types/packages/core-web/src/svg/raphael.importSVG.d.ts +11 -0
- package/types/packages/core-web/src/svg/raphael.importSVG.d.ts.map +1 -0
- package/types/packages/core-web/src/svg/rappar.d.ts +3 -0
- package/types/packages/core-web/src/svg/rappar.d.ts.map +1 -0
- package/types/packages/core-web/src/tween/Easing.d.ts.map +1 -0
- package/types/packages/core-web/src/tween/Group.d.ts.map +1 -0
- package/types/packages/core-web/src/tween/Interpolation.d.ts.map +1 -0
- package/types/packages/core-web/src/tween/Now.d.ts.map +1 -0
- package/types/packages/core-web/src/tween/Sequence.d.ts.map +1 -0
- package/types/packages/core-web/src/tween/Tween.d.ts.map +1 -0
- package/types/packages/core-web/src/tween/index.d.ts.map +1 -0
- package/types/packages/core-web/src/tween/mainGroup.d.ts.map +1 -0
- package/types/packages/core-web/src/url.d.ts.map +1 -0
- package/types/{video.d.ts → packages/core-web/src/video.d.ts} +1 -0
- package/types/packages/core-web/src/video.d.ts.map +1 -0
- package/types/packages/core-web/src/webgl/index.d.ts.map +1 -0
- package/types/packages/core-web/src/webrtc/adapter.d.ts.map +1 -0
- package/types/packages/core-web/src/webrtc/index.d.ts.map +1 -0
- package/types/packages/core-web/src/websocketclient.d.ts +22 -0
- package/types/packages/core-web/src/websocketclient.d.ts.map +1 -0
- package/types/third/raphael/raphael.min.d.ts +4 -0
- package/types/third/raphael/raphael.min.d.ts.map +1 -0
- package/types/UPNG.d.ts.map +0 -1
- package/types/animate.d.ts.map +0 -1
- package/types/bom.d.ts.map +0 -1
- package/types/cache.d.ts.map +0 -1
- package/types/canvas/canvas2svg.d.ts.map +0 -1
- package/types/canvas/index.d.ts.map +0 -1
- package/types/canvas/konva/KonvaApp.d.ts.map +0 -1
- package/types/canvas/konva/plugins/AlignmentPlugin.d.ts.map +0 -1
- package/types/canvas/konva/plugins/HistoryPlugin/HistoryPlugin.d.ts.map +0 -1
- package/types/canvas/konva/plugins/HistoryPlugin/commands/add-object-cmd.d.ts.map +0 -1
- package/types/canvas/konva/plugins/HistoryPlugin/commands/base.d.ts.map +0 -1
- package/types/canvas/konva/plugins/HistoryPlugin/commands/decompose-group-cmd.d.ts.map +0 -1
- package/types/canvas/konva/plugins/HistoryPlugin/commands/index.d.ts.map +0 -1
- package/types/canvas/konva/plugins/HistoryPlugin/commands/make-group-cmd.d.ts.map +0 -1
- package/types/canvas/konva/plugins/HistoryPlugin/commands/modified-object-cmd.d.ts.map +0 -1
- package/types/canvas/konva/plugins/HistoryPlugin/commands/move-zIndex-object-cmd.d.ts.map +0 -1
- package/types/canvas/konva/plugins/HistoryPlugin/commands/remove-object-cmd.d.ts.map +0 -1
- package/types/canvas/konva/plugins/SelectorPlugin.d.ts.map +0 -1
- package/types/canvas/konva/plugins/index.d.ts.map +0 -1
- package/types/canvas/konva/polyfill/ellipse.d.ts.map +0 -1
- package/types/canvas/konva/polyfill/image.d.ts.map +0 -1
- package/types/canvas/konva/polyfill/index.d.ts.map +0 -1
- package/types/canvas/konva/polyfill/line.d.ts.map +0 -1
- package/types/canvas/konva/polyfill/node.d.ts.map +0 -1
- package/types/canvas/konva/polyfill/rect.d.ts.map +0 -1
- package/types/canvas/konva/polyfill/regular-polygon.d.ts.map +0 -1
- package/types/canvas/konva/polyfill/text.d.ts.map +0 -1
- package/types/canvas/konva/services/Mouse.d.ts.map +0 -1
- package/types/canvas/konva/services/Tooler.d.ts.map +0 -1
- package/types/canvas/konva/services/index.d.ts.map +0 -1
- package/types/canvas/konva/services/types.d.ts.map +0 -1
- package/types/canvas/konva/tools/DiamondTool.d.ts.map +0 -1
- package/types/canvas/konva/tools/DrawingTool.d.ts.map +0 -1
- package/types/canvas/konva/tools/EllipseTool.d.ts.map +0 -1
- package/types/canvas/konva/tools/EraserTool.d.ts.map +0 -1
- package/types/canvas/konva/tools/ImageTool.d.ts.map +0 -1
- package/types/canvas/konva/tools/LineTool.d.ts.map +0 -1
- package/types/canvas/konva/tools/RectTool.d.ts.map +0 -1
- package/types/canvas/konva/tools/SelectTool.d.ts.map +0 -1
- package/types/canvas/konva/tools/TextTool.d.ts.map +0 -1
- package/types/canvas/konva/tools/index.d.ts.map +0 -1
- package/types/canvas/konva/utils/index.d.ts.map +0 -1
- package/types/canvas/shapes/arrow.d.ts.map +0 -1
- package/types/canvas/shapes/ball.d.ts.map +0 -1
- package/types/canvas/shapes/ball3d.d.ts.map +0 -1
- package/types/canvas/shapes/box.d.ts.map +0 -1
- package/types/canvas/shapes/light.d.ts.map +0 -1
- package/types/canvas/shapes/line.d.ts.map +0 -1
- package/types/canvas/shapes/point3d.d.ts.map +0 -1
- package/types/canvas/shapes/segment.d.ts.map +0 -1
- package/types/canvas/shapes/shapes.d.ts.map +0 -1
- package/types/canvas/shapes/ship.d.ts.map +0 -1
- package/types/canvas/shapes/slider.d.ts.map +0 -1
- package/types/canvas/shapes/tree.d.ts.map +0 -1
- package/types/canvas/shapes/triangle-light.d.ts.map +0 -1
- package/types/canvas/shapes/triangle.d.ts.map +0 -1
- package/types/color.d.ts.map +0 -1
- package/types/dom/DOMDetect.d.ts.map +0 -1
- package/types/dom/DOMEvent.d.ts.map +0 -1
- package/types/dom/DOMKey.d.ts.map +0 -1
- package/types/dom/DOMMedia.d.ts.map +0 -1
- package/types/dom/DOMMouse.d.ts.map +0 -1
- package/types/dom/DOMQuery.d.ts.map +0 -1
- package/types/dom/DOMScroll.d.ts.map +0 -1
- package/types/dom/DOMUtil.d.ts +0 -8
- package/types/dom/DOMUtil.d.ts.map +0 -1
- package/types/dom/index.d.ts.map +0 -1
- package/types/dom/zyzui.d.ts +0 -1
- package/types/dom/zyzui.d.ts.map +0 -1
- package/types/dom.d.ts +0 -22
- package/types/dom.d.ts.map +0 -1
- package/types/env.d.ts.map +0 -1
- package/types/fetch.d.ts.map +0 -1
- package/types/file.d.ts.map +0 -1
- package/types/image-gif.d.ts.map +0 -1
- package/types/image.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/jsonp.d.ts.map +0 -1
- package/types/math/AnimateShape.d.ts.map +0 -1
- package/types/math/Matrix.d.ts.map +0 -1
- package/types/math/Point.d.ts.map +0 -1
- package/types/math/Polygon.d.ts.map +0 -1
- package/types/math/Rect.d.ts.map +0 -1
- package/types/math/Vector.d.ts.map +0 -1
- package/types/math/index.d.ts.map +0 -1
- package/types/math/math.d.ts.map +0 -1
- package/types/microTask.d.ts.map +0 -1
- package/types/patch.d.ts.map +0 -1
- package/types/position.d.ts.map +0 -1
- package/types/qrcode.d.ts.map +0 -1
- package/types/query.d.ts.map +0 -1
- package/types/reactive.d.ts.map +0 -1
- package/types/rem.d.ts.map +0 -1
- package/types/scrollparent.d.ts.map +0 -1
- package/types/svg/a2c.d.ts.map +0 -1
- package/types/svg/abs-svg-path.d.ts.map +0 -1
- package/types/svg/index.d.ts.map +0 -1
- package/types/svg/is-svg-path.d.ts.map +0 -1
- package/types/svg/normalize-svg-path.d.ts.map +0 -1
- package/types/svg/parse-svg-path.d.ts.map +0 -1
- package/types/svg/platform-browser.d.ts.map +0 -1
- package/types/svg/platform-node.d.ts.map +0 -1
- package/types/svg/point-at-length.d.ts.map +0 -1
- package/types/svg/point-in-path.d.ts.map +0 -1
- package/types/tween/Easing.d.ts.map +0 -1
- package/types/tween/Group.d.ts.map +0 -1
- package/types/tween/Interpolation.d.ts.map +0 -1
- package/types/tween/Now.d.ts.map +0 -1
- package/types/tween/Sequence.d.ts.map +0 -1
- package/types/tween/Tween.d.ts.map +0 -1
- package/types/tween/index.d.ts.map +0 -1
- package/types/tween/mainGroup.d.ts.map +0 -1
- package/types/url.d.ts.map +0 -1
- package/types/video.d.ts.map +0 -1
- package/types/webgl/index.d.ts.map +0 -1
- package/types/webrtc/adapter.d.ts.map +0 -1
- package/types/webrtc/index.d.ts.map +0 -1
- package/types/websocket.d.ts +0 -16
- package/types/websocket.d.ts.map +0 -1
- /package/types/{UPNG.d.ts → packages/core-web/src/UPNG.d.ts} +0 -0
- /package/types/{animate.d.ts → packages/core-web/src/animate.d.ts} +0 -0
- /package/types/{bom.d.ts → packages/core-web/src/bom.d.ts} +0 -0
- /package/types/{cache.d.ts → packages/core-web/src/cache.d.ts} +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/canvas2svg.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/index.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/KonvaApp.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/plugins/AlignmentPlugin.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/plugins/HistoryPlugin/HistoryPlugin.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/plugins/HistoryPlugin/commands/add-object-cmd.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/plugins/HistoryPlugin/commands/base.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/plugins/HistoryPlugin/commands/decompose-group-cmd.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/plugins/HistoryPlugin/commands/index.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/plugins/HistoryPlugin/commands/make-group-cmd.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/plugins/HistoryPlugin/commands/modified-object-cmd.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/plugins/HistoryPlugin/commands/move-zIndex-object-cmd.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/plugins/HistoryPlugin/commands/remove-object-cmd.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/plugins/SelectorPlugin.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/plugins/index.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/polyfill/ellipse.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/polyfill/image.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/polyfill/index.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/polyfill/line.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/polyfill/node.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/polyfill/rect.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/polyfill/regular-polygon.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/polyfill/text.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/services/Mouse.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/services/Tooler.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/services/index.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/services/types.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/tools/DiamondTool.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/tools/DrawingTool.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/tools/EllipseTool.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/tools/EraserTool.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/tools/ImageTool.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/tools/LineTool.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/tools/RectTool.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/tools/SelectTool.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/tools/TextTool.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/tools/index.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/konva/utils/index.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/arrow.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/ball.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/ball3d.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/box.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/light.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/line.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/point3d.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/segment.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/shapes.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/ship.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/slider.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/tree.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/triangle-light.d.ts +0 -0
- /package/types/{canvas → packages/core-web/src/canvas}/shapes/triangle.d.ts +0 -0
- /package/types/{dom → packages/core-web/src/dom}/DOMDetect.d.ts +0 -0
- /package/types/{dom → packages/core-web/src/dom}/DOMEvent.d.ts +0 -0
- /package/types/{dom → packages/core-web/src/dom}/DOMKey.d.ts +0 -0
- /package/types/{dom → packages/core-web/src/dom}/DOMMedia.d.ts +0 -0
- /package/types/{dom → packages/core-web/src/dom}/DOMQuery.d.ts +0 -0
- /package/types/{dom → packages/core-web/src/dom}/index.d.ts +0 -0
- /package/types/{env.d.ts → packages/core-web/src/env.d.ts} +0 -0
- /package/types/{fetch.d.ts → packages/core-web/src/fetch.d.ts} +0 -0
- /package/types/{file.d.ts → packages/core-web/src/file.d.ts} +0 -0
- /package/types/{iframe.d.ts → packages/core-web/src/iframe.d.ts} +0 -0
- /package/types/{image-gif.d.ts → packages/core-web/src/image-gif.d.ts} +0 -0
- /package/types/{image.d.ts → packages/core-web/src/image.d.ts} +0 -0
- /package/types/{jsonp.d.ts → packages/core-web/src/jsonp.d.ts} +0 -0
- /package/types/{math → packages/core-web/src/math}/AnimateShape.d.ts +0 -0
- /package/types/{math → packages/core-web/src/math}/Matrix.d.ts +0 -0
- /package/types/{math → packages/core-web/src/math}/Point.d.ts +0 -0
- /package/types/{math → packages/core-web/src/math}/Polygon.d.ts +0 -0
- /package/types/{math → packages/core-web/src/math}/Rect.d.ts +0 -0
- /package/types/{math → packages/core-web/src/math}/Vector.d.ts +0 -0
- /package/types/{math → packages/core-web/src/math}/index.d.ts +0 -0
- /package/types/{math → packages/core-web/src/math}/math.d.ts +0 -0
- /package/types/{microTask.d.ts → packages/core-web/src/microTask.d.ts} +0 -0
- /package/types/{patch.d.ts → packages/core-web/src/patch.d.ts} +0 -0
- /package/types/{position.d.ts → packages/core-web/src/position.d.ts} +0 -0
- /package/types/{qrcode.d.ts → packages/core-web/src/qrcode.d.ts} +0 -0
- /package/types/{query.d.ts → packages/core-web/src/query.d.ts} +0 -0
- /package/types/{reactive.d.ts → packages/core-web/src/reactive.d.ts} +0 -0
- /package/types/{rem.d.ts → packages/core-web/src/rem.d.ts} +0 -0
- /package/types/{scrollparent.d.ts → packages/core-web/src/scrollparent.d.ts} +0 -0
- /package/types/{svg → packages/core-web/src/svg/lib}/a2c.d.ts +0 -0
- /package/types/{svg → packages/core-web/src/svg/lib}/abs-svg-path.d.ts +0 -0
- /package/types/{svg → packages/core-web/src/svg/lib}/is-svg-path.d.ts +0 -0
- /package/types/{svg → packages/core-web/src/svg/lib}/normalize-svg-path.d.ts +0 -0
- /package/types/{svg → packages/core-web/src/svg/lib}/parse-svg-path.d.ts +0 -0
- /package/types/{svg → packages/core-web/src/svg/lib}/platform-browser.d.ts +0 -0
- /package/types/{svg → packages/core-web/src/svg/lib}/platform-node.d.ts +0 -0
- /package/types/{svg → packages/core-web/src/svg/lib}/point-at-length.d.ts +0 -0
- /package/types/{svg → packages/core-web/src/svg/lib}/point-in-path.d.ts +0 -0
- /package/types/{tween → packages/core-web/src/tween}/Easing.d.ts +0 -0
- /package/types/{tween → packages/core-web/src/tween}/Group.d.ts +0 -0
- /package/types/{tween → packages/core-web/src/tween}/Interpolation.d.ts +0 -0
- /package/types/{tween → packages/core-web/src/tween}/Now.d.ts +0 -0
- /package/types/{tween → packages/core-web/src/tween}/Sequence.d.ts +0 -0
- /package/types/{tween → packages/core-web/src/tween}/Tween.d.ts +0 -0
- /package/types/{tween → packages/core-web/src/tween}/index.d.ts +0 -0
- /package/types/{tween → packages/core-web/src/tween}/mainGroup.d.ts +0 -0
- /package/types/{url.d.ts → packages/core-web/src/url.d.ts} +0 -0
- /package/types/{webgl → packages/core-web/src/webgl}/index.d.ts +0 -0
- /package/types/{webrtc → packages/core-web/src/webrtc}/adapter.d.ts +0 -0
- /package/types/{webrtc → packages/core-web/src/webrtc}/index.d.ts +0 -0
|
@@ -1,30 +1,35 @@
|
|
|
1
|
-
var ZYZGroupCoreWeb=function(E){"use strict";typeof process<"u"&&process.versions!=null&&process.versions.node!=null;const rd=(i=12)=>"x".repeat(i).replace(/[x]/g,t=>(Math.random()*16|0).toString(16));function wo(i){let t="";for(let e=0,n=i.length;e<n;e++){const r=i.charCodeAt(e);r>=1&&r<=127?t+=i.charAt(e):r>2047?(t+=String.fromCharCode(224|r>>12&15),t+=String.fromCharCode(128|r>>6&63),t+=String.fromCharCode(128|r>>0&63)):(t+=String.fromCharCode(192|r>>6&31),t+=String.fromCharCode(128|r>>0&63))}return t}var ne=(i=>(i.UNKNOWN="",i.HTML="text/html",i.CSS="text/css",i.JPEG="image/jpeg",i.PNG="image/png",i.GIF="image/gif",i.WEBP="image/webp",i.SVG="image/svg+xml",i.MPEG="audio/mpeg",i.OGG="audio/ogg",i.MP4="video/mp4",i.JSON="application/json",i.JAVASCRIPT="application/javascript",i.ECMASCRIPT="application/ecmascript",i.EXCEL="application/vnb.ms-excel",i.XWWW="application/x-www-form-urlencoded",i.CSV="application/x-csv",i.PDF="application/pdf",i.ZIP="application/zip",i.TGZ="application/x-gtar",i.TAR_GZ="application/x-gzip",i.XML="text/xml",i.TEXT="text/plain",i))(ne||{});const ui=(i,t=16)=>(i=i.toLowerCase(),(i.indexOf("0b")==0||i.indexOf("0x")==0)&&(i=i.slice(2)),parseInt(i,t));function sd(){const i=Uint32Array.of(305419896),t=new Uint8Array(i.buffer);switch(t[0]*16777216+t[1]*65536+t[2]*256+t[3]){case 305419896:return!1;case 2018915346:return!0}}const So=i=>{let t=ne.UNKNOWN;switch(new DataView(i).getUint32(0,sd()).toString(16).toUpperCase()){case"FFD8FFDB":t=ne.JPEG;break;case"FFD8FFE0":case"FFD8FFE1":case"FFD8FFE2":case"FFD8FFE3":t=ne.JPEG;break;case"89504E47":t=ne.PNG;break;case"47494638":t=ne.GIF;break;case"52494646":t=ne.WEBP;break;case"25504446":t=ne.PDF;break;case"504B0304":t=ne.ZIP;break}return t},Co=function(){const i=[];return{writeByte(t){i.push(t&255)},writeShort(t){this.writeByte(t),this.writeByte(t>>>8)},writeBytes(t,e=0,n=t.length){for(let r=0;r<n;r++)this.writeByte(t[r+e])},writeString(t){for(let e=0,n=t.length;e<n;e++)this.writeByte(t.charCodeAt(e))},toByteArray(){return i},toString(){let t="[";for(let e=0,n=i.length;e<n;e++)e>0&&(t+=","),t+=i[e];return t+="]",t}}},ad=function(){let i=0,t=0,e=0,n="";const r=function(a){if(!(a<0)){if(a<26)return 65+a;if(a<52)return 97+(a-26);if(a<62)return 48+(a-52);if(a==62)return 43;if(a==63)return 47}throw new Error("n:"+a)},s=function(a){n+=String.fromCharCode(r(a&63))};return{writeByte(a){for(i=i<<8|a&255,t+=8,e+=1;t>=6;)s(i>>>t-6),t-=6},flush(){if(t>0&&(s(i<<6-t),i=0,t=0),e%3!=0){const a=3-e%3;for(let o=0;o<a;o++)n+="="}},toString(){return n}}};function xo(i,t){return function(){return i.apply(t,arguments)}}const{toString:od}=Object.prototype,{getPrototypeOf:xs}=Object,In=(i=>t=>{const e=od.call(t);return i[e]||(i[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),Wt=i=>(i=i.toLowerCase(),t=>In(t)===i),Fn=i=>t=>typeof t===i,{isArray:di}=Array,ji=Fn("undefined");function ld(i){return i!==null&&!ji(i)&&i.constructor!==null&&!ji(i.constructor)&&Ut(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const To=Wt("ArrayBuffer");function hd(i){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(i):t=i&&i.buffer&&To(i.buffer),t}const cd=Fn("string"),Ut=Fn("function"),Eo=Fn("number"),Nn=i=>i!==null&&typeof i=="object",ud=i=>i===!0||i===!1,Un=i=>{if(In(i)!=="object")return!1;const t=xs(i);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},dd=Wt("Date"),fd=Wt("File"),gd=Wt("Blob"),pd=Wt("FileList"),md=i=>Nn(i)&&Ut(i.pipe),_d=i=>{let t;return i&&(typeof FormData=="function"&&i instanceof FormData||Ut(i.append)&&((t=In(i))==="formdata"||t==="object"&&Ut(i.toString)&&i.toString()==="[object FormData]"))},vd=Wt("URLSearchParams"),yd=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Vi(i,t,{allOwnKeys:e=!1}={}){if(i===null||typeof i>"u")return;let n,r;if(typeof i!="object"&&(i=[i]),di(i))for(n=0,r=i.length;n<r;n++)t.call(null,i[n],n,i);else{const s=e?Object.getOwnPropertyNames(i):Object.keys(i),a=s.length;let o;for(n=0;n<a;n++)o=s[n],t.call(null,i[o],o,i)}}function ko(i,t){t=t.toLowerCase();const e=Object.keys(i);let n=e.length,r;for(;n-- >0;)if(r=e[n],t===r.toLowerCase())return r;return null}const Ao=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Po=i=>!ji(i)&&i!==Ao;function Ts(){const{caseless:i}=Po(this)&&this||{},t={},e=(n,r)=>{const s=i&&ko(t,r)||r;Un(t[s])&&Un(n)?t[s]=Ts(t[s],n):Un(n)?t[s]=Ts({},n):di(n)?t[s]=n.slice():t[s]=n};for(let n=0,r=arguments.length;n<r;n++)arguments[n]&&Vi(arguments[n],e);return t}const bd=(i,t,e,{allOwnKeys:n}={})=>(Vi(t,(r,s)=>{e&&Ut(r)?i[s]=xo(r,e):i[s]=r},{allOwnKeys:n}),i),wd=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Sd=(i,t,e,n)=>{i.prototype=Object.create(t.prototype,n),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:t.prototype}),e&&Object.assign(i.prototype,e)},Cd=(i,t,e,n)=>{let r,s,a;const o={};if(t=t||{},i==null)return t;do{for(r=Object.getOwnPropertyNames(i),s=r.length;s-- >0;)a=r[s],(!n||n(a,i,t))&&!o[a]&&(t[a]=i[a],o[a]=!0);i=e!==!1&&xs(i)}while(i&&(!e||e(i,t))&&i!==Object.prototype);return t},xd=(i,t,e)=>{i=String(i),(e===void 0||e>i.length)&&(e=i.length),e-=t.length;const n=i.indexOf(t,e);return n!==-1&&n===e},Td=i=>{if(!i)return null;if(di(i))return i;let t=i.length;if(!Eo(t))return null;const e=new Array(t);for(;t-- >0;)e[t]=i[t];return e},Ed=(i=>t=>i&&t instanceof i)(typeof Uint8Array<"u"&&xs(Uint8Array)),kd=(i,t)=>{const e=(i&&i[Symbol.iterator]).call(i);let n;for(;(n=e.next())&&!n.done;){const r=n.value;t.call(i,r[0],r[1])}},Ad=(i,t)=>{let e;const n=[];for(;(e=i.exec(t))!==null;)n.push(e);return n},Pd=Wt("HTMLFormElement"),Md=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,n){return e.toUpperCase()+n}),Mo=(({hasOwnProperty:i})=>(t,e)=>i.call(t,e))(Object.prototype),Rd=Wt("RegExp"),Ro=(i,t)=>{const e=Object.getOwnPropertyDescriptors(i),n={};Vi(e,(r,s)=>{let a;(a=t(r,s,i))!==!1&&(n[s]=a||r)}),Object.defineProperties(i,n)},Dd=i=>{Ro(i,(t,e)=>{if(Ut(i)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;const n=i[e];if(Ut(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")})}})},Ld=(i,t)=>{const e={},n=r=>{r.forEach(s=>{e[s]=!0})};return di(i)?n(i):n(String(i).split(t)),e},Od=()=>{},Id=(i,t)=>(i=+i,Number.isFinite(i)?i:t),Es="abcdefghijklmnopqrstuvwxyz",Do="0123456789",Lo={DIGIT:Do,ALPHA:Es,ALPHA_DIGIT:Es+Es.toUpperCase()+Do},Fd=(i=16,t=Lo.ALPHA_DIGIT)=>{let e="";const{length:n}=t;for(;i--;)e+=t[Math.random()*n|0];return e};function Nd(i){return!!(i&&Ut(i.append)&&i[Symbol.toStringTag]==="FormData"&&i[Symbol.iterator])}const Ud=i=>{const t=new Array(10),e=(n,r)=>{if(Nn(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[r]=n;const s=di(n)?[]:{};return Vi(n,(a,o)=>{const h=e(a,r+1);!ji(h)&&(s[o]=h)}),t[r]=void 0,s}}return n};return e(i,0)},Gd=Wt("AsyncFunction"),Bd=i=>i&&(Nn(i)||Ut(i))&&Ut(i.then)&&Ut(i.catch),R={isArray:di,isArrayBuffer:To,isBuffer:ld,isFormData:_d,isArrayBufferView:hd,isString:cd,isNumber:Eo,isBoolean:ud,isObject:Nn,isPlainObject:Un,isUndefined:ji,isDate:dd,isFile:fd,isBlob:gd,isRegExp:Rd,isFunction:Ut,isStream:md,isURLSearchParams:vd,isTypedArray:Ed,isFileList:pd,forEach:Vi,merge:Ts,extend:bd,trim:yd,stripBOM:wd,inherits:Sd,toFlatObject:Cd,kindOf:In,kindOfTest:Wt,endsWith:xd,toArray:Td,forEachEntry:kd,matchAll:Ad,isHTMLForm:Pd,hasOwnProperty:Mo,hasOwnProp:Mo,reduceDescriptors:Ro,freezeMethods:Dd,toObjectSet:Ld,toCamelCase:Md,noop:Od,toFiniteNumber:Id,findKey:ko,global:Ao,isContextDefined:Po,ALPHABET:Lo,generateString:Fd,isSpecCompliantForm:Nd,toJSONObject:Ud,isAsyncFn:Gd,isThenable:Bd};function Z(i,t,e,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),n&&(this.request=n),r&&(this.response=r)}R.inherits(Z,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:R.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Oo=Z.prototype,Io={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{Io[i]={value:i}}),Object.defineProperties(Z,Io),Object.defineProperty(Oo,"isAxiosError",{value:!0}),Z.from=(i,t,e,n,r,s)=>{const a=Object.create(Oo);return R.toFlatObject(i,a,function(o){return o!==Error.prototype},o=>o!=="isAxiosError"),Z.call(a,i.message,t,e,n,r),a.cause=i,a.name=i.name,s&&Object.assign(a,s),a};const zd=null;function ks(i){return R.isPlainObject(i)||R.isArray(i)}function Fo(i){return R.endsWith(i,"[]")?i.slice(0,-2):i}function No(i,t,e){return i?i.concat(t).map(function(n,r){return n=Fo(n),!e&&r?"["+n+"]":n}).join(e?".":""):t}function Hd(i){return R.isArray(i)&&!i.some(ks)}const jd=R.toFlatObject(R,{},null,function(i){return/^is[A-Z]/.test(i)});function Gn(i,t,e){if(!R.isObject(i))throw new TypeError("target must be an object");t=t||new FormData,e=R.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(u,g){return!R.isUndefined(g[u])});const n=e.metaTokens,r=e.visitor||l,s=e.dots,a=e.indexes,o=(e.Blob||typeof Blob<"u"&&Blob)&&R.isSpecCompliantForm(t);if(!R.isFunction(r))throw new TypeError("visitor must be a function");function h(u){if(u===null)return"";if(R.isDate(u))return u.toISOString();if(!o&&R.isBlob(u))throw new Z("Blob is not supported. Use a Buffer instead.");return R.isArrayBuffer(u)||R.isTypedArray(u)?o&&typeof Blob=="function"?new Blob([u]):Buffer.from(u):u}function l(u,g,p){let _=u;if(u&&!p&&typeof u=="object"){if(R.endsWith(g,"{}"))g=n?g:g.slice(0,-2),u=JSON.stringify(u);else if(R.isArray(u)&&Hd(u)||(R.isFileList(u)||R.endsWith(g,"[]"))&&(_=R.toArray(u)))return g=Fo(g),_.forEach(function(y,b){!(R.isUndefined(y)||y===null)&&t.append(a===!0?No([g],b,s):a===null?g:g+"[]",h(y))}),!1}return ks(u)?!0:(t.append(No(p,g,s),h(u)),!1)}const c=[],d=Object.assign(jd,{defaultVisitor:l,convertValue:h,isVisitable:ks});function f(u,g){if(!R.isUndefined(u)){if(c.indexOf(u)!==-1)throw Error("Circular reference detected in "+g.join("."));c.push(u),R.forEach(u,function(p,_){(!(R.isUndefined(p)||p===null)&&r.call(t,p,R.isString(_)?_.trim():_,g,d))===!0&&f(p,g?g.concat(_):[_])}),c.pop()}}if(!R.isObject(i))throw new TypeError("data must be an object");return f(i),t}function Uo(i){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function As(i,t){this._pairs=[],i&&Gn(i,this,t)}const Go=As.prototype;Go.append=function(i,t){this._pairs.push([i,t])},Go.toString=function(i){const t=i?function(e){return i.call(this,e,Uo)}:Uo;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};function Vd(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Bo(i,t,e){if(!t)return i;const n=e&&e.encode||Vd,r=e&&e.serialize;let s;if(r?s=r(t,e):s=R.isURLSearchParams(t)?t.toString():new As(t,e).toString(n),s){const a=i.indexOf("#");a!==-1&&(i=i.slice(0,a)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class $d{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){R.forEach(this.handlers,function(e){e!==null&&t(e)})}}const zo=$d,Ho={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xd=typeof URLSearchParams<"u"?URLSearchParams:As,Yd=typeof FormData<"u"?FormData:null,Wd=typeof Blob<"u"?Blob:null,qd=(()=>{let i;return typeof navigator<"u"&&((i=navigator.product)==="ReactNative"||i==="NativeScript"||i==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),Kd=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),qt={isBrowser:!0,classes:{URLSearchParams:Xd,FormData:Yd,Blob:Wd},isStandardBrowserEnv:qd,isStandardBrowserWebWorkerEnv:Kd,protocols:["http","https","file","blob","url","data"]};function Zd(i,t){return Gn(i,new qt.classes.URLSearchParams,Object.assign({visitor:function(e,n,r,s){return qt.isNode&&R.isBuffer(e)?(this.append(n,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function Jd(i){return R.matchAll(/\w+|\[(\w*)]/g,i).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Qd(i){const t={},e=Object.keys(i);let n;const r=e.length;let s;for(n=0;n<r;n++)s=e[n],t[s]=i[s];return t}function jo(i){function t(e,n,r,s){let a=e[s++];const o=Number.isFinite(+a),h=s>=e.length;return a=!a&&R.isArray(r)?r.length:a,h?(R.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!R.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],s)&&R.isArray(r[a])&&(r[a]=Qd(r[a])),!o)}if(R.isFormData(i)&&R.isFunction(i.entries)){const e={};return R.forEachEntry(i,(n,r)=>{t(Jd(n),r,e,0)}),e}return null}function tf(i,t,e){if(R.isString(i))try{return(t||JSON.parse)(i),R.trim(i)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(i)}const Ps={transitional:Ho,adapter:["xhr","http"],transformRequest:[function(i,t){const e=t.getContentType()||"",n=e.indexOf("application/json")>-1,r=R.isObject(i);if(r&&R.isHTMLForm(i)&&(i=new FormData(i)),R.isFormData(i))return n&&n?JSON.stringify(jo(i)):i;if(R.isArrayBuffer(i)||R.isBuffer(i)||R.isStream(i)||R.isFile(i)||R.isBlob(i))return i;if(R.isArrayBufferView(i))return i.buffer;if(R.isURLSearchParams(i))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),i.toString();let s;if(r){if(e.indexOf("application/x-www-form-urlencoded")>-1)return Zd(i,this.formSerializer).toString();if((s=R.isFileList(i))||e.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Gn(s?{"files[]":i}:i,a&&new a,this.formSerializer)}}return r||n?(t.setContentType("application/json",!1),tf(i)):i}],transformResponse:[function(i){const t=this.transitional||Ps.transitional,e=t&&t.forcedJSONParsing,n=this.responseType==="json";if(i&&R.isString(i)&&(e&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(i)}catch(s){if(r)throw s.name==="SyntaxError"?Z.from(s,Z.ERR_BAD_RESPONSE,this,null,this.response):s}}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:qt.classes.FormData,Blob:qt.classes.Blob},validateStatus:function(i){return i>=200&&i<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};R.forEach(["delete","get","head","post","put","patch"],i=>{Ps.headers[i]={}});const Ms=Ps,ef=R.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),nf=i=>{const t={};let e,n,r;return i&&i.split(`
|
|
2
|
-
`).forEach(function(s){r=s.indexOf(":"),e=s.substring(0,r).trim().toLowerCase(),n=s.substring(r+1).trim(),!(!e||t[e]&&
|
|
3
|
-
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach(r=>n.set(r)),n}static accessor(t){const e=(this[
|
|
4
|
-
`+s.map(
|
|
5
|
-
`):" "+
|
|
1
|
+
var ZYZGroupCoreWeb=function(H){"use strict";function xt(i,t){for(var e=0;e<t.length;e++){const n=t[e];if(typeof n!="string"&&!Array.isArray(n)){for(const r in n)if(r!=="default"&&!(r in i)){const s=Object.getOwnPropertyDescriptor(n,r);s&&Object.defineProperty(i,r,s.get?s:{enumerable:!0,get:()=>n[r]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}typeof process<"u"&&process.versions!=null&&process.versions.node!=null;const ng=(i=12)=>"x".repeat(i).replace(/[x]/g,t=>(Math.random()*16|0).toString(16));function Lh(i){let t="";for(let e=0,n=i.length;e<n;e++){const r=i.charCodeAt(e);r>=1&&r<=127?t+=i.charAt(e):r>2047?(t+=String.fromCharCode(224|r>>12&15),t+=String.fromCharCode(128|r>>6&63),t+=String.fromCharCode(128|r>>0&63)):(t+=String.fromCharCode(192|r>>6&31),t+=String.fromCharCode(128|r>>0&63))}return t}var ti=(i=>(i.UNKNOWN="",i.HTML="text/html",i.CSS="text/css",i.JPEG="image/jpeg",i.PNG="image/png",i.GIF="image/gif",i.WEBP="image/webp",i.SVG="image/svg+xml",i.MPEG="audio/mpeg",i.OGG="audio/ogg",i.MP4="video/mp4",i.JSON="application/json",i.JAVASCRIPT="application/javascript",i.ECMASCRIPT="application/ecmascript",i.EXCEL="application/vnb.ms-excel",i.XWWW="application/x-www-form-urlencoded",i.CSV="application/x-csv",i.PDF="application/pdf",i.ZIP="application/zip",i.TGZ="application/x-gtar",i.TAR_GZ="application/x-gzip",i.XML="text/xml",i.TEXT="text/plain",i))(ti||{});const yn=(i,t=16)=>(i=i.toLowerCase(),(i.indexOf("0b")==0||i.indexOf("0x")==0)&&(i=i.slice(2)),parseInt(i,t));function rg(){const i=Uint32Array.of(305419896),t=new Uint8Array(i.buffer);switch(t[0]*16777216+t[1]*65536+t[2]*256+t[3]){case 305419896:return!1;case 2018915346:return!0}}const Dh=i=>{let t=ti.UNKNOWN;switch(new DataView(i).getUint32(0,rg()).toString(16).toUpperCase()){case"FFD8FFDB":t=ti.JPEG;break;case"FFD8FFE0":case"FFD8FFE1":case"FFD8FFE2":case"FFD8FFE3":t=ti.JPEG;break;case"89504E47":t=ti.PNG;break;case"47494638":t=ti.GIF;break;case"52494646":t=ti.WEBP;break;case"25504446":t=ti.PDF;break;case"504B0304":t=ti.ZIP;break}return t},Ih=function(){const i=[];return{writeByte(t){i.push(t&255)},writeShort(t){this.writeByte(t),this.writeByte(t>>>8)},writeBytes(t,e=0,n=t.length){for(let r=0;r<n;r++)this.writeByte(t[r+e])},writeString(t){for(let e=0,n=t.length;e<n;e++)this.writeByte(t.charCodeAt(e))},toByteArray(){return i},toString(){let t="[";for(let e=0,n=i.length;e<n;e++)e>0&&(t+=","),t+=i[e];return t+="]",t}}},sg=function(){let i=0,t=0,e=0,n="";const r=function(a){if(!(a<0)){if(a<26)return 65+a;if(a<52)return 97+(a-26);if(a<62)return 48+(a-52);if(a==62)return 43;if(a==63)return 47}throw new Error("n:"+a)},s=function(a){n+=String.fromCharCode(r(a&63))};return{writeByte(a){for(i=i<<8|a&255,t+=8,e+=1;t>=6;)s(i>>>t-6),t-=6},flush(){if(t>0&&(s(i<<6-t),i=0,t=0),e%3!=0){const a=3-e%3;for(let o=0;o<a;o++)n+="="}},toString(){return n}}};Math.cbrt=Math.cbrt||function(i){const t=Math.pow(Math.abs(i),.3333333333333333);return i<0?-t:t};function Oh(i,t){return function(){return i.apply(t,arguments)}}const{toString:ag}=Object.prototype,{getPrototypeOf:ho}=Object,js=(i=>t=>{const e=ag.call(t);return i[e]||(i[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),je=i=>(i=i.toLowerCase(),t=>js(t)===i),Vs=i=>t=>typeof t===i,{isArray:bn}=Array,or=Vs("undefined");function og(i){return i!==null&&!or(i)&&i.constructor!==null&&!or(i.constructor)&&Ie(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Fh=je("ArrayBuffer");function lg(i){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(i):t=i&&i.buffer&&Fh(i.buffer),t}const hg=Vs("string"),Ie=Vs("function"),Nh=Vs("number"),qs=i=>i!==null&&typeof i=="object",cg=i=>i===!0||i===!1,Xs=i=>{if(js(i)!=="object")return!1;const t=ho(i);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},ug=je("Date"),fg=je("File"),dg=je("Blob"),gg=je("FileList"),pg=i=>qs(i)&&Ie(i.pipe),mg=i=>{let t;return i&&(typeof FormData=="function"&&i instanceof FormData||Ie(i.append)&&((t=js(i))==="formdata"||t==="object"&&Ie(i.toString)&&i.toString()==="[object FormData]"))},vg=je("URLSearchParams"),_g=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function lr(i,t,{allOwnKeys:e=!1}={}){if(i===null||typeof i>"u")return;let n,r;if(typeof i!="object"&&(i=[i]),bn(i))for(n=0,r=i.length;n<r;n++)t.call(null,i[n],n,i);else{const s=e?Object.getOwnPropertyNames(i):Object.keys(i),a=s.length;let o;for(n=0;n<a;n++)o=s[n],t.call(null,i[o],o,i)}}function Uh(i,t){t=t.toLowerCase();const e=Object.keys(i);let n=e.length,r;for(;n-- >0;)if(r=e[n],t===r.toLowerCase())return r;return null}const Bh=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Gh=i=>!or(i)&&i!==Bh;function co(){const{caseless:i}=Gh(this)&&this||{},t={},e=(n,r)=>{const s=i&&Uh(t,r)||r;Xs(t[s])&&Xs(n)?t[s]=co(t[s],n):Xs(n)?t[s]=co({},n):bn(n)?t[s]=n.slice():t[s]=n};for(let n=0,r=arguments.length;n<r;n++)arguments[n]&&lr(arguments[n],e);return t}const yg=(i,t,e,{allOwnKeys:n}={})=>(lr(t,(r,s)=>{e&&Ie(r)?i[s]=Oh(r,e):i[s]=r},{allOwnKeys:n}),i),bg=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),wg=(i,t,e,n)=>{i.prototype=Object.create(t.prototype,n),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:t.prototype}),e&&Object.assign(i.prototype,e)},xg=(i,t,e,n)=>{let r,s,a;const o={};if(t=t||{},i==null)return t;do{for(r=Object.getOwnPropertyNames(i),s=r.length;s-- >0;)a=r[s],(!n||n(a,i,t))&&!o[a]&&(t[a]=i[a],o[a]=!0);i=e!==!1&&ho(i)}while(i&&(!e||e(i,t))&&i!==Object.prototype);return t},Sg=(i,t,e)=>{i=String(i),(e===void 0||e>i.length)&&(e=i.length),e-=t.length;const n=i.indexOf(t,e);return n!==-1&&n===e},Cg=i=>{if(!i)return null;if(bn(i))return i;let t=i.length;if(!Nh(t))return null;const e=new Array(t);for(;t-- >0;)e[t]=i[t];return e},kg=(i=>t=>i&&t instanceof i)(typeof Uint8Array<"u"&&ho(Uint8Array)),Tg=(i,t)=>{const e=(i&&i[Symbol.iterator]).call(i);let n;for(;(n=e.next())&&!n.done;){const r=n.value;t.call(i,r[0],r[1])}},Eg=(i,t)=>{let e;const n=[];for(;(e=i.exec(t))!==null;)n.push(e);return n},Ag=je("HTMLFormElement"),Pg=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,n){return e.toUpperCase()+n}),$h=(({hasOwnProperty:i})=>(t,e)=>i.call(t,e))(Object.prototype),Mg=je("RegExp"),zh=(i,t)=>{const e=Object.getOwnPropertyDescriptors(i),n={};lr(e,(r,s)=>{let a;(a=t(r,s,i))!==!1&&(n[s]=a||r)}),Object.defineProperties(i,n)},Rg=i=>{zh(i,(t,e)=>{if(Ie(i)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;const n=i[e];if(Ie(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")})}})},Lg=(i,t)=>{const e={},n=r=>{r.forEach(s=>{e[s]=!0})};return bn(i)?n(i):n(String(i).split(t)),e},Dg=()=>{},Ig=(i,t)=>(i=+i,Number.isFinite(i)?i:t),uo="abcdefghijklmnopqrstuvwxyz",Hh="0123456789",jh={DIGIT:Hh,ALPHA:uo,ALPHA_DIGIT:uo+uo.toUpperCase()+Hh},Og=(i=16,t=jh.ALPHA_DIGIT)=>{let e="";const{length:n}=t;for(;i--;)e+=t[Math.random()*n|0];return e};function Fg(i){return!!(i&&Ie(i.append)&&i[Symbol.toStringTag]==="FormData"&&i[Symbol.iterator])}const Ng=i=>{const t=new Array(10),e=(n,r)=>{if(qs(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[r]=n;const s=bn(n)?[]:{};return lr(n,(a,o)=>{const l=e(a,r+1);!or(l)&&(s[o]=l)}),t[r]=void 0,s}}return n};return e(i,0)},Ug=je("AsyncFunction"),Bg=i=>i&&(qs(i)||Ie(i))&&Ie(i.then)&&Ie(i.catch),st={isArray:bn,isArrayBuffer:Fh,isBuffer:og,isFormData:mg,isArrayBufferView:lg,isString:hg,isNumber:Nh,isBoolean:cg,isObject:qs,isPlainObject:Xs,isUndefined:or,isDate:ug,isFile:fg,isBlob:dg,isRegExp:Mg,isFunction:Ie,isStream:pg,isURLSearchParams:vg,isTypedArray:kg,isFileList:gg,forEach:lr,merge:co,extend:yg,trim:_g,stripBOM:bg,inherits:wg,toFlatObject:xg,kindOf:js,kindOfTest:je,endsWith:Sg,toArray:Cg,forEachEntry:Tg,matchAll:Eg,isHTMLForm:Ag,hasOwnProperty:$h,hasOwnProp:$h,reduceDescriptors:zh,freezeMethods:Rg,toObjectSet:Lg,toCamelCase:Pg,noop:Dg,toFiniteNumber:Ig,findKey:Uh,global:Bh,isContextDefined:Gh,ALPHABET:jh,generateString:Og,isSpecCompliantForm:Fg,toJSONObject:Ng,isAsyncFn:Ug,isThenable:Bg};function $t(i,t,e,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),n&&(this.request=n),r&&(this.response=r)}st.inherits($t,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:st.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Vh=$t.prototype,qh={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{qh[i]={value:i}}),Object.defineProperties($t,qh),Object.defineProperty(Vh,"isAxiosError",{value:!0}),$t.from=(i,t,e,n,r,s)=>{const a=Object.create(Vh);return st.toFlatObject(i,a,function(o){return o!==Error.prototype},o=>o!=="isAxiosError"),$t.call(a,i.message,t,e,n,r),a.cause=i,a.name=i.name,s&&Object.assign(a,s),a};const Gg=null;function fo(i){return st.isPlainObject(i)||st.isArray(i)}function Xh(i){return st.endsWith(i,"[]")?i.slice(0,-2):i}function Yh(i,t,e){return i?i.concat(t).map(function(n,r){return n=Xh(n),!e&&r?"["+n+"]":n}).join(e?".":""):t}function $g(i){return st.isArray(i)&&!i.some(fo)}const zg=st.toFlatObject(st,{},null,function(i){return/^is[A-Z]/.test(i)});function Ys(i,t,e){if(!st.isObject(i))throw new TypeError("target must be an object");t=t||new FormData,e=st.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(u,p){return!st.isUndefined(p[u])});const n=e.metaTokens,r=e.visitor||h,s=e.dots,a=e.indexes,o=(e.Blob||typeof Blob<"u"&&Blob)&&st.isSpecCompliantForm(t);if(!st.isFunction(r))throw new TypeError("visitor must be a function");function l(u){if(u===null)return"";if(st.isDate(u))return u.toISOString();if(!o&&st.isBlob(u))throw new $t("Blob is not supported. Use a Buffer instead.");return st.isArrayBuffer(u)||st.isTypedArray(u)?o&&typeof Blob=="function"?new Blob([u]):Buffer.from(u):u}function h(u,p,m){let y=u;if(u&&!m&&typeof u=="object"){if(st.endsWith(p,"{}"))p=n?p:p.slice(0,-2),u=JSON.stringify(u);else if(st.isArray(u)&&$g(u)||(st.isFileList(u)||st.endsWith(p,"[]"))&&(y=st.toArray(u)))return p=Xh(p),y.forEach(function(S,C){!(st.isUndefined(S)||S===null)&&t.append(a===!0?Yh([p],C,s):a===null?p:p+"[]",l(S))}),!1}return fo(u)?!0:(t.append(Yh(m,p,s),l(u)),!1)}const c=[],d=Object.assign(zg,{defaultVisitor:h,convertValue:l,isVisitable:fo});function f(u,p){if(!st.isUndefined(u)){if(c.indexOf(u)!==-1)throw Error("Circular reference detected in "+p.join("."));c.push(u),st.forEach(u,function(m,y){(!(st.isUndefined(m)||m===null)&&r.call(t,m,st.isString(y)?y.trim():y,p,d))===!0&&f(m,p?p.concat(y):[y])}),c.pop()}}if(!st.isObject(i))throw new TypeError("data must be an object");return f(i),t}function Wh(i){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function go(i,t){this._pairs=[],i&&Ys(i,this,t)}const Kh=go.prototype;Kh.append=function(i,t){this._pairs.push([i,t])},Kh.toString=function(i){const t=i?function(e){return i.call(this,e,Wh)}:Wh;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};function Hg(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Zh(i,t,e){if(!t)return i;const n=e&&e.encode||Hg,r=e&&e.serialize;let s;if(r?s=r(t,e):s=st.isURLSearchParams(t)?t.toString():new go(t,e).toString(n),s){const a=i.indexOf("#");a!==-1&&(i=i.slice(0,a)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class jg{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){st.forEach(this.handlers,function(e){e!==null&&t(e)})}}const Jh=jg,Qh={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Vg=typeof URLSearchParams<"u"?URLSearchParams:go,qg=typeof FormData<"u"?FormData:null,Xg=typeof Blob<"u"?Blob:null,Yg=(()=>{let i;return typeof navigator<"u"&&((i=navigator.product)==="ReactNative"||i==="NativeScript"||i==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),Wg=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Ve={isBrowser:!0,classes:{URLSearchParams:Vg,FormData:qg,Blob:Xg},isStandardBrowserEnv:Yg,isStandardBrowserWebWorkerEnv:Wg,protocols:["http","https","file","blob","url","data"]};function Kg(i,t){return Ys(i,new Ve.classes.URLSearchParams,Object.assign({visitor:function(e,n,r,s){return Ve.isNode&&st.isBuffer(e)?(this.append(n,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function Zg(i){return st.matchAll(/\w+|\[(\w*)]/g,i).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Jg(i){const t={},e=Object.keys(i);let n;const r=e.length;let s;for(n=0;n<r;n++)s=e[n],t[s]=i[s];return t}function tc(i){function t(e,n,r,s){let a=e[s++];const o=Number.isFinite(+a),l=s>=e.length;return a=!a&&st.isArray(r)?r.length:a,l?(st.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!st.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],s)&&st.isArray(r[a])&&(r[a]=Jg(r[a])),!o)}if(st.isFormData(i)&&st.isFunction(i.entries)){const e={};return st.forEachEntry(i,(n,r)=>{t(Zg(n),r,e,0)}),e}return null}function Qg(i,t,e){if(st.isString(i))try{return(t||JSON.parse)(i),st.trim(i)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(i)}const po={transitional:Qh,adapter:["xhr","http"],transformRequest:[function(i,t){const e=t.getContentType()||"",n=e.indexOf("application/json")>-1,r=st.isObject(i);if(r&&st.isHTMLForm(i)&&(i=new FormData(i)),st.isFormData(i))return n&&n?JSON.stringify(tc(i)):i;if(st.isArrayBuffer(i)||st.isBuffer(i)||st.isStream(i)||st.isFile(i)||st.isBlob(i))return i;if(st.isArrayBufferView(i))return i.buffer;if(st.isURLSearchParams(i))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),i.toString();let s;if(r){if(e.indexOf("application/x-www-form-urlencoded")>-1)return Kg(i,this.formSerializer).toString();if((s=st.isFileList(i))||e.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Ys(s?{"files[]":i}:i,a&&new a,this.formSerializer)}}return r||n?(t.setContentType("application/json",!1),Qg(i)):i}],transformResponse:[function(i){const t=this.transitional||po.transitional,e=t&&t.forcedJSONParsing,n=this.responseType==="json";if(i&&st.isString(i)&&(e&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(i)}catch(s){if(r)throw s.name==="SyntaxError"?$t.from(s,$t.ERR_BAD_RESPONSE,this,null,this.response):s}}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ve.classes.FormData,Blob:Ve.classes.Blob},validateStatus:function(i){return i>=200&&i<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};st.forEach(["delete","get","head","post","put","patch"],i=>{po.headers[i]={}});const mo=po,tp=st.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ep=i=>{const t={};let e,n,r;return i&&i.split(`
|
|
2
|
+
`).forEach(function(s){r=s.indexOf(":"),e=s.substring(0,r).trim().toLowerCase(),n=s.substring(r+1).trim(),!(!e||t[e]&&tp[e])&&(e==="set-cookie"?t[e]?t[e].push(n):t[e]=[n]:t[e]=t[e]?t[e]+", "+n:n)}),t},ec=Symbol("internals");function hr(i){return i&&String(i).trim().toLowerCase()}function Ws(i){return i===!1||i==null?i:st.isArray(i)?i.map(Ws):String(i)}function ip(i){const t=Object.create(null),e=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=e.exec(i);)t[n[1]]=n[2];return t}const np=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function vo(i,t,e,n,r){if(st.isFunction(n))return n.call(this,t,e);if(r&&(t=e),!!st.isString(t)){if(st.isString(n))return t.indexOf(n)!==-1;if(st.isRegExp(n))return n.test(t)}}function rp(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,n)=>e.toUpperCase()+n)}function sp(i,t){const e=st.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(i,n+e,{value:function(r,s,a){return this[n].call(this,t,r,s,a)},configurable:!0})})}class Ks{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function s(o,l,h){const c=hr(l);if(!c)throw new Error("header name must be a non-empty string");const d=st.findKey(r,c);(!d||r[d]===void 0||h===!0||h===void 0&&r[d]!==!1)&&(r[d||l]=Ws(o))}const a=(o,l)=>st.forEach(o,(h,c)=>s(h,c,l));return st.isPlainObject(t)||t instanceof this.constructor?a(t,e):st.isString(t)&&(t=t.trim())&&!np(t)?a(ep(t),e):t!=null&&s(e,t,n),this}get(t,e){if(t=hr(t),t){const n=st.findKey(this,t);if(n){const r=this[n];if(!e)return r;if(e===!0)return ip(r);if(st.isFunction(e))return e.call(this,r,n);if(st.isRegExp(e))return e.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=hr(t),t){const n=st.findKey(this,t);return!!(n&&this[n]!==void 0&&(!e||vo(this,this[n],n,e)))}return!1}delete(t,e){const n=this;let r=!1;function s(a){if(a=hr(a),a){const o=st.findKey(n,a);o&&(!e||vo(n,n[o],o,e))&&(delete n[o],r=!0)}}return st.isArray(t)?t.forEach(s):s(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const s=e[n];(!t||vo(this,this[s],s,t,!0))&&(delete this[s],r=!0)}return r}normalize(t){const e=this,n={};return st.forEach(this,(r,s)=>{const a=st.findKey(n,s);if(a){e[a]=Ws(r),delete e[s];return}const o=t?rp(s):String(s).trim();o!==s&&delete e[s],e[o]=Ws(r),n[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return st.forEach(this,(n,r)=>{n!=null&&n!==!1&&(e[r]=t&&st.isArray(n)?n.join(", "):n)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(`
|
|
3
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach(r=>n.set(r)),n}static accessor(t){const e=(this[ec]=this[ec]={accessors:{}}).accessors,n=this.prototype;function r(s){const a=hr(s);e[a]||(sp(n,s),e[a]=!0)}return st.isArray(t)?t.forEach(r):r(t),this}}Ks.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),st.reduceDescriptors(Ks.prototype,({value:i},t)=>{let e=t[0].toUpperCase()+t.slice(1);return{get:()=>i,set(n){this[e]=n}}}),st.freezeMethods(Ks);const ei=Ks;function _o(i,t){const e=this||mo,n=t||e,r=ei.from(n.headers);let s=n.data;return st.forEach(i,function(a){s=a.call(e,s,r.normalize(),t?t.status:void 0)}),r.normalize(),s}function ic(i){return!!(i&&i.__CANCEL__)}function cr(i,t,e){$t.call(this,i??"canceled",$t.ERR_CANCELED,t,e),this.name="CanceledError"}st.inherits(cr,$t,{__CANCEL__:!0});function ap(i,t,e){const n=e.config.validateStatus;!e.status||!n||n(e.status)?i(e):t(new $t("Request failed with status code "+e.status,[$t.ERR_BAD_REQUEST,$t.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}const op=Ve.isStandardBrowserEnv?function(){return{write:function(i,t,e,n,r,s){const a=[];a.push(i+"="+encodeURIComponent(t)),st.isNumber(e)&&a.push("expires="+new Date(e).toGMTString()),st.isString(n)&&a.push("path="+n),st.isString(r)&&a.push("domain="+r),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(i){const t=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(i){this.write(i,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function lp(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function hp(i,t){return t?i.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):i}function nc(i,t){return i&&!lp(t)?hp(i,t):t}const cp=Ve.isStandardBrowserEnv?function(){const i=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let e;function n(r){let s=r;return i&&(t.setAttribute("href",s),s=t.href),t.setAttribute("href",s),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return e=n(window.location.href),function(r){const s=st.isString(r)?n(r):r;return s.protocol===e.protocol&&s.host===e.host}}():function(){return function(){return!0}}();function up(i){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return t&&t[1]||""}function fp(i,t){i=i||10;const e=new Array(i),n=new Array(i);let r=0,s=0,a;return t=t!==void 0?t:1e3,function(o){const l=Date.now(),h=n[s];a||(a=l),e[r]=o,n[r]=l;let c=s,d=0;for(;c!==r;)d+=e[c++],c=c%i;if(r=(r+1)%i,r===s&&(s=(s+1)%i),l-a<t)return;const f=h&&l-h;return f?Math.round(d*1e3/f):void 0}}function rc(i,t){let e=0;const n=fp(50,250);return r=>{const s=r.loaded,a=r.lengthComputable?r.total:void 0,o=s-e,l=n(o),h=s<=a;e=s;const c={loaded:s,total:a,progress:a?s/a:void 0,bytes:o,rate:l||void 0,estimated:l&&a&&h?(a-s)/l:void 0,event:r};c[t?"download":"upload"]=!0,i(c)}}const dp=typeof XMLHttpRequest<"u",gp=dp&&function(i){return new Promise(function(t,e){let n=i.data;const r=ei.from(i.headers).normalize(),s=i.responseType;let a;function o(){i.cancelToken&&i.cancelToken.unsubscribe(a),i.signal&&i.signal.removeEventListener("abort",a)}let l;st.isFormData(n)&&(Ve.isStandardBrowserEnv||Ve.isStandardBrowserWebWorkerEnv?r.setContentType(!1):r.getContentType(/^\s*multipart\/form-data/)?st.isString(l=r.getContentType())&&r.setContentType(l.replace(/^\s*(multipart\/form-data);+/,"$1")):r.setContentType("multipart/form-data"));let h=new XMLHttpRequest;if(i.auth){const u=i.auth.username||"",p=i.auth.password?unescape(encodeURIComponent(i.auth.password)):"";r.set("Authorization","Basic "+btoa(u+":"+p))}const c=nc(i.baseURL,i.url);h.open(i.method.toUpperCase(),Zh(c,i.params,i.paramsSerializer),!0),h.timeout=i.timeout;function d(){if(!h)return;const u=ei.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),p={data:!s||s==="text"||s==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:u,config:i,request:h};ap(function(m){t(m),o()},function(m){e(m),o()},p),h=null}if("onloadend"in h?h.onloadend=d:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(d)},h.onabort=function(){h&&(e(new $t("Request aborted",$t.ECONNABORTED,i,h)),h=null)},h.onerror=function(){e(new $t("Network Error",$t.ERR_NETWORK,i,h)),h=null},h.ontimeout=function(){let u=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const p=i.transitional||Qh;i.timeoutErrorMessage&&(u=i.timeoutErrorMessage),e(new $t(u,p.clarifyTimeoutError?$t.ETIMEDOUT:$t.ECONNABORTED,i,h)),h=null},Ve.isStandardBrowserEnv){const u=(i.withCredentials||cp(c))&&i.xsrfCookieName&&op.read(i.xsrfCookieName);u&&r.set(i.xsrfHeaderName,u)}n===void 0&&r.setContentType(null),"setRequestHeader"in h&&st.forEach(r.toJSON(),function(u,p){h.setRequestHeader(p,u)}),st.isUndefined(i.withCredentials)||(h.withCredentials=!!i.withCredentials),s&&s!=="json"&&(h.responseType=i.responseType),typeof i.onDownloadProgress=="function"&&h.addEventListener("progress",rc(i.onDownloadProgress,!0)),typeof i.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",rc(i.onUploadProgress)),(i.cancelToken||i.signal)&&(a=u=>{h&&(e(!u||u.type?new cr(null,i,h):u),h.abort(),h=null)},i.cancelToken&&i.cancelToken.subscribe(a),i.signal&&(i.signal.aborted?a():i.signal.addEventListener("abort",a)));const f=up(c);if(f&&Ve.protocols.indexOf(f)===-1){e(new $t("Unsupported protocol "+f+":",$t.ERR_BAD_REQUEST,i));return}h.send(n||null)})},yo={http:Gg,xhr:gp};st.forEach(yo,(i,t)=>{if(i){try{Object.defineProperty(i,"name",{value:t})}catch{}Object.defineProperty(i,"adapterName",{value:t})}});const sc=i=>`- ${i}`,pp=i=>st.isFunction(i)||i===null||i===!1,ac={getAdapter:i=>{i=st.isArray(i)?i:[i];const{length:t}=i;let e,n;const r={};for(let s=0;s<t;s++){e=i[s];let a;if(n=e,!pp(e)&&(n=yo[(a=String(e)).toLowerCase()],n===void 0))throw new $t(`Unknown adapter '${a}'`);if(n)break;r[a||"#"+s]=n}if(!n){const s=Object.entries(r).map(([o,l])=>`adapter ${o} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=t?s.length>1?`since :
|
|
4
|
+
`+s.map(sc).join(`
|
|
5
|
+
`):" "+sc(s[0]):"as no adapter specified";throw new $t("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return n},adapters:yo};function bo(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new cr(null,i)}function oc(i){return bo(i),i.headers=ei.from(i.headers),i.data=_o.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),ac.getAdapter(i.adapter||mo.adapter)(i).then(function(t){return bo(i),t.data=_o.call(i,i.transformResponse,t),t.headers=ei.from(t.headers),t},function(t){return ic(t)||(bo(i),t&&t.response&&(t.response.data=_o.call(i,i.transformResponse,t.response),t.response.headers=ei.from(t.response.headers))),Promise.reject(t)})}const lc=i=>i instanceof ei?i.toJSON():i;function wn(i,t){t=t||{};const e={};function n(h,c,d){return st.isPlainObject(h)&&st.isPlainObject(c)?st.merge.call({caseless:d},h,c):st.isPlainObject(c)?st.merge({},c):st.isArray(c)?c.slice():c}function r(h,c,d){if(st.isUndefined(c)){if(!st.isUndefined(h))return n(void 0,h,d)}else return n(h,c,d)}function s(h,c){if(!st.isUndefined(c))return n(void 0,c)}function a(h,c){if(st.isUndefined(c)){if(!st.isUndefined(h))return n(void 0,h)}else return n(void 0,c)}function o(h,c,d){if(d in t)return n(h,c);if(d in i)return n(void 0,h)}const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(h,c)=>r(lc(h),lc(c),!0)};return st.forEach(Object.keys(Object.assign({},i,t)),function(h){const c=l[h]||r,d=c(i[h],t[h],h);st.isUndefined(d)&&c!==o||(e[h]=d)}),e}const hc="1.5.1",wo={};["object","boolean","number","function","string","symbol"].forEach((i,t)=>{wo[i]=function(e){return typeof e===i||"a"+(t<1?"n ":" ")+i}});const cc={};wo.transitional=function(i,t,e){function n(r,s){return"[Axios v"+hc+"] Transitional option '"+r+"'"+s+(e?". "+e:"")}return(r,s,a)=>{if(i===!1)throw new $t(n(s," has been removed"+(t?" in "+t:"")),$t.ERR_DEPRECATED);return t&&!cc[s]&&(cc[s]=!0,console.warn(n(s," has been deprecated since v"+t+" and will be removed in the near future"))),i?i(r,s,a):!0}};function mp(i,t,e){if(typeof i!="object")throw new $t("options must be an object",$t.ERR_BAD_OPTION_VALUE);const n=Object.keys(i);let r=n.length;for(;r-- >0;){const s=n[r],a=t[s];if(a){const o=i[s],l=o===void 0||a(o,s,i);if(l!==!0)throw new $t("option "+s+" must be "+l,$t.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new $t("Unknown option "+s,$t.ERR_BAD_OPTION)}}const xo={assertOptions:mp,validators:wo},bi=xo.validators;class Zs{constructor(t){this.defaults=t,this.interceptors={request:new Jh,response:new Jh}}request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=wn(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:s}=e;n!==void 0&&xo.assertOptions(n,{silentJSONParsing:bi.transitional(bi.boolean),forcedJSONParsing:bi.transitional(bi.boolean),clarifyTimeoutError:bi.transitional(bi.boolean)},!1),r!=null&&(st.isFunction(r)?e.paramsSerializer={serialize:r}:xo.assertOptions(r,{encode:bi.function,serialize:bi.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=s&&st.merge(s.common,s[e.method]);s&&st.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),e.headers=ei.concat(a,s);const o=[];let l=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(e)===!1||(l=l&&p.synchronous,o.unshift(p.fulfilled,p.rejected))});const h=[];this.interceptors.response.forEach(function(p){h.push(p.fulfilled,p.rejected)});let c,d=0,f;if(!l){const p=[oc.bind(this),void 0];for(p.unshift.apply(p,o),p.push.apply(p,h),f=p.length,c=Promise.resolve(e);d<f;)c=c.then(p[d++],p[d++]);return c}f=o.length;let u=e;for(d=0;d<f;){const p=o[d++],m=o[d++];try{u=p(u)}catch(y){m.call(this,y);break}}try{c=oc.call(this,u)}catch(p){return Promise.reject(p)}for(d=0,f=h.length;d<f;)c=c.then(h[d++],h[d++]);return c}getUri(t){t=wn(this.defaults,t);const e=nc(t.baseURL,t.url);return Zh(e,t.params,t.paramsSerializer)}}st.forEach(["delete","get","head","options"],function(i){Zs.prototype[i]=function(t,e){return this.request(wn(e||{},{method:i,url:t,data:(e||{}).data}))}}),st.forEach(["post","put","patch"],function(i){function t(e){return function(n,r,s){return this.request(wn(s||{},{method:i,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Zs.prototype[i]=t(),Zs.prototype[i+"Form"]=t(!0)});const Js=Zs;class So{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(r){e=r});const n=this;this.promise.then(r=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](r);n._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(r);return a.cancel=function(){n.unsubscribe(s)},a},t(function(r,s,a){n.reason||(n.reason=new cr(r,s,a),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}static source(){let t;return{token:new So(function(e){t=e}),cancel:t}}}const vp=So;function _p(i){return function(t){return i.apply(null,t)}}function yp(i){return st.isObject(i)&&i.isAxiosError===!0}const Co={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Co).forEach(([i,t])=>{Co[t]=i});const bp=Co;function uc(i){const t=new Js(i),e=Oh(Js.prototype.request,t);return st.extend(e,Js.prototype,t,{allOwnKeys:!0}),st.extend(e,t,null,{allOwnKeys:!0}),e.create=function(n){return uc(wn(i,n))},e}const he=uc(mo);he.Axios=Js,he.CanceledError=cr,he.CancelToken=vp,he.isCancel=ic,he.VERSION=hc,he.toFormData=Ys,he.AxiosError=$t,he.Cancel=he.CanceledError,he.all=function(i){return Promise.all(i)},he.spread=_p,he.isAxiosError=yp,he.mergeConfig=wn,he.AxiosHeaders=ei,he.formToJSON=i=>tc(st.isHTMLForm(i)?new FormData(i):i),he.getAdapter=ac.getAdapter,he.HttpStatusCode=bp,he.default=he;var ko=function(i,t){return ko=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])},ko(i,t)};function wi(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ko(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function To(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ur(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],a;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(o){a={error:o}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return s}function fr(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))}function ii(i){return typeof i=="function"}function Eo(i){var t=function(n){Error.call(n),n.stack=new Error().stack},e=i(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var Ao=Eo(function(i){return function(t){i(this),this.message=t?t.length+` errors occurred during unsubscription:
|
|
6
6
|
`+t.map(function(e,n){return n+1+") "+e.toString()}).join(`
|
|
7
|
-
`):"",this.name="UnsubscriptionError",this.errors=t}});function Vn(i,t){if(i){var e=i.indexOf(t);0<=e&&i.splice(e,1)}}var qi=function(){function i(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var t,e,n,r,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=Bs(a),h=o.next();!h.done;h=o.next()){var l=h.value;l.remove(this)}}catch(p){t={error:p}}finally{try{h&&!h.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}else a.remove(this);var c=this.initialTeardown;if(se(c))try{c()}catch(p){s=p instanceof Hs?p.errors:[p]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=Bs(d),u=f.next();!u.done;u=f.next()){var g=u.value;try{nl(g)}catch(p){s=s??[],p instanceof Hs?s=Wi(Wi([],Yi(s)),Yi(p.errors)):s.push(p)}}}catch(p){n={error:p}}finally{try{u&&!u.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}}if(s)throw new Hs(s)}},i.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)nl(t);else{if(t instanceof i){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},i.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},i.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},i.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&Vn(e,t)},i.prototype.remove=function(t){var e=this._finalizers;e&&Vn(e,t),t instanceof i&&t._removeParent(this)},i.EMPTY=function(){var t=new i;return t.closed=!0,t}(),i}(),el=qi.EMPTY;function il(i){return i instanceof qi||i&&"closed"in i&&se(i.remove)&&se(i.add)&&se(i.unsubscribe)}function nl(i){se(i)?i():i.unsubscribe()}var rl={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Cf={setTimeout:function(i,t){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];return setTimeout.apply(void 0,Wi([i,t],Yi(e)))},clearTimeout:function(i){return clearTimeout(i)},delegate:void 0};function xf(i){Cf.setTimeout(function(){throw i})}function sl(){}function $n(i){i()}var js=function(i){xe(t,i);function t(e){var n=i.call(this)||this;return n.isStopped=!1,e?(n.destination=e,il(e)&&e.add(n)):n.destination=Af,n}return t.create=function(e,n,r){return new $s(e,n,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,i.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(qi),Tf=Function.prototype.bind;function Vs(i,t){return Tf.call(i,t)}var Ef=function(){function i(t){this.partialObserver=t}return i.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(n){Xn(n)}},i.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(n){Xn(n)}else Xn(t)},i.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){Xn(e)}},i}(),$s=function(i){xe(t,i);function t(e,n,r){var s=i.call(this)||this,a;if(se(e)||!e)a={next:e??void 0,error:n??void 0,complete:r??void 0};else{var o;s&&rl.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=function(){return s.unsubscribe()},a={next:e.next&&Vs(e.next,o),error:e.error&&Vs(e.error,o),complete:e.complete&&Vs(e.complete,o)}):a=e}return s.destination=new Ef(a),s}return t}(js);function Xn(i){xf(i)}function kf(i){throw i}var Af={closed:!0,next:sl,error:kf,complete:sl},Pf=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Mf(i){return i}function Rf(i){return i.length===0?Mf:i.length===1?i[0]:function(t){return i.reduce(function(e,n){return n(e)},t)}}var al=function(){function i(t){t&&(this._subscribe=t)}return i.prototype.lift=function(t){var e=new i;return e.source=this,e.operator=t,e},i.prototype.subscribe=function(t,e,n){var r=this,s=Lf(t)?t:new $s(t,e,n);return $n(function(){var a=r,o=a.operator,h=a.source;s.add(o?o.call(s,h):h?r._subscribe(s):r._trySubscribe(s))}),s},i.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},i.prototype.forEach=function(t,e){var n=this;return e=ol(e),new e(function(r,s){var a=new $s({next:function(o){try{t(o)}catch(h){s(h),a.unsubscribe()}},error:s,complete:r});n.subscribe(a)})},i.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},i.prototype[Pf]=function(){return this},i.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Rf(t)(this)},i.prototype.toPromise=function(t){var e=this;return t=ol(t),new t(function(n,r){var s;e.subscribe(function(a){return s=a},function(a){return r(a)},function(){return n(s)})})},i.create=function(t){return new i(t)},i}();function ol(i){var t;return(t=i??rl.Promise)!==null&&t!==void 0?t:Promise}function Df(i){return i&&se(i.next)&&se(i.error)&&se(i.complete)}function Lf(i){return i&&i instanceof js||Df(i)&&il(i)}(function(i){xe(t,i);function t(e,n,r,s,a,o){var h=i.call(this,e)||this;return h.onFinalize=a,h.shouldUnsubscribe=o,h._next=n?function(l){try{n(l)}catch(c){e.error(c)}}:i.prototype._next,h._error=s?function(l){try{s(l)}catch(c){e.error(c)}finally{this.unsubscribe()}}:i.prototype._error,h._complete=r?function(){try{r()}catch(l){e.error(l)}finally{this.unsubscribe()}}:i.prototype._complete,h}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;i.prototype.unsubscribe.call(this),!n&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t})(js);var Of=zs(function(i){return function(){i(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),If=function(i){xe(t,i);function t(){var e=i.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return t.prototype.lift=function(e){var n=new ll(this,this);return n.operator=e,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new Of},t.prototype.next=function(e){var n=this;$n(function(){var r,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Bs(n.currentObservers),o=a.next();!o.done;o=a.next()){var h=o.value;h.next(e)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var n=this;$n(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=e;for(var r=n.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;$n(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var n=e.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),i.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var n=this,r=this,s=r.hasError,a=r.isStopped,o=r.observers;return s||a?el:(this.currentObservers=null,o.push(e),new qi(function(){n.currentObservers=null,Vn(o,e)}))},t.prototype._checkFinalizedStatuses=function(e){var n=this,r=n.hasError,s=n.thrownError,a=n.isStopped;r?e.error(s):a&&e.complete()},t.prototype.asObservable=function(){var e=new al;return e.source=this,e},t.create=function(e,n){return new ll(e,n)},t}(al),ll=function(i){xe(t,i);function t(e,n){var r=i.call(this)||this;return r.destination=e,r.source=n,r}return t.prototype.next=function(e){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.next)===null||r===void 0||r.call(n,e)},t.prototype.error=function(e){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.error)===null||r===void 0||r.call(n,e)},t.prototype.complete=function(){var e,n;(n=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||n===void 0||n.call(e)},t.prototype._subscribe=function(e){var n,r;return(r=(n=this.source)===null||n===void 0?void 0:n.subscribe(e))!==null&&r!==void 0?r:el},t}(If),Ff={now:function(){return Date.now()},delegate:void 0},Nf=function(i){xe(t,i);function t(e,n){return i.call(this)||this}return t.prototype.schedule=function(e,n){return this},t}(qi),Xs={setInterval:function(i,t){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];var r=Xs.delegate;return r?.setInterval?r.setInterval.apply(r,Wi([i,t],Yi(e))):setInterval.apply(void 0,Wi([i,t],Yi(e)))},clearInterval:function(i){return clearInterval(i)},delegate:void 0},Uf=function(i){xe(t,i);function t(e,n){var r=i.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return t.prototype.schedule=function(e,n){var r;if(n===void 0&&(n=0),this.closed)return this;this.state=e;var s=this.id,a=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(a,s,n)),this.pending=!0,this.delay=n,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(a,this.id,n),this},t.prototype.requestAsyncId=function(e,n,r){return r===void 0&&(r=0),Xs.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,n,r){if(r===void 0&&(r=0),r!=null&&this.delay===r&&this.pending===!1)return n;n!=null&&Xs.clearInterval(n)},t.prototype.execute=function(e,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,n);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,n){var r=!1,s;try{this.work(e)}catch(a){r=!0,s=a||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var e=this,n=e.id,r=e.scheduler,s=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Vn(s,this),n!=null&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,i.prototype.unsubscribe.call(this)}},t}(Nf),hl=function(){function i(t,e){e===void 0&&(e=i.now),this.schedulerActionCtor=t,this.now=e}return i.prototype.schedule=function(t,e,n){return e===void 0&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},i.now=Ff.now,i}(),Gf=function(i){xe(t,i);function t(e,n){n===void 0&&(n=hl.now);var r=i.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return t.prototype.flush=function(e){var n=this.actions;if(this._active){n.push(e);return}var r;this._active=!0;do if(r=e.execute(e.state,e.delay))break;while(e=n.shift());if(this._active=!1,r){for(;e=n.shift();)e.unsubscribe();throw r}},t}(hl);new Gf(Uf);function Bf(i){switch(i.responseType){case"json":{if("response"in i)return i.response;var t=i;return JSON.parse(t.responseText)}case"document":return i.responseXML;case"text":default:{if("response"in i)return i.response;var t=i;return t.responseText}}}var cl=zs(function(i){return function(t,e,n){this.message=t,this.name="AjaxError",this.xhr=e,this.request=n,this.status=e.status,this.responseType=e.responseType;var r;try{r=Bf(e)}catch{r=e.responseText}this.response=r}});(function(){function i(t,e){return cl.call(this,"ajax timeout",t,e),this.name="AjaxTimeoutError",this}return i.prototype=Object.create(cl.prototype),i})();var Ys={exports:{}},gi=typeof Reflect=="object"?Reflect:null,ul=gi&&typeof gi.apply=="function"?gi.apply:function(i,t,e){return Function.prototype.apply.call(i,t,e)},Yn;gi&&typeof gi.ownKeys=="function"?Yn=gi.ownKeys:Object.getOwnPropertySymbols?Yn=function(i){return Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i))}:Yn=function(i){return Object.getOwnPropertyNames(i)};function zf(i){console&&console.warn&&console.warn(i)}var dl=Number.isNaN||function(i){return i!==i};function nt(){nt.init.call(this)}Ys.exports=nt,Ys.exports.once=$f,nt.EventEmitter=nt,nt.prototype._events=void 0,nt.prototype._eventsCount=0,nt.prototype._maxListeners=void 0;var fl=10;function Wn(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(nt,"defaultMaxListeners",{enumerable:!0,get:function(){return fl},set:function(i){if(typeof i!="number"||i<0||dl(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");fl=i}}),nt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},nt.prototype.setMaxListeners=function(i){if(typeof i!="number"||i<0||dl(i))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+i+".");return this._maxListeners=i,this};function gl(i){return i._maxListeners===void 0?nt.defaultMaxListeners:i._maxListeners}nt.prototype.getMaxListeners=function(){return gl(this)},nt.prototype.emit=function(i){for(var t=[],e=1;e<arguments.length;e++)t.push(arguments[e]);var n=i==="error",r=this._events;if(r!==void 0)n=n&&r.error===void 0;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var o=r[i];if(o===void 0)return!1;if(typeof o=="function")ul(o,this,t);else for(var h=o.length,l=yl(o,h),e=0;e<h;++e)ul(l[e],this,t);return!0};function pl(i,t,e,n){var r,s,a;if(Wn(e),s=i._events,s===void 0?(s=i._events=Object.create(null),i._eventsCount=0):(s.newListener!==void 0&&(i.emit("newListener",t,e.listener?e.listener:e),s=i._events),a=s[t]),a===void 0)a=s[t]=e,++i._eventsCount;else if(typeof a=="function"?a=s[t]=n?[e,a]:[a,e]:n?a.unshift(e):a.push(e),r=gl(i),r>0&&a.length>r&&!a.warned){a.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=i,o.type=t,o.count=a.length,zf(o)}return i}nt.prototype.addListener=function(i,t){return pl(this,i,t,!1)},nt.prototype.on=nt.prototype.addListener,nt.prototype.prependListener=function(i,t){return pl(this,i,t,!0)};function Hf(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ml(i,t,e){var n={fired:!1,wrapFn:void 0,target:i,type:t,listener:e},r=Hf.bind(n);return r.listener=e,n.wrapFn=r,r}nt.prototype.once=function(i,t){return Wn(t),this.on(i,ml(this,i,t)),this},nt.prototype.prependOnceListener=function(i,t){return Wn(t),this.prependListener(i,ml(this,i,t)),this},nt.prototype.removeListener=function(i,t){var e,n,r,s,a;if(Wn(t),n=this._events,n===void 0)return this;if(e=n[i],e===void 0)return this;if(e===t||e.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[i],n.removeListener&&this.emit("removeListener",i,e.listener||t));else if(typeof e!="function"){for(r=-1,s=e.length-1;s>=0;s--)if(e[s]===t||e[s].listener===t){a=e[s].listener,r=s;break}if(r<0)return this;r===0?e.shift():jf(e,r),e.length===1&&(n[i]=e[0]),n.removeListener!==void 0&&this.emit("removeListener",i,a||t)}return this},nt.prototype.off=nt.prototype.removeListener,nt.prototype.removeAllListeners=function(i){var t,e,n;if(e=this._events,e===void 0)return this;if(e.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):e[i]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete e[i]),this;if(arguments.length===0){var r=Object.keys(e),s;for(n=0;n<r.length;++n)s=r[n],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=e[i],typeof t=="function")this.removeListener(i,t);else if(t!==void 0)for(n=t.length-1;n>=0;n--)this.removeListener(i,t[n]);return this};function _l(i,t,e){var n=i._events;if(n===void 0)return[];var r=n[t];return r===void 0?[]:typeof r=="function"?e?[r.listener||r]:[r]:e?Vf(r):yl(r,r.length)}nt.prototype.listeners=function(i){return _l(this,i,!0)},nt.prototype.rawListeners=function(i){return _l(this,i,!1)},nt.listenerCount=function(i,t){return typeof i.listenerCount=="function"?i.listenerCount(t):vl.call(i,t)},nt.prototype.listenerCount=vl;function vl(i){var t=this._events;if(t!==void 0){var e=t[i];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}nt.prototype.eventNames=function(){return this._eventsCount>0?Yn(this._events):[]};function yl(i,t){for(var e=new Array(t),n=0;n<t;++n)e[n]=i[n];return e}function jf(i,t){for(;t+1<i.length;t++)i[t]=i[t+1];i.pop()}function Vf(i){for(var t=new Array(i.length),e=0;e<t.length;++e)t[e]=i[e].listener||i[e];return t}function $f(i,t){return new Promise(function(e,n){function r(a){i.removeListener(t,s),n(a)}function s(){typeof i.removeListener=="function"&&i.removeListener("error",r),e([].slice.call(arguments))}bl(i,t,s,{once:!0}),t!=="error"&&Xf(i,r,{once:!0})})}function Xf(i,t,e){typeof i.on=="function"&&bl(i,"error",t,e)}function bl(i,t,e,n){if(typeof i.on=="function")n.once?i.once(t,e):i.on(t,e);else if(typeof i.addEventListener=="function")i.addEventListener(t,function r(s){n.once&&i.removeEventListener(t,r),e(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof i)}var Yf=Ys.exports;class zv extends Yf.EventEmitter{constructor(){super()}on(t,e){return super.on(t,e)}addListener(t,e){return this.on(t,e)}prependListener(t,e){return super.prependListener(t,e)}once(t,e){return super.once(t,e)}prependOnceListener(t,e){return super.prependOnceListener(t,e)}removeListener(t,e){return super.removeListener(t,e)}off(t,e){return super.off(t,e)}removeAllListeners(t){return super.removeAllListeners(t)}emit(t,...e){return super.emit(t,...e)}listeners(t){return super.listeners(t)}rawListeners(t){return super.rawListeners(t)}listenerCount(t){return super.listenerCount(t)}}class Wf{events;constructor(){this.events={}}on(t,e){this.events[t]||(this.events[t]=[]),this.events[t].push(e)}addListener(t,e){this.on(t,e)}prependListener(t,e){this.events[t]||(this.events[t]=[]),this.events[t].unshift(e)}removeListener(t,e){this.events[t]&&(this.events[t]=this.events[t].filter(n=>n!==e))}off(t,e){this.removeListener(t,e)}removeAllListeners(t){t?this.events[t]=[]:this.events={}}emit(t,...e){this.events[t]&&this.events[t].forEach(n=>{Reflect.apply(n,this,e)})}once(t,e){const n=(()=>{let r=!1;return(...s)=>{r||(r=!0,Reflect.apply(e,this,s),this.off(t,n))}})();this.on(t,n)}}const wl=(i,t="image/svg+xml",e="utf-8")=>new Blob([i],{type:`${t};charset=${e}`}),Sl=i=>new XMLSerializer().serializeToString(i),qf=(i,t="text/html")=>new DOMParser().parseFromString(i,t),Kf=(i,t="image/svg+xml",e="utf-8")=>wl(Sl(i),t,e),Zf=(i,t)=>{const e=document.createElement("a");e.style.visibility="hidden",document.body.appendChild(e),e.download=t,typeof i=="string"?e.href=i:e.href=window.URL.createObjectURL(i),e.click(),document.body.removeChild(e),window.URL.revokeObjectURL(e.href)};function Cl(i=["*"],t){if(!globalThis.document||!(globalThis.document instanceof Document))throw new Error("This is not a browser environment");const e=globalThis.document.createElement("input");return e.setAttribute("type","file"),e.setAttribute("visibility","hidden"),Array.isArray(i)&&i.length>0&&e.setAttribute("accept",i.join(",")),t&&e.setAttribute("multiple","true"),e.click(),new Promise((n,r)=>{globalThis.addEventListener("focus",()=>{setTimeout(()=>{(!e.files||e.files?.length===0)&&r(new Error("Cancel select"))},1e3)},{once:!0}),e.addEventListener("change",()=>{if(!e.files||e.files?.length===0)r(new Error("Cancel select"));else{const s=Array.from(e.files);!i.includes("*")&&s.some(a=>!i.includes(`.${Tl(a)}`))&&r(new Error(`Please select files in ${i} format`)),n(s)}})})}const Ws=(i,t="text",e)=>new Promise((n,r)=>{const s=new FileReader;switch(s.addEventListener("progress",a=>{e?.(a.loaded,a.total)}),s.addEventListener("load",a=>{n(a.target?.result)}),s.addEventListener("error",a=>{r(a)}),t){case"dataURL":s.readAsDataURL(i);break;case"binaryString":s.readAsBinaryString(i);break;case"arrayBuffer":s.readAsArrayBuffer(i);break;default:s.readAsText(i)}});function xl(i,t,e){return Ws(i.slice(t,e),"arrayBuffer")}async function Jf(i){const t=await xl(i,0,4);return So(t)}const Tl=i=>{let t;return i instanceof File?t=i.name:t=i,t.match(/\.([0-9a-z]+)(?:[\\?#]|$)/i)?.[1]??""};function Qf(i,t){i.addEventListener("change",function(){t(i.files)},!1)}function t0(i,t){i.addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},!1),i.addEventListener("drop",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer&&t(e.dataTransfer.files)},!1)}function e0(i){typeof queueMicrotask=="function"?queueMicrotask(i):Promise.resolve().then(i).catch(t=>setTimeout(()=>{throw t}))}function i0(i,t={},e=[]){return{tag:i,props:t,children:e}}function Ki(i,t){if(i.el)return;const e=i.el=document.createElement(i.tag);if(i.props)for(const n in i.props){const r=i.props[n];n.startsWith("on")?e.addEventListener(n.slice(2).toLowerCase(),r):e.setAttribute(n,r)}i.children&&(typeof i.children=="string"?e.textContent=i.children:i.children.forEach(n=>{Ki(n,e)})),t.appendChild(e)}function El(i,t){if(i.tag!==t.tag){if(!i.el)return;const e=i.el.parentElement||document.body;e.removeChild(i.el),Ki(t,e)}else{const e=t.el=i.el;if(!e)return;const n=i.props,r=t.props;for(const o in n)o in r||(o.startsWith("on")?e.removeEventListener(o.slice(2).toLowerCase(),n[o]):e.removeAttribute(o));for(const o in r){const h=n[o],l=r[o];l!=h&&(o.startsWith("on")?e.addEventListener(o.slice(2).toLowerCase(),l):e.setAttribute(o,l))}const s=i.children||[],a=t.children||[];if(typeof a=="string")e.innerHTML=a;else if(typeof s=="string")e.innerHTML="",a.forEach(o=>{Ki(o,e)});else{const o=Math.min(s.length,a.length);for(let h=0;h<o;h++)El(s[h],a[h]);a.length>s.length&&a.slice(s.length).forEach(h=>{Ki(h,e)}),a.length<s.length&&s.slice(a.length).forEach(h=>{h.el&&e.removeChild(h.el)})}}}function kl(i,t,e){if(!i){e&&t&&e.appendChild(t);return}if(!i.isEqualNode(t)){if(i.nodeName!==t.nodeName){e.replaceChild(t,i);return}if(i.nodeType===Node.TEXT_NODE){i.textContent!==t.textContent&&(i.textContent=t.textContent);return}for(let n=i.attributes.length-1;n>=0;n--){const r=i.attributes[n].name;!t.hasAttribute(r)&&r!=="open"&&i.removeAttribute(r)}for(let n=0;n<t.attributes.length;n++){const r=t.attributes[n].name,s=t.attributes[n].value;i.setAttribute(r,s)}for(let n=0;n<t.childNodes.length;n++)i.childNodes[n]?kl(i.childNodes[n],t.childNodes[n],i):i.appendChild(t.childNodes[n].cloneNode(!0));for(;i.childNodes.length>t.childNodes.length;)i.lastChild&&i.removeChild(i.lastChild)}}class Zi{constructor(t){this.waitingResponse=[],this.messageQueue=[],this.url=t,this.createSocket()}createSocket(){this.socket=new Zi(this.url),this.socket.onopen=()=>{this.messageQueue.forEach(t=>this.socket.send(t)),this.messageQueue=[]},this.socket.onclose=t=>{const{code:e,reason:n,wasClean:r}=t;console.log(`ws closed : ${e} ${n} ${r}`)},this.socket.onerror=t=>{console.log(`ws error : ${t}`)},this.socket.onmessage=t=>{this.processMessage(t)}}recreateSocket(t){console.log("Reconnection Attempted"),this.messageQueue.push(t),this.createSocket()}closeSocket(){this.socket.close(),console.log("Socket closed manually.")}openSocket(){this.createSocket(),console.log("Socket opened manually.")}async sendPayload(t){let e=+new Date;const n=this.waitingResponse[e]={sent:e},r={...n,...t};try{this.socket.readyState===Zi.OPEN?this.socket.send(JSON.stringify(r)):this.recreateSocket(JSON.stringify(r));const s=await new Promise(function(a,o){n.resolve=a,console.log(n),setTimeout(()=>{o("Timeout")},5e3)});return console.info("Time took",(+new Date-n.sent)/1e3),s}finally{console.log("Exit code ran successfully"),delete this.waitingResponse[e]}}async processMessage(t){try{let e=JSON.parse(t.data);if(Object.prototype.hasOwnProperty.call(e,"requestid")){const n=this.waitingResponse[e.requestid];n?n.resolve(e):console.warn("Got data but found no associated request, already timed out?",e)}else console.warn("Got data without request id",e)}catch{console.log(t.data)}}async sendRequest(t,e,n=r=>{console.log(r)}){this.sendPayload(t).then(function(r){e(r)},function(r){n(r)})}sendMessage(t){const e=(()=>{try{return JSON.stringify(t)}catch{return t}})();this.socket.readyState===Zi.OPEN?this.socket.send(e):this.recreateSocket(e)}}function qs(){return document.compatMode=="BackCompat"?document.body:document.documentElement}function pi(){const i=qs();return{scrollTop:i.scrollTop,scrollLeft:i.scrollLeft,scrollWidth:i.scrollWidth,scrollHeight:i.scrollHeight}}function qn(){const i=qs();return{clientTop:i.clientTop,clientLeft:i.clientLeft,clientWidth:i.clientWidth,clientHeight:i.clientHeight}}function Ji(){const{clientWidth:i,clientHeight:t}=qn();return{width:window.innerWidth||i,height:window.innerHeight||t}}function n0(){const{scrollWidth:i,scrollHeight:t}=pi(),{width:e,height:n}=Ji();return{width:Math.max(i,e),height:Math.max(t,n)}}function r0(i){const{width:t,height:e}=Ji(),{top:n,left:r,right:s,bottom:a}=i.getBoundingClientRect();return(n>=0&&n<=e||a>=0&&a<=e)&&(r>=0&&r<=t||s>=0&&s<=t)}function s0(i,t,e){const n={threshold:1},r=function(a,o){const{width:h,height:l}=Ji();a.forEach(c=>{const{top:d,left:f,right:u,bottom:g}=c.boundingClientRect;(d>=0&&d<=l||g>=0&&g<=l)&&(f>=0&&f<=h||u>=0&&u<=h)?t(c.target):e?.(c.target)})};new IntersectionObserver(r,n).observe(i)}function Al(i){const{top:t,left:e}=i.getBoundingClientRect(),n=pi();return{x:e+n.scrollLeft,y:t+n.scrollTop}}function a0(i){return{x:Pl(i),y:Ml(i)}}function Pl(i){let t=0;for(;i!==null;)t+=i.offsetLeft,i=i.offsetParent;return t}function Ml(i){let t=0;for(;i!==null;)t+=i.offsetTop,i=i.offsetParent;return t}function o0(i){const t=i.getBoundingClientRect();return{x:t.left,y:t.top}}function Rl(i){if(i.pageX&&i.pageY)return{x:i.pageX,y:i.pageY};const t=pi();return{x:i.clientX+t.scrollLeft,y:i.clientY+t.scrollTop}}function l0(i){return{x:i.clientX,y:i.clientY}}function Kn(i,t){const e=Rl(t),n=Al(i);return{x:e.x-n.x,y:e.y-n.y}}const Ve=()=>{const i=navigator.userAgent.toLowerCase();let t="Unknown";return i.includes("mac")?t="macOS":i.includes("win")?t="Windows":/android/.test(i)?t="Android":/iphone|ipad|ipod/.test(i)?t="iOS":/linux/.test(i)?t="Linux":/bsd/.test(i)&&(t="BSD"),t.toLowerCase()},h0=()=>{const i=navigator.userAgent;let t="Unknown";if(/Windows NT/.test(i)){const e=i.match(/Windows NT (\d+\.\d+)/);e&&(t=e[1])}else if(/Mac OS X/.test(i)){const e=i.match(/Mac OS X (\d+_\d+)/);e&&(t=e[1].replace("_","."))}else if(/Android/.test(i)){const e=i.match(/Android (\d+\.\d+)/);e&&(t=e[1])}else if(/iPhone|iPad|iPod/.test(i)){const e=i.match(/OS (\d+_\d+)/);e&&(t=e[1].replace("_","."))}return t.toLowerCase()},c0=()=>{const i=navigator.userAgent.toLowerCase();let t="Unknown";return/chrome/.test(i)?t="Chrome":/firefox/.test(i)?t="Firefox":/safari/.test(i)?t="Safari":/edge/.test(i)?t="Edge":/msie|trident/.test(i)?t="IE":/MicroMessenger/.test(i)&&(t="Wechat"),t.toLowerCase()},u0=()=>{const i=navigator.userAgent;let t="Unknown";if(/Chrome/.test(i)){const e=i.match(/Chrome\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Firefox/.test(i)){const e=i.match(/Firefox\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Safari/.test(i)){const e=i.match(/Version\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Edge/.test(i)){const e=i.match(/Edge\/(\d+\.\d+)/);e&&(t=e[1])}else if(/MSIE|Trident/.test(i)){const e=i.match(/(?:MSIE|rv:)(\d+\.\d+)/);e&&(t=e[1])}return t},d0=()=>"geolocation"in navigator?new Promise((i,t)=>{navigator.geolocation.getCurrentPosition(e=>{const n=e.coords.latitude,r=e.coords.longitude;i({latitude:n,longitude:r})},e=>{t(e)})}):Promise.reject("Geolocation is not available.");function f0(){return(navigator.browserLanguage||navigator.language).toLowerCase()}function g0(){return Intl.DateTimeFormat().resolvedOptions().timeZone.toLowerCase()}function Dl(){return Ve()==="ios"}function p0(){return Ve()==="ios"|Ve()==="macos"}function Ll(){return Ve()==="macos"}function Ol(){return Ve()==="android"}function m0(){return Dl()||Ol()}function _0(){return Ve()==="wechat"}function v0(){return typeof window=="object"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function Il(){const i=window.navigator.userAgent,t=i.indexOf("MSIE ");if(t>0)return parseInt(i.substring(t+5,i.indexOf(".",t)),10);if(i.indexOf("Trident/")>0){const r=i.indexOf("rv:");return parseInt(i.substring(r+3,i.indexOf(".",r)),10)}const n=i.indexOf("Edge/");return n>0?parseInt(i.substring(n+5,i.indexOf(".",n)),10):-1}const y0=Il()!==-1,b0=typeof document<"u",Fl=typeof window<"u",w0=typeof history<"u",S0=Fl&&window.File&&window.FileReader&&window.FileList&&window.Blob;function C0(i){var t=document.documentElement,e=window.devicePixelRatio;t.dataset.dpr=e;var n=100,r=function(){var s=Math.min(t.clientWidth,i);t.dataset.width=s,t.dataset.rem=n=Math.round(100*(s/i)),t.style.fontSize=n+"px"};r(),window.rem2px=function(s){return s=parseFloat(s),s*n},window.px2rem=function(s){return s=parseFloat(s),s/n},window.addEventListener&&window.addEventListener("orientationchange"in window?"orientationchange":"resize",r,!1)}function x0(i){return btoa(encodeURIComponent(i)).replaceAll("+","*").replaceAll("/","-").replaceAll("=","")}function T0(i){let t=i.replaceAll("*","+").replaceAll("-","/");const e=t.length%4;return e&&(t=t.padEnd(t.length+(4-e),"=")),decodeURIComponent(atob(t))}function Nl(i){return new URL(i)}function E0(i){const t="(?<protocol>https?:)",e="(?<host>(?<hostname>[^/#?:]+)(?::(?<port>\\d+))?)",n="(?<pathname>(?:\\/[^/#?]+)*\\/?)",r="(?<search>(?:\\?[^#]*)?)",s="(?<hash>(?:#.*)?)",o=new RegExp(`^${t}//${e}${n}${r}${s}$`).exec(i);return o&&o.groups?(o.groups.port=o.groups?.port||"",o.groups):{protocol:"",host:"",hostname:"",port:"",pathname:"",search:"",hash:""}}function k0(i){i=i.replace(/^[#?&]/,"");const t={};if(!i)return t;const e=/(?:^|&)([^&=]*)=?([^&]*?)(?=&|$)/y;let n=e.exec(i);for(;n;)t[n[1]]=n[2],n=e.exec(i);return t}function A0(i){const t=Nl(i);return t.protocol==="http:"||t.protocol==="https:"}function Ul(i){return"?"+[...i.entries()].map(t=>encodeURIComponent(t[0])+"="+encodeURIComponent(t[1]instanceof File?t[1].name:t[1])).join("&")}function Ks(i,t){return i.indexOf("?")>=0?i+t.replace(/^\?/,"&"):i.replace(/(?:\?.*)?$/,t.replace(/^[&?]/,"?"))}function P0(i){return new URLSearchParams(i).toString()}function M0(i){let t="";for(const e in i)t&&(t+="&"),t+=`${e}=${i[e]}`;return t}const R0=i=>Array.from(new URLSearchParams(i)).reduce((t,[e,n])=>Object.assign({},t,{[e]:t[e]?(Array.isArray(t[e])?t[e]:[t[e]]).concat(n):n}),{});function D0(){const i={};let t=location.search;return t&&(t=t.substring(1,t.length),t.split("&").forEach(n=>{const r=n.split("=");i[r[0]]=decodeURIComponent(r[1])})),i}function L0(i){let t="";new MutationObserver(function(n){window.location.href!==t&&(t=window.location.href,console.log(`URL data changed to ${window.location.href}`),i&&i(location.href))}).observe(document,{attributes:!0,childList:!0,subtree:!0})}function O0(i){window.addEventListener("hashchange",()=>{i(location.hash)})}function I0(i){window.addEventListener("popstate",i,!1)}const F0=new Proxy({},{get(i,t){return function(e={},...n){const r=document.createElement(t);for(const s of Object.keys(e))r.setAttribute(s,e[s]);for(const s of n)typeof s=="string"?r.appendChild(document.createTextNode(s)):r.appendChild(s);return r}}}),N0=i=>navigator.clipboard.writeText(i),U0=()=>window.getSelection()?.toString(),G0=i=>i===document.activeElement,B0=i=>Array.prototype.slice.call(i.parentNode?.children).filter(t=>t!==i),z0=()=>!document.hidden,H0=(i={x:0,y:0})=>window.scrollTo(i.x,i.y),j0=()=>history.back(),V0=()=>history.go(-1);function $0(){const i=document.getElementsByTagName("img"),t=Ji().height;let e=0;return()=>{for(let n=e;n<i.length;n++)i[n].getBoundingClientRect().top<t&&(i[n].src=i[n].getAttribute("data-src")??"",e=n+1)}}const X0=()=>new Promise(i=>{const t=Array.from(document.querySelectorAll("link[rel=stylesheet]"));let e=document.styleSheets.length??0;const n=()=>e>=t.length?(i(),!0):!1;n()||t.forEach(r=>{r.onload=()=>{e+=1,n()}})}),Y0=(i,t,e=400)=>{const n=document.createElement("span");n.style.visibility="hidden",n.style.padding="0",n.style.whiteSpace="nowrap",n.style.overflow="visible",n.style.fontSize=t>12?t+"px":"12px",n.style.fontWeight=e.toString(),n.innerText=i,document.body.appendChild(n);const r=n.offsetWidth;return document.body.removeChild(n),r},W0=(i,t,e=12,n=400,r=!0)=>{let s="",a="",o="";if(!i||t<e||typeof i!="string")return s;const h=i.split(""),l=document.createElement("span");l.style.visibility="hidden",l.style.padding="0",l.style.whiteSpace="nowrap",l.style.overflow="visible",l.style.fontSize=e>12?e+"px":"12px",l.style.fontWeight=n.toString(),document.body.appendChild(l);for(let c=0,d=h.length;c<d;c++){const f=h[c];if(a=o,o+=f,s=o,l.innerText=o,l.offsetWidth>t){r?s=a+"...":s=a;break}}return document.body.removeChild(l),s};function q0(i,t="encode"){const e={"&":"&","<":"<",">":">",""":'"',"'":"'"};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const r=new RegExp(t=="decode"?n:e[n],"g");i=i.replace(r,t=="decode"?e[n]:n)}return i}const K0=i=>i.replace(/[\u00A0-\u9999<>&](?!#)/gim,t=>"&#"+t.charCodeAt(0)+";").replace(/\u0008/gim,"");function Z0(i){return i=i.replace(/<%=(.+?)%>/g,"`); \n echo( $1 ); \n echo(`").replace(/<%([\s\S]+?)%>/g,"`); \n $1 \n echo(`"),i="echo(`"+i+"`);",`(function parse(data){
|
|
7
|
+
`):"",this.name="UnsubscriptionError",this.errors=t}});function Qs(i,t){if(i){var e=i.indexOf(t);0<=e&&i.splice(e,1)}}var dr=function(){function i(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var t,e,n,r,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=To(a),l=o.next();!l.done;l=o.next()){var h=l.value;h.remove(this)}}catch(m){t={error:m}}finally{try{l&&!l.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}else a.remove(this);var c=this.initialTeardown;if(ii(c))try{c()}catch(m){s=m instanceof Ao?m.errors:[m]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=To(d),u=f.next();!u.done;u=f.next()){var p=u.value;try{gc(p)}catch(m){s=s??[],m instanceof Ao?s=fr(fr([],ur(s)),ur(m.errors)):s.push(m)}}}catch(m){n={error:m}}finally{try{u&&!u.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}}if(s)throw new Ao(s)}},i.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)gc(t);else{if(t instanceof i){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},i.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},i.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},i.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&Qs(e,t)},i.prototype.remove=function(t){var e=this._finalizers;e&&Qs(e,t),t instanceof i&&t._removeParent(this)},i.EMPTY=function(){var t=new i;return t.closed=!0,t}(),i}(),fc=dr.EMPTY;function dc(i){return i instanceof dr||i&&"closed"in i&&ii(i.remove)&&ii(i.add)&&ii(i.unsubscribe)}function gc(i){ii(i)?i():i.unsubscribe()}var pc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},wp={setTimeout:function(i,t){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];return setTimeout.apply(void 0,fr([i,t],ur(e)))},clearTimeout:function(i){return clearTimeout(i)},delegate:void 0};function xp(i){wp.setTimeout(function(){throw i})}function mc(){}function ta(i){i()}var Po=function(i){wi(t,i);function t(e){var n=i.call(this)||this;return n.isStopped=!1,e?(n.destination=e,dc(e)&&e.add(n)):n.destination=Tp,n}return t.create=function(e,n,r){return new Ro(e,n,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,i.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(dr),Sp=Function.prototype.bind;function Mo(i,t){return Sp.call(i,t)}var Cp=function(){function i(t){this.partialObserver=t}return i.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(n){ea(n)}},i.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(n){ea(n)}else ea(t)},i.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){ea(e)}},i}(),Ro=function(i){wi(t,i);function t(e,n,r){var s=i.call(this)||this,a;if(ii(e)||!e)a={next:e??void 0,error:n??void 0,complete:r??void 0};else{var o;s&&pc.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=function(){return s.unsubscribe()},a={next:e.next&&Mo(e.next,o),error:e.error&&Mo(e.error,o),complete:e.complete&&Mo(e.complete,o)}):a=e}return s.destination=new Cp(a),s}return t}(Po);function ea(i){xp(i)}function kp(i){throw i}var Tp={closed:!0,next:mc,error:kp,complete:mc},Ep=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Ap(i){return i}function Pp(i){return i.length===0?Ap:i.length===1?i[0]:function(t){return i.reduce(function(e,n){return n(e)},t)}}var vc=function(){function i(t){t&&(this._subscribe=t)}return i.prototype.lift=function(t){var e=new i;return e.source=this,e.operator=t,e},i.prototype.subscribe=function(t,e,n){var r=this,s=Rp(t)?t:new Ro(t,e,n);return ta(function(){var a=r,o=a.operator,l=a.source;s.add(o?o.call(s,l):l?r._subscribe(s):r._trySubscribe(s))}),s},i.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},i.prototype.forEach=function(t,e){var n=this;return e=_c(e),new e(function(r,s){var a=new Ro({next:function(o){try{t(o)}catch(l){s(l),a.unsubscribe()}},error:s,complete:r});n.subscribe(a)})},i.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},i.prototype[Ep]=function(){return this},i.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Pp(t)(this)},i.prototype.toPromise=function(t){var e=this;return t=_c(t),new t(function(n,r){var s;e.subscribe(function(a){return s=a},function(a){return r(a)},function(){return n(s)})})},i.create=function(t){return new i(t)},i}();function _c(i){var t;return(t=i??pc.Promise)!==null&&t!==void 0?t:Promise}function Mp(i){return i&&ii(i.next)&&ii(i.error)&&ii(i.complete)}function Rp(i){return i&&i instanceof Po||Mp(i)&&dc(i)}(function(i){wi(t,i);function t(e,n,r,s,a,o){var l=i.call(this,e)||this;return l.onFinalize=a,l.shouldUnsubscribe=o,l._next=n?function(h){try{n(h)}catch(c){e.error(c)}}:i.prototype._next,l._error=s?function(h){try{s(h)}catch(c){e.error(c)}finally{this.unsubscribe()}}:i.prototype._error,l._complete=r?function(){try{r()}catch(h){e.error(h)}finally{this.unsubscribe()}}:i.prototype._complete,l}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;i.prototype.unsubscribe.call(this),!n&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t})(Po);var Lp=Eo(function(i){return function(){i(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Dp=function(i){wi(t,i);function t(){var e=i.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return t.prototype.lift=function(e){var n=new yc(this,this);return n.operator=e,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new Lp},t.prototype.next=function(e){var n=this;ta(function(){var r,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=To(n.currentObservers),o=a.next();!o.done;o=a.next()){var l=o.value;l.next(e)}}catch(h){r={error:h}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var n=this;ta(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=e;for(var r=n.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;ta(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var n=e.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),i.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var n=this,r=this,s=r.hasError,a=r.isStopped,o=r.observers;return s||a?fc:(this.currentObservers=null,o.push(e),new dr(function(){n.currentObservers=null,Qs(o,e)}))},t.prototype._checkFinalizedStatuses=function(e){var n=this,r=n.hasError,s=n.thrownError,a=n.isStopped;r?e.error(s):a&&e.complete()},t.prototype.asObservable=function(){var e=new vc;return e.source=this,e},t.create=function(e,n){return new yc(e,n)},t}(vc),yc=function(i){wi(t,i);function t(e,n){var r=i.call(this)||this;return r.destination=e,r.source=n,r}return t.prototype.next=function(e){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.next)===null||r===void 0||r.call(n,e)},t.prototype.error=function(e){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.error)===null||r===void 0||r.call(n,e)},t.prototype.complete=function(){var e,n;(n=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||n===void 0||n.call(e)},t.prototype._subscribe=function(e){var n,r;return(r=(n=this.source)===null||n===void 0?void 0:n.subscribe(e))!==null&&r!==void 0?r:fc},t}(Dp),Ip={now:function(){return Date.now()},delegate:void 0},Op=function(i){wi(t,i);function t(e,n){return i.call(this)||this}return t.prototype.schedule=function(e,n){return this},t}(dr),Lo={setInterval:function(i,t){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];var r=Lo.delegate;return r?.setInterval?r.setInterval.apply(r,fr([i,t],ur(e))):setInterval.apply(void 0,fr([i,t],ur(e)))},clearInterval:function(i){return clearInterval(i)},delegate:void 0},Fp=function(i){wi(t,i);function t(e,n){var r=i.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return t.prototype.schedule=function(e,n){var r;if(n===void 0&&(n=0),this.closed)return this;this.state=e;var s=this.id,a=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(a,s,n)),this.pending=!0,this.delay=n,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(a,this.id,n),this},t.prototype.requestAsyncId=function(e,n,r){return r===void 0&&(r=0),Lo.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,n,r){if(r===void 0&&(r=0),r!=null&&this.delay===r&&this.pending===!1)return n;n!=null&&Lo.clearInterval(n)},t.prototype.execute=function(e,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,n);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,n){var r=!1,s;try{this.work(e)}catch(a){r=!0,s=a||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var e=this,n=e.id,r=e.scheduler,s=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Qs(s,this),n!=null&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,i.prototype.unsubscribe.call(this)}},t}(Op),bc=function(){function i(t,e){e===void 0&&(e=i.now),this.schedulerActionCtor=t,this.now=e}return i.prototype.schedule=function(t,e,n){return e===void 0&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},i.now=Ip.now,i}(),Np=function(i){wi(t,i);function t(e,n){n===void 0&&(n=bc.now);var r=i.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return t.prototype.flush=function(e){var n=this.actions;if(this._active){n.push(e);return}var r;this._active=!0;do if(r=e.execute(e.state,e.delay))break;while(e=n.shift());if(this._active=!1,r){for(;e=n.shift();)e.unsubscribe();throw r}},t}(bc);new Np(Fp);function Up(i){switch(i.responseType){case"json":{if("response"in i)return i.response;var t=i;return JSON.parse(t.responseText)}case"document":return i.responseXML;case"text":default:{if("response"in i)return i.response;var t=i;return t.responseText}}}var wc=Eo(function(i){return function(t,e,n){this.message=t,this.name="AjaxError",this.xhr=e,this.request=n,this.status=e.status,this.responseType=e.responseType;var r;try{r=Up(e)}catch{r=e.responseText}this.response=r}});(function(){function i(t,e){return wc.call(this,"ajax timeout",t,e),this.name="AjaxTimeoutError",this}return i.prototype=Object.create(wc.prototype),i})();var Do={exports:{}},xn=typeof Reflect=="object"?Reflect:null,xc=xn&&typeof xn.apply=="function"?xn.apply:function(i,t,e){return Function.prototype.apply.call(i,t,e)},ia;xn&&typeof xn.ownKeys=="function"?ia=xn.ownKeys:Object.getOwnPropertySymbols?ia=function(i){return Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i))}:ia=function(i){return Object.getOwnPropertyNames(i)};function Bp(i){console&&console.warn&&console.warn(i)}var Sc=Number.isNaN||function(i){return i!==i};function Xt(){Xt.init.call(this)}Do.exports=Xt,Do.exports.once=Hp,Xt.EventEmitter=Xt,Xt.prototype._events=void 0,Xt.prototype._eventsCount=0,Xt.prototype._maxListeners=void 0;var Cc=10;function na(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(Xt,"defaultMaxListeners",{enumerable:!0,get:function(){return Cc},set:function(i){if(typeof i!="number"||i<0||Sc(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");Cc=i}}),Xt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Xt.prototype.setMaxListeners=function(i){if(typeof i!="number"||i<0||Sc(i))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+i+".");return this._maxListeners=i,this};function kc(i){return i._maxListeners===void 0?Xt.defaultMaxListeners:i._maxListeners}Xt.prototype.getMaxListeners=function(){return kc(this)},Xt.prototype.emit=function(i){for(var t=[],e=1;e<arguments.length;e++)t.push(arguments[e]);var n=i==="error",r=this._events;if(r!==void 0)n=n&&r.error===void 0;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var o=r[i];if(o===void 0)return!1;if(typeof o=="function")xc(o,this,t);else for(var l=o.length,h=Mc(o,l),e=0;e<l;++e)xc(h[e],this,t);return!0};function Tc(i,t,e,n){var r,s,a;if(na(e),s=i._events,s===void 0?(s=i._events=Object.create(null),i._eventsCount=0):(s.newListener!==void 0&&(i.emit("newListener",t,e.listener?e.listener:e),s=i._events),a=s[t]),a===void 0)a=s[t]=e,++i._eventsCount;else if(typeof a=="function"?a=s[t]=n?[e,a]:[a,e]:n?a.unshift(e):a.push(e),r=kc(i),r>0&&a.length>r&&!a.warned){a.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=i,o.type=t,o.count=a.length,Bp(o)}return i}Xt.prototype.addListener=function(i,t){return Tc(this,i,t,!1)},Xt.prototype.on=Xt.prototype.addListener,Xt.prototype.prependListener=function(i,t){return Tc(this,i,t,!0)};function Gp(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ec(i,t,e){var n={fired:!1,wrapFn:void 0,target:i,type:t,listener:e},r=Gp.bind(n);return r.listener=e,n.wrapFn=r,r}Xt.prototype.once=function(i,t){return na(t),this.on(i,Ec(this,i,t)),this},Xt.prototype.prependOnceListener=function(i,t){return na(t),this.prependListener(i,Ec(this,i,t)),this},Xt.prototype.removeListener=function(i,t){var e,n,r,s,a;if(na(t),n=this._events,n===void 0)return this;if(e=n[i],e===void 0)return this;if(e===t||e.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[i],n.removeListener&&this.emit("removeListener",i,e.listener||t));else if(typeof e!="function"){for(r=-1,s=e.length-1;s>=0;s--)if(e[s]===t||e[s].listener===t){a=e[s].listener,r=s;break}if(r<0)return this;r===0?e.shift():$p(e,r),e.length===1&&(n[i]=e[0]),n.removeListener!==void 0&&this.emit("removeListener",i,a||t)}return this},Xt.prototype.off=Xt.prototype.removeListener,Xt.prototype.removeAllListeners=function(i){var t,e,n;if(e=this._events,e===void 0)return this;if(e.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):e[i]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete e[i]),this;if(arguments.length===0){var r=Object.keys(e),s;for(n=0;n<r.length;++n)s=r[n],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=e[i],typeof t=="function")this.removeListener(i,t);else if(t!==void 0)for(n=t.length-1;n>=0;n--)this.removeListener(i,t[n]);return this};function Ac(i,t,e){var n=i._events;if(n===void 0)return[];var r=n[t];return r===void 0?[]:typeof r=="function"?e?[r.listener||r]:[r]:e?zp(r):Mc(r,r.length)}Xt.prototype.listeners=function(i){return Ac(this,i,!0)},Xt.prototype.rawListeners=function(i){return Ac(this,i,!1)},Xt.listenerCount=function(i,t){return typeof i.listenerCount=="function"?i.listenerCount(t):Pc.call(i,t)},Xt.prototype.listenerCount=Pc;function Pc(i){var t=this._events;if(t!==void 0){var e=t[i];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}Xt.prototype.eventNames=function(){return this._eventsCount>0?ia(this._events):[]};function Mc(i,t){for(var e=new Array(t),n=0;n<t;++n)e[n]=i[n];return e}function $p(i,t){for(;t+1<i.length;t++)i[t]=i[t+1];i.pop()}function zp(i){for(var t=new Array(i.length),e=0;e<t.length;++e)t[e]=i[e].listener||i[e];return t}function Hp(i,t){return new Promise(function(e,n){function r(a){i.removeListener(t,s),n(a)}function s(){typeof i.removeListener=="function"&&i.removeListener("error",r),e([].slice.call(arguments))}Rc(i,t,s,{once:!0}),t!=="error"&&jp(i,r,{once:!0})})}function jp(i,t,e){typeof i.on=="function"&&Rc(i,"error",t,e)}function Rc(i,t,e,n){if(typeof i.on=="function")n.once?i.once(t,e):i.on(t,e);else if(typeof i.addEventListener=="function")i.addEventListener(t,function r(s){n.once&&i.removeEventListener(t,r),e(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof i)}var Vp=Do.exports;class ww extends Vp.EventEmitter{constructor(){super()}on(t,e){return super.on(t,e)}addListener(t,e){return this.on(t,e)}prependListener(t,e){return super.prependListener(t,e)}once(t,e){return super.once(t,e)}prependOnceListener(t,e){return super.prependOnceListener(t,e)}removeListener(t,e){return super.removeListener(t,e)}off(t,e){return super.off(t,e)}removeAllListeners(t){return super.removeAllListeners(t)}emit(t,...e){return super.emit(t,...e)}listeners(t){return super.listeners(t)}rawListeners(t){return super.rawListeners(t)}listenerCount(t){return super.listenerCount(t)}}class qp{events;constructor(){this.events={}}on(t,e){this.events[t]||(this.events[t]=[]),this.events[t].push(e)}addListener(t,e){this.on(t,e)}prependListener(t,e){this.events[t]||(this.events[t]=[]),this.events[t].unshift(e)}removeListener(t,e){this.events[t]&&(this.events[t]=this.events[t].filter(n=>n!==e))}off(t,e){this.removeListener(t,e)}removeAllListeners(t){t?this.events[t]=[]:this.events={}}emit(t,...e){this.events[t]&&this.events[t].forEach(n=>{Reflect.apply(n,this,e)})}once(t,e){const n=(()=>{let r=!1;return(...s)=>{r||(r=!0,Reflect.apply(e,this,s),this.off(t,n))}})();this.on(t,n)}}const Lc=(i,t="image/svg+xml",e="utf-8")=>new Blob([i],{type:`${t};charset=${e}`}),Dc=i=>new XMLSerializer().serializeToString(i),Xp=(i,t="text/html")=>new DOMParser().parseFromString(i,t),Yp=(i,t="image/svg+xml",e="utf-8")=>Lc(Dc(i),t,e),Wp=(i,t)=>{const e=document.createElement("a");e.style.visibility="hidden",document.body.appendChild(e),e.download=t,typeof i=="string"?e.href=i:e.href=window.URL.createObjectURL(i),e.click(),document.body.removeChild(e),window.URL.revokeObjectURL(e.href)};function Ic(i=["*"],t){if(!globalThis.document||!(globalThis.document instanceof Document))throw new Error("This is not a browser environment");const e=globalThis.document.createElement("input");return e.setAttribute("type","file"),e.setAttribute("visibility","hidden"),Array.isArray(i)&&i.length>0&&e.setAttribute("accept",i.join(",")),t&&e.setAttribute("multiple","true"),e.click(),new Promise((n,r)=>{globalThis.addEventListener("focus",()=>{setTimeout(()=>{(!e.files||e.files?.length===0)&&r(new Error("Cancel select"))},1e3)},{once:!0}),e.addEventListener("change",()=>{if(!e.files||e.files?.length===0)r(new Error("Cancel select"));else{const s=Array.from(e.files);!i.includes("*")&&s.some(a=>!i.includes(`.${Fc(a)}`))&&r(new Error(`Please select files in ${i} format`)),n(s)}})})}const Io=(i,t="text",e)=>new Promise((n,r)=>{const s=new FileReader;switch(s.addEventListener("progress",a=>{e?.(a.loaded,a.total)}),s.addEventListener("load",a=>{n(a.target?.result)}),s.addEventListener("error",a=>{r(a)}),t){case"dataURL":s.readAsDataURL(i);break;case"binaryString":s.readAsBinaryString(i);break;case"arrayBuffer":s.readAsArrayBuffer(i);break;default:s.readAsText(i)}});function Oc(i,t,e){return Io(i.slice(t,e),"arrayBuffer")}async function Kp(i){const t=await Oc(i,0,4);return Dh(t)}const Fc=i=>{let t;return i instanceof File?t=i.name:t=i,t.match(/\.([0-9a-z]+)(?:[\\?#]|$)/i)?.[1]??""};function Zp(i,t){i.addEventListener("change",function(){t(i.files)},!1)}function Jp(i,t){i.addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},!1),i.addEventListener("drop",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer&&t(e.dataTransfer.files)},!1)}function Qp(i){typeof queueMicrotask=="function"?queueMicrotask(i):Promise.resolve().then(i).catch(t=>setTimeout(()=>{throw t}))}function t2(i,t={},e=[]){return{tag:i,props:t,children:e}}function gr(i,t){if(i.el)return;const e=i.el=document.createElement(i.tag);if(i.props)for(const n in i.props){const r=i.props[n];n.startsWith("on")?e.addEventListener(n.slice(2).toLowerCase(),r):e.setAttribute(n,r)}i.children&&(typeof i.children=="string"?e.textContent=i.children:i.children.forEach(n=>{gr(n,e)})),t.appendChild(e)}function Nc(i,t){if(i.tag!==t.tag){if(!i.el)return;const e=i.el.parentElement||document.body;e.removeChild(i.el),gr(t,e)}else{const e=t.el=i.el;if(!e)return;const n=i.props,r=t.props;for(const o in n)o in r||(o.startsWith("on")?e.removeEventListener(o.slice(2).toLowerCase(),n[o]):e.removeAttribute(o));for(const o in r){const l=n[o],h=r[o];h!=l&&(o.startsWith("on")?e.addEventListener(o.slice(2).toLowerCase(),h):e.setAttribute(o,h))}const s=i.children||[],a=t.children||[];if(typeof a=="string")e.innerHTML=a;else if(typeof s=="string")e.innerHTML="",a.forEach(o=>{gr(o,e)});else{const o=Math.min(s.length,a.length);for(let l=0;l<o;l++)Nc(s[l],a[l]);a.length>s.length&&a.slice(s.length).forEach(l=>{gr(l,e)}),a.length<s.length&&s.slice(a.length).forEach(l=>{l.el&&e.removeChild(l.el)})}}}function Uc(i,t,e){if(!i){e&&t&&e.appendChild(t);return}if(!i.isEqualNode(t)){if(i.nodeName!==t.nodeName){e.replaceChild(t,i);return}if(i.nodeType===Node.TEXT_NODE){i.textContent!==t.textContent&&(i.textContent=t.textContent);return}for(let n=i.attributes.length-1;n>=0;n--){const r=i.attributes[n].name;!t.hasAttribute(r)&&r!=="open"&&i.removeAttribute(r)}for(let n=0;n<t.attributes.length;n++){const r=t.attributes[n].name,s=t.attributes[n].value;i.setAttribute(r,s)}for(let n=0;n<t.childNodes.length;n++)i.childNodes[n]?Uc(i.childNodes[n],t.childNodes[n],i):i.appendChild(t.childNodes[n].cloneNode(!0));for(;i.childNodes.length>t.childNodes.length;)i.lastChild&&i.removeChild(i.lastChild)}}class e2{url;socket;waitingResponse={};sendMessageQueue=[];constructor(t){this.url=t,this.createSocket()}createSocket(){console.log("Socket Create Attempted"),this.socket=new WebSocket(this.url),this.socket.onopen=()=>{this.sendMessageQueue.forEach(t=>this.socket?.send(t)),this.sendMessageQueue=[]},this.socket.onclose=t=>{const{code:e,reason:n,wasClean:r}=t;console.log(`ws closed : ${e} ${n} ${r}`)},this.socket.onerror=t=>{console.log(`ws error : ${t.type}`)},this.socket.onmessage=t=>{this.processMessage(t)}}recreateSocket(t){console.log("Socket Recreate Attempted"),this.sendMessageQueue.push(t),this.createSocket()}closeSocket(){this.socket&&(this.socket.close(),console.log("Socket closed"))}openSocket(){this.createSocket(),console.log("Socket opened manually")}sendWithRetry(t){this.socket?.readyState===WebSocket.OPEN?this.socket.send(t):this.recreateSocket(t)}async processMessage(t){if(typeof t.data=="string")try{const e=JSON.parse(t.data);if(Object.prototype.hasOwnProperty.call(e,"requestid")){const n=this.waitingResponse[e.requestid];n?n.resolve?.(e):console.warn("Got data but found no associated request, already timed out?",e)}else console.warn("Got data without request id",e)}catch{console.log(`Received String : ${t.data}`)}else t.data instanceof ArrayBuffer?console.log(`Received ArrayBuffer : ${t.data}`):t.data instanceof Blob&&console.log(`Received Blob : ${t.data}`)}async sendPayload(t){const e=+new Date,n=this.waitingResponse[e]={requestid:e};try{let r;t instanceof Blob||t instanceof ArrayBuffer||typeof t=="string"?r=t:r=JSON.stringify({...n,...t});const s=await new Promise((a,o)=>{n.resolve=a,this.sendWithRetry(r),setTimeout(()=>{o("Timeout")},5e3)});return console.info("Time took",(+new Date-n.requestid)/1e3),s}catch(r){return Promise.reject(r)}finally{delete this.waitingResponse[e]}}async send(t,e,n=r=>{console.log(r)}){this.sendPayload(t).then(e,n)}}function Oo(){return document.compatMode=="BackCompat"?document.body:document.documentElement}function Sn(){const i=Oo();return{scrollTop:i.scrollTop,scrollLeft:i.scrollLeft,scrollWidth:i.scrollWidth,scrollHeight:i.scrollHeight}}function ra(){const i=Oo();return{clientTop:i.clientTop,clientLeft:i.clientLeft,clientWidth:i.clientWidth,clientHeight:i.clientHeight}}function sa(){const{clientWidth:i,clientHeight:t}=ra();return{width:window.innerWidth||i,height:window.innerHeight||t}}function i2(){const{scrollWidth:i,scrollHeight:t}=Sn(),{width:e,height:n}=sa();return{width:Math.max(i,e),height:Math.max(t,n)}}function n2(i){const{width:t,height:e}=sa(),{top:n,left:r,right:s,bottom:a}=i.getBoundingClientRect();return(n>=0&&n<=e||a>=0&&a<=e)&&(r>=0&&r<=t||s>=0&&s<=t)}function r2(i,t,e){const n={threshold:1};new IntersectionObserver(function(s,a){let o=s[0];if(s.length>1){const h=s.find(c=>c.isIntersecting);h&&(o=h)}o.isIntersecting&&o.intersectionRatio>=n.threshold?t(o.target):e?.(o.target)},n).observe(i)}function Bc(i){const{top:t,left:e}=i.getBoundingClientRect(),n=Sn();return{x:e+n.scrollLeft,y:t+n.scrollTop}}function s2(i){return{x:Gc(i),y:$c(i)}}function Gc(i){let t=0;for(;i!==null;)t+=i.offsetLeft,i=i.offsetParent;return t}function $c(i){let t=0;for(;i!==null;)t+=i.offsetTop,i=i.offsetParent;return t}function a2(i){const t=i.getBoundingClientRect();return{x:t.left,y:t.top}}function zc(i){if(i.pageX&&i.pageY)return{x:i.pageX,y:i.pageY};const t=Sn();return{x:i.clientX+t.scrollLeft,y:i.clientY+t.scrollTop}}function o2(i){return{x:i.clientX,y:i.clientY}}function aa(i,t){const e=zc(t),n=Bc(i);return{x:e.x-n.x,y:e.y-n.y}}const Xi=()=>{const i=navigator.userAgent.toLowerCase();let t="Unknown";return i.includes("mac")?t="macOS":i.includes("win")?t="Windows":/android/.test(i)?t="Android":/iphone|ipad|ipod/.test(i)?t="iOS":/linux/.test(i)?t="Linux":/bsd/.test(i)&&(t="BSD"),t.toLowerCase()},l2=()=>{const i=navigator.userAgent;let t="Unknown";if(/Windows NT/.test(i)){const e=i.match(/Windows NT (\d+\.\d+)/);e&&(t=e[1])}else if(/Mac OS X/.test(i)){const e=i.match(/Mac OS X (\d+_\d+)/);e&&(t=e[1].replace("_","."))}else if(/Android/.test(i)){const e=i.match(/Android (\d+\.\d+)/);e&&(t=e[1])}else if(/iPhone|iPad|iPod/.test(i)){const e=i.match(/OS (\d+_\d+)/);e&&(t=e[1].replace("_","."))}return t.toLowerCase()},h2=()=>{const i=navigator.userAgent.toLowerCase();let t="Unknown";return/chrome/.test(i)?t="Chrome":/firefox/.test(i)?t="Firefox":/safari/.test(i)?t="Safari":/edge/.test(i)?t="Edge":/msie|trident/.test(i)?t="IE":/MicroMessenger/.test(i)&&(t="Wechat"),t.toLowerCase()},c2=()=>{const i=navigator.userAgent;let t="Unknown";if(/Chrome/.test(i)){const e=i.match(/Chrome\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Firefox/.test(i)){const e=i.match(/Firefox\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Safari/.test(i)){const e=i.match(/Version\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Edge/.test(i)){const e=i.match(/Edge\/(\d+\.\d+)/);e&&(t=e[1])}else if(/MSIE|Trident/.test(i)){const e=i.match(/(?:MSIE|rv:)(\d+\.\d+)/);e&&(t=e[1])}return t},u2=()=>"geolocation"in navigator?new Promise((i,t)=>{navigator.geolocation.getCurrentPosition(e=>{const n=e.coords.latitude,r=e.coords.longitude;i({latitude:n,longitude:r})},e=>{t(e)})}):Promise.reject("Geolocation is not available.");function f2(){return(navigator.browserLanguage||navigator.language).toLowerCase()}function d2(){return Intl.DateTimeFormat().resolvedOptions().timeZone.toLowerCase()}function Hc(){return Xi()==="ios"}function g2(){return Xi()==="ios"|Xi()==="macos"}function jc(){return Xi()==="macos"}function Vc(){return Xi()==="android"}function p2(){return Hc()||Vc()}function m2(){return Xi()==="wechat"}function v2(){return typeof window=="object"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function qc(){const i=window.navigator.userAgent,t=i.indexOf("MSIE ");if(t>0)return parseInt(i.substring(t+5,i.indexOf(".",t)),10);if(i.indexOf("Trident/")>0){const r=i.indexOf("rv:");return parseInt(i.substring(r+3,i.indexOf(".",r)),10)}const n=i.indexOf("Edge/");return n>0?parseInt(i.substring(n+5,i.indexOf(".",n)),10):-1}const _2=qc()!==-1,y2=typeof document<"u",Xc=typeof window<"u",b2=typeof history<"u",w2=Xc&&window.File&&window.FileReader&&window.FileList&&window.Blob;function x2(i){var t=document.documentElement,e=window.top===window.self?window.devicePixelRatio:1;t.dataset.dpr=e;var n=100,r=function(){var s=Math.min(t.clientWidth,i);t.dataset.width=s,t.dataset.rem=n=Math.round(100*(s/i)),t.style.fontSize=n+"px"};r(),window.rem2px=function(s){return s=parseFloat(s),s*n},window.px2rem=function(s){return s=parseFloat(s),s/n},window.addEventListener&&window.addEventListener("orientationchange"in window?"orientationchange":"resize",r,!1)}function S2(i){return btoa(encodeURIComponent(i)).replaceAll("+","*").replaceAll("/","-").replaceAll("=","")}function C2(i){let t=i.replaceAll("*","+").replaceAll("-","/");const e=t.length%4;return e&&(t=t.padEnd(t.length+(4-e),"=")),decodeURIComponent(atob(t))}function Yc(i){return new URL(i)}function k2(i){const t="(?<protocol>https?:)",e="(?<host>(?<hostname>[^/#?:]+)(?::(?<port>\\d+))?)",n="(?<pathname>(?:\\/[^/#?]+)*\\/?)",r="(?<search>(?:\\?[^#]*)?)",s="(?<hash>(?:#.*)?)",o=new RegExp(`^${t}//${e}${n}${r}${s}$`).exec(i);return o&&o.groups?(o.groups.port=o.groups?.port||"",o.groups):{protocol:"",host:"",hostname:"",port:"",pathname:"",search:"",hash:""}}function T2(i){i=i.replace(/^[#?&]/,"");const t={};if(!i)return t;const e=/(?:^|&)([^&=]*)=?([^&]*?)(?=&|$)/y;let n=e.exec(i);for(;n;)t[n[1]]=n[2],n=e.exec(i);return t}function E2(i){const t=Yc(i);return t.protocol==="http:"||t.protocol==="https:"}function Wc(i){return"?"+[...i.entries()].map(t=>encodeURIComponent(t[0])+"="+encodeURIComponent(t[1]instanceof File?t[1].name:t[1])).join("&")}function Fo(i,t){return i.indexOf("?")>=0?i+t.replace(/^\?/,"&"):i.replace(/(?:\?.*)?$/,t.replace(/^[&?]/,"?"))}function A2(i){return new URLSearchParams(i).toString()}function P2(i){let t="";for(const e in i)t&&(t+="&"),t+=`${e}=${i[e]}`;return t}const M2=i=>Array.from(new URLSearchParams(i)).reduce((t,[e,n])=>Object.assign({},t,{[e]:t[e]?(Array.isArray(t[e])?t[e]:[t[e]]).concat(n):n}),{});function R2(){const i={};let t=location.search;return t&&(t=t.substring(1,t.length),t.split("&").forEach(n=>{const r=n.split("=");i[r[0]]=decodeURIComponent(r[1])})),i}function L2(i){let t="";new MutationObserver(function(n){window.location.href!==t&&(t=window.location.href,console.log(`URL data changed to ${window.location.href}`),i&&i(location.href))}).observe(document,{attributes:!0,childList:!0,subtree:!0})}function D2(i){window.addEventListener("hashchange",()=>{i(location.hash)})}function I2(i){window.addEventListener("popstate",i,!1)}class O2{static onDocumentReady(t){function e(){document.readyState!=="loading"&&(t(),document.removeEventListener("DOMContentLoaded",e))}typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}static getCSSVar(t){return getComputedStyle(document.documentElement).getPropertyValue(t)}static setCSSVar(t,e){document.documentElement.style.setProperty(t,e)}static dom=new Proxy({},{get(t,e){return function(n={},...r){const s=document.createElement(e);for(const a of Object.keys(n))s.setAttribute(a,n[a]);for(const a of r)typeof a=="string"?s.appendChild(document.createTextNode(a)):s.appendChild(a);return s}}});static compileTemplate(t){return t=t.replace(/<%=(.+?)%>/g,"`); \n echo( $1 ); \n echo(`").replace(/<%([\s\S]+?)%>/g,"`); \n $1 \n echo(`"),t="echo(`"+t+"`);",`(function parse(data){
|
|
8
8
|
let output = "";
|
|
9
9
|
function echo(html){
|
|
10
10
|
output += html;
|
|
11
11
|
}
|
|
12
|
-
${
|
|
12
|
+
${t}
|
|
13
13
|
return output;
|
|
14
|
-
})`}const J0=typeof document<"u"&&document.ontouchstart?"touchstart":"click";function Q0(i){if(document.implementation.hasFeature("MouseEvents","2.0"))return i.button;switch(i.button){case 0:case 1:case 3:case 5:case 7:return 0;case 2:case 6:return 2;case 4:return 1}}class t1{static onDocumentReady(t){function e(){document.readyState!=="loading"&&(t(),document.removeEventListener("DOMContentLoaded",e))}typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}static loadScript(t){const e=document.createElement("script");e.type="text/javascript",e.src=t,e.async=!1,document.body.appendChild(e),e.onload=()=>{},e.onerror=()=>{}}static loadStyle(t){const e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.insertBefore(e,document.head.childNodes[document.head.childNodes.length-1].nextSibling)}static iframePostMessage(t,e="http://test.com"){const n=document.createElement("iframe");n.src=`${e}/localstorage.html`,document.body.append(n),setTimeout(function(){n.contentWindow?.postMessage(t,e)},4e3),setTimeout(function(){n.remove()},6e3)}}function Gl(i,t=document){return new kt(i,t)}class kt{context;nodes;prefixs=["moz","o","ms","webkit"];constructor(t,e=document){if(this.context=e,typeof t=="string"?this.nodes=Array.from(this.context.querySelectorAll(t)):t instanceof HTMLElement?this.nodes=[t]:this.nodes=t,this.nodes.length===0)throw new Error(`can not find ${t}`)}get(t){return this.nodes[t]}concat(t){return new kt(this.nodes.concat(t.nodes),this.context)}then(t){return t(this)??this}each(t){return this.nodes.forEach((e,n)=>{t(e,n)}),this}on(t,e,n){return this.nodes.forEach(r=>{r.addEventListener(t,e,n)}),this}off(t,e,n){return this.nodes.forEach(r=>{r.removeEventListener(t,e,n)}),this}dispatchEvent(t,e){let n;const r=["click","dblclick","mousedown","mouseup","mousemove"],s=["keydown","keyup","keypress"];return typeof t=="string"?r.includes(t)?n=new MouseEvent(t,e):s.includes(t)?n=new KeyboardEvent(t,e):n=new Event(t,e):n=t,this.nodes.forEach(a=>{a.dispatchEvent(n)}),this}change(){return this.dispatchEvent("change")}click(){return this.dispatchEvent("click")}static hasEvent(t,e){return"on"+e in t}static _fragment(t){const e=document.createElement("template");return e.innerHTML=t,e.content.childNodes.forEach(n=>{const r=kt._scriptConvert(n);r!=n&&e.content.replaceChild(r,n)}),e.content}static _scriptConvert(t){const e=n=>{const s=n.ownerDocument.createElement("script");s.text=n.text;const a=n.attributes;for(let o=0;o<a.length;o++)s.setAttribute(a[o].name,a[o].value);return s};return t.tagName=="SCRIPT"&&(t=e(t)),t.querySelectorAll&&t.querySelectorAll("script").forEach(n=>{n.parentNode?.replaceChild(e(n),n)}),t}static _fixProp(t){const e={cellpadding:"cellPadding",cellspacing:"cellSpacing",class:"className",colspan:"colSpan",contenteditable:"contentEditable",for:"htmlFor",frameborder:"frameBorder",maxlength:"maxLength",readonly:"readOnly",rowspan:"rowSpan",tabindex:"tabIndex",usemap:"useMap"};return e[t]?e[t]:t}static isSVG(t){return(t||document.documentElement).nodeName.toLowerCase()==="svg"}static createElement(t){return kt.isSVG()?document.createElementNS.call(document,"http://www.w3.org/2000/svg",t):document.createElement.call(document,t)}static createTextNode(t){return document.createTextNode.call(document,t)}static createDocumentFragment(){return document.createDocumentFragment.call(document)}_insert(t,e){return this.nodes.forEach(n=>{n[t](kt._fragment(e))}),this}append(t){return this._insert("append",t)}prepend(t){return this._insert("prepend",t)}after(t){return this._insert("after",t)}before(t){return this._insert("before",t)}replace(t){return this._insert("replaceWith",t)}remove(){return this.nodes.forEach(t=>{t.remove()}),this}static removeChild(t){t.parentElement?.removeChild(t)}find(t){const e=[];return this.nodes.forEach(n=>{e.push(...Array.from(n.querySelectorAll(t)))}),new kt(e,this.context)}filter(t){const e=[];return this.nodes.forEach(n=>{n.matches&&n.matches(t)&&e.push(n)}),new kt(e,this.context)}next(){const t=[];return this.nodes.forEach(e=>{const n=e.nextElementSibling;n&&t.push(n)}),new kt(t,this.context)}prev(){const t=[];return this.nodes.forEach(e=>{const n=e.previousElementSibling;n&&t.push(n)}),new kt(t,this.context)}closest(t){const e=[];return this.nodes.forEach(n=>{const r=n.closest(t);r&&e.push(r)}),new kt(e,this.context)}shadow(t){const e=[];this.nodes.forEach(r=>{r.shadowRoot&&e.push(r.shadowRoot)});const n=new kt(e,this.context);return t!==void 0?n.find(t):n}parent(t){return this.parents(t,!0)}parents(t,e=!1){const n=[],r=a=>{if(n.indexOf(a)==-1&&n.push(a),!e&&a.parentElement)return r(a.parentElement)};this.nodes.forEach(a=>{a.parentElement&&r(a.parentElement)});const s=new kt(n,this.context);return t!==void 0?s.filter(t):s}static getComputedStyle(t,e,n){let r;const s=t.style.getPropertyPriority(e);return"getComputedStyle"in window?(r=getComputedStyle.call(window,t,n),r=r.getPropertyValue(e)):r=t.style.getPropertyValue(e),r+(s?"!"+s:"")}css(t,e){if((t===void 0||typeof t=="string")&&e===void 0){const n=this.nodes[0].style;if(typeof t=="string"){const r=n.getPropertyPriority(t);return n.getPropertyValue(t)+(r?"!"+r:"")}else return Object.fromEntries(this.nodes[0].style.cssText.split(";").filter(r=>!!r).map(r=>r.split(":").map(s=>s.trim())))}else{let n={};return typeof t=="string"&&e!==void 0?n[t]=e:typeof t=="object"&&(n=t),this.nodes.forEach(r=>{Object.keys(n).forEach(s=>{const a=String(n[s]).toLowerCase().includes("!important")?"important":"";r.style.setProperty(s,String(n[s]).replace(/!important/i,""),a)})}),this}}addClass(t){return this.toggleClass(t,!0)}removeClass(t){return this.toggleClass(t,!1)}toggleClass(t,e){const n=t.split(/[,\s]+/);return this.nodes.forEach(r=>{n.forEach(s=>{if(s.trim()!==""){let a="toggle";e!==void 0&&(a=e?"add":"remove"),r.classList[a](s.trim())}})}),this}hasClass(t){const e=t.split(/[,\s]+/);let n=!1;return this.nodes.forEach(r=>{n=n||e.every(s=>Array.from(r.classList??[]).includes(s.trim()))}),n}attr(t,e){if(e===void 0&&typeof t=="string")return this.nodes[0].getAttribute(t);let n={};return typeof t=="object"?n=t:e!==void 0&&(n[t]=e),this.nodes.forEach(r=>{Object.entries(n).forEach(([s,a])=>{r.setAttribute(s,a)})}),this}removeAttr(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(n=>{e.forEach(r=>{n.removeAttribute(r)})}),this}prop(t,e){if(e===void 0&&typeof t=="string")return this.nodes[0][t];{let n={};return typeof t=="object"?n=t:typeof t=="string"&&e!==void 0&&(n[t]=e),this.nodes.forEach(r=>{Object.entries(n).forEach(([s,a])=>{const o=kt._fixProp(s);r[o]=a,o=="innerHTML"&&kt._scriptConvert(r)})}),this}}removeProp(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(n=>{e.forEach(r=>{delete n[kt._fixProp(r)]})}),this}changeSelected(t){this.nodes.forEach(e=>{if(e instanceof HTMLSelectElement){const n=e.options;for(let r=0,s=n.length;r<s;r++)n[r].value==t?n[r].selected=!0:n[r].selected=!1}})}changeChecked(t){this.nodes.forEach(e=>{e instanceof HTMLInputElement&&(e.value==t?e.checked=!0:e.checked=!1)})}data(t,e){if(typeof t=="string"&&t.indexOf("-")!=-1)throw new Error(`Key "${t}" contains "-" (dash). Dashes are not allowed in property names. Use camelCase instead.`);if((typeof t=="string"||t===void 0)&&e===void 0){const n=Object.assign({},this.nodes[0].dataset);return Object.keys(n).forEach(r=>{if(n[r]?.startsWith("[")||n[r]?.startsWith("{"))try{n[r]=JSON.parse(n[r]??"")}catch{}}),typeof t=="string"?n[t]:n}else{let n={};return typeof t=="object"?n=t:typeof t=="string"&&(n[t]=e),this.nodes.forEach(r=>{Object.entries(n).forEach(([s,a])=>{a!=null?r.dataset[s]=a instanceof Object?JSON.stringify(a):a:delete r.dataset[s]})}),this}}removeData(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(n=>{e.forEach(r=>{delete n.dataset[r]})}),this}show(){return this.toggle(!0)}hide(){return this.toggle(!1)}toggle(t){return this.nodes.forEach(e=>{const n=e.style.display,r=getComputedStyle(e).display,s=n=="none"||r=="none";if(s&&(t===void 0||t===!0)){const a=e instanceof HTMLTableRowElement?"table-row":e instanceof HTMLTableCellElement?"table-cell":"block";e.style.display=a}!s&&(t==null||t===!1)&&e.style.setProperty("display","none")})}empty(){return this.html("")}html(t){return t instanceof HTMLElement?this.empty().append(t.innerHTML):this.prop("innerHTML",t)}text(t){return this.prop("textContent",t)}val(t){return this.prop("value",t)}}class Zn{isMacOS=Ll();constructor(){}capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}getFormatKeys(t){const e=[];return t.ctrl&&e.push(this.isMacOS?"Cmd":"Ctrl"),t.shift&&e.push(this.isMacOS?"Option":"Shift"),t.alt&&e.push("Alt"),typeof t.key=="string"?e.push(this.capitalize(t.key)):Array.isArray(t.key)&&(t.key.map(n=>this.capitalize(n)),e.push(...t.key)),e}matchKeyScheme(t,e){const n=t.ctrl??!1,r=t.shift??!1,s=t.alt??!1;if(t.exact)return(n===e.metaKey||n===e.ctrlKey)&&r===e.shiftKey&&s===e.altKey;const a=[];return n&&a.push(n===e.metaKey||n===e.ctrlKey),r&&a.push(r===e.shiftKey),s&&a.push(s===e.altKey),a.every(o=>o)}on(t,e){const n=t?.target??window;if(t?.key===void 0||t?.key===null)return e;const r=this.getFormatKeys(t);let s=!1;const a=o=>{if(o.stopPropagation(),!s&&o.key!=="Control"&&o.key!=="Shift"&&o.key!=="Alt"&&r.find(h=>h.toLowerCase()===o.key.toLowerCase())&&this.matchKeyScheme(t,o)){o.preventDefault();const h=e();if(typeof h!="function")return;const l=c=>{c.preventDefault(),h(),n.removeEventListener("keyup",l)};n.addEventListener("keyup",l)}};return n.addEventListener("keydown",a),e.keys=r,e.title=t?.title??"",e.pause=()=>s=!0,e.unpause=()=>s=!1,e.removeListener=()=>n.removeEventListener("keydown",a),e}static getKeyCode(t){const e=t.code||(t.keyCode||t.charCode).toString();return{code:e,key:t.key.toLowerCase()||Zn.codeKeys[e]}}static codeKeys={8:"backspace",9:"tab",13:"enter",15:"command",16:"shift",17:"ctrl",18:"alt",19:"pause_break",20:"caps_lock",21:"numpad",27:"escape",32:"spacebar",33:"page_up",34:"page_down",35:"end",36:"home",37:"left_arrow",38:"up_arrow",39:"right_arrow",40:"down_arrow",45:"insert",46:"delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",91:"left_window_key",92:"right_window_key",93:"select_key",96:"numpad_0",97:"numpad_1",98:"numpad_2",99:"numpad_3",100:"numpad_4",101:"numpad_5",102:"numpad_6",103:"numpad_7",104:"numpad_8",105:"numpad_9",106:"multiply",107:"add",109:"subtract",110:"decimal_point",111:"divide",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",124:"f13",125:"f14",126:"f15",144:"num_lock",145:"scroll_lock",186:"semi_colon",187:"equal_sign",188:"comma",189:"dash",190:"period",191:"forward_slash",192:"grave_accent",219:"open_bracket",220:"back_slash",221:"close_braket",222:"single_quote"}}class Zs{static captureMouse(t){const e={x:0,y:0,isMouseDown:!1},n=a=>{e.isMouseDown=!0,document.addEventListener("mouseup",r,!1),t.style.userSelect="none",t.style.webkitUserSelect=""},r=a=>{e.x=0,e.y=0,e.isMouseDown=!1,document.removeEventListener("mouseup",r,!1),t.style.userSelect="",t.style.webkitUserSelect=""},s=a=>{const o=Kn(t,a);e.x=o.x,e.y=o.y};return t.addEventListener("mousedown",n,!1),document.addEventListener("mousemove",s,!1),e}static captureTouch(t){const e={x:0,y:0,isMouseDown:!1},n=a=>{a.preventDefault(),e.isMouseDown=!0},r=a=>{e.x=0,e.y=0,e.isMouseDown=!1},s=a=>{const o=a.changedTouches[0],h=Kn(t,o);e.x=h.x,e.y=h.y};return t.addEventListener("touchstart",n,!1),t.addEventListener("touchend",r,!1),t.addEventListener("touchcancel",r,!1),t.addEventListener("touchmove",s,!1),e}static capturePointer(t){const e={x:0,y:0,isMouseDown:!1},n=a=>{e.isMouseDown=!0,t.setPointerCapture(a.pointerId),t.style.userSelect="none",t.style.webkitUserSelect=""},r=a=>{e.x=0,e.y=0,e.isMouseDown=!1,t.style.userSelect="",t.style.webkitUserSelect=""},s=a=>{const o=Kn(t,a);e.x=o.x,e.y=o.y};return t.addEventListener("pointerdown",n,!1),t.addEventListener("pointerup",r,!1),t.addEventListener("pointercancel",r,!1),t.addEventListener("pointermove",s,!1),e}}function Js(i,t){if(typeof t<"u")window.localStorage.setItem(i,t);else return window.localStorage.getItem(i)??void 0}function e1(i,t,e){const n=new Date;n.setTime(n.getTime()+e*24*60*60*1e3);const r="expires="+n.toUTCString();document.cookie=i+"="+t+"; "+r}function i1(i){const t=i+"=",e=document.cookie.split(";");for(let n=0,r=e.length;n<r;n++){const s=e[n].trim();if(s.indexOf(t)==0)return s.substring(t.length,s.length)}return""}const n1=()=>document.cookie.split(";").map(i=>i.split("=")).reduce((i,[t,e])=>(i[t.trim().replace('"',"")]=e,i),{}),r1=()=>document.cookie.split(";").forEach(i=>document.cookie=i.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`));class s1{static theme(t){return t=t||Js("theme"),typeof t>"u"&&(t=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Js("theme",t),document.documentElement.classList.toggle("dark",t==="dark"),t}static has(t){return window.matchMedia(t).matches||!1}static on(t,e){window.matchMedia(t).addEventListener("change",e)}static off(t,e){window.matchMedia(t).removeEventListener("change",e)}}class a1{static addEventListener(t,e,n){t.addEventListener(e,n,!1)}static removeEventListener(t,e,n){t.removeEventListener(e,n,!1)}static getTarget(t){return t.target||t.srcElement}}class o1{static setPageVerticalScrollPercent(t,e="width"){const n=Gl(t);n.css("transition","all linear 30ms");const{clientHeight:r}=qn(),{scrollTop:s,scrollHeight:a}=pi(),o=a-r,h=o<=0?0:s/o*100;n.css(e,h+"%")}static pullDownRefresh(t,e,n=50){let r=0,s=0;t.addEventListener("touchstart",function(a){r=a.touches[0].pageY,t.style.position="relative",t.style.transition="transform 0s"},!1),t.addEventListener("touchmove",function(a){s=a.touches[0].pageY-r,s>0&&s<n&&(t.style.transform="translateY("+s+"px)")},!1),t.addEventListener("touchend",function(a){t.style.transition="transform 0.5s ease 1s",t.style.transform="translateY(0px)",s>=n&&e()},!1)}static pullUpLoading(t,e=50){const{clientHeight:n}=qn(),{scrollTop:r,scrollHeight:s}=pi();r+n>=s-e&&t()}}class ot{static version=.8;constructor(t,e){this.context=e??document;let n=[];if(Array.isArray(t))n=t;else if(t instanceof Node||t instanceof Window)n=[t];else if(t instanceof ot)n=t.nodes;else if(typeof t=="string"){if(typeof this.context.querySelector!="function")throw new Error("Invalid context");n=Array.from(this.context.querySelectorAll(t))}else if(t==null)n=[];else{let r=Array.from(t??[]);if(typeof t=="object"&&Array.isArray(r))n=r;else throw new Error(`Invalid selector "${t}"`)}this.nodes=n,this.length=n.length,this.each((r,s)=>{this[s]=r})}static _fragment(t){let e=document.createElement("template");return e.innerHTML=t,e.content.childNodes.forEach(n=>{let r=ot._scriptConvert(n);r!=n&&e.content.replaceChild(r,n)}),e.content}static _scriptConvert(t){let e=n=>{let s=n.ownerDocument.createElement("script");s.text=n.text;let a=n.attributes;for(let o=0;o<a.length;o++)s.setAttribute(a[o].name,a[o].value);return s};return t.tagName=="SCRIPT"&&(t=e(t)),t.querySelectorAll&&t.querySelectorAll("script").forEach(n=>{n.parentNode.replaceChild(e(n),n)}),t}static _fixProp(t){let e={cellpadding:"cellPadding",cellspacing:"cellSpacing",class:"className",colspan:"colSpan",contenteditable:"contentEditable",for:"htmlFor",frameborder:"frameBorder",maxlength:"maxLength",readonly:"readOnly",rowspan:"rowSpan",tabindex:"tabIndex",usemap:"useMap"};return e[t]?e[t]:t}_insert(t,e){let n=[],r=this.length;if(r<1)return;let s=this;if(typeof e=="string")this.each(a=>{let o=ot._fragment(e);n.push(...o.childNodes),a[t](o)});else if(e instanceof ot){let a=r==1;e.each(o=>{this.each(h=>{let l=a?o:o.cloneNode(!0);n.push(l),h[t](l),ot._scriptConvert(l)})}),a||e.remove()}else if(e instanceof Node)this.each(a=>{let o=r===1?e:ot._fragment(e.outerHTML);n.push(...r===1?[e]:o.childNodes),a[t](o)}),r>1&&e.remove();else throw new Error(`Incorrect argument for "${t}(html)". It expects one string argument.`);return t=="replaceWith"&&(s=new ot(n,this.context)),s}_save(t,e,n){t._mQuery=t._mQuery??{},Array.isArray(n)?(t._mQuery[e]=t._mQuery[e]??[],t._mQuery[e].push(...n)):n!=null?t._mQuery[e]=n:delete t._mQuery[e]}get(t){t<0&&(t=this.length+t);let e=this[t];return e||(t!=null?null:this.nodes)}eq(t){t<0&&(t=this.length+t);let e=[this[t]];return e[0]==null&&(e=[]),new ot(e,this.context)}then(t){let e=t(this);return e??this}find(t){let e=[];return this.each(n=>{let r=Array.from(n.querySelectorAll(t));r.length>0&&e.push(...r)}),new ot(e,this.context)}filter(t){let e=[];return this.each(n=>{(n===t||typeof t=="string"&&n.matches&&n.matches(t)||typeof t=="function"&&t(n))&&e.push(n)}),new ot(e,this.context)}next(){let t=[];return this.each(e=>{let n=e.nextElementSibling;n&&t.push(n)}),new ot(t,this.context)}prev(){let t=[];return this.each(e=>{let n=e.previousElementSibling;n&&t.push(n)}),new ot(t,this.context)}shadow(t){let e=[];this.each(r=>{r.shadowRoot&&e.push(r.shadowRoot)});let n=new ot(e,this.context);return t?n.find(t):n}closest(t){let e=[];return this.each(n=>{let r=n.closest(t);r&&e.push(r)}),new ot(e,this.context)}host(t){let e=[],n=s=>s.parentNode?n(s.parentNode):s,r=s=>{let a=n(s);e.push(a.host?a.host:a),a.host&&t&&r(a.host)};return this.each(s=>{r(s)}),new ot(e,this.context)}parent(t){return this.parents(t,!0)}parents(t,e){let n=[],r=a=>{if(n.indexOf(a)==-1&&n.push(a),!e&&a.parentNode)return r(a.parentNode)};this.each(a=>{a.parentNode&&r(a.parentNode)});let s=new ot(n,this.context);return t?s.filter(t):s}add(t){let e=t instanceof ot?t.nodes:Array.isArray(t)?t:[t];return new ot(this.nodes.concat(e),this.context)}each(t){return this.nodes.forEach((e,n)=>{t(e,n,this)}),this}append(t){return this._insert("append",t)}prepend(t){return this._insert("prepend",t)}after(t){return this._insert("after",t)}before(t){return this._insert("before",t)}replace(t){return this._insert("replaceWith",t)}remove(){return this.each(t=>{t.remove()}),this}css(t,e){let n=t,r=arguments.length;if(r===0||r===1&&typeof t=="string")if(this[0]){let s=this[0].style;if(typeof t=="string"){let a=s.getPropertyPriority(t);return s.getPropertyValue(t)+(a?"!"+a:"")}else return Object.fromEntries(this[0].style.cssText.split(";").filter(a=>!!a).map(a=>a.split(":").map(o=>o.trim())))}else return;else return typeof t!="object"&&(n={},n[t]=e),this.each((s,a)=>{Object.keys(n).forEach(o=>{let h=String(n[o]).toLowerCase().includes("!important")?"important":"";s.style.setProperty(o,String(n[o]).replace(/!important/i,""),h)})}),this}addClass(t){return this.toggleClass(t,!0),this}removeClass(t){return this.toggleClass(t,!1),this}toggleClass(t,e){return typeof t=="string"&&(t=t.split(/[,\s]+/)),this.each(n=>{let r=t;r==null&&e===!1&&(r=Array.from(n.classList)),r.forEach(s=>{if(s!==""){let a="toggle";e!=null&&(a=e?"add":"remove"),n.classList[a](s)}})}),this}hasClass(t){if(typeof t=="string"&&(t=t.split(/[,\s]+/)),t==null&&this.length>0)return Array.from(this[0].classList);let e=!1;return this.each(n=>{e=e||t.every(r=>Array.from(n.classList??[]).includes(r))}),e}on(t,e,n){typeof e=="function"&&(n=e,e=void 0);let r;return e?.delegate&&(r=e.delegate,delete e.delegate),t=t.split(/[,\s]+/),t.forEach(s=>{let[a,o]=String(s).toLowerCase().split(".");if(r){let h=n;n=l=>{let c=vt(l.target).parents(r);c.length>0?l.delegate=c[0]:l.delegate=l.target,(l.target.matches(r)||c.length>0)&&h(l)}}this.each(h=>{this._save(h,"events",[{event:a,scope:o,callback:n,options:e}]),h.addEventListener(a,n,e)})}),this}off(t,e,n){return typeof e=="function"&&(n=e,e=void 0),t=(t??"").split(/[,\s]+/),t.forEach(r=>{let[s,a]=String(r).toLowerCase().split(".");this.each(o=>{if(Array.isArray(o._mQuery?.events))for(let h=o._mQuery.events.length-1;h>=0;h--){let l=o._mQuery.events[h];a==null||a===""?(l.event==s||s==="")&&(l.callback==n||n==null)&&(o.removeEventListener(l.event,l.callback,l.options),o._mQuery.events.splice(h,1)):(l.event==s||s==="")&&l.scope==a&&(o.removeEventListener(l.event,l.callback,l.options),o._mQuery.events.splice(h,1))}})}),this}trigger(t,e){let n,r=["click","dblclick","mousedown","mouseup","mousemove"],s=["keydown","keyup","keypress"];return t instanceof Event||t instanceof CustomEvent?n=t:r.includes(t)?n=new MouseEvent(t,e):s.includes(t)?n=new KeyboardEvent(t,e):n=new Event(t,e),this.each(a=>{a.dispatchEvent(n)}),this}attr(t,e){if(e===void 0&&typeof t=="string")return this[0]?this[0].getAttribute(t):void 0;{let n={};return typeof t=="object"?n=t:n[t]=e,this.each(r=>{Object.entries(n).forEach(([s,a])=>{r.setAttribute(s,a)})}),this}}removeAttr(){return this.each(t=>{Array.from(arguments).forEach(e=>{t.removeAttribute(e)})}),this}prop(t,e){if(e===void 0&&typeof t=="string")return this[0]?this[0][t]:void 0;{let n={};return typeof t=="object"?n=t:n[t]=e,this.each(r=>{Object.entries(n).forEach(([s,a])=>{let o=ot._fixProp(s);r[o]=a,o=="innerHTML"&&ot._scriptConvert(r)})}),this}}removeProp(){return this.each(t=>{Array.from(arguments).forEach(e=>{delete t[ot._fixProp(e)]})}),this}data(t,e){if(t instanceof Object){Object.entries(t).forEach(n=>{this.data(n[0],n[1])});return}if(t&&t.indexOf("-")!=-1&&console.error(`Key "${t}" contains "-" (dash). Dashes are not allowed in property names. Use camelCase instead.`),arguments.length<2)if(this[0]){let n=Object.assign({},this[0].dataset);return Object.keys(n).forEach(r=>{if(n[r].startsWith("[")||n[r].startsWith("{"))try{n[r]=JSON.parse(n[r])}catch{}}),t?n[t]:n}else return;else return this.each(n=>{e!=null?n.dataset[t]=e instanceof Object?JSON.stringify(e):e:delete n.dataset[t]}),this}removeData(t){return typeof t=="string"&&(t=t.split(/[,\s]+/)),this.each(e=>{t.forEach(n=>{delete e.dataset[n]})}),this}show(){return this.toggle(!0)}hide(){return this.toggle(!1)}toggle(t){return this.each(e=>{let n=e.style.display,r=getComputedStyle(e).display,s=n=="none"||r=="none";if(s&&(t==null||t===!0)){let a=e instanceof HTMLTableRowElement?"table-row":e instanceof HTMLTableCellElement?"table-cell":"block";e.style.display=e._mQuery?.prevDisplay??(n==r&&r!="none"?"":a),this._save(e,"prevDisplay",null)}!s&&(t==null||t===!1)&&(r!="none"&&this._save(e,"prevDisplay",r),e.style.setProperty("display","none"))})}empty(){return this.html("")}html(t){return t instanceof HTMLElement?this.empty().append(t):this.prop("innerHTML",t)}text(t){return this.prop("textContent",t)}val(t){return this.prop("value",t)}change(){return this.trigger("change")}click(){return this.trigger("click")}}let vt=function(i,t){return new ot(i,t)};vt.html=i=>{let t=ot._fragment(i);return vt(t.children,t)},vt.version=ot.version,function(){let i=0;window.requestAnimationFrame||(window.requestAnimationFrame=function(t){const e=new Date().getTime(),n=Math.max(0,16-(e-i)),r=window.setTimeout(function(){t(e+n)},n);return i=e+n,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}();const Bl=i=>{function t(e){const n=window.requestAnimationFrame(t);i(e,n)}window.requestAnimationFrame(t)},l1=(i,t)=>{const n=document.getElementById(i).getContext("2d");Bl((r,s)=>{t(n,r,s)})};function h1(i,t,e,n,r=.5,s="ease"){return new Promise(a=>{const o=getComputedStyle(i),h=parseInt(o.width),l=parseInt(o.height);if(!i||!t){console.log("ERROR: Cannot do transition when one of the divs is null");return}switch(i.parentElement&&(i.parentElement.style.cssText+="; perspective: 900px; overflow: hidden;"),i.style.cssText+="; position: absolute; z-index: 1019; backface-visibility: hidden",t.style.cssText+="; position: absolute; z-index: 1020; backface-visibility: hidden",e){case"slide-left":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d("+h+"px, 0, 0)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(-"+h+"px, 0, 0)"},1);break;case"slide-right":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(-"+h+"px, 0, 0)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0px, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d("+h+"px, 0, 0)"},1);break;case"slide-down":i.style.cssText+="overflow: hidden; z-index: 1; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; z-index: 0; transform: translate3d(0, 0, 0)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, "+l+"px, 0)"},1);break;case"slide-up":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(0, "+l+"px, 0)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)"},1);break;case"flip-left":i.style.cssText+="overflow: hidden; transform: rotateY(0deg)",t.style.cssText+="overflow: hidden; transform: rotateY(-180deg)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(180deg)"},1);break;case"flip-right":i.style.cssText+="overflow: hidden; transform: rotateY(0deg)",t.style.cssText+="overflow: hidden; transform: rotateY(180deg)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(-180deg)"},1);break;case"flip-down":i.style.cssText+="overflow: hidden; transform: rotateX(0deg)",t.style.cssText+="overflow: hidden; transform: rotateX(180deg)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(-180deg)"},1);break;case"flip-up":i.style.cssText+="overflow: hidden; transform: rotateX(0deg)",t.style.cssText+="overflow: hidden; transform: rotateX(-180deg)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(180deg)"},1);break;case"pop-in":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(.8); opacity: 0;",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: scale(1); opacity: 1;",i.style.cssText+="transition: "+r+"s "+s+";"},1);break;case"pop-out":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(1); opacity: 1;",t.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); opacity: 0;",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; opacity: 1;",i.style.cssText+="transition: "+r+"s "+s+"; transform: scale(1.7); opacity: 0;"},1);break;default:i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; translate3d(0, 0, 0); opacity: 0;",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; opacity: 1;",i.style.cssText+="transition: "+r+"s "+s},1);break}setTimeout(()=>{if(e==="slide-down"&&(vt(i).css("z-index","1019"),vt(t).css("z-index","1020")),t){const c=vt(t);c?.css({opacity:"1"}),c?.css({transition:"",transform:""})}if(i){const c=vt(i);c?.css({opacity:"1"}),c?.css({transition:"",transform:""})}typeof n=="function"&&n(),a()},r*1e3)})}var zl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Hl(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var jl={exports:{}};(function(i){var t={};i.exports=t,t.parse=function(e,n){for(var r=t.bin.readUshort,s=t.bin.readUint,l=0,a={},o=new Uint8Array(e),h=o.length-4;s(o,h)!=101010256;)h--;var l=h;l+=4,l+=4;var c=r(o,l);l+=2,r(o,l),l+=2;var d=s(o,l);l+=4;var f=s(o,l);l+=4,l=f;for(var u=0;u<c;u++){s(o,l),l+=4,l+=4,l+=4,l+=4,s(o,l),l+=4;var d=s(o,l);l+=4;var g=s(o,l);l+=4;var p=r(o,l),_=r(o,l+2),y=r(o,l+4);l+=6,l+=8;var b=s(o,l);l+=4,l+=p+_+y,t._readLocal(o,b,a,d,g,n)}return a},t._readLocal=function(e,n,r,s,a,o){var h=t.bin.readUshort,l=t.bin.readUint;l(e,n),n+=4,h(e,n),n+=2,h(e,n),n+=2;var c=h(e,n);n+=2,l(e,n),n+=4,l(e,n),n+=4,n+=8;var d=h(e,n);n+=2;var f=h(e,n);n+=2;var u=t.bin.readUTF8(e,n,d);if(n+=d,n+=f,o){r[u]={size:a,csize:s};return}var g=new Uint8Array(e.buffer,n);if(c==0)r[u]=new Uint8Array(g.buffer.slice(n,n+s));else if(c==8){var p=new Uint8Array(a);t.inflateRaw(g,p),r[u]=p}else throw"unknown compression method: "+c},t.inflateRaw=function(e,n){return t.F.inflate(e,n)},t.inflate=function(e,n){return e[0],e[1],t.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),n)},t.deflate=function(e,n){n==null&&(n={level:6});var r=0,s=new Uint8Array(50+Math.floor(e.length*1.1));s[r]=120,s[r+1]=156,r+=2,r=t.F.deflateRaw(e,s,r,n.level);var a=t.adler(e,0,e.length);return s[r+0]=a>>>24&255,s[r+1]=a>>>16&255,s[r+2]=a>>>8&255,s[r+3]=a>>>0&255,new Uint8Array(s.buffer,0,r+4)},t.deflateRaw=function(e,n){n==null&&(n={level:6});var r=new Uint8Array(50+Math.floor(e.length*1.1)),s=t.F.deflateRaw(e,r,s,n.level);return new Uint8Array(r.buffer,0,s)},t.encode=function(e,n){n==null&&(n=!1);var r=0,s=t.bin.writeUint,a=t.bin.writeUshort,o={};for(var h in e){var l=!t._noNeed(h)&&!n,c=e[h],d=t.crc.crc(c,0,c.length);o[h]={cpr:l,usize:c.length,crc:d,file:l?t.deflateRaw(c):c}}for(var h in o)r+=o[h].file.length+30+46+2*t.bin.sizeUTF8(h);r+=22;var f=new Uint8Array(r),u=0,g=[];for(var h in o){var p=o[h];g.push(u),u=t._writeHeader(f,u,h,p,0)}var _=0,y=u;for(var h in o){var p=o[h];g.push(u),u=t._writeHeader(f,u,h,p,1,g[_++])}var b=u-y;return s(f,u,101010256),u+=4,u+=4,a(f,u,_),u+=2,a(f,u,_),u+=2,s(f,u,b),u+=4,s(f,u,y),u+=4,u+=2,f.buffer},t._noNeed=function(e){var n=e.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(n)!=-1},t._writeHeader=function(e,n,r,s,a,o){var h=t.bin.writeUint,l=t.bin.writeUshort,c=s.file;h(e,n,a==0?67324752:33639248),n+=4,a==1&&(n+=2),l(e,n,20),n+=2,l(e,n,0),n+=2,l(e,n,s.cpr?8:0),n+=2,h(e,n,0),n+=4,h(e,n,s.crc),n+=4,h(e,n,c.length),n+=4,h(e,n,s.usize),n+=4,l(e,n,t.bin.sizeUTF8(r)),n+=2,l(e,n,0),n+=2,a==1&&(n+=2,n+=2,n+=6,h(e,n,o),n+=4);var d=t.bin.writeUTF8(e,n,r);return n+=d,a==0&&(e.set(c,n),n+=c.length),n},t.crc={table:function(){for(var e=new Uint32Array(256),n=0;n<256;n++){for(var r=n,s=0;s<8;s++)r&1?r=3988292384^r>>>1:r=r>>>1;e[n]=r}return e}(),update:function(e,n,r,s){for(var a=0;a<s;a++)e=t.crc.table[(e^n[r+a])&255]^e>>>8;return e},crc:function(e,n,r){return t.crc.update(4294967295,e,n,r)^4294967295}},t.adler=function(e,n,r){for(var s=1,a=0,o=n,h=n+r;o<h;){for(var l=Math.min(o+5552,h);o<l;)s+=e[o++],a+=s;s=s%65521,a=a%65521}return a<<16|s},t.bin={readUshort:function(e,n){return e[n]|e[n+1]<<8},writeUshort:function(e,n,r){e[n]=r&255,e[n+1]=r>>8&255},readUint:function(e,n){return e[n+3]*16777216+(e[n+2]<<16|e[n+1]<<8|e[n])},writeUint:function(e,n,r){e[n]=r&255,e[n+1]=r>>8&255,e[n+2]=r>>16&255,e[n+3]=r>>24&255},readASCII:function(e,n,r){for(var s="",a=0;a<r;a++)s+=String.fromCharCode(e[n+a]);return s},writeASCII:function(e,n,r){for(var s=0;s<r.length;s++)e[n+s]=r.charCodeAt(s)},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,n,r){for(var s="",a,o=0;o<r;o++)s+="%"+t.bin.pad(e[n+o].toString(16));try{a=decodeURIComponent(s)}catch{return t.bin.readASCII(e,n,r)}return a},writeUTF8:function(e,n,r){for(var s=r.length,a=0,o=0;o<s;o++){var h=r.charCodeAt(o);if(!(h&4294967168))e[n+a]=h,a++;else if(!(h&4294965248))e[n+a]=192|h>>6,e[n+a+1]=128|h>>0&63,a+=2;else if(!(h&4294901760))e[n+a]=224|h>>12,e[n+a+1]=128|h>>6&63,e[n+a+2]=128|h>>0&63,a+=3;else if(!(h&4292870144))e[n+a]=240|h>>18,e[n+a+1]=128|h>>12&63,e[n+a+2]=128|h>>6&63,e[n+a+3]=128|h>>0&63,a+=4;else throw"e"}return a},sizeUTF8:function(e){for(var n=e.length,r=0,s=0;s<n;s++){var a=e.charCodeAt(s);if(!(a&4294967168))r++;else if(!(a&4294965248))r+=2;else if(!(a&4294901760))r+=3;else if(!(a&4292870144))r+=4;else throw"e"}return r}},t.F={},t.F.deflateRaw=function(e,n,r,s){var a=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]],o=a[s],h=t.F.U,l=t.F._goodIndex;t.F._hash;var c=t.F._putsE,d=0,f=r<<3,u=0,g=e.length;if(s==0){for(;d<g;){var p=Math.min(65535,g-d);c(n,f,d+p==g?1:0),f=t.F._copyExact(e,d,p,n,f+8),d+=p}return f>>>3}var _=h.lits,y=h.strt,b=h.prev,m=0,v=0,w=0,S=0,k=0,C=0;for(g>2&&(C=t.F._hash(e,0),y[C]=0),d=0;d<g;d++){if(k=C,d+1<g-2){C=t.F._hash(e,d+1);var A=d+1&32767;b[A]=y[C],y[C]=A}if(u<=d){(m>14e3||v>26697)&&g-d>100&&(u<d&&(_[m]=d-u,m+=2,u=d),f=t.F._writeBlock(d==g-1||u==g?1:0,_,m,S,e,w,d-w,n,f),m=v=S=0,w=d);var x=0;d<g-2&&(x=t.F._bestMatch(e,d,b,k,Math.min(o[2],g-d),o[3]));var p=x>>>16,T=x&65535;if(x!=0){var p=x>>>16,T=x&65535,M=l(p,h.of0);h.lhst[257+M]++;var D=l(T,h.df0);h.dhst[D]++,S+=h.exb[M]+h.dxb[D],_[m]=p<<23|d-u,_[m+1]=T<<16|M<<8|D,m+=2,u=d+p}else h.lhst[e[d]]++;v++}}for((w!=d||e.length==0)&&(u<d&&(_[m]=d-u,m+=2,u=d),f=t.F._writeBlock(1,_,m,S,e,w,d-w,n,f),m=0,v=0,m=v=S=0,w=d);f&7;)f++;return f>>>3},t.F._bestMatch=function(e,n,r,s,a,o){var h=n&32767,l=r[h],c=h-l+32768&32767;if(l==h||s!=t.F._hash(e,n-c))return 0;for(var d=0,f=0,u=Math.min(32767,n);c<=u&&--o!=0&&l!=h;){if(d==0||e[n+d]==e[n+d-c]){var g=t.F._howLong(e,n,c);if(g>d){if(d=g,f=c,d>=a)break;c+2<g&&(g=c+2);for(var p=0,_=0;_<g-2;_++){var y=n-c+_+32768&32767,b=r[y],m=y-b+32768&32767;m>p&&(p=m,l=y)}}}h=l,l=r[h],c+=h-l+32768&32767}return d<<16|f},t.F._howLong=function(e,n,r){if(e[n]!=e[n-r]||e[n+1]!=e[n+1-r]||e[n+2]!=e[n+2-r])return 0;var s=n,a=Math.min(e.length,n+258);for(n+=3;n<a&&e[n]==e[n-r];)n++;return n-s},t.F._hash=function(e,n){return(e[n]<<8|e[n+1])+(e[n+2]<<4)&65535},t.saved=0,t.F._writeBlock=function(e,n,r,s,a,o,h,l,c){var d=t.F.U,f=t.F._putsF,u=t.F._putsE,g,p,_,y,b,m,v,w,S;d.lhst[256]++,g=t.F.getTrees(),p=g[0],_=g[1],y=g[2],b=g[3],m=g[4],v=g[5],w=g[6],S=g[7];var k=(c+3&7?8-(c+3&7):0)+32+(h<<3),C=s+t.F.contSize(d.fltree,d.lhst)+t.F.contSize(d.fdtree,d.dhst),A=s+t.F.contSize(d.ltree,d.lhst)+t.F.contSize(d.dtree,d.dhst);A+=14+3*v+t.F.contSize(d.itree,d.ihst)+(d.ihst[16]*2+d.ihst[17]*3+d.ihst[18]*7);for(var x=0;x<286;x++)d.lhst[x]=0;for(var x=0;x<30;x++)d.dhst[x]=0;for(var x=0;x<19;x++)d.ihst[x]=0;var T=k<C&&k<A?0:C<A?1:2;if(f(l,c,e),f(l,c+1,T),c+=3,T==0){for(;c&7;)c++;c=t.F._copyExact(a,o,h,l,c)}else{var M,D;if(T==1&&(M=d.fltree,D=d.fdtree),T==2){t.F.makeCodes(d.ltree,p),t.F.revCodes(d.ltree,p),t.F.makeCodes(d.dtree,_),t.F.revCodes(d.dtree,_),t.F.makeCodes(d.itree,y),t.F.revCodes(d.itree,y),M=d.ltree,D=d.dtree,u(l,c,b-257),c+=5,u(l,c,m-1),c+=5,u(l,c,v-4),c+=4;for(var O=0;O<v;O++)u(l,c+O*3,d.itree[(d.ordr[O]<<1)+1]);c+=3*v,c=t.F._codeTiny(w,d.itree,l,c),c=t.F._codeTiny(S,d.itree,l,c)}for(var I=o,H=0;H<r;H+=2){for(var j=n[H],$=j>>>23,et=I+(j&(1<<23)-1);I<et;)c=t.F._writeLit(a[I++],M,l,c);if($!=0){var G=n[H+1],z=G>>16,W=G>>8&255,J=G&255;c=t.F._writeLit(257+W,M,l,c),u(l,c,$-d.of0[W]),c+=d.exb[W],c=t.F._writeLit(J,D,l,c),f(l,c,z-d.df0[J]),c+=d.dxb[J],I+=$}}c=t.F._writeLit(256,M,l,c)}return c},t.F._copyExact=function(e,n,r,s,a){var o=a>>>3;return s[o]=r,s[o+1]=r>>>8,s[o+2]=255-s[o],s[o+3]=255-s[o+1],o+=4,s.set(new Uint8Array(e.buffer,n,r),o),a+(r+4<<3)},t.F.getTrees=function(){for(var e=t.F.U,n=t.F._hufTree(e.lhst,e.ltree,15),r=t.F._hufTree(e.dhst,e.dtree,15),s=[],a=t.F._lenCodes(e.ltree,s),o=[],h=t.F._lenCodes(e.dtree,o),l=0;l<s.length;l+=2)e.ihst[s[l]]++;for(var l=0;l<o.length;l+=2)e.ihst[o[l]]++;for(var c=t.F._hufTree(e.ihst,e.itree,7),d=19;d>4&&e.itree[(e.ordr[d-1]<<1)+1]==0;)d--;return[n,r,c,a,h,d,s,o]},t.F.getSecond=function(e){for(var n=[],r=0;r<e.length;r+=2)n.push(e[r+1]);return n},t.F.nonZero=function(e){for(var n="",r=0;r<e.length;r+=2)e[r+1]!=0&&(n+=(r>>1)+",");return n},t.F.contSize=function(e,n){for(var r=0,s=0;s<n.length;s++)r+=n[s]*e[(s<<1)+1];return r},t.F._codeTiny=function(e,n,r,s){for(var a=0;a<e.length;a+=2){var o=e[a],h=e[a+1];s=t.F._writeLit(o,n,r,s);var l=o==16?2:o==17?3:7;o>15&&(t.F._putsE(r,s,h,l),s+=l)}return s},t.F._lenCodes=function(e,n){for(var r=e.length;r!=2&&e[r-1]==0;)r-=2;for(var s=0;s<r;s+=2){var a=e[s+1],o=s+3<r?e[s+3]:-1,h=s+5<r?e[s+5]:-1,l=s==0?-1:e[s-1];if(a==0&&o==a&&h==a){for(var c=s+5;c+2<r&&e[c+2]==a;)c+=2;var d=Math.min(c+1-s>>>1,138);d<11?n.push(17,d-3):n.push(18,d-11),s+=d*2-2}else if(a==l&&o==a&&h==a){for(var c=s+5;c+2<r&&e[c+2]==a;)c+=2;var d=Math.min(c+1-s>>>1,6);n.push(16,d-3),s+=d*2-2}else n.push(a,0)}return r>>>1},t.F._hufTree=function(e,n,r){var s=[],a=e.length,o=n.length,h=0;for(h=0;h<o;h+=2)n[h]=0,n[h+1]=0;for(h=0;h<a;h++)e[h]!=0&&s.push({lit:h,f:e[h]});var l=s.length,c=s.slice(0);if(l==0)return 0;if(l==1){var d=s[0].lit,c=d==0?1:0;return n[(d<<1)+1]=1,n[(c<<1)+1]=1,1}s.sort(function(b,m){return b.f-m.f});var f=s[0],u=s[1],g=0,p=1,_=2;for(s[0]={lit:-1,f:f.f+u.f,l:f,r:u,d:0};p!=l-1;)g!=p&&(_==l||s[g].f<s[_].f)?f=s[g++]:f=s[_++],g!=p&&(_==l||s[g].f<s[_].f)?u=s[g++]:u=s[_++],s[p++]={lit:-1,f:f.f+u.f,l:f,r:u};var y=t.F.setDepth(s[p-1],0);for(y>r&&(t.F.restrictDepth(c,r,y),y=r),h=0;h<l;h++)n[(c[h].lit<<1)+1]=c[h].d;return y},t.F.setDepth=function(e,n){return e.lit!=-1?(e.d=n,n):Math.max(t.F.setDepth(e.l,n+1),t.F.setDepth(e.r,n+1))},t.F.restrictDepth=function(e,n,r){var s=0,a=1<<r-n,o=0;for(e.sort(function(l,c){return c.d==l.d?l.f-c.f:c.d-l.d}),s=0;s<e.length&&e[s].d>n;s++){var h=e[s].d;e[s].d=n,o+=a-(1<<r-h)}for(o=o>>>r-n;o>0;){var h=e[s].d;h<n?(e[s].d++,o-=1<<n-h-1):s++}for(;s>=0;s--)e[s].d==n&&o<0&&(e[s].d--,o++);o!=0&&console.log("debt left")},t.F._goodIndex=function(e,n){var r=0;return n[r|16]<=e&&(r|=16),n[r|8]<=e&&(r|=8),n[r|4]<=e&&(r|=4),n[r|2]<=e&&(r|=2),n[r|1]<=e&&(r|=1),r},t.F._writeLit=function(e,n,r,s){return t.F._putsF(r,s,n[e<<1]),s+n[(e<<1)+1]},t.F.inflate=function(e,n){var r=Uint8Array;if(e[0]==3&&e[1]==0)return n||new r(0);var s=t.F,a=s._bitsF,o=s._bitsE,h=s._decodeTiny,l=s.makeCodes,c=s.codes2map,d=s._get17,f=s.U,u=n==null;u&&(n=new r(e.length>>>2<<3));for(var g=0,p=0,_=0,y=0,b=0,m=0,v=0,w=0,S=0,k,C;g==0;){if(g=a(e,S,1),p=a(e,S+1,2),S+=3,p==0){S&7&&(S+=8-(S&7));var A=(S>>>3)+4,x=e[A-4]|e[A-3]<<8;u&&(n=t.F._check(n,w+x)),n.set(new r(e.buffer,e.byteOffset+A,x),w),S=A+x<<3,w+=x;continue}if(u&&(n=t.F._check(n,w+131072)),p==1&&(k=f.flmap,C=f.fdmap,m=511,v=31),p==2){_=o(e,S,5)+257,y=o(e,S+5,5)+1,b=o(e,S+10,4)+4,S+=14;for(var T=0;T<38;T+=2)f.itree[T]=0,f.itree[T+1]=0;for(var M=1,T=0;T<b;T++){var D=o(e,S+T*3,3);f.itree[(f.ordr[T]<<1)+1]=D,D>M&&(M=D)}S+=3*b,l(f.itree,M),c(f.itree,M,f.imap),k=f.lmap,C=f.dmap,S=h(f.imap,(1<<M)-1,_+y,e,S,f.ttree);var O=s._copyOut(f.ttree,0,_,f.ltree);m=(1<<O)-1;var I=s._copyOut(f.ttree,_,y,f.dtree);v=(1<<I)-1,l(f.ltree,O),c(f.ltree,O,k),l(f.dtree,I),c(f.dtree,I,C)}for(;;){var H=k[d(e,S)&m];S+=H&15;var j=H>>>4;if(!(j>>>8))n[w++]=j;else{if(j==256)break;var $=w+j-254;if(j>264){var et=f.ldef[j-257];$=w+(et>>>3)+o(e,S,et&7),S+=et&7}var G=C[d(e,S)&v];S+=G&15;var z=G>>>4,W=f.ddef[z],J=(W>>>4)+a(e,S,W&15);for(S+=W&15,u&&(n=t.F._check(n,w+131072));w<$;)n[w]=n[w++-J],n[w]=n[w++-J],n[w]=n[w++-J],n[w]=n[w++-J];w=$}}}return n.length==w?n:n.slice(0,w)},t.F._check=function(e,n){var r=e.length;if(n<=r)return e;var s=new Uint8Array(Math.max(r<<1,n));return s.set(e,0),s},t.F._decodeTiny=function(e,n,r,s,a,o){for(var h=t.F._bitsE,l=t.F._get17,c=0;c<r;){var d=e[l(s,a)&n];a+=d&15;var f=d>>>4;if(f<=15)o[c]=f,c++;else{var u=0,g=0;f==16?(g=3+h(s,a,2),a+=2,u=o[c-1]):f==17?(g=3+h(s,a,3),a+=3):f==18&&(g=11+h(s,a,7),a+=7);for(var p=c+g;c<p;)o[c]=u,c++}}return a},t.F._copyOut=function(e,n,r,s){for(var a=0,o=0,h=s.length>>>1;o<r;){var l=e[o+n];s[o<<1]=0,s[(o<<1)+1]=l,l>a&&(a=l),o++}for(;o<h;)s[o<<1]=0,s[(o<<1)+1]=0,o++;return a},t.F.makeCodes=function(e,n){for(var r=t.F.U,s=e.length,a,o,h,l,c,d=r.bl_count,l=0;l<=n;l++)d[l]=0;for(l=1;l<s;l+=2)d[e[l]]++;var f=r.next_code;for(a=0,d[0]=0,o=1;o<=n;o++)a=a+d[o-1]<<1,f[o]=a;for(h=0;h<s;h+=2)c=e[h+1],c!=0&&(e[h]=f[c],f[c]++)},t.F.codes2map=function(e,n,r){for(var s=e.length,a=t.F.U,o=a.rev15,h=0;h<s;h+=2)if(e[h+1]!=0)for(var l=h>>1,c=e[h+1],d=l<<4|c,f=n-c,u=e[h]<<f,g=u+(1<<f);u!=g;){var p=o[u]>>>15-n;r[p]=d,u++}},t.F.revCodes=function(e,n){for(var r=t.F.U.rev15,s=15-n,a=0;a<e.length;a+=2){var o=e[a]<<n-e[a+1];e[a]=r[o]>>>s}},t.F._putsE=function(e,n,r){r=r<<(n&7);var s=n>>>3;e[s]|=r,e[s+1]|=r>>>8},t.F._putsF=function(e,n,r){r=r<<(n&7);var s=n>>>3;e[s]|=r,e[s+1]|=r>>>8,e[s+2]|=r>>>16},t.F._bitsE=function(e,n,r){return(e[n>>>3]|e[(n>>>3)+1]<<8)>>>(n&7)&(1<<r)-1},t.F._bitsF=function(e,n,r){return(e[n>>>3]|e[(n>>>3)+1]<<8|e[(n>>>3)+2]<<16)>>>(n&7)&(1<<r)-1},t.F._get17=function(e,n){return(e[n>>>3]|e[(n>>>3)+1]<<8|e[(n>>>3)+2]<<16)>>>(n&7)},t.F._get25=function(e,n){return(e[n>>>3]|e[(n>>>3)+1]<<8|e[(n>>>3)+2]<<16|e[(n>>>3)+3]<<24)>>>(n&7)},t.F.U=function(){var e=Uint16Array,n=Uint32Array;return{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new e(65536),prev:new e(32768)}}(),function(){for(var e=t.F.U,n=32768,r=0;r<n;r++){var s=r;s=(s&2863311530)>>>1|(s&1431655765)<<1,s=(s&3435973836)>>>2|(s&858993459)<<2,s=(s&4042322160)>>>4|(s&252645135)<<4,s=(s&4278255360)>>>8|(s&16711935)<<8,e.rev15[r]=(s>>>16|s<<16)>>>17}function a(o,h,l){for(;h--!=0;)o.push(0,l)}for(var r=0;r<32;r++)e.ldef[r]=e.of0[r]<<3|e.exb[r],e.ddef[r]=e.df0[r]<<4|e.dxb[r];a(e.fltree,144,8),a(e.fltree,112,9),a(e.fltree,24,7),a(e.fltree,8,8),t.F.makeCodes(e.fltree,9),t.F.codes2map(e.fltree,9,e.flmap),t.F.revCodes(e.fltree,9),a(e.fdtree,32,5),t.F.makeCodes(e.fdtree,5),t.F.codes2map(e.fdtree,5,e.fdmap),t.F.revCodes(e.fdtree,5),a(e.itree,19,0),a(e.ltree,286,0),a(e.dtree,30,0),a(e.ttree,320,0)}()})(jl);var c1=jl.exports;const Vl=Hl(c1);/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const u1=4,$l=0,Xl=1,d1=2;function mi(i){let t=i.length;for(;--t>=0;)i[t]=0}const f1=0,Yl=1,g1=2,p1=3,m1=258,Qs=29,Qi=256,tn=Qi+1+Qs,_i=30,ta=19,Wl=2*tn+1,$e=15,ea=16,_1=7,ia=256,ql=16,Kl=17,Zl=18,na=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Jn=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),v1=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Jl=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),y1=512,ae=new Array((tn+2)*2);mi(ae);const en=new Array(_i*2);mi(en);const nn=new Array(y1);mi(nn);const rn=new Array(m1-p1+1);mi(rn);const ra=new Array(Qs);mi(ra);const Qn=new Array(_i);mi(Qn);function sa(i,t,e,n,r){this.static_tree=i,this.extra_bits=t,this.extra_base=e,this.elems=n,this.max_length=r,this.has_stree=i&&i.length}let Ql,th,eh;function aa(i,t){this.dyn_tree=i,this.max_code=0,this.stat_desc=t}const ih=i=>i<256?nn[i]:nn[256+(i>>>7)],sn=(i,t)=>{i.pending_buf[i.pending++]=t&255,i.pending_buf[i.pending++]=t>>>8&255},Dt=(i,t,e)=>{i.bi_valid>ea-e?(i.bi_buf|=t<<i.bi_valid&65535,sn(i,i.bi_buf),i.bi_buf=t>>ea-i.bi_valid,i.bi_valid+=e-ea):(i.bi_buf|=t<<i.bi_valid&65535,i.bi_valid+=e)},Kt=(i,t,e)=>{Dt(i,e[t*2],e[t*2+1])},nh=(i,t)=>{let e=0;do e|=i&1,i>>>=1,e<<=1;while(--t>0);return e>>>1},b1=i=>{i.bi_valid===16?(sn(i,i.bi_buf),i.bi_buf=0,i.bi_valid=0):i.bi_valid>=8&&(i.pending_buf[i.pending++]=i.bi_buf&255,i.bi_buf>>=8,i.bi_valid-=8)},w1=(i,t)=>{const e=t.dyn_tree,n=t.max_code,r=t.stat_desc.static_tree,s=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,h=t.stat_desc.max_length;let l,c,d,f,u,g,p=0;for(f=0;f<=$e;f++)i.bl_count[f]=0;for(e[i.heap[i.heap_max]*2+1]=0,l=i.heap_max+1;l<Wl;l++)c=i.heap[l],f=e[e[c*2+1]*2+1]+1,f>h&&(f=h,p++),e[c*2+1]=f,!(c>n)&&(i.bl_count[f]++,u=0,c>=o&&(u=a[c-o]),g=e[c*2],i.opt_len+=g*(f+u),s&&(i.static_len+=g*(r[c*2+1]+u)));if(p!==0){do{for(f=h-1;i.bl_count[f]===0;)f--;i.bl_count[f]--,i.bl_count[f+1]+=2,i.bl_count[h]--,p-=2}while(p>0);for(f=h;f!==0;f--)for(c=i.bl_count[f];c!==0;)d=i.heap[--l],!(d>n)&&(e[d*2+1]!==f&&(i.opt_len+=(f-e[d*2+1])*e[d*2],e[d*2+1]=f),c--)}},rh=(i,t,e)=>{const n=new Array($e+1);let r=0,s,a;for(s=1;s<=$e;s++)r=r+e[s-1]<<1,n[s]=r;for(a=0;a<=t;a++){let o=i[a*2+1];o!==0&&(i[a*2]=nh(n[o]++,o))}},S1=()=>{let i,t,e,n,r;const s=new Array($e+1);for(e=0,n=0;n<Qs-1;n++)for(ra[n]=e,i=0;i<1<<na[n];i++)rn[e++]=n;for(rn[e-1]=n,r=0,n=0;n<16;n++)for(Qn[n]=r,i=0;i<1<<Jn[n];i++)nn[r++]=n;for(r>>=7;n<_i;n++)for(Qn[n]=r<<7,i=0;i<1<<Jn[n]-7;i++)nn[256+r++]=n;for(t=0;t<=$e;t++)s[t]=0;for(i=0;i<=143;)ae[i*2+1]=8,i++,s[8]++;for(;i<=255;)ae[i*2+1]=9,i++,s[9]++;for(;i<=279;)ae[i*2+1]=7,i++,s[7]++;for(;i<=287;)ae[i*2+1]=8,i++,s[8]++;for(rh(ae,tn+1,s),i=0;i<_i;i++)en[i*2+1]=5,en[i*2]=nh(i,5);Ql=new sa(ae,na,Qi+1,tn,$e),th=new sa(en,Jn,0,_i,$e),eh=new sa(new Array(0),v1,0,ta,_1)},sh=i=>{let t;for(t=0;t<tn;t++)i.dyn_ltree[t*2]=0;for(t=0;t<_i;t++)i.dyn_dtree[t*2]=0;for(t=0;t<ta;t++)i.bl_tree[t*2]=0;i.dyn_ltree[ia*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},ah=i=>{i.bi_valid>8?sn(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},oh=(i,t,e,n)=>{const r=t*2,s=e*2;return i[r]<i[s]||i[r]===i[s]&&n[t]<=n[e]},oa=(i,t,e)=>{const n=i.heap[e];let r=e<<1;for(;r<=i.heap_len&&(r<i.heap_len&&oh(t,i.heap[r+1],i.heap[r],i.depth)&&r++,!oh(t,n,i.heap[r],i.depth));)i.heap[e]=i.heap[r],e=r,r<<=1;i.heap[e]=n},lh=(i,t,e)=>{let n,r,s=0,a,o;if(i.sym_next!==0)do n=i.pending_buf[i.sym_buf+s++]&255,n+=(i.pending_buf[i.sym_buf+s++]&255)<<8,r=i.pending_buf[i.sym_buf+s++],n===0?Kt(i,r,t):(a=rn[r],Kt(i,a+Qi+1,t),o=na[a],o!==0&&(r-=ra[a],Dt(i,r,o)),n--,a=ih(n),Kt(i,a,e),o=Jn[a],o!==0&&(n-=Qn[a],Dt(i,n,o)));while(s<i.sym_next);Kt(i,ia,t)},la=(i,t)=>{const e=t.dyn_tree,n=t.stat_desc.static_tree,r=t.stat_desc.has_stree,s=t.stat_desc.elems;let a,o,h=-1,l;for(i.heap_len=0,i.heap_max=Wl,a=0;a<s;a++)e[a*2]!==0?(i.heap[++i.heap_len]=h=a,i.depth[a]=0):e[a*2+1]=0;for(;i.heap_len<2;)l=i.heap[++i.heap_len]=h<2?++h:0,e[l*2]=1,i.depth[l]=0,i.opt_len--,r&&(i.static_len-=n[l*2+1]);for(t.max_code=h,a=i.heap_len>>1;a>=1;a--)oa(i,e,a);l=s;do a=i.heap[1],i.heap[1]=i.heap[i.heap_len--],oa(i,e,1),o=i.heap[1],i.heap[--i.heap_max]=a,i.heap[--i.heap_max]=o,e[l*2]=e[a*2]+e[o*2],i.depth[l]=(i.depth[a]>=i.depth[o]?i.depth[a]:i.depth[o])+1,e[a*2+1]=e[o*2+1]=l,i.heap[1]=l++,oa(i,e,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],w1(i,t),rh(e,h,i.bl_count)},hh=(i,t,e)=>{let n,r=-1,s,a=t[0*2+1],o=0,h=7,l=4;for(a===0&&(h=138,l=3),t[(e+1)*2+1]=65535,n=0;n<=e;n++)s=a,a=t[(n+1)*2+1],!(++o<h&&s===a)&&(o<l?i.bl_tree[s*2]+=o:s!==0?(s!==r&&i.bl_tree[s*2]++,i.bl_tree[ql*2]++):o<=10?i.bl_tree[Kl*2]++:i.bl_tree[Zl*2]++,o=0,r=s,a===0?(h=138,l=3):s===a?(h=6,l=3):(h=7,l=4))},ch=(i,t,e)=>{let n,r=-1,s,a=t[0*2+1],o=0,h=7,l=4;for(a===0&&(h=138,l=3),n=0;n<=e;n++)if(s=a,a=t[(n+1)*2+1],!(++o<h&&s===a)){if(o<l)do Kt(i,s,i.bl_tree);while(--o!==0);else s!==0?(s!==r&&(Kt(i,s,i.bl_tree),o--),Kt(i,ql,i.bl_tree),Dt(i,o-3,2)):o<=10?(Kt(i,Kl,i.bl_tree),Dt(i,o-3,3)):(Kt(i,Zl,i.bl_tree),Dt(i,o-11,7));o=0,r=s,a===0?(h=138,l=3):s===a?(h=6,l=3):(h=7,l=4)}},C1=i=>{let t;for(hh(i,i.dyn_ltree,i.l_desc.max_code),hh(i,i.dyn_dtree,i.d_desc.max_code),la(i,i.bl_desc),t=ta-1;t>=3&&i.bl_tree[Jl[t]*2+1]===0;t--);return i.opt_len+=3*(t+1)+5+5+4,t},x1=(i,t,e,n)=>{let r;for(Dt(i,t-257,5),Dt(i,e-1,5),Dt(i,n-4,4),r=0;r<n;r++)Dt(i,i.bl_tree[Jl[r]*2+1],3);ch(i,i.dyn_ltree,t-1),ch(i,i.dyn_dtree,e-1)},T1=i=>{let t=4093624447,e;for(e=0;e<=31;e++,t>>>=1)if(t&1&&i.dyn_ltree[e*2]!==0)return $l;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return Xl;for(e=32;e<Qi;e++)if(i.dyn_ltree[e*2]!==0)return Xl;return $l};let uh=!1;const E1=i=>{uh||(S1(),uh=!0),i.l_desc=new aa(i.dyn_ltree,Ql),i.d_desc=new aa(i.dyn_dtree,th),i.bl_desc=new aa(i.bl_tree,eh),i.bi_buf=0,i.bi_valid=0,sh(i)},dh=(i,t,e,n)=>{Dt(i,(f1<<1)+(n?1:0),3),ah(i),sn(i,e),sn(i,~e),e&&i.pending_buf.set(i.window.subarray(t,t+e),i.pending),i.pending+=e},k1=i=>{Dt(i,Yl<<1,3),Kt(i,ia,ae),b1(i)},A1=(i,t,e,n)=>{let r,s,a=0;i.level>0?(i.strm.data_type===d1&&(i.strm.data_type=T1(i)),la(i,i.l_desc),la(i,i.d_desc),a=C1(i),r=i.opt_len+3+7>>>3,s=i.static_len+3+7>>>3,s<=r&&(r=s)):r=s=e+5,e+4<=r&&t!==-1?dh(i,t,e,n):i.strategy===u1||s===r?(Dt(i,(Yl<<1)+(n?1:0),3),lh(i,ae,en)):(Dt(i,(g1<<1)+(n?1:0),3),x1(i,i.l_desc.max_code+1,i.d_desc.max_code+1,a+1),lh(i,i.dyn_ltree,i.dyn_dtree)),sh(i),n&&ah(i)},P1=(i,t,e)=>(i.pending_buf[i.sym_buf+i.sym_next++]=t,i.pending_buf[i.sym_buf+i.sym_next++]=t>>8,i.pending_buf[i.sym_buf+i.sym_next++]=e,t===0?i.dyn_ltree[e*2]++:(i.matches++,t--,i.dyn_ltree[(rn[e]+Qi+1)*2]++,i.dyn_dtree[ih(t)*2]++),i.sym_next===i.sym_end);var M1=E1,R1=dh,D1=A1,L1=P1,O1=k1,I1={_tr_init:M1,_tr_stored_block:R1,_tr_flush_block:D1,_tr_tally:L1,_tr_align:O1},an=(i,t,e,n)=>{let r=i&65535|0,s=i>>>16&65535|0,a=0;for(;e!==0;){a=e>2e3?2e3:e,e-=a;do r=r+t[n++]|0,s=s+r|0;while(--a);r%=65521,s%=65521}return r|s<<16|0};const F1=()=>{let i,t=[];for(var e=0;e<256;e++){i=e;for(var n=0;n<8;n++)i=i&1?3988292384^i>>>1:i>>>1;t[e]=i}return t},N1=new Uint32Array(F1());var Tt=(i,t,e,n)=>{const r=N1,s=n+e;i^=-1;for(let a=n;a<s;a++)i=i>>>8^r[(i^t[a])&255];return i^-1},Xe={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ye={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:U1,_tr_stored_block:ha,_tr_flush_block:G1,_tr_tally:Te,_tr_align:B1}=I1,{Z_NO_FLUSH:Ee,Z_PARTIAL_FLUSH:z1,Z_FULL_FLUSH:H1,Z_FINISH:Gt,Z_BLOCK:fh,Z_OK:At,Z_STREAM_END:gh,Z_STREAM_ERROR:Zt,Z_DATA_ERROR:j1,Z_BUF_ERROR:ca,Z_DEFAULT_COMPRESSION:V1,Z_FILTERED:$1,Z_HUFFMAN_ONLY:tr,Z_RLE:X1,Z_FIXED:Y1,Z_DEFAULT_STRATEGY:W1,Z_UNKNOWN:q1,Z_DEFLATED:er}=Ye,K1=9,Z1=15,J1=8,Q1=29,ua=256+1+Q1,tg=30,eg=19,ig=2*ua+1,ng=15,K=3,ke=258,Jt=ke+K+1,rg=32,vi=42,da=57,fa=69,ga=73,pa=91,ma=103,We=113,on=666,Mt=1,yi=2,qe=3,bi=4,sg=3,Ke=(i,t)=>(i.msg=Xe[t],t),ph=i=>i*2-(i>4?9:0),Ae=i=>{let t=i.length;for(;--t>=0;)i[t]=0},ag=i=>{let t,e,n,r=i.w_size;t=i.hash_size,n=t;do e=i.head[--n],i.head[n]=e>=r?e-r:0;while(--t);t=r,n=t;do e=i.prev[--n],i.prev[n]=e>=r?e-r:0;while(--t)};let Pe=(i,t,e)=>(t<<i.hash_shift^e)&i.hash_mask;const Lt=i=>{const t=i.state;let e=t.pending;e>i.avail_out&&(e=i.avail_out),e!==0&&(i.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+e),i.next_out),i.next_out+=e,t.pending_out+=e,i.total_out+=e,i.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))},Ot=(i,t)=>{G1(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,t),i.block_start=i.strstart,Lt(i.strm)},tt=(i,t)=>{i.pending_buf[i.pending++]=t},ln=(i,t)=>{i.pending_buf[i.pending++]=t>>>8&255,i.pending_buf[i.pending++]=t&255},_a=(i,t,e,n)=>{let r=i.avail_in;return r>n&&(r=n),r===0?0:(i.avail_in-=r,t.set(i.input.subarray(i.next_in,i.next_in+r),e),i.state.wrap===1?i.adler=an(i.adler,t,r,e):i.state.wrap===2&&(i.adler=Tt(i.adler,t,r,e)),i.next_in+=r,i.total_in+=r,r)},mh=(i,t)=>{let e=i.max_chain_length,n=i.strstart,r,s,a=i.prev_length,o=i.nice_match;const h=i.strstart>i.w_size-Jt?i.strstart-(i.w_size-Jt):0,l=i.window,c=i.w_mask,d=i.prev,f=i.strstart+ke;let u=l[n+a-1],g=l[n+a];i.prev_length>=i.good_match&&(e>>=2),o>i.lookahead&&(o=i.lookahead);do if(r=t,!(l[r+a]!==g||l[r+a-1]!==u||l[r]!==l[n]||l[++r]!==l[n+1])){n+=2,r++;do;while(l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&n<f);if(s=ke-(f-n),n=f-ke,s>a){if(i.match_start=t,a=s,s>=o)break;u=l[n+a-1],g=l[n+a]}}while((t=d[t&c])>h&&--e!==0);return a<=i.lookahead?a:i.lookahead},wi=i=>{const t=i.w_size;let e,n,r;do{if(n=i.window_size-i.lookahead-i.strstart,i.strstart>=t+(t-Jt)&&(i.window.set(i.window.subarray(t,t+t-n),0),i.match_start-=t,i.strstart-=t,i.block_start-=t,i.insert>i.strstart&&(i.insert=i.strstart),ag(i),n+=t),i.strm.avail_in===0)break;if(e=_a(i.strm,i.window,i.strstart+i.lookahead,n),i.lookahead+=e,i.lookahead+i.insert>=K)for(r=i.strstart-i.insert,i.ins_h=i.window[r],i.ins_h=Pe(i,i.ins_h,i.window[r+1]);i.insert&&(i.ins_h=Pe(i,i.ins_h,i.window[r+K-1]),i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++,i.insert--,!(i.lookahead+i.insert<K)););}while(i.lookahead<Jt&&i.strm.avail_in!==0)},_h=(i,t)=>{let e=i.pending_buf_size-5>i.w_size?i.w_size:i.pending_buf_size-5,n,r,s,a=0,o=i.strm.avail_in;do{if(n=65535,s=i.bi_valid+42>>3,i.strm.avail_out<s||(s=i.strm.avail_out-s,r=i.strstart-i.block_start,n>r+i.strm.avail_in&&(n=r+i.strm.avail_in),n>s&&(n=s),n<e&&(n===0&&t!==Gt||t===Ee||n!==r+i.strm.avail_in)))break;a=t===Gt&&n===r+i.strm.avail_in?1:0,ha(i,0,0,a),i.pending_buf[i.pending-4]=n,i.pending_buf[i.pending-3]=n>>8,i.pending_buf[i.pending-2]=~n,i.pending_buf[i.pending-1]=~n>>8,Lt(i.strm),r&&(r>n&&(r=n),i.strm.output.set(i.window.subarray(i.block_start,i.block_start+r),i.strm.next_out),i.strm.next_out+=r,i.strm.avail_out-=r,i.strm.total_out+=r,i.block_start+=r,n-=r),n&&(_a(i.strm,i.strm.output,i.strm.next_out,n),i.strm.next_out+=n,i.strm.avail_out-=n,i.strm.total_out+=n)}while(a===0);return o-=i.strm.avail_in,o&&(o>=i.w_size?(i.matches=2,i.window.set(i.strm.input.subarray(i.strm.next_in-i.w_size,i.strm.next_in),0),i.strstart=i.w_size,i.insert=i.strstart):(i.window_size-i.strstart<=o&&(i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,i.insert>i.strstart&&(i.insert=i.strstart)),i.window.set(i.strm.input.subarray(i.strm.next_in-o,i.strm.next_in),i.strstart),i.strstart+=o,i.insert+=o>i.w_size-i.insert?i.w_size-i.insert:o),i.block_start=i.strstart),i.high_water<i.strstart&&(i.high_water=i.strstart),a?bi:t!==Ee&&t!==Gt&&i.strm.avail_in===0&&i.strstart===i.block_start?yi:(s=i.window_size-i.strstart,i.strm.avail_in>s&&i.block_start>=i.w_size&&(i.block_start-=i.w_size,i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,s+=i.w_size,i.insert>i.strstart&&(i.insert=i.strstart)),s>i.strm.avail_in&&(s=i.strm.avail_in),s&&(_a(i.strm,i.window,i.strstart,s),i.strstart+=s,i.insert+=s>i.w_size-i.insert?i.w_size-i.insert:s),i.high_water<i.strstart&&(i.high_water=i.strstart),s=i.bi_valid+42>>3,s=i.pending_buf_size-s>65535?65535:i.pending_buf_size-s,e=s>i.w_size?i.w_size:s,r=i.strstart-i.block_start,(r>=e||(r||t===Gt)&&t!==Ee&&i.strm.avail_in===0&&r<=s)&&(n=r>s?s:r,a=t===Gt&&i.strm.avail_in===0&&n===r?1:0,ha(i,i.block_start,n,a),i.block_start+=n,Lt(i.strm)),a?qe:Mt)},va=(i,t)=>{let e,n;for(;;){if(i.lookahead<Jt){if(wi(i),i.lookahead<Jt&&t===Ee)return Mt;if(i.lookahead===0)break}if(e=0,i.lookahead>=K&&(i.ins_h=Pe(i,i.ins_h,i.window[i.strstart+K-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),e!==0&&i.strstart-e<=i.w_size-Jt&&(i.match_length=mh(i,e)),i.match_length>=K)if(n=Te(i,i.strstart-i.match_start,i.match_length-K),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=K){i.match_length--;do i.strstart++,i.ins_h=Pe(i,i.ins_h,i.window[i.strstart+K-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart;while(--i.match_length!==0);i.strstart++}else i.strstart+=i.match_length,i.match_length=0,i.ins_h=i.window[i.strstart],i.ins_h=Pe(i,i.ins_h,i.window[i.strstart+1]);else n=Te(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(n&&(Ot(i,!1),i.strm.avail_out===0))return Mt}return i.insert=i.strstart<K-1?i.strstart:K-1,t===Gt?(Ot(i,!0),i.strm.avail_out===0?qe:bi):i.sym_next&&(Ot(i,!1),i.strm.avail_out===0)?Mt:yi},Si=(i,t)=>{let e,n,r;for(;;){if(i.lookahead<Jt){if(wi(i),i.lookahead<Jt&&t===Ee)return Mt;if(i.lookahead===0)break}if(e=0,i.lookahead>=K&&(i.ins_h=Pe(i,i.ins_h,i.window[i.strstart+K-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),i.prev_length=i.match_length,i.prev_match=i.match_start,i.match_length=K-1,e!==0&&i.prev_length<i.max_lazy_match&&i.strstart-e<=i.w_size-Jt&&(i.match_length=mh(i,e),i.match_length<=5&&(i.strategy===$1||i.match_length===K&&i.strstart-i.match_start>4096)&&(i.match_length=K-1)),i.prev_length>=K&&i.match_length<=i.prev_length){r=i.strstart+i.lookahead-K,n=Te(i,i.strstart-1-i.prev_match,i.prev_length-K),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=r&&(i.ins_h=Pe(i,i.ins_h,i.window[i.strstart+K-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart);while(--i.prev_length!==0);if(i.match_available=0,i.match_length=K-1,i.strstart++,n&&(Ot(i,!1),i.strm.avail_out===0))return Mt}else if(i.match_available){if(n=Te(i,0,i.window[i.strstart-1]),n&&Ot(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return Mt}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(n=Te(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<K-1?i.strstart:K-1,t===Gt?(Ot(i,!0),i.strm.avail_out===0?qe:bi):i.sym_next&&(Ot(i,!1),i.strm.avail_out===0)?Mt:yi},og=(i,t)=>{let e,n,r,s;const a=i.window;for(;;){if(i.lookahead<=ke){if(wi(i),i.lookahead<=ke&&t===Ee)return Mt;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=K&&i.strstart>0&&(r=i.strstart-1,n=a[r],n===a[++r]&&n===a[++r]&&n===a[++r])){s=i.strstart+ke;do;while(n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&r<s);i.match_length=ke-(s-r),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=K?(e=Te(i,1,i.match_length-K),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(e=Te(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),e&&(Ot(i,!1),i.strm.avail_out===0))return Mt}return i.insert=0,t===Gt?(Ot(i,!0),i.strm.avail_out===0?qe:bi):i.sym_next&&(Ot(i,!1),i.strm.avail_out===0)?Mt:yi},lg=(i,t)=>{let e;for(;;){if(i.lookahead===0&&(wi(i),i.lookahead===0)){if(t===Ee)return Mt;break}if(i.match_length=0,e=Te(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,e&&(Ot(i,!1),i.strm.avail_out===0))return Mt}return i.insert=0,t===Gt?(Ot(i,!0),i.strm.avail_out===0?qe:bi):i.sym_next&&(Ot(i,!1),i.strm.avail_out===0)?Mt:yi};function Qt(i,t,e,n,r){this.good_length=i,this.max_lazy=t,this.nice_length=e,this.max_chain=n,this.func=r}const hn=[new Qt(0,0,0,0,_h),new Qt(4,4,8,4,va),new Qt(4,5,16,8,va),new Qt(4,6,32,32,va),new Qt(4,4,16,16,Si),new Qt(8,16,32,32,Si),new Qt(8,16,128,128,Si),new Qt(8,32,128,256,Si),new Qt(32,128,258,1024,Si),new Qt(32,258,258,4096,Si)],hg=i=>{i.window_size=2*i.w_size,Ae(i.head),i.max_lazy_match=hn[i.level].max_lazy,i.good_match=hn[i.level].good_length,i.nice_match=hn[i.level].nice_length,i.max_chain_length=hn[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=K-1,i.match_available=0,i.ins_h=0};function cg(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=er,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(ig*2),this.dyn_dtree=new Uint16Array((2*tg+1)*2),this.bl_tree=new Uint16Array((2*eg+1)*2),Ae(this.dyn_ltree),Ae(this.dyn_dtree),Ae(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ng+1),this.heap=new Uint16Array(2*ua+1),Ae(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*ua+1),Ae(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const cn=i=>{if(!i)return 1;const t=i.state;return!t||t.strm!==i||t.status!==vi&&t.status!==da&&t.status!==fa&&t.status!==ga&&t.status!==pa&&t.status!==ma&&t.status!==We&&t.status!==on?1:0},vh=i=>{if(cn(i))return Ke(i,Zt);i.total_in=i.total_out=0,i.data_type=q1;const t=i.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?da:t.wrap?vi:We,i.adler=t.wrap===2?0:1,t.last_flush=-2,U1(t),At},yh=i=>{const t=vh(i);return t===At&&hg(i.state),t},ug=(i,t)=>cn(i)||i.state.wrap!==2?Zt:(i.state.gzhead=t,At),bh=(i,t,e,n,r,s)=>{if(!i)return Zt;let a=1;if(t===V1&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),r<1||r>K1||e!==er||n<8||n>15||t<0||t>9||s<0||s>Y1||n===8&&a!==1)return Ke(i,Zt);n===8&&(n=9);const o=new cg;return i.state=o,o.strm=i,o.status=vi,o.wrap=a,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=r+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+K-1)/K),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<r+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=t,o.strategy=s,o.method=e,yh(i)},dg=(i,t)=>bh(i,t,er,Z1,J1,W1),fg=(i,t)=>{if(cn(i)||t>fh||t<0)return i?Ke(i,Zt):Zt;const e=i.state;if(!i.output||i.avail_in!==0&&!i.input||e.status===on&&t!==Gt)return Ke(i,i.avail_out===0?ca:Zt);const n=e.last_flush;if(e.last_flush=t,e.pending!==0){if(Lt(i),i.avail_out===0)return e.last_flush=-1,At}else if(i.avail_in===0&&ph(t)<=ph(n)&&t!==Gt)return Ke(i,ca);if(e.status===on&&i.avail_in!==0)return Ke(i,ca);if(e.status===vi&&e.wrap===0&&(e.status=We),e.status===vi){let r=er+(e.w_bits-8<<4)<<8,s=-1;if(e.strategy>=tr||e.level<2?s=0:e.level<6?s=1:e.level===6?s=2:s=3,r|=s<<6,e.strstart!==0&&(r|=rg),r+=31-r%31,ln(e,r),e.strstart!==0&&(ln(e,i.adler>>>16),ln(e,i.adler&65535)),i.adler=1,e.status=We,Lt(i),e.pending!==0)return e.last_flush=-1,At}if(e.status===da){if(i.adler=0,tt(e,31),tt(e,139),tt(e,8),e.gzhead)tt(e,(e.gzhead.text?1:0)+(e.gzhead.hcrc?2:0)+(e.gzhead.extra?4:0)+(e.gzhead.name?8:0)+(e.gzhead.comment?16:0)),tt(e,e.gzhead.time&255),tt(e,e.gzhead.time>>8&255),tt(e,e.gzhead.time>>16&255),tt(e,e.gzhead.time>>24&255),tt(e,e.level===9?2:e.strategy>=tr||e.level<2?4:0),tt(e,e.gzhead.os&255),e.gzhead.extra&&e.gzhead.extra.length&&(tt(e,e.gzhead.extra.length&255),tt(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(i.adler=Tt(i.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=fa;else if(tt(e,0),tt(e,0),tt(e,0),tt(e,0),tt(e,0),tt(e,e.level===9?2:e.strategy>=tr||e.level<2?4:0),tt(e,sg),e.status=We,Lt(i),e.pending!==0)return e.last_flush=-1,At}if(e.status===fa){if(e.gzhead.extra){let r=e.pending,s=(e.gzhead.extra.length&65535)-e.gzindex;for(;e.pending+s>e.pending_buf_size;){let o=e.pending_buf_size-e.pending;if(e.pending_buf.set(e.gzhead.extra.subarray(e.gzindex,e.gzindex+o),e.pending),e.pending=e.pending_buf_size,e.gzhead.hcrc&&e.pending>r&&(i.adler=Tt(i.adler,e.pending_buf,e.pending-r,r)),e.gzindex+=o,Lt(i),e.pending!==0)return e.last_flush=-1,At;r=0,s-=o}let a=new Uint8Array(e.gzhead.extra);e.pending_buf.set(a.subarray(e.gzindex,e.gzindex+s),e.pending),e.pending+=s,e.gzhead.hcrc&&e.pending>r&&(i.adler=Tt(i.adler,e.pending_buf,e.pending-r,r)),e.gzindex=0}e.status=ga}if(e.status===ga){if(e.gzhead.name){let r=e.pending,s;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>r&&(i.adler=Tt(i.adler,e.pending_buf,e.pending-r,r)),Lt(i),e.pending!==0)return e.last_flush=-1,At;r=0}e.gzindex<e.gzhead.name.length?s=e.gzhead.name.charCodeAt(e.gzindex++)&255:s=0,tt(e,s)}while(s!==0);e.gzhead.hcrc&&e.pending>r&&(i.adler=Tt(i.adler,e.pending_buf,e.pending-r,r)),e.gzindex=0}e.status=pa}if(e.status===pa){if(e.gzhead.comment){let r=e.pending,s;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>r&&(i.adler=Tt(i.adler,e.pending_buf,e.pending-r,r)),Lt(i),e.pending!==0)return e.last_flush=-1,At;r=0}e.gzindex<e.gzhead.comment.length?s=e.gzhead.comment.charCodeAt(e.gzindex++)&255:s=0,tt(e,s)}while(s!==0);e.gzhead.hcrc&&e.pending>r&&(i.adler=Tt(i.adler,e.pending_buf,e.pending-r,r))}e.status=ma}if(e.status===ma){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(Lt(i),e.pending!==0))return e.last_flush=-1,At;tt(e,i.adler&255),tt(e,i.adler>>8&255),i.adler=0}if(e.status=We,Lt(i),e.pending!==0)return e.last_flush=-1,At}if(i.avail_in!==0||e.lookahead!==0||t!==Ee&&e.status!==on){let r=e.level===0?_h(e,t):e.strategy===tr?lg(e,t):e.strategy===X1?og(e,t):hn[e.level].func(e,t);if((r===qe||r===bi)&&(e.status=on),r===Mt||r===qe)return i.avail_out===0&&(e.last_flush=-1),At;if(r===yi&&(t===z1?B1(e):t!==fh&&(ha(e,0,0,!1),t===H1&&(Ae(e.head),e.lookahead===0&&(e.strstart=0,e.block_start=0,e.insert=0))),Lt(i),i.avail_out===0))return e.last_flush=-1,At}return t!==Gt?At:e.wrap<=0?gh:(e.wrap===2?(tt(e,i.adler&255),tt(e,i.adler>>8&255),tt(e,i.adler>>16&255),tt(e,i.adler>>24&255),tt(e,i.total_in&255),tt(e,i.total_in>>8&255),tt(e,i.total_in>>16&255),tt(e,i.total_in>>24&255)):(ln(e,i.adler>>>16),ln(e,i.adler&65535)),Lt(i),e.wrap>0&&(e.wrap=-e.wrap),e.pending!==0?At:gh)},gg=i=>{if(cn(i))return Zt;const t=i.state.status;return i.state=null,t===We?Ke(i,j1):At},pg=(i,t)=>{let e=t.length;if(cn(i))return Zt;const n=i.state,r=n.wrap;if(r===2||r===1&&n.status!==vi||n.lookahead)return Zt;if(r===1&&(i.adler=an(i.adler,t,e,0)),n.wrap=0,e>=n.w_size){r===0&&(Ae(n.head),n.strstart=0,n.block_start=0,n.insert=0);let h=new Uint8Array(n.w_size);h.set(t.subarray(e-n.w_size,e),0),t=h,e=n.w_size}const s=i.avail_in,a=i.next_in,o=i.input;for(i.avail_in=e,i.next_in=0,i.input=t,wi(n);n.lookahead>=K;){let h=n.strstart,l=n.lookahead-(K-1);do n.ins_h=Pe(n,n.ins_h,n.window[h+K-1]),n.prev[h&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=h,h++;while(--l);n.strstart=h,n.lookahead=K-1,wi(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=K-1,n.match_available=0,i.next_in=a,i.input=o,i.avail_in=s,n.wrap=r,At};var mg=dg,_g=bh,vg=yh,yg=vh,bg=ug,wg=fg,Sg=gg,Cg=pg,xg="pako deflate (from Nodeca project)",un={deflateInit:mg,deflateInit2:_g,deflateReset:vg,deflateResetKeep:yg,deflateSetHeader:bg,deflate:wg,deflateEnd:Sg,deflateSetDictionary:Cg,deflateInfo:xg};const Tg=(i,t)=>Object.prototype.hasOwnProperty.call(i,t);var Eg=function(i){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)Tg(e,n)&&(i[n]=e[n])}}return i},kg=i=>{let t=0;for(let n=0,r=i.length;n<r;n++)t+=i[n].length;const e=new Uint8Array(t);for(let n=0,r=0,s=i.length;n<s;n++){let a=i[n];e.set(a,r),r+=a.length}return e},ir={assign:Eg,flattenChunks:kg};let wh=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{wh=!1}const dn=new Uint8Array(256);for(let i=0;i<256;i++)dn[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;dn[254]=dn[254]=1;var Ag=i=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let t,e,n,r,s,a=i.length,o=0;for(r=0;r<a;r++)e=i.charCodeAt(r),(e&64512)===55296&&r+1<a&&(n=i.charCodeAt(r+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),r++)),o+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(o),s=0,r=0;s<o;r++)e=i.charCodeAt(r),(e&64512)===55296&&r+1<a&&(n=i.charCodeAt(r+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),r++)),e<128?t[s++]=e:e<2048?(t[s++]=192|e>>>6,t[s++]=128|e&63):e<65536?(t[s++]=224|e>>>12,t[s++]=128|e>>>6&63,t[s++]=128|e&63):(t[s++]=240|e>>>18,t[s++]=128|e>>>12&63,t[s++]=128|e>>>6&63,t[s++]=128|e&63);return t};const Pg=(i,t)=>{if(t<65534&&i.subarray&&wh)return String.fromCharCode.apply(null,i.length===t?i:i.subarray(0,t));let e="";for(let n=0;n<t;n++)e+=String.fromCharCode(i[n]);return e};var Mg=(i,t)=>{const e=t||i.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,t));let n,r;const s=new Array(e*2);for(r=0,n=0;n<e;){let a=i[n++];if(a<128){s[r++]=a;continue}let o=dn[a];if(o>4){s[r++]=65533,n+=o-1;continue}for(a&=o===2?31:o===3?15:7;o>1&&n<e;)a=a<<6|i[n++]&63,o--;if(o>1){s[r++]=65533;continue}a<65536?s[r++]=a:(a-=65536,s[r++]=55296|a>>10&1023,s[r++]=56320|a&1023)}return Pg(s,r)},Rg=(i,t)=>{t=t||i.length,t>i.length&&(t=i.length);let e=t-1;for(;e>=0&&(i[e]&192)===128;)e--;return e<0||e===0?t:e+dn[i[e]]>t?e:t},fn={string2buf:Ag,buf2string:Mg,utf8border:Rg};function Dg(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Sh=Dg;const Ch=Object.prototype.toString,{Z_NO_FLUSH:Lg,Z_SYNC_FLUSH:Og,Z_FULL_FLUSH:Ig,Z_FINISH:Fg,Z_OK:nr,Z_STREAM_END:Ng,Z_DEFAULT_COMPRESSION:Ug,Z_DEFAULT_STRATEGY:Gg,Z_DEFLATED:Bg}=Ye;function gn(i){this.options=ir.assign({level:Ug,method:Bg,chunkSize:16384,windowBits:15,memLevel:8,strategy:Gg},i||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Sh,this.strm.avail_out=0;let e=un.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==nr)throw new Error(Xe[e]);if(t.header&&un.deflateSetHeader(this.strm,t.header),t.dictionary){let n;if(typeof t.dictionary=="string"?n=fn.string2buf(t.dictionary):Ch.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,e=un.deflateSetDictionary(this.strm,n),e!==nr)throw new Error(Xe[e]);this._dict_set=!0}}gn.prototype.push=function(i,t){const e=this.strm,n=this.options.chunkSize;let r,s;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?Fg:Lg,typeof i=="string"?e.input=fn.string2buf(i):Ch.call(i)==="[object ArrayBuffer]"?e.input=new Uint8Array(i):e.input=i,e.next_in=0,e.avail_in=e.input.length;;){if(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),(s===Og||s===Ig)&&e.avail_out<=6){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(r=un.deflate(e,s),r===Ng)return e.next_out>0&&this.onData(e.output.subarray(0,e.next_out)),r=un.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===nr;if(e.avail_out===0){this.onData(e.output);continue}if(s>0&&e.next_out>0){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(e.avail_in===0)break}return!0},gn.prototype.onData=function(i){this.chunks.push(i)},gn.prototype.onEnd=function(i){i===nr&&(this.result=ir.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function ya(i,t){const e=new gn(t);if(e.push(i,!0),e.err)throw e.msg||Xe[e.err];return e.result}function zg(i,t){return t=t||{},t.raw=!0,ya(i,t)}function Hg(i,t){return t=t||{},t.gzip=!0,ya(i,t)}var jg=gn,Vg=ya,$g=zg,Xg=Hg,Yg=Ye,Wg={Deflate:jg,deflate:Vg,deflateRaw:$g,gzip:Xg,constants:Yg};const rr=16209,qg=16191;var Kg=function(t,e){let n,r,s,a,o,h,l,c,d,f,u,g,p,_,y,b,m,v,w,S,k,C,A,x;const T=t.state;n=t.next_in,A=t.input,r=n+(t.avail_in-5),s=t.next_out,x=t.output,a=s-(e-t.avail_out),o=s+(t.avail_out-257),h=T.dmax,l=T.wsize,c=T.whave,d=T.wnext,f=T.window,u=T.hold,g=T.bits,p=T.lencode,_=T.distcode,y=(1<<T.lenbits)-1,b=(1<<T.distbits)-1;t:do{g<15&&(u+=A[n++]<<g,g+=8,u+=A[n++]<<g,g+=8),m=p[u&y];e:for(;;){if(v=m>>>24,u>>>=v,g-=v,v=m>>>16&255,v===0)x[s++]=m&65535;else if(v&16){w=m&65535,v&=15,v&&(g<v&&(u+=A[n++]<<g,g+=8),w+=u&(1<<v)-1,u>>>=v,g-=v),g<15&&(u+=A[n++]<<g,g+=8,u+=A[n++]<<g,g+=8),m=_[u&b];i:for(;;){if(v=m>>>24,u>>>=v,g-=v,v=m>>>16&255,v&16){if(S=m&65535,v&=15,g<v&&(u+=A[n++]<<g,g+=8,g<v&&(u+=A[n++]<<g,g+=8)),S+=u&(1<<v)-1,S>h){t.msg="invalid distance too far back",T.mode=rr;break t}if(u>>>=v,g-=v,v=s-a,S>v){if(v=S-v,v>c&&T.sane){t.msg="invalid distance too far back",T.mode=rr;break t}if(k=0,C=f,d===0){if(k+=l-v,v<w){w-=v;do x[s++]=f[k++];while(--v);k=s-S,C=x}}else if(d<v){if(k+=l+d-v,v-=d,v<w){w-=v;do x[s++]=f[k++];while(--v);if(k=0,d<w){v=d,w-=v;do x[s++]=f[k++];while(--v);k=s-S,C=x}}}else if(k+=d-v,v<w){w-=v;do x[s++]=f[k++];while(--v);k=s-S,C=x}for(;w>2;)x[s++]=C[k++],x[s++]=C[k++],x[s++]=C[k++],w-=3;w&&(x[s++]=C[k++],w>1&&(x[s++]=C[k++]))}else{k=s-S;do x[s++]=x[k++],x[s++]=x[k++],x[s++]=x[k++],w-=3;while(w>2);w&&(x[s++]=x[k++],w>1&&(x[s++]=x[k++]))}}else if(v&64){t.msg="invalid distance code",T.mode=rr;break t}else{m=_[(m&65535)+(u&(1<<v)-1)];continue i}break}}else if(v&64)if(v&32){T.mode=qg;break t}else{t.msg="invalid literal/length code",T.mode=rr;break t}else{m=p[(m&65535)+(u&(1<<v)-1)];continue e}break}}while(n<r&&s<o);w=g>>3,n-=w,g-=w<<3,u&=(1<<g)-1,t.next_in=n,t.next_out=s,t.avail_in=n<r?5+(r-n):5-(n-r),t.avail_out=s<o?257+(o-s):257-(s-o),T.hold=u,T.bits=g};const Ci=15,xh=852,Th=592,Eh=0,ba=1,kh=2,Zg=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Jg=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Qg=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),t2=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var pn=(i,t,e,n,r,s,a,o)=>{const h=o.bits;let l=0,c=0,d=0,f=0,u=0,g=0,p=0,_=0,y=0,b=0,m,v,w,S,k,C=null,A;const x=new Uint16Array(Ci+1),T=new Uint16Array(Ci+1);let M=null,D,O,I;for(l=0;l<=Ci;l++)x[l]=0;for(c=0;c<n;c++)x[t[e+c]]++;for(u=h,f=Ci;f>=1&&x[f]===0;f--);if(u>f&&(u=f),f===0)return r[s++]=1<<24|64<<16|0,r[s++]=1<<24|64<<16|0,o.bits=1,0;for(d=1;d<f&&x[d]===0;d++);for(u<d&&(u=d),_=1,l=1;l<=Ci;l++)if(_<<=1,_-=x[l],_<0)return-1;if(_>0&&(i===Eh||f!==1))return-1;for(T[1]=0,l=1;l<Ci;l++)T[l+1]=T[l]+x[l];for(c=0;c<n;c++)t[e+c]!==0&&(a[T[t[e+c]]++]=c);if(i===Eh?(C=M=a,A=20):i===ba?(C=Zg,M=Jg,A=257):(C=Qg,M=t2,A=0),b=0,c=0,l=d,k=s,g=u,p=0,w=-1,y=1<<u,S=y-1,i===ba&&y>xh||i===kh&&y>Th)return 1;for(;;){D=l-p,a[c]+1<A?(O=0,I=a[c]):a[c]>=A?(O=M[a[c]-A],I=C[a[c]-A]):(O=32+64,I=0),m=1<<l-p,v=1<<g,d=v;do v-=m,r[k+(b>>p)+v]=D<<24|O<<16|I|0;while(v!==0);for(m=1<<l-1;b&m;)m>>=1;if(m!==0?(b&=m-1,b+=m):b=0,c++,--x[l]===0){if(l===f)break;l=t[e+a[c]]}if(l>u&&(b&S)!==w){for(p===0&&(p=u),k+=d,g=l-p,_=1<<g;g+p<f&&(_-=x[g+p],!(_<=0));)g++,_<<=1;if(y+=1<<g,i===ba&&y>xh||i===kh&&y>Th)return 1;w=b&S,r[w]=u<<24|g<<16|k-s|0}}return b!==0&&(r[k+b]=l-p<<24|64<<16|0),o.bits=u,0};const e2=0,Ah=1,Ph=2,{Z_FINISH:Mh,Z_BLOCK:i2,Z_TREES:sr,Z_OK:Ze,Z_STREAM_END:n2,Z_NEED_DICT:r2,Z_STREAM_ERROR:Bt,Z_DATA_ERROR:Rh,Z_MEM_ERROR:Dh,Z_BUF_ERROR:s2,Z_DEFLATED:Lh}=Ye,ar=16180,Oh=16181,Ih=16182,Fh=16183,Nh=16184,Uh=16185,Gh=16186,Bh=16187,zh=16188,Hh=16189,or=16190,oe=16191,wa=16192,jh=16193,Sa=16194,Vh=16195,$h=16196,Xh=16197,Yh=16198,lr=16199,hr=16200,Wh=16201,qh=16202,Kh=16203,Zh=16204,Jh=16205,Ca=16206,Qh=16207,tc=16208,ct=16209,ec=16210,ic=16211,a2=852,o2=592,l2=15,nc=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function h2(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Je=i=>{if(!i)return 1;const t=i.state;return!t||t.strm!==i||t.mode<ar||t.mode>ic?1:0},rc=i=>{if(Je(i))return Bt;const t=i.state;return i.total_in=i.total_out=t.total=0,i.msg="",t.wrap&&(i.adler=t.wrap&1),t.mode=ar,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(a2),t.distcode=t.distdyn=new Int32Array(o2),t.sane=1,t.back=-1,Ze},sc=i=>{if(Je(i))return Bt;const t=i.state;return t.wsize=0,t.whave=0,t.wnext=0,rc(i)},ac=(i,t)=>{let e;if(Je(i))return Bt;const n=i.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Bt:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,sc(i))},oc=(i,t)=>{if(!i)return Bt;const e=new h2;i.state=e,e.strm=i,e.window=null,e.mode=ar;const n=ac(i,t);return n!==Ze&&(i.state=null),n},c2=i=>oc(i,l2);let lc=!0,xa,Ta;const u2=i=>{if(lc){xa=new Int32Array(512),Ta=new Int32Array(32);let t=0;for(;t<144;)i.lens[t++]=8;for(;t<256;)i.lens[t++]=9;for(;t<280;)i.lens[t++]=7;for(;t<288;)i.lens[t++]=8;for(pn(Ah,i.lens,0,288,xa,0,i.work,{bits:9}),t=0;t<32;)i.lens[t++]=5;pn(Ph,i.lens,0,32,Ta,0,i.work,{bits:5}),lc=!1}i.lencode=xa,i.lenbits=9,i.distcode=Ta,i.distbits=5},hc=(i,t,e,n)=>{let r;const s=i.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),n>=s.wsize?(s.window.set(t.subarray(e-s.wsize,e),0),s.wnext=0,s.whave=s.wsize):(r=s.wsize-s.wnext,r>n&&(r=n),s.window.set(t.subarray(e-n,e-n+r),s.wnext),n-=r,n?(s.window.set(t.subarray(e-n,e),0),s.wnext=n,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0},d2=(i,t)=>{let e,n,r,s,a,o,h,l,c,d,f,u,g,p,_=0,y,b,m,v,w,S,k,C;const A=new Uint8Array(4);let x,T;const M=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Je(i)||!i.output||!i.input&&i.avail_in!==0)return Bt;e=i.state,e.mode===oe&&(e.mode=wa),a=i.next_out,r=i.output,h=i.avail_out,s=i.next_in,n=i.input,o=i.avail_in,l=e.hold,c=e.bits,d=o,f=h,C=Ze;t:for(;;)switch(e.mode){case ar:if(e.wrap===0){e.mode=wa;break}for(;c<16;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(e.wrap&2&&l===35615){e.wbits===0&&(e.wbits=15),e.check=0,A[0]=l&255,A[1]=l>>>8&255,e.check=Tt(e.check,A,2,0),l=0,c=0,e.mode=Oh;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((l&255)<<8)+(l>>8))%31){i.msg="incorrect header check",e.mode=ct;break}if((l&15)!==Lh){i.msg="unknown compression method",e.mode=ct;break}if(l>>>=4,c-=4,k=(l&15)+8,e.wbits===0&&(e.wbits=k),k>15||k>e.wbits){i.msg="invalid window size",e.mode=ct;break}e.dmax=1<<e.wbits,e.flags=0,i.adler=e.check=1,e.mode=l&512?Hh:oe,l=0,c=0;break;case Oh:for(;c<16;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(e.flags=l,(e.flags&255)!==Lh){i.msg="unknown compression method",e.mode=ct;break}if(e.flags&57344){i.msg="unknown header flags set",e.mode=ct;break}e.head&&(e.head.text=l>>8&1),e.flags&512&&e.wrap&4&&(A[0]=l&255,A[1]=l>>>8&255,e.check=Tt(e.check,A,2,0)),l=0,c=0,e.mode=Ih;case Ih:for(;c<32;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}e.head&&(e.head.time=l),e.flags&512&&e.wrap&4&&(A[0]=l&255,A[1]=l>>>8&255,A[2]=l>>>16&255,A[3]=l>>>24&255,e.check=Tt(e.check,A,4,0)),l=0,c=0,e.mode=Fh;case Fh:for(;c<16;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}e.head&&(e.head.xflags=l&255,e.head.os=l>>8),e.flags&512&&e.wrap&4&&(A[0]=l&255,A[1]=l>>>8&255,e.check=Tt(e.check,A,2,0)),l=0,c=0,e.mode=Nh;case Nh:if(e.flags&1024){for(;c<16;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}e.length=l,e.head&&(e.head.extra_len=l),e.flags&512&&e.wrap&4&&(A[0]=l&255,A[1]=l>>>8&255,e.check=Tt(e.check,A,2,0)),l=0,c=0}else e.head&&(e.head.extra=null);e.mode=Uh;case Uh:if(e.flags&1024&&(u=e.length,u>o&&(u=o),u&&(e.head&&(k=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(s,s+u),k)),e.flags&512&&e.wrap&4&&(e.check=Tt(e.check,n,u,s)),o-=u,s+=u,e.length-=u),e.length))break t;e.length=0,e.mode=Gh;case Gh:if(e.flags&2048){if(o===0)break t;u=0;do k=n[s+u++],e.head&&k&&e.length<65536&&(e.head.name+=String.fromCharCode(k));while(k&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=Tt(e.check,n,u,s)),o-=u,s+=u,k)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=Bh;case Bh:if(e.flags&4096){if(o===0)break t;u=0;do k=n[s+u++],e.head&&k&&e.length<65536&&(e.head.comment+=String.fromCharCode(k));while(k&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=Tt(e.check,n,u,s)),o-=u,s+=u,k)break t}else e.head&&(e.head.comment=null);e.mode=zh;case zh:if(e.flags&512){for(;c<16;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(e.wrap&4&&l!==(e.check&65535)){i.msg="header crc mismatch",e.mode=ct;break}l=0,c=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),i.adler=e.check=0,e.mode=oe;break;case Hh:for(;c<32;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}i.adler=e.check=nc(l),l=0,c=0,e.mode=or;case or:if(e.havedict===0)return i.next_out=a,i.avail_out=h,i.next_in=s,i.avail_in=o,e.hold=l,e.bits=c,r2;i.adler=e.check=1,e.mode=oe;case oe:if(t===i2||t===sr)break t;case wa:if(e.last){l>>>=c&7,c-=c&7,e.mode=Ca;break}for(;c<3;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}switch(e.last=l&1,l>>>=1,c-=1,l&3){case 0:e.mode=jh;break;case 1:if(u2(e),e.mode=lr,t===sr){l>>>=2,c-=2;break t}break;case 2:e.mode=$h;break;case 3:i.msg="invalid block type",e.mode=ct}l>>>=2,c-=2;break;case jh:for(l>>>=c&7,c-=c&7;c<32;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if((l&65535)!==(l>>>16^65535)){i.msg="invalid stored block lengths",e.mode=ct;break}if(e.length=l&65535,l=0,c=0,e.mode=Sa,t===sr)break t;case Sa:e.mode=Vh;case Vh:if(u=e.length,u){if(u>o&&(u=o),u>h&&(u=h),u===0)break t;r.set(n.subarray(s,s+u),a),o-=u,s+=u,h-=u,a+=u,e.length-=u;break}e.mode=oe;break;case $h:for(;c<14;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(e.nlen=(l&31)+257,l>>>=5,c-=5,e.ndist=(l&31)+1,l>>>=5,c-=5,e.ncode=(l&15)+4,l>>>=4,c-=4,e.nlen>286||e.ndist>30){i.msg="too many length or distance symbols",e.mode=ct;break}e.have=0,e.mode=Xh;case Xh:for(;e.have<e.ncode;){for(;c<3;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}e.lens[M[e.have++]]=l&7,l>>>=3,c-=3}for(;e.have<19;)e.lens[M[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,x={bits:e.lenbits},C=pn(e2,e.lens,0,19,e.lencode,0,e.work,x),e.lenbits=x.bits,C){i.msg="invalid code lengths set",e.mode=ct;break}e.have=0,e.mode=Yh;case Yh:for(;e.have<e.nlen+e.ndist;){for(;_=e.lencode[l&(1<<e.lenbits)-1],y=_>>>24,b=_>>>16&255,m=_&65535,!(y<=c);){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(m<16)l>>>=y,c-=y,e.lens[e.have++]=m;else{if(m===16){for(T=y+2;c<T;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(l>>>=y,c-=y,e.have===0){i.msg="invalid bit length repeat",e.mode=ct;break}k=e.lens[e.have-1],u=3+(l&3),l>>>=2,c-=2}else if(m===17){for(T=y+3;c<T;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}l>>>=y,c-=y,k=0,u=3+(l&7),l>>>=3,c-=3}else{for(T=y+7;c<T;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}l>>>=y,c-=y,k=0,u=11+(l&127),l>>>=7,c-=7}if(e.have+u>e.nlen+e.ndist){i.msg="invalid bit length repeat",e.mode=ct;break}for(;u--;)e.lens[e.have++]=k}}if(e.mode===ct)break;if(e.lens[256]===0){i.msg="invalid code -- missing end-of-block",e.mode=ct;break}if(e.lenbits=9,x={bits:e.lenbits},C=pn(Ah,e.lens,0,e.nlen,e.lencode,0,e.work,x),e.lenbits=x.bits,C){i.msg="invalid literal/lengths set",e.mode=ct;break}if(e.distbits=6,e.distcode=e.distdyn,x={bits:e.distbits},C=pn(Ph,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,x),e.distbits=x.bits,C){i.msg="invalid distances set",e.mode=ct;break}if(e.mode=lr,t===sr)break t;case lr:e.mode=hr;case hr:if(o>=6&&h>=258){i.next_out=a,i.avail_out=h,i.next_in=s,i.avail_in=o,e.hold=l,e.bits=c,Kg(i,f),a=i.next_out,r=i.output,h=i.avail_out,s=i.next_in,n=i.input,o=i.avail_in,l=e.hold,c=e.bits,e.mode===oe&&(e.back=-1);break}for(e.back=0;_=e.lencode[l&(1<<e.lenbits)-1],y=_>>>24,b=_>>>16&255,m=_&65535,!(y<=c);){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(b&&!(b&240)){for(v=y,w=b,S=m;_=e.lencode[S+((l&(1<<v+w)-1)>>v)],y=_>>>24,b=_>>>16&255,m=_&65535,!(v+y<=c);){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}l>>>=v,c-=v,e.back+=v}if(l>>>=y,c-=y,e.back+=y,e.length=m,b===0){e.mode=Jh;break}if(b&32){e.back=-1,e.mode=oe;break}if(b&64){i.msg="invalid literal/length code",e.mode=ct;break}e.extra=b&15,e.mode=Wh;case Wh:if(e.extra){for(T=e.extra;c<T;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}e.length+=l&(1<<e.extra)-1,l>>>=e.extra,c-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=qh;case qh:for(;_=e.distcode[l&(1<<e.distbits)-1],y=_>>>24,b=_>>>16&255,m=_&65535,!(y<=c);){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(!(b&240)){for(v=y,w=b,S=m;_=e.distcode[S+((l&(1<<v+w)-1)>>v)],y=_>>>24,b=_>>>16&255,m=_&65535,!(v+y<=c);){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}l>>>=v,c-=v,e.back+=v}if(l>>>=y,c-=y,e.back+=y,b&64){i.msg="invalid distance code",e.mode=ct;break}e.offset=m,e.extra=b&15,e.mode=Kh;case Kh:if(e.extra){for(T=e.extra;c<T;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}e.offset+=l&(1<<e.extra)-1,l>>>=e.extra,c-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){i.msg="invalid distance too far back",e.mode=ct;break}e.mode=Zh;case Zh:if(h===0)break t;if(u=f-h,e.offset>u){if(u=e.offset-u,u>e.whave&&e.sane){i.msg="invalid distance too far back",e.mode=ct;break}u>e.wnext?(u-=e.wnext,g=e.wsize-u):g=e.wnext-u,u>e.length&&(u=e.length),p=e.window}else p=r,g=a-e.offset,u=e.length;u>h&&(u=h),h-=u,e.length-=u;do r[a++]=p[g++];while(--u);e.length===0&&(e.mode=hr);break;case Jh:if(h===0)break t;r[a++]=e.length,h--,e.mode=hr;break;case Ca:if(e.wrap){for(;c<32;){if(o===0)break t;o--,l|=n[s++]<<c,c+=8}if(f-=h,i.total_out+=f,e.total+=f,e.wrap&4&&f&&(i.adler=e.check=e.flags?Tt(e.check,r,f,a-f):an(e.check,r,f,a-f)),f=h,e.wrap&4&&(e.flags?l:nc(l))!==e.check){i.msg="incorrect data check",e.mode=ct;break}l=0,c=0}e.mode=Qh;case Qh:if(e.wrap&&e.flags){for(;c<32;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(e.wrap&4&&l!==(e.total&4294967295)){i.msg="incorrect length check",e.mode=ct;break}l=0,c=0}e.mode=tc;case tc:C=n2;break t;case ct:C=Rh;break t;case ec:return Dh;case ic:default:return Bt}return i.next_out=a,i.avail_out=h,i.next_in=s,i.avail_in=o,e.hold=l,e.bits=c,(e.wsize||f!==i.avail_out&&e.mode<ct&&(e.mode<Ca||t!==Mh))&&hc(i,i.output,i.next_out,f-i.avail_out),d-=i.avail_in,f-=i.avail_out,i.total_in+=d,i.total_out+=f,e.total+=f,e.wrap&4&&f&&(i.adler=e.check=e.flags?Tt(e.check,r,f,i.next_out-f):an(e.check,r,f,i.next_out-f)),i.data_type=e.bits+(e.last?64:0)+(e.mode===oe?128:0)+(e.mode===lr||e.mode===Sa?256:0),(d===0&&f===0||t===Mh)&&C===Ze&&(C=s2),C},f2=i=>{if(Je(i))return Bt;let t=i.state;return t.window&&(t.window=null),i.state=null,Ze},g2=(i,t)=>{if(Je(i))return Bt;const e=i.state;return e.wrap&2?(e.head=t,t.done=!1,Ze):Bt},p2=(i,t)=>{const e=t.length;let n,r,s;return Je(i)||(n=i.state,n.wrap!==0&&n.mode!==or)?Bt:n.mode===or&&(r=1,r=an(r,t,e,0),r!==n.check)?Rh:(s=hc(i,t,e,e),s?(n.mode=ec,Dh):(n.havedict=1,Ze))};var m2=sc,_2=ac,v2=rc,y2=c2,b2=oc,w2=d2,S2=f2,C2=g2,x2=p2,T2="pako inflate (from Nodeca project)",le={inflateReset:m2,inflateReset2:_2,inflateResetKeep:v2,inflateInit:y2,inflateInit2:b2,inflate:w2,inflateEnd:S2,inflateGetHeader:C2,inflateSetDictionary:x2,inflateInfo:T2};function E2(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var k2=E2;const cc=Object.prototype.toString,{Z_NO_FLUSH:A2,Z_FINISH:P2,Z_OK:mn,Z_STREAM_END:Ea,Z_NEED_DICT:ka,Z_STREAM_ERROR:M2,Z_DATA_ERROR:uc,Z_MEM_ERROR:R2}=Ye;function _n(i){this.options=ir.assign({chunkSize:65536,windowBits:15,to:""},i||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(i&&i.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Sh,this.strm.avail_out=0;let e=le.inflateInit2(this.strm,t.windowBits);if(e!==mn)throw new Error(Xe[e]);if(this.header=new k2,le.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=fn.string2buf(t.dictionary):cc.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=le.inflateSetDictionary(this.strm,t.dictionary),e!==mn)))throw new Error(Xe[e])}_n.prototype.push=function(i,t){const e=this.strm,n=this.options.chunkSize,r=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?P2:A2,cc.call(i)==="[object ArrayBuffer]"?e.input=new Uint8Array(i):e.input=i,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),s=le.inflate(e,a),s===ka&&r&&(s=le.inflateSetDictionary(e,r),s===mn?s=le.inflate(e,a):s===uc&&(s=ka));e.avail_in>0&&s===Ea&&e.state.wrap>0&&i[e.next_in]!==0;)le.inflateReset(e),s=le.inflate(e,a);switch(s){case M2:case uc:case ka:case R2:return this.onEnd(s),this.ended=!0,!1}if(o=e.avail_out,e.next_out&&(e.avail_out===0||s===Ea))if(this.options.to==="string"){let h=fn.utf8border(e.output,e.next_out),l=e.next_out-h,c=fn.buf2string(e.output,h);e.next_out=l,e.avail_out=n-l,l&&e.output.set(e.output.subarray(h,h+l),0),this.onData(c)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(s===mn&&o===0)){if(s===Ea)return s=le.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(e.avail_in===0)break}}return!0},_n.prototype.onData=function(i){this.chunks.push(i)},_n.prototype.onEnd=function(i){i===mn&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=ir.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function Aa(i,t){const e=new _n(t);if(e.push(i),e.err)throw e.msg||Xe[e.err];return e.result}function D2(i,t){return t=t||{},t.raw=!0,Aa(i,t)}var L2=_n,O2=Aa,I2=D2,F2=Aa,N2=Ye,U2={Inflate:L2,inflate:O2,inflateRaw:I2,ungzip:F2,constants:N2};const{Deflate:G2,deflate:B2,deflateRaw:z2,gzip:H2}=Wg,{Inflate:j2,inflate:V2,inflateRaw:$2,ungzip:X2}=U2;var Y2=G2,W2=B2,q2=z2,K2=H2,Z2=j2,J2=V2,Q2=$2,tp=X2,ep=Ye,ip={Deflate:Y2,deflate:W2,deflateRaw:q2,gzip:K2,Inflate:Z2,inflate:J2,inflateRaw:Q2,ungzip:tp,constants:ep};const L={};L.toRGBA8=function(i){const t=i.width,e=i.height;if(i.tabs.acTL===null)return[L.toRGBA8.decodeImage(i.data,t,e,i).buffer];const n=[];i.frames[0].data===null&&(i.frames[0].data=i.data);const r=t*e*4,s=new Uint8Array(r),a=new Uint8Array(r),o=new Uint8Array(r);for(let h=0;h<i.frames.length;h++){const l=i.frames[h],c=l.rect.x,d=l.rect.y,f=l.rect.width,u=l.rect.height,g=L.toRGBA8.decodeImage(l.data,f,u,i);if(h!==0)for(let p=0;p<r;p++)o[p]=s[p];if(l.blend===0?L._copyTile(g,f,u,s,t,e,c,d,0):l.blend===1&&L._copyTile(g,f,u,s,t,e,c,d,1),n.push(s.buffer.slice(0)),l.dispose===1)L._copyTile(a,f,u,s,t,e,c,d,0);else if(l.dispose===2)for(let p=0;p<r;p++)s[p]=o[p]}return n},L.toRGBA8.decodeImage=function(i,t,e,n){const r=t*e,s=L.decode._getBPP(n),a=Math.ceil(t*s/8),o=new Uint8Array(r*4),h=new Uint32Array(o.buffer),l=n.ctype,c=n.depth,d=L._bin.readUshort;if(l===6){const f=r<<2;if(c===8)for(let u=0;u<f;u+=4)o[u]=i[u],o[u+1]=i[u+1],o[u+2]=i[u+2],o[u+3]=i[u+3];if(c===16)for(let u=0;u<f;u++)o[u]=i[u<<1]}else if(l===2){const f=n.tabs.tRNS;if(f===null){if(c===8)for(let u=0;u<r;u++){const g=u*3;h[u]=-16777216|i[g+2]<<16|i[g+1]<<8|i[g]}if(c===16)for(let u=0;u<r;u++){const g=u*6;h[u]=-16777216|i[g+4]<<16|i[g+2]<<8|i[g]}}else{const u=f[0],g=f[1],p=f[2];if(c===8)for(let _=0;_<r;_++){const y=_<<2,b=_*3;h[_]=-16777216|i[b+2]<<16|i[b+1]<<8|i[b],i[b]===u&&i[b+1]===g&&i[b+2]===p&&(o[y+3]=0)}if(c===16)for(let _=0;_<r;_++){const y=_<<2,b=_*6;h[_]=-16777216|i[b+4]<<16|i[b+2]<<8|i[b],d(i,b)===u&&d(i,b+2)===g&&d(i,b+4)===p&&(o[y+3]=0)}}}else if(l===3){const f=n.tabs.PLTE,u=n.tabs.tRNS,g=u?u.length:0;if(c===1)for(let p=0;p<e;p++){const _=p*a,y=p*t;for(let b=0;b<t;b++){const m=y+b<<2,v=i[_+(b>>3)]>>7-((b&7)<<0)&1,w=3*v;o[m]=f[w],o[m+1]=f[w+1],o[m+2]=f[w+2],o[m+3]=v<g?u[v]:255}}if(c===2)for(let p=0;p<e;p++){const _=p*a,y=p*t;for(let b=0;b<t;b++){const m=y+b<<2,v=i[_+(b>>2)]>>6-((b&3)<<1)&3,w=3*v;o[m]=f[w],o[m+1]=f[w+1],o[m+2]=f[w+2],o[m+3]=v<g?u[v]:255}}if(c===4)for(let p=0;p<e;p++){const _=p*a,y=p*t;for(let b=0;b<t;b++){const m=y+b<<2,v=i[_+(b>>1)]>>4-((b&1)<<2)&15,w=3*v;o[m]=f[w],o[m+1]=f[w+1],o[m+2]=f[w+2],o[m+3]=v<g?u[v]:255}}if(c===8)for(let p=0;p<r;p++){const _=p<<2,y=i[p],b=3*y;o[_]=f[b],o[_+1]=f[b+1],o[_+2]=f[b+2],o[_+3]=y<g?u[y]:255}}else if(l===4){if(c===8)for(let f=0;f<r;f++){const u=f<<2,g=f<<1,p=i[g];o[u]=p,o[u+1]=p,o[u+2]=p,o[u+3]=i[g+1]}if(c===16)for(let f=0;f<r;f++){const u=f<<2,g=f<<2,p=i[g];o[u]=p,o[u+1]=p,o[u+2]=p,o[u+3]=i[g+2]}}else if(l===0){const f=n.tabs.tRNS?n.tabs.tRNS:-1;for(let u=0;u<e;u++){const g=u*a,p=u*t;if(c===1)for(let _=0;_<t;_++){const y=255*(i[g+(_>>>3)]>>>7-(_&7)&1),b=y===f*255?0:255;h[p+_]=b<<24|y<<16|y<<8|y}else if(c===2)for(let _=0;_<t;_++){const y=85*(i[g+(_>>>2)]>>>6-((_&3)<<1)&3),b=y===f*85?0:255;h[p+_]=b<<24|y<<16|y<<8|y}else if(c===4)for(let _=0;_<t;_++){const y=17*(i[g+(_>>>1)]>>>4-((_&1)<<2)&15),b=y===f*17?0:255;h[p+_]=b<<24|y<<16|y<<8|y}else if(c===8)for(let _=0;_<t;_++){const y=i[g+_],b=y===f?0:255;h[p+_]=b<<24|y<<16|y<<8|y}else if(c===16)for(let _=0;_<t;_++){const y=i[g+(_<<1)],b=d(i,g+(_<<1))===f?0:255;h[p+_]=b<<24|y<<16|y<<8|y}}}return o},L.decode=function(i){const t=new Uint8Array(i);let e=8;const n=L._bin,r=n.readUshort,s=n.readUint,a={tabs:{},frames:[]},o=new Uint8Array(t.length);let h=0,l,c=0;const d=[137,80,78,71,13,10,26,10];for(let f=0;f<8;f++)if(t[f]!==d[f])throw"The input is not a PNG file!";for(;e<t.length;){const f=n.readUint(t,e);e+=4;const u=n.readASCII(t,e,4);if(e+=4,u==="IHDR")L.decode._IHDR(t,e,a);else if(u==="CgBI")a.tabs[u]=t.slice(e,e+4);else if(u==="IDAT"){for(let g=0;g<f;g++)o[h+g]=t[e+g];h+=f}else if(u==="acTL")a.tabs[u]={num_frames:s(t,e),num_plays:s(t,e+4)},l=new Uint8Array(t.length);else if(u==="fcTL"){if(c!==0){const y=a.frames[a.frames.length-1];y.data=L.decode._decompress(a,l.slice(0,c),y.rect.width,y.rect.height),c=0}const g={x:s(t,e+12),y:s(t,e+16),width:s(t,e+4),height:s(t,e+8)};let p=r(t,e+22);p=r(t,e+20)/(p===0?100:p);const _={rect:g,delay:Math.round(p*1e3),dispose:t[e+24],blend:t[e+25]};a.frames.push(_)}else if(u==="fdAT"){for(let g=0;g<f-4;g++)l[c+g]=t[e+g+4];c+=f-4}else if(u==="pHYs")a.tabs[u]=[n.readUint(t,e),n.readUint(t,e+4),t[e+8]];else if(u==="cHRM"){a.tabs[u]=[];for(let g=0;g<8;g++)a.tabs[u].push(n.readUint(t,e+g*4))}else if(u==="tEXt"||u==="zTXt"){a.tabs[u]===null&&(a.tabs[u]={});const g=n.nextZero(t,e),p=n.readASCII(t,e,g-e);let _;const y=e+f-g-1;if(u==="tEXt")_=n.readASCII(t,g+1,y);else{const b=L.decode._inflate(t.slice(g+2,g+2+y));_=n.readUTF8(b,0,b.length)}a.tabs[u][p]=_}else if(u==="iTXt"){a.tabs[u]==null&&(a.tabs[u]={});let g=0,p=e;g=n.nextZero(t,p);const _=n.readASCII(t,p,g-p);p=g+1;const y=t[p];p+=2,g=n.nextZero(t,p),p=g+1,g=n.nextZero(t,p),p=g+1;let b;const m=f-(p-e);if(y===0)b=n.readUTF8(t,p,m);else{const v=L.decode._inflate(t.slice(p,p+m));b=n.readUTF8(v,0,v.length)}a.tabs[u][_]=b}else if(u==="PLTE")a.tabs[u]=n.readBytes(t,e,f);else if(u==="hIST"){const g=a.tabs.PLTE.length/3;a.tabs[u]=[];for(let p=0;p<g;p++)a.tabs[u].push(r(t,e+p*2))}else if(u==="tRNS")a.ctype===3?a.tabs[u]=n.readBytes(t,e,f):a.ctype===0?a.tabs[u]=r(t,e):a.ctype===2&&(a.tabs[u]=[r(t,e),r(t,e+2),r(t,e+4)]);else if(u==="gAMA")a.tabs[u]=n.readUint(t,e)/1e5;else if(u==="sRGB")a.tabs[u]=t[e];else if(u==="bKGD")a.ctype===0||a.ctype===4?a.tabs[u]=[r(t,e)]:a.ctype===2||a.ctype===6?a.tabs[u]=[r(t,e),r(t,e+2),r(t,e+4)]:a.ctype===3&&(a.tabs[u]=t[e]);else if(u==="IEND")break;e+=f,e+=4}if(c!==0){const f=a.frames[a.frames.length-1];f.data=L.decode._decompress(a,l.slice(0,c),f.rect.width,f.rect.height),c=0}return a.data=L.decode._decompress(a,o,a.width,a.height),delete a.compress,delete a.interlace,delete a.filter,a},L.decode._decompress=function(i,t,e,n){const r=L.decode._getBPP(i),s=Math.ceil(e*r/8),a=new Uint8Array((s+1+i.interlace)*n);return i.tabs.CgBI?t=L.inflateRaw(t,a):t=L.decode._inflate(t,a),i.interlace===0?t=L.decode._filterZero(t,i,0,e,n):i.interlace===1&&(t=L.decode._readInterlace(t,i)),t},L.decode._inflate=function(i,t){return L.inflateRaw(new Uint8Array(i.buffer,2,i.length-6),t)},L.inflateRaw=function(){const i={};return i.H={},i.H.N=function(t,e){const n=Uint8Array;let r=0,s=0,a=0,o=0,h=0,l=0,c=0,d=0,f=0,u,g;if(t[0]===3&&t[1]===0)return e||new n(0);const p=i.H,_=p.b,y=p.e,b=p.R,m=p.n,v=p.A,w=p.Z,S=p.m,k=e===null;for(k&&(e=new n(t.length>>>2<<3));r===0;){if(r=_(t,f,1),s=_(t,f+1,2),f+=3,s===0){f&7&&(f+=8-(f&7));const C=(f>>>3)+4,A=t[C-4]|t[C-3]<<8;k&&(e=i.H.W(e,d+A)),e.set(new n(t.buffer,t.byteOffset+C,A),d),f=C+A<<3,d+=A;continue}if(k&&(e=i.H.W(e,d+131072)),s===1&&(u=S.J,g=S.h,l=511,c=31),s===2){a=y(t,f,5)+257,o=y(t,f+5,5)+1,h=y(t,f+10,4)+4,f+=14;let C=1;for(let T=0;T<38;T+=2)S.Q[T]=0,S.Q[T+1]=0;for(let T=0;T<h;T++){const M=y(t,f+T*3,3);S.Q[(S.X[T]<<1)+1]=M,M>C&&(C=M)}f+=3*h,m(S.Q,C),v(S.Q,C,S.u),u=S.w,g=S.d,f=b(S.u,(1<<C)-1,a+o,t,f,S.v);const A=p.V(S.v,0,a,S.C);l=(1<<A)-1;const x=p.V(S.v,a,o,S.D);c=(1<<x)-1,m(S.C,A),v(S.C,A,u),m(S.D,x),v(S.D,x,g)}for(;;){const C=u[w(t,f)&l];f+=C&15;const A=C>>>4;if(!(A>>>8))e[d++]=A;else{if(A===256)break;{let x=d+A-254;if(A>264){const I=S.q[A-257];x=d+(I>>>3)+y(t,f,I&7),f+=I&7}const T=g[w(t,f)&c];f+=T&15;const M=T>>>4,D=S.c[M],O=(D>>>4)+_(t,f,D&15);for(f+=D&15;d<x;)e[d]=e[d++-O],e[d]=e[d++-O],e[d]=e[d++-O],e[d]=e[d++-O];d=x}}}}return e.length===d?e:e.slice(0,d)},i.H.W=function(t,e){const n=t.length;if(e<=n)return t;const r=new Uint8Array(n<<1);return r.set(t,0),r},i.H.R=function(t,e,n,r,s,a){const o=i.H.e,h=i.H.Z;let l=0;for(;l<n;){const c=t[h(r,s)&e];s+=c&15;const d=c>>>4;if(d<=15)a[l]=d,l++;else{let f=0,u=0;d===16?(u=3+o(r,s,2),s+=2,f=a[l-1]):d===17?(u=3+o(r,s,3),s+=3):d===18&&(u=11+o(r,s,7),s+=7);const g=l+u;for(;l<g;)a[l]=f,l++}}return s},i.H.V=function(t,e,n,r){let s=0,a=0;const o=r.length>>>1;for(;a<n;){const h=t[a+e];r[a<<1]=0,r[(a<<1)+1]=h,h>s&&(s=h),a++}for(;a<o;)r[a<<1]=0,r[(a<<1)+1]=0,a++;return s},i.H.n=function(t,e){const n=i.H.m,r=t.length;let s,a,o,h,l;const c=n.j;for(let f=0;f<=e;f++)c[f]=0;for(h=1;h<r;h+=2)c[t[h]]++;const d=n.K;for(s=0,c[0]=0,a=1;a<=e;a++)s=s+c[a-1]<<1,d[a]=s;for(o=0;o<r;o+=2)l=t[o+1],l!==0&&(t[o]=d[l],d[l]++)},i.H.A=function(t,e,n){const r=t.length,a=i.H.m.r;for(let o=0;o<r;o+=2)if(t[o+1]!==0){const h=o>>1,l=t[o+1],c=h<<4|l,d=e-l;let f=t[o]<<d;const u=f+(1<<d);for(;f!==u;){const g=a[f]>>>15-e;n[g]=c,f++}}},i.H.l=function(t,e){const n=i.H.m.r,r=15-e;for(let s=0;s<t.length;s+=2){const a=t[s]<<e-t[s+1];t[s]=n[a]>>>r}},i.H.M=function(t,e,n){n=n<<(e&7);const r=e>>>3;t[r]|=n,t[r+1]|=n>>>8},i.H.I=function(t,e,n){n=n<<(e&7);const r=e>>>3;t[r]|=n,t[r+1]|=n>>>8,t[r+2]|=n>>>16},i.H.e=function(t,e,n){return(t[e>>>3]|t[(e>>>3)+1]<<8)>>>(e&7)&(1<<n)-1},i.H.b=function(t,e,n){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)&(1<<n)-1},i.H.Z=function(t,e){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)},i.H.i=function(t,e){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16|t[(e>>>3)+3]<<24)>>>(e&7)},i.H.m=function(){const t=Uint16Array,e=Uint32Array;return{K:new t(16),j:new t(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new t(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new e(32),J:new t(512),_:[],h:new t(32),$:[],w:new t(32768),C:[],v:[],d:new t(32768),D:[],u:new t(512),Q:[],r:new t(32768),s:new e(286),Y:new e(30),a:new e(19),t:new e(15e3),k:new t(65536),g:new t(32768)}}(),function(){const t=i.H.m,e=32768;for(let r=0;r<e;r++){let s=r;s=(s&2863311530)>>>1|(s&1431655765)<<1,s=(s&3435973836)>>>2|(s&858993459)<<2,s=(s&4042322160)>>>4|(s&252645135)<<4,s=(s&4278255360)>>>8|(s&16711935)<<8,t.r[r]=(s>>>16|s<<16)>>>17}function n(r,s,a){for(;s--!==0;)r.push(0,a)}for(let r=0;r<32;r++)t.q[r]=t.S[r]<<3|t.T[r],t.c[r]=t.p[r]<<4|t.z[r];n(t._,144,8),n(t._,112,9),n(t._,24,7),n(t._,8,8),i.H.n(t._,9),i.H.A(t._,9,t.J),i.H.l(t._,9),n(t.$,32,5),i.H.n(t.$,5),i.H.A(t.$,5,t.h),i.H.l(t.$,5),n(t.Q,19,0),n(t.C,286,0),n(t.D,30,0),n(t.v,320,0)}(),i.H.N}(),L.decode._readInterlace=function(i,t){const e=t.width,n=t.height,r=L.decode._getBPP(t),s=r>>3,a=Math.ceil(e*r/8),o=new Uint8Array(n*a);let h=0;const l=[0,0,4,0,2,0,1],c=[0,4,0,2,0,1,0],d=[8,8,8,4,4,2,2],f=[8,8,4,4,2,2,1];let u=0;for(;u<7;){const g=d[u],p=f[u];let _=0,y=0,b=l[u];for(;b<n;)b+=g,y++;let m=c[u];for(;m<e;)m+=p,_++;const v=Math.ceil(_*r/8);L.decode._filterZero(i,t,h,_,y);let w=0,S=l[u];for(;S<n;){let k=c[u],C=h+w*v<<3;for(;k<e;){if(r===1){let A=i[C>>3];A=A>>7-(C&7)&1,o[S*a+(k>>3)]|=A<<7-((k&7)<<0)}if(r===2){let A=i[C>>3];A=A>>6-(C&7)&3,o[S*a+(k>>2)]|=A<<6-((k&3)<<1)}if(r===4){let A=i[C>>3];A=A>>4-(C&7)&15,o[S*a+(k>>1)]|=A<<4-((k&1)<<2)}if(r>=8){const A=S*a+k*s;for(let x=0;x<s;x++)o[A+x]=i[(C>>3)+x]}C+=r,k+=p}w++,S+=g}_*y!==0&&(h+=y*(1+v)),u=u+1}return o},L.decode._getBPP=function(i){return[1,null,3,1,2,null,4][i.ctype]*i.depth},L.decode._filterZero=function(i,t,e,n,r){let s=L.decode._getBPP(t);const a=Math.ceil(n*s/8),o=L.decode._paeth;s=Math.ceil(s/8);let h=0,l=1,c=i[e],d=0;if(c>1&&(i[e]=[0,0,1][c-2]),c===3)for(d=s;d<a;d++)i[d+1]=i[d+1]+(i[d+1-s]>>>1)&255;for(let f=0;f<r;f++)if(h=e+f*a,l=h+f+1,c=i[l-1],d=0,c===0)for(;d<a;d++)i[h+d]=i[l+d];else if(c===1){for(;d<s;d++)i[h+d]=i[l+d];for(;d<a;d++)i[h+d]=i[l+d]+i[h+d-s]}else if(c===2)for(;d<a;d++)i[h+d]=i[l+d]+i[h+d-a];else if(c===3){for(;d<s;d++)i[h+d]=i[l+d]+(i[h+d-a]>>>1);for(;d<a;d++)i[h+d]=i[l+d]+(i[h+d-a]+i[h+d-s]>>>1)}else{for(;d<s;d++)i[h+d]=i[l+d]+o(0,i[h+d-a],0);for(;d<a;d++)i[h+d]=i[l+d]+o(i[h+d-s],i[h+d-a],i[h+d-s-a])}return i},L.decode._paeth=function(i,t,e){const n=i+t-e,r=n-i,s=n-t,a=n-e;return r*r<=s*s&&r*r<=a*a?i:s*s<=a*a?t:e},L.decode._IHDR=function(i,t,e){const n=L._bin;e.width=n.readUint(i,t),t+=4,e.height=n.readUint(i,t),t+=4,e.depth=i[t],t++,e.ctype=i[t],t++,e.compress=i[t],t++,e.filter=i[t],t++,e.interlace=i[t],t++},L._bin={nextZero:function(i,t){for(;i[t]!==0;)t++;return t},readUshort:function(i,t){return i[t]<<8|i[t+1]},writeUshort:function(i,t,e){i[t]=e>>8&255,i[t+1]=e&255},readUint:function(i,t){return i[t]*16777216+(i[t+1]<<16|i[t+2]<<8|i[t+3])},writeUint:function(i,t,e){i[t]=e>>24&255,i[t+1]=e>>16&255,i[t+2]=e>>8&255,i[t+3]=e&255},readASCII:function(i,t,e){let n="";for(let r=0;r<e;r++)n+=String.fromCharCode(i[t+r]);return n},writeASCII:function(i,t,e){for(let n=0;n<e.length;n++)i[t+n]=e.charCodeAt(n)},readBytes:function(i,t,e){const n=[];for(let r=0;r<e;r++)n.push(i[t+r]);return n},pad:function(i){return i.length<2?"0"+i:i},readUTF8:function(i,t,e){let n="",r;for(let s=0;s<e;s++)n+="%"+L._bin.pad(i[t+s].toString(16));try{r=decodeURIComponent(n)}catch{return L._bin.readASCII(i,t,e)}return r}},L._copyTile=function(i,t,e,n,r,s,a,o,h){const l=Math.min(t,r),c=Math.min(e,s);let d=0,f=0;for(let u=0;u<c;u++)for(let g=0;g<l;g++)if(a>=0&&o>=0?(d=u*t+g<<2,f=(o+u)*r+a+g<<2):(d=(-o+u)*t-a+g<<2,f=u*r+g<<2),h===0)n[f]=i[d],n[f+1]=i[d+1],n[f+2]=i[d+2],n[f+3]=i[d+3];else if(h===1){const p=i[d+3]*.00392156862745098,_=i[d]*p,y=i[d+1]*p,b=i[d+2]*p,m=n[f+3]*(1/255),v=n[f]*m,w=n[f+1]*m,S=n[f+2]*m,k=1-p,C=p+m*k,A=C===0?0:1/C;n[f+3]=255*C,n[f+0]=(_+v*k)*A,n[f+1]=(y+w*k)*A,n[f+2]=(b+S*k)*A}else if(h===2){const p=i[d+3],_=i[d],y=i[d+1],b=i[d+2],m=n[f+3],v=n[f],w=n[f+1],S=n[f+2];p===m&&_===v&&y===w&&b===S?(n[f]=0,n[f+1]=0,n[f+2]=0,n[f+3]=0):(n[f]=_,n[f+1]=y,n[f+2]=b,n[f+3]=p)}else if(h===3){const p=i[d+3],_=i[d],y=i[d+1],b=i[d+2],m=n[f+3],v=n[f],w=n[f+1],S=n[f+2];if(p===m&&_===v&&y===w&&b===S)continue;if(p<220&&m>20)return!1}return!0},L.encode=function(i,t,e,n,r,s,a){n===null&&(n=0),a===null&&(a=!1);const o=L.encode.compress(i,t,e,n,[!1,!1,!1,0,a]);return L.encode.compressPNG(o,-1),L.encode._main(o,t,e,r,s)},L.encodeLL=function(i,t,e,n,r,s,a,o){const h={ctype:0+(n===1?0:2)+(r===0?0:4),depth:s,frames:[]},l=(n+r)*s,c=l*t;for(let f=0;f<i.length;f++)h.frames.push({rect:{x:0,y:0,width:t,height:e},img:new Uint8Array(i[f]),blend:0,dispose:1,bpp:Math.ceil(l/8),bpl:Math.ceil(c/8)});return L.encode.compressPNG(h,0,!0),L.encode._main(h,t,e,a,o)},L.encode._main=function(i,t,e,n,r){r||(r={});const s=L.crc.crc,a=L._bin.writeUint,o=L._bin.writeUshort,h=L._bin.writeASCII;let l=8;const c=i.frames.length>1;let d=!1,f=8+(16+5+4)+(c?20:0);if(r.sRGB!==null&&r.sRGB!==void 0&&(f+=13),r.pHYs!==null&&r.pHYs!==void 0&&(f+=21),i.ctype===3){const _=i.plte.length;for(let y=0;y<_;y++)i.plte[y]>>>24!==255&&(d=!0);f+=8+_*3+4+(d?8+_*1+4:0)}for(let _=0;_<i.frames.length;_++){const y=i.frames[_];c&&(f+=38),f+=y.cimg.length+12,_!==0&&(f+=4)}f+=12;const u=new Uint8Array(f),g=[137,80,78,71,13,10,26,10];for(let _=0;_<8;_++)u[_]=g[_];if(a(u,l,13),l+=4,h(u,l,"IHDR"),l+=4,a(u,l,t),l+=4,a(u,l,e),l+=4,u[l]=i.depth,l++,u[l]=i.ctype,l++,u[l]=0,l++,u[l]=0,l++,u[l]=0,l++,a(u,l,s(u,l-17,17)),l+=4,r.sRGB!==null&&r.sRGB!==void 0&&(a(u,l,1),l+=4,h(u,l,"sRGB"),l+=4,u[l]=r.sRGB,l++,a(u,l,s(u,l-5,5)),l+=4),r.pHYs!==null&&r.pHYs!==void 0&&(a(u,l,9),l+=4,h(u,l,"pHYs"),l+=4,a(u,l,r.pHYs[0]),l+=4,a(u,l,r.pHYs[1]),l+=4,u[l]=r.pHYs[2],l++,a(u,l,s(u,l-13,13)),l+=4),c&&(a(u,l,8),l+=4,h(u,l,"acTL"),l+=4,a(u,l,i.frames.length),l+=4,a(u,l,r.loop!=null?r.loop:0),l+=4,a(u,l,s(u,l-12,12)),l+=4),i.ctype===3){const _=i.plte.length;a(u,l,_*3),l+=4,h(u,l,"PLTE"),l+=4;for(let y=0;y<_;y++){const b=y*3,m=i.plte[y],v=m&255,w=m>>>8&255,S=m>>>16&255;u[l+b+0]=v,u[l+b+1]=w,u[l+b+2]=S}if(l+=_*3,a(u,l,s(u,l-_*3-4,_*3+4)),l+=4,d){a(u,l,_),l+=4,h(u,l,"tRNS"),l+=4;for(let y=0;y<_;y++)u[l+y]=i.plte[y]>>>24&255;l+=_,a(u,l,s(u,l-_-4,_+4)),l+=4}}let p=0;for(let _=0;_<i.frames.length;_++){const y=i.frames[_];c&&(a(u,l,26),l+=4,h(u,l,"fcTL"),l+=4,a(u,l,p++),l+=4,a(u,l,y.rect.width),l+=4,a(u,l,y.rect.height),l+=4,a(u,l,y.rect.x),l+=4,a(u,l,y.rect.y),l+=4,o(u,l,n[_]),l+=2,o(u,l,1e3),l+=2,u[l]=y.dispose,l++,u[l]=y.blend,l++,a(u,l,s(u,l-30,30)),l+=4);const b=y.cimg,m=b.length;a(u,l,m+(_===0?0:4)),l+=4;const v=l;h(u,l,_===0?"IDAT":"fdAT"),l+=4,_!==0&&(a(u,l,p++),l+=4),u.set(b,l),l+=m,a(u,l,s(u,v,l-v)),l+=4}return a(u,l,0),l+=4,h(u,l,"IEND"),l+=4,a(u,l,s(u,l-4,4)),l+=4,u.buffer},L.encode.compressPNG=function(i,t,e){for(let n=0;n<i.frames.length;n++){const r=i.frames[n],s=r.rect.height,a=new Uint8Array(s*r.bpl+s);r.cimg=L.encode._filterZero(r.img,s,r.bpp,r.bpl,a,t,e)}},L.encode.compress=function(i,t,e,n,r){const s=r[0],a=r[1],o=r[2],h=r[3],l=r[4];let c=6,d=8,f=255;for(let m=0;m<i.length;m++){const v=new Uint8Array(i[m]),w=v.length;for(let S=0;S<w;S+=4)f&=v[S+3]}const u=f!==255,g=L.encode.framize(i,t,e,s,a,o),p={},_=[],y=[];if(n!==0){const m=[];for(let C=0;C<g.length;C++)m.push(g[C].img.buffer);const v=L.encode.concatRGBA(m),w=L.quantize(v,n);let S=0;const k=new Uint8Array(w.abuf);for(let C=0;C<g.length;C++){const A=g[C].img,x=A.length;y.push(new Uint8Array(w.inds.buffer,S>>2,x>>2));for(let T=0;T<x;T+=4)A[T]=k[S+T],A[T+1]=k[S+T+1],A[T+2]=k[S+T+2],A[T+3]=k[S+T+3];S+=x}for(let C=0;C<w.plte.length;C++)_.push(w.plte[C].est.rgba)}else for(let m=0;m<g.length;m++){const v=g[m],w=new Uint32Array(v.img.buffer),S=v.rect.width,k=w.length,C=new Uint8Array(k);y.push(C);for(let A=0;A<k;A++){const x=w[A];if(A!==0&&x===w[A-1])C[A]=C[A-1];else if(A>S&&x===w[A-S])C[A]=C[A-S];else{let T=p[x];if(T===null&&(p[x]=T=_.length,_.push(x),_.length>=300))break;C[A]=T}}}const b=_.length;b<=256&&l===!1&&(b<=2?d=1:b<=4?d=2:b<=16?d=4:d=8,d=Math.max(d,h));for(let m=0;m<g.length;m++){const v=g[m],w=v.rect.width,S=v.rect.height;let k=v.img,C=4*w,A=4;if(b<=256&&l===!1){C=Math.ceil(d*w/8);const x=new Uint8Array(C*S),T=y[m];for(let M=0;M<S;M++){const D=M*C,O=M*w;if(d===8)for(let I=0;I<w;I++)x[D+I]=T[O+I];else if(d===4)for(let I=0;I<w;I++)x[D+(I>>1)]|=T[O+I]<<4-(I&1)*4;else if(d===2)for(let I=0;I<w;I++)x[D+(I>>2)]|=T[O+I]<<6-(I&3)*2;else if(d===1)for(let I=0;I<w;I++)x[D+(I>>3)]|=T[O+I]<<7-(I&7)*1}k=x,c=3,A=1}else if(u===!1&&g.length===1){const x=new Uint8Array(w*S*3),T=w*S;for(let M=0;M<T;M++){const D=M*3,O=M*4;x[D]=k[O],x[D+1]=k[O+1],x[D+2]=k[O+2]}k=x,c=2,A=3,C=3*w}v.img=k,v.bpl=C,v.bpp=A}return{ctype:c,depth:d,plte:_,frames:g}},L.encode.framize=function(i,t,e,n,r,s){const a=[];for(let o=0;o<i.length;o++){const h=new Uint8Array(i[o]),l=new Uint32Array(h.buffer);let c,d=0,f=0,u=t,g=e,p=n?1:0;if(o!==0){const _=s||n||o===1||a[o-2].dispose!==0?1:2;let y=0,b=1e9;for(let v=0;v<_;v++){const w=new Uint32Array(i[o-1-v]);let S=t,k=e,C=-1,A=-1;for(let T=0;T<e;T++)for(let M=0;M<t;M++){const D=T*t+M;l[D]!==w[D]&&(M<S&&(S=M),M>C&&(C=M),T<k&&(k=T),T>A&&(A=T))}C===-1&&(S=k=C=A=0),r&&((S&1)===1&&S--,(k&1)===1&&k--);const x=(C-S+1)*(A-k+1);x<b&&(b=x,y=v,d=S,f=k,u=C-S+1,g=A-k+1)}const m=new Uint8Array(i[o-1-y]);y===1&&(a[o-1].dispose=2),c=new Uint8Array(u*g*4),L._copyTile(m,t,e,c,u,g,-d,-f,0),p=L._copyTile(h,t,e,c,u,g,-d,-f,3)?1:0,p===1?L.encode._prepareDiff(h,t,e,c,{x:d,y:f,width:u,height:g}):L._copyTile(h,t,e,c,u,g,-d,-f,0)}else c=h.slice(0);a.push({rect:{x:d,y:f,width:u,height:g},img:c,blend:p,dispose:0})}if(n)for(let o=0;o<a.length;o++){const h=a[o];if(h.blend===1)continue;const l=h.rect,c=a[o-1].rect,d=Math.min(l.x,c.x),f=Math.min(l.y,c.y),u=Math.max(l.x+l.width,c.x+c.width),g=Math.max(l.y+l.height,c.y+c.height),p={x:d,y:f,width:u-d,height:g-f};a[o-1].dispose=1,o-1!==0&&L.encode._updateFrame(i,t,e,a,o-1,p,r),L.encode._updateFrame(i,t,e,a,o,p,r)}return a},L.encode._updateFrame=function(i,t,e,n,r,s,a){const o=Uint8Array,h=Uint32Array,l=new o(i[r-1]),c=new h(i[r-1]),d=r+1<i.length?new o(i[r+1]):null,f=new o(i[r]),u=new h(f.buffer);let g=t,p=e,_=-1,y=-1;for(let m=0;m<s.height;m++)for(let v=0;v<s.width;v++){const w=s.x+v,S=s.y+m,k=S*t+w,C=u[k];C===0||n[r-1].dispose===0&&c[k]===C&&(d===null||d[k*4+3]!==0)||(w<g&&(g=w),w>_&&(_=w),S<p&&(p=S),S>y&&(y=S))}_===-1&&(g=p=_=y=0),a&&((g&1)===1&&g--,(p&1)===1&&p--),s={x:g,y:p,width:_-g+1,height:y-p+1};const b=n[r];b.rect=s,b.blend=1,b.img=new Uint8Array(s.width*s.height*4),n[r-1].dispose===0?(L._copyTile(l,t,e,b.img,s.width,s.height,-s.x,-s.y,0),L.encode._prepareDiff(f,t,e,b.img,s)):L._copyTile(f,t,e,b.img,s.width,s.height,-s.x,-s.y,0)},L.encode._prepareDiff=function(i,t,e,n,r){L._copyTile(i,t,e,n,r.width,r.height,-r.x,-r.y,2)},L.encode._filterZero=function(i,t,e,n,r,s,a){const o=[];let h=[0,1,2,3,4];s!==-1?h=[s]:(t*n>5e5||e===1)&&(h=[0]);let l;a&&(l={level:0});const c=r.length>1e7&&Vl!=null?Vl:ip;for(let u=0;u<h.length;u++){for(let g=0;g<t;g++)L.encode._filterLine(r,i,g,n,e,h[u]);o.push(c.deflate(r,l))}let d,f=1e9;for(let u=0;u<o.length;u++)o[u].length<f&&(d=u,f=o[u].length);return o[d]},L.encode._filterLine=function(i,t,e,n,r,s){const a=e*n;let o=a+e;const h=L.decode._paeth;if(i[o]=s,o++,s===0)if(n<500)for(let l=0;l<n;l++)i[o+l]=t[a+l];else i.set(new Uint8Array(t.buffer,a,n),o);else if(s===1){for(let l=0;l<r;l++)i[o+l]=t[a+l];for(let l=r;l<n;l++)i[o+l]=t[a+l]-t[a+l-r]+256&255}else if(e===0){for(let l=0;l<r;l++)i[o+l]=t[a+l];if(s===2)for(let l=r;l<n;l++)i[o+l]=t[a+l];if(s===3)for(let l=r;l<n;l++)i[o+l]=t[a+l]-(t[a+l-r]>>1)+256&255;if(s===4)for(let l=r;l<n;l++)i[o+l]=t[a+l]-h(t[a+l-r],0,0)+256&255}else{if(s===2)for(let l=0;l<n;l++)i[o+l]=t[a+l]+256-t[a+l-n]&255;if(s===3){for(let l=0;l<r;l++)i[o+l]=t[a+l]+256-(t[a+l-n]>>1)&255;for(let l=r;l<n;l++)i[o+l]=t[a+l]+256-(t[a+l-n]+t[a+l-r]>>1)&255}if(s===4){for(let l=0;l<r;l++)i[o+l]=t[a+l]+256-h(0,t[a+l-n],0)&255;for(let l=r;l<n;l++)i[o+l]=t[a+l]+256-h(t[a+l-r],t[a+l-n],t[a+l-r-n])&255}}},L.crc={table:function(){const i=new Uint32Array(256);for(let t=0;t<256;t++){let e=t;for(let n=0;n<8;n++)e&1?e=3988292384^e>>>1:e=e>>>1;i[t]=e}return i}(),update:function(i,t,e,n){for(let r=0;r<n;r++)i=L.crc.table[(i^t[e+r])&255]^i>>>8;return i},crc:function(i,t,e){return L.crc.update(4294967295,i,t,e)^4294967295}},L.quantize=function(i,t){const e=new Uint8Array(i),n=e.slice(0),r=new Uint32Array(n.buffer),s=L.quantize.getKDtree(n,t),a=s[0],o=s[1],h=L.quantize.planeDst,l=e,c=r,d=l.length,f=new Uint8Array(e.length>>2);let u;if(e.length<2e7)for(let g=0;g<d;g+=4){const p=l[g]*.00392156862745098,_=l[g+1]*(1/255),y=l[g+2]*(1/255),b=l[g+3]*(1/255);u=L.quantize.getNearest(a,p,_,y,b),f[g>>2]=u.ind,c[g>>2]=u.est.rgba}else for(let g=0;g<d;g+=4){const p=l[g]*.00392156862745098,_=l[g+1]*(1/255),y=l[g+2]*(1/255),b=l[g+3]*(1/255);for(u=a;u.left;)u=h(u.est,p,_,y,b)<=0?u.left:u.right;f[g>>2]=u.ind,c[g>>2]=u.est.rgba}return{abuf:n.buffer,inds:f,plte:o}},L.quantize.getKDtree=function(i,t,e){e===null&&(e=1e-4);const n=new Uint32Array(i.buffer),r={i0:0,i1:i.length,bst:null,est:null,tdst:0,left:null,right:null};r.bst=L.quantize.stats(i,r.i0,r.i1),r.est=L.quantize.estats(r.bst);const s=[r];for(;s.length<t;){let a=0,o=0;for(let u=0;u<s.length;u++)s[u].est.L>a&&(a=s[u].est.L,o=u);if(a<e)break;const h=s[o],l=L.quantize.splitPixels(i,n,h.i0,h.i1,h.est.e,h.est.eMq255);if(h.i0>=l||h.i1<=l){h.est.L=0;continue}const d={i0:h.i0,i1:l,bst:null,est:null,tdst:0,left:null,right:null};d.bst=L.quantize.stats(i,d.i0,d.i1),d.est=L.quantize.estats(d.bst);const f={i0:l,i1:h.i1,bst:null,est:null,tdst:0,left:null,right:null};f.bst={R:[],m:[],N:h.bst.N-d.bst.N};for(let u=0;u<16;u++)f.bst.R[u]=h.bst.R[u]-d.bst.R[u];for(let u=0;u<4;u++)f.bst.m[u]=h.bst.m[u]-d.bst.m[u];f.est=L.quantize.estats(f.bst),h.left=d,h.right=f,s[o]=d,s.push(f)}s.sort(function(a,o){return o.bst.N-a.bst.N});for(let a=0;a<s.length;a++)s[a].ind=a;return[r,s]},L.quantize.getNearest=function(i,t,e,n,r){if(i.left==null)return i.tdst=L.quantize.dist(i.est.q,t,e,n,r),i;const s=L.quantize.planeDst(i.est,t,e,n,r);let a=i.left,o=i.right;s>0&&(a=i.right,o=i.left);const h=L.quantize.getNearest(a,t,e,n,r);if(h.tdst<=s*s)return h;const l=L.quantize.getNearest(o,t,e,n,r);return l.tdst<h.tdst?l:h},L.quantize.planeDst=function(i,t,e,n,r){const s=i.e;return s[0]*t+s[1]*e+s[2]*n+s[3]*r-i.eMq},L.quantize.dist=function(i,t,e,n,r){const s=t-i[0],a=e-i[1],o=n-i[2],h=r-i[3];return s*s+a*a+o*o+h*h},L.quantize.splitPixels=function(i,t,e,n,r,s){const a=L.quantize.vecDot;for(n-=4;e<n;){for(;a(i,e,r)<=s;)e+=4;for(;a(i,n,r)>s;)n-=4;if(e>=n)break;const o=t[e>>2];t[e>>2]=t[n>>2],t[n>>2]=o,e+=4,n-=4}for(;a(i,e,r)>s;)e-=4;return e+4},L.quantize.vecDot=function(i,t,e){return i[t]*e[0]+i[t+1]*e[1]+i[t+2]*e[2]+i[t+3]*e[3]},L.quantize.stats=function(i,t,e){const n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=[0,0,0,0],s=e-t>>2;for(let a=t;a<e;a+=4){const o=i[a]*.00392156862745098,h=i[a+1]*(1/255),l=i[a+2]*(1/255),c=i[a+3]*(1/255);r[0]+=o,r[1]+=h,r[2]+=l,r[3]+=c,n[0]+=o*o,n[1]+=o*h,n[2]+=o*l,n[3]+=o*c,n[5]+=h*h,n[6]+=h*l,n[7]+=h*c,n[10]+=l*l,n[11]+=l*c,n[15]+=c*c}return n[4]=n[1],n[8]=n[2],n[9]=n[6],n[12]=n[3],n[13]=n[7],n[14]=n[11],{R:n,m:r,N:s}},L.quantize.estats=function(i){const t=i.R,e=i.m,n=i.N,r=e[0],s=e[1],a=e[2],o=e[3],h=n===0?0:1/n,l=[t[0]-r*r*h,t[1]-r*s*h,t[2]-r*a*h,t[3]-r*o*h,t[4]-s*r*h,t[5]-s*s*h,t[6]-s*a*h,t[7]-s*o*h,t[8]-a*r*h,t[9]-a*s*h,t[10]-a*a*h,t[11]-a*o*h,t[12]-o*r*h,t[13]-o*s*h,t[14]-o*a*h,t[15]-o*o*h],c=l,d=L.M4;let f=[Math.random(),Math.random(),Math.random(),Math.random()],u=0,g=0;if(n!==0)for(let y=0;y<16&&(f=d.multVec(c,f),g=Math.sqrt(d.dot(f,f)),f=d.sml(1/g,f),!(y!==0&&Math.abs(g-u)<1e-9));y++)u=g;const p=[r*h,s*h,a*h,o*h],_=d.dot(d.sml(255,p),f);return{Cov:l,q:p,e:f,L:u,eMq255:_,eMq:d.dot(f,p),rgba:(Math.round(255*p[3])<<24|Math.round(255*p[2])<<16|Math.round(255*p[1])<<8|Math.round(255*p[0])<<0)>>>0}},L.M4={multVec:function(i,t){return[i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3],i[4]*t[0]+i[5]*t[1]+i[6]*t[2]+i[7]*t[3],i[8]*t[0]+i[9]*t[1]+i[10]*t[2]+i[11]*t[3],i[12]*t[0]+i[13]*t[1]+i[14]*t[2]+i[15]*t[3]]},dot:function(i,t){return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3]},sml:function(i,t){return[i*t[0],i*t[1],i*t[2],i*t[3]]}},L.encode.concatRGBA=function(i){let t=0;for(let r=0;r<i.length;r++)t+=i[r].byteLength;const e=new Uint8Array(t);let n=0;for(let r=0;r<i.length;r++){const s=new Uint8Array(i[r]),a=s.length;for(let o=0;o<a;o+=4){let h=s[o],l=s[o+1],c=s[o+2];const d=s[o+3];d===0&&(h=l=c=0),e[n+o]=h,e[n+o+1]=l,e[n+o+2]=c,e[n+o+3]=d}n+=a}return e.buffer};const cr=new Map,Pa=(i,t)=>{if(cr.has(i))return t(null,cr.get(i));const e=new Image;e.onload=function(){cr.set(i,{width:e.width,height:e.height,element:e}),t(null,cr.get(i))},e.onerror=function(n){t(n,null)},e.src=i},Ma=(i,t)=>{Pa(i,(e,n)=>{if(!n)return t(e,null);const r=document.createElement("canvas"),s=r.getContext("2d");return r.width=n.width,r.height=n.height,s.drawImage(n.element,0,0,r.width,r.height),s.getImageData(0,0,r.width,r.height)})},np=(i,t)=>{for(let e=0,n=i.length;e<n;e++){const r=i[e],{type:s}=r;if(s.split("/")[0]!=="image")return;let o;const h=new FileReader;h.onload=function(l){if(!l.target)return t("no reader target",null);const c=l.target.result;o=So(c);const f=new Blob([c]);Ra(f,(u,g)=>{if(!g)return t(u,null);Pa(g,(p,_)=>{if(!_)return t(p,null);Ma(g,(y,b)=>{if(!b)return t(y,null);const m={name:r.name,fileType:o,size:r.size,width:_.width,height:_.height,imgUrl:g,imageData:b,blob:f};return t(null,m)})})})},h.readAsArrayBuffer(r)}},rp=(i,t=0,e=0)=>{const n=document.createElement("canvas"),r=n.getContext("2d");return n.width=t,n.height=e,r.drawImage(i,0,0,t,e),r.getImageData(0,0,t,e)},sp=(i,t=0,e=0)=>{const n=document.createElement("canvas"),r=n.getContext("2d");return n.width=t,n.height=e,r.drawImage(i,0,0,t,e),r.getImageData(0,0,t,e)},ap=i=>{const t=i.width,e=i.height,n=t*e*3,r=n+54,s=[66,77,r&255,r>>8&255,r>>16&255,r>>24&255,0,0,0,0,54,0,0,0],a=[40,0,0,0,t&255,t>>8&255,t>>16&255,t>>24&255,e&255,e>>8&255,e>>16&255,e>>24&255,1,0,24,0,0,0,0,0,n&255,n>>8&255,n>>16&255,n>>24&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o=(4-t*3%4)%4,h=i.data;let l="";const c=t<<2;let d=e;const f=String.fromCharCode;do{const g=c*(d-1);let p="";for(let _=0;_<t;_++){const y=_<<2;p+=f(h[g+y+2])+f(h[g+y+1])+f(h[g+y])}for(let _=0;_<o;_++)p+=String.fromCharCode(0);l+=p}while(--d);function u(g){if(!window.btoa)throw"btoa undefined";let p="";if(typeof g=="string")p=g;else for(let _=0;_<g.length;_++)p+=String.fromCharCode(g[_]);return btoa(p)}return u(s.concat(a))+u(l)},op=i=>{const{width:t,height:e}=i,n=document.createElement("canvas"),r=n.getContext("2d");return n.width=t,n.height=e,r.putImageData(i,0,0,0,0,t,e),n.toDataURL("image/png")},lp=(i,t,e)=>{const{width:n,height:r}=i,s=document.createElement("canvas"),a=s.getContext("2d");s.width=n,s.height=r,a.putImageData(i,0,0,0,0,n,r);const o=`image/${t?t.toLowerCase():"png"}`;s.toBlob(h=>{e?.(null,h)},o,1)},Ra=(i,t)=>{const e=new FileReader;e.onload=function(n){n.target?t(null,n.target.result):t("can't readAsDataURL",null)},e.readAsDataURL(i)},hp=(i,t)=>{Ra(i,function(e,n){if(n){const r=new Image;r.src=n}else t(e)})};function cp(i,t){Ma(i,(e,n)=>{if(!n)return t(e,null);const r=n.data;let s=0;const a=[],o=[],h=[];for(let f=0;f<r.length;f+=4)a[s]=r[f],o[s]=r[f+1],h[s]=r[f+2],s+=1;const l=Da(a),c=Da(o),d=Da(h);return t(null,"rgb("+l+","+c+","+d+")")})}function Da(i){const t={},e=[],n=[];for(let o=0;o<i.length;o++)t[i[o]]?e.push(i[o]):t[i[o]]=1;let r=0;for(let o=0;o<e.length;o++){r=0;for(let h=0;h<e.length;h++)e[o]===e[h]&&(r+=1),n[o]=r}const s=Math.max.apply(null,n);let a=0;for(;a<n.length;a++)if(n[a]===s)return;return e[a]}const up=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[(a*e+e-o-1)*4],r[h+1]=t[(a*e+e-o-1)*4+1],r[h+2]=t[(a*e+e-o-1)*4+2],r[h+3]=t[(a*e+e-o-1)*4+3]}return new ImageData(r,e,n)},dp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[((n-a-1)*e+o)*4],r[h+1]=t[((n-a-1)*e+o)*4+1],r[h+2]=t[((n-a-1)*e+o)*4+2],r[h+3]=t[((n-a-1)*e+o)*4+3]}return new ImageData(r,e,n)},fp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<n;o++){const h=(a*n+o)*4;r[h]=t[(o*e+e-a-1)*4],r[h+1]=t[(o*e+e-a-1)*4+1],r[h+2]=t[(o*e+e-a-1)*4+2],r[h+3]=t[(o*e+e-a-1)*4+3]}return new ImageData(r,n,e)},gp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<n;o++){const h=(a*n+o)*4;r[h]=t[((n-o-1)*e+a)*4],r[h+1]=t[((n-o-1)*e+a)*4+1],r[h+2]=t[((n-o-1)*e+a)*4+2],r[h+3]=t[((n-o-1)*e+a)*4+3]}return new ImageData(r,n,e)},pp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h]+t[h+1]+t[h+2])/3;r[h]=l,r[h+1]=l,r[h+2]=l,r[h+3]=t[h+3]}return new ImageData(r,e,n)},mp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=.2126*t[h]+.7152*t[h+1]+.0722*t[h+2];r[h]=l,r[h+1]=l,r[h+2]=l,r[h+3]=t[h+3]}return new ImageData(r,e,n)},_p=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,c=(t[h]+t[h+1]+t[h+2])/3>127?255:0;r[h]=c,r[h+1]=c,r[h+2]=c,r[h+3]=t[h+3]}return new ImageData(r,e,n)},vp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=255-t[h],r[h+1]=255-t[h+1],r[h+2]=255-t[h+2],r[h+3]=t[h+3]}return new ImageData(r,e,n)},yp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[h],r[h+1]=0,r[h+2]=0,r[h+3]=t[h+3]}return new ImageData(r,e,n)},bp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=0,r[h+1]=t[h+1],r[h+2]=0,r[h+3]=t[h+3]}return new ImageData(r,e,n)},wp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=0,r[h+1]=0,r[h+2]=t[h+2],r[h+3]=t[h+3]}return new ImageData(r,e,n)},Sp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[h],r[h+1]=t[h+1],r[h+2]=0,r[h+3]=t[h+3]}return new ImageData(r,e,n)},Cp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[h],r[h+1]=0,r[h+2]=t[h+1],r[h+3]=t[h+3]}return new ImageData(r,e,n)},xp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=0,r[h+1]=t[h+1],r[h+2]=t[h+1],r[h+3]=t[h+3]}return new ImageData(r,e,n)},Tp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h+1]+t[h+2])/2;r[h]=t[h],r[h+1]=l,r[h+2]=l,r[h+3]=t[h+3]}return new ImageData(r,e,n)},Ep=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h]+t[h+2])/2;r[h]=l,r[h+1]=t[h+1],r[h+2]=l,r[h+3]=t[h+3]}return new ImageData(r,e,n)},kp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h]+t[h+1])/2;r[h]=l,r[h+1]=l,r[h+2]=t[h+2],r[h+3]=t[h+3]}return new ImageData(r,e,n)},Ap=i=>dc(i,[-1,-1,-1,-1,9,-1,-1,-1,-1]),Pp=i=>dc(i,[-1,-1,-1,-1,8,-1,-1,-1,-1]),Mp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[h],r[h+1]=t[h+1],r[h+2]=t[h+2],r[h+3]=255}return new ImageData(r,e,n)},Rp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;if(t[h+3]===0)r[h]=255,r[h+1]=255,r[h+2]=255,r[h+3]=255;else{const l=fc([t[h],t[h+1],t[h+2],t[h+3]],[255,255,255,255]);r[h]=l[0],r[h+1]=l[1],r[h+2]=l[2],r[h+3]=l[3]}}return new ImageData(r,e,n)},Dp=(i,t,e,n,r,s=!1,a)=>{const{data:o,width:h,height:l}=i;let c=r,d=n,f=t,u=e;if(c<0?c=0:c>h&&(c=h),d<0?d=0:d>l&&(d=l),f<1?f=1:f>h&&(f=h),u<1?u=1:u>l&&(u=l),c+f>h&&(f=h-c),d+u>l&&(u=l-d),s){const g=new Uint8ClampedArray(o.length);for(let _=0;_<l;_++)for(let y=0;y<h;y++){const b=(_*h+y)*4;y>=c&&y<=c+f&&_>=d&&_<=d+u?(g[b]=o[b],g[b+1]=o[b+1],g[b+2]=o[b+2],g[b+3]=o[b+3]):(g[b]=255,g[b+1]=255,g[b+2]=255,g[b+3]=a&&["JPG","JPEG"].includes(a.toUpperCase())?255:0)}return new ImageData(g,h,l)}else{const g=new Uint8ClampedArray(f*u*4);for(let _=d;_<=d+u;_++)for(let y=c;y<=c+f;y++){const b=((_-d)*f+y-c)*4,m=(_*h+y)*4;g[b]=o[m],g[b+1]=o[m+1],g[b+2]=o[m+2],g[b+3]=o[m+3]}return new ImageData(g,f,u)}},Lp=(i,t,e,n)=>{const{data:r,width:s,height:a}=i;let o=t;o>Math.floor(s/2)&&(o=Math.floor(s/2)),o>Math.floor(a/2)&&(o=Math.floor(a/2)),o<0&&(o=0);const h=new Uint8ClampedArray(r.length);for(let c=0;c<a;c++)for(let d=0;d<s;d++){const f=(c*s+d)*4;let u=-1;d<o?c<o?u=Math.sqrt(Math.pow(o-d-1,2)+Math.pow(o-c-1,2)):c>a-o-1&&(u=Math.sqrt(Math.pow(o-d-1,2)+Math.pow(c-(a-o),2))):d>s-o-1&&(c<o?u=Math.sqrt(Math.pow(d-(s-o),2)+Math.pow(o-c-1,2)):c>a-o-1&&(u=Math.sqrt(Math.pow(d-(s-o),2)+Math.pow(c-(a-o),2)))),Math.round(u)>o?(h[f]=255,h[f+1]=255,h[f+2]=255,h[f+3]=n||e.toUpperCase()==="PNG"?0:255):(h[f]=r[f],h[f+1]=r[f+1],h[f+2]=r[f+2],h[f+3]=n||e.toUpperCase()==="PNG"?r[f+3]:255)}return new ImageData(h,s,a)},Op=(i,t,e,n,r,s=1e4)=>{const a=new Image;a.src=i;const o=document.createElement("canvas"),h=o.getContext("2d");return o.width=s,o.height=s,h.drawImage(a,0,0,t,e,0,0,n,r),h.getImageData(0,0,n,r)},Ip=(i,t)=>{const{data:e,width:n,height:r}=i,s=new Uint8ClampedArray(e.length);for(let o=0;o<r;o++)for(let h=0;h<n;h++){const l=(o*n+h)*4;s[l]=Math.max(Math.min(e[l]+t,255),0),s[l+1]=Math.max(Math.min(e[l+1]+t,255),0),s[l+2]=Math.max(Math.min(e[l+2]+t,255),0),s[l+3]=e[l+3]}return new ImageData(s,n,r)},Fp=(i,t,e=!1)=>{const{data:n,width:r,height:s}=i,a=new Uint8ClampedArray(n.length);for(let h=0;h<s;h++)for(let l=0;l<r;l++){const c=(h*r+l)*4;n[c+3]===0?(a[c]=255,a[c+1]=255,a[c+2]=255):(a[c]=n[c],a[c+1]=n[c+1],a[c+2]=n[c+2]);let d=n[c+3];e?d=Math.max(Math.min(Math.floor(255*t),255),0):d=Math.max(Math.min(Math.floor(d+255*t),255),0),a[c+3]=d}return new ImageData(a,r,s)},Np=(i,t,e,n)=>{const{data:r,width:s,height:a}=i,{data:o,width:h,height:l}=t;let c=e,d=n;e+l>a&&(c=a-l),n+h>s&&(d=s-h);const f=new Uint8ClampedArray(r.length);for(let g=0;g<a;g++)for(let p=0;p<s;p++){const _=(g*s+p)*4;if(p<d||p>d+h||g<=c||g>=c+l)f[_]=r[_],f[_+1]=r[_+1],f[_+2]=r[_+2],f[_+3]=r[_+3];else{const y=(g*s+p-((c+1)*s+(g-(c+1))*(s-h))+h-d-1)*4,b=[o[y],o[y+1],o[y+2],o[y+3]],m=[r[_],r[_+1],r[_+2],r[_+3]],v=fc(b,m);f[_]=v[0],f[_+1]=v[1],f[_+2]=v[2],f[_+3]=v[3]}}return new ImageData(f,s,a)},Up=(i,t,e,n,r,s=10)=>{const{data:a,width:o,height:h}=i;let l=r,c=n,d=t,f=e;l<0?l=0:l>o&&(l=o),c<0?c=0:c>h&&(c=h),d<1?d=1:d>o&&(d=o),f<1?f=1:f>h&&(f=h),l+d>o&&(d=o-l),c+f>h&&(f=h-c);const u=new Uint8ClampedArray(a.length);for(let p=0;p<h;p++)for(let _=0;_<o;_++){const y=(p*o+_)*4;if(_>=l&&_<=l+d&&p>=c&&p<=c+f){const b=Math.floor((_-l)/s),m=Math.floor((p-c)/s);let v=Math.floor(s*(b+1)-s/2+l),w=Math.floor(s*(m+1)-s/2+c);v>o-1&&(v=o-1),w>h-1&&(w=h-1);const S=(w*o+v)*4;u[y]=a[S],u[y+1]=a[S+1],u[y+2]=a[S+2],u[y+3]=a[S+3]}else u[y]=a[y],u[y+1]=a[y+1],u[y+2]=a[y+2],u[y+3]=a[y+3]}return new ImageData(u,o,h)},Gp=async(i,t,e,n,r,s)=>{const a=r/100;if(["JPG","JPEG"].includes(n.toUpperCase())){const o=new Image;o.src=i;const h=document.createElement("canvas"),l=h.getContext("2d");h.width=t,h.height=e,l.drawImage(o,0,0,t,e),h.toBlob(c=>{s(c)},`image/${n.toLowerCase()}`,a)}else{const o=Math.floor(a*256),h=L.encode([i.data.buffer],t,e,o),l=new Blob([h]);s&&s(l)}},Bp=(i,t,e={backgroundColor:{r:0,g:0,b:0,a:255},changeIntoColor:{r:0,g:0,b:0,a:0}})=>{if(t&&e){const{data:n,width:r,height:s}=i,{data:a}=t,o=new Uint8ClampedArray(n.length),{backgroundColor:h,changeIntoColor:l}=e;for(let d=0;d<s;d++)for(let f=0;f<r;f++){const u=(d*r+f)*4,g=a[u],p=a[u+1],_=a[u+2],y=a[u+3];g===h.r&&p===h.g&&_===h.b&&y===h.a&&l.a!==0?(o[u]=l.r,o[u+1]=l.g,o[u+2]=l.b,o[u+3]=l.a):(o[u]=n[u],o[u+1]=n[u+1],o[u+2]=n[u+2],o[u+3]=n[u+3])}return new ImageData(o,r,s)}return i},dc=(i,t)=>{const{data:e,width:n,height:r}=i,s=new Uint8ClampedArray(e.length);for(let o=0;o<r;o++)for(let h=0;h<n;h++){const l=(o*n+h)*4;for(let c=0;c<3;c++){const d=l+c;h===0||h===n-1||o===0||o===r-1?s[d]=e[d]:s[d]=t[0]*e[d-n*4-4]+t[1]*e[d-n*4]+t[2]*e[d-n*4+4]+t[3]*e[d-4]+t[4]*e[d]+t[5]*e[d+4]+t[6]*e[d+n*4-4]+t[7]*e[d+n*4]+t[8]*e[d+n*4+4]}s[l+3]=e[l+3]}return new ImageData(s,n,r)},fc=(i,t)=>{if(i&&i.length===4&&t&&t.length===4){const e=i[3],n=t[3];if(e===255||n===0)return i;if(e===0)return t;{const r=e/255,s=n/255,a=Math.max(Math.min(Math.floor(i[0]*r+t[0]*s*(1-r)),255),0),o=Math.max(Math.min(Math.floor(i[1]*r+t[1]*s*(1-r)),255),0),h=Math.max(Math.min(Math.floor(i[2]*r+t[2]*s*(1-r)),255),0),l=Math.max(Math.min(Math.floor((r+s*(1-r))*255),255),0);return[a,o,h,l]}}return[255,255,255,255]},gc=function(i,t,e){const n=new Array(i*i),r=function(o){const h=o;let l=0,c=0;return{write(d,f){if(d>>>f)throw new Error("length over");for(;l+f>=8;)h.writeByte(255&(d<<l|c)),f-=8-l,d>>>=8-l,c=0,l=0;c=d<<l|c,l=l+f},flush(){l>0&&h.writeByte(c)}}},s=function(o){const h=1<<o,l=(1<<o)+1;let c=o+1;const d=a();for(let _=0;_<h;_++)d.add(String.fromCharCode(_));d.add(String.fromCharCode(h)),d.add(String.fromCharCode(l));const f=Co(),u=r(f);u.write(h,c);let g=0,p=String.fromCharCode(n[g]);for(g+=1;g<n.length;){const _=String.fromCharCode(n[g]);g+=1,d.contains(p+_)?p=p+_:(u.write(d.indexOf(p),c),d.size()<4095&&(d.size()==1<<c&&(c+=1),d.add(p+_)),p=_)}return u.write(d.indexOf(p),c),u.write(l,c),u.flush(),f.toByteArray()},a=function(){const o={};let h=0;return{add(l){if(this.contains(l))throw new Error("dup key:"+l);o[l]=h,h+=1},size(){return h},indexOf(l){return o[l]},contains(l){return typeof o[l]<"u"}}};return{setPixel(o,h,l){n[h*i+o]=l},write(o){o.writeString("GIF87a"),o.writeShort(i),o.writeShort(i),o.writeByte(128),o.writeByte(0),o.writeByte(0),o.writeByte(ui("0x"+t[1]+t[2])),o.writeByte(ui("0x"+t[3]+t[4])),o.writeByte(ui("0x"+t[5]+t[6])),o.writeByte(ui("0x"+e[1]+e[2])),o.writeByte(ui("0x"+e[3]+e[4])),o.writeByte(ui("0x"+e[5]+e[6])),o.writeString(","),o.writeShort(0),o.writeShort(0),o.writeShort(i),o.writeShort(i),o.writeByte(0);const h=2,l=s(h);o.writeByte(h);let c=0;for(;l.length-c>255;)o.writeByte(255),o.writeBytes(l,c,255),c+=255;o.writeByte(l.length-c),o.writeBytes(l,c,l.length-c),o.writeByte(0),o.writeString(";")}}},pc=function(i,t,e,n){const r=gc(i,t,e);for(let l=0;l<i;l++)for(let c=0;c<i;c++)r.setPixel(c,l,n(c,l));const s=Co();r.write(s);const a=ad(),o=s.toByteArray();for(let l=0,c=o.length;l<c;l++)a.writeByte(o[l]);a.flush();let h="";return h+="data:image/gif;base64,",h+=a,h},It={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},vn={M:0,L:1,H:2,Q:3},Me={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Et={glog:function(i){if(i<1)throw new Error("glog("+i+")");return Et.LOG_TABLE[i]},gexp:function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return Et.EXP_TABLE[i]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(let i=0;i<8;i++)Et.EXP_TABLE[i]=1<<i;for(let i=8;i<256;i++)Et.EXP_TABLE[i]=Et.EXP_TABLE[i-4]^Et.EXP_TABLE[i-5]^Et.EXP_TABLE[i-6]^Et.EXP_TABLE[i-8];for(let i=0;i<255;i++)Et.LOG_TABLE[Et.EXP_TABLE[i]]=i;const ut={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(i){let t=i<<10;for(;ut.getBCHDigit(t)-ut.getBCHDigit(ut.G15)>=0;)t^=ut.G15<<ut.getBCHDigit(t)-ut.getBCHDigit(ut.G15);return(i<<10|t)^ut.G15_MASK},getBCHTypeNumber:function(i){let t=i<<12;for(;ut.getBCHDigit(t)-ut.getBCHDigit(ut.G18)>=0;)t^=ut.G18<<ut.getBCHDigit(t)-ut.getBCHDigit(ut.G18);return i<<12|t},getBCHDigit:function(i){let t=0;for(;i!=0;)t++,i>>>=1;return t},getPatternPosition:function(i){return ut.PATTERN_POSITION_TABLE[i-1]},getMask:function(i,t,e){switch(i){case Me.PATTERN000:return(t+e)%2==0;case Me.PATTERN001:return t%2==0;case Me.PATTERN010:return e%3==0;case Me.PATTERN011:return(t+e)%3==0;case Me.PATTERN100:return(Math.floor(t/2)+Math.floor(e/3))%2==0;case Me.PATTERN101:return t*e%2+t*e%3==0;case Me.PATTERN110:return(t*e%2+t*e%3)%2==0;case Me.PATTERN111:return(t*e%3+(t+e)%2)%2==0;default:throw new Error("bad maskPattern:"+i)}},getErrorCorrectPolynomial:function(i){let t=new xi([1],0);for(let e=0;e<i;e++)t=t.multiply(new xi([1,Et.gexp(e)],0));return t},getLengthInBits:function(i,t){if(1<=t&&t<10)switch(i){case It.MODE_NUMBER:return 10;case It.MODE_ALPHA_NUM:return 9;case It.MODE_8BIT_BYTE:return 8;case It.MODE_KANJI:return 8;default:throw new Error("mode:"+i)}else if(t<27)switch(i){case It.MODE_NUMBER:return 12;case It.MODE_ALPHA_NUM:return 11;case It.MODE_8BIT_BYTE:return 16;case It.MODE_KANJI:return 10;default:throw new Error("mode:"+i)}else if(t<41)switch(i){case It.MODE_NUMBER:return 14;case It.MODE_ALPHA_NUM:return 13;case It.MODE_8BIT_BYTE:return 16;case It.MODE_KANJI:return 12;default:throw new Error("mode:"+i)}else throw new Error("type:"+t)},getLostPoint:function(i){const t=i.getModuleCount();let e=0;for(let s=0;s<t;s++)for(let a=0;a<t;a++){let o=0;const h=i.isDark(s,a);for(let l=-1;l<=1;l++)if(!(s+l<0||t<=s+l))for(let c=-1;c<=1;c++)a+c<0||t<=a+c||l==0&&c==0||h==i.isDark(s+l,a+c)&&o++;o>5&&(e+=3+o-5)}for(let s=0;s<t-1;s++)for(let a=0;a<t-1;a++){let o=0;i.isDark(s,a)&&o++,i.isDark(s+1,a)&&o++,i.isDark(s,a+1)&&o++,i.isDark(s+1,a+1)&&o++,(o==0||o==4)&&(e+=3)}for(let s=0;s<t;s++)for(let a=0;a<t-6;a++)i.isDark(s,a)&&!i.isDark(s,a+1)&&i.isDark(s,a+2)&&i.isDark(s,a+3)&&i.isDark(s,a+4)&&!i.isDark(s,a+5)&&i.isDark(s,a+6)&&(e+=40);for(let s=0;s<t;s++)for(let a=0;a<t-6;a++)i.isDark(a,s)&&!i.isDark(a+1,s)&&i.isDark(a+2,s)&&i.isDark(a+3,s)&&i.isDark(a+4,s)&&!i.isDark(a+5,s)&&i.isDark(a+6,s)&&(e+=40);let n=0;for(let s=0;s<t;s++)for(let a=0;a<t;a++)i.isDark(a,s)&&n++;const r=Math.abs(100*n/t/t-50)/5;return e+=r*10,e}};class xi{num;constructor(t,e){if(t.length==null)throw new Error(t.length+"/"+e);let n=0;for(;n<t.length&&t[n]==0;)n++;this.num=new Array(t.length-n+e);for(let r=0;r<t.length-n;r++)this.num[r]=t[r+n]}get(t){return this.num[t]}getLength(){return this.num.length}multiply(t){const e=new Array(this.getLength()+t.getLength()-1);for(let n=0;n<this.getLength();n++)for(let r=0;r<t.getLength();r++)e[n+r]^=Et.gexp(Et.glog(this.get(n))+Et.glog(t.get(r)));return new xi(e,0)}mod(t){if(this.getLength()-t.getLength()<0)return this;const e=Et.glog(this.get(0))-Et.glog(t.get(0)),n=new Array(this.getLength());for(let r=0;r<this.getLength();r++)n[r]=this.get(r);for(let r=0;r<t.getLength();r++)n[r]^=Et.gexp(Et.glog(t.get(r))+e);return new xi(n,0).mod(t)}}class he{totalCount;dataCount;constructor(t,e){this.totalCount=t,this.dataCount=e}static RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];static getRSBlocks(t,e){const n=he.getRsBlockTable(t,e);if(n==null)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);const r=n.length/3,s=[];for(let a=0;a<r;a++){const o=n[a*3+0],h=n[a*3+1],l=n[a*3+2];for(let c=0;c<o;c++)s.push(new he(h,l))}return s}static getRsBlockTable(t,e){switch(e){case vn.L:return he.RS_BLOCK_TABLE[(t-1)*4+0];case vn.M:return he.RS_BLOCK_TABLE[(t-1)*4+1];case vn.Q:return he.RS_BLOCK_TABLE[(t-1)*4+2];case vn.H:return he.RS_BLOCK_TABLE[(t-1)*4+3];default:return}}}class mc{buffer;length;constructor(){this.buffer=[],this.length=0}get(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)==1}put(t,e){for(let n=0;n<e;n++)this.putBit((t>>>e-n-1&1)==1)}getLengthInBits(){return this.length}putBit(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}}class zp{mode;data;constructor(t){this.mode=It.MODE_8BIT_BYTE,this.data=t}getLength(){return this.data.length}write(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data.charCodeAt(e),8)}}class Re{static PAD0=236;static PAD1=17;typeNumber;errorCorrectLevel;modules;moduleCount;dataCache;dataList;constructor(t,e){this.typeNumber=t,this.errorCorrectLevel=vn[e],this.modules=[],this.moduleCount=0,this.dataCache=null,this.dataList=[]}addData(t){const e=new zp(t);this.dataList.push(e),this.dataCache=null}isDark(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]}getModuleCount(){return this.moduleCount}make(){if(this.typeNumber<1){let t=1;for(t=1;t<40;t++){const e=he.getRSBlocks(t,this.errorCorrectLevel),n=new mc;let r=0;for(let s=0;s<e.length;s++)r+=e[s].dataCount;for(let s=0;s<this.dataList.length;s++){const a=this.dataList[s];n.put(a.mode,4),n.put(a.getLength(),ut.getLengthInBits(a.mode,t)),a.write(n)}if(n.getLengthInBits()<=r*8)break}this.typeNumber=t}this.makeImpl(!1,this.getBestMaskPattern())}makeImpl(t,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(let n=0;n<this.moduleCount;n++){this.modules[n]=new Array(this.moduleCount);for(let r=0;r<this.moduleCount;r++)this.modules[n][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=Re.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)}setupPositionProbePattern(t,e){for(let n=-1;n<=7;n++)if(!(t+n<=-1||this.moduleCount<=t+n))for(let r=-1;r<=7;r++)e+r<=-1||this.moduleCount<=e+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[t+n][e+r]=!0:this.modules[t+n][e+r]=!1)}getBestMaskPattern(){let t=0,e=0;for(let n=0;n<8;n++){this.makeImpl(!0,n);const r=ut.getLostPoint(this);(n==0||t>r)&&(t=r,e=n)}return e}createMovieClip(t,e,n){const r=t.createEmptyMovieClip(e,n),s=1;this.make();for(let a=0;a<this.modules.length;a++){const o=a*s;for(let h=0;h<this.modules[a].length;h++){const l=h*s;this.modules[a][h]&&(r.beginFill(0,100),r.moveTo(l,o),r.lineTo(l+s,o),r.lineTo(l+s,o+s),r.lineTo(l,o+s),r.endFill())}}return r}setupTimingPattern(){for(let t=8;t<this.moduleCount-8;t++)this.modules[t][6]==null&&(this.modules[t][6]=t%2==0);for(let t=8;t<this.moduleCount-8;t++)this.modules[6][t]==null&&(this.modules[6][t]=t%2==0)}setupPositionAdjustPattern(){const t=ut.getPatternPosition(this.typeNumber);for(let e=0;e<t.length;e++)for(let n=0;n<t.length;n++){const r=t[e],s=t[n];if(this.modules[r][s]==null)for(let a=-2;a<=2;a++)for(let o=-2;o<=2;o++)a==-2||a==2||o==-2||o==2||a==0&&o==0?this.modules[r+a][s+o]=!0:this.modules[r+a][s+o]=!1}}setupTypeNumber(t){const e=ut.getBCHTypeNumber(this.typeNumber);for(let n=0;n<18;n++){const r=!t&&(e>>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(let n=0;n<18;n++){const r=!t&&(e>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}}setupTypeInfo(t,e){const n=this.errorCorrectLevel<<3|e,r=ut.getBCHTypeInfo(n);for(let s=0;s<15;s++){const a=!t&&(r>>s&1)==1;s<6?this.modules[s][8]=a:s<8?this.modules[s+1][8]=a:this.modules[this.moduleCount-15+s][8]=a}for(let s=0;s<15;s++){const a=!t&&(r>>s&1)==1;s<8?this.modules[8][this.moduleCount-s-1]=a:s<9?this.modules[8][15-s-1+1]=a:this.modules[8][15-s-1]=a}this.modules[this.moduleCount-8][8]=!t}mapData(t,e){let n=-1,r=this.moduleCount-1,s=7,a=0;for(let o=this.moduleCount-1;o>0;o-=2)for(o==6&&o--;;){for(let h=0;h<2;h++)if(this.modules[r][o-h]==null){let l=!1;a<t.length&&(l=(t[a]>>>s&1)==1),ut.getMask(e,r,o-h)&&(l=!l),this.modules[r][o-h]=l,s--,s==-1&&(a++,s=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}}static createData(t,e,n){const r=he.getRSBlocks(t,e),s=new mc;for(let o=0;o<n.length;o++){const h=n[o];s.put(h.mode,4),s.put(h.getLength(),ut.getLengthInBits(h.mode,t)),h.write(s)}let a=0;for(let o=0;o<r.length;o++)a+=r[o].dataCount;if(s.getLengthInBits()>a*8)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+a*8+")");for(s.getLengthInBits()+4<=a*8&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=a*8||(s.put(Re.PAD0,8),s.getLengthInBits()>=a*8));)s.put(Re.PAD1,8);return Re.createBytes(s,r)}static createBytes(t,e){let n=0,r=0,s=0;const a=new Array(e.length),o=new Array(e.length);for(let d=0;d<e.length;d++){const f=e[d].dataCount,u=e[d].totalCount-f;r=Math.max(r,f),s=Math.max(s,u),a[d]=new Array(f);for(let y=0;y<a[d].length;y++)a[d][y]=255&t.buffer[y+n];n+=f;const g=ut.getErrorCorrectPolynomial(u),_=new xi(a[d],g.getLength()-1).mod(g);o[d]=new Array(g.getLength()-1);for(let y=0;y<o[d].length;y++){const b=y+_.getLength()-o[d].length;o[d][y]=b>=0?_.get(b):0}}let h=0;for(let d=0;d<e.length;d++)h+=e[d].totalCount;const l=new Array(h);let c=0;for(let d=0;d<r;d++)for(let f=0;f<e.length;f++)d<a[f].length&&(l[c++]=a[f][d]);for(let d=0;d<s;d++)for(let f=0;f<e.length;f++)d<o[f].length&&(l[c++]=o[f][d]);return l}}const _c=Math.ceil,yn=Math.floor,vc=Math.round;function Hp(i,t){const e=wo(i),n=t?.ecc||"H",r=t?.size||256,s=-1,a=t?.padding||0,o=t?.color||"#000000",h=t?.background||"#ffffff",l=new Re(s,n);l.addData(e),l.make();const c=l.getModuleCount(),d=(r-a*2)/c,f=a,u=r-a;return pc(r,o,h,function(g,p){if(f<=g&&g<u&&f<=p&&p<u){const _=yn((g-f)/d),y=yn((p-f)/d);return l.isDark(y,_)?0:1}else return 1})}function jp(i,t){const e=t.x||0,n=t.y||0,r=wo(i),s=t.ctx,a=t.ecc||"H",o=typeof t.size=="number"?yn(t.size):256,h=t.padding||0,l=-1,c=t.color||"#000000",d=t.background||"#ffffff",f=new Re(l,a);f.addData(r),f.make();const u=f.getModuleCount(),g=(o-h*2)/u;s.fillStyle=d,s.fillRect(e,n,o,o);for(let p=0;p<u;p++)for(let _=0;_<u;_++){const y=_c((_+1)*g)-yn(_*g),b=_c((p+1)*g)-yn(p*g);s.fillStyle=f.isDark(p,_)?c:d,s.fillRect(e+vc(_*g)+h,n+vc(p*g)+h,y,b)}}function yc(){let i=null;if(window.ActiveXObject){const t=["Microsoft.XMLHTTP","MSXML6.XMLHTTP","MSXML5.XMLHTTP","MSXML4.XMLHTTP","MSXML3.XMLHTTP","MSXML2.XMLHTTP","MSXML.XMLHTTP"];for(let e=0;e<t.length;e++)try{i=new window.ActiveXObject(t[e]);break}catch{continue}}else i=new XMLHttpRequest;return i}function Vp(i){if(!i.action)return;const t=i.method.toLowerCase()==="get",e=i.method.toLowerCase()==="post";let n=i.action,r=null;const s="---------------------------"+Date.now().toString(16);if(window.FormData)r=new FormData(i),t&&(n=Ks(n,Ul(r)));else if(t){let a="";for(let o=0;o<i.elements.length;o++){const h=i.elements[o];if(!h.hasAttribute("name"))continue;const l=h.nodeName.toUpperCase()==="INPUT"?h.getAttribute("type").toUpperCase():"TEXT";if(l==="FILE")for(let c=0;c<h.files.length;a+="&"+encodeURIComponent(h.name)+"="+encodeURIComponent(h.files[c++].name));else(l!=="RADIO"&&l!=="CHECKBOX"||h.checked)&&(a+="&"+encodeURIComponent(h.name)+"="+encodeURIComponent(h.value))}n=Ks(n,a)}else if(e){let a=[];if(i.enctype==="application/x-www-form-urlencoded"){for(let o=0;o<i.elements.length;o++){const h=i.elements[o];h.hasAttribute("name")&&a.push(encodeURIComponent(h.name)+"="+encodeURIComponent(h.value))}r=a.join()}else if(i.enctype==="text/plain"){for(let o=0;o<i.elements.length;o++){const h=i.elements[o];h.hasAttribute("name")&&a.push(h.name+"="+h.value)}r=a.join(`\r
|
|
15
|
-
`)}else if(i.enctype==="multipart/form-data"){for(let o=0;o<i.elements.length;o++){const
|
|
14
|
+
})`}static safeHtml(t,e="encode"){const n={"&":"&","<":"<",">":">",""":'"',"'":"'"};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t=t.replace(new RegExp(e=="decode"?r:n[r],"g"),e=="decode"?n[r]:r));return t}static loadScript(t){const e=document.createElement("script");e.type="text/javascript",e.src=t,e.async=!1,document.body.appendChild(e),e.onload=()=>{},e.onerror=()=>{}}static loadStyle(t){const e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.insertBefore(e,document.head.childNodes[document.head.childNodes.length-1].nextSibling)}static waitForStyleSheetsLoaded=()=>new Promise(t=>{const e=Array.from(document.querySelectorAll("link[rel=stylesheet]"));let n=document.styleSheets.length??0;const r=()=>n>=e.length?(t(),!0):!1;r()||e.forEach(s=>{s.onload=()=>{n+=1,r()}})});static lazyloadImages(){const t=document.getElementsByTagName("img"),e=sa().height;let n=0;return()=>{for(let r=n;r<t.length;r++)t[r].getBoundingClientRect().top<e&&(t[r].src=t[r].getAttribute("data-src")??"",n=r+1)}}static iframePostMessage(t,e="http://test.com/localstorage.html"){const n=document.createElement("iframe");n.src=e,document.body.append(n),setTimeout(function(){n.contentWindow?.postMessage(t,e)},4e3),setTimeout(function(){n.remove()},6e3)}static getTextWidth=(t,e,n=400)=>{const r=document.createElement("span");r.style.visibility="hidden",r.style.padding="0",r.style.whiteSpace="nowrap",r.style.overflow="visible",r.style.fontSize=e>12?e+"px":"12px",r.style.fontWeight=n.toString(),r.innerText=t,document.body.appendChild(r);const s=r.offsetWidth;return document.body.removeChild(r),s};static getFixedWidthText=(t,e,n=12,r=400,s=!0)=>{let a="",o="",l="";if(!t||e<n||typeof t!="string")return a;const h=t.split(""),c=document.createElement("span");c.style.visibility="hidden",c.style.padding="0",c.style.whiteSpace="nowrap",c.style.overflow="visible",c.style.fontSize=n>12?n+"px":"12px",c.style.fontWeight=r.toString(),document.body.appendChild(c);for(let d=0,f=h.length;d<f;d++){const u=h[d];if(o=l,l+=u,a=l,c.innerText=l,c.offsetWidth>e){s?a=o+"...":a=o;break}}return document.body.removeChild(c),a};static getLocation(){return new Promise((t,e)=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(n=>{t(n.coords)}):e("Geolocation is not supported by this browser")})}static vibrate(t=200){"vibrate"in navigator?window.navigator.vibrate(t):console.error("Your device is not support vibrate on this browser.")}static copyToClipboard=t=>navigator.clipboard.writeText(t);static getSelectedText=()=>window.getSelection()?.toString();static siblings=t=>Array.prototype.slice.call(t.parentNode?.children).filter(e=>e!==t);static isElementFocus=t=>t===document.activeElement;static isTabInView=()=>!document.hidden;static navigateBack=()=>history.back();static navigateBack2=()=>history.go(-1)}function Kc(i,t=document){return new me(i,t)}class me{context;nodes;prefixs=["moz","o","ms","webkit"];constructor(t,e=document){if(this.context=e,typeof t=="string"?this.nodes=Array.from(this.context.querySelectorAll(t)):t instanceof HTMLElement?this.nodes=[t]:this.nodes=t,this.nodes.length===0)throw new Error(`can not find ${t}`)}get(t){return this.nodes[t]}concat(t){return new me(this.nodes.concat(t.nodes),this.context)}then(t){return t(this)??this}each(t){return this.nodes.forEach((e,n)=>{t(e,n)}),this}on(t,e,n){return this.nodes.forEach(r=>{r.addEventListener(t,e,n)}),this}off(t,e,n){return this.nodes.forEach(r=>{r.removeEventListener(t,e,n)}),this}dispatchEvent(t,e){let n;const r=["click","dblclick","mousedown","mouseup","mousemove"],s=["keydown","keyup","keypress"];return typeof t=="string"?r.includes(t)?n=new MouseEvent(t,e):s.includes(t)?n=new KeyboardEvent(t,e):n=new Event(t,e):n=t,this.nodes.forEach(a=>{a.dispatchEvent(n)}),this}change(){return this.dispatchEvent("change")}click(){return this.dispatchEvent("click")}static hasEvent(t,e){return"on"+e in t}static _fragment(t){const e=document.createElement("template");return e.innerHTML=t,e.content.childNodes.forEach(n=>{const r=me._scriptConvert(n);r!=n&&e.content.replaceChild(r,n)}),e.content}static _scriptConvert(t){const e=n=>{const s=n.ownerDocument.createElement("script");s.text=n.text;const a=n.attributes;for(let o=0;o<a.length;o++)s.setAttribute(a[o].name,a[o].value);return s};return t.tagName=="SCRIPT"&&(t=e(t)),t.querySelectorAll&&t.querySelectorAll("script").forEach(n=>{n.parentNode?.replaceChild(e(n),n)}),t}static _fixProp(t){const e={cellpadding:"cellPadding",cellspacing:"cellSpacing",class:"className",colspan:"colSpan",contenteditable:"contentEditable",for:"htmlFor",frameborder:"frameBorder",maxlength:"maxLength",readonly:"readOnly",rowspan:"rowSpan",tabindex:"tabIndex",usemap:"useMap"};return e[t]?e[t]:t}static isSVG(t){return(t||document.documentElement).nodeName.toLowerCase()==="svg"}static createElement(t){return me.isSVG()?document.createElementNS.call(document,"http://www.w3.org/2000/svg",t):document.createElement.call(document,t)}static createTextNode(t){return document.createTextNode.call(document,t)}static createDocumentFragment(){return document.createDocumentFragment.call(document)}_insert(t,e){return this.nodes.forEach(n=>{n[t](me._fragment(e))}),this}append(t){return this._insert("append",t)}prepend(t){return this._insert("prepend",t)}after(t){return this._insert("after",t)}before(t){return this._insert("before",t)}replace(t){return this._insert("replaceWith",t)}remove(){return this.nodes.forEach(t=>{t.remove()}),this}static removeChild(t){t.parentElement?.removeChild(t)}find(t){const e=[];return this.nodes.forEach(n=>{e.push(...Array.from(n.querySelectorAll(t)))}),new me(e,this.context)}filter(t){const e=[];return this.nodes.forEach(n=>{n.matches&&n.matches(t)&&e.push(n)}),new me(e,this.context)}next(){const t=[];return this.nodes.forEach(e=>{const n=e.nextElementSibling;n&&t.push(n)}),new me(t,this.context)}prev(){const t=[];return this.nodes.forEach(e=>{const n=e.previousElementSibling;n&&t.push(n)}),new me(t,this.context)}closest(t){const e=[];return this.nodes.forEach(n=>{const r=n.closest(t);r&&e.push(r)}),new me(e,this.context)}shadow(t){const e=[];this.nodes.forEach(r=>{r.shadowRoot&&e.push(r.shadowRoot)});const n=new me(e,this.context);return t!==void 0?n.find(t):n}parent(t){return this.parents(t,!0)}parents(t,e=!1){const n=[],r=a=>{if(n.indexOf(a)==-1&&n.push(a),!e&&a.parentElement)return r(a.parentElement)};this.nodes.forEach(a=>{a.parentElement&&r(a.parentElement)});const s=new me(n,this.context);return t!==void 0?s.filter(t):s}static getComputedStyle(t,e,n){let r;const s=t.style.getPropertyPriority(e);return"getComputedStyle"in window?(r=getComputedStyle.call(window,t,n),r=r.getPropertyValue(e)):r=t.style.getPropertyValue(e),r+(s?"!"+s:"")}css(t,e){if((t===void 0||typeof t=="string")&&e===void 0){const n=this.nodes[0].style;if(typeof t=="string"){const r=n.getPropertyPriority(t);return n.getPropertyValue(t)+(r?"!"+r:"")}else return Object.fromEntries(this.nodes[0].style.cssText.split(";").filter(r=>!!r).map(r=>r.split(":").map(s=>s.trim())))}else{let n={};return typeof t=="string"&&e!==void 0?n[t]=e:typeof t=="object"&&(n=t),this.nodes.forEach(r=>{Object.keys(n).forEach(s=>{const a=String(n[s]).toLowerCase().includes("!important")?"important":"";r.style.setProperty(s,String(n[s]).replace(/!important/i,""),a)})}),this}}addClass(t){return this.toggleClass(t,!0)}removeClass(t){return this.toggleClass(t,!1)}toggleClass(t,e){const n=t.split(/[,\s]+/);return this.nodes.forEach(r=>{n.forEach(s=>{if(s.trim()!==""){let a="toggle";e!==void 0&&(a=e?"add":"remove"),r.classList[a](s.trim())}})}),this}hasClass(t){const e=t.split(/[,\s]+/);let n=!1;return this.nodes.forEach(r=>{n=n||e.every(s=>Array.from(r.classList??[]).includes(s.trim()))}),n}attr(t,e){if(e===void 0&&typeof t=="string")return this.nodes[0].getAttribute(t);let n={};return typeof t=="object"?n=t:e!==void 0&&(n[t]=e),this.nodes.forEach(r=>{Object.entries(n).forEach(([s,a])=>{r.setAttribute(s,a)})}),this}removeAttr(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(n=>{e.forEach(r=>{n.removeAttribute(r)})}),this}prop(t,e){if(e===void 0&&typeof t=="string")return this.nodes[0][t];{let n={};return typeof t=="object"?n=t:typeof t=="string"&&e!==void 0&&(n[t]=e),this.nodes.forEach(r=>{Object.entries(n).forEach(([s,a])=>{const o=me._fixProp(s);r[o]=a,o=="innerHTML"&&me._scriptConvert(r)})}),this}}removeProp(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(n=>{e.forEach(r=>{delete n[me._fixProp(r)]})}),this}changeSelected(t){this.nodes.forEach(e=>{if(e instanceof HTMLSelectElement){const n=e.options;for(let r=0,s=n.length;r<s;r++)n[r].value==t?n[r].selected=!0:n[r].selected=!1}})}changeChecked(t){this.nodes.forEach(e=>{e instanceof HTMLInputElement&&(e.value==t?e.checked=!0:e.checked=!1)})}data(t,e){if(typeof t=="string"&&t.indexOf("-")!=-1)throw new Error(`Key "${t}" contains "-" (dash). Dashes are not allowed in property names. Use camelCase instead.`);if((typeof t=="string"||t===void 0)&&e===void 0){const n=Object.assign({},this.nodes[0].dataset);return Object.keys(n).forEach(r=>{if(n[r]?.startsWith("[")||n[r]?.startsWith("{"))try{n[r]=JSON.parse(n[r]??"")}catch{}}),typeof t=="string"?n[t]:n}else{let n={};return typeof t=="object"?n=t:typeof t=="string"&&(n[t]=e),this.nodes.forEach(r=>{Object.entries(n).forEach(([s,a])=>{a!=null?r.dataset[s]=a instanceof Object?JSON.stringify(a):a:delete r.dataset[s]})}),this}}removeData(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(n=>{e.forEach(r=>{delete n.dataset[r]})}),this}show(){return this.toggle(!0)}hide(){return this.toggle(!1)}toggle(t){return this.nodes.forEach(e=>{const n=e.style.display,r=getComputedStyle(e).display,s=n=="none"||r=="none";if(s&&(t===void 0||t===!0)){const a=e instanceof HTMLTableRowElement?"table-row":e instanceof HTMLTableCellElement?"table-cell":"block";e.style.display=a}!s&&(t==null||t===!1)&&e.style.setProperty("display","none")})}empty(){return this.html("")}html(t){return t instanceof HTMLElement?this.empty().append(t.innerHTML):this.prop("innerHTML",t)}text(t){return this.prop("textContent",t)}val(t){return this.prop("value",t)}}class oa{isMacOS=jc();constructor(){}capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}getFormatKeys(t){const e=[];return t.ctrl&&e.push(this.isMacOS?"Cmd":"Ctrl"),t.shift&&e.push(this.isMacOS?"Option":"Shift"),t.alt&&e.push("Alt"),typeof t.key=="string"?e.push(this.capitalize(t.key)):Array.isArray(t.key)&&(t.key.map(n=>this.capitalize(n)),e.push(...t.key)),e}matchKeyScheme(t,e){const n=t.ctrl??!1,r=t.shift??!1,s=t.alt??!1;if(t.exact)return(n===e.metaKey||n===e.ctrlKey)&&r===e.shiftKey&&s===e.altKey;const a=[];return n&&a.push(n===e.metaKey||n===e.ctrlKey),r&&a.push(r===e.shiftKey),s&&a.push(s===e.altKey),a.every(o=>o)}on(t,e){const n=t?.target??window;if(t?.key===void 0||t?.key===null)return e;const r=this.getFormatKeys(t);let s=!1;const a=o=>{if(o.stopPropagation(),!s&&o.key!=="Control"&&o.key!=="Shift"&&o.key!=="Alt"&&r.find(l=>l.toLowerCase()===o.key.toLowerCase())&&this.matchKeyScheme(t,o)){o.preventDefault();const l=e();if(typeof l!="function")return;const h=c=>{c.preventDefault(),l(),n.removeEventListener("keyup",h)};n.addEventListener("keyup",h)}};return n.addEventListener("keydown",a),e.keys=r,e.title=t?.title??"",e.pause=()=>s=!0,e.unpause=()=>s=!1,e.removeListener=()=>n.removeEventListener("keydown",a),e}static getKeyCode(t){const e=t.code||(t.keyCode||t.charCode).toString();return{code:e,key:t.key.toLowerCase()||oa.codeKeys[e]}}static codeKeys={8:"backspace",9:"tab",13:"enter",15:"command",16:"shift",17:"ctrl",18:"alt",19:"pause_break",20:"caps_lock",21:"numpad",27:"escape",32:"spacebar",33:"page_up",34:"page_down",35:"end",36:"home",37:"left_arrow",38:"up_arrow",39:"right_arrow",40:"down_arrow",45:"insert",46:"delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",91:"left_window_key",92:"right_window_key",93:"select_key",96:"numpad_0",97:"numpad_1",98:"numpad_2",99:"numpad_3",100:"numpad_4",101:"numpad_5",102:"numpad_6",103:"numpad_7",104:"numpad_8",105:"numpad_9",106:"multiply",107:"add",109:"subtract",110:"decimal_point",111:"divide",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",124:"f13",125:"f14",126:"f15",144:"num_lock",145:"scroll_lock",186:"semi_colon",187:"equal_sign",188:"comma",189:"dash",190:"period",191:"forward_slash",192:"grave_accent",219:"open_bracket",220:"back_slash",221:"close_braket",222:"single_quote"}}class No{static clickEvent=typeof document<"u"&&document.ontouchstart?"touchstart":"click";static captureMouse(t){const e={x:0,y:0,isMouseDown:!1},n=a=>{e.isMouseDown=!0,document.addEventListener("mouseup",r,!1),t.style.userSelect="none",t.style.webkitUserSelect=""},r=a=>{e.x=0,e.y=0,e.isMouseDown=!1,document.removeEventListener("mouseup",r,!1),t.style.userSelect="",t.style.webkitUserSelect=""},s=a=>{const o=aa(t,a);e.x=o.x,e.y=o.y};return t.addEventListener("mousedown",n,!1),document.addEventListener("mousemove",s,!1),e}static captureTouch(t){const e={x:0,y:0,isMouseDown:!1},n=a=>{a.preventDefault(),e.isMouseDown=!0},r=a=>{e.x=0,e.y=0,e.isMouseDown=!1},s=a=>{const o=a.changedTouches[0],l=aa(t,o);e.x=l.x,e.y=l.y};return t.addEventListener("touchstart",n,!1),t.addEventListener("touchend",r,!1),t.addEventListener("touchcancel",r,!1),t.addEventListener("touchmove",s,!1),e}static capturePointer(t){const e={x:0,y:0,isMouseDown:!1},n=a=>{e.isMouseDown=!0,t.setPointerCapture(a.pointerId),t.style.userSelect="none",t.style.webkitUserSelect=""},r=a=>{e.x=0,e.y=0,e.isMouseDown=!1,t.style.userSelect="",t.style.webkitUserSelect=""},s=a=>{const o=aa(t,a);e.x=o.x,e.y=o.y};return t.addEventListener("pointerdown",n,!1),t.addEventListener("pointerup",r,!1),t.addEventListener("pointercancel",r,!1),t.addEventListener("pointermove",s,!1),e}static getMouseButton(t){if(document.implementation.hasFeature("MouseEvents","2.0"))return t.button;switch(t.button){case 0:case 1:case 3:case 5:case 7:return 0;case 2:case 6:return 2;case 4:return 1}}}function Uo(i,t){if(typeof t<"u")window.localStorage.setItem(i,t);else return window.localStorage.getItem(i)??void 0}function F2(i,t,e){const n=new Date;n.setTime(n.getTime()+e*24*60*60*1e3);const r="expires="+n.toUTCString();document.cookie=i+"="+t+"; "+r}function N2(i){const t=i+"=",e=document.cookie.split(";");for(let n=0,r=e.length;n<r;n++){const s=e[n].trim();if(s.indexOf(t)==0)return s.substring(t.length,s.length)}return""}const U2=()=>document.cookie.split(";").map(i=>i.split("=")).reduce((i,[t,e])=>(i[t.trim().replace('"',"")]=e,i),{}),B2=()=>document.cookie.split(";").forEach(i=>document.cookie=i.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`));class G2{static theme(t){return t=t||Uo("theme"),typeof t>"u"&&(t=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Uo("theme",t),document.documentElement.classList.toggle("dark",t==="dark"),t}static has(t){return window.matchMedia(t).matches||!1}static on(t,e){window.matchMedia(t).addEventListener("change",e)}static off(t,e){window.matchMedia(t).removeEventListener("change",e)}}class $2{static addEventListener(t,e,n){t.addEventListener(e,n,!1)}static removeEventListener(t,e,n){t.removeEventListener(e,n,!1)}static getTarget(t){return t.target||t.srcElement}}class z2{static setPageVerticalScrollPercent(t,e="width"){const n=Kc(t);n.css("transition","all linear 30ms");const{clientHeight:r}=ra(),{scrollTop:s,scrollHeight:a}=Sn(),o=a-r,l=o<=0?0:s/o*100;n.css(e,l+"%")}static pullDownRefresh(t,e,n=50){let r=0,s=0;t.addEventListener("touchstart",function(a){r=a.touches[0].pageY,t.style.position="relative",t.style.transition="transform 0s"},!1),t.addEventListener("touchmove",function(a){s=a.touches[0].pageY-r,s>0&&s<n&&(t.style.transform="translateY("+s+"px)")},!1),t.addEventListener("touchend",function(a){t.style.transition="transform 0.5s ease 1s",t.style.transform="translateY(0px)",s>=n&&e()},!1)}static pullUpLoading(t,e=50){const{clientHeight:n}=ra(),{scrollTop:r,scrollHeight:s}=Sn();r+n>=s-e&&t()}static scrollTo=(t={x:0,y:0})=>window.scrollTo(t.x,t.y)}class Kt{static version=.8;constructor(t,e){this.context=e??document;let n=[];if(Array.isArray(t))n=t;else if(t instanceof Node||t instanceof Window)n=[t];else if(t instanceof Kt)n=t.nodes;else if(typeof t=="string"){if(typeof this.context.querySelector!="function")throw new Error("Invalid context");n=Array.from(this.context.querySelectorAll(t))}else if(t==null)n=[];else{let r=Array.from(t??[]);if(typeof t=="object"&&Array.isArray(r))n=r;else throw new Error(`Invalid selector "${t}"`)}this.nodes=n,this.length=n.length,this.each((r,s)=>{this[s]=r})}static _fragment(t){let e=document.createElement("template");return e.innerHTML=t,e.content.childNodes.forEach(n=>{let r=Kt._scriptConvert(n);r!=n&&e.content.replaceChild(r,n)}),e.content}static _scriptConvert(t){let e=n=>{let s=n.ownerDocument.createElement("script");s.text=n.text;let a=n.attributes;for(let o=0;o<a.length;o++)s.setAttribute(a[o].name,a[o].value);return s};return t.tagName=="SCRIPT"&&(t=e(t)),t.querySelectorAll&&t.querySelectorAll("script").forEach(n=>{n.parentNode.replaceChild(e(n),n)}),t}static _fixProp(t){let e={cellpadding:"cellPadding",cellspacing:"cellSpacing",class:"className",colspan:"colSpan",contenteditable:"contentEditable",for:"htmlFor",frameborder:"frameBorder",maxlength:"maxLength",readonly:"readOnly",rowspan:"rowSpan",tabindex:"tabIndex",usemap:"useMap"};return e[t]?e[t]:t}_insert(t,e){let n=[],r=this.length;if(r<1)return;let s=this;if(typeof e=="string")this.each(a=>{let o=Kt._fragment(e);n.push(...o.childNodes),a[t](o)});else if(e instanceof Kt){let a=r==1;e.each(o=>{this.each(l=>{let h=a?o:o.cloneNode(!0);n.push(h),l[t](h),Kt._scriptConvert(h)})}),a||e.remove()}else if(e instanceof Node)this.each(a=>{let o=r===1?e:Kt._fragment(e.outerHTML);n.push(...r===1?[e]:o.childNodes),a[t](o)}),r>1&&e.remove();else throw new Error(`Incorrect argument for "${t}(html)". It expects one string argument.`);return t=="replaceWith"&&(s=new Kt(n,this.context)),s}_save(t,e,n){t._mQuery=t._mQuery??{},Array.isArray(n)?(t._mQuery[e]=t._mQuery[e]??[],t._mQuery[e].push(...n)):n!=null?t._mQuery[e]=n:delete t._mQuery[e]}get(t){t<0&&(t=this.length+t);let e=this[t];return e||(t!=null?null:this.nodes)}eq(t){t<0&&(t=this.length+t);let e=[this[t]];return e[0]==null&&(e=[]),new Kt(e,this.context)}then(t){let e=t(this);return e??this}find(t){let e=[];return this.each(n=>{let r=Array.from(n.querySelectorAll(t));r.length>0&&e.push(...r)}),new Kt(e,this.context)}filter(t){let e=[];return this.each(n=>{(n===t||typeof t=="string"&&n.matches&&n.matches(t)||typeof t=="function"&&t(n))&&e.push(n)}),new Kt(e,this.context)}next(){let t=[];return this.each(e=>{let n=e.nextElementSibling;n&&t.push(n)}),new Kt(t,this.context)}prev(){let t=[];return this.each(e=>{let n=e.previousElementSibling;n&&t.push(n)}),new Kt(t,this.context)}shadow(t){let e=[];this.each(r=>{r.shadowRoot&&e.push(r.shadowRoot)});let n=new Kt(e,this.context);return t?n.find(t):n}closest(t){let e=[];return this.each(n=>{let r=n.closest(t);r&&e.push(r)}),new Kt(e,this.context)}host(t){let e=[],n=s=>s.parentNode?n(s.parentNode):s,r=s=>{let a=n(s);e.push(a.host?a.host:a),a.host&&t&&r(a.host)};return this.each(s=>{r(s)}),new Kt(e,this.context)}parent(t){return this.parents(t,!0)}parents(t,e){let n=[],r=a=>{if(n.indexOf(a)==-1&&n.push(a),!e&&a.parentNode)return r(a.parentNode)};this.each(a=>{a.parentNode&&r(a.parentNode)});let s=new Kt(n,this.context);return t?s.filter(t):s}add(t){let e=t instanceof Kt?t.nodes:Array.isArray(t)?t:[t];return new Kt(this.nodes.concat(e),this.context)}each(t){return this.nodes.forEach((e,n)=>{t(e,n,this)}),this}append(t){return this._insert("append",t)}prepend(t){return this._insert("prepend",t)}after(t){return this._insert("after",t)}before(t){return this._insert("before",t)}replace(t){return this._insert("replaceWith",t)}remove(){return this.each(t=>{t.remove()}),this}css(t,e){let n=t,r=arguments.length;if(r===0||r===1&&typeof t=="string")if(this[0]){let s=this[0].style;if(typeof t=="string"){let a=s.getPropertyPriority(t);return s.getPropertyValue(t)+(a?"!"+a:"")}else return Object.fromEntries(this[0].style.cssText.split(";").filter(a=>!!a).map(a=>a.split(":").map(o=>o.trim())))}else return;else return typeof t!="object"&&(n={},n[t]=e),this.each((s,a)=>{Object.keys(n).forEach(o=>{let l=String(n[o]).toLowerCase().includes("!important")?"important":"";s.style.setProperty(o,String(n[o]).replace(/!important/i,""),l)})}),this}addClass(t){return this.toggleClass(t,!0),this}removeClass(t){return this.toggleClass(t,!1),this}toggleClass(t,e){return typeof t=="string"&&(t=t.split(/[,\s]+/)),this.each(n=>{let r=t;r==null&&e===!1&&(r=Array.from(n.classList)),r.forEach(s=>{if(s!==""){let a="toggle";e!=null&&(a=e?"add":"remove"),n.classList[a](s)}})}),this}hasClass(t){if(typeof t=="string"&&(t=t.split(/[,\s]+/)),t==null&&this.length>0)return Array.from(this[0].classList);let e=!1;return this.each(n=>{e=e||t.every(r=>Array.from(n.classList??[]).includes(r))}),e}on(t,e,n){typeof e=="function"&&(n=e,e=void 0);let r;return e?.delegate&&(r=e.delegate,delete e.delegate),t=t.split(/[,\s]+/),t.forEach(s=>{let[a,o]=String(s).toLowerCase().split(".");if(r){let l=n;n=h=>{let c=se(h.target).parents(r);c.length>0?h.delegate=c[0]:h.delegate=h.target,(h.target.matches(r)||c.length>0)&&l(h)}}this.each(l=>{this._save(l,"events",[{event:a,scope:o,callback:n,options:e}]),l.addEventListener(a,n,e)})}),this}off(t,e,n){return typeof e=="function"&&(n=e,e=void 0),t=(t??"").split(/[,\s]+/),t.forEach(r=>{let[s,a]=String(r).toLowerCase().split(".");this.each(o=>{if(Array.isArray(o._mQuery?.events))for(let l=o._mQuery.events.length-1;l>=0;l--){let h=o._mQuery.events[l];a==null||a===""?(h.event==s||s==="")&&(h.callback==n||n==null)&&(o.removeEventListener(h.event,h.callback,h.options),o._mQuery.events.splice(l,1)):(h.event==s||s==="")&&h.scope==a&&(o.removeEventListener(h.event,h.callback,h.options),o._mQuery.events.splice(l,1))}})}),this}trigger(t,e){let n,r=["click","dblclick","mousedown","mouseup","mousemove"],s=["keydown","keyup","keypress"];return t instanceof Event||t instanceof CustomEvent?n=t:r.includes(t)?n=new MouseEvent(t,e):s.includes(t)?n=new KeyboardEvent(t,e):n=new Event(t,e),this.each(a=>{a.dispatchEvent(n)}),this}attr(t,e){if(e===void 0&&typeof t=="string")return this[0]?this[0].getAttribute(t):void 0;{let n={};return typeof t=="object"?n=t:n[t]=e,this.each(r=>{Object.entries(n).forEach(([s,a])=>{r.setAttribute(s,a)})}),this}}removeAttr(){return this.each(t=>{Array.from(arguments).forEach(e=>{t.removeAttribute(e)})}),this}prop(t,e){if(e===void 0&&typeof t=="string")return this[0]?this[0][t]:void 0;{let n={};return typeof t=="object"?n=t:n[t]=e,this.each(r=>{Object.entries(n).forEach(([s,a])=>{let o=Kt._fixProp(s);r[o]=a,o=="innerHTML"&&Kt._scriptConvert(r)})}),this}}removeProp(){return this.each(t=>{Array.from(arguments).forEach(e=>{delete t[Kt._fixProp(e)]})}),this}data(t,e){if(t instanceof Object){Object.entries(t).forEach(n=>{this.data(n[0],n[1])});return}if(t&&t.indexOf("-")!=-1&&console.error(`Key "${t}" contains "-" (dash). Dashes are not allowed in property names. Use camelCase instead.`),arguments.length<2)if(this[0]){let n=Object.assign({},this[0].dataset);return Object.keys(n).forEach(r=>{if(n[r].startsWith("[")||n[r].startsWith("{"))try{n[r]=JSON.parse(n[r])}catch{}}),t?n[t]:n}else return;else return this.each(n=>{e!=null?n.dataset[t]=e instanceof Object?JSON.stringify(e):e:delete n.dataset[t]}),this}removeData(t){return typeof t=="string"&&(t=t.split(/[,\s]+/)),this.each(e=>{t.forEach(n=>{delete e.dataset[n]})}),this}show(){return this.toggle(!0)}hide(){return this.toggle(!1)}toggle(t){return this.each(e=>{let n=e.style.display,r=getComputedStyle(e).display,s=n=="none"||r=="none";if(s&&(t==null||t===!0)){let a=e instanceof HTMLTableRowElement?"table-row":e instanceof HTMLTableCellElement?"table-cell":"block";e.style.display=e._mQuery?.prevDisplay??(n==r&&r!="none"?"":a),this._save(e,"prevDisplay",null)}!s&&(t==null||t===!1)&&(r!="none"&&this._save(e,"prevDisplay",r),e.style.setProperty("display","none"))})}empty(){return this.html("")}html(t){return t instanceof HTMLElement?this.empty().append(t):this.prop("innerHTML",t)}text(t){return this.prop("textContent",t)}val(t){return this.prop("value",t)}change(){return this.trigger("change")}click(){return this.trigger("click")}}let se=function(i,t){return new Kt(i,t)};se.html=i=>{let t=Kt._fragment(i);return se(t.children,t)},se.version=Kt.version,function(){let i=0;window.requestAnimationFrame||(window.requestAnimationFrame=function(t){const e=new Date().getTime(),n=Math.max(0,16-(e-i)),r=window.setTimeout(function(){t(e+n)},n);return i=e+n,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}();const Zc=i=>{function t(e){const n=window.requestAnimationFrame(t);i(e,n)}window.requestAnimationFrame(t)},H2=(i,t)=>{const n=document.getElementById(i).getContext("2d");Zc((r,s)=>{t(n,r,s)})};function j2(i,t,e,n,r=.5,s="ease"){return new Promise(a=>{const o=getComputedStyle(i),l=parseInt(o.width),h=parseInt(o.height);if(!i||!t){console.log("ERROR: Cannot do transition when one of the divs is null");return}switch(i.parentElement&&(i.parentElement.style.cssText+="; perspective: 900px; overflow: hidden;"),i.style.cssText+="; position: absolute; z-index: 1019; backface-visibility: hidden",t.style.cssText+="; position: absolute; z-index: 1020; backface-visibility: hidden",e){case"slide-left":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d("+l+"px, 0, 0)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(-"+l+"px, 0, 0)"},1);break;case"slide-right":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(-"+l+"px, 0, 0)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0px, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d("+l+"px, 0, 0)"},1);break;case"slide-down":i.style.cssText+="overflow: hidden; z-index: 1; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; z-index: 0; transform: translate3d(0, 0, 0)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, "+h+"px, 0)"},1);break;case"slide-up":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(0, "+h+"px, 0)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)"},1);break;case"flip-left":i.style.cssText+="overflow: hidden; transform: rotateY(0deg)",t.style.cssText+="overflow: hidden; transform: rotateY(-180deg)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(180deg)"},1);break;case"flip-right":i.style.cssText+="overflow: hidden; transform: rotateY(0deg)",t.style.cssText+="overflow: hidden; transform: rotateY(180deg)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(-180deg)"},1);break;case"flip-down":i.style.cssText+="overflow: hidden; transform: rotateX(0deg)",t.style.cssText+="overflow: hidden; transform: rotateX(180deg)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(-180deg)"},1);break;case"flip-up":i.style.cssText+="overflow: hidden; transform: rotateX(0deg)",t.style.cssText+="overflow: hidden; transform: rotateX(-180deg)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(180deg)"},1);break;case"pop-in":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(.8); opacity: 0;",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: scale(1); opacity: 1;",i.style.cssText+="transition: "+r+"s "+s+";"},1);break;case"pop-out":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(1); opacity: 1;",t.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); opacity: 0;",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; opacity: 1;",i.style.cssText+="transition: "+r+"s "+s+"; transform: scale(1.7); opacity: 0;"},1);break;default:i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; translate3d(0, 0, 0); opacity: 0;",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; opacity: 1;",i.style.cssText+="transition: "+r+"s "+s},1);break}setTimeout(()=>{if(e==="slide-down"&&(se(i).css("z-index","1019"),se(t).css("z-index","1020")),t){const c=se(t);c?.css({opacity:"1"}),c?.css({transition:"",transform:""})}if(i){const c=se(i);c?.css({opacity:"1"}),c?.css({transition:"",transform:""})}typeof n=="function"&&n(),a()},r*1e3)})}var Bo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ee(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function St(i){if(i.__esModule)return i;var t=i.default;if(typeof t=="function"){var e=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(i).forEach(function(n){var r=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return i[n]}})}),e}var Jc={exports:{}};(function(i){var t={};i.exports=t,t.parse=function(e,n){for(var r=t.bin.readUshort,s=t.bin.readUint,h=0,a={},o=new Uint8Array(e),l=o.length-4;s(o,l)!=101010256;)l--;var h=l;h+=4,h+=4;var c=r(o,h);h+=2,r(o,h),h+=2;var d=s(o,h);h+=4;var f=s(o,h);h+=4,h=f;for(var u=0;u<c;u++){s(o,h),h+=4,h+=4,h+=4,h+=4,s(o,h),h+=4;var d=s(o,h);h+=4;var p=s(o,h);h+=4;var m=r(o,h),y=r(o,h+2),S=r(o,h+4);h+=6,h+=8;var C=s(o,h);h+=4,h+=m+y+S,t._readLocal(o,C,a,d,p,n)}return a},t._readLocal=function(e,n,r,s,a,o){var l=t.bin.readUshort,h=t.bin.readUint;h(e,n),n+=4,l(e,n),n+=2,l(e,n),n+=2;var c=l(e,n);n+=2,h(e,n),n+=4,h(e,n),n+=4,n+=8;var d=l(e,n);n+=2;var f=l(e,n);n+=2;var u=t.bin.readUTF8(e,n,d);if(n+=d,n+=f,o){r[u]={size:a,csize:s};return}var p=new Uint8Array(e.buffer,n);if(c==0)r[u]=new Uint8Array(p.buffer.slice(n,n+s));else if(c==8){var m=new Uint8Array(a);t.inflateRaw(p,m),r[u]=m}else throw"unknown compression method: "+c},t.inflateRaw=function(e,n){return t.F.inflate(e,n)},t.inflate=function(e,n){return e[0],e[1],t.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),n)},t.deflate=function(e,n){n==null&&(n={level:6});var r=0,s=new Uint8Array(50+Math.floor(e.length*1.1));s[r]=120,s[r+1]=156,r+=2,r=t.F.deflateRaw(e,s,r,n.level);var a=t.adler(e,0,e.length);return s[r+0]=a>>>24&255,s[r+1]=a>>>16&255,s[r+2]=a>>>8&255,s[r+3]=a>>>0&255,new Uint8Array(s.buffer,0,r+4)},t.deflateRaw=function(e,n){n==null&&(n={level:6});var r=new Uint8Array(50+Math.floor(e.length*1.1)),s=t.F.deflateRaw(e,r,s,n.level);return new Uint8Array(r.buffer,0,s)},t.encode=function(e,n){n==null&&(n=!1);var r=0,s=t.bin.writeUint,a=t.bin.writeUshort,o={};for(var l in e){var h=!t._noNeed(l)&&!n,c=e[l],d=t.crc.crc(c,0,c.length);o[l]={cpr:h,usize:c.length,crc:d,file:h?t.deflateRaw(c):c}}for(var l in o)r+=o[l].file.length+30+46+2*t.bin.sizeUTF8(l);r+=22;var f=new Uint8Array(r),u=0,p=[];for(var l in o){var m=o[l];p.push(u),u=t._writeHeader(f,u,l,m,0)}var y=0,S=u;for(var l in o){var m=o[l];p.push(u),u=t._writeHeader(f,u,l,m,1,p[y++])}var C=u-S;return s(f,u,101010256),u+=4,u+=4,a(f,u,y),u+=2,a(f,u,y),u+=2,s(f,u,C),u+=4,s(f,u,S),u+=4,u+=2,f.buffer},t._noNeed=function(e){var n=e.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(n)!=-1},t._writeHeader=function(e,n,r,s,a,o){var l=t.bin.writeUint,h=t.bin.writeUshort,c=s.file;l(e,n,a==0?67324752:33639248),n+=4,a==1&&(n+=2),h(e,n,20),n+=2,h(e,n,0),n+=2,h(e,n,s.cpr?8:0),n+=2,l(e,n,0),n+=4,l(e,n,s.crc),n+=4,l(e,n,c.length),n+=4,l(e,n,s.usize),n+=4,h(e,n,t.bin.sizeUTF8(r)),n+=2,h(e,n,0),n+=2,a==1&&(n+=2,n+=2,n+=6,l(e,n,o),n+=4);var d=t.bin.writeUTF8(e,n,r);return n+=d,a==0&&(e.set(c,n),n+=c.length),n},t.crc={table:function(){for(var e=new Uint32Array(256),n=0;n<256;n++){for(var r=n,s=0;s<8;s++)r&1?r=3988292384^r>>>1:r=r>>>1;e[n]=r}return e}(),update:function(e,n,r,s){for(var a=0;a<s;a++)e=t.crc.table[(e^n[r+a])&255]^e>>>8;return e},crc:function(e,n,r){return t.crc.update(4294967295,e,n,r)^4294967295}},t.adler=function(e,n,r){for(var s=1,a=0,o=n,l=n+r;o<l;){for(var h=Math.min(o+5552,l);o<h;)s+=e[o++],a+=s;s=s%65521,a=a%65521}return a<<16|s},t.bin={readUshort:function(e,n){return e[n]|e[n+1]<<8},writeUshort:function(e,n,r){e[n]=r&255,e[n+1]=r>>8&255},readUint:function(e,n){return e[n+3]*16777216+(e[n+2]<<16|e[n+1]<<8|e[n])},writeUint:function(e,n,r){e[n]=r&255,e[n+1]=r>>8&255,e[n+2]=r>>16&255,e[n+3]=r>>24&255},readASCII:function(e,n,r){for(var s="",a=0;a<r;a++)s+=String.fromCharCode(e[n+a]);return s},writeASCII:function(e,n,r){for(var s=0;s<r.length;s++)e[n+s]=r.charCodeAt(s)},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,n,r){for(var s="",a,o=0;o<r;o++)s+="%"+t.bin.pad(e[n+o].toString(16));try{a=decodeURIComponent(s)}catch{return t.bin.readASCII(e,n,r)}return a},writeUTF8:function(e,n,r){for(var s=r.length,a=0,o=0;o<s;o++){var l=r.charCodeAt(o);if(!(l&4294967168))e[n+a]=l,a++;else if(!(l&4294965248))e[n+a]=192|l>>6,e[n+a+1]=128|l>>0&63,a+=2;else if(!(l&4294901760))e[n+a]=224|l>>12,e[n+a+1]=128|l>>6&63,e[n+a+2]=128|l>>0&63,a+=3;else if(!(l&4292870144))e[n+a]=240|l>>18,e[n+a+1]=128|l>>12&63,e[n+a+2]=128|l>>6&63,e[n+a+3]=128|l>>0&63,a+=4;else throw"e"}return a},sizeUTF8:function(e){for(var n=e.length,r=0,s=0;s<n;s++){var a=e.charCodeAt(s);if(!(a&4294967168))r++;else if(!(a&4294965248))r+=2;else if(!(a&4294901760))r+=3;else if(!(a&4292870144))r+=4;else throw"e"}return r}},t.F={},t.F.deflateRaw=function(e,n,r,s){var a=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]],o=a[s],l=t.F.U,h=t.F._goodIndex;t.F._hash;var c=t.F._putsE,d=0,f=r<<3,u=0,p=e.length;if(s==0){for(;d<p;){var m=Math.min(65535,p-d);c(n,f,d+m==p?1:0),f=t.F._copyExact(e,d,m,n,f+8),d+=m}return f>>>3}var y=l.lits,S=l.strt,C=l.prev,_=0,w=0,k=0,A=0,R=0,P=0;for(p>2&&(P=t.F._hash(e,0),S[P]=0),d=0;d<p;d++){if(R=P,d+1<p-2){P=t.F._hash(e,d+1);var U=d+1&32767;C[U]=S[P],S[P]=U}if(u<=d){(_>14e3||w>26697)&&p-d>100&&(u<d&&(y[_]=d-u,_+=2,u=d),f=t.F._writeBlock(d==p-1||u==p?1:0,y,_,A,e,k,d-k,n,f),_=w=A=0,k=d);var I=0;d<p-2&&(I=t.F._bestMatch(e,d,C,R,Math.min(o[2],p-d),o[3]));var m=I>>>16,N=I&65535;if(I!=0){var m=I>>>16,N=I&65535,q=h(m,l.of0);l.lhst[257+q]++;var W=h(N,l.df0);l.dhst[W]++,A+=l.exb[q]+l.dxb[W],y[_]=m<<23|d-u,y[_+1]=N<<16|q<<8|W,_+=2,u=d+m}else l.lhst[e[d]]++;w++}}for((k!=d||e.length==0)&&(u<d&&(y[_]=d-u,_+=2,u=d),f=t.F._writeBlock(1,y,_,A,e,k,d-k,n,f),_=0,w=0,_=w=A=0,k=d);f&7;)f++;return f>>>3},t.F._bestMatch=function(e,n,r,s,a,o){var l=n&32767,h=r[l],c=l-h+32768&32767;if(h==l||s!=t.F._hash(e,n-c))return 0;for(var d=0,f=0,u=Math.min(32767,n);c<=u&&--o!=0&&h!=l;){if(d==0||e[n+d]==e[n+d-c]){var p=t.F._howLong(e,n,c);if(p>d){if(d=p,f=c,d>=a)break;c+2<p&&(p=c+2);for(var m=0,y=0;y<p-2;y++){var S=n-c+y+32768&32767,C=r[S],_=S-C+32768&32767;_>m&&(m=_,h=S)}}}l=h,h=r[l],c+=l-h+32768&32767}return d<<16|f},t.F._howLong=function(e,n,r){if(e[n]!=e[n-r]||e[n+1]!=e[n+1-r]||e[n+2]!=e[n+2-r])return 0;var s=n,a=Math.min(e.length,n+258);for(n+=3;n<a&&e[n]==e[n-r];)n++;return n-s},t.F._hash=function(e,n){return(e[n]<<8|e[n+1])+(e[n+2]<<4)&65535},t.saved=0,t.F._writeBlock=function(e,n,r,s,a,o,l,h,c){var d=t.F.U,f=t.F._putsF,u=t.F._putsE,p,m,y,S,C,_,w,k,A;d.lhst[256]++,p=t.F.getTrees(),m=p[0],y=p[1],S=p[2],C=p[3],_=p[4],w=p[5],k=p[6],A=p[7];var R=(c+3&7?8-(c+3&7):0)+32+(l<<3),P=s+t.F.contSize(d.fltree,d.lhst)+t.F.contSize(d.fdtree,d.dhst),U=s+t.F.contSize(d.ltree,d.lhst)+t.F.contSize(d.dtree,d.dhst);U+=14+3*w+t.F.contSize(d.itree,d.ihst)+(d.ihst[16]*2+d.ihst[17]*3+d.ihst[18]*7);for(var I=0;I<286;I++)d.lhst[I]=0;for(var I=0;I<30;I++)d.dhst[I]=0;for(var I=0;I<19;I++)d.ihst[I]=0;var N=R<P&&R<U?0:P<U?1:2;if(f(h,c,e),f(h,c+1,N),c+=3,N==0){for(;c&7;)c++;c=t.F._copyExact(a,o,l,h,c)}else{var q,W;if(N==1&&(q=d.fltree,W=d.fdtree),N==2){t.F.makeCodes(d.ltree,m),t.F.revCodes(d.ltree,m),t.F.makeCodes(d.dtree,y),t.F.revCodes(d.dtree,y),t.F.makeCodes(d.itree,S),t.F.revCodes(d.itree,S),q=d.ltree,W=d.dtree,u(h,c,C-257),c+=5,u(h,c,_-1),c+=5,u(h,c,w-4),c+=4;for(var K=0;K<w;K++)u(h,c+K*3,d.itree[(d.ordr[K]<<1)+1]);c+=3*w,c=t.F._codeTiny(k,d.itree,h,c),c=t.F._codeTiny(A,d.itree,h,c)}for(var it=o,pt=0;pt<r;pt+=2){for(var vt=n[pt],dt=vt>>>23,_t=it+(vt&(1<<23)-1);it<_t;)c=t.F._writeLit(a[it++],q,h,c);if(dt!=0){var yt=n[pt+1],L=yt>>16,M=yt>>8&255,T=yt&255;c=t.F._writeLit(257+M,q,h,c),u(h,c,dt-d.of0[M]),c+=d.exb[M],c=t.F._writeLit(T,W,h,c),f(h,c,L-d.df0[T]),c+=d.dxb[T],it+=dt}}c=t.F._writeLit(256,q,h,c)}return c},t.F._copyExact=function(e,n,r,s,a){var o=a>>>3;return s[o]=r,s[o+1]=r>>>8,s[o+2]=255-s[o],s[o+3]=255-s[o+1],o+=4,s.set(new Uint8Array(e.buffer,n,r),o),a+(r+4<<3)},t.F.getTrees=function(){for(var e=t.F.U,n=t.F._hufTree(e.lhst,e.ltree,15),r=t.F._hufTree(e.dhst,e.dtree,15),s=[],a=t.F._lenCodes(e.ltree,s),o=[],l=t.F._lenCodes(e.dtree,o),h=0;h<s.length;h+=2)e.ihst[s[h]]++;for(var h=0;h<o.length;h+=2)e.ihst[o[h]]++;for(var c=t.F._hufTree(e.ihst,e.itree,7),d=19;d>4&&e.itree[(e.ordr[d-1]<<1)+1]==0;)d--;return[n,r,c,a,l,d,s,o]},t.F.getSecond=function(e){for(var n=[],r=0;r<e.length;r+=2)n.push(e[r+1]);return n},t.F.nonZero=function(e){for(var n="",r=0;r<e.length;r+=2)e[r+1]!=0&&(n+=(r>>1)+",");return n},t.F.contSize=function(e,n){for(var r=0,s=0;s<n.length;s++)r+=n[s]*e[(s<<1)+1];return r},t.F._codeTiny=function(e,n,r,s){for(var a=0;a<e.length;a+=2){var o=e[a],l=e[a+1];s=t.F._writeLit(o,n,r,s);var h=o==16?2:o==17?3:7;o>15&&(t.F._putsE(r,s,l,h),s+=h)}return s},t.F._lenCodes=function(e,n){for(var r=e.length;r!=2&&e[r-1]==0;)r-=2;for(var s=0;s<r;s+=2){var a=e[s+1],o=s+3<r?e[s+3]:-1,l=s+5<r?e[s+5]:-1,h=s==0?-1:e[s-1];if(a==0&&o==a&&l==a){for(var c=s+5;c+2<r&&e[c+2]==a;)c+=2;var d=Math.min(c+1-s>>>1,138);d<11?n.push(17,d-3):n.push(18,d-11),s+=d*2-2}else if(a==h&&o==a&&l==a){for(var c=s+5;c+2<r&&e[c+2]==a;)c+=2;var d=Math.min(c+1-s>>>1,6);n.push(16,d-3),s+=d*2-2}else n.push(a,0)}return r>>>1},t.F._hufTree=function(e,n,r){var s=[],a=e.length,o=n.length,l=0;for(l=0;l<o;l+=2)n[l]=0,n[l+1]=0;for(l=0;l<a;l++)e[l]!=0&&s.push({lit:l,f:e[l]});var h=s.length,c=s.slice(0);if(h==0)return 0;if(h==1){var d=s[0].lit,c=d==0?1:0;return n[(d<<1)+1]=1,n[(c<<1)+1]=1,1}s.sort(function(C,_){return C.f-_.f});var f=s[0],u=s[1],p=0,m=1,y=2;for(s[0]={lit:-1,f:f.f+u.f,l:f,r:u,d:0};m!=h-1;)p!=m&&(y==h||s[p].f<s[y].f)?f=s[p++]:f=s[y++],p!=m&&(y==h||s[p].f<s[y].f)?u=s[p++]:u=s[y++],s[m++]={lit:-1,f:f.f+u.f,l:f,r:u};var S=t.F.setDepth(s[m-1],0);for(S>r&&(t.F.restrictDepth(c,r,S),S=r),l=0;l<h;l++)n[(c[l].lit<<1)+1]=c[l].d;return S},t.F.setDepth=function(e,n){return e.lit!=-1?(e.d=n,n):Math.max(t.F.setDepth(e.l,n+1),t.F.setDepth(e.r,n+1))},t.F.restrictDepth=function(e,n,r){var s=0,a=1<<r-n,o=0;for(e.sort(function(h,c){return c.d==h.d?h.f-c.f:c.d-h.d}),s=0;s<e.length&&e[s].d>n;s++){var l=e[s].d;e[s].d=n,o+=a-(1<<r-l)}for(o=o>>>r-n;o>0;){var l=e[s].d;l<n?(e[s].d++,o-=1<<n-l-1):s++}for(;s>=0;s--)e[s].d==n&&o<0&&(e[s].d--,o++);o!=0&&console.log("debt left")},t.F._goodIndex=function(e,n){var r=0;return n[r|16]<=e&&(r|=16),n[r|8]<=e&&(r|=8),n[r|4]<=e&&(r|=4),n[r|2]<=e&&(r|=2),n[r|1]<=e&&(r|=1),r},t.F._writeLit=function(e,n,r,s){return t.F._putsF(r,s,n[e<<1]),s+n[(e<<1)+1]},t.F.inflate=function(e,n){var r=Uint8Array;if(e[0]==3&&e[1]==0)return n||new r(0);var s=t.F,a=s._bitsF,o=s._bitsE,l=s._decodeTiny,h=s.makeCodes,c=s.codes2map,d=s._get17,f=s.U,u=n==null;u&&(n=new r(e.length>>>2<<3));for(var p=0,m=0,y=0,S=0,C=0,_=0,w=0,k=0,A=0,R,P;p==0;){if(p=a(e,A,1),m=a(e,A+1,2),A+=3,m==0){A&7&&(A+=8-(A&7));var U=(A>>>3)+4,I=e[U-4]|e[U-3]<<8;u&&(n=t.F._check(n,k+I)),n.set(new r(e.buffer,e.byteOffset+U,I),k),A=U+I<<3,k+=I;continue}if(u&&(n=t.F._check(n,k+131072)),m==1&&(R=f.flmap,P=f.fdmap,_=511,w=31),m==2){y=o(e,A,5)+257,S=o(e,A+5,5)+1,C=o(e,A+10,4)+4,A+=14;for(var N=0;N<38;N+=2)f.itree[N]=0,f.itree[N+1]=0;for(var q=1,N=0;N<C;N++){var W=o(e,A+N*3,3);f.itree[(f.ordr[N]<<1)+1]=W,W>q&&(q=W)}A+=3*C,h(f.itree,q),c(f.itree,q,f.imap),R=f.lmap,P=f.dmap,A=l(f.imap,(1<<q)-1,y+S,e,A,f.ttree);var K=s._copyOut(f.ttree,0,y,f.ltree);_=(1<<K)-1;var it=s._copyOut(f.ttree,y,S,f.dtree);w=(1<<it)-1,h(f.ltree,K),c(f.ltree,K,R),h(f.dtree,it),c(f.dtree,it,P)}for(;;){var pt=R[d(e,A)&_];A+=pt&15;var vt=pt>>>4;if(!(vt>>>8))n[k++]=vt;else{if(vt==256)break;var dt=k+vt-254;if(vt>264){var _t=f.ldef[vt-257];dt=k+(_t>>>3)+o(e,A,_t&7),A+=_t&7}var yt=P[d(e,A)&w];A+=yt&15;var L=yt>>>4,M=f.ddef[L],T=(M>>>4)+a(e,A,M&15);for(A+=M&15,u&&(n=t.F._check(n,k+131072));k<dt;)n[k]=n[k++-T],n[k]=n[k++-T],n[k]=n[k++-T],n[k]=n[k++-T];k=dt}}}return n.length==k?n:n.slice(0,k)},t.F._check=function(e,n){var r=e.length;if(n<=r)return e;var s=new Uint8Array(Math.max(r<<1,n));return s.set(e,0),s},t.F._decodeTiny=function(e,n,r,s,a,o){for(var l=t.F._bitsE,h=t.F._get17,c=0;c<r;){var d=e[h(s,a)&n];a+=d&15;var f=d>>>4;if(f<=15)o[c]=f,c++;else{var u=0,p=0;f==16?(p=3+l(s,a,2),a+=2,u=o[c-1]):f==17?(p=3+l(s,a,3),a+=3):f==18&&(p=11+l(s,a,7),a+=7);for(var m=c+p;c<m;)o[c]=u,c++}}return a},t.F._copyOut=function(e,n,r,s){for(var a=0,o=0,l=s.length>>>1;o<r;){var h=e[o+n];s[o<<1]=0,s[(o<<1)+1]=h,h>a&&(a=h),o++}for(;o<l;)s[o<<1]=0,s[(o<<1)+1]=0,o++;return a},t.F.makeCodes=function(e,n){for(var r=t.F.U,s=e.length,a,o,l,h,c,d=r.bl_count,h=0;h<=n;h++)d[h]=0;for(h=1;h<s;h+=2)d[e[h]]++;var f=r.next_code;for(a=0,d[0]=0,o=1;o<=n;o++)a=a+d[o-1]<<1,f[o]=a;for(l=0;l<s;l+=2)c=e[l+1],c!=0&&(e[l]=f[c],f[c]++)},t.F.codes2map=function(e,n,r){for(var s=e.length,a=t.F.U,o=a.rev15,l=0;l<s;l+=2)if(e[l+1]!=0)for(var h=l>>1,c=e[l+1],d=h<<4|c,f=n-c,u=e[l]<<f,p=u+(1<<f);u!=p;){var m=o[u]>>>15-n;r[m]=d,u++}},t.F.revCodes=function(e,n){for(var r=t.F.U.rev15,s=15-n,a=0;a<e.length;a+=2){var o=e[a]<<n-e[a+1];e[a]=r[o]>>>s}},t.F._putsE=function(e,n,r){r=r<<(n&7);var s=n>>>3;e[s]|=r,e[s+1]|=r>>>8},t.F._putsF=function(e,n,r){r=r<<(n&7);var s=n>>>3;e[s]|=r,e[s+1]|=r>>>8,e[s+2]|=r>>>16},t.F._bitsE=function(e,n,r){return(e[n>>>3]|e[(n>>>3)+1]<<8)>>>(n&7)&(1<<r)-1},t.F._bitsF=function(e,n,r){return(e[n>>>3]|e[(n>>>3)+1]<<8|e[(n>>>3)+2]<<16)>>>(n&7)&(1<<r)-1},t.F._get17=function(e,n){return(e[n>>>3]|e[(n>>>3)+1]<<8|e[(n>>>3)+2]<<16)>>>(n&7)},t.F._get25=function(e,n){return(e[n>>>3]|e[(n>>>3)+1]<<8|e[(n>>>3)+2]<<16|e[(n>>>3)+3]<<24)>>>(n&7)},t.F.U=function(){var e=Uint16Array,n=Uint32Array;return{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new e(65536),prev:new e(32768)}}(),function(){for(var e=t.F.U,n=32768,r=0;r<n;r++){var s=r;s=(s&2863311530)>>>1|(s&1431655765)<<1,s=(s&3435973836)>>>2|(s&858993459)<<2,s=(s&4042322160)>>>4|(s&252645135)<<4,s=(s&4278255360)>>>8|(s&16711935)<<8,e.rev15[r]=(s>>>16|s<<16)>>>17}function a(o,l,h){for(;l--!=0;)o.push(0,h)}for(var r=0;r<32;r++)e.ldef[r]=e.of0[r]<<3|e.exb[r],e.ddef[r]=e.df0[r]<<4|e.dxb[r];a(e.fltree,144,8),a(e.fltree,112,9),a(e.fltree,24,7),a(e.fltree,8,8),t.F.makeCodes(e.fltree,9),t.F.codes2map(e.fltree,9,e.flmap),t.F.revCodes(e.fltree,9),a(e.fdtree,32,5),t.F.makeCodes(e.fdtree,5),t.F.codes2map(e.fdtree,5,e.fdmap),t.F.revCodes(e.fdtree,5),a(e.itree,19,0),a(e.ltree,286,0),a(e.dtree,30,0),a(e.ttree,320,0)}()})(Jc);var V2=Jc.exports;const Qc=Ee(V2);/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const q2=4,tu=0,eu=1,X2=2;function Cn(i){let t=i.length;for(;--t>=0;)i[t]=0}const Y2=0,iu=1,W2=2,K2=3,Z2=258,Go=29,pr=256,mr=pr+1+Go,kn=30,$o=19,nu=2*mr+1,Yi=15,zo=16,J2=7,Ho=256,ru=16,su=17,au=18,jo=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),la=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Q2=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ou=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tm=512,ni=new Array((mr+2)*2);Cn(ni);const vr=new Array(kn*2);Cn(vr);const _r=new Array(tm);Cn(_r);const yr=new Array(Z2-K2+1);Cn(yr);const Vo=new Array(Go);Cn(Vo);const ha=new Array(kn);Cn(ha);function qo(i,t,e,n,r){this.static_tree=i,this.extra_bits=t,this.extra_base=e,this.elems=n,this.max_length=r,this.has_stree=i&&i.length}let lu,hu,cu;function Xo(i,t){this.dyn_tree=i,this.max_code=0,this.stat_desc=t}const uu=i=>i<256?_r[i]:_r[256+(i>>>7)],br=(i,t)=>{i.pending_buf[i.pending++]=t&255,i.pending_buf[i.pending++]=t>>>8&255},Ce=(i,t,e)=>{i.bi_valid>zo-e?(i.bi_buf|=t<<i.bi_valid&65535,br(i,i.bi_buf),i.bi_buf=t>>zo-i.bi_valid,i.bi_valid+=e-zo):(i.bi_buf|=t<<i.bi_valid&65535,i.bi_valid+=e)},qe=(i,t,e)=>{Ce(i,e[t*2],e[t*2+1])},fu=(i,t)=>{let e=0;do e|=i&1,i>>>=1,e<<=1;while(--t>0);return e>>>1},em=i=>{i.bi_valid===16?(br(i,i.bi_buf),i.bi_buf=0,i.bi_valid=0):i.bi_valid>=8&&(i.pending_buf[i.pending++]=i.bi_buf&255,i.bi_buf>>=8,i.bi_valid-=8)},im=(i,t)=>{const e=t.dyn_tree,n=t.max_code,r=t.stat_desc.static_tree,s=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,l=t.stat_desc.max_length;let h,c,d,f,u,p,m=0;for(f=0;f<=Yi;f++)i.bl_count[f]=0;for(e[i.heap[i.heap_max]*2+1]=0,h=i.heap_max+1;h<nu;h++)c=i.heap[h],f=e[e[c*2+1]*2+1]+1,f>l&&(f=l,m++),e[c*2+1]=f,!(c>n)&&(i.bl_count[f]++,u=0,c>=o&&(u=a[c-o]),p=e[c*2],i.opt_len+=p*(f+u),s&&(i.static_len+=p*(r[c*2+1]+u)));if(m!==0){do{for(f=l-1;i.bl_count[f]===0;)f--;i.bl_count[f]--,i.bl_count[f+1]+=2,i.bl_count[l]--,m-=2}while(m>0);for(f=l;f!==0;f--)for(c=i.bl_count[f];c!==0;)d=i.heap[--h],!(d>n)&&(e[d*2+1]!==f&&(i.opt_len+=(f-e[d*2+1])*e[d*2],e[d*2+1]=f),c--)}},du=(i,t,e)=>{const n=new Array(Yi+1);let r=0,s,a;for(s=1;s<=Yi;s++)r=r+e[s-1]<<1,n[s]=r;for(a=0;a<=t;a++){let o=i[a*2+1];o!==0&&(i[a*2]=fu(n[o]++,o))}},nm=()=>{let i,t,e,n,r;const s=new Array(Yi+1);for(e=0,n=0;n<Go-1;n++)for(Vo[n]=e,i=0;i<1<<jo[n];i++)yr[e++]=n;for(yr[e-1]=n,r=0,n=0;n<16;n++)for(ha[n]=r,i=0;i<1<<la[n];i++)_r[r++]=n;for(r>>=7;n<kn;n++)for(ha[n]=r<<7,i=0;i<1<<la[n]-7;i++)_r[256+r++]=n;for(t=0;t<=Yi;t++)s[t]=0;for(i=0;i<=143;)ni[i*2+1]=8,i++,s[8]++;for(;i<=255;)ni[i*2+1]=9,i++,s[9]++;for(;i<=279;)ni[i*2+1]=7,i++,s[7]++;for(;i<=287;)ni[i*2+1]=8,i++,s[8]++;for(du(ni,mr+1,s),i=0;i<kn;i++)vr[i*2+1]=5,vr[i*2]=fu(i,5);lu=new qo(ni,jo,pr+1,mr,Yi),hu=new qo(vr,la,0,kn,Yi),cu=new qo(new Array(0),Q2,0,$o,J2)},gu=i=>{let t;for(t=0;t<mr;t++)i.dyn_ltree[t*2]=0;for(t=0;t<kn;t++)i.dyn_dtree[t*2]=0;for(t=0;t<$o;t++)i.bl_tree[t*2]=0;i.dyn_ltree[Ho*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},pu=i=>{i.bi_valid>8?br(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},mu=(i,t,e,n)=>{const r=t*2,s=e*2;return i[r]<i[s]||i[r]===i[s]&&n[t]<=n[e]},Yo=(i,t,e)=>{const n=i.heap[e];let r=e<<1;for(;r<=i.heap_len&&(r<i.heap_len&&mu(t,i.heap[r+1],i.heap[r],i.depth)&&r++,!mu(t,n,i.heap[r],i.depth));)i.heap[e]=i.heap[r],e=r,r<<=1;i.heap[e]=n},vu=(i,t,e)=>{let n,r,s=0,a,o;if(i.sym_next!==0)do n=i.pending_buf[i.sym_buf+s++]&255,n+=(i.pending_buf[i.sym_buf+s++]&255)<<8,r=i.pending_buf[i.sym_buf+s++],n===0?qe(i,r,t):(a=yr[r],qe(i,a+pr+1,t),o=jo[a],o!==0&&(r-=Vo[a],Ce(i,r,o)),n--,a=uu(n),qe(i,a,e),o=la[a],o!==0&&(n-=ha[a],Ce(i,n,o)));while(s<i.sym_next);qe(i,Ho,t)},Wo=(i,t)=>{const e=t.dyn_tree,n=t.stat_desc.static_tree,r=t.stat_desc.has_stree,s=t.stat_desc.elems;let a,o,l=-1,h;for(i.heap_len=0,i.heap_max=nu,a=0;a<s;a++)e[a*2]!==0?(i.heap[++i.heap_len]=l=a,i.depth[a]=0):e[a*2+1]=0;for(;i.heap_len<2;)h=i.heap[++i.heap_len]=l<2?++l:0,e[h*2]=1,i.depth[h]=0,i.opt_len--,r&&(i.static_len-=n[h*2+1]);for(t.max_code=l,a=i.heap_len>>1;a>=1;a--)Yo(i,e,a);h=s;do a=i.heap[1],i.heap[1]=i.heap[i.heap_len--],Yo(i,e,1),o=i.heap[1],i.heap[--i.heap_max]=a,i.heap[--i.heap_max]=o,e[h*2]=e[a*2]+e[o*2],i.depth[h]=(i.depth[a]>=i.depth[o]?i.depth[a]:i.depth[o])+1,e[a*2+1]=e[o*2+1]=h,i.heap[1]=h++,Yo(i,e,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],im(i,t),du(e,l,i.bl_count)},_u=(i,t,e)=>{let n,r=-1,s,a=t[0*2+1],o=0,l=7,h=4;for(a===0&&(l=138,h=3),t[(e+1)*2+1]=65535,n=0;n<=e;n++)s=a,a=t[(n+1)*2+1],!(++o<l&&s===a)&&(o<h?i.bl_tree[s*2]+=o:s!==0?(s!==r&&i.bl_tree[s*2]++,i.bl_tree[ru*2]++):o<=10?i.bl_tree[su*2]++:i.bl_tree[au*2]++,o=0,r=s,a===0?(l=138,h=3):s===a?(l=6,h=3):(l=7,h=4))},yu=(i,t,e)=>{let n,r=-1,s,a=t[0*2+1],o=0,l=7,h=4;for(a===0&&(l=138,h=3),n=0;n<=e;n++)if(s=a,a=t[(n+1)*2+1],!(++o<l&&s===a)){if(o<h)do qe(i,s,i.bl_tree);while(--o!==0);else s!==0?(s!==r&&(qe(i,s,i.bl_tree),o--),qe(i,ru,i.bl_tree),Ce(i,o-3,2)):o<=10?(qe(i,su,i.bl_tree),Ce(i,o-3,3)):(qe(i,au,i.bl_tree),Ce(i,o-11,7));o=0,r=s,a===0?(l=138,h=3):s===a?(l=6,h=3):(l=7,h=4)}},rm=i=>{let t;for(_u(i,i.dyn_ltree,i.l_desc.max_code),_u(i,i.dyn_dtree,i.d_desc.max_code),Wo(i,i.bl_desc),t=$o-1;t>=3&&i.bl_tree[ou[t]*2+1]===0;t--);return i.opt_len+=3*(t+1)+5+5+4,t},sm=(i,t,e,n)=>{let r;for(Ce(i,t-257,5),Ce(i,e-1,5),Ce(i,n-4,4),r=0;r<n;r++)Ce(i,i.bl_tree[ou[r]*2+1],3);yu(i,i.dyn_ltree,t-1),yu(i,i.dyn_dtree,e-1)},am=i=>{let t=4093624447,e;for(e=0;e<=31;e++,t>>>=1)if(t&1&&i.dyn_ltree[e*2]!==0)return tu;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return eu;for(e=32;e<pr;e++)if(i.dyn_ltree[e*2]!==0)return eu;return tu};let bu=!1;const om=i=>{bu||(nm(),bu=!0),i.l_desc=new Xo(i.dyn_ltree,lu),i.d_desc=new Xo(i.dyn_dtree,hu),i.bl_desc=new Xo(i.bl_tree,cu),i.bi_buf=0,i.bi_valid=0,gu(i)},wu=(i,t,e,n)=>{Ce(i,(Y2<<1)+(n?1:0),3),pu(i),br(i,e),br(i,~e),e&&i.pending_buf.set(i.window.subarray(t,t+e),i.pending),i.pending+=e},lm=i=>{Ce(i,iu<<1,3),qe(i,Ho,ni),em(i)},hm=(i,t,e,n)=>{let r,s,a=0;i.level>0?(i.strm.data_type===X2&&(i.strm.data_type=am(i)),Wo(i,i.l_desc),Wo(i,i.d_desc),a=rm(i),r=i.opt_len+3+7>>>3,s=i.static_len+3+7>>>3,s<=r&&(r=s)):r=s=e+5,e+4<=r&&t!==-1?wu(i,t,e,n):i.strategy===q2||s===r?(Ce(i,(iu<<1)+(n?1:0),3),vu(i,ni,vr)):(Ce(i,(W2<<1)+(n?1:0),3),sm(i,i.l_desc.max_code+1,i.d_desc.max_code+1,a+1),vu(i,i.dyn_ltree,i.dyn_dtree)),gu(i),n&&pu(i)},cm=(i,t,e)=>(i.pending_buf[i.sym_buf+i.sym_next++]=t,i.pending_buf[i.sym_buf+i.sym_next++]=t>>8,i.pending_buf[i.sym_buf+i.sym_next++]=e,t===0?i.dyn_ltree[e*2]++:(i.matches++,t--,i.dyn_ltree[(yr[e]+pr+1)*2]++,i.dyn_dtree[uu(t)*2]++),i.sym_next===i.sym_end);var um=om,fm=wu,dm=hm,gm=cm,pm=lm,mm={_tr_init:um,_tr_stored_block:fm,_tr_flush_block:dm,_tr_tally:gm,_tr_align:pm},wr=(i,t,e,n)=>{let r=i&65535|0,s=i>>>16&65535|0,a=0;for(;e!==0;){a=e>2e3?2e3:e,e-=a;do r=r+t[n++]|0,s=s+r|0;while(--a);r%=65521,s%=65521}return r|s<<16|0};const vm=()=>{let i,t=[];for(var e=0;e<256;e++){i=e;for(var n=0;n<8;n++)i=i&1?3988292384^i>>>1:i>>>1;t[e]=i}return t},_m=new Uint32Array(vm());var de=(i,t,e,n)=>{const r=_m,s=n+e;i^=-1;for(let a=n;a<s;a++)i=i>>>8^r[(i^t[a])&255];return i^-1},Wi={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ki={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:ym,_tr_stored_block:Ko,_tr_flush_block:bm,_tr_tally:xi,_tr_align:wm}=mm,{Z_NO_FLUSH:Si,Z_PARTIAL_FLUSH:xm,Z_FULL_FLUSH:Sm,Z_FINISH:Oe,Z_BLOCK:xu,Z_OK:ve,Z_STREAM_END:Su,Z_STREAM_ERROR:Xe,Z_DATA_ERROR:Cm,Z_BUF_ERROR:Zo,Z_DEFAULT_COMPRESSION:km,Z_FILTERED:Tm,Z_HUFFMAN_ONLY:ca,Z_RLE:Em,Z_FIXED:Am,Z_DEFAULT_STRATEGY:Pm,Z_UNKNOWN:Mm,Z_DEFLATED:ua}=Ki,Rm=9,Lm=15,Dm=8,Im=29,Jo=256+1+Im,Om=30,Fm=19,Nm=2*Jo+1,Um=15,Bt=3,Ci=258,Ye=Ci+Bt+1,Bm=32,Tn=42,Qo=57,tl=69,el=73,il=91,nl=103,Zi=113,xr=666,we=1,En=2,Ji=3,An=4,Gm=3,Qi=(i,t)=>(i.msg=Wi[t],t),Cu=i=>i*2-(i>4?9:0),ki=i=>{let t=i.length;for(;--t>=0;)i[t]=0},$m=i=>{let t,e,n,r=i.w_size;t=i.hash_size,n=t;do e=i.head[--n],i.head[n]=e>=r?e-r:0;while(--t);t=r,n=t;do e=i.prev[--n],i.prev[n]=e>=r?e-r:0;while(--t)};let Ti=(i,t,e)=>(t<<i.hash_shift^e)&i.hash_mask;const Ae=i=>{const t=i.state;let e=t.pending;e>i.avail_out&&(e=i.avail_out),e!==0&&(i.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+e),i.next_out),i.next_out+=e,t.pending_out+=e,i.total_out+=e,i.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))},Pe=(i,t)=>{bm(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,t),i.block_start=i.strstart,Ae(i.strm)},Ht=(i,t)=>{i.pending_buf[i.pending++]=t},Sr=(i,t)=>{i.pending_buf[i.pending++]=t>>>8&255,i.pending_buf[i.pending++]=t&255},rl=(i,t,e,n)=>{let r=i.avail_in;return r>n&&(r=n),r===0?0:(i.avail_in-=r,t.set(i.input.subarray(i.next_in,i.next_in+r),e),i.state.wrap===1?i.adler=wr(i.adler,t,r,e):i.state.wrap===2&&(i.adler=de(i.adler,t,r,e)),i.next_in+=r,i.total_in+=r,r)},ku=(i,t)=>{let e=i.max_chain_length,n=i.strstart,r,s,a=i.prev_length,o=i.nice_match;const l=i.strstart>i.w_size-Ye?i.strstart-(i.w_size-Ye):0,h=i.window,c=i.w_mask,d=i.prev,f=i.strstart+Ci;let u=h[n+a-1],p=h[n+a];i.prev_length>=i.good_match&&(e>>=2),o>i.lookahead&&(o=i.lookahead);do if(r=t,!(h[r+a]!==p||h[r+a-1]!==u||h[r]!==h[n]||h[++r]!==h[n+1])){n+=2,r++;do;while(h[++n]===h[++r]&&h[++n]===h[++r]&&h[++n]===h[++r]&&h[++n]===h[++r]&&h[++n]===h[++r]&&h[++n]===h[++r]&&h[++n]===h[++r]&&h[++n]===h[++r]&&n<f);if(s=Ci-(f-n),n=f-Ci,s>a){if(i.match_start=t,a=s,s>=o)break;u=h[n+a-1],p=h[n+a]}}while((t=d[t&c])>l&&--e!==0);return a<=i.lookahead?a:i.lookahead},Pn=i=>{const t=i.w_size;let e,n,r;do{if(n=i.window_size-i.lookahead-i.strstart,i.strstart>=t+(t-Ye)&&(i.window.set(i.window.subarray(t,t+t-n),0),i.match_start-=t,i.strstart-=t,i.block_start-=t,i.insert>i.strstart&&(i.insert=i.strstart),$m(i),n+=t),i.strm.avail_in===0)break;if(e=rl(i.strm,i.window,i.strstart+i.lookahead,n),i.lookahead+=e,i.lookahead+i.insert>=Bt)for(r=i.strstart-i.insert,i.ins_h=i.window[r],i.ins_h=Ti(i,i.ins_h,i.window[r+1]);i.insert&&(i.ins_h=Ti(i,i.ins_h,i.window[r+Bt-1]),i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++,i.insert--,!(i.lookahead+i.insert<Bt)););}while(i.lookahead<Ye&&i.strm.avail_in!==0)},Tu=(i,t)=>{let e=i.pending_buf_size-5>i.w_size?i.w_size:i.pending_buf_size-5,n,r,s,a=0,o=i.strm.avail_in;do{if(n=65535,s=i.bi_valid+42>>3,i.strm.avail_out<s||(s=i.strm.avail_out-s,r=i.strstart-i.block_start,n>r+i.strm.avail_in&&(n=r+i.strm.avail_in),n>s&&(n=s),n<e&&(n===0&&t!==Oe||t===Si||n!==r+i.strm.avail_in)))break;a=t===Oe&&n===r+i.strm.avail_in?1:0,Ko(i,0,0,a),i.pending_buf[i.pending-4]=n,i.pending_buf[i.pending-3]=n>>8,i.pending_buf[i.pending-2]=~n,i.pending_buf[i.pending-1]=~n>>8,Ae(i.strm),r&&(r>n&&(r=n),i.strm.output.set(i.window.subarray(i.block_start,i.block_start+r),i.strm.next_out),i.strm.next_out+=r,i.strm.avail_out-=r,i.strm.total_out+=r,i.block_start+=r,n-=r),n&&(rl(i.strm,i.strm.output,i.strm.next_out,n),i.strm.next_out+=n,i.strm.avail_out-=n,i.strm.total_out+=n)}while(a===0);return o-=i.strm.avail_in,o&&(o>=i.w_size?(i.matches=2,i.window.set(i.strm.input.subarray(i.strm.next_in-i.w_size,i.strm.next_in),0),i.strstart=i.w_size,i.insert=i.strstart):(i.window_size-i.strstart<=o&&(i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,i.insert>i.strstart&&(i.insert=i.strstart)),i.window.set(i.strm.input.subarray(i.strm.next_in-o,i.strm.next_in),i.strstart),i.strstart+=o,i.insert+=o>i.w_size-i.insert?i.w_size-i.insert:o),i.block_start=i.strstart),i.high_water<i.strstart&&(i.high_water=i.strstart),a?An:t!==Si&&t!==Oe&&i.strm.avail_in===0&&i.strstart===i.block_start?En:(s=i.window_size-i.strstart,i.strm.avail_in>s&&i.block_start>=i.w_size&&(i.block_start-=i.w_size,i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,s+=i.w_size,i.insert>i.strstart&&(i.insert=i.strstart)),s>i.strm.avail_in&&(s=i.strm.avail_in),s&&(rl(i.strm,i.window,i.strstart,s),i.strstart+=s,i.insert+=s>i.w_size-i.insert?i.w_size-i.insert:s),i.high_water<i.strstart&&(i.high_water=i.strstart),s=i.bi_valid+42>>3,s=i.pending_buf_size-s>65535?65535:i.pending_buf_size-s,e=s>i.w_size?i.w_size:s,r=i.strstart-i.block_start,(r>=e||(r||t===Oe)&&t!==Si&&i.strm.avail_in===0&&r<=s)&&(n=r>s?s:r,a=t===Oe&&i.strm.avail_in===0&&n===r?1:0,Ko(i,i.block_start,n,a),i.block_start+=n,Ae(i.strm)),a?Ji:we)},sl=(i,t)=>{let e,n;for(;;){if(i.lookahead<Ye){if(Pn(i),i.lookahead<Ye&&t===Si)return we;if(i.lookahead===0)break}if(e=0,i.lookahead>=Bt&&(i.ins_h=Ti(i,i.ins_h,i.window[i.strstart+Bt-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),e!==0&&i.strstart-e<=i.w_size-Ye&&(i.match_length=ku(i,e)),i.match_length>=Bt)if(n=xi(i,i.strstart-i.match_start,i.match_length-Bt),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=Bt){i.match_length--;do i.strstart++,i.ins_h=Ti(i,i.ins_h,i.window[i.strstart+Bt-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart;while(--i.match_length!==0);i.strstart++}else i.strstart+=i.match_length,i.match_length=0,i.ins_h=i.window[i.strstart],i.ins_h=Ti(i,i.ins_h,i.window[i.strstart+1]);else n=xi(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(n&&(Pe(i,!1),i.strm.avail_out===0))return we}return i.insert=i.strstart<Bt-1?i.strstart:Bt-1,t===Oe?(Pe(i,!0),i.strm.avail_out===0?Ji:An):i.sym_next&&(Pe(i,!1),i.strm.avail_out===0)?we:En},Mn=(i,t)=>{let e,n,r;for(;;){if(i.lookahead<Ye){if(Pn(i),i.lookahead<Ye&&t===Si)return we;if(i.lookahead===0)break}if(e=0,i.lookahead>=Bt&&(i.ins_h=Ti(i,i.ins_h,i.window[i.strstart+Bt-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),i.prev_length=i.match_length,i.prev_match=i.match_start,i.match_length=Bt-1,e!==0&&i.prev_length<i.max_lazy_match&&i.strstart-e<=i.w_size-Ye&&(i.match_length=ku(i,e),i.match_length<=5&&(i.strategy===Tm||i.match_length===Bt&&i.strstart-i.match_start>4096)&&(i.match_length=Bt-1)),i.prev_length>=Bt&&i.match_length<=i.prev_length){r=i.strstart+i.lookahead-Bt,n=xi(i,i.strstart-1-i.prev_match,i.prev_length-Bt),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=r&&(i.ins_h=Ti(i,i.ins_h,i.window[i.strstart+Bt-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart);while(--i.prev_length!==0);if(i.match_available=0,i.match_length=Bt-1,i.strstart++,n&&(Pe(i,!1),i.strm.avail_out===0))return we}else if(i.match_available){if(n=xi(i,0,i.window[i.strstart-1]),n&&Pe(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return we}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(n=xi(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<Bt-1?i.strstart:Bt-1,t===Oe?(Pe(i,!0),i.strm.avail_out===0?Ji:An):i.sym_next&&(Pe(i,!1),i.strm.avail_out===0)?we:En},zm=(i,t)=>{let e,n,r,s;const a=i.window;for(;;){if(i.lookahead<=Ci){if(Pn(i),i.lookahead<=Ci&&t===Si)return we;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=Bt&&i.strstart>0&&(r=i.strstart-1,n=a[r],n===a[++r]&&n===a[++r]&&n===a[++r])){s=i.strstart+Ci;do;while(n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&r<s);i.match_length=Ci-(s-r),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=Bt?(e=xi(i,1,i.match_length-Bt),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(e=xi(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),e&&(Pe(i,!1),i.strm.avail_out===0))return we}return i.insert=0,t===Oe?(Pe(i,!0),i.strm.avail_out===0?Ji:An):i.sym_next&&(Pe(i,!1),i.strm.avail_out===0)?we:En},Hm=(i,t)=>{let e;for(;;){if(i.lookahead===0&&(Pn(i),i.lookahead===0)){if(t===Si)return we;break}if(i.match_length=0,e=xi(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,e&&(Pe(i,!1),i.strm.avail_out===0))return we}return i.insert=0,t===Oe?(Pe(i,!0),i.strm.avail_out===0?Ji:An):i.sym_next&&(Pe(i,!1),i.strm.avail_out===0)?we:En};function We(i,t,e,n,r){this.good_length=i,this.max_lazy=t,this.nice_length=e,this.max_chain=n,this.func=r}const Cr=[new We(0,0,0,0,Tu),new We(4,4,8,4,sl),new We(4,5,16,8,sl),new We(4,6,32,32,sl),new We(4,4,16,16,Mn),new We(8,16,32,32,Mn),new We(8,16,128,128,Mn),new We(8,32,128,256,Mn),new We(32,128,258,1024,Mn),new We(32,258,258,4096,Mn)],jm=i=>{i.window_size=2*i.w_size,ki(i.head),i.max_lazy_match=Cr[i.level].max_lazy,i.good_match=Cr[i.level].good_length,i.nice_match=Cr[i.level].nice_length,i.max_chain_length=Cr[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=Bt-1,i.match_available=0,i.ins_h=0};function Vm(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ua,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Nm*2),this.dyn_dtree=new Uint16Array((2*Om+1)*2),this.bl_tree=new Uint16Array((2*Fm+1)*2),ki(this.dyn_ltree),ki(this.dyn_dtree),ki(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Um+1),this.heap=new Uint16Array(2*Jo+1),ki(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Jo+1),ki(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const kr=i=>{if(!i)return 1;const t=i.state;return!t||t.strm!==i||t.status!==Tn&&t.status!==Qo&&t.status!==tl&&t.status!==el&&t.status!==il&&t.status!==nl&&t.status!==Zi&&t.status!==xr?1:0},Eu=i=>{if(kr(i))return Qi(i,Xe);i.total_in=i.total_out=0,i.data_type=Mm;const t=i.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Qo:t.wrap?Tn:Zi,i.adler=t.wrap===2?0:1,t.last_flush=-2,ym(t),ve},Au=i=>{const t=Eu(i);return t===ve&&jm(i.state),t},qm=(i,t)=>kr(i)||i.state.wrap!==2?Xe:(i.state.gzhead=t,ve),Pu=(i,t,e,n,r,s)=>{if(!i)return Xe;let a=1;if(t===km&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),r<1||r>Rm||e!==ua||n<8||n>15||t<0||t>9||s<0||s>Am||n===8&&a!==1)return Qi(i,Xe);n===8&&(n=9);const o=new Vm;return i.state=o,o.strm=i,o.status=Tn,o.wrap=a,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=r+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+Bt-1)/Bt),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<r+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=t,o.strategy=s,o.method=e,Au(i)},Xm=(i,t)=>Pu(i,t,ua,Lm,Dm,Pm),Ym=(i,t)=>{if(kr(i)||t>xu||t<0)return i?Qi(i,Xe):Xe;const e=i.state;if(!i.output||i.avail_in!==0&&!i.input||e.status===xr&&t!==Oe)return Qi(i,i.avail_out===0?Zo:Xe);const n=e.last_flush;if(e.last_flush=t,e.pending!==0){if(Ae(i),i.avail_out===0)return e.last_flush=-1,ve}else if(i.avail_in===0&&Cu(t)<=Cu(n)&&t!==Oe)return Qi(i,Zo);if(e.status===xr&&i.avail_in!==0)return Qi(i,Zo);if(e.status===Tn&&e.wrap===0&&(e.status=Zi),e.status===Tn){let r=ua+(e.w_bits-8<<4)<<8,s=-1;if(e.strategy>=ca||e.level<2?s=0:e.level<6?s=1:e.level===6?s=2:s=3,r|=s<<6,e.strstart!==0&&(r|=Bm),r+=31-r%31,Sr(e,r),e.strstart!==0&&(Sr(e,i.adler>>>16),Sr(e,i.adler&65535)),i.adler=1,e.status=Zi,Ae(i),e.pending!==0)return e.last_flush=-1,ve}if(e.status===Qo){if(i.adler=0,Ht(e,31),Ht(e,139),Ht(e,8),e.gzhead)Ht(e,(e.gzhead.text?1:0)+(e.gzhead.hcrc?2:0)+(e.gzhead.extra?4:0)+(e.gzhead.name?8:0)+(e.gzhead.comment?16:0)),Ht(e,e.gzhead.time&255),Ht(e,e.gzhead.time>>8&255),Ht(e,e.gzhead.time>>16&255),Ht(e,e.gzhead.time>>24&255),Ht(e,e.level===9?2:e.strategy>=ca||e.level<2?4:0),Ht(e,e.gzhead.os&255),e.gzhead.extra&&e.gzhead.extra.length&&(Ht(e,e.gzhead.extra.length&255),Ht(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(i.adler=de(i.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=tl;else if(Ht(e,0),Ht(e,0),Ht(e,0),Ht(e,0),Ht(e,0),Ht(e,e.level===9?2:e.strategy>=ca||e.level<2?4:0),Ht(e,Gm),e.status=Zi,Ae(i),e.pending!==0)return e.last_flush=-1,ve}if(e.status===tl){if(e.gzhead.extra){let r=e.pending,s=(e.gzhead.extra.length&65535)-e.gzindex;for(;e.pending+s>e.pending_buf_size;){let o=e.pending_buf_size-e.pending;if(e.pending_buf.set(e.gzhead.extra.subarray(e.gzindex,e.gzindex+o),e.pending),e.pending=e.pending_buf_size,e.gzhead.hcrc&&e.pending>r&&(i.adler=de(i.adler,e.pending_buf,e.pending-r,r)),e.gzindex+=o,Ae(i),e.pending!==0)return e.last_flush=-1,ve;r=0,s-=o}let a=new Uint8Array(e.gzhead.extra);e.pending_buf.set(a.subarray(e.gzindex,e.gzindex+s),e.pending),e.pending+=s,e.gzhead.hcrc&&e.pending>r&&(i.adler=de(i.adler,e.pending_buf,e.pending-r,r)),e.gzindex=0}e.status=el}if(e.status===el){if(e.gzhead.name){let r=e.pending,s;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>r&&(i.adler=de(i.adler,e.pending_buf,e.pending-r,r)),Ae(i),e.pending!==0)return e.last_flush=-1,ve;r=0}e.gzindex<e.gzhead.name.length?s=e.gzhead.name.charCodeAt(e.gzindex++)&255:s=0,Ht(e,s)}while(s!==0);e.gzhead.hcrc&&e.pending>r&&(i.adler=de(i.adler,e.pending_buf,e.pending-r,r)),e.gzindex=0}e.status=il}if(e.status===il){if(e.gzhead.comment){let r=e.pending,s;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>r&&(i.adler=de(i.adler,e.pending_buf,e.pending-r,r)),Ae(i),e.pending!==0)return e.last_flush=-1,ve;r=0}e.gzindex<e.gzhead.comment.length?s=e.gzhead.comment.charCodeAt(e.gzindex++)&255:s=0,Ht(e,s)}while(s!==0);e.gzhead.hcrc&&e.pending>r&&(i.adler=de(i.adler,e.pending_buf,e.pending-r,r))}e.status=nl}if(e.status===nl){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(Ae(i),e.pending!==0))return e.last_flush=-1,ve;Ht(e,i.adler&255),Ht(e,i.adler>>8&255),i.adler=0}if(e.status=Zi,Ae(i),e.pending!==0)return e.last_flush=-1,ve}if(i.avail_in!==0||e.lookahead!==0||t!==Si&&e.status!==xr){let r=e.level===0?Tu(e,t):e.strategy===ca?Hm(e,t):e.strategy===Em?zm(e,t):Cr[e.level].func(e,t);if((r===Ji||r===An)&&(e.status=xr),r===we||r===Ji)return i.avail_out===0&&(e.last_flush=-1),ve;if(r===En&&(t===xm?wm(e):t!==xu&&(Ko(e,0,0,!1),t===Sm&&(ki(e.head),e.lookahead===0&&(e.strstart=0,e.block_start=0,e.insert=0))),Ae(i),i.avail_out===0))return e.last_flush=-1,ve}return t!==Oe?ve:e.wrap<=0?Su:(e.wrap===2?(Ht(e,i.adler&255),Ht(e,i.adler>>8&255),Ht(e,i.adler>>16&255),Ht(e,i.adler>>24&255),Ht(e,i.total_in&255),Ht(e,i.total_in>>8&255),Ht(e,i.total_in>>16&255),Ht(e,i.total_in>>24&255)):(Sr(e,i.adler>>>16),Sr(e,i.adler&65535)),Ae(i),e.wrap>0&&(e.wrap=-e.wrap),e.pending!==0?ve:Su)},Wm=i=>{if(kr(i))return Xe;const t=i.state.status;return i.state=null,t===Zi?Qi(i,Cm):ve},Km=(i,t)=>{let e=t.length;if(kr(i))return Xe;const n=i.state,r=n.wrap;if(r===2||r===1&&n.status!==Tn||n.lookahead)return Xe;if(r===1&&(i.adler=wr(i.adler,t,e,0)),n.wrap=0,e>=n.w_size){r===0&&(ki(n.head),n.strstart=0,n.block_start=0,n.insert=0);let l=new Uint8Array(n.w_size);l.set(t.subarray(e-n.w_size,e),0),t=l,e=n.w_size}const s=i.avail_in,a=i.next_in,o=i.input;for(i.avail_in=e,i.next_in=0,i.input=t,Pn(n);n.lookahead>=Bt;){let l=n.strstart,h=n.lookahead-(Bt-1);do n.ins_h=Ti(n,n.ins_h,n.window[l+Bt-1]),n.prev[l&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=l,l++;while(--h);n.strstart=l,n.lookahead=Bt-1,Pn(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=Bt-1,n.match_available=0,i.next_in=a,i.input=o,i.avail_in=s,n.wrap=r,ve};var Zm=Xm,Jm=Pu,Qm=Au,tv=Eu,ev=qm,iv=Ym,nv=Wm,rv=Km,sv="pako deflate (from Nodeca project)",Tr={deflateInit:Zm,deflateInit2:Jm,deflateReset:Qm,deflateResetKeep:tv,deflateSetHeader:ev,deflate:iv,deflateEnd:nv,deflateSetDictionary:rv,deflateInfo:sv};const av=(i,t)=>Object.prototype.hasOwnProperty.call(i,t);var ov=function(i){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)av(e,n)&&(i[n]=e[n])}}return i},lv=i=>{let t=0;for(let n=0,r=i.length;n<r;n++)t+=i[n].length;const e=new Uint8Array(t);for(let n=0,r=0,s=i.length;n<s;n++){let a=i[n];e.set(a,r),r+=a.length}return e},fa={assign:ov,flattenChunks:lv};let Mu=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Mu=!1}const Er=new Uint8Array(256);for(let i=0;i<256;i++)Er[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;Er[254]=Er[254]=1;var hv=i=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let t,e,n,r,s,a=i.length,o=0;for(r=0;r<a;r++)e=i.charCodeAt(r),(e&64512)===55296&&r+1<a&&(n=i.charCodeAt(r+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),r++)),o+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(o),s=0,r=0;s<o;r++)e=i.charCodeAt(r),(e&64512)===55296&&r+1<a&&(n=i.charCodeAt(r+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),r++)),e<128?t[s++]=e:e<2048?(t[s++]=192|e>>>6,t[s++]=128|e&63):e<65536?(t[s++]=224|e>>>12,t[s++]=128|e>>>6&63,t[s++]=128|e&63):(t[s++]=240|e>>>18,t[s++]=128|e>>>12&63,t[s++]=128|e>>>6&63,t[s++]=128|e&63);return t};const cv=(i,t)=>{if(t<65534&&i.subarray&&Mu)return String.fromCharCode.apply(null,i.length===t?i:i.subarray(0,t));let e="";for(let n=0;n<t;n++)e+=String.fromCharCode(i[n]);return e};var uv=(i,t)=>{const e=t||i.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,t));let n,r;const s=new Array(e*2);for(r=0,n=0;n<e;){let a=i[n++];if(a<128){s[r++]=a;continue}let o=Er[a];if(o>4){s[r++]=65533,n+=o-1;continue}for(a&=o===2?31:o===3?15:7;o>1&&n<e;)a=a<<6|i[n++]&63,o--;if(o>1){s[r++]=65533;continue}a<65536?s[r++]=a:(a-=65536,s[r++]=55296|a>>10&1023,s[r++]=56320|a&1023)}return cv(s,r)},fv=(i,t)=>{t=t||i.length,t>i.length&&(t=i.length);let e=t-1;for(;e>=0&&(i[e]&192)===128;)e--;return e<0||e===0?t:e+Er[i[e]]>t?e:t},Ar={string2buf:hv,buf2string:uv,utf8border:fv};function dv(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Ru=dv;const Lu=Object.prototype.toString,{Z_NO_FLUSH:gv,Z_SYNC_FLUSH:pv,Z_FULL_FLUSH:mv,Z_FINISH:vv,Z_OK:da,Z_STREAM_END:_v,Z_DEFAULT_COMPRESSION:yv,Z_DEFAULT_STRATEGY:bv,Z_DEFLATED:wv}=Ki;function Pr(i){this.options=fa.assign({level:yv,method:wv,chunkSize:16384,windowBits:15,memLevel:8,strategy:bv},i||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ru,this.strm.avail_out=0;let e=Tr.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==da)throw new Error(Wi[e]);if(t.header&&Tr.deflateSetHeader(this.strm,t.header),t.dictionary){let n;if(typeof t.dictionary=="string"?n=Ar.string2buf(t.dictionary):Lu.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,e=Tr.deflateSetDictionary(this.strm,n),e!==da)throw new Error(Wi[e]);this._dict_set=!0}}Pr.prototype.push=function(i,t){const e=this.strm,n=this.options.chunkSize;let r,s;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?vv:gv,typeof i=="string"?e.input=Ar.string2buf(i):Lu.call(i)==="[object ArrayBuffer]"?e.input=new Uint8Array(i):e.input=i,e.next_in=0,e.avail_in=e.input.length;;){if(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),(s===pv||s===mv)&&e.avail_out<=6){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(r=Tr.deflate(e,s),r===_v)return e.next_out>0&&this.onData(e.output.subarray(0,e.next_out)),r=Tr.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===da;if(e.avail_out===0){this.onData(e.output);continue}if(s>0&&e.next_out>0){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(e.avail_in===0)break}return!0},Pr.prototype.onData=function(i){this.chunks.push(i)},Pr.prototype.onEnd=function(i){i===da&&(this.result=fa.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function al(i,t){const e=new Pr(t);if(e.push(i,!0),e.err)throw e.msg||Wi[e.err];return e.result}function xv(i,t){return t=t||{},t.raw=!0,al(i,t)}function Sv(i,t){return t=t||{},t.gzip=!0,al(i,t)}var Cv=Pr,kv=al,Tv=xv,Ev=Sv,Av=Ki,Pv={Deflate:Cv,deflate:kv,deflateRaw:Tv,gzip:Ev,constants:Av};const ga=16209,Mv=16191;var Rv=function(t,e){let n,r,s,a,o,l,h,c,d,f,u,p,m,y,S,C,_,w,k,A,R,P,U,I;const N=t.state;n=t.next_in,U=t.input,r=n+(t.avail_in-5),s=t.next_out,I=t.output,a=s-(e-t.avail_out),o=s+(t.avail_out-257),l=N.dmax,h=N.wsize,c=N.whave,d=N.wnext,f=N.window,u=N.hold,p=N.bits,m=N.lencode,y=N.distcode,S=(1<<N.lenbits)-1,C=(1<<N.distbits)-1;t:do{p<15&&(u+=U[n++]<<p,p+=8,u+=U[n++]<<p,p+=8),_=m[u&S];e:for(;;){if(w=_>>>24,u>>>=w,p-=w,w=_>>>16&255,w===0)I[s++]=_&65535;else if(w&16){k=_&65535,w&=15,w&&(p<w&&(u+=U[n++]<<p,p+=8),k+=u&(1<<w)-1,u>>>=w,p-=w),p<15&&(u+=U[n++]<<p,p+=8,u+=U[n++]<<p,p+=8),_=y[u&C];i:for(;;){if(w=_>>>24,u>>>=w,p-=w,w=_>>>16&255,w&16){if(A=_&65535,w&=15,p<w&&(u+=U[n++]<<p,p+=8,p<w&&(u+=U[n++]<<p,p+=8)),A+=u&(1<<w)-1,A>l){t.msg="invalid distance too far back",N.mode=ga;break t}if(u>>>=w,p-=w,w=s-a,A>w){if(w=A-w,w>c&&N.sane){t.msg="invalid distance too far back",N.mode=ga;break t}if(R=0,P=f,d===0){if(R+=h-w,w<k){k-=w;do I[s++]=f[R++];while(--w);R=s-A,P=I}}else if(d<w){if(R+=h+d-w,w-=d,w<k){k-=w;do I[s++]=f[R++];while(--w);if(R=0,d<k){w=d,k-=w;do I[s++]=f[R++];while(--w);R=s-A,P=I}}}else if(R+=d-w,w<k){k-=w;do I[s++]=f[R++];while(--w);R=s-A,P=I}for(;k>2;)I[s++]=P[R++],I[s++]=P[R++],I[s++]=P[R++],k-=3;k&&(I[s++]=P[R++],k>1&&(I[s++]=P[R++]))}else{R=s-A;do I[s++]=I[R++],I[s++]=I[R++],I[s++]=I[R++],k-=3;while(k>2);k&&(I[s++]=I[R++],k>1&&(I[s++]=I[R++]))}}else if(w&64){t.msg="invalid distance code",N.mode=ga;break t}else{_=y[(_&65535)+(u&(1<<w)-1)];continue i}break}}else if(w&64)if(w&32){N.mode=Mv;break t}else{t.msg="invalid literal/length code",N.mode=ga;break t}else{_=m[(_&65535)+(u&(1<<w)-1)];continue e}break}}while(n<r&&s<o);k=p>>3,n-=k,p-=k<<3,u&=(1<<p)-1,t.next_in=n,t.next_out=s,t.avail_in=n<r?5+(r-n):5-(n-r),t.avail_out=s<o?257+(o-s):257-(s-o),N.hold=u,N.bits=p};const Rn=15,Du=852,Iu=592,Ou=0,ol=1,Fu=2,Lv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Dv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Iv=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ov=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mr=(i,t,e,n,r,s,a,o)=>{const l=o.bits;let h=0,c=0,d=0,f=0,u=0,p=0,m=0,y=0,S=0,C=0,_,w,k,A,R,P=null,U;const I=new Uint16Array(Rn+1),N=new Uint16Array(Rn+1);let q=null,W,K,it;for(h=0;h<=Rn;h++)I[h]=0;for(c=0;c<n;c++)I[t[e+c]]++;for(u=l,f=Rn;f>=1&&I[f]===0;f--);if(u>f&&(u=f),f===0)return r[s++]=1<<24|64<<16|0,r[s++]=1<<24|64<<16|0,o.bits=1,0;for(d=1;d<f&&I[d]===0;d++);for(u<d&&(u=d),y=1,h=1;h<=Rn;h++)if(y<<=1,y-=I[h],y<0)return-1;if(y>0&&(i===Ou||f!==1))return-1;for(N[1]=0,h=1;h<Rn;h++)N[h+1]=N[h]+I[h];for(c=0;c<n;c++)t[e+c]!==0&&(a[N[t[e+c]]++]=c);if(i===Ou?(P=q=a,U=20):i===ol?(P=Lv,q=Dv,U=257):(P=Iv,q=Ov,U=0),C=0,c=0,h=d,R=s,p=u,m=0,k=-1,S=1<<u,A=S-1,i===ol&&S>Du||i===Fu&&S>Iu)return 1;for(;;){W=h-m,a[c]+1<U?(K=0,it=a[c]):a[c]>=U?(K=q[a[c]-U],it=P[a[c]-U]):(K=32+64,it=0),_=1<<h-m,w=1<<p,d=w;do w-=_,r[R+(C>>m)+w]=W<<24|K<<16|it|0;while(w!==0);for(_=1<<h-1;C&_;)_>>=1;if(_!==0?(C&=_-1,C+=_):C=0,c++,--I[h]===0){if(h===f)break;h=t[e+a[c]]}if(h>u&&(C&A)!==k){for(m===0&&(m=u),R+=d,p=h-m,y=1<<p;p+m<f&&(y-=I[p+m],!(y<=0));)p++,y<<=1;if(S+=1<<p,i===ol&&S>Du||i===Fu&&S>Iu)return 1;k=C&A,r[k]=u<<24|p<<16|R-s|0}}return C!==0&&(r[R+C]=h-m<<24|64<<16|0),o.bits=u,0};const Fv=0,Nu=1,Uu=2,{Z_FINISH:Bu,Z_BLOCK:Nv,Z_TREES:pa,Z_OK:tn,Z_STREAM_END:Uv,Z_NEED_DICT:Bv,Z_STREAM_ERROR:Fe,Z_DATA_ERROR:Gu,Z_MEM_ERROR:$u,Z_BUF_ERROR:Gv,Z_DEFLATED:zu}=Ki,ma=16180,Hu=16181,ju=16182,Vu=16183,qu=16184,Xu=16185,Yu=16186,Wu=16187,Ku=16188,Zu=16189,va=16190,ri=16191,ll=16192,Ju=16193,hl=16194,Qu=16195,tf=16196,ef=16197,nf=16198,_a=16199,ya=16200,rf=16201,sf=16202,af=16203,of=16204,lf=16205,cl=16206,hf=16207,cf=16208,Jt=16209,uf=16210,ff=16211,$v=852,zv=592,Hv=15,df=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function jv(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const en=i=>{if(!i)return 1;const t=i.state;return!t||t.strm!==i||t.mode<ma||t.mode>ff?1:0},gf=i=>{if(en(i))return Fe;const t=i.state;return i.total_in=i.total_out=t.total=0,i.msg="",t.wrap&&(i.adler=t.wrap&1),t.mode=ma,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array($v),t.distcode=t.distdyn=new Int32Array(zv),t.sane=1,t.back=-1,tn},pf=i=>{if(en(i))return Fe;const t=i.state;return t.wsize=0,t.whave=0,t.wnext=0,gf(i)},mf=(i,t)=>{let e;if(en(i))return Fe;const n=i.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Fe:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,pf(i))},vf=(i,t)=>{if(!i)return Fe;const e=new jv;i.state=e,e.strm=i,e.window=null,e.mode=ma;const n=mf(i,t);return n!==tn&&(i.state=null),n},Vv=i=>vf(i,Hv);let _f=!0,ul,fl;const qv=i=>{if(_f){ul=new Int32Array(512),fl=new Int32Array(32);let t=0;for(;t<144;)i.lens[t++]=8;for(;t<256;)i.lens[t++]=9;for(;t<280;)i.lens[t++]=7;for(;t<288;)i.lens[t++]=8;for(Mr(Nu,i.lens,0,288,ul,0,i.work,{bits:9}),t=0;t<32;)i.lens[t++]=5;Mr(Uu,i.lens,0,32,fl,0,i.work,{bits:5}),_f=!1}i.lencode=ul,i.lenbits=9,i.distcode=fl,i.distbits=5},yf=(i,t,e,n)=>{let r;const s=i.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),n>=s.wsize?(s.window.set(t.subarray(e-s.wsize,e),0),s.wnext=0,s.whave=s.wsize):(r=s.wsize-s.wnext,r>n&&(r=n),s.window.set(t.subarray(e-n,e-n+r),s.wnext),n-=r,n?(s.window.set(t.subarray(e-n,e),0),s.wnext=n,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0},Xv=(i,t)=>{let e,n,r,s,a,o,l,h,c,d,f,u,p,m,y=0,S,C,_,w,k,A,R,P;const U=new Uint8Array(4);let I,N;const q=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(en(i)||!i.output||!i.input&&i.avail_in!==0)return Fe;e=i.state,e.mode===ri&&(e.mode=ll),a=i.next_out,r=i.output,l=i.avail_out,s=i.next_in,n=i.input,o=i.avail_in,h=e.hold,c=e.bits,d=o,f=l,P=tn;t:for(;;)switch(e.mode){case ma:if(e.wrap===0){e.mode=ll;break}for(;c<16;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(e.wrap&2&&h===35615){e.wbits===0&&(e.wbits=15),e.check=0,U[0]=h&255,U[1]=h>>>8&255,e.check=de(e.check,U,2,0),h=0,c=0,e.mode=Hu;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((h&255)<<8)+(h>>8))%31){i.msg="incorrect header check",e.mode=Jt;break}if((h&15)!==zu){i.msg="unknown compression method",e.mode=Jt;break}if(h>>>=4,c-=4,R=(h&15)+8,e.wbits===0&&(e.wbits=R),R>15||R>e.wbits){i.msg="invalid window size",e.mode=Jt;break}e.dmax=1<<e.wbits,e.flags=0,i.adler=e.check=1,e.mode=h&512?Zu:ri,h=0,c=0;break;case Hu:for(;c<16;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(e.flags=h,(e.flags&255)!==zu){i.msg="unknown compression method",e.mode=Jt;break}if(e.flags&57344){i.msg="unknown header flags set",e.mode=Jt;break}e.head&&(e.head.text=h>>8&1),e.flags&512&&e.wrap&4&&(U[0]=h&255,U[1]=h>>>8&255,e.check=de(e.check,U,2,0)),h=0,c=0,e.mode=ju;case ju:for(;c<32;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}e.head&&(e.head.time=h),e.flags&512&&e.wrap&4&&(U[0]=h&255,U[1]=h>>>8&255,U[2]=h>>>16&255,U[3]=h>>>24&255,e.check=de(e.check,U,4,0)),h=0,c=0,e.mode=Vu;case Vu:for(;c<16;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}e.head&&(e.head.xflags=h&255,e.head.os=h>>8),e.flags&512&&e.wrap&4&&(U[0]=h&255,U[1]=h>>>8&255,e.check=de(e.check,U,2,0)),h=0,c=0,e.mode=qu;case qu:if(e.flags&1024){for(;c<16;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}e.length=h,e.head&&(e.head.extra_len=h),e.flags&512&&e.wrap&4&&(U[0]=h&255,U[1]=h>>>8&255,e.check=de(e.check,U,2,0)),h=0,c=0}else e.head&&(e.head.extra=null);e.mode=Xu;case Xu:if(e.flags&1024&&(u=e.length,u>o&&(u=o),u&&(e.head&&(R=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(s,s+u),R)),e.flags&512&&e.wrap&4&&(e.check=de(e.check,n,u,s)),o-=u,s+=u,e.length-=u),e.length))break t;e.length=0,e.mode=Yu;case Yu:if(e.flags&2048){if(o===0)break t;u=0;do R=n[s+u++],e.head&&R&&e.length<65536&&(e.head.name+=String.fromCharCode(R));while(R&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=de(e.check,n,u,s)),o-=u,s+=u,R)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=Wu;case Wu:if(e.flags&4096){if(o===0)break t;u=0;do R=n[s+u++],e.head&&R&&e.length<65536&&(e.head.comment+=String.fromCharCode(R));while(R&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=de(e.check,n,u,s)),o-=u,s+=u,R)break t}else e.head&&(e.head.comment=null);e.mode=Ku;case Ku:if(e.flags&512){for(;c<16;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(e.wrap&4&&h!==(e.check&65535)){i.msg="header crc mismatch",e.mode=Jt;break}h=0,c=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),i.adler=e.check=0,e.mode=ri;break;case Zu:for(;c<32;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}i.adler=e.check=df(h),h=0,c=0,e.mode=va;case va:if(e.havedict===0)return i.next_out=a,i.avail_out=l,i.next_in=s,i.avail_in=o,e.hold=h,e.bits=c,Bv;i.adler=e.check=1,e.mode=ri;case ri:if(t===Nv||t===pa)break t;case ll:if(e.last){h>>>=c&7,c-=c&7,e.mode=cl;break}for(;c<3;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}switch(e.last=h&1,h>>>=1,c-=1,h&3){case 0:e.mode=Ju;break;case 1:if(qv(e),e.mode=_a,t===pa){h>>>=2,c-=2;break t}break;case 2:e.mode=tf;break;case 3:i.msg="invalid block type",e.mode=Jt}h>>>=2,c-=2;break;case Ju:for(h>>>=c&7,c-=c&7;c<32;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if((h&65535)!==(h>>>16^65535)){i.msg="invalid stored block lengths",e.mode=Jt;break}if(e.length=h&65535,h=0,c=0,e.mode=hl,t===pa)break t;case hl:e.mode=Qu;case Qu:if(u=e.length,u){if(u>o&&(u=o),u>l&&(u=l),u===0)break t;r.set(n.subarray(s,s+u),a),o-=u,s+=u,l-=u,a+=u,e.length-=u;break}e.mode=ri;break;case tf:for(;c<14;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(e.nlen=(h&31)+257,h>>>=5,c-=5,e.ndist=(h&31)+1,h>>>=5,c-=5,e.ncode=(h&15)+4,h>>>=4,c-=4,e.nlen>286||e.ndist>30){i.msg="too many length or distance symbols",e.mode=Jt;break}e.have=0,e.mode=ef;case ef:for(;e.have<e.ncode;){for(;c<3;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}e.lens[q[e.have++]]=h&7,h>>>=3,c-=3}for(;e.have<19;)e.lens[q[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,I={bits:e.lenbits},P=Mr(Fv,e.lens,0,19,e.lencode,0,e.work,I),e.lenbits=I.bits,P){i.msg="invalid code lengths set",e.mode=Jt;break}e.have=0,e.mode=nf;case nf:for(;e.have<e.nlen+e.ndist;){for(;y=e.lencode[h&(1<<e.lenbits)-1],S=y>>>24,C=y>>>16&255,_=y&65535,!(S<=c);){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(_<16)h>>>=S,c-=S,e.lens[e.have++]=_;else{if(_===16){for(N=S+2;c<N;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(h>>>=S,c-=S,e.have===0){i.msg="invalid bit length repeat",e.mode=Jt;break}R=e.lens[e.have-1],u=3+(h&3),h>>>=2,c-=2}else if(_===17){for(N=S+3;c<N;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}h>>>=S,c-=S,R=0,u=3+(h&7),h>>>=3,c-=3}else{for(N=S+7;c<N;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}h>>>=S,c-=S,R=0,u=11+(h&127),h>>>=7,c-=7}if(e.have+u>e.nlen+e.ndist){i.msg="invalid bit length repeat",e.mode=Jt;break}for(;u--;)e.lens[e.have++]=R}}if(e.mode===Jt)break;if(e.lens[256]===0){i.msg="invalid code -- missing end-of-block",e.mode=Jt;break}if(e.lenbits=9,I={bits:e.lenbits},P=Mr(Nu,e.lens,0,e.nlen,e.lencode,0,e.work,I),e.lenbits=I.bits,P){i.msg="invalid literal/lengths set",e.mode=Jt;break}if(e.distbits=6,e.distcode=e.distdyn,I={bits:e.distbits},P=Mr(Uu,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,I),e.distbits=I.bits,P){i.msg="invalid distances set",e.mode=Jt;break}if(e.mode=_a,t===pa)break t;case _a:e.mode=ya;case ya:if(o>=6&&l>=258){i.next_out=a,i.avail_out=l,i.next_in=s,i.avail_in=o,e.hold=h,e.bits=c,Rv(i,f),a=i.next_out,r=i.output,l=i.avail_out,s=i.next_in,n=i.input,o=i.avail_in,h=e.hold,c=e.bits,e.mode===ri&&(e.back=-1);break}for(e.back=0;y=e.lencode[h&(1<<e.lenbits)-1],S=y>>>24,C=y>>>16&255,_=y&65535,!(S<=c);){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(C&&!(C&240)){for(w=S,k=C,A=_;y=e.lencode[A+((h&(1<<w+k)-1)>>w)],S=y>>>24,C=y>>>16&255,_=y&65535,!(w+S<=c);){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}h>>>=w,c-=w,e.back+=w}if(h>>>=S,c-=S,e.back+=S,e.length=_,C===0){e.mode=lf;break}if(C&32){e.back=-1,e.mode=ri;break}if(C&64){i.msg="invalid literal/length code",e.mode=Jt;break}e.extra=C&15,e.mode=rf;case rf:if(e.extra){for(N=e.extra;c<N;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}e.length+=h&(1<<e.extra)-1,h>>>=e.extra,c-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=sf;case sf:for(;y=e.distcode[h&(1<<e.distbits)-1],S=y>>>24,C=y>>>16&255,_=y&65535,!(S<=c);){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(!(C&240)){for(w=S,k=C,A=_;y=e.distcode[A+((h&(1<<w+k)-1)>>w)],S=y>>>24,C=y>>>16&255,_=y&65535,!(w+S<=c);){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}h>>>=w,c-=w,e.back+=w}if(h>>>=S,c-=S,e.back+=S,C&64){i.msg="invalid distance code",e.mode=Jt;break}e.offset=_,e.extra=C&15,e.mode=af;case af:if(e.extra){for(N=e.extra;c<N;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}e.offset+=h&(1<<e.extra)-1,h>>>=e.extra,c-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){i.msg="invalid distance too far back",e.mode=Jt;break}e.mode=of;case of:if(l===0)break t;if(u=f-l,e.offset>u){if(u=e.offset-u,u>e.whave&&e.sane){i.msg="invalid distance too far back",e.mode=Jt;break}u>e.wnext?(u-=e.wnext,p=e.wsize-u):p=e.wnext-u,u>e.length&&(u=e.length),m=e.window}else m=r,p=a-e.offset,u=e.length;u>l&&(u=l),l-=u,e.length-=u;do r[a++]=m[p++];while(--u);e.length===0&&(e.mode=ya);break;case lf:if(l===0)break t;r[a++]=e.length,l--,e.mode=ya;break;case cl:if(e.wrap){for(;c<32;){if(o===0)break t;o--,h|=n[s++]<<c,c+=8}if(f-=l,i.total_out+=f,e.total+=f,e.wrap&4&&f&&(i.adler=e.check=e.flags?de(e.check,r,f,a-f):wr(e.check,r,f,a-f)),f=l,e.wrap&4&&(e.flags?h:df(h))!==e.check){i.msg="incorrect data check",e.mode=Jt;break}h=0,c=0}e.mode=hf;case hf:if(e.wrap&&e.flags){for(;c<32;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(e.wrap&4&&h!==(e.total&4294967295)){i.msg="incorrect length check",e.mode=Jt;break}h=0,c=0}e.mode=cf;case cf:P=Uv;break t;case Jt:P=Gu;break t;case uf:return $u;case ff:default:return Fe}return i.next_out=a,i.avail_out=l,i.next_in=s,i.avail_in=o,e.hold=h,e.bits=c,(e.wsize||f!==i.avail_out&&e.mode<Jt&&(e.mode<cl||t!==Bu))&&yf(i,i.output,i.next_out,f-i.avail_out),d-=i.avail_in,f-=i.avail_out,i.total_in+=d,i.total_out+=f,e.total+=f,e.wrap&4&&f&&(i.adler=e.check=e.flags?de(e.check,r,f,i.next_out-f):wr(e.check,r,f,i.next_out-f)),i.data_type=e.bits+(e.last?64:0)+(e.mode===ri?128:0)+(e.mode===_a||e.mode===hl?256:0),(d===0&&f===0||t===Bu)&&P===tn&&(P=Gv),P},Yv=i=>{if(en(i))return Fe;let t=i.state;return t.window&&(t.window=null),i.state=null,tn},Wv=(i,t)=>{if(en(i))return Fe;const e=i.state;return e.wrap&2?(e.head=t,t.done=!1,tn):Fe},Kv=(i,t)=>{const e=t.length;let n,r,s;return en(i)||(n=i.state,n.wrap!==0&&n.mode!==va)?Fe:n.mode===va&&(r=1,r=wr(r,t,e,0),r!==n.check)?Gu:(s=yf(i,t,e,e),s?(n.mode=uf,$u):(n.havedict=1,tn))};var Zv=pf,Jv=mf,Qv=gf,t5=Vv,e5=vf,i5=Xv,n5=Yv,r5=Wv,s5=Kv,a5="pako inflate (from Nodeca project)",si={inflateReset:Zv,inflateReset2:Jv,inflateResetKeep:Qv,inflateInit:t5,inflateInit2:e5,inflate:i5,inflateEnd:n5,inflateGetHeader:r5,inflateSetDictionary:s5,inflateInfo:a5};function o5(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var l5=o5;const bf=Object.prototype.toString,{Z_NO_FLUSH:h5,Z_FINISH:c5,Z_OK:Rr,Z_STREAM_END:dl,Z_NEED_DICT:gl,Z_STREAM_ERROR:u5,Z_DATA_ERROR:wf,Z_MEM_ERROR:f5}=Ki;function Lr(i){this.options=fa.assign({chunkSize:65536,windowBits:15,to:""},i||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(i&&i.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ru,this.strm.avail_out=0;let e=si.inflateInit2(this.strm,t.windowBits);if(e!==Rr)throw new Error(Wi[e]);if(this.header=new l5,si.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Ar.string2buf(t.dictionary):bf.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=si.inflateSetDictionary(this.strm,t.dictionary),e!==Rr)))throw new Error(Wi[e])}Lr.prototype.push=function(i,t){const e=this.strm,n=this.options.chunkSize,r=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?c5:h5,bf.call(i)==="[object ArrayBuffer]"?e.input=new Uint8Array(i):e.input=i,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),s=si.inflate(e,a),s===gl&&r&&(s=si.inflateSetDictionary(e,r),s===Rr?s=si.inflate(e,a):s===wf&&(s=gl));e.avail_in>0&&s===dl&&e.state.wrap>0&&i[e.next_in]!==0;)si.inflateReset(e),s=si.inflate(e,a);switch(s){case u5:case wf:case gl:case f5:return this.onEnd(s),this.ended=!0,!1}if(o=e.avail_out,e.next_out&&(e.avail_out===0||s===dl))if(this.options.to==="string"){let l=Ar.utf8border(e.output,e.next_out),h=e.next_out-l,c=Ar.buf2string(e.output,l);e.next_out=h,e.avail_out=n-h,h&&e.output.set(e.output.subarray(l,l+h),0),this.onData(c)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(s===Rr&&o===0)){if(s===dl)return s=si.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(e.avail_in===0)break}}return!0},Lr.prototype.onData=function(i){this.chunks.push(i)},Lr.prototype.onEnd=function(i){i===Rr&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=fa.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function pl(i,t){const e=new Lr(t);if(e.push(i),e.err)throw e.msg||Wi[e.err];return e.result}function d5(i,t){return t=t||{},t.raw=!0,pl(i,t)}var g5=Lr,p5=pl,m5=d5,v5=pl,_5=Ki,y5={Inflate:g5,inflate:p5,inflateRaw:m5,ungzip:v5,constants:_5};const{Deflate:b5,deflate:w5,deflateRaw:x5,gzip:S5}=Pv,{Inflate:C5,inflate:k5,inflateRaw:T5,ungzip:E5}=y5;var A5=b5,P5=w5,M5=x5,R5=S5,L5=C5,D5=k5,I5=T5,O5=E5,F5=Ki,N5={Deflate:A5,deflate:P5,deflateRaw:M5,gzip:R5,Inflate:L5,inflate:D5,inflateRaw:I5,ungzip:O5,constants:F5};const ut={};ut.toRGBA8=function(i){const t=i.width,e=i.height;if(i.tabs.acTL===null)return[ut.toRGBA8.decodeImage(i.data,t,e,i).buffer];const n=[];i.frames[0].data===null&&(i.frames[0].data=i.data);const r=t*e*4,s=new Uint8Array(r),a=new Uint8Array(r),o=new Uint8Array(r);for(let l=0;l<i.frames.length;l++){const h=i.frames[l],c=h.rect.x,d=h.rect.y,f=h.rect.width,u=h.rect.height,p=ut.toRGBA8.decodeImage(h.data,f,u,i);if(l!==0)for(let m=0;m<r;m++)o[m]=s[m];if(h.blend===0?ut._copyTile(p,f,u,s,t,e,c,d,0):h.blend===1&&ut._copyTile(p,f,u,s,t,e,c,d,1),n.push(s.buffer.slice(0)),h.dispose===1)ut._copyTile(a,f,u,s,t,e,c,d,0);else if(h.dispose===2)for(let m=0;m<r;m++)s[m]=o[m]}return n},ut.toRGBA8.decodeImage=function(i,t,e,n){const r=t*e,s=ut.decode._getBPP(n),a=Math.ceil(t*s/8),o=new Uint8Array(r*4),l=new Uint32Array(o.buffer),h=n.ctype,c=n.depth,d=ut._bin.readUshort;if(h===6){const f=r<<2;if(c===8)for(let u=0;u<f;u+=4)o[u]=i[u],o[u+1]=i[u+1],o[u+2]=i[u+2],o[u+3]=i[u+3];if(c===16)for(let u=0;u<f;u++)o[u]=i[u<<1]}else if(h===2){const f=n.tabs.tRNS;if(f===null){if(c===8)for(let u=0;u<r;u++){const p=u*3;l[u]=-16777216|i[p+2]<<16|i[p+1]<<8|i[p]}if(c===16)for(let u=0;u<r;u++){const p=u*6;l[u]=-16777216|i[p+4]<<16|i[p+2]<<8|i[p]}}else{const u=f[0],p=f[1],m=f[2];if(c===8)for(let y=0;y<r;y++){const S=y<<2,C=y*3;l[y]=-16777216|i[C+2]<<16|i[C+1]<<8|i[C],i[C]===u&&i[C+1]===p&&i[C+2]===m&&(o[S+3]=0)}if(c===16)for(let y=0;y<r;y++){const S=y<<2,C=y*6;l[y]=-16777216|i[C+4]<<16|i[C+2]<<8|i[C],d(i,C)===u&&d(i,C+2)===p&&d(i,C+4)===m&&(o[S+3]=0)}}}else if(h===3){const f=n.tabs.PLTE,u=n.tabs.tRNS,p=u?u.length:0;if(c===1)for(let m=0;m<e;m++){const y=m*a,S=m*t;for(let C=0;C<t;C++){const _=S+C<<2,w=i[y+(C>>3)]>>7-((C&7)<<0)&1,k=3*w;o[_]=f[k],o[_+1]=f[k+1],o[_+2]=f[k+2],o[_+3]=w<p?u[w]:255}}if(c===2)for(let m=0;m<e;m++){const y=m*a,S=m*t;for(let C=0;C<t;C++){const _=S+C<<2,w=i[y+(C>>2)]>>6-((C&3)<<1)&3,k=3*w;o[_]=f[k],o[_+1]=f[k+1],o[_+2]=f[k+2],o[_+3]=w<p?u[w]:255}}if(c===4)for(let m=0;m<e;m++){const y=m*a,S=m*t;for(let C=0;C<t;C++){const _=S+C<<2,w=i[y+(C>>1)]>>4-((C&1)<<2)&15,k=3*w;o[_]=f[k],o[_+1]=f[k+1],o[_+2]=f[k+2],o[_+3]=w<p?u[w]:255}}if(c===8)for(let m=0;m<r;m++){const y=m<<2,S=i[m],C=3*S;o[y]=f[C],o[y+1]=f[C+1],o[y+2]=f[C+2],o[y+3]=S<p?u[S]:255}}else if(h===4){if(c===8)for(let f=0;f<r;f++){const u=f<<2,p=f<<1,m=i[p];o[u]=m,o[u+1]=m,o[u+2]=m,o[u+3]=i[p+1]}if(c===16)for(let f=0;f<r;f++){const u=f<<2,p=f<<2,m=i[p];o[u]=m,o[u+1]=m,o[u+2]=m,o[u+3]=i[p+2]}}else if(h===0){const f=n.tabs.tRNS?n.tabs.tRNS:-1;for(let u=0;u<e;u++){const p=u*a,m=u*t;if(c===1)for(let y=0;y<t;y++){const S=255*(i[p+(y>>>3)]>>>7-(y&7)&1),C=S===f*255?0:255;l[m+y]=C<<24|S<<16|S<<8|S}else if(c===2)for(let y=0;y<t;y++){const S=85*(i[p+(y>>>2)]>>>6-((y&3)<<1)&3),C=S===f*85?0:255;l[m+y]=C<<24|S<<16|S<<8|S}else if(c===4)for(let y=0;y<t;y++){const S=17*(i[p+(y>>>1)]>>>4-((y&1)<<2)&15),C=S===f*17?0:255;l[m+y]=C<<24|S<<16|S<<8|S}else if(c===8)for(let y=0;y<t;y++){const S=i[p+y],C=S===f?0:255;l[m+y]=C<<24|S<<16|S<<8|S}else if(c===16)for(let y=0;y<t;y++){const S=i[p+(y<<1)],C=d(i,p+(y<<1))===f?0:255;l[m+y]=C<<24|S<<16|S<<8|S}}}return o},ut.decode=function(i){const t=new Uint8Array(i);let e=8;const n=ut._bin,r=n.readUshort,s=n.readUint,a={tabs:{},frames:[]},o=new Uint8Array(t.length);let l=0,h,c=0;const d=[137,80,78,71,13,10,26,10];for(let f=0;f<8;f++)if(t[f]!==d[f])throw"The input is not a PNG file!";for(;e<t.length;){const f=n.readUint(t,e);e+=4;const u=n.readASCII(t,e,4);if(e+=4,u==="IHDR")ut.decode._IHDR(t,e,a);else if(u==="CgBI")a.tabs[u]=t.slice(e,e+4);else if(u==="IDAT"){for(let p=0;p<f;p++)o[l+p]=t[e+p];l+=f}else if(u==="acTL")a.tabs[u]={num_frames:s(t,e),num_plays:s(t,e+4)},h=new Uint8Array(t.length);else if(u==="fcTL"){if(c!==0){const S=a.frames[a.frames.length-1];S.data=ut.decode._decompress(a,h.slice(0,c),S.rect.width,S.rect.height),c=0}const p={x:s(t,e+12),y:s(t,e+16),width:s(t,e+4),height:s(t,e+8)};let m=r(t,e+22);m=r(t,e+20)/(m===0?100:m);const y={rect:p,delay:Math.round(m*1e3),dispose:t[e+24],blend:t[e+25]};a.frames.push(y)}else if(u==="fdAT"){for(let p=0;p<f-4;p++)h[c+p]=t[e+p+4];c+=f-4}else if(u==="pHYs")a.tabs[u]=[n.readUint(t,e),n.readUint(t,e+4),t[e+8]];else if(u==="cHRM"){a.tabs[u]=[];for(let p=0;p<8;p++)a.tabs[u].push(n.readUint(t,e+p*4))}else if(u==="tEXt"||u==="zTXt"){a.tabs[u]===null&&(a.tabs[u]={});const p=n.nextZero(t,e),m=n.readASCII(t,e,p-e);let y;const S=e+f-p-1;if(u==="tEXt")y=n.readASCII(t,p+1,S);else{const C=ut.decode._inflate(t.slice(p+2,p+2+S));y=n.readUTF8(C,0,C.length)}a.tabs[u][m]=y}else if(u==="iTXt"){a.tabs[u]==null&&(a.tabs[u]={});let p=0,m=e;p=n.nextZero(t,m);const y=n.readASCII(t,m,p-m);m=p+1;const S=t[m];m+=2,p=n.nextZero(t,m),m=p+1,p=n.nextZero(t,m),m=p+1;let C;const _=f-(m-e);if(S===0)C=n.readUTF8(t,m,_);else{const w=ut.decode._inflate(t.slice(m,m+_));C=n.readUTF8(w,0,w.length)}a.tabs[u][y]=C}else if(u==="PLTE")a.tabs[u]=n.readBytes(t,e,f);else if(u==="hIST"){const p=a.tabs.PLTE.length/3;a.tabs[u]=[];for(let m=0;m<p;m++)a.tabs[u].push(r(t,e+m*2))}else if(u==="tRNS")a.ctype===3?a.tabs[u]=n.readBytes(t,e,f):a.ctype===0?a.tabs[u]=r(t,e):a.ctype===2&&(a.tabs[u]=[r(t,e),r(t,e+2),r(t,e+4)]);else if(u==="gAMA")a.tabs[u]=n.readUint(t,e)/1e5;else if(u==="sRGB")a.tabs[u]=t[e];else if(u==="bKGD")a.ctype===0||a.ctype===4?a.tabs[u]=[r(t,e)]:a.ctype===2||a.ctype===6?a.tabs[u]=[r(t,e),r(t,e+2),r(t,e+4)]:a.ctype===3&&(a.tabs[u]=t[e]);else if(u==="IEND")break;e+=f,e+=4}if(c!==0){const f=a.frames[a.frames.length-1];f.data=ut.decode._decompress(a,h.slice(0,c),f.rect.width,f.rect.height),c=0}return a.data=ut.decode._decompress(a,o,a.width,a.height),delete a.compress,delete a.interlace,delete a.filter,a},ut.decode._decompress=function(i,t,e,n){const r=ut.decode._getBPP(i),s=Math.ceil(e*r/8),a=new Uint8Array((s+1+i.interlace)*n);return i.tabs.CgBI?t=ut.inflateRaw(t,a):t=ut.decode._inflate(t,a),i.interlace===0?t=ut.decode._filterZero(t,i,0,e,n):i.interlace===1&&(t=ut.decode._readInterlace(t,i)),t},ut.decode._inflate=function(i,t){return ut.inflateRaw(new Uint8Array(i.buffer,2,i.length-6),t)},ut.inflateRaw=function(){const i={};return i.H={},i.H.N=function(t,e){const n=Uint8Array;let r=0,s=0,a=0,o=0,l=0,h=0,c=0,d=0,f=0,u,p;if(t[0]===3&&t[1]===0)return e||new n(0);const m=i.H,y=m.b,S=m.e,C=m.R,_=m.n,w=m.A,k=m.Z,A=m.m,R=e===null;for(R&&(e=new n(t.length>>>2<<3));r===0;){if(r=y(t,f,1),s=y(t,f+1,2),f+=3,s===0){f&7&&(f+=8-(f&7));const P=(f>>>3)+4,U=t[P-4]|t[P-3]<<8;R&&(e=i.H.W(e,d+U)),e.set(new n(t.buffer,t.byteOffset+P,U),d),f=P+U<<3,d+=U;continue}if(R&&(e=i.H.W(e,d+131072)),s===1&&(u=A.J,p=A.h,h=511,c=31),s===2){a=S(t,f,5)+257,o=S(t,f+5,5)+1,l=S(t,f+10,4)+4,f+=14;let P=1;for(let N=0;N<38;N+=2)A.Q[N]=0,A.Q[N+1]=0;for(let N=0;N<l;N++){const q=S(t,f+N*3,3);A.Q[(A.X[N]<<1)+1]=q,q>P&&(P=q)}f+=3*l,_(A.Q,P),w(A.Q,P,A.u),u=A.w,p=A.d,f=C(A.u,(1<<P)-1,a+o,t,f,A.v);const U=m.V(A.v,0,a,A.C);h=(1<<U)-1;const I=m.V(A.v,a,o,A.D);c=(1<<I)-1,_(A.C,U),w(A.C,U,u),_(A.D,I),w(A.D,I,p)}for(;;){const P=u[k(t,f)&h];f+=P&15;const U=P>>>4;if(!(U>>>8))e[d++]=U;else{if(U===256)break;{let I=d+U-254;if(U>264){const it=A.q[U-257];I=d+(it>>>3)+S(t,f,it&7),f+=it&7}const N=p[k(t,f)&c];f+=N&15;const q=N>>>4,W=A.c[q],K=(W>>>4)+y(t,f,W&15);for(f+=W&15;d<I;)e[d]=e[d++-K],e[d]=e[d++-K],e[d]=e[d++-K],e[d]=e[d++-K];d=I}}}}return e.length===d?e:e.slice(0,d)},i.H.W=function(t,e){const n=t.length;if(e<=n)return t;const r=new Uint8Array(n<<1);return r.set(t,0),r},i.H.R=function(t,e,n,r,s,a){const o=i.H.e,l=i.H.Z;let h=0;for(;h<n;){const c=t[l(r,s)&e];s+=c&15;const d=c>>>4;if(d<=15)a[h]=d,h++;else{let f=0,u=0;d===16?(u=3+o(r,s,2),s+=2,f=a[h-1]):d===17?(u=3+o(r,s,3),s+=3):d===18&&(u=11+o(r,s,7),s+=7);const p=h+u;for(;h<p;)a[h]=f,h++}}return s},i.H.V=function(t,e,n,r){let s=0,a=0;const o=r.length>>>1;for(;a<n;){const l=t[a+e];r[a<<1]=0,r[(a<<1)+1]=l,l>s&&(s=l),a++}for(;a<o;)r[a<<1]=0,r[(a<<1)+1]=0,a++;return s},i.H.n=function(t,e){const n=i.H.m,r=t.length;let s,a,o,l,h;const c=n.j;for(let f=0;f<=e;f++)c[f]=0;for(l=1;l<r;l+=2)c[t[l]]++;const d=n.K;for(s=0,c[0]=0,a=1;a<=e;a++)s=s+c[a-1]<<1,d[a]=s;for(o=0;o<r;o+=2)h=t[o+1],h!==0&&(t[o]=d[h],d[h]++)},i.H.A=function(t,e,n){const r=t.length,a=i.H.m.r;for(let o=0;o<r;o+=2)if(t[o+1]!==0){const l=o>>1,h=t[o+1],c=l<<4|h,d=e-h;let f=t[o]<<d;const u=f+(1<<d);for(;f!==u;){const p=a[f]>>>15-e;n[p]=c,f++}}},i.H.l=function(t,e){const n=i.H.m.r,r=15-e;for(let s=0;s<t.length;s+=2){const a=t[s]<<e-t[s+1];t[s]=n[a]>>>r}},i.H.M=function(t,e,n){n=n<<(e&7);const r=e>>>3;t[r]|=n,t[r+1]|=n>>>8},i.H.I=function(t,e,n){n=n<<(e&7);const r=e>>>3;t[r]|=n,t[r+1]|=n>>>8,t[r+2]|=n>>>16},i.H.e=function(t,e,n){return(t[e>>>3]|t[(e>>>3)+1]<<8)>>>(e&7)&(1<<n)-1},i.H.b=function(t,e,n){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)&(1<<n)-1},i.H.Z=function(t,e){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)},i.H.i=function(t,e){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16|t[(e>>>3)+3]<<24)>>>(e&7)},i.H.m=function(){const t=Uint16Array,e=Uint32Array;return{K:new t(16),j:new t(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new t(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new e(32),J:new t(512),_:[],h:new t(32),$:[],w:new t(32768),C:[],v:[],d:new t(32768),D:[],u:new t(512),Q:[],r:new t(32768),s:new e(286),Y:new e(30),a:new e(19),t:new e(15e3),k:new t(65536),g:new t(32768)}}(),function(){const t=i.H.m,e=32768;for(let r=0;r<e;r++){let s=r;s=(s&2863311530)>>>1|(s&1431655765)<<1,s=(s&3435973836)>>>2|(s&858993459)<<2,s=(s&4042322160)>>>4|(s&252645135)<<4,s=(s&4278255360)>>>8|(s&16711935)<<8,t.r[r]=(s>>>16|s<<16)>>>17}function n(r,s,a){for(;s--!==0;)r.push(0,a)}for(let r=0;r<32;r++)t.q[r]=t.S[r]<<3|t.T[r],t.c[r]=t.p[r]<<4|t.z[r];n(t._,144,8),n(t._,112,9),n(t._,24,7),n(t._,8,8),i.H.n(t._,9),i.H.A(t._,9,t.J),i.H.l(t._,9),n(t.$,32,5),i.H.n(t.$,5),i.H.A(t.$,5,t.h),i.H.l(t.$,5),n(t.Q,19,0),n(t.C,286,0),n(t.D,30,0),n(t.v,320,0)}(),i.H.N}(),ut.decode._readInterlace=function(i,t){const e=t.width,n=t.height,r=ut.decode._getBPP(t),s=r>>3,a=Math.ceil(e*r/8),o=new Uint8Array(n*a);let l=0;const h=[0,0,4,0,2,0,1],c=[0,4,0,2,0,1,0],d=[8,8,8,4,4,2,2],f=[8,8,4,4,2,2,1];let u=0;for(;u<7;){const p=d[u],m=f[u];let y=0,S=0,C=h[u];for(;C<n;)C+=p,S++;let _=c[u];for(;_<e;)_+=m,y++;const w=Math.ceil(y*r/8);ut.decode._filterZero(i,t,l,y,S);let k=0,A=h[u];for(;A<n;){let R=c[u],P=l+k*w<<3;for(;R<e;){if(r===1){let U=i[P>>3];U=U>>7-(P&7)&1,o[A*a+(R>>3)]|=U<<7-((R&7)<<0)}if(r===2){let U=i[P>>3];U=U>>6-(P&7)&3,o[A*a+(R>>2)]|=U<<6-((R&3)<<1)}if(r===4){let U=i[P>>3];U=U>>4-(P&7)&15,o[A*a+(R>>1)]|=U<<4-((R&1)<<2)}if(r>=8){const U=A*a+R*s;for(let I=0;I<s;I++)o[U+I]=i[(P>>3)+I]}P+=r,R+=m}k++,A+=p}y*S!==0&&(l+=S*(1+w)),u=u+1}return o},ut.decode._getBPP=function(i){return[1,null,3,1,2,null,4][i.ctype]*i.depth},ut.decode._filterZero=function(i,t,e,n,r){let s=ut.decode._getBPP(t);const a=Math.ceil(n*s/8),o=ut.decode._paeth;s=Math.ceil(s/8);let l=0,h=1,c=i[e],d=0;if(c>1&&(i[e]=[0,0,1][c-2]),c===3)for(d=s;d<a;d++)i[d+1]=i[d+1]+(i[d+1-s]>>>1)&255;for(let f=0;f<r;f++)if(l=e+f*a,h=l+f+1,c=i[h-1],d=0,c===0)for(;d<a;d++)i[l+d]=i[h+d];else if(c===1){for(;d<s;d++)i[l+d]=i[h+d];for(;d<a;d++)i[l+d]=i[h+d]+i[l+d-s]}else if(c===2)for(;d<a;d++)i[l+d]=i[h+d]+i[l+d-a];else if(c===3){for(;d<s;d++)i[l+d]=i[h+d]+(i[l+d-a]>>>1);for(;d<a;d++)i[l+d]=i[h+d]+(i[l+d-a]+i[l+d-s]>>>1)}else{for(;d<s;d++)i[l+d]=i[h+d]+o(0,i[l+d-a],0);for(;d<a;d++)i[l+d]=i[h+d]+o(i[l+d-s],i[l+d-a],i[l+d-s-a])}return i},ut.decode._paeth=function(i,t,e){const n=i+t-e,r=n-i,s=n-t,a=n-e;return r*r<=s*s&&r*r<=a*a?i:s*s<=a*a?t:e},ut.decode._IHDR=function(i,t,e){const n=ut._bin;e.width=n.readUint(i,t),t+=4,e.height=n.readUint(i,t),t+=4,e.depth=i[t],t++,e.ctype=i[t],t++,e.compress=i[t],t++,e.filter=i[t],t++,e.interlace=i[t],t++},ut._bin={nextZero:function(i,t){for(;i[t]!==0;)t++;return t},readUshort:function(i,t){return i[t]<<8|i[t+1]},writeUshort:function(i,t,e){i[t]=e>>8&255,i[t+1]=e&255},readUint:function(i,t){return i[t]*16777216+(i[t+1]<<16|i[t+2]<<8|i[t+3])},writeUint:function(i,t,e){i[t]=e>>24&255,i[t+1]=e>>16&255,i[t+2]=e>>8&255,i[t+3]=e&255},readASCII:function(i,t,e){let n="";for(let r=0;r<e;r++)n+=String.fromCharCode(i[t+r]);return n},writeASCII:function(i,t,e){for(let n=0;n<e.length;n++)i[t+n]=e.charCodeAt(n)},readBytes:function(i,t,e){const n=[];for(let r=0;r<e;r++)n.push(i[t+r]);return n},pad:function(i){return i.length<2?"0"+i:i},readUTF8:function(i,t,e){let n="",r;for(let s=0;s<e;s++)n+="%"+ut._bin.pad(i[t+s].toString(16));try{r=decodeURIComponent(n)}catch{return ut._bin.readASCII(i,t,e)}return r}},ut._copyTile=function(i,t,e,n,r,s,a,o,l){const h=Math.min(t,r),c=Math.min(e,s);let d=0,f=0;for(let u=0;u<c;u++)for(let p=0;p<h;p++)if(a>=0&&o>=0?(d=u*t+p<<2,f=(o+u)*r+a+p<<2):(d=(-o+u)*t-a+p<<2,f=u*r+p<<2),l===0)n[f]=i[d],n[f+1]=i[d+1],n[f+2]=i[d+2],n[f+3]=i[d+3];else if(l===1){const m=i[d+3]*.00392156862745098,y=i[d]*m,S=i[d+1]*m,C=i[d+2]*m,_=n[f+3]*(1/255),w=n[f]*_,k=n[f+1]*_,A=n[f+2]*_,R=1-m,P=m+_*R,U=P===0?0:1/P;n[f+3]=255*P,n[f+0]=(y+w*R)*U,n[f+1]=(S+k*R)*U,n[f+2]=(C+A*R)*U}else if(l===2){const m=i[d+3],y=i[d],S=i[d+1],C=i[d+2],_=n[f+3],w=n[f],k=n[f+1],A=n[f+2];m===_&&y===w&&S===k&&C===A?(n[f]=0,n[f+1]=0,n[f+2]=0,n[f+3]=0):(n[f]=y,n[f+1]=S,n[f+2]=C,n[f+3]=m)}else if(l===3){const m=i[d+3],y=i[d],S=i[d+1],C=i[d+2],_=n[f+3],w=n[f],k=n[f+1],A=n[f+2];if(m===_&&y===w&&S===k&&C===A)continue;if(m<220&&_>20)return!1}return!0},ut.encode=function(i,t,e,n,r,s,a){n===null&&(n=0),a===null&&(a=!1);const o=ut.encode.compress(i,t,e,n,[!1,!1,!1,0,a]);return ut.encode.compressPNG(o,-1),ut.encode._main(o,t,e,r,s)},ut.encodeLL=function(i,t,e,n,r,s,a,o){const l={ctype:0+(n===1?0:2)+(r===0?0:4),depth:s,frames:[]},h=(n+r)*s,c=h*t;for(let f=0;f<i.length;f++)l.frames.push({rect:{x:0,y:0,width:t,height:e},img:new Uint8Array(i[f]),blend:0,dispose:1,bpp:Math.ceil(h/8),bpl:Math.ceil(c/8)});return ut.encode.compressPNG(l,0,!0),ut.encode._main(l,t,e,a,o)},ut.encode._main=function(i,t,e,n,r){r||(r={});const s=ut.crc.crc,a=ut._bin.writeUint,o=ut._bin.writeUshort,l=ut._bin.writeASCII;let h=8;const c=i.frames.length>1;let d=!1,f=8+(16+5+4)+(c?20:0);if(r.sRGB!==null&&r.sRGB!==void 0&&(f+=13),r.pHYs!==null&&r.pHYs!==void 0&&(f+=21),i.ctype===3){const y=i.plte.length;for(let S=0;S<y;S++)i.plte[S]>>>24!==255&&(d=!0);f+=8+y*3+4+(d?8+y*1+4:0)}for(let y=0;y<i.frames.length;y++){const S=i.frames[y];c&&(f+=38),f+=S.cimg.length+12,y!==0&&(f+=4)}f+=12;const u=new Uint8Array(f),p=[137,80,78,71,13,10,26,10];for(let y=0;y<8;y++)u[y]=p[y];if(a(u,h,13),h+=4,l(u,h,"IHDR"),h+=4,a(u,h,t),h+=4,a(u,h,e),h+=4,u[h]=i.depth,h++,u[h]=i.ctype,h++,u[h]=0,h++,u[h]=0,h++,u[h]=0,h++,a(u,h,s(u,h-17,17)),h+=4,r.sRGB!==null&&r.sRGB!==void 0&&(a(u,h,1),h+=4,l(u,h,"sRGB"),h+=4,u[h]=r.sRGB,h++,a(u,h,s(u,h-5,5)),h+=4),r.pHYs!==null&&r.pHYs!==void 0&&(a(u,h,9),h+=4,l(u,h,"pHYs"),h+=4,a(u,h,r.pHYs[0]),h+=4,a(u,h,r.pHYs[1]),h+=4,u[h]=r.pHYs[2],h++,a(u,h,s(u,h-13,13)),h+=4),c&&(a(u,h,8),h+=4,l(u,h,"acTL"),h+=4,a(u,h,i.frames.length),h+=4,a(u,h,r.loop!=null?r.loop:0),h+=4,a(u,h,s(u,h-12,12)),h+=4),i.ctype===3){const y=i.plte.length;a(u,h,y*3),h+=4,l(u,h,"PLTE"),h+=4;for(let S=0;S<y;S++){const C=S*3,_=i.plte[S],w=_&255,k=_>>>8&255,A=_>>>16&255;u[h+C+0]=w,u[h+C+1]=k,u[h+C+2]=A}if(h+=y*3,a(u,h,s(u,h-y*3-4,y*3+4)),h+=4,d){a(u,h,y),h+=4,l(u,h,"tRNS"),h+=4;for(let S=0;S<y;S++)u[h+S]=i.plte[S]>>>24&255;h+=y,a(u,h,s(u,h-y-4,y+4)),h+=4}}let m=0;for(let y=0;y<i.frames.length;y++){const S=i.frames[y];c&&(a(u,h,26),h+=4,l(u,h,"fcTL"),h+=4,a(u,h,m++),h+=4,a(u,h,S.rect.width),h+=4,a(u,h,S.rect.height),h+=4,a(u,h,S.rect.x),h+=4,a(u,h,S.rect.y),h+=4,o(u,h,n[y]),h+=2,o(u,h,1e3),h+=2,u[h]=S.dispose,h++,u[h]=S.blend,h++,a(u,h,s(u,h-30,30)),h+=4);const C=S.cimg,_=C.length;a(u,h,_+(y===0?0:4)),h+=4;const w=h;l(u,h,y===0?"IDAT":"fdAT"),h+=4,y!==0&&(a(u,h,m++),h+=4),u.set(C,h),h+=_,a(u,h,s(u,w,h-w)),h+=4}return a(u,h,0),h+=4,l(u,h,"IEND"),h+=4,a(u,h,s(u,h-4,4)),h+=4,u.buffer},ut.encode.compressPNG=function(i,t,e){for(let n=0;n<i.frames.length;n++){const r=i.frames[n],s=r.rect.height,a=new Uint8Array(s*r.bpl+s);r.cimg=ut.encode._filterZero(r.img,s,r.bpp,r.bpl,a,t,e)}},ut.encode.compress=function(i,t,e,n,r){const s=r[0],a=r[1],o=r[2],l=r[3],h=r[4];let c=6,d=8,f=255;for(let _=0;_<i.length;_++){const w=new Uint8Array(i[_]),k=w.length;for(let A=0;A<k;A+=4)f&=w[A+3]}const u=f!==255,p=ut.encode.framize(i,t,e,s,a,o),m={},y=[],S=[];if(n!==0){const _=[];for(let P=0;P<p.length;P++)_.push(p[P].img.buffer);const w=ut.encode.concatRGBA(_),k=ut.quantize(w,n);let A=0;const R=new Uint8Array(k.abuf);for(let P=0;P<p.length;P++){const U=p[P].img,I=U.length;S.push(new Uint8Array(k.inds.buffer,A>>2,I>>2));for(let N=0;N<I;N+=4)U[N]=R[A+N],U[N+1]=R[A+N+1],U[N+2]=R[A+N+2],U[N+3]=R[A+N+3];A+=I}for(let P=0;P<k.plte.length;P++)y.push(k.plte[P].est.rgba)}else for(let _=0;_<p.length;_++){const w=p[_],k=new Uint32Array(w.img.buffer),A=w.rect.width,R=k.length,P=new Uint8Array(R);S.push(P);for(let U=0;U<R;U++){const I=k[U];if(U!==0&&I===k[U-1])P[U]=P[U-1];else if(U>A&&I===k[U-A])P[U]=P[U-A];else{let N=m[I];if(N===null&&(m[I]=N=y.length,y.push(I),y.length>=300))break;P[U]=N}}}const C=y.length;C<=256&&h===!1&&(C<=2?d=1:C<=4?d=2:C<=16?d=4:d=8,d=Math.max(d,l));for(let _=0;_<p.length;_++){const w=p[_],k=w.rect.width,A=w.rect.height;let R=w.img,P=4*k,U=4;if(C<=256&&h===!1){P=Math.ceil(d*k/8);const I=new Uint8Array(P*A),N=S[_];for(let q=0;q<A;q++){const W=q*P,K=q*k;if(d===8)for(let it=0;it<k;it++)I[W+it]=N[K+it];else if(d===4)for(let it=0;it<k;it++)I[W+(it>>1)]|=N[K+it]<<4-(it&1)*4;else if(d===2)for(let it=0;it<k;it++)I[W+(it>>2)]|=N[K+it]<<6-(it&3)*2;else if(d===1)for(let it=0;it<k;it++)I[W+(it>>3)]|=N[K+it]<<7-(it&7)*1}R=I,c=3,U=1}else if(u===!1&&p.length===1){const I=new Uint8Array(k*A*3),N=k*A;for(let q=0;q<N;q++){const W=q*3,K=q*4;I[W]=R[K],I[W+1]=R[K+1],I[W+2]=R[K+2]}R=I,c=2,U=3,P=3*k}w.img=R,w.bpl=P,w.bpp=U}return{ctype:c,depth:d,plte:y,frames:p}},ut.encode.framize=function(i,t,e,n,r,s){const a=[];for(let o=0;o<i.length;o++){const l=new Uint8Array(i[o]),h=new Uint32Array(l.buffer);let c,d=0,f=0,u=t,p=e,m=n?1:0;if(o!==0){const y=s||n||o===1||a[o-2].dispose!==0?1:2;let S=0,C=1e9;for(let w=0;w<y;w++){const k=new Uint32Array(i[o-1-w]);let A=t,R=e,P=-1,U=-1;for(let N=0;N<e;N++)for(let q=0;q<t;q++){const W=N*t+q;h[W]!==k[W]&&(q<A&&(A=q),q>P&&(P=q),N<R&&(R=N),N>U&&(U=N))}P===-1&&(A=R=P=U=0),r&&((A&1)===1&&A--,(R&1)===1&&R--);const I=(P-A+1)*(U-R+1);I<C&&(C=I,S=w,d=A,f=R,u=P-A+1,p=U-R+1)}const _=new Uint8Array(i[o-1-S]);S===1&&(a[o-1].dispose=2),c=new Uint8Array(u*p*4),ut._copyTile(_,t,e,c,u,p,-d,-f,0),m=ut._copyTile(l,t,e,c,u,p,-d,-f,3)?1:0,m===1?ut.encode._prepareDiff(l,t,e,c,{x:d,y:f,width:u,height:p}):ut._copyTile(l,t,e,c,u,p,-d,-f,0)}else c=l.slice(0);a.push({rect:{x:d,y:f,width:u,height:p},img:c,blend:m,dispose:0})}if(n)for(let o=0;o<a.length;o++){const l=a[o];if(l.blend===1)continue;const h=l.rect,c=a[o-1].rect,d=Math.min(h.x,c.x),f=Math.min(h.y,c.y),u=Math.max(h.x+h.width,c.x+c.width),p=Math.max(h.y+h.height,c.y+c.height),m={x:d,y:f,width:u-d,height:p-f};a[o-1].dispose=1,o-1!==0&&ut.encode._updateFrame(i,t,e,a,o-1,m,r),ut.encode._updateFrame(i,t,e,a,o,m,r)}return a},ut.encode._updateFrame=function(i,t,e,n,r,s,a){const o=Uint8Array,l=Uint32Array,h=new o(i[r-1]),c=new l(i[r-1]),d=r+1<i.length?new o(i[r+1]):null,f=new o(i[r]),u=new l(f.buffer);let p=t,m=e,y=-1,S=-1;for(let _=0;_<s.height;_++)for(let w=0;w<s.width;w++){const k=s.x+w,A=s.y+_,R=A*t+k,P=u[R];P===0||n[r-1].dispose===0&&c[R]===P&&(d===null||d[R*4+3]!==0)||(k<p&&(p=k),k>y&&(y=k),A<m&&(m=A),A>S&&(S=A))}y===-1&&(p=m=y=S=0),a&&((p&1)===1&&p--,(m&1)===1&&m--),s={x:p,y:m,width:y-p+1,height:S-m+1};const C=n[r];C.rect=s,C.blend=1,C.img=new Uint8Array(s.width*s.height*4),n[r-1].dispose===0?(ut._copyTile(h,t,e,C.img,s.width,s.height,-s.x,-s.y,0),ut.encode._prepareDiff(f,t,e,C.img,s)):ut._copyTile(f,t,e,C.img,s.width,s.height,-s.x,-s.y,0)},ut.encode._prepareDiff=function(i,t,e,n,r){ut._copyTile(i,t,e,n,r.width,r.height,-r.x,-r.y,2)},ut.encode._filterZero=function(i,t,e,n,r,s,a){const o=[];let l=[0,1,2,3,4];s!==-1?l=[s]:(t*n>5e5||e===1)&&(l=[0]);let h;a&&(h={level:0});const c=r.length>1e7&&Qc!=null?Qc:N5;for(let u=0;u<l.length;u++){for(let p=0;p<t;p++)ut.encode._filterLine(r,i,p,n,e,l[u]);o.push(c.deflate(r,h))}let d,f=1e9;for(let u=0;u<o.length;u++)o[u].length<f&&(d=u,f=o[u].length);return o[d]},ut.encode._filterLine=function(i,t,e,n,r,s){const a=e*n;let o=a+e;const l=ut.decode._paeth;if(i[o]=s,o++,s===0)if(n<500)for(let h=0;h<n;h++)i[o+h]=t[a+h];else i.set(new Uint8Array(t.buffer,a,n),o);else if(s===1){for(let h=0;h<r;h++)i[o+h]=t[a+h];for(let h=r;h<n;h++)i[o+h]=t[a+h]-t[a+h-r]+256&255}else if(e===0){for(let h=0;h<r;h++)i[o+h]=t[a+h];if(s===2)for(let h=r;h<n;h++)i[o+h]=t[a+h];if(s===3)for(let h=r;h<n;h++)i[o+h]=t[a+h]-(t[a+h-r]>>1)+256&255;if(s===4)for(let h=r;h<n;h++)i[o+h]=t[a+h]-l(t[a+h-r],0,0)+256&255}else{if(s===2)for(let h=0;h<n;h++)i[o+h]=t[a+h]+256-t[a+h-n]&255;if(s===3){for(let h=0;h<r;h++)i[o+h]=t[a+h]+256-(t[a+h-n]>>1)&255;for(let h=r;h<n;h++)i[o+h]=t[a+h]+256-(t[a+h-n]+t[a+h-r]>>1)&255}if(s===4){for(let h=0;h<r;h++)i[o+h]=t[a+h]+256-l(0,t[a+h-n],0)&255;for(let h=r;h<n;h++)i[o+h]=t[a+h]+256-l(t[a+h-r],t[a+h-n],t[a+h-r-n])&255}}},ut.crc={table:function(){const i=new Uint32Array(256);for(let t=0;t<256;t++){let e=t;for(let n=0;n<8;n++)e&1?e=3988292384^e>>>1:e=e>>>1;i[t]=e}return i}(),update:function(i,t,e,n){for(let r=0;r<n;r++)i=ut.crc.table[(i^t[e+r])&255]^i>>>8;return i},crc:function(i,t,e){return ut.crc.update(4294967295,i,t,e)^4294967295}},ut.quantize=function(i,t){const e=new Uint8Array(i),n=e.slice(0),r=new Uint32Array(n.buffer),s=ut.quantize.getKDtree(n,t),a=s[0],o=s[1],l=ut.quantize.planeDst,h=e,c=r,d=h.length,f=new Uint8Array(e.length>>2);let u;if(e.length<2e7)for(let p=0;p<d;p+=4){const m=h[p]*.00392156862745098,y=h[p+1]*(1/255),S=h[p+2]*(1/255),C=h[p+3]*(1/255);u=ut.quantize.getNearest(a,m,y,S,C),f[p>>2]=u.ind,c[p>>2]=u.est.rgba}else for(let p=0;p<d;p+=4){const m=h[p]*.00392156862745098,y=h[p+1]*(1/255),S=h[p+2]*(1/255),C=h[p+3]*(1/255);for(u=a;u.left;)u=l(u.est,m,y,S,C)<=0?u.left:u.right;f[p>>2]=u.ind,c[p>>2]=u.est.rgba}return{abuf:n.buffer,inds:f,plte:o}},ut.quantize.getKDtree=function(i,t,e){e===null&&(e=1e-4);const n=new Uint32Array(i.buffer),r={i0:0,i1:i.length,bst:null,est:null,tdst:0,left:null,right:null};r.bst=ut.quantize.stats(i,r.i0,r.i1),r.est=ut.quantize.estats(r.bst);const s=[r];for(;s.length<t;){let a=0,o=0;for(let u=0;u<s.length;u++)s[u].est.L>a&&(a=s[u].est.L,o=u);if(a<e)break;const l=s[o],h=ut.quantize.splitPixels(i,n,l.i0,l.i1,l.est.e,l.est.eMq255);if(l.i0>=h||l.i1<=h){l.est.L=0;continue}const d={i0:l.i0,i1:h,bst:null,est:null,tdst:0,left:null,right:null};d.bst=ut.quantize.stats(i,d.i0,d.i1),d.est=ut.quantize.estats(d.bst);const f={i0:h,i1:l.i1,bst:null,est:null,tdst:0,left:null,right:null};f.bst={R:[],m:[],N:l.bst.N-d.bst.N};for(let u=0;u<16;u++)f.bst.R[u]=l.bst.R[u]-d.bst.R[u];for(let u=0;u<4;u++)f.bst.m[u]=l.bst.m[u]-d.bst.m[u];f.est=ut.quantize.estats(f.bst),l.left=d,l.right=f,s[o]=d,s.push(f)}s.sort(function(a,o){return o.bst.N-a.bst.N});for(let a=0;a<s.length;a++)s[a].ind=a;return[r,s]},ut.quantize.getNearest=function(i,t,e,n,r){if(i.left==null)return i.tdst=ut.quantize.dist(i.est.q,t,e,n,r),i;const s=ut.quantize.planeDst(i.est,t,e,n,r);let a=i.left,o=i.right;s>0&&(a=i.right,o=i.left);const l=ut.quantize.getNearest(a,t,e,n,r);if(l.tdst<=s*s)return l;const h=ut.quantize.getNearest(o,t,e,n,r);return h.tdst<l.tdst?h:l},ut.quantize.planeDst=function(i,t,e,n,r){const s=i.e;return s[0]*t+s[1]*e+s[2]*n+s[3]*r-i.eMq},ut.quantize.dist=function(i,t,e,n,r){const s=t-i[0],a=e-i[1],o=n-i[2],l=r-i[3];return s*s+a*a+o*o+l*l},ut.quantize.splitPixels=function(i,t,e,n,r,s){const a=ut.quantize.vecDot;for(n-=4;e<n;){for(;a(i,e,r)<=s;)e+=4;for(;a(i,n,r)>s;)n-=4;if(e>=n)break;const o=t[e>>2];t[e>>2]=t[n>>2],t[n>>2]=o,e+=4,n-=4}for(;a(i,e,r)>s;)e-=4;return e+4},ut.quantize.vecDot=function(i,t,e){return i[t]*e[0]+i[t+1]*e[1]+i[t+2]*e[2]+i[t+3]*e[3]},ut.quantize.stats=function(i,t,e){const n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=[0,0,0,0],s=e-t>>2;for(let a=t;a<e;a+=4){const o=i[a]*.00392156862745098,l=i[a+1]*(1/255),h=i[a+2]*(1/255),c=i[a+3]*(1/255);r[0]+=o,r[1]+=l,r[2]+=h,r[3]+=c,n[0]+=o*o,n[1]+=o*l,n[2]+=o*h,n[3]+=o*c,n[5]+=l*l,n[6]+=l*h,n[7]+=l*c,n[10]+=h*h,n[11]+=h*c,n[15]+=c*c}return n[4]=n[1],n[8]=n[2],n[9]=n[6],n[12]=n[3],n[13]=n[7],n[14]=n[11],{R:n,m:r,N:s}},ut.quantize.estats=function(i){const t=i.R,e=i.m,n=i.N,r=e[0],s=e[1],a=e[2],o=e[3],l=n===0?0:1/n,h=[t[0]-r*r*l,t[1]-r*s*l,t[2]-r*a*l,t[3]-r*o*l,t[4]-s*r*l,t[5]-s*s*l,t[6]-s*a*l,t[7]-s*o*l,t[8]-a*r*l,t[9]-a*s*l,t[10]-a*a*l,t[11]-a*o*l,t[12]-o*r*l,t[13]-o*s*l,t[14]-o*a*l,t[15]-o*o*l],c=h,d=ut.M4;let f=[Math.random(),Math.random(),Math.random(),Math.random()],u=0,p=0;if(n!==0)for(let S=0;S<16&&(f=d.multVec(c,f),p=Math.sqrt(d.dot(f,f)),f=d.sml(1/p,f),!(S!==0&&Math.abs(p-u)<1e-9));S++)u=p;const m=[r*l,s*l,a*l,o*l],y=d.dot(d.sml(255,m),f);return{Cov:h,q:m,e:f,L:u,eMq255:y,eMq:d.dot(f,m),rgba:(Math.round(255*m[3])<<24|Math.round(255*m[2])<<16|Math.round(255*m[1])<<8|Math.round(255*m[0])<<0)>>>0}},ut.M4={multVec:function(i,t){return[i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3],i[4]*t[0]+i[5]*t[1]+i[6]*t[2]+i[7]*t[3],i[8]*t[0]+i[9]*t[1]+i[10]*t[2]+i[11]*t[3],i[12]*t[0]+i[13]*t[1]+i[14]*t[2]+i[15]*t[3]]},dot:function(i,t){return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3]},sml:function(i,t){return[i*t[0],i*t[1],i*t[2],i*t[3]]}},ut.encode.concatRGBA=function(i){let t=0;for(let r=0;r<i.length;r++)t+=i[r].byteLength;const e=new Uint8Array(t);let n=0;for(let r=0;r<i.length;r++){const s=new Uint8Array(i[r]),a=s.length;for(let o=0;o<a;o+=4){let l=s[o],h=s[o+1],c=s[o+2];const d=s[o+3];d===0&&(l=h=c=0),e[n+o]=l,e[n+o+1]=h,e[n+o+2]=c,e[n+o+3]=d}n+=a}return e.buffer};const ba=new Map,ml=(i,t)=>{if(ba.has(i))return t(null,ba.get(i));const e=new Image;e.onload=function(){ba.set(i,{width:e.width,height:e.height,element:e}),t(null,ba.get(i))},e.onerror=function(n){t(n,null)},e.src=i},vl=(i,t)=>{ml(i,(e,n)=>{if(!n)return t(e,null);const r=document.createElement("canvas"),s=r.getContext("2d");return r.width=n.width,r.height=n.height,s.drawImage(n.element,0,0,r.width,r.height),s.getImageData(0,0,r.width,r.height)})},U5=(i,t)=>{for(let e=0,n=i.length;e<n;e++){const r=i[e],{type:s}=r;if(s.split("/")[0]!=="image")return;let o;const l=new FileReader;l.onload=function(h){if(!h.target)return t("no reader target",null);const c=h.target.result;o=Dh(c);const f=new Blob([c]);_l(f,(u,p)=>{if(!p)return t(u,null);ml(p,(m,y)=>{if(!y)return t(m,null);vl(p,(S,C)=>{if(!C)return t(S,null);const _={name:r.name,fileType:o,size:r.size,width:y.width,height:y.height,imgUrl:p,imageData:C,blob:f};return t(null,_)})})})},l.readAsArrayBuffer(r)}},B5=(i,t=0,e=0)=>{const n=document.createElement("canvas"),r=n.getContext("2d");return n.width=t,n.height=e,r.drawImage(i,0,0,t,e),r.getImageData(0,0,t,e)},G5=(i,t=0,e=0)=>{const n=document.createElement("canvas"),r=n.getContext("2d");return n.width=t,n.height=e,r.drawImage(i,0,0,t,e),r.getImageData(0,0,t,e)},$5=i=>{const t=i.width,e=i.height,n=t*e*3,r=n+54,s=[66,77,r&255,r>>8&255,r>>16&255,r>>24&255,0,0,0,0,54,0,0,0],a=[40,0,0,0,t&255,t>>8&255,t>>16&255,t>>24&255,e&255,e>>8&255,e>>16&255,e>>24&255,1,0,24,0,0,0,0,0,n&255,n>>8&255,n>>16&255,n>>24&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o=(4-t*3%4)%4,l=i.data;let h="";const c=t<<2;let d=e;const f=String.fromCharCode;do{const p=c*(d-1);let m="";for(let y=0;y<t;y++){const S=y<<2;m+=f(l[p+S+2])+f(l[p+S+1])+f(l[p+S])}for(let y=0;y<o;y++)m+=String.fromCharCode(0);h+=m}while(--d);function u(p){if(!window.btoa)throw"btoa undefined";let m="";if(typeof p=="string")m=p;else for(let y=0;y<p.length;y++)m+=String.fromCharCode(p[y]);return btoa(m)}return u(s.concat(a))+u(h)},z5=i=>{const{width:t,height:e}=i,n=document.createElement("canvas"),r=n.getContext("2d");return n.width=t,n.height=e,r.putImageData(i,0,0,0,0,t,e),n.toDataURL("image/png")},H5=(i,t,e)=>{const{width:n,height:r}=i,s=document.createElement("canvas"),a=s.getContext("2d");s.width=n,s.height=r,a.putImageData(i,0,0,0,0,n,r);const o=`image/${t?t.toLowerCase():"png"}`;s.toBlob(l=>{e?.(null,l)},o,1)},_l=(i,t)=>{const e=new FileReader;e.onload=function(n){n.target?t(null,n.target.result):t("can't readAsDataURL",null)},e.readAsDataURL(i)},j5=(i,t)=>{_l(i,function(e,n){if(n){const r=new Image;r.src=n}else t(e)})};function V5(i,t){vl(i,(e,n)=>{if(!n)return t(e,null);const r=n.data;let s=0;const a=[],o=[],l=[];for(let f=0;f<r.length;f+=4)a[s]=r[f],o[s]=r[f+1],l[s]=r[f+2],s+=1;const h=yl(a),c=yl(o),d=yl(l);return t(null,"rgb("+h+","+c+","+d+")")})}function yl(i){const t={},e=[],n=[];for(let o=0;o<i.length;o++)t[i[o]]?e.push(i[o]):t[i[o]]=1;let r=0;for(let o=0;o<e.length;o++){r=0;for(let l=0;l<e.length;l++)e[o]===e[l]&&(r+=1),n[o]=r}const s=Math.max.apply(null,n);let a=0;for(;a<n.length;a++)if(n[a]===s)return;return e[a]}const q5=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=t[(a*e+e-o-1)*4],r[l+1]=t[(a*e+e-o-1)*4+1],r[l+2]=t[(a*e+e-o-1)*4+2],r[l+3]=t[(a*e+e-o-1)*4+3]}return new ImageData(r,e,n)},X5=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=t[((n-a-1)*e+o)*4],r[l+1]=t[((n-a-1)*e+o)*4+1],r[l+2]=t[((n-a-1)*e+o)*4+2],r[l+3]=t[((n-a-1)*e+o)*4+3]}return new ImageData(r,e,n)},Y5=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<n;o++){const l=(a*n+o)*4;r[l]=t[(o*e+e-a-1)*4],r[l+1]=t[(o*e+e-a-1)*4+1],r[l+2]=t[(o*e+e-a-1)*4+2],r[l+3]=t[(o*e+e-a-1)*4+3]}return new ImageData(r,n,e)},W5=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<n;o++){const l=(a*n+o)*4;r[l]=t[((n-o-1)*e+a)*4],r[l+1]=t[((n-o-1)*e+a)*4+1],r[l+2]=t[((n-o-1)*e+a)*4+2],r[l+3]=t[((n-o-1)*e+a)*4+3]}return new ImageData(r,n,e)},K5=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4,h=(t[l]+t[l+1]+t[l+2])/3;r[l]=h,r[l+1]=h,r[l+2]=h,r[l+3]=t[l+3]}return new ImageData(r,e,n)},Z5=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4,h=.2126*t[l]+.7152*t[l+1]+.0722*t[l+2];r[l]=h,r[l+1]=h,r[l+2]=h,r[l+3]=t[l+3]}return new ImageData(r,e,n)},J5=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4,c=(t[l]+t[l+1]+t[l+2])/3>127?255:0;r[l]=c,r[l+1]=c,r[l+2]=c,r[l+3]=t[l+3]}return new ImageData(r,e,n)},Q5=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=255-t[l],r[l+1]=255-t[l+1],r[l+2]=255-t[l+2],r[l+3]=t[l+3]}return new ImageData(r,e,n)},t_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=t[l],r[l+1]=0,r[l+2]=0,r[l+3]=t[l+3]}return new ImageData(r,e,n)},e_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=0,r[l+1]=t[l+1],r[l+2]=0,r[l+3]=t[l+3]}return new ImageData(r,e,n)},i_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=0,r[l+1]=0,r[l+2]=t[l+2],r[l+3]=t[l+3]}return new ImageData(r,e,n)},n_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=t[l],r[l+1]=t[l+1],r[l+2]=0,r[l+3]=t[l+3]}return new ImageData(r,e,n)},r_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=t[l],r[l+1]=0,r[l+2]=t[l+1],r[l+3]=t[l+3]}return new ImageData(r,e,n)},s_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=0,r[l+1]=t[l+1],r[l+2]=t[l+1],r[l+3]=t[l+3]}return new ImageData(r,e,n)},a_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4,h=(t[l+1]+t[l+2])/2;r[l]=t[l],r[l+1]=h,r[l+2]=h,r[l+3]=t[l+3]}return new ImageData(r,e,n)},o_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4,h=(t[l]+t[l+2])/2;r[l]=h,r[l+1]=t[l+1],r[l+2]=h,r[l+3]=t[l+3]}return new ImageData(r,e,n)},l_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4,h=(t[l]+t[l+1])/2;r[l]=h,r[l+1]=h,r[l+2]=t[l+2],r[l+3]=t[l+3]}return new ImageData(r,e,n)},h_=i=>xf(i,[-1,-1,-1,-1,9,-1,-1,-1,-1]),c_=i=>xf(i,[-1,-1,-1,-1,8,-1,-1,-1,-1]),u_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=t[l],r[l+1]=t[l+1],r[l+2]=t[l+2],r[l+3]=255}return new ImageData(r,e,n)},f_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;if(t[l+3]===0)r[l]=255,r[l+1]=255,r[l+2]=255,r[l+3]=255;else{const h=Sf([t[l],t[l+1],t[l+2],t[l+3]],[255,255,255,255]);r[l]=h[0],r[l+1]=h[1],r[l+2]=h[2],r[l+3]=h[3]}}return new ImageData(r,e,n)},d_=(i,t,e,n,r,s=!1,a)=>{const{data:o,width:l,height:h}=i;let c=r,d=n,f=t,u=e;if(c<0?c=0:c>l&&(c=l),d<0?d=0:d>h&&(d=h),f<1?f=1:f>l&&(f=l),u<1?u=1:u>h&&(u=h),c+f>l&&(f=l-c),d+u>h&&(u=h-d),s){const p=new Uint8ClampedArray(o.length);for(let y=0;y<h;y++)for(let S=0;S<l;S++){const C=(y*l+S)*4;S>=c&&S<=c+f&&y>=d&&y<=d+u?(p[C]=o[C],p[C+1]=o[C+1],p[C+2]=o[C+2],p[C+3]=o[C+3]):(p[C]=255,p[C+1]=255,p[C+2]=255,p[C+3]=a&&["JPG","JPEG"].includes(a.toUpperCase())?255:0)}return new ImageData(p,l,h)}else{const p=new Uint8ClampedArray(f*u*4);for(let y=d;y<=d+u;y++)for(let S=c;S<=c+f;S++){const C=((y-d)*f+S-c)*4,_=(y*l+S)*4;p[C]=o[_],p[C+1]=o[_+1],p[C+2]=o[_+2],p[C+3]=o[_+3]}return new ImageData(p,f,u)}},g_=(i,t,e,n)=>{const{data:r,width:s,height:a}=i;let o=t;o>Math.floor(s/2)&&(o=Math.floor(s/2)),o>Math.floor(a/2)&&(o=Math.floor(a/2)),o<0&&(o=0);const l=new Uint8ClampedArray(r.length);for(let c=0;c<a;c++)for(let d=0;d<s;d++){const f=(c*s+d)*4;let u=-1;d<o?c<o?u=Math.sqrt(Math.pow(o-d-1,2)+Math.pow(o-c-1,2)):c>a-o-1&&(u=Math.sqrt(Math.pow(o-d-1,2)+Math.pow(c-(a-o),2))):d>s-o-1&&(c<o?u=Math.sqrt(Math.pow(d-(s-o),2)+Math.pow(o-c-1,2)):c>a-o-1&&(u=Math.sqrt(Math.pow(d-(s-o),2)+Math.pow(c-(a-o),2)))),Math.round(u)>o?(l[f]=255,l[f+1]=255,l[f+2]=255,l[f+3]=n||e.toUpperCase()==="PNG"?0:255):(l[f]=r[f],l[f+1]=r[f+1],l[f+2]=r[f+2],l[f+3]=n||e.toUpperCase()==="PNG"?r[f+3]:255)}return new ImageData(l,s,a)},p_=(i,t,e,n,r,s=1e4)=>{const a=new Image;a.src=i;const o=document.createElement("canvas"),l=o.getContext("2d");return o.width=s,o.height=s,l.drawImage(a,0,0,t,e,0,0,n,r),l.getImageData(0,0,n,r)},m_=(i,t)=>{const{data:e,width:n,height:r}=i,s=new Uint8ClampedArray(e.length);for(let o=0;o<r;o++)for(let l=0;l<n;l++){const h=(o*n+l)*4;s[h]=Math.max(Math.min(e[h]+t,255),0),s[h+1]=Math.max(Math.min(e[h+1]+t,255),0),s[h+2]=Math.max(Math.min(e[h+2]+t,255),0),s[h+3]=e[h+3]}return new ImageData(s,n,r)},v_=(i,t,e=!1)=>{const{data:n,width:r,height:s}=i,a=new Uint8ClampedArray(n.length);for(let l=0;l<s;l++)for(let h=0;h<r;h++){const c=(l*r+h)*4;n[c+3]===0?(a[c]=255,a[c+1]=255,a[c+2]=255):(a[c]=n[c],a[c+1]=n[c+1],a[c+2]=n[c+2]);let d=n[c+3];e?d=Math.max(Math.min(Math.floor(255*t),255),0):d=Math.max(Math.min(Math.floor(d+255*t),255),0),a[c+3]=d}return new ImageData(a,r,s)},__=(i,t,e,n)=>{const{data:r,width:s,height:a}=i,{data:o,width:l,height:h}=t;let c=e,d=n;e+h>a&&(c=a-h),n+l>s&&(d=s-l);const f=new Uint8ClampedArray(r.length);for(let p=0;p<a;p++)for(let m=0;m<s;m++){const y=(p*s+m)*4;if(m<d||m>d+l||p<=c||p>=c+h)f[y]=r[y],f[y+1]=r[y+1],f[y+2]=r[y+2],f[y+3]=r[y+3];else{const S=(p*s+m-((c+1)*s+(p-(c+1))*(s-l))+l-d-1)*4,C=[o[S],o[S+1],o[S+2],o[S+3]],_=[r[y],r[y+1],r[y+2],r[y+3]],w=Sf(C,_);f[y]=w[0],f[y+1]=w[1],f[y+2]=w[2],f[y+3]=w[3]}}return new ImageData(f,s,a)},y_=(i,t,e,n,r,s=10)=>{const{data:a,width:o,height:l}=i;let h=r,c=n,d=t,f=e;h<0?h=0:h>o&&(h=o),c<0?c=0:c>l&&(c=l),d<1?d=1:d>o&&(d=o),f<1?f=1:f>l&&(f=l),h+d>o&&(d=o-h),c+f>l&&(f=l-c);const u=new Uint8ClampedArray(a.length);for(let m=0;m<l;m++)for(let y=0;y<o;y++){const S=(m*o+y)*4;if(y>=h&&y<=h+d&&m>=c&&m<=c+f){const C=Math.floor((y-h)/s),_=Math.floor((m-c)/s);let w=Math.floor(s*(C+1)-s/2+h),k=Math.floor(s*(_+1)-s/2+c);w>o-1&&(w=o-1),k>l-1&&(k=l-1);const A=(k*o+w)*4;u[S]=a[A],u[S+1]=a[A+1],u[S+2]=a[A+2],u[S+3]=a[A+3]}else u[S]=a[S],u[S+1]=a[S+1],u[S+2]=a[S+2],u[S+3]=a[S+3]}return new ImageData(u,o,l)},b_=async(i,t,e,n,r,s)=>{const a=r/100;if(["JPG","JPEG"].includes(n.toUpperCase())){const o=new Image;o.src=i;const l=document.createElement("canvas"),h=l.getContext("2d");l.width=t,l.height=e,h.drawImage(o,0,0,t,e),l.toBlob(c=>{s(c)},`image/${n.toLowerCase()}`,a)}else{const o=Math.floor(a*256),l=ut.encode([i.data.buffer],t,e,o),h=new Blob([l]);s&&s(h)}},w_=(i,t,e={backgroundColor:{r:0,g:0,b:0,a:255},changeIntoColor:{r:0,g:0,b:0,a:0}})=>{if(t&&e){const{data:n,width:r,height:s}=i,{data:a}=t,o=new Uint8ClampedArray(n.length),{backgroundColor:l,changeIntoColor:h}=e;for(let d=0;d<s;d++)for(let f=0;f<r;f++){const u=(d*r+f)*4,p=a[u],m=a[u+1],y=a[u+2],S=a[u+3];p===l.r&&m===l.g&&y===l.b&&S===l.a&&h.a!==0?(o[u]=h.r,o[u+1]=h.g,o[u+2]=h.b,o[u+3]=h.a):(o[u]=n[u],o[u+1]=n[u+1],o[u+2]=n[u+2],o[u+3]=n[u+3])}return new ImageData(o,r,s)}return i},xf=(i,t)=>{const{data:e,width:n,height:r}=i,s=new Uint8ClampedArray(e.length);for(let o=0;o<r;o++)for(let l=0;l<n;l++){const h=(o*n+l)*4;for(let c=0;c<3;c++){const d=h+c;l===0||l===n-1||o===0||o===r-1?s[d]=e[d]:s[d]=t[0]*e[d-n*4-4]+t[1]*e[d-n*4]+t[2]*e[d-n*4+4]+t[3]*e[d-4]+t[4]*e[d]+t[5]*e[d+4]+t[6]*e[d+n*4-4]+t[7]*e[d+n*4]+t[8]*e[d+n*4+4]}s[h+3]=e[h+3]}return new ImageData(s,n,r)},Sf=(i,t)=>{if(i&&i.length===4&&t&&t.length===4){const e=i[3],n=t[3];if(e===255||n===0)return i;if(e===0)return t;{const r=e/255,s=n/255,a=Math.max(Math.min(Math.floor(i[0]*r+t[0]*s*(1-r)),255),0),o=Math.max(Math.min(Math.floor(i[1]*r+t[1]*s*(1-r)),255),0),l=Math.max(Math.min(Math.floor(i[2]*r+t[2]*s*(1-r)),255),0),h=Math.max(Math.min(Math.floor((r+s*(1-r))*255),255),0);return[a,o,l,h]}}return[255,255,255,255]},Cf=function(i,t,e){const n=new Array(i*i),r=function(o){const l=o;let h=0,c=0;return{write(d,f){if(d>>>f)throw new Error("length over");for(;h+f>=8;)l.writeByte(255&(d<<h|c)),f-=8-h,d>>>=8-h,c=0,h=0;c=d<<h|c,h=h+f},flush(){h>0&&l.writeByte(c)}}},s=function(o){const l=1<<o,h=(1<<o)+1;let c=o+1;const d=a();for(let y=0;y<l;y++)d.add(String.fromCharCode(y));d.add(String.fromCharCode(l)),d.add(String.fromCharCode(h));const f=Ih(),u=r(f);u.write(l,c);let p=0,m=String.fromCharCode(n[p]);for(p+=1;p<n.length;){const y=String.fromCharCode(n[p]);p+=1,d.contains(m+y)?m=m+y:(u.write(d.indexOf(m),c),d.size()<4095&&(d.size()==1<<c&&(c+=1),d.add(m+y)),m=y)}return u.write(d.indexOf(m),c),u.write(h,c),u.flush(),f.toByteArray()},a=function(){const o={};let l=0;return{add(h){if(this.contains(h))throw new Error("dup key:"+h);o[h]=l,l+=1},size(){return l},indexOf(h){return o[h]},contains(h){return typeof o[h]<"u"}}};return{setPixel(o,l,h){n[l*i+o]=h},write(o){o.writeString("GIF87a"),o.writeShort(i),o.writeShort(i),o.writeByte(128),o.writeByte(0),o.writeByte(0),o.writeByte(yn("0x"+t[1]+t[2])),o.writeByte(yn("0x"+t[3]+t[4])),o.writeByte(yn("0x"+t[5]+t[6])),o.writeByte(yn("0x"+e[1]+e[2])),o.writeByte(yn("0x"+e[3]+e[4])),o.writeByte(yn("0x"+e[5]+e[6])),o.writeString(","),o.writeShort(0),o.writeShort(0),o.writeShort(i),o.writeShort(i),o.writeByte(0);const l=2,h=s(l);o.writeByte(l);let c=0;for(;h.length-c>255;)o.writeByte(255),o.writeBytes(h,c,255),c+=255;o.writeByte(h.length-c),o.writeBytes(h,c,h.length-c),o.writeByte(0),o.writeString(";")}}},kf=function(i,t,e,n){const r=Cf(i,t,e);for(let h=0;h<i;h++)for(let c=0;c<i;c++)r.setPixel(c,h,n(c,h));const s=Ih();r.write(s);const a=sg(),o=s.toByteArray();for(let h=0,c=o.length;h<c;h++)a.writeByte(o[h]);a.flush();let l="";return l+="data:image/gif;base64,",l+=a,l},Me={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Dr={M:0,L:1,H:2,Q:3},Ei={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},ge={glog:function(i){if(i<1)throw new Error("glog("+i+")");return ge.LOG_TABLE[i]},gexp:function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return ge.EXP_TABLE[i]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(let i=0;i<8;i++)ge.EXP_TABLE[i]=1<<i;for(let i=8;i<256;i++)ge.EXP_TABLE[i]=ge.EXP_TABLE[i-4]^ge.EXP_TABLE[i-5]^ge.EXP_TABLE[i-6]^ge.EXP_TABLE[i-8];for(let i=0;i<255;i++)ge.LOG_TABLE[ge.EXP_TABLE[i]]=i;const Qt={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(i){let t=i<<10;for(;Qt.getBCHDigit(t)-Qt.getBCHDigit(Qt.G15)>=0;)t^=Qt.G15<<Qt.getBCHDigit(t)-Qt.getBCHDigit(Qt.G15);return(i<<10|t)^Qt.G15_MASK},getBCHTypeNumber:function(i){let t=i<<12;for(;Qt.getBCHDigit(t)-Qt.getBCHDigit(Qt.G18)>=0;)t^=Qt.G18<<Qt.getBCHDigit(t)-Qt.getBCHDigit(Qt.G18);return i<<12|t},getBCHDigit:function(i){let t=0;for(;i!=0;)t++,i>>>=1;return t},getPatternPosition:function(i){return Qt.PATTERN_POSITION_TABLE[i-1]},getMask:function(i,t,e){switch(i){case Ei.PATTERN000:return(t+e)%2==0;case Ei.PATTERN001:return t%2==0;case Ei.PATTERN010:return e%3==0;case Ei.PATTERN011:return(t+e)%3==0;case Ei.PATTERN100:return(Math.floor(t/2)+Math.floor(e/3))%2==0;case Ei.PATTERN101:return t*e%2+t*e%3==0;case Ei.PATTERN110:return(t*e%2+t*e%3)%2==0;case Ei.PATTERN111:return(t*e%3+(t+e)%2)%2==0;default:throw new Error("bad maskPattern:"+i)}},getErrorCorrectPolynomial:function(i){let t=new Ln([1],0);for(let e=0;e<i;e++)t=t.multiply(new Ln([1,ge.gexp(e)],0));return t},getLengthInBits:function(i,t){if(1<=t&&t<10)switch(i){case Me.MODE_NUMBER:return 10;case Me.MODE_ALPHA_NUM:return 9;case Me.MODE_8BIT_BYTE:return 8;case Me.MODE_KANJI:return 8;default:throw new Error("mode:"+i)}else if(t<27)switch(i){case Me.MODE_NUMBER:return 12;case Me.MODE_ALPHA_NUM:return 11;case Me.MODE_8BIT_BYTE:return 16;case Me.MODE_KANJI:return 10;default:throw new Error("mode:"+i)}else if(t<41)switch(i){case Me.MODE_NUMBER:return 14;case Me.MODE_ALPHA_NUM:return 13;case Me.MODE_8BIT_BYTE:return 16;case Me.MODE_KANJI:return 12;default:throw new Error("mode:"+i)}else throw new Error("type:"+t)},getLostPoint:function(i){const t=i.getModuleCount();let e=0;for(let s=0;s<t;s++)for(let a=0;a<t;a++){let o=0;const l=i.isDark(s,a);for(let h=-1;h<=1;h++)if(!(s+h<0||t<=s+h))for(let c=-1;c<=1;c++)a+c<0||t<=a+c||h==0&&c==0||l==i.isDark(s+h,a+c)&&o++;o>5&&(e+=3+o-5)}for(let s=0;s<t-1;s++)for(let a=0;a<t-1;a++){let o=0;i.isDark(s,a)&&o++,i.isDark(s+1,a)&&o++,i.isDark(s,a+1)&&o++,i.isDark(s+1,a+1)&&o++,(o==0||o==4)&&(e+=3)}for(let s=0;s<t;s++)for(let a=0;a<t-6;a++)i.isDark(s,a)&&!i.isDark(s,a+1)&&i.isDark(s,a+2)&&i.isDark(s,a+3)&&i.isDark(s,a+4)&&!i.isDark(s,a+5)&&i.isDark(s,a+6)&&(e+=40);for(let s=0;s<t;s++)for(let a=0;a<t-6;a++)i.isDark(a,s)&&!i.isDark(a+1,s)&&i.isDark(a+2,s)&&i.isDark(a+3,s)&&i.isDark(a+4,s)&&!i.isDark(a+5,s)&&i.isDark(a+6,s)&&(e+=40);let n=0;for(let s=0;s<t;s++)for(let a=0;a<t;a++)i.isDark(a,s)&&n++;const r=Math.abs(100*n/t/t-50)/5;return e+=r*10,e}};class Ln{num;constructor(t,e){if(t.length==null)throw new Error(t.length+"/"+e);let n=0;for(;n<t.length&&t[n]==0;)n++;this.num=new Array(t.length-n+e);for(let r=0;r<t.length-n;r++)this.num[r]=t[r+n]}get(t){return this.num[t]}getLength(){return this.num.length}multiply(t){const e=new Array(this.getLength()+t.getLength()-1);for(let n=0;n<this.getLength();n++)for(let r=0;r<t.getLength();r++)e[n+r]^=ge.gexp(ge.glog(this.get(n))+ge.glog(t.get(r)));return new Ln(e,0)}mod(t){if(this.getLength()-t.getLength()<0)return this;const e=ge.glog(this.get(0))-ge.glog(t.get(0)),n=new Array(this.getLength());for(let r=0;r<this.getLength();r++)n[r]=this.get(r);for(let r=0;r<t.getLength();r++)n[r]^=ge.gexp(ge.glog(t.get(r))+e);return new Ln(n,0).mod(t)}}class ai{totalCount;dataCount;constructor(t,e){this.totalCount=t,this.dataCount=e}static RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];static getRSBlocks(t,e){const n=ai.getRsBlockTable(t,e);if(n==null)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);const r=n.length/3,s=[];for(let a=0;a<r;a++){const o=n[a*3+0],l=n[a*3+1],h=n[a*3+2];for(let c=0;c<o;c++)s.push(new ai(l,h))}return s}static getRsBlockTable(t,e){switch(e){case Dr.L:return ai.RS_BLOCK_TABLE[(t-1)*4+0];case Dr.M:return ai.RS_BLOCK_TABLE[(t-1)*4+1];case Dr.Q:return ai.RS_BLOCK_TABLE[(t-1)*4+2];case Dr.H:return ai.RS_BLOCK_TABLE[(t-1)*4+3];default:return}}}class Tf{buffer;length;constructor(){this.buffer=[],this.length=0}get(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)==1}put(t,e){for(let n=0;n<e;n++)this.putBit((t>>>e-n-1&1)==1)}getLengthInBits(){return this.length}putBit(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}}class x_{mode;data;constructor(t){this.mode=Me.MODE_8BIT_BYTE,this.data=t}getLength(){return this.data.length}write(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data.charCodeAt(e),8)}}class Ai{static PAD0=236;static PAD1=17;typeNumber;errorCorrectLevel;modules;moduleCount;dataCache;dataList;constructor(t,e){this.typeNumber=t,this.errorCorrectLevel=Dr[e],this.modules=[],this.moduleCount=0,this.dataCache=null,this.dataList=[]}addData(t){const e=new x_(t);this.dataList.push(e),this.dataCache=null}isDark(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]}getModuleCount(){return this.moduleCount}make(){if(this.typeNumber<1){let t=1;for(t=1;t<40;t++){const e=ai.getRSBlocks(t,this.errorCorrectLevel),n=new Tf;let r=0;for(let s=0;s<e.length;s++)r+=e[s].dataCount;for(let s=0;s<this.dataList.length;s++){const a=this.dataList[s];n.put(a.mode,4),n.put(a.getLength(),Qt.getLengthInBits(a.mode,t)),a.write(n)}if(n.getLengthInBits()<=r*8)break}this.typeNumber=t}this.makeImpl(!1,this.getBestMaskPattern())}makeImpl(t,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(let n=0;n<this.moduleCount;n++){this.modules[n]=new Array(this.moduleCount);for(let r=0;r<this.moduleCount;r++)this.modules[n][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=Ai.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)}setupPositionProbePattern(t,e){for(let n=-1;n<=7;n++)if(!(t+n<=-1||this.moduleCount<=t+n))for(let r=-1;r<=7;r++)e+r<=-1||this.moduleCount<=e+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[t+n][e+r]=!0:this.modules[t+n][e+r]=!1)}getBestMaskPattern(){let t=0,e=0;for(let n=0;n<8;n++){this.makeImpl(!0,n);const r=Qt.getLostPoint(this);(n==0||t>r)&&(t=r,e=n)}return e}createMovieClip(t,e,n){const r=t.createEmptyMovieClip(e,n),s=1;this.make();for(let a=0;a<this.modules.length;a++){const o=a*s;for(let l=0;l<this.modules[a].length;l++){const h=l*s;this.modules[a][l]&&(r.beginFill(0,100),r.moveTo(h,o),r.lineTo(h+s,o),r.lineTo(h+s,o+s),r.lineTo(h,o+s),r.endFill())}}return r}setupTimingPattern(){for(let t=8;t<this.moduleCount-8;t++)this.modules[t][6]==null&&(this.modules[t][6]=t%2==0);for(let t=8;t<this.moduleCount-8;t++)this.modules[6][t]==null&&(this.modules[6][t]=t%2==0)}setupPositionAdjustPattern(){const t=Qt.getPatternPosition(this.typeNumber);for(let e=0;e<t.length;e++)for(let n=0;n<t.length;n++){const r=t[e],s=t[n];if(this.modules[r][s]==null)for(let a=-2;a<=2;a++)for(let o=-2;o<=2;o++)a==-2||a==2||o==-2||o==2||a==0&&o==0?this.modules[r+a][s+o]=!0:this.modules[r+a][s+o]=!1}}setupTypeNumber(t){const e=Qt.getBCHTypeNumber(this.typeNumber);for(let n=0;n<18;n++){const r=!t&&(e>>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(let n=0;n<18;n++){const r=!t&&(e>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}}setupTypeInfo(t,e){const n=this.errorCorrectLevel<<3|e,r=Qt.getBCHTypeInfo(n);for(let s=0;s<15;s++){const a=!t&&(r>>s&1)==1;s<6?this.modules[s][8]=a:s<8?this.modules[s+1][8]=a:this.modules[this.moduleCount-15+s][8]=a}for(let s=0;s<15;s++){const a=!t&&(r>>s&1)==1;s<8?this.modules[8][this.moduleCount-s-1]=a:s<9?this.modules[8][15-s-1+1]=a:this.modules[8][15-s-1]=a}this.modules[this.moduleCount-8][8]=!t}mapData(t,e){let n=-1,r=this.moduleCount-1,s=7,a=0;for(let o=this.moduleCount-1;o>0;o-=2)for(o==6&&o--;;){for(let l=0;l<2;l++)if(this.modules[r][o-l]==null){let h=!1;a<t.length&&(h=(t[a]>>>s&1)==1),Qt.getMask(e,r,o-l)&&(h=!h),this.modules[r][o-l]=h,s--,s==-1&&(a++,s=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}}static createData(t,e,n){const r=ai.getRSBlocks(t,e),s=new Tf;for(let o=0;o<n.length;o++){const l=n[o];s.put(l.mode,4),s.put(l.getLength(),Qt.getLengthInBits(l.mode,t)),l.write(s)}let a=0;for(let o=0;o<r.length;o++)a+=r[o].dataCount;if(s.getLengthInBits()>a*8)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+a*8+")");for(s.getLengthInBits()+4<=a*8&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=a*8||(s.put(Ai.PAD0,8),s.getLengthInBits()>=a*8));)s.put(Ai.PAD1,8);return Ai.createBytes(s,r)}static createBytes(t,e){let n=0,r=0,s=0;const a=new Array(e.length),o=new Array(e.length);for(let d=0;d<e.length;d++){const f=e[d].dataCount,u=e[d].totalCount-f;r=Math.max(r,f),s=Math.max(s,u),a[d]=new Array(f);for(let S=0;S<a[d].length;S++)a[d][S]=255&t.buffer[S+n];n+=f;const p=Qt.getErrorCorrectPolynomial(u),y=new Ln(a[d],p.getLength()-1).mod(p);o[d]=new Array(p.getLength()-1);for(let S=0;S<o[d].length;S++){const C=S+y.getLength()-o[d].length;o[d][S]=C>=0?y.get(C):0}}let l=0;for(let d=0;d<e.length;d++)l+=e[d].totalCount;const h=new Array(l);let c=0;for(let d=0;d<r;d++)for(let f=0;f<e.length;f++)d<a[f].length&&(h[c++]=a[f][d]);for(let d=0;d<s;d++)for(let f=0;f<e.length;f++)d<o[f].length&&(h[c++]=o[f][d]);return h}}const Ef=Math.ceil,Ir=Math.floor,Af=Math.round;function S_(i,t){const e=Lh(i),n=t?.ecc||"H",r=t?.size||256,s=-1,a=t?.padding||0,o=t?.color||"#000000",l=t?.background||"#ffffff",h=new Ai(s,n);h.addData(e),h.make();const c=h.getModuleCount(),d=(r-a*2)/c,f=a,u=r-a;return kf(r,o,l,function(p,m){if(f<=p&&p<u&&f<=m&&m<u){const y=Ir((p-f)/d),S=Ir((m-f)/d);return h.isDark(S,y)?0:1}else return 1})}function C_(i,t){const e=t.x||0,n=t.y||0,r=Lh(i),s=t.ctx,a=t.ecc||"H",o=typeof t.size=="number"?Ir(t.size):256,l=t.padding||0,h=-1,c=t.color||"#000000",d=t.background||"#ffffff",f=new Ai(h,a);f.addData(r),f.make();const u=f.getModuleCount(),p=(o-l*2)/u;s.fillStyle=d,s.fillRect(e,n,o,o);for(let m=0;m<u;m++)for(let y=0;y<u;y++){const S=Ef((y+1)*p)-Ir(y*p),C=Ef((m+1)*p)-Ir(m*p);s.fillStyle=f.isDark(m,y)?c:d,s.fillRect(e+Af(y*p)+l,n+Af(m*p)+l,S,C)}}function Pf(){let i=null;if(window.ActiveXObject){const t=["Microsoft.XMLHTTP","MSXML6.XMLHTTP","MSXML5.XMLHTTP","MSXML4.XMLHTTP","MSXML3.XMLHTTP","MSXML2.XMLHTTP","MSXML.XMLHTTP"];for(let e=0;e<t.length;e++)try{i=new window.ActiveXObject(t[e]);break}catch{continue}}else i=new XMLHttpRequest;return i}function k_(i){if(!i.action)return;const t=i.method.toLowerCase()==="get",e=i.method.toLowerCase()==="post";let n=i.action,r=null;const s="---------------------------"+Date.now().toString(16);if(window.FormData)r=new FormData(i),t&&(n=Fo(n,Wc(r)));else if(t){let a="";for(let o=0;o<i.elements.length;o++){const l=i.elements[o];if(!l.hasAttribute("name"))continue;const h=l.nodeName.toUpperCase()==="INPUT"?l.getAttribute("type").toUpperCase():"TEXT";if(h==="FILE")for(let c=0;c<l.files.length;a+="&"+encodeURIComponent(l.name)+"="+encodeURIComponent(l.files[c++].name));else(h!=="RADIO"&&h!=="CHECKBOX"||l.checked)&&(a+="&"+encodeURIComponent(l.name)+"="+encodeURIComponent(l.value))}n=Fo(n,a)}else if(e){let a=[];if(i.enctype==="application/x-www-form-urlencoded"){for(let o=0;o<i.elements.length;o++){const l=i.elements[o];l.hasAttribute("name")&&a.push(encodeURIComponent(l.name)+"="+encodeURIComponent(l.value))}r=a.join()}else if(i.enctype==="text/plain"){for(let o=0;o<i.elements.length;o++){const l=i.elements[o];l.hasAttribute("name")&&a.push(l.name+"="+l.value)}r=a.join(`\r
|
|
15
|
+
`)}else if(i.enctype==="multipart/form-data"){for(let o=0;o<i.elements.length;o++){const l=i.elements[o];if(!l.hasAttribute("name"))continue;if((l.nodeName.toUpperCase()==="INPUT"?l.getAttribute("type").toUpperCase():"TEXT")==="FILE")for(let c=0;c<l.files.length;c++){const d=l.files[c];a.push('Content-Disposition: form-data; name="'+l.name+'"; filename="'+d.name+`"\r
|
|
16
16
|
Content-Type: `+d.type+`\r
|
|
17
17
|
\r
|
|
18
|
-
`)}else a.push('Content-Disposition: form-data; name="'+
|
|
18
|
+
`)}else a.push('Content-Disposition: form-data; name="'+l.name+`"\r
|
|
19
19
|
\r
|
|
20
|
-
`+
|
|
20
|
+
`+l.value+`\r
|
|
21
21
|
`)}r=a.join(s+`\r
|
|
22
|
-
`)}}return{url:n,data:r,boundary:s}}function
|
|
22
|
+
`)}}return{url:n,data:r,boundary:s}}function T_({method:i="GET",url:t,data:e="",responseType:n="json",timeout:r=3e4,boundary:s=""}){return new Promise((a,o)=>{const l=Pf();l.onreadystatechange=function(h){l.readyState===4&&(l.status===200?a(l.response):o(l.statusText))},l.ontimeout=function(){o(`${t} is timed out for ${r}ms.`)},l.addEventListener("progress",function(h){if(h.lengthComputable){const c=Math.round(h.loaded*100/h.total);console.log(`progress : ${c}%`)}},!1),l.addEventListener("load",function(h){console.log("load")},!1),l.addEventListener("error",function(h){console.log(`error : ${h}`)},!1),l.timeout=r,l.responseType=n,s&&l.setRequestHeader("Content-Type","multipart/form-data; boundary="+s),i=i.toUpperCase(),i==="GET"?(l.open("GET",t+"?"+e,!0),l.send(null)):i==="POST"?(l.open("POST",t,!0),s?l.sendAsBinary(s+`\r
|
|
23
23
|
`+e+s+`--\r
|
|
24
|
-
`):h.send(e)):(h.open(i,t,!0),h.send(e))})}function Xp(i,t){const e=new XMLHttpRequest;e.open("HEAD",i),e.filepath=i,e.callback=t,e.onload=function(){const n=parseFloat(window.localStorage.getItem("lm_"+this.filepath)),r=Date.parse(this.getResponseHeader("Last-Modified"));(isNaN(n)||r>n)&&(window.localStorage.setItem("lm_"+this.filepath,Date.now()),isFinite(n)&&this.callback(r,n))},e.send()}let ur;const bc=new WeakMap;function La(i,t){let e=bc.get(i);e||(e=new Map,bc.set(i,e));let n=e.get(t);return n||(n=new wc,e.set(t,n)),n}class wc{subscribers;constructor(){this.subscribers=new Set}depend(){ur&&this.subscribers.add(ur)}notify(){this.subscribers.forEach(t=>t())}}function Yp(i){ur=i,i(),ur=null}function Wp(i){return Object.keys(i).forEach(t=>{let e=i[t];const n=La(i,t);Object.defineProperty(i,t,{get(){return n.depend(),e},set(r){r!=e&&(e=r,n.notify())}})}),i}function qp(i){return new Proxy(i,{get(t,e,n){return La(i,e).depend(),Reflect.get(t,e,n)},set(t,e,n,r){const s=La(i,e);return i[e]!=n&&(i[e]=n,s.notify()),Reflect.set(t,e,n,r)}})}const Kp=()=>Math.random()*16777215,Zp=()=>`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`,Jp=()=>`#${(~~(Math.random()*(1<<24))).toString(16)}`,Sc=function(i){let t="00000"+(i|0).toString(16);return t="#"+t.substring(t.length-6),t},Cc=function(i,t=1){const e=i>>16&255,n=i>>8&255,r=i&255,s=t<0?0:t>1?1:t;return s===1?"rgb("+e+","+n+","+r+")":"rgba("+e+","+n+","+r+","+s+")"},dr=function(i){return i[0]==="#"&&(i=i.slice(1)),window.parseInt(i,16)},Oa=function(i,t=1){const e=dr(i);return Cc(e,t)},Qp=i=>{const e=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(i);return e?"#"+((1<<24)+(parseInt(e[1])<<16)+(parseInt(e[2])<<8)+parseInt(e[3])).toString(16).slice(1):""};function tm(i,t,e,n){let r,s,a;i=i/360,t=t/100,e=e/100;const o=Math.floor(i*6),h=i*6-o,l=e*(1-t),c=e*(1-h*t),d=e*(1-(1-h)*t);switch(o%6){case 0:r=e,s=d,a=l;break;case 1:r=c,s=e,a=l;break;case 2:r=l,s=e,a=d;break;case 3:r=l,s=c,a=e;break;case 4:r=d,s=l,a=e;break;case 5:default:r=e,s=l,a=c;break}return{r:Math.round(r*255),g:Math.round(s*255),b:Math.round(a*255),a:n??1}}function em(i,t,e,n){const r=Math.max(i,t,e),s=Math.min(i,t,e),a=r-s,o=r===0?0:a/r,h=r/255;let l;switch(r){case s:l=0;break;case i:l=t-e+a*(t<e?6:0),l/=6*a;break;case t:l=e-i+a*2,l/=6*a;break;case e:default:l=i-t+a*4,l/=6*a;break}return{h:Math.round(l*360),s:Math.round(o*100),v:Math.round(h*100),a:n??1}}const im=i=>i*Math.PI/180,nm=i=>i*180/Math.PI;function De(i,t,e,n,r=!1){return{x:r?i*n+t*e:i*n-t*e,y:r?t*n-i*e:t*n+i*e}}class ce{m;constructor(t=[1,0,0,1,0,0]){this.m=[t[0],t[1],t[2],t[3],t[4],t[5]]}unit(){return this.m=[1,0,0,1,0,0],this}multiply(t){const e=this.m;let n;t instanceof ce?n=t.m:n=t;const r=e[0]*n[0]+e[2]*n[1],s=e[1]*n[0]+e[3]*n[1],a=e[0]*n[2]+e[2]*n[3],o=e[1]*n[2]+e[3]*n[3],h=e[0]*n[4]+e[2]*n[5]+e[4],l=e[1]*n[4]+e[3]*n[5]+e[5];return e[0]=r,e[1]=s,e[2]=a,e[3]=o,e[4]=h,e[5]=l,this}inverse(){const t=new ce(this.m),e=t.m,n=1/(e[0]*e[3]-e[1]*e[2]),r=e[3]*n,s=-e[1]*n,a=-e[2]*n,o=e[0]*n,h=n*(e[2]*e[5]-e[3]*e[4]),l=n*(e[1]*e[4]-e[0]*e[5]);return e[0]=r,e[1]=s,e[2]=a,e[3]=o,e[4]=h,e[5]=l,t}translate(t,e){return this.multiply([1,0,0,1,t,e])}rotate(t){const e=t*Math.PI/180,n=Math.cos(e),r=Math.sin(e);return this.multiply([n,r,-r,n,0,0])}skew(t,e=0){const n=t*Math.PI/180,r=e*Math.PI/180,s=Math.tan(n),a=Math.tan(r);return this.multiply([1,a,s,1,0,0])}scale(t,e){return this.multiply([t,0,0,e,0,0])}transformPoint(t,e){const n=t,r=e;return t=n*this.m[0]+r*this.m[2]+this.m[4],e=n*this.m[1]+r*this.m[3]+this.m[5],[t,e]}transformVector(t,e){const n=t,r=e;return t=n*this.m[0]+r*this.m[2],e=n*this.m[1]+r*this.m[3],[t,e]}}class fr{x;y;z;constructor(t=[0,0,0],e=[0,0,0]){const[n,r,s]=t,[a,o,h]=e;this.x=n-a,this.y=r-o,this.z=s-h}get length(){const{x:t,y:e,z:n}=this;return Math.sqrt(t*t+e*e+n*n)}unit(){const t=this.length;return new fr([this.x/t,this.y/t,this.z/t])}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){const e=this.x,n=this.y,r=this.z,s=t.x,a=t.y,o=t.z;return new fr([n*o-r*a,r*s-e*o,e*a-s*n])}}class gr{x;y;vx=0;vy=0;ax=0;ay=0;mass=0;constructor(t,e,n){this.x=t,this.y=e,n?.vx!==void 0&&(this.vx=n?.vx),n?.vy!==void 0&&(this.vy=n?.vy),n?.ax!==void 0&&(this.ax=n?.ax),n?.ay!==void 0&&(this.ay=n?.ay),n?.mass!==void 0&&(this.mass=n?.mass)}distanceTo(t){const e=t.x-this.x,n=t.y-this.y;return Math.sqrt(e*e+n*n)}angleTo(t){const e=t.x-this.x,n=t.y-this.y;return Math.atan2(n,e)}trackVelocity(t,e){return{vx:e.x-t.x,vy:e.y-t.y}}nextFrame(t){const e=t?.gravity??0,n=t?.friction??0;if(this.vx+=this.ax,this.vy+=this.ay,this.vy+=e,n>0){const r=Math.atan2(this.vy,this.vx);let s=Math.sqrt(this.vx*this.vx+this.vy*this.vy);s>n?s-=n:s=0,this.vx=Math.cos(r)*s,this.vy=Math.sin(r)*s}this.x+=this.vx,this.y+=this.vy}nextFrameEaseTo=(t,e)=>{const n=e?.gravity??0,r=e?.friction??1,s=e?.easing??.05,a=t.x-this.x,o=t.y-this.y;this.vx=a*s,this.vy=o*s,this.vy+=n,this.vx*=r,this.vy*=r,this.x+=this.vx,this.y+=this.vy};nextFrameSpringTo(t,e){const n=e?.gravity??0,r=e?.friction??.95,s=e?.spring??.03;(Array.isArray(t)?t:[t]).forEach(o=>{const h=o.x-this.x,l=o.y-this.y,c=h*s,d=l*s;this.vx+=c,this.vy+=d}),this.vy+=n,this.vx*=r,this.vy*=r,this.x+=this.vx,this.y+=this.vy}nextFrameSpringConnect(t,e){const n=e?.gravity??0,r=e?.friction??.95,s=e?.spring??.03,a=e?.springLength??100,o=this.angleTo(t);this.nextFrameSpringTo(new gr(t.x-Math.cos(o)*a,t.y-Math.sin(o)*a),{spring:s,friction:r,gravity:n})}}class pt extends gr{isMouseDown=!1;radius=0;constructor(t,e,n){super(t,e,n),n?.isMouseDown!==void 0&&(this.isMouseDown=n?.isMouseDown),n?.radius!==void 0&&(this.radius=n?.radius)}setX(t){this.x=t}setY(t){this.y=t}setXY(t,e){this.x=t,this.y=e}eq(t){return this.x===t.x&&this.y===t.y}midPointBtw(t){return new pt(this.x+(t.x-this.x)/2,this.y+(t.y-this.y)/2)}fromRadian(t,e){return new pt(Math.cos(t)*e,Math.sin(t)*e)}toArray(){return[this.x,this.y]}clone(t){this.setXY(t.x,t.y)}checkCollisionTo(t){const e=t.x-this.x,n=t.y-this.y;if(Math.sqrt(e*e+n*n)<this.radius+t.radius){const s=Math.atan2(n,e),a=Math.sin(s),o=Math.cos(s),h={x:0,y:0},l=De(e,n,a,o,!0),c=De(this.vx,this.vy,a,o,!0),d=De(t.vx,t.vy,a,o,!0),f=c.x-d.x;c.x=((this.mass-t.mass)*c.x+2*t.mass*d.x)/(this.mass+t.mass),d.x=f+c.x;const u=Math.abs(c.x)+Math.abs(d.x),g=this.radius+t.radius-Math.abs(h.x-l.x);h.x+=c.x/u*g,l.x+=d.x/u*g;const p=De(h.x,h.y,a,o,!1),_=De(l.x,l.y,a,o,!1);t.x=this.x+_.x,t.y=this.y+_.y,this.x=this.x+p.x,this.y=this.y+p.y;const y=De(c.x,c.y,a,o,!1),b=De(d.x,d.y,a,o,!1);this.vx=y.x,this.vy=y.y,t.vx=b.x,t.vy=b.y}}nextFrameWall(t){const e=t.left,n=t.top,r=t.right,s=t.bottom,a=t?.bounce??-1;this.x+this.radius>r?(this.x=r-this.radius,this.vx*=a):this.x-this.radius<e&&(this.x=e+this.radius,this.vx*=a),this.y+this.radius>s?(this.y=s-this.radius,this.vy*=a):this.y-this.radius<n&&(this.y=n+this.radius,this.vy*=a)}}let Ia=class extends gr{width;height;constructor(t,e,n,r=n,s){super(t,e,s),this.width=n,this.height=r}eq(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}isIntersectRect(t){return!(this.x+this.width<t.x||t.x+t.width<this.x||this.y+this.height<t.y||t.y+t.height<this.y)}isContainPoint(t){return!(t.x<this.x||t.x>this.x+this.width||t.y<this.y||t.y>this.y+this.height)}toArray(){return[this.x,this.y,this.width,this.height]}clone(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}};class rm{points=[];constructor(t){this.points=t}get length(){return this.points.length}getPoint(t){return this.points[t]}isContainPoint(t){const e=t.x,n=t.y,r=this.length;let s=!1;const a=2e-10;for(let o=0,h=r-1;o<r;h=o,o++){const l=this.points[o].x,c=this.points[o].y,d=this.points[h].x,f=this.points[h].y;if(l===e&&c===n||d===e&&f===n||n===c&&n===f)return!0;if(n>=c&&n<f||n<c&&n>=f){const u=(d-l)/(f-c),g=l+u*(n-c);if(g===e||Math.abs(g-e)<a)return!0;g>e&&(s=!s)}}return s}[Symbol.iterator](){let t=0;return{next:()=>({value:t>=this.length-1?this.points[++t]:void 0,done:t>=this.length})}}}const Ti={Linear:{None:function(i){return i}},Quadratic:{In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}},Cubic:{In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}},Quartic:{In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}},Quintic:{In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}},Sinusoidal:{In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}},Exponential:{In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}},Circular:{In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}},Elastic:{In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}},Back:{In:function(i){return i===1?1:i*i*((1.70158+1)*i-1.70158)},Out:function(i){return i===0?0:--i*i*((1.70158+1)*i+1.70158)+1},InOut:function(i){const t=2.5949095;return(i*=2)<1?.5*(i*i*((t+1)*i-t)):.5*((i-=2)*i*((t+1)*i+t)+2)}},Bounce:{In:function(i){return 1-Ti.Bounce.Out(1-i)},Out:function(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},InOut:function(i){return i<.5?Ti.Bounce.In(i*2)*.5:Ti.Bounce.Out(i*2-1)*.5+.5}},generatePow:function(i=4){return i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(t){return t**i},Out:function(t){return 1-(1-t)**i},InOut:function(t){return t<.5?(t*2)**i/2:(1-(2-t*2)**i)/2+.5}}},random:function(i){return Math.random()},createStep:function(i){return function(t){return Math.floor(t*i)/i}},createNoisyEasing:function(i,t=.1){const e=1-t;return function(n){return t*Math.random()+e*i(n)}}};let bn;typeof self>"u"&&typeof process<"u"&&process.hrtime?bn=function(){const i=process.hrtime();return i[0]*1e3+i[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?bn=self.performance.now.bind(self.performance):Date.now!==void 0?bn=Date.now:bn=function(){return new Date().getTime()};const Ei=bn;let xc=class{_tweens={};_tweensAddedDuringUpdate={};getAll(){return Object.keys(this._tweens).map(t=>this._tweens[t])}removeAll(){this._tweens={}}add(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t}remove(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]}update(t=Ei(),e=!1){let n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(let r=0;r<n.length;r++){const s=this._tweens[n[r]],a=!e;s&&s.update(t,a)===!1&&!e&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0}};const Qe={Linear:function(i,t){const e=i.length-1,n=e*t,r=Math.floor(n),s=Qe.Utils.Linear;return t<0?s(i[0],i[1],n):t>1?s(i[e],i[e-1],e-n):s(i[r],i[r+1>e?e:r+1],n-r)},Bezier:function(i,t){let e=0;const n=i.length-1,r=Math.pow,s=Qe.Utils.Bernstein;for(let a=0;a<=n;a++)e+=r(1-t,n-a)*r(t,a)*i[a]*s(n,a);return e},CatmullRom:function(i,t){const e=i.length-1;let n=e*t,r=Math.floor(n);const s=Qe.Utils.CatmullRom;return i[0]===i[e]?(t<0&&(r=Math.floor(n=e*(1+t))),s(i[(r-1+e)%e],i[r],i[(r+1)%e],i[(r+2)%e],n-r)):t<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):t>1?i[e]-(s(i[e],i[e],i[e-1],i[e-1],n-e)-i[e]):s(i[r?r-1:0],i[r],i[e<r+1?e:r+1],i[e<r+2?e:r+2],n-r)},Utils:{Linear:function(i,t,e){return(t-i)*e+i},Factorial:function(){const i=[1];return function(t){let e=1;if(i[t])return i[t];for(let n=t;n>1;n--)e*=n;return i[t]=e,e}}(),Bernstein:function(i,t){const e=Qe.Utils.Factorial;return e(i)/e(t)/e(i-t)},CatmullRom:function(i,t,e,n,r){const s=(e-i)*.5,a=(n-t)*.5,o=r*r,h=r*o;return(2*t-2*e+s+a)*h+(-3*t+3*e-2*s-a)*o+s*r+t}}};class wn{static _nextId=0;static nextId(){return wn._nextId++}}const zt=new xc;let sm=class{constructor(t,e=zt){this._object=t,this._group=e}_id=wn.nextId();_isPlaying=!1;_startTime=0;_delayTime=0;_durationTime=1e3;_isPaused=!1;_pauseStartTime=0;_initialRepeat=0;_repeat=0;_repeatDelayTime;_yoyo=!1;_reversed=!1;_valuesStart={};_valuesEnd={};_valuesStartRepeat={};_easingFunction=Ti.Linear.None;_interpolationFunction=Qe.Linear;_chainedTweens=[];_isChainStopped=!1;_onStartCallback;_onStartCallbackFired=!1;_onEveryStartCallback;_onEveryStartCallbackFired=!1;_onUpdateCallback;_onRepeatCallback;_onCompleteCallback;_onStopCallback;_goToEnd=!1;getId(){return this._id}isPlaying(){return this._isPlaying}isPaused(){return this._isPaused}to(t,e){return this._valuesEnd=Object.create(t),e!==void 0&&(this._durationTime=e),this}duration(t=1e3){return this._durationTime=t,this}start(t=Ei()){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(const e in this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this}_setupProperties(t,e,n,r){for(const s in n){const a=t[s],o=Array.isArray(a),h=o?"array":typeof a,l=!o&&Array.isArray(n[s]);if(!(h==="undefined"||h==="function")){if(l){let c=n[s];if(c.length===0)continue;c=c.map(this._handleRelativeValue.bind(this,a)),n[s]=[a].concat(c)}if((h==="object"||o)&&a&&!l){e[s]=o?[]:{};for(const c in a)e[s][c]=a[c];r[s]=o?[]:{},this._setupProperties(a,e[s],n[s],r[s])}else typeof e[s]>"u"&&(e[s]=a),o||(e[s]*=1),l?r[s]=n[s].slice().reverse():r[s]=e[s]||0}}}stop(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this}end(){return this._goToEnd=!0,this.update(1/0),this}pause(t=Ei()){return this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStartTime=t,this._group&&this._group.remove(this),this)}resume(t=Ei()){return!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStartTime,this._pauseStartTime=0,this._group&&this._group.add(this),this)}stopChainedTweens(){for(let t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this}group(t=zt){return this._group=t,this}delay(t=0){return this._delayTime=t,this}repeat(t=0){return this._initialRepeat=t,this._repeat=t,this}repeatDelay(t){return this._repeatDelayTime=t,this}yoyo(t=!1){return this._yoyo=t,this}easing(t=Ti.Linear.None){return this._easingFunction=t,this}interpolation(t=Qe.Linear){return this._interpolationFunction=t,this}chain(...t){return this._chainedTweens=t,this}onStart(t){return this._onStartCallback=t,this}onEveryStart(t){return this._onEveryStartCallback=t,this}onUpdate(t){return this._onUpdateCallback=t,this}onRepeat(t){return this._onRepeatCallback=t,this}onComplete(t){return this._onCompleteCallback=t,this}onStop(t){return this._onStopCallback=t,this}update(t=Ei(),e=!0){if(this._isPaused)return!0;let n,r;const s=this._startTime+this._durationTime;if(!this._goToEnd&&!this._isPlaying){if(t>s)return!1;e&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0),r=(t-this._startTime)/this._durationTime,r=this._durationTime===0||r>1?1:r;const a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),r===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(n in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[n]=="string"&&(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(let o=0,h=this._chainedTweens.length;o<h;o++)this._chainedTweens[o].start(this._startTime+this._durationTime);return this._isPlaying=!1,!1}return!0}_updateProperties(t,e,n,r){for(const s in n){if(e[s]===void 0)continue;const a=e[s]||0;let o=n[s];const h=Array.isArray(t[s]),l=Array.isArray(o);!h&&l?t[s]=this._interpolationFunction(o,r):typeof o=="object"&&o?this._updateProperties(t[s],a,o,r):(o=this._handleRelativeValue(a,o),typeof o=="number"&&(t[s]=a+(o-a)*r))}}_handleRelativeValue(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)}_swapEndStartRepeatValues(t){const e=this._valuesStartRepeat[t],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=n,this._valuesEnd[t]=e}};const am=wn.nextId,om=zt.getAll.bind(zt),lm=zt.removeAll.bind(zt),hm=zt.add.bind(zt),cm=zt.remove.bind(zt),um=zt.update.bind(zt),dm={Easing:Ti,Group:xc,Interpolation:Qe,now:Ei,Sequence:wn,nextId:am,Tween:sm,getAll:om,removeAll:lm,add:hm,remove:cm,update:um};function Tc(i){const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",i),t}function fm(i,t){const e=Tc(i),{x:n,y:r}=e.getPointAtLength(t);return[n,r]}function gm(i,t){return Tc(i).getTotalLength(t)}let Ht=null;function pm({d:i},t,e){Ht||(Ht=document.createElement("canvas").getContext("2d"));const n=new Path2D(i);return Ht.isPointInPath(n,t,e)}function Ec({d:i},t,e,{lineWidth:n=1,lineCap:r="butt",lineJoin:s="miter"}){if(Ht||(Ht=document.createElement("canvas").getContext("2d")),Ht.isPointInStroke){Ht.save(),Ht.lineWidth=n,Ht.lineCap=r,Ht.lineJoin=s;const a=new Path2D(i),o=Ht.isPointInStroke(a,t,e);return Ht.restore(),o}}var Fa={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},mm=/([astvzqmhlc])([^astvzqmhlc]*)/gi;function _m(i){var t=[];return i.replace(mm,function(e,n,r){var s=n.toLowerCase();for(r=ym(r),s=="m"&&r.length>2&&(t.push([n].concat(r.splice(0,2))),s="l",n=n=="m"?"l":"L");;){if(r.length==Fa[s])return r.unshift(n),t.push(r);if(r.length<Fa[s])throw new Error("malformed path data");t.push([n].concat(r.splice(0,Fa[s])))}}),t}var vm=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function ym(i){var t=i.match(vm);return t?t.map(Number):[]}function bm(i){var t=0,e=0,n=0,r=0;return i.map(function(s){s=s.slice();var a=s[0],o=a.toUpperCase();if(a!=o)switch(s[0]=o,a){case"a":s[6]+=n,s[7]+=r;break;case"v":s[1]+=r;break;case"h":s[1]+=n;break;default:for(var h=1;h<s.length;)s[h++]+=n,s[h++]+=r}switch(o){case"Z":n=t,r=e;break;case"H":n=s[1];break;case"V":r=s[1];break;case"M":n=t=s[1],r=e=s[2];break;default:n=s[s.length-2],r=s[s.length-1]}return s})}const Sn=Math.PI*2;function kc(i,t,e,n){const r=i*n-t*e<0?-1:1;let s=i*e+t*n;return s>1&&(s=1),s<-1&&(s=-1),r*Math.acos(s)}function wm(i,t,e,n,r,s,a,o,h,l){const c=l*(i-e)/2+h*(t-n)/2,d=-h*(i-e)/2+l*(t-n)/2,f=a*a,u=o*o,g=c*c,p=d*d;let _=f*u-f*p-u*g;_<0&&(_=0),_/=f*p+u*g,_=Math.sqrt(_)*(r===s?-1:1);const y=_*a/o*d,b=_*-o/a*c,m=l*y-h*b+(i+e)/2,v=h*y+l*b+(t+n)/2,w=(c-y)/a,S=(d-b)/o,k=(-c-y)/a,C=(-d-b)/o,A=kc(1,0,w,S);let x=kc(w,S,k,C);return s===0&&x>0&&(x-=Sn),s===1&&x<0&&(x+=Sn),[m,v,A,x]}function Sm(i,t){const e=1.3333333333333333*Math.tan(t/4),n=Math.cos(i),r=Math.sin(i),s=Math.cos(i+t),a=Math.sin(i+t);return[n,r,n-r*e,r+n*e,s+a*e,a-s*e,s,a]}function Cm(i,t,e,n,r,s,a,o,h){const l=Math.sin(h*Sn/360),c=Math.cos(h*Sn/360),d=c*(i-e)/2+l*(t-n)/2,f=-l*(i-e)/2+c*(t-n)/2;if(d===0&&f===0)return[];if(a===0||o===0)return[];a=Math.abs(a),o=Math.abs(o);const u=d*d/(a*a)+f*f/(o*o);u>1&&(a*=Math.sqrt(u),o*=Math.sqrt(u));const g=wm(i,t,e,n,r,s,a,o,l,c),p=[];let _=g[2],y=g[3];const b=Math.max(Math.ceil(Math.abs(y)/(Sn/4)),1);y/=b;for(let m=0;m<b;m++)p.push(Sm(_,y)),_+=y;return p.map(m=>{for(let v=0;v<m.length;v+=2){let w=m[v+0],S=m[v+1];w*=a,S*=o;const k=c*w-l*S,C=l*w+c*S;m[v+0]=k+g[0],m[v+1]=C+g[1]}return m})}function xm(i){for(var t,e=[],n=0,r=0,s=0,a=0,o=null,h=null,l=0,c=0,d=0,f=i.length;d<f;d++){var u=i[d],g=u[0];switch(g){case"M":s=u[1],a=u[2];break;case"A":var p=Cm(l,c,u[6],u[7],u[4],u[5],u[1],u[2],u[3]);if(!p.length)continue;p=p.map(v=>{const[w,S,k,C,A,x,T,M]=v;return{x1:k,y1:C,x2:A,y2:x,x:T,y:M}});for(var _=0,y;_<p.length;_++)y=p[_],u=["C",y.x1,y.y1,y.x2,y.y2,y.x,y.y],_<p.length-1&&e.push(u);break;case"S":var b=l,m=c;(t=="C"||t=="S")&&(b+=b-n,m+=m-r),u=["C",b,m,u[1],u[2],u[3],u[4]];break;case"T":t=="Q"||t=="T"?(o=l*2-o,h=c*2-h):(o=l,h=c),u=Ac(l,c,o,h,u[1],u[2]);break;case"Q":o=u[1],h=u[2],u=Ac(l,c,u[1],u[2],u[3],u[4]);break;case"L":u=pr(l,c,u[1],u[2]);break;case"H":u=pr(l,c,u[1],c);break;case"V":u=pr(l,c,l,u[1]);break;case"Z":u=pr(l,c,s,a);break}t=g,l=u[u.length-2],c=u[u.length-1],u.length>4?(n=u[u.length-4],r=u[u.length-3]):(n=l,r=c),e.push(u)}return e}function pr(i,t,e,n){return["C",i,t,e,n,e,n]}function Ac(i,t,e,n,r,s){return["C",i/3+.6666666666666666*e,t/3+.6666666666666666*n,r/3+.6666666666666666*e,s/3+.6666666666666666*n,r,s]}function Tm(i){return typeof i!="string"?!1:(i=i.trim(),/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(i)&&/[\dz]$/i.test(i)&&i.length>4)}const mr=Symbol("initialPath"),ue=Symbol("path"),Le=Symbol("bounds"),_r=Symbol("savedPaths"),de=Symbol("renderProps"),Na=Symbol("beginPath");class Em{constructor(t){if(!Tm(t))throw new Error("Not an SVG path!");this[mr]=bm(_m(t)),this[ue]=xm(this[mr]),this[Le]=null,this[_r]=[],this[de]={},this[Na]=!1}save(){return this[_r].push({path:this[ue],bounds:this[Le],renderProps:Object.assign({},this[de])}),this}restore(){if(this[_r].length){const{path:t,bounds:e,renderProps:n}=this[_r].pop();this[ue]=t,this[Le]=e,this[de]=n}return this}get bounds(){if(!this[Le]){const t=this[ue];if(this[Le]=[0,0,0,0],t.length){const e=[1/0,1/0,-1/0,-1/0];for(let n=0,r=t.length;n<r;n++){const s=t[n].slice(1);for(let a=0;a<s.length;a+=2)s[a+0]<e[0]&&(e[0]=s[a+0]),s[a+1]<e[1]&&(e[1]=s[a+1]),s[a+0]>e[2]&&(e[2]=s[a+0]),s[a+1]>e[3]&&(e[3]=s[a+1])}this[Le]=e}}return this[Le]}get size(){const t=this.bounds;return[t[2]-t[0],t[3]-t[1]]}get center(){const[t,e,n,r]=this.bounds;return[(t+n)/2,(e+r)/2]}get d(){let t=this[ue].map(e=>{const[n,...r]=e;return n+r.join()}).join("");return this.isClosed&&(t+="Z"),t}get path(){return this[ue]}get isClosed(){const t=this[mr][this[mr].length-1];return t&&t[0]==="Z"}isPointInPath(t,e){return pm(this,t,e)}isPointInStroke(t,e,{lineWidth:n=1,lineCap:r="butt",lineJoin:s="miter"}){if(Ec)return Ec(this,t,e,{lineWidth:n,lineCap:r,lineJoin:s})}getPointAtLength(t){return fm(this.d,t)}getTotalLength(){return gm(this.d)}transform(...t){this[Le]=null;const e=new ce(t),n=this[ue];return this[ue]=n.map(r=>{const[s,...a]=r,o=[s];for(let h=0;h<a.length;h+=2){const l=a[h],c=a[h+1],[d,f]=e.transformPoint(l,c);o.push(d,f)}return o}),this}translate(t,e){const n=new ce().translate(t,e);return this.transform(...n.m)}rotate(t){const e=new ce().rotate(t);return this.transform(...e.m)}scale(t,e){e==null&&(e=t);const n=new ce().scale(t,e);return this.transform(...n.m)}skew(t,e){const n=new ce().skew(t,e);return this.transform(...n.m)}trim(){const[t,e]=this.bounds;return this.translate(-t,-e),this}beginPath(){return this[Na]=!0,this}toCanvas(t){const e=this[ue],n=this[de];return e.length&&(this[Na]&&t.beginPath(),e.forEach(r=>{const[s,...a]=r;s==="M"?t.moveTo(...a):t.bezierCurveTo(...a)}),this.isClosed&&t.closePath()),Object.assign(t,n),{stroke(){return t.stroke(),this},fill(){return t.fill(),this}}}strokeStyle(t){return this[de].strokeStyle=t,this}fillStyle(t){return this[de].fillStyle=t,this}lineWidth(t){return this[de].lineWidth=t,this}lineCap(t){return this[de].lineCap=t,this}lineJoin(t){return this[de].lineJoin=t,this}}const Pc=km("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32);function km(i,t=10){const e={},n=i.split(",");for(let r=0;r<n.length;r+=2){const s="&"+n[r+1]+";",a=parseInt(n[r],t);e[s]="&#"+a+";"}return e["\\xa0"]=" ",e}function Rt(i,t){const e=Object.keys(t);for(let n=0;n<e.length;n++)i=i.replace(new RegExp("{"+e[n]+"}","gi"),""+t[e[n]]);return i}function vr(i){let t,e;if(!i)throw new Error("cannot create a random attribute name for an undefined object");const n="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";t="";do for(t="",e=0;e<12;e++)t+=n[Math.floor(Math.random()*n.length)];while(i[t]);return t}function Am(i){const t={left:"start",right:"end",center:"middle",start:"start",end:"end"};return t[i]||t.start}function Pm(i){const t={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return t[i]||t.alphabetic}const Cn={strokeStyle:{svgAttr:"stroke",canvas:"#000000",svg:"none",apply:"stroke"},fillStyle:{svgAttr:"fill",canvas:"#000000",svg:null,apply:"fill"},lineCap:{svgAttr:"stroke-linecap",canvas:"butt",svg:"butt",apply:"stroke"},lineJoin:{svgAttr:"stroke-linejoin",canvas:"miter",svg:"miter",apply:"stroke"},miterLimit:{svgAttr:"stroke-miterlimit",canvas:10,svg:4,apply:"stroke"},lineWidth:{svgAttr:"stroke-width",canvas:1,svg:1,apply:"stroke"},globalAlpha:{svgAttr:"opacity",canvas:1,svg:1,apply:"fill stroke"},font:{canvas:"10px sans-serif"},shadowColor:{canvas:"#000000"},shadowOffsetX:{canvas:0},shadowOffsetY:{canvas:0},shadowBlur:{canvas:0},textAlign:{canvas:"start"},textBaseline:{canvas:"alphabetic"},lineDash:{svgAttr:"stroke-dasharray",canvas:[],svg:null,apply:"stroke"}};class Ua{__root;__ctx;constructor(t,e){this.__root=t,this.__ctx=e}addColorStop(t,e){const n=this.__ctx.__createElement("stop");if(n.setAttribute("offset",""+t),e.indexOf("rgba")!==-1){const s=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(e);s&&(n.setAttribute("stop-color",Rt("rgb({r},{g},{b})",{r:s[1],g:s[2],b:s[3]})),n.setAttribute("stop-opacity",s[4]))}else n.setAttribute("stop-color",e);this.__root.appendChild(n)}}class Mc{__root;__ctx;constructor(t,e){this.__root=t,this.__ctx=e}}class yr{__document=document;__canvas;__ctx;width;height;__styleStack;__groupStack;__rootSVG;__ids;__SVGdefs;__currentElement;__currentElementsToStyle=null;constructor({canvas:t,width:e=500,height:n=500,enableMirroring:r=!1}){this.enableMirroring=r,t?(this.__canvas=t,this.__ctx=t.getContext("2d"),this.width=t.width,this.height=t.height):(this.__canvas=this.__document.createElement("canvas"),this.__ctx=this.__canvas.getContext("2d"),this.width=e,this.height=n),this.__setDefaultStyles(),this.__styleStack=[this.__getStyleState()],this.__groupStack=[],this.__rootSVG=this.__document.createElementNS("http://www.w3.org/2000/svg","svg"),this.__rootSVG.setAttribute("version","1.1"),this.__rootSVG.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.__rootSVG.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),this.__rootSVG.setAttribute("width",""+this.width),this.__rootSVG.setAttribute("height",""+this.height),this.__ids={},this.__SVGdefs=this.__document.createElementNS("http://www.w3.org/2000/svg","defs"),this.__rootSVG.appendChild(this.__SVGdefs),this.__currentElement=this.__document.createElementNS("http://www.w3.org/2000/svg","g"),this.__rootSVG.appendChild(this.__currentElement)}__setDefaultStyles(){const t=Object.keys(Cn);for(let e=0,n=t.length;e<n;e++){const r=t[e];this[r]=Cn[r].canvas}}__getStyleState(){const t={},e=Object.keys(Cn);for(let n=0,r=e.length;n<r;n++){const s=e[n];t[s]=this[s]}return t}__applyStyleState(t){const e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){const s=e[n];this[s]=t[s]}}__createElement(t,e={},n=!1){const r=this.__document.createElementNS("http://www.w3.org/2000/svg",t),s=Object.keys(e);n&&(r.setAttribute("fill","none"),r.setAttribute("stroke","none"));for(let a=0;a<s.length;a++){const o=s[a];r.setAttribute(o,e[o])}return r}__applyStyleToCurrentElement(t){let e=this.__currentElement;const n=this.__currentElementsToStyle;n&&(e.setAttribute(t,""),e=n.element,n.children.forEach(s=>{s.setAttribute(t,"")}));const r=Object.keys(Cn);for(let s=0;s<r.length;s++){const a=Cn[r[s]],o=this[r[s]];if(a.apply){if(o instanceof Mc){if(o.__ctx)for(;o.__ctx.__SVGdefs.childNodes.length;){const h=o.__ctx.__SVGdefs.childNodes[0].getAttribute("id");this.__ids[h]=h,this.__SVGdefs.appendChild(o.__ctx.__SVGdefs.childNodes[0])}e.setAttribute(a.apply,Rt("url(#{id})",{id:o.__root.getAttribute("id")}))}else if(o instanceof Ua)e.setAttribute(a.apply,Rt("url(#{id})",{id:o.__root.getAttribute("id")}));else if(a.apply.indexOf(t)!==-1&&a.svg!==o)if((a.svgAttr==="stroke"||a.svgAttr==="fill")&&o.indexOf("rgba")!==-1){const l=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(o);e.setAttribute(a.svgAttr,Rt("rgb({r},{g},{b})",{r:l[1],g:l[2],b:l[3]}));let c=parseFloat(l[4]);const d=this.globalAlpha;d!=null&&(c*=d),e.setAttribute(a.svgAttr+"-opacity",""+c)}else{let h=a.svgAttr;if(r[s]==="globalAlpha"&&(h=t+"-"+a.svgAttr,e.getAttribute(h)))continue;h&&e.setAttribute(h,o)}}}}__closestGroupOrSvg(t){return t=t||this.__currentElement,t.nodeName==="g"||t.nodeName==="svg"?t:this.__closestGroupOrSvg(t.parentNode)}getSerializedSvg(t){let e=new XMLSerializer().serializeToString(this.__rootSVG);if(/xmlns="http:\/\/www\.w3\.org\/2000\/svg".+xmlns="http:\/\/www\.w3\.org\/2000\/svg/gi.test(e)&&(e=e.replace('xmlns="http://www.w3.org/2000/svg','xmlns:xlink="http://www.w3.org/1999/xlink')),t){const r=Object.keys(Pc);for(let s=0,a=r.length;s<a;s++){const o=r[s],h=Pc[o],l=new RegExp(o,"gi");l.test(e)&&(e=e.replace(l,h))}}return e}getSvg(){return this.__rootSVG}save(){const t=this.__createElement("g"),e=this.__closestGroupOrSvg();this.__groupStack.push(e),e.appendChild(t),this.__currentElement=t,this.__styleStack.push(this.__getStyleState())}restore(){this.__currentElementsToStyle=null;const t=this.__groupStack.pop();t?this.__currentElement=t:this.__currentElement=this.__rootSVG.childNodes[1];const e=this.__styleStack.pop();e&&this.__applyStyleState(e)}__addTransform(t){const e=this.__closestGroupOrSvg();if(e.childNodes.length>0){this.__currentElement.nodeName==="path"&&(this.__currentElementsToStyle||(this.__currentElementsToStyle={element:e,children:[]}),this.__currentElementsToStyle.children.push(this.__currentElement),this.__applyCurrentDefaultPath());const r=this.__createElement("g");e.appendChild(r),this.__currentElement=r}let n=this.__currentElement.getAttribute("transform");n?n+=" ":n="",n+=t,this.__currentElement.setAttribute("transform",n)}scale(t,e){e===void 0&&(e=t),this.__addTransform(Rt("scale({x},{y})",{x:t,y:e}))}rotate(t){const e=t*180/Math.PI;this.__addTransform(Rt("rotate({angle},{cx},{cy})",{angle:e,cx:0,cy:0}))}translate(t,e){this.__addTransform(Rt("translate({x},{y})",{x:t,y:e}))}transform(t,e,n,r,s,a){this.__addTransform(Rt("matrix({a},{b},{c},{d},{e},{f})",{a:t,b:e,c:n,d:r,e:s,f:a}))}beginPath(){this.__currentDefaultPath="",this.__currentPosition={};const t=this.__createElement("path",{},!0);this.__closestGroupOrSvg().appendChild(t),this.__currentElement=t}__applyCurrentDefaultPath(){const t=this.__currentElement;t.nodeName==="path"?t.setAttribute("d",this.__currentDefaultPath):console.error("Attempted to apply path command to node",t.nodeName)}__addPathCommand(t){this.__currentDefaultPath+=" ",this.__currentDefaultPath+=t}moveTo(t,e){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.__currentPosition={x:t,y:e},this.__addPathCommand(Rt("M {x} {y}",this.__currentPosition))}closePath(){this.__currentDefaultPath&&this.__addPathCommand("Z")}lineTo(t,e){this.__currentPosition={x:t,y:e},this.__currentDefaultPath.indexOf("M")>-1?this.__addPathCommand(Rt("L {x} {y}",this.__currentPosition)):this.__addPathCommand(Rt("M {x} {y}",this.__currentPosition))}bezierCurveTo(t,e,n,r,s,a){this.__currentPosition={x:s,y:a},this.__addPathCommand(Rt("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:t,cp1y:e,cp2x:n,cp2y:r,x:s,y:a}))}quadraticCurveTo(t,e,n,r){this.__currentPosition={x:n,y:r},this.__addPathCommand(Rt("Q {cpx} {cpy} {x} {y}",{cpx:t,cpy:e,x:n,y:r}))}normalize(t){const e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]/e,t[1]/e]}arcTo(t,e,n,r,s){const a=this.__currentPosition&&this.__currentPosition.x,o=this.__currentPosition&&this.__currentPosition.y;if(typeof a>"u"||typeof o>"u")return;if(s<0)throw new Error("IndexSizeError: The radius provided ("+s+") is negative.");if(a===t&&o===e||t===n&&e===r||s===0){this.lineTo(t,e);return}const h=this.normalize([a-t,o-e]),l=this.normalize([n-t,r-e]);if(h[0]*l[1]===h[1]*l[0]){this.lineTo(t,e);return}const c=h[0]*l[0]+h[1]*l[1],d=Math.acos(Math.abs(c)),f=this.normalize([h[0]+l[0],h[1]+l[1]]),u=s/Math.sin(d/2),g=t+u*f[0],p=e+u*f[1],_=[-h[1],h[0]],y=[l[1],-l[0]],b=function(w){const S=w[0];return w[1]>=0?Math.acos(S):-Math.acos(S)},m=b(_),v=b(y);this.lineTo(g+_[0]*s,p+_[1]*s),this.arc(g,p,s,m,v)}stroke(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","fill stroke markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("stroke")}fill(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","stroke fill markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("fill")}rect(t,e,n,r){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.moveTo(t,e),this.lineTo(t+n,e),this.lineTo(t+n,e+r),this.lineTo(t,e+r),this.lineTo(t,e),this.closePath()}fillRect(t,e,n,r){const s=this.__createElement("rect",{x:t,y:e,width:n,height:r},!0);this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("fill")}strokeRect(t,e,n,r){const s=this.__createElement("rect",{x:t,y:e,width:n,height:r},!0);this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("stroke")}__clearCanvas(){const e=this.__closestGroupOrSvg().getAttribute("transform"),n=this.__rootSVG.childNodes[1],r=n.childNodes;for(let s=r.length-1;s>=0;s--)r[s]&&n.removeChild(r[s]);this.__currentElement=n,this.__groupStack=[],e&&this.__addTransform(e)}clearRect(t,e,n,r){if(t===0&&e===0&&n===this.width&&r===this.height){this.__clearCanvas();return}const s=this.__closestGroupOrSvg(),a=this.__createElement("rect",{x:t,y:e,width:n,height:r,fill:"#FFFFFF"},!0);s.appendChild(a)}createLinearGradient(t,e,n,r){const s=this.__createElement("linearGradient",{id:vr(this.__ids),x1:t+"px",x2:n+"px",y1:e+"px",y2:r+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__SVGdefs.appendChild(s),new Ua(s,this)}createRadialGradient(t,e,n,r,s,a){const o=this.__createElement("radialGradient",{id:vr(this.__ids),cx:r+"px",cy:s+"px",r:a+"px",fx:t+"px",fy:e+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__SVGdefs.appendChild(o),new Ua(o,this)}__parseFont(){const e=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:%|in|[cem]m|ex|p[CustomCanvasContext]))(?:\s*\/\s*(normal|[.\d]+(?:%|in|[cem]m|ex|p[CustomCanvasContext])))?\s*([-,'"\sa-z0-9]+?)\s*$/i.exec(this.font),n={style:e[1]||"normal",size:e[4]||"10px",family:e[6]||"sans-serif",weight:e[3]||"normal",decoration:e[2]||"normal",href:null};return this.__fontUnderline==="underline"&&(n.decoration="underline"),this.__fontHref&&(n.href=this.__fontHref),n}__wrapTextLink(t,e){if(t.href){const n=this.__createElement("a");return n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.href),n.appendChild(e),n}return e}__applyText(t,e,n,r){const s=this.__parseFont(),a=this.__closestGroupOrSvg(),o=this.__createElement("text",{"font-family":s.family,"font-size":s.size,"font-style":s.style,"font-weight":s.weight,"text-decoration":s.decoration,x:e,y:n,"text-anchor":Am(this.textAlign),"dominant-baseline":Pm(this.textBaseline)},!0);o.appendChild(this.__document.createTextNode(t)),this.__currentElement=o,this.__applyStyleToCurrentElement(r),a.appendChild(this.__wrapTextLink(s,o))}fillText(t,e,n){this.__applyText(t,e,n,"fill")}strokeText(t,e,n){this.__applyText(t,e,n,"stroke")}measureText(t){return this.__ctx.font=this.font,this.__ctx.measureText(t)}arc(t,e,n,r,s,a){if(r===s)return;r=r%(2*Math.PI),s=s%(2*Math.PI),r===s&&(s=(s+2*Math.PI-.001*(a?-1:1))%(2*Math.PI));const o=t+n*Math.cos(s),h=e+n*Math.sin(s),l=t+n*Math.cos(r),c=e+n*Math.sin(r),d=a?0:1;let f=0,u=s-r;u<0&&(u+=2*Math.PI),a?f=u>Math.PI?0:1:f=u>Math.PI?1:0,this.lineTo(l,c),this.__addPathCommand(Rt("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:n,ry:n,xAxisRotation:0,largeArcFlag:f,sweepFlag:d,endX:o,endY:h})),this.__currentPosition={x:o,y:h}}clip(){const t=this.__closestGroupOrSvg(),e=this.__createElement("clipPath"),n=vr(this.__ids),r=this.__createElement("g");this.__applyCurrentDefaultPath(),t.removeChild(this.__currentElement),e.setAttribute("id",n),e.appendChild(this.__currentElement),this.__SVGdefs.appendChild(e),t.setAttribute("clip-path",Rt("url(#{id})",{id:n})),t.appendChild(r),this.__currentElement=r}drawImage(...t){let e=t[0],n,r,s,a,o=0,h=0,l,c,d,f,u,g,p,_;if(t.length===3)n=t[1],r=t[2],l=e.width,c=e.height,s=l,a=c;else if(t.length===5)n=t[1],r=t[2],s=t[3],a=t[4],l=e.width,c=e.height;else if(t.length===9)o=t[1],h=t[2],l=t[3],c=t[4],n=t[5],r=t[6],s=t[7],a=t[8];else throw new Error("Invalid number of arguments passed to drawImage: "+arguments.length);const y=this.__closestGroupOrSvg();this.__currentElement;const b="translate("+n+", "+r+")";if(e instanceof yr){if(d=e.getSvg().cloneNode(!0),d.childNodes&&d.childNodes.length>1){for(f=d.childNodes[0];f.childNodes.length;)_=f.childNodes[0].getAttribute("id"),this.__ids[_]=_,this.__SVGdefs.appendChild(f.childNodes[0]);if(u=d.childNodes[1],u){const m=u.getAttribute("transform");let v;m?v=m+" "+b:v=b,u.setAttribute("transform",v),y.appendChild(u)}}}else(e.nodeName==="CANVAS"||e.nodeName==="IMG")&&(g=this.__createElement("image"),g.setAttribute("width",s),g.setAttribute("height",a),g.setAttribute("preserveAspectRatio","none"),(o||h||l!==e.width||c!==e.height)&&(p=this.__document.createElement("canvas"),p.width=s,p.height=a,p.getContext("2d")?.drawImage(e,o,h,l,c,0,0,s,a),e=p),g.setAttribute("transform",b),g.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e.nodeName==="CANVAS"?e.toDataURL():e.getAttribute("src")),y.appendChild(g))}createPattern(t,e){const n=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),r=vr(this.__ids);let s;return n.setAttribute("id",r),t.nodeName==="CANVAS"||t.nodeName==="IMG"?(s=this.__document.createElementNS("http://www.w3.org/2000/svg","image"),s.setAttribute("width",""+t.width),s.setAttribute("height",""+t.height),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.nodeName==="CANVAS"?t.toDataURL():t.getAttribute("src")),n.appendChild(s),this.__SVGdefs.appendChild(n)):t instanceof yr&&(n.setAttribute("width",""+t.width),n.setAttribute("height",""+t.height),n.appendChild(t.__rootSVG.childNodes[1]),this.__SVGdefs.appendChild(n)),new Mc(n,this)}setLineDash(t){t&&t.length>0?this.lineDash=t.join(","):this.lineDash=null}drawFocusRing(){}createImageData(){}getImageData(){}putImageData(){}globalCompositeOperation(){}setTransform(){}}const Mm=yr,Rm=function(i,t,e,n,r,s){i.beginPath(),i.moveTo(t,e+s),i.lineTo(t,e+r-s),i.quadraticCurveTo(t,e+r,t+s,e+r),i.lineTo(t+n-s,e+r),i.quadraticCurveTo(t+n,e+r,t+n,e+r-s),i.lineTo(t+n,e+s),i.quadraticCurveTo(t+n,e,t+n-s,e),i.lineTo(t+s,e),i.quadraticCurveTo(t,e,t,e+s),i.stroke()},Dm=function(i,t,e,n){var r=t-n,s=0,a=1;i.beginPath(),i.moveTo(r,s);do{if(a>2e4)break;var o=(t+e)*Math.cos(a*Math.PI/72)-(e+n)*Math.cos((t+e)/e*(a*Math.PI/72)),h=(t+e)*Math.sin(a*Math.PI/72)-(e+n)*Math.sin((t+e)/e*(a*Math.PI/72));i.lineTo(o,h),r=o,s=h,a++}while(o!=t-n&&h!=0);i.stroke()},Lm=function(i,t){i.save(),i.beginPath(),i.moveTo(t,0);for(var e=0;e<9;e++)i.rotate(Math.PI/5),e%2==0?i.lineTo(t/.525731*.200811,0):i.lineTo(t,0);i.closePath(),i.fill(),i.restore()},Om=function(i,t,e,n,r){var s=0;function a(){i.clearRect(t,e,n,r),i.setLineDash([4,2]),i.lineDashOffset=-s,i.strokeRect(t,e,n,r)}function o(){s++,s>16&&(s=0),a(),setTimeout(o,40)}o()},Im=function(i){i.beginPath(),i.arc(75,75,50,0,Math.PI*2,!0),i.moveTo(110,75),i.arc(75,75,35,0,Math.PI,!1),i.moveTo(65,65),i.arc(60,65,5,0,Math.PI*2,!0),i.moveTo(95,65),i.arc(90,65,5,0,Math.PI*2,!0),i.stroke()};let Fm=class{constructor(t=0,e=0,n="#ffff00",r=0){this.x=t,this.y=e,this.color=n,this.rotation=r}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.lineWidth=2,t.fillStyle=this.color,t.beginPath(),t.moveTo(-50,-25),t.lineTo(0,-25),t.lineTo(0,-50),t.lineTo(50,0),t.lineTo(0,50),t.lineTo(0,25),t.lineTo(-50,25),t.lineTo(-50,-25),t.closePath(),t.fill(),t.stroke(),t.restore()}};class Nm extends pt{constructor(t=40,e="#ff0000"){super(0,0,{vx:0,vy:0,radius:t}),this.x=0,this.y=0,this.radius=t,this.vx=0,this.vy=0,this.mass=1,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=e,this.lineWidth=1}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.fillStyle=this.color,t.beginPath(),t.arc(0,0,this.radius,0,Math.PI*2,!0),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore()}getBounds(){return new Ia(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}class Um{constructor(t=40,e="#ff0000"){this.x=0,this.y=0,this.xpos=0,this.ypos=0,this.zpos=0,this.radius=t,this.vx=0,this.vy=0,this.vz=0,this.mass=1,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=e,this.lineWidth=1,this.visible=!0}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.fillStyle=this.color,t.beginPath(),t.arc(0,0,this.radius,0,Math.PI*2,!0),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore()}}class Gm{constructor(t=50,e=50,n="#ff0000"){this.x=0,this.y=0,this.width=t,this.height=e,this.vx=0,this.vy=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=n,this.lineWidth=1}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.fillStyle=this.color,t.beginPath(),t.rect(0,0,this.width,this.height),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore()}isIntersectRect(t){return!(this.x+this.width<t.x||t.x+t.width<this.x||this.y+this.height<t.y||t.y+t.height<this.y)}}class Bm{constructor(t,e,n,r){this.x=t===void 0?-100:t,this.y=e===void 0?-100:e,this.z=n===void 0?-100:n,this.brightness=r===void 0?1:r}setBrightness(t){this.brightness=Math.min(Math.max(t,0),1)}}let zm=class{constructor(t,e,n,r){this.x=0,this.y=0,this.x1=t===void 0?0:t,this.y1=e===void 0?0:e,this.x2=n===void 0?0:n,this.y2=r===void 0?0:r,this.rotation=0,this.scaleX=1,this.scaleY=1,this.lineWidth=1}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.beginPath(),t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2),t.closePath(),t.stroke(),t.restore()}getBounds(){if(this.rotation===0){var t=Math.min(this.x1,this.x2),e=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),r=Math.max(this.y1,this.y2);return{x:this.x+t,y:this.y+e,width:n-t,height:r-e}}else{var s=Math.sin(this.rotation),a=Math.cos(this.rotation),o=a*this.x1-s*this.y1,h=a*this.x2-s*this.y2,l=a*this.y1+s*this.x1,c=a*this.y2+s*this.x2;return{x:this.x+Math.min(o,h),y:this.y+Math.min(l,c),width:Math.max(o,h)-Math.min(o,h),height:Math.max(l,c)-Math.min(l,c)}}}};class Hm{constructor(t,e,n){this.x=t===void 0?0:t,this.y=e===void 0?0:e,this.z=n===void 0?0:n,this.fl=250,this.vpX=0,this.vpY=0,this.cX=0,this.cY=0,this.cZ=0}setVanishingPoint(t,e){this.vpX=t,this.vpY=e}setCenter(t,e,n){this.cX=t,this.cY=e,this.cZ=n}rotateX(t){var e=Math.cos(t),n=Math.sin(t),r=this.y*e-this.z*n,s=this.z*e+this.y*n;this.y=r,this.z=s}rotateY(t){var e=Math.cos(t),n=Math.sin(t),r=this.x*e-this.z*n,s=this.z*e+this.x*n;this.x=r,this.z=s}rotateZ(t){var e=Math.cos(t),n=Math.sin(t),r=this.x*e-this.y*n,s=this.y*e+this.x*n;this.x=r,this.y=s}getScreenX(){var t=this.fl/(this.fl+this.z+this.cZ);return this.vpX+(this.cX+this.x)*t}getScreenY(){var t=this.fl/(this.fl+this.z+this.cZ);return this.vpY+(this.cY+this.y)*t}}class jm{constructor(){this.x=0,this.y=0,this.width=25,this.height=20,this.rotation=0,this.showFlame=!1}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.lineWidth=1,t.strokeStyle="#ffffff",t.beginPath(),t.moveTo(10,0),t.lineTo(-10,10),t.lineTo(-5,0),t.lineTo(-10,-10),t.lineTo(10,0),t.closePath(),t.stroke(),this.showFlame&&(t.beginPath(),t.moveTo(-7.5,-5),t.lineTo(-15,0),t.lineTo(-7.5,5),t.closePath(),t.stroke()),t.restore()}}class Vm{constructor(t,e,n){this.min=t===void 0?0:t,this.max=e===void 0?100:e,this.value=n===void 0?100:n,this.onchange=null,this.x=0,this.y=0,this.width=16,this.height=100,this.backColor="#cccccc",this.backBorderColor="#999999",this.backWidth=4,this.backX=this.width/2-this.backWidth/2,this.handleColor="#eeeeee",this.handleBorderColor="#cccccc",this.handleHeight=6,this.handleY=0,this.updatePosition()}draw(t){t.save(),t.translate(this.x,this.y),t.fillStyle=this.backColor,t.beginPath(),t.fillRect(this.backX,0,this.backWidth,this.height),t.closePath(),t.strokeStyle=this.handleBorderColor,t.fillStyle=this.handleColor,t.beginPath(),t.rect(0,this.handleY,this.width,this.handleHeight),t.closePath(),t.fill(),t.stroke(),t.restore()}updateValue(){var t=this.value,e=this.height-this.handleHeight,n=this.max-this.min;this.value=(e-this.handleY)/e*n+this.min,typeof this.onchange=="function"&&this.value!==t&&this.onchange()}updatePosition(){var t=this.height-this.handleHeight,e=this.max-this.min;this.handleY=t-(this.value-this.min)/e*t}captureMouse(t){var e=this,n=Zs.captureMouse(t),r=new Ia(0,0,0,0);o(),t.addEventListener("mousedown",function(){r.isContainPoint(n)&&(t.addEventListener("mouseup",s,!1),t.addEventListener("mousemove",a,!1))},!1);function s(){t.removeEventListener("mousemove",a,!1),t.removeEventListener("mouseup",s,!1),o()}function a(){var h=n.y-e.y;e.handleY=Math.min(e.height-e.handleHeight,Math.max(h,0)),e.updateValue()}function o(){r.x=e.x,r.y=e.y+e.handleY,r.width=e.width,r.height=e.handleHeight}}}class $m{constructor(t,e,n,r="#ff0000"){this.pointA=t,this.pointB=e,this.pointC=n,this.color=r,this.lineWidth=1,this.alpha=1}draw(t){this.isBackface()||(t.save(),t.lineWidth=this.lineWidth,t.fillStyle=t.strokeStyle=Oa(this.color,this.alpha),t.beginPath(),t.moveTo(this.pointA.getScreenX(),this.pointA.getScreenY()),t.lineTo(this.pointB.getScreenX(),this.pointB.getScreenY()),t.lineTo(this.pointC.getScreenX(),this.pointC.getScreenY()),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore())}getDepth(){return Math.min(this.pointA.z,this.pointB.z,this.pointC.z)}isBackface(){var t=this.pointC.getScreenX()-this.pointA.getScreenX(),e=this.pointC.getScreenY()-this.pointA.getScreenY(),n=this.pointB.getScreenX()-this.pointC.getScreenX(),r=this.pointB.getScreenY()-this.pointC.getScreenY();return t*r>e*n}}class Xm{constructor(t,e,n,r="#ff0000"){this.pointA=t,this.pointB=e,this.pointC=n,this.color=r,this.lineWidth=1,this.alpha=1,this.light=null}draw(t){this.isBackface()||(t.save(),t.lineWidth=this.lineWidth,t.fillStyle=t.strokeStyle=this.getAdjustedColor(),t.beginPath(),t.moveTo(this.pointA.getScreenX(),this.pointA.getScreenY()),t.lineTo(this.pointB.getScreenX(),this.pointB.getScreenY()),t.lineTo(this.pointC.getScreenX(),this.pointC.getScreenY()),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore())}getDepth(){return Math.min(this.pointA.z,this.pointB.z,this.pointC.z)}isBackface(){var t=this.pointC.getScreenX()-this.pointA.getScreenX(),e=this.pointC.getScreenY()-this.pointA.getScreenY(),n=this.pointB.getScreenX()-this.pointC.getScreenX(),r=this.pointB.getScreenY()-this.pointC.getScreenY();return t*r>e*n}getAdjustedColor(){var t=dr(this.color),e=t>>16,n=t>>8&255,r=t&255,s=this.getLightFactor();return e*=s,n*=s,r*=s,Sc(e<<16|n<<8|r)}getLightFactor(){var t={x:this.pointA.x-this.pointB.x,y:this.pointA.y-this.pointB.y,z:this.pointA.z-this.pointB.z},e={x:this.pointB.x-this.pointC.x,y:this.pointB.y-this.pointC.y,z:this.pointB.z-this.pointC.z},n={x:t.y*e.z-t.z*e.y,y:-(t.x*e.z-t.z*e.x),z:t.x*e.y-t.y*e.x},r=n.x*this.light.x+n.y*this.light.y+n.z*this.light.z,s=Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z),a=Math.sqrt(this.light.x*this.light.x+this.light.y*this.light.y+this.light.z*this.light.z);return Math.acos(r/(s*a))/Math.PI*this.light.brightness}}class Ym{constructor(){this.x=0,this.y=0,this.xpos=0,this.ypos=0,this.zpos=0,this.scaleX=1,this.scaleY=1,this.color="#ffffff",this.alpha=1,this.lineWidth=1,this.branch=[],this.branch[0]=-140-Math.random()*20,this.branch[1]=-30-Math.random()*30,this.branch[2]=Math.random()*80-40,this.branch[3]=-100-Math.random()*40,this.branch[4]=-60-Math.random()*40,this.branch[5]=Math.random()*60-30,this.branch[6]=-110-Math.random()*20}draw(t){t.save(),t.translate(this.x,this.y),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.strokeStyle=Oa(this.color,this.alpha),t.beginPath(),t.moveTo(0,0),t.lineTo(0,this.branch[0]),t.moveTo(0,this.branch[1]),t.lineTo(this.branch[2],this.branch[3]),t.moveTo(0,this.branch[4]),t.lineTo(this.branch[5],this.branch[6]),t.stroke(),t.restore()}}class Wm{constructor(t,e,n="#ffffff"){this.x=0,this.y=0,this.width=t,this.height=e,this.vx=0,this.vy=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=n,this.lineWidth=1}draw(t){var e=this.height,n=this.width+e,r=e/2;t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.fillStyle=this.color,t.beginPath(),t.moveTo(0,-r),t.lineTo(n-2*r,-r),t.quadraticCurveTo(-r+n,-r,-r+n,0),t.lineTo(-r+n,e-2*r),t.quadraticCurveTo(-r+n,-r+e,n-2*r,-r+e),t.lineTo(0,-r+e),t.quadraticCurveTo(-r,-r+e,-r,e-2*r),t.lineTo(-r,0),t.quadraticCurveTo(-r,-r,0,-r),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.beginPath(),t.arc(0,0,2,0,Math.PI*2,!0),t.closePath(),t.stroke(),t.beginPath(),t.arc(this.width,0,2,0,Math.PI*2,!0),t.closePath(),t.stroke(),t.restore()}getPin(){return{x:this.x+Math.cos(this.rotation)*this.width,y:this.y+Math.sin(this.rotation)*this.width}}}class qm{canvas;context;mouse;constructor(t){this.canvas=t,this.context=t.getContext("2d",{willReadFrequently:!0}),this.mouse=Zs.captureMouse(this.canvas)}getMouseRotation(t){return t.angleTo(this.mouse)}followMouse(t,e){const n=this.getMouseRotation(t),{x:r,y:s}=t.fromRadian(n,e);return t.x+=r,t.y+=s,t}followMouseWithAcceleration(t,e=.05){const n=this.getMouseRotation(t),{x:r,y:s}=t.fromRadian(n,e);return t.ax=r,t.ay=s,t.nextFrame(),t}getMouseDistance(t){return t.distanceTo(this.mouse)}clearRect(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this}lineWidth(t){return this.context.lineWidth=t,this}fillStyle(t){return this.context.fillStyle=t,this}fill(){return this.context.fill(),this}strokeStyle(t){return this.context.strokeStyle=t,this}stroke(){return this.context.stroke(),this}createLinearGradient(t,e,n){const r=this.context.createLinearGradient(t.x,t.y,e.x,e.y);return Object.keys(n).forEach(s=>r.addColorStop(parseFloat(s),n[parseFloat(s)])),r}createRadialGradient(t,e,n){const r=this.context.createRadialGradient(t.x,t.y,t.radius,e.x,e.y,e.radius);return Object.keys(n).forEach(s=>r.addColorStop(parseFloat(s),n[parseFloat(s)])),r}moveTo(t){this.context.moveTo(t.x,t.y)}closePath(){this.context.closePath()}lineTo(t,e){this.context.save(),this.context.beginPath(),this.context.moveTo(t.x,t.y),this.context.lineTo(e.x,e.y),this.context.stroke(),this.context.restore()}drawMouseMoveLine(){const t=()=>{this.context.lineTo(this.mouse.x,this.mouse.y),this.stroke()};this.canvas.addEventListener("mousedown",()=>{this.context.beginPath(),this.context.moveTo(this.mouse.x,this.mouse.y),this.canvas.addEventListener("mousemove",t,!1)},!1),this.canvas.addEventListener("mouseup",()=>{this.canvas.removeEventListener("mousemove",t,!1)},!1)}drawMouseMoveBrushLine({brush_size:t,brush_density:e,brush_color:n}={brush_size:25,brush_density:50,brush_color:"#000000"}){const r=this.getImageData(),s=r.data,a=dr(n),o=()=>{for(let h=0;h<e;h++){const l=Math.random()*Math.PI*2,c=Math.random()*t,d=this.mouse.x+Math.cos(l)*c|0,f=this.mouse.y+Math.sin(l)*c|0,u=(d+f*r.width)*4;s[u]=a>>16&255,s[u+1]=a>>8&255,s[u+2]=a&255,s[u+3]=255}this.putImageData(r)};this.canvas.addEventListener("mousedown",()=>{this.canvas.addEventListener("mousemove",o,!1)},!1),this.canvas.addEventListener("mouseup",()=>{this.canvas.removeEventListener("mousemove",o,!1)},!1)}quadraticCurveTo(t,e,n){this.context.save(),this.context.beginPath(),this.context.moveTo(t.x,t.y),this.context.quadraticCurveTo(e.x,e.y,n.x,n.y),this.context.stroke(),this.context.restore()}drawQuadraticCurveLine(t){const e=t.length;if(e<3)return new Error("points length must >= 3");this.context.beginPath(),this.context.moveTo(t[0].x,t[0].y);for(let n=1;n<e;n+=2)this.context.quadraticCurveTo(t[n].x,t[n].y,t[n+1].x,t[n+1].y);this.context.stroke()}quadraticThroughCurveTo(t,e,n){e.x=e.x*2-(t.x+n.x)/2,e.y=e.y*2-(t.y+n.y)/2,this.quadraticCurveTo(t,e,n)}drawQuadraticThroughCurveLine(t){const e=t.length;if(e<3)return new Error("points length must >= 3");this.context.beginPath(),this.context.moveTo(t[0].x,t[0].y);let n=1;for(;n<e-2;n++)this.context.quadraticCurveTo(t[n].x,t[n].y,(t[n].x+t[n+1].x)/2,(t[n].y+t[n+1].y)/2);this.context.quadraticCurveTo(t[n].x,t[n].y,t[n+1].x,t[n+1].y),this.context.stroke()}drawQuadraticThroughCurveLineBetter(t){const e=t.length;if(e<3)return new Error("points length must >= 3");const n=(t[0].x+t[e-1].x)/2,r=(t[0].y+t[e-1].y)/2;this.context.beginPath(),this.context.moveTo(n,r);let s=0;for(;s<e-1;s++){const a=(t[s].x+t[s+1].x)/2,o=(t[s].y+t[s+1].y)/2;this.context.quadraticCurveTo(t[s].x,t[s].y,a,o)}this.context.quadraticCurveTo(t[s].x,t[s].y,r,r),this.context.stroke()}fillRect(t){this.context.save(),this.context.fillRect(t.x,t.y,t.width,t.height),this.context.stroke(),this.context.restore()}drawImage(t,e=0,n=0){this.context.drawImage(t,e,n)}getImageData(t={x:0,y:0,width:this.canvas.width,height:this.canvas.height},e){return this.context.getImageData(t.x,t.y,t.width,t.height,e)}putImageData(t,e=0,n=0){return this.context.putImageData(t,e,n)}drawShape(t){t.draw(this.context)}}var Rc=null;if(navigator.mozGetUserMedia)console.log("This appears to be Firefox"),window.webrtcDetectedBrowser="firefox",window.webrtcDetectedVersion=parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1],10),RTCSessionDescription=mozRTCSessionDescription,RTCIceCandidate=mozRTCIceCandidate,window.getUserMedia=navigator.mozGetUserMedia.bind(navigator),navigator.getUserMedia=Rc,window.createIceServer=function(i,t,e){var n=null,r=i.split(":");if(r[0].indexOf("stun")===0)n={url:i};else if(r[0].indexOf("turn")===0){var s=i.split("?");(s.length===1||s[1].indexOf("transport=udp")===0)&&(n={url:s[0],credential:e,username:t})}return n},window.createIceServers=function(i,t,e){for(var n=[],r=0;r<i.length;r++){var s=createIceServer(i[r],t,e);s!==null&&n.push(s)}return n},window.attachMediaStream=function(i,t){console.log("Attaching media stream"),i.mozSrcObject=t,i.play()},window.reattachMediaStream=function(i,t){console.log("Reattaching media stream"),i.mozSrcObject=t.mozSrcObject,i.play()};else if(navigator.webkitGetUserMedia){console.log("This appears to be Chrome"),window.webrtcDetectedBrowser="chrome";var Dc=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);Dc!==null?window.webrtcDetectedVersion=parseInt(Dc[2],10):window.webrtcDetectedVersion=999,window.createIceServer=function(i,t,e){var n=null,r=i.split(":");return r[0].indexOf("stun")===0?n={url:i}:r[0].indexOf("turn")===0&&(n={url:i,credential:e,username:t}),n},window.createIceServers=function(i,t,e){for(var n=[],r=0;r<i.length;r++){var s=createIceServer(i[r],t,e);s!==null&&n.push(s)}return n},window.getUserMedia=navigator.webkitGetUserMedia.bind(navigator),navigator.getUserMedia=Rc,window.attachMediaStream=function(i,t){typeof i.srcObject<"u"?i.srcObject=t:typeof i.mozSrcObject<"u"?i.mozSrcObject=t:typeof i.src<"u"?i.src=URL.createObjectURL(t):console.log("Error attaching stream to element.")},window.reattachMediaStream=function(i,t){i.src=t.src}}else console.log("Browser does not appear to be WebRTC-capable");class xn{video;constructor(t){this.video=t}setSrcObject(t){this.video.addEventListener("loadedmetadata",e=>{const n=e.target;n instanceof HTMLVideoElement&&console.log(`${n.id} videoWidth: ${n.videoWidth}px, videoHeight: ${n.videoHeight}px.`)}),this.video.srcObject=t}static tryAutoPlayOrAutoPlayAfterClick(t){return new Promise(e=>{t.play().then(()=>{t.autoplay=!0,e(!0)}).catch(n=>{xn.setAutoPlayWhenClick(t),e(!1)})})}static setAutoPlayWhenClick(t){function e(){t.autoplay=!0,t.play(),document.removeEventListener("click",e),document.removeEventListener("touchend",e)}document.addEventListener("click",e),document.addEventListener("touchend",e)}}class Km{localVideoUtil;remoteVideoUtil;localPeerConnection=null;remotePeerConnection=null;constructor(t,e){this.localVideoUtil=new xn(t),this.remoteVideoUtil=new xn(e)}start(){this.getLocalMediaStream().then(t=>{this.call(t)})}end(){this.localPeerConnection?.close(),this.remotePeerConnection?.close(),this.localPeerConnection=null,this.remotePeerConnection=null,this.trace("Ending call.")}getLocalMediaStream(){return new Promise((t,e)=>{navigator.mediaDevices.getUserMedia({audio:!0,video:!0}).then(n=>{this.localVideoUtil.setSrcObject(n),t(n)}).catch(n=>{this.trace(`navigator.getUserMedia error: ${n}.`),e(n)})})}gotRemoteMediaStream(t){const e=t.streams[0];this.remoteVideoUtil.setSrcObject(e),this.trace("Remote peer connection received remote stream.")}call(t){const e=t.getVideoTracks(),n=t.getAudioTracks();e.length>0&&this.trace(`Using video device: ${e[0].label}.`),n.length>0&&this.trace(`Using audio device: ${n[0].label}.`);const r=void 0,s=new RTCPeerConnection(r);this.localPeerConnection=s,this.trace("Created local peer connection object localPeerConnection."),s.addEventListener("icecandidate",this.handleConnection),s.addEventListener("iceconnectionstatechange",this.handleConnectionChange);const a=new RTCPeerConnection(r);this.remotePeerConnection=a,this.trace("Created remote peer connection object remotePeerConnection."),a.addEventListener("icecandidate",this.handleConnection),a.addEventListener("iceconnectionstatechange",this.handleConnectionChange),a.addEventListener("track",this.gotRemoteMediaStream),this.trace("Add local localStream to localPeerConnection."),s.addTrack(e[0],t),s.addTrack(n[0],t),this.trace("localPeerConnection createOffer start."),s.createOffer({offerToReceiveVideo:!0}).then(o=>this.createdOffer(o)).catch(o=>this.setSessionDescriptionError(o))}handleConnection(t){const e=t.target,n=t.candidate;if(e&&n){const r=new RTCIceCandidate(n),s=this.getOtherPeer(e);s&&(s.addIceCandidate(r).then(()=>{this.handleConnectionSuccess(e)}).catch(a=>{this.handleConnectionFailure(e,a)}),this.trace(`${this.getPeerName(e)} ICE candidate:
|
|
24
|
+
`):l.send(e)):(l.open(i,t,!0),l.send(e))})}function E_(i,t){const e=new XMLHttpRequest;e.open("HEAD",i),e.filepath=i,e.callback=t,e.onload=function(){const n=parseFloat(window.localStorage.getItem("lm_"+this.filepath)),r=Date.parse(this.getResponseHeader("Last-Modified"));(isNaN(n)||r>n)&&(window.localStorage.setItem("lm_"+this.filepath,Date.now()),isFinite(n)&&this.callback(r,n))},e.send()}let wa;const Mf=new WeakMap;function bl(i,t){let e=Mf.get(i);e||(e=new Map,Mf.set(i,e));let n=e.get(t);return n||(n=new Rf,e.set(t,n)),n}class Rf{subscribers;constructor(){this.subscribers=new Set}depend(){wa&&this.subscribers.add(wa)}notify(){this.subscribers.forEach(t=>t())}}function A_(i){wa=i,i(),wa=null}function P_(i){return Object.keys(i).forEach(t=>{let e=i[t];const n=bl(i,t);Object.defineProperty(i,t,{get(){return n.depend(),e},set(r){r!=e&&(e=r,n.notify())}})}),i}function M_(i){return new Proxy(i,{get(t,e,n){return bl(i,e).depend(),Reflect.get(t,e,n)},set(t,e,n,r){const s=bl(i,e);return i[e]!=n&&(i[e]=n,s.notify()),Reflect.set(t,e,n,r)}})}const R_=()=>Math.random()*16777215,L_=()=>`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`,D_=()=>`#${(~~(Math.random()*(1<<24))).toString(16)}`,Lf=function(i){let t="00000"+(i|0).toString(16);return t="#"+t.substring(t.length-6),t},Df=function(i,t=1){const e=i>>16&255,n=i>>8&255,r=i&255,s=t<0?0:t>1?1:t;return s===1?"rgb("+e+","+n+","+r+")":"rgba("+e+","+n+","+r+","+s+")"},xa=function(i){return i[0]==="#"&&(i=i.slice(1)),window.parseInt(i,16)},wl=function(i,t=1){const e=xa(i);return Df(e,t)},I_=i=>{const e=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(i);return e?"#"+((1<<24)+(parseInt(e[1])<<16)+(parseInt(e[2])<<8)+parseInt(e[3])).toString(16).slice(1):""};function O_(i,t,e,n){let r,s,a;i=i/360,t=t/100,e=e/100;const o=Math.floor(i*6),l=i*6-o,h=e*(1-t),c=e*(1-l*t),d=e*(1-(1-l)*t);switch(o%6){case 0:r=e,s=d,a=h;break;case 1:r=c,s=e,a=h;break;case 2:r=h,s=e,a=d;break;case 3:r=h,s=c,a=e;break;case 4:r=d,s=h,a=e;break;case 5:default:r=e,s=h,a=c;break}return{r:Math.round(r*255),g:Math.round(s*255),b:Math.round(a*255),a:n??1}}function F_(i,t,e,n){const r=Math.max(i,t,e),s=Math.min(i,t,e),a=r-s,o=r===0?0:a/r,l=r/255;let h;switch(r){case s:h=0;break;case i:h=t-e+a*(t<e?6:0),h/=6*a;break;case t:h=e-i+a*2,h/=6*a;break;case e:default:h=i-t+a*4,h/=6*a;break}return{h:Math.round(h*360),s:Math.round(o*100),v:Math.round(l*100),a:n??1}}function N_(i,t){let e=parseInt(i.substring(1,3),16),n=parseInt(i.substring(3,5),16),r=parseInt(i.substring(5,7),16);e==0&&(e=32),n==0&&(n=32),r==0&&(r=32),e=e*(100+t)/100,n=n*(100+t)/100,r=r*(100+t)/100,e=e<255?e:255,n=n<255?n:255,r=r<255?r:255,e=Math.round(e),n=Math.round(n),r=Math.round(r);const s=e.toString(16).length==1?"0"+e.toString(16):e.toString(16),a=n.toString(16).length==1?"0"+n.toString(16):n.toString(16),o=r.toString(16).length==1?"0"+r.toString(16):r.toString(16);return"#"+s+a+o}const U_=i=>i*Math.PI/180,B_=i=>i*180/Math.PI;function Pi(i,t,e,n,r=!1){return{x:r?i*n+t*e:i*n-t*e,y:r?t*n-i*e:t*n+i*e}}let Dn=class Mh{m;constructor(t=[1,0,0,1,0,0]){this.m=[t[0],t[1],t[2],t[3],t[4],t[5]]}unit(){return this.m=[1,0,0,1,0,0],this}multiply(t){const e=this.m;let n;t instanceof Mh?n=t.m:n=t;const r=e[0]*n[0]+e[2]*n[1],s=e[1]*n[0]+e[3]*n[1],a=e[0]*n[2]+e[2]*n[3],o=e[1]*n[2]+e[3]*n[3],l=e[0]*n[4]+e[2]*n[5]+e[4],h=e[1]*n[4]+e[3]*n[5]+e[5];return e[0]=r,e[1]=s,e[2]=a,e[3]=o,e[4]=l,e[5]=h,this}inverse(){const t=new Mh(this.m),e=t.m,n=1/(e[0]*e[3]-e[1]*e[2]),r=e[3]*n,s=-e[1]*n,a=-e[2]*n,o=e[0]*n,l=n*(e[2]*e[5]-e[3]*e[4]),h=n*(e[1]*e[4]-e[0]*e[5]);return e[0]=r,e[1]=s,e[2]=a,e[3]=o,e[4]=l,e[5]=h,t}translate(t,e){return this.multiply([1,0,0,1,t,e])}rotate(t){const e=t*Math.PI/180,n=Math.cos(e),r=Math.sin(e);return this.multiply([n,r,-r,n,0,0])}skew(t,e=0){const n=t*Math.PI/180,r=e*Math.PI/180,s=Math.tan(n),a=Math.tan(r);return this.multiply([1,a,s,1,0,0])}scale(t,e){return this.multiply([t,0,0,e,0,0])}transformPoint(t,e){const n=t,r=e;return t=n*this.m[0]+r*this.m[2]+this.m[4],e=n*this.m[1]+r*this.m[3]+this.m[5],[t,e]}transformVector(t,e){const n=t,r=e;return t=n*this.m[0]+r*this.m[2],e=n*this.m[1]+r*this.m[3],[t,e]}};class Sa{x;y;z;constructor(t=[0,0,0],e=[0,0,0]){const[n,r,s]=t,[a,o,l]=e;this.x=n-a,this.y=r-o,this.z=s-l}get length(){const{x:t,y:e,z:n}=this;return Math.sqrt(t*t+e*e+n*n)}unit(){const t=this.length;return new Sa([this.x/t,this.y/t,this.z/t])}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){const e=this.x,n=this.y,r=this.z,s=t.x,a=t.y,o=t.z;return new Sa([n*o-r*a,r*s-e*o,e*a-s*n])}}class Ca{x;y;vx=0;vy=0;ax=0;ay=0;mass=0;constructor(t,e,n){this.x=t,this.y=e,n?.vx!==void 0&&(this.vx=n?.vx),n?.vy!==void 0&&(this.vy=n?.vy),n?.ax!==void 0&&(this.ax=n?.ax),n?.ay!==void 0&&(this.ay=n?.ay),n?.mass!==void 0&&(this.mass=n?.mass)}distanceTo(t){const e=t.x-this.x,n=t.y-this.y;return Math.sqrt(e*e+n*n)}angleTo(t){const e=t.x-this.x,n=t.y-this.y;return Math.atan2(n,e)}trackVelocity(t,e){return{vx:e.x-t.x,vy:e.y-t.y}}nextFrame(t){const e=t?.gravity??0,n=t?.friction??0;if(this.vx+=this.ax,this.vy+=this.ay,this.vy+=e,n>0){const r=Math.atan2(this.vy,this.vx);let s=Math.sqrt(this.vx*this.vx+this.vy*this.vy);s>n?s-=n:s=0,this.vx=Math.cos(r)*s,this.vy=Math.sin(r)*s}this.x+=this.vx,this.y+=this.vy}nextFrameEaseTo=(t,e)=>{const n=e?.gravity??0,r=e?.friction??1,s=e?.easing??.05,a=t.x-this.x,o=t.y-this.y;this.vx=a*s,this.vy=o*s,this.vy+=n,this.vx*=r,this.vy*=r,this.x+=this.vx,this.y+=this.vy};nextFrameSpringTo(t,e){const n=e?.gravity??0,r=e?.friction??.95,s=e?.spring??.03;(Array.isArray(t)?t:[t]).forEach(o=>{const l=o.x-this.x,h=o.y-this.y,c=l*s,d=h*s;this.vx+=c,this.vy+=d}),this.vy+=n,this.vx*=r,this.vy*=r,this.x+=this.vx,this.y+=this.vy}nextFrameSpringConnect(t,e){const n=e?.gravity??0,r=e?.friction??.95,s=e?.spring??.03,a=e?.springLength??100,o=this.angleTo(t);this.nextFrameSpringTo(new Ca(t.x-Math.cos(o)*a,t.y-Math.sin(o)*a),{spring:s,friction:r,gravity:n})}}class te extends Ca{isMouseDown=!1;radius=0;constructor(t,e,n){super(t,e,n),n?.isMouseDown!==void 0&&(this.isMouseDown=n?.isMouseDown),n?.radius!==void 0&&(this.radius=n?.radius)}setX(t){this.x=t}setY(t){this.y=t}setXY(t,e){this.x=t,this.y=e}eq(t){return this.x===t.x&&this.y===t.y}midPointBtw(t){return new te(this.x+(t.x-this.x)/2,this.y+(t.y-this.y)/2)}fromRadian(t,e){return new te(Math.cos(t)*e,Math.sin(t)*e)}toArray(){return[this.x,this.y]}clone(t){this.setXY(t.x,t.y)}checkCollisionTo(t){const e=t.x-this.x,n=t.y-this.y;if(Math.sqrt(e*e+n*n)<this.radius+t.radius){const s=Math.atan2(n,e),a=Math.sin(s),o=Math.cos(s),l={x:0,y:0},h=Pi(e,n,a,o,!0),c=Pi(this.vx,this.vy,a,o,!0),d=Pi(t.vx,t.vy,a,o,!0),f=c.x-d.x;c.x=((this.mass-t.mass)*c.x+2*t.mass*d.x)/(this.mass+t.mass),d.x=f+c.x;const u=Math.abs(c.x)+Math.abs(d.x),p=this.radius+t.radius-Math.abs(l.x-h.x);l.x+=c.x/u*p,h.x+=d.x/u*p;const m=Pi(l.x,l.y,a,o,!1),y=Pi(h.x,h.y,a,o,!1);t.x=this.x+y.x,t.y=this.y+y.y,this.x=this.x+m.x,this.y=this.y+m.y;const S=Pi(c.x,c.y,a,o,!1),C=Pi(d.x,d.y,a,o,!1);this.vx=S.x,this.vy=S.y,t.vx=C.x,t.vy=C.y}}nextFrameWall(t){const e=t.left,n=t.top,r=t.right,s=t.bottom,a=t?.bounce??-1;this.x+this.radius>r?(this.x=r-this.radius,this.vx*=a):this.x-this.radius<e&&(this.x=e+this.radius,this.vx*=a),this.y+this.radius>s?(this.y=s-this.radius,this.vy*=a):this.y-this.radius<n&&(this.y=n+this.radius,this.vy*=a)}}let xl=class extends Ca{width;height;constructor(t,e,n,r=n,s){super(t,e,s),this.width=n,this.height=r}eq(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}isIntersectRect(t){return!(this.x+this.width<t.x||t.x+t.width<this.x||this.y+this.height<t.y||t.y+t.height<this.y)}isContainPoint(t){return!(t.x<this.x||t.x>this.x+this.width||t.y<this.y||t.y>this.y+this.height)}toArray(){return[this.x,this.y,this.width,this.height]}clone(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}};class G_{points=[];constructor(t){this.points=t}get length(){return this.points.length}getPoint(t){return this.points[t]}isContainPoint(t){const e=t.x,n=t.y,r=this.length;let s=!1;const a=2e-10;for(let o=0,l=r-1;o<r;l=o,o++){const h=this.points[o].x,c=this.points[o].y,d=this.points[l].x,f=this.points[l].y;if(h===e&&c===n||d===e&&f===n||n===c&&n===f)return!0;if(n>=c&&n<f||n<c&&n>=f){const u=(d-h)/(f-c),p=h+u*(n-c);if(p===e||Math.abs(p-e)<a)return!0;p>e&&(s=!s)}}return s}[Symbol.iterator](){let t=0;return{next:()=>({value:t>=this.length-1?this.points[++t]:void 0,done:t>=this.length})}}}const In={Linear:{None:function(i){return i}},Quadratic:{In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}},Cubic:{In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}},Quartic:{In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}},Quintic:{In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}},Sinusoidal:{In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}},Exponential:{In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}},Circular:{In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}},Elastic:{In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}},Back:{In:function(i){return i===1?1:i*i*((1.70158+1)*i-1.70158)},Out:function(i){return i===0?0:--i*i*((1.70158+1)*i+1.70158)+1},InOut:function(i){const t=2.5949095;return(i*=2)<1?.5*(i*i*((t+1)*i-t)):.5*((i-=2)*i*((t+1)*i+t)+2)}},Bounce:{In:function(i){return 1-In.Bounce.Out(1-i)},Out:function(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},InOut:function(i){return i<.5?In.Bounce.In(i*2)*.5:In.Bounce.Out(i*2-1)*.5+.5}},generatePow:function(i=4){return i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(t){return t**i},Out:function(t){return 1-(1-t)**i},InOut:function(t){return t<.5?(t*2)**i/2:(1-(2-t*2)**i)/2+.5}}},random:function(i){return Math.random()},createStep:function(i){return function(t){return Math.floor(t*i)/i}},createNoisyEasing:function(i,t=.1){const e=1-t;return function(n){return t*Math.random()+e*i(n)}}};let Or;typeof self>"u"&&typeof process<"u"&&process.hrtime?Or=function(){const i=process.hrtime();return i[0]*1e3+i[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?Or=self.performance.now.bind(self.performance):Date.now!==void 0?Or=Date.now:Or=function(){return new Date().getTime()};const On=Or;let If=class{_tweens={};_tweensAddedDuringUpdate={};getAll(){return Object.keys(this._tweens).map(t=>this._tweens[t])}removeAll(){this._tweens={}}add(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t}remove(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]}update(t=On(),e=!1){let n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(let r=0;r<n.length;r++){const s=this._tweens[n[r]],a=!e;s&&s.update(t,a)===!1&&!e&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0}};const nn={Linear:function(i,t){const e=i.length-1,n=e*t,r=Math.floor(n),s=nn.Utils.Linear;return t<0?s(i[0],i[1],n):t>1?s(i[e],i[e-1],e-n):s(i[r],i[r+1>e?e:r+1],n-r)},Bezier:function(i,t){let e=0;const n=i.length-1,r=Math.pow,s=nn.Utils.Bernstein;for(let a=0;a<=n;a++)e+=r(1-t,n-a)*r(t,a)*i[a]*s(n,a);return e},CatmullRom:function(i,t){const e=i.length-1;let n=e*t,r=Math.floor(n);const s=nn.Utils.CatmullRom;return i[0]===i[e]?(t<0&&(r=Math.floor(n=e*(1+t))),s(i[(r-1+e)%e],i[r],i[(r+1)%e],i[(r+2)%e],n-r)):t<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):t>1?i[e]-(s(i[e],i[e],i[e-1],i[e-1],n-e)-i[e]):s(i[r?r-1:0],i[r],i[e<r+1?e:r+1],i[e<r+2?e:r+2],n-r)},Utils:{Linear:function(i,t,e){return(t-i)*e+i},Factorial:function(){const i=[1];return function(t){let e=1;if(i[t])return i[t];for(let n=t;n>1;n--)e*=n;return i[t]=e,e}}(),Bernstein:function(i,t){const e=nn.Utils.Factorial;return e(i)/e(t)/e(i-t)},CatmullRom:function(i,t,e,n,r){const s=(e-i)*.5,a=(n-t)*.5,o=r*r,l=r*o;return(2*t-2*e+s+a)*l+(-3*t+3*e-2*s-a)*o+s*r+t}}};class Fr{static _nextId=0;static nextId(){return Fr._nextId++}}const Ne=new If;let $_=class{constructor(t,e=Ne){this._object=t,this._group=e}_id=Fr.nextId();_isPlaying=!1;_startTime=0;_delayTime=0;_durationTime=1e3;_isPaused=!1;_pauseStartTime=0;_initialRepeat=0;_repeat=0;_repeatDelayTime;_yoyo=!1;_reversed=!1;_valuesStart={};_valuesEnd={};_valuesStartRepeat={};_easingFunction=In.Linear.None;_interpolationFunction=nn.Linear;_chainedTweens=[];_isChainStopped=!1;_onStartCallback;_onStartCallbackFired=!1;_onEveryStartCallback;_onEveryStartCallbackFired=!1;_onUpdateCallback;_onRepeatCallback;_onCompleteCallback;_onStopCallback;_goToEnd=!1;getId(){return this._id}isPlaying(){return this._isPlaying}isPaused(){return this._isPaused}to(t,e){return this._valuesEnd=Object.create(t),e!==void 0&&(this._durationTime=e),this}duration(t=1e3){return this._durationTime=t,this}start(t=On()){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(const e in this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this}_setupProperties(t,e,n,r){for(const s in n){const a=t[s],o=Array.isArray(a),l=o?"array":typeof a,h=!o&&Array.isArray(n[s]);if(!(l==="undefined"||l==="function")){if(h){let c=n[s];if(c.length===0)continue;c=c.map(this._handleRelativeValue.bind(this,a)),n[s]=[a].concat(c)}if((l==="object"||o)&&a&&!h){e[s]=o?[]:{};for(const c in a)e[s][c]=a[c];r[s]=o?[]:{},this._setupProperties(a,e[s],n[s],r[s])}else typeof e[s]>"u"&&(e[s]=a),o||(e[s]*=1),h?r[s]=n[s].slice().reverse():r[s]=e[s]||0}}}stop(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this}end(){return this._goToEnd=!0,this.update(1/0),this}pause(t=On()){return this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStartTime=t,this._group&&this._group.remove(this),this)}resume(t=On()){return!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStartTime,this._pauseStartTime=0,this._group&&this._group.add(this),this)}stopChainedTweens(){for(let t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this}group(t=Ne){return this._group=t,this}delay(t=0){return this._delayTime=t,this}repeat(t=0){return this._initialRepeat=t,this._repeat=t,this}repeatDelay(t){return this._repeatDelayTime=t,this}yoyo(t=!1){return this._yoyo=t,this}easing(t=In.Linear.None){return this._easingFunction=t,this}interpolation(t=nn.Linear){return this._interpolationFunction=t,this}chain(...t){return this._chainedTweens=t,this}onStart(t){return this._onStartCallback=t,this}onEveryStart(t){return this._onEveryStartCallback=t,this}onUpdate(t){return this._onUpdateCallback=t,this}onRepeat(t){return this._onRepeatCallback=t,this}onComplete(t){return this._onCompleteCallback=t,this}onStop(t){return this._onStopCallback=t,this}update(t=On(),e=!0){if(this._isPaused)return!0;let n,r;const s=this._startTime+this._durationTime;if(!this._goToEnd&&!this._isPlaying){if(t>s)return!1;e&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0),r=(t-this._startTime)/this._durationTime,r=this._durationTime===0||r>1?1:r;const a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),r===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(n in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[n]=="string"&&(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(let o=0,l=this._chainedTweens.length;o<l;o++)this._chainedTweens[o].start(this._startTime+this._durationTime);return this._isPlaying=!1,!1}return!0}_updateProperties(t,e,n,r){for(const s in n){if(e[s]===void 0)continue;const a=e[s]||0;let o=n[s];const l=Array.isArray(t[s]),h=Array.isArray(o);!l&&h?t[s]=this._interpolationFunction(o,r):typeof o=="object"&&o?this._updateProperties(t[s],a,o,r):(o=this._handleRelativeValue(a,o),typeof o=="number"&&(t[s]=a+(o-a)*r))}}_handleRelativeValue(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)}_swapEndStartRepeatValues(t){const e=this._valuesStartRepeat[t],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=n,this._valuesEnd[t]=e}};const z_=Fr.nextId,H_=Ne.getAll.bind(Ne),j_=Ne.removeAll.bind(Ne),V_=Ne.add.bind(Ne),q_=Ne.remove.bind(Ne),X_=Ne.update.bind(Ne),Y_={Easing:In,Group:If,Interpolation:nn,now:On,Sequence:Fr,nextId:z_,Tween:$_,getAll:H_,removeAll:j_,add:V_,remove:q_,update:X_};function Of(i){const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",i),t}function W_(i,t){const e=Of(i),{x:n,y:r}=e.getPointAtLength(t);return[n,r]}function K_(i,t){return Of(i).getTotalLength(t)}let Ue=null;function Z_({d:i},t,e){Ue||(Ue=document.createElement("canvas").getContext("2d"));const n=new Path2D(i);return Ue.isPointInPath(n,t,e)}function Ff({d:i},t,e,{lineWidth:n=1,lineCap:r="butt",lineJoin:s="miter"}){if(Ue||(Ue=document.createElement("canvas").getContext("2d")),Ue.isPointInStroke){Ue.save(),Ue.lineWidth=n,Ue.lineCap=r,Ue.lineJoin=s;const a=new Path2D(i),o=Ue.isPointInStroke(a,t,e);return Ue.restore(),o}}var Sl={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},J_=/([astvzqmhlc])([^astvzqmhlc]*)/gi,Q_=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function ty(i){var t=i.match(Q_);return t?t.map(Number):[]}function ey(i){var t=[];return i.replace(J_,function(e,n,r){var s=n.toLowerCase();for(r=ty(r),s=="m"&&r.length>2&&(t.push([n].concat(r.splice(0,2))),s="l",n=n=="m"?"l":"L");;){if(r.length==Sl[s])return r.unshift(n),t.push(r);if(r.length<Sl[s])throw new Error("malformed path data");t.push([n].concat(r.splice(0,Sl[s])))}}),t}function iy(i){var t=0,e=0,n=0,r=0;return i.map(function(s){s=s.slice();var a=s[0],o=a.toUpperCase();if(a!=o)switch(s[0]=o,a){case"a":s[6]+=n,s[7]+=r;break;case"v":s[1]+=r;break;case"h":s[1]+=n;break;default:for(var l=1;l<s.length;)s[l++]+=n,s[l++]+=r}switch(o){case"Z":n=t,r=e;break;case"H":n=s[1];break;case"V":r=s[1];break;case"M":n=t=s[1],r=e=s[2];break;default:n=s[s.length-2],r=s[s.length-1]}return s})}const Nr=Math.PI*2;function Nf(i,t,e,n){const r=i*n-t*e<0?-1:1;let s=i*e+t*n;return s>1&&(s=1),s<-1&&(s=-1),r*Math.acos(s)}function ny(i,t,e,n,r,s,a,o,l,h){const c=h*(i-e)/2+l*(t-n)/2,d=-l*(i-e)/2+h*(t-n)/2,f=a*a,u=o*o,p=c*c,m=d*d;let y=f*u-f*m-u*p;y<0&&(y=0),y/=f*m+u*p,y=Math.sqrt(y)*(r===s?-1:1);const S=y*a/o*d,C=y*-o/a*c,_=h*S-l*C+(i+e)/2,w=l*S+h*C+(t+n)/2,k=(c-S)/a,A=(d-C)/o,R=(-c-S)/a,P=(-d-C)/o,U=Nf(1,0,k,A);let I=Nf(k,A,R,P);return s===0&&I>0&&(I-=Nr),s===1&&I<0&&(I+=Nr),[_,w,U,I]}function ry(i,t){const e=1.3333333333333333*Math.tan(t/4),n=Math.cos(i),r=Math.sin(i),s=Math.cos(i+t),a=Math.sin(i+t);return[n,r,n-r*e,r+n*e,s+a*e,a-s*e,s,a]}function sy(i,t,e,n,r,s,a,o,l){const h=Math.sin(l*Nr/360),c=Math.cos(l*Nr/360),d=c*(i-e)/2+h*(t-n)/2,f=-h*(i-e)/2+c*(t-n)/2;if(d===0&&f===0)return[];if(a===0||o===0)return[];a=Math.abs(a),o=Math.abs(o);const u=d*d/(a*a)+f*f/(o*o);u>1&&(a*=Math.sqrt(u),o*=Math.sqrt(u));const p=ny(i,t,e,n,r,s,a,o,h,c),m=[];let y=p[2],S=p[3];const C=Math.max(Math.ceil(Math.abs(S)/(Nr/4)),1);S/=C;for(let _=0;_<C;_++)m.push(ry(y,S)),y+=S;return m.map(_=>{for(let w=0;w<_.length;w+=2){let k=_[w+0],A=_[w+1];k*=a,A*=o;const R=c*k-h*A,P=h*k+c*A;_[w+0]=R+p[0],_[w+1]=P+p[1]}return _})}function ay(i){for(var t,e=[],n=0,r=0,s=0,a=0,o=null,l=null,h=0,c=0,d=0,f=i.length;d<f;d++){var u=i[d],p=u[0];switch(p){case"M":s=u[1],a=u[2];break;case"A":var m=sy(h,c,u[6],u[7],u[4],u[5],u[1],u[2],u[3]);if(!m.length)continue;m=m.map(w=>{const[k,A,R,P,U,I,N,q]=w;return{x1:R,y1:P,x2:U,y2:I,x:N,y:q}});for(var y=0,S;y<m.length;y++)S=m[y],u=["C",S.x1,S.y1,S.x2,S.y2,S.x,S.y],y<m.length-1&&e.push(u);break;case"S":var C=h,_=c;(t=="C"||t=="S")&&(C+=C-n,_+=_-r),u=["C",C,_,u[1],u[2],u[3],u[4]];break;case"T":t=="Q"||t=="T"?(o=h*2-o,l=c*2-l):(o=h,l=c),u=Uf(h,c,o,l,u[1],u[2]);break;case"Q":o=u[1],l=u[2],u=Uf(h,c,u[1],u[2],u[3],u[4]);break;case"L":u=ka(h,c,u[1],u[2]);break;case"H":u=ka(h,c,u[1],c);break;case"V":u=ka(h,c,h,u[1]);break;case"Z":u=ka(h,c,s,a);break}t=p,h=u[u.length-2],c=u[u.length-1],u.length>4?(n=u[u.length-4],r=u[u.length-3]):(n=h,r=c),e.push(u)}return e}function ka(i,t,e,n){return["C",i,t,e,n,e,n]}function Uf(i,t,e,n,r,s){return["C",i/3+.6666666666666666*e,t/3+.6666666666666666*n,r/3+.6666666666666666*e,s/3+.6666666666666666*n,r,s]}function oy(i){return typeof i!="string"?!1:(i=i.trim(),/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(i)&&/[\dz]$/i.test(i)&&i.length>4)}const Ta=Symbol("initialPath"),oi=Symbol("path"),Mi=Symbol("bounds"),Ea=Symbol("savedPaths"),li=Symbol("renderProps"),Cl=Symbol("beginPath");class Bf{constructor(t){if(!oy(t))throw new Error("Not an SVG path!");this[Ta]=iy(ey(t)),this[oi]=ay(this[Ta]),this[Mi]=null,this[Ea]=[],this[li]={},this[Cl]=!1}save(){return this[Ea].push({path:this[oi],bounds:this[Mi],renderProps:Object.assign({},this[li])}),this}restore(){if(this[Ea].length){const{path:t,bounds:e,renderProps:n}=this[Ea].pop();this[oi]=t,this[Mi]=e,this[li]=n}return this}get bounds(){if(!this[Mi]){const t=this[oi];if(this[Mi]=[0,0,0,0],t.length){const e=[1/0,1/0,-1/0,-1/0];for(let n=0,r=t.length;n<r;n++){const s=t[n].slice(1);for(let a=0;a<s.length;a+=2)s[a+0]<e[0]&&(e[0]=s[a+0]),s[a+1]<e[1]&&(e[1]=s[a+1]),s[a+0]>e[2]&&(e[2]=s[a+0]),s[a+1]>e[3]&&(e[3]=s[a+1])}this[Mi]=e}}return this[Mi]}get size(){const t=this.bounds;return[t[2]-t[0],t[3]-t[1]]}get center(){const[t,e,n,r]=this.bounds;return[(t+n)/2,(e+r)/2]}get d(){let t=this[oi].map(e=>{const[n,...r]=e;return n+r.join()}).join("");return this.isClosed&&(t+="Z"),t}get path(){return this[oi]}get isClosed(){const t=this[Ta][this[Ta].length-1];return t&&t[0]==="Z"}isPointInPath(t,e){return Z_(this,t,e)}isPointInStroke(t,e,{lineWidth:n=1,lineCap:r="butt",lineJoin:s="miter"}){if(Ff)return Ff(this,t,e,{lineWidth:n,lineCap:r,lineJoin:s})}getPointAtLength(t){return W_(this.d,t)}getTotalLength(){return K_(this.d)}transform(...t){this[Mi]=null;const e=new Dn(t),n=this[oi];return this[oi]=n.map(r=>{const[s,...a]=r,o=[s];for(let l=0;l<a.length;l+=2){const h=a[l],c=a[l+1],[d,f]=e.transformPoint(h,c);o.push(d,f)}return o}),this}translate(t,e){const n=new Dn().translate(t,e);return this.transform(...n.m)}rotate(t){const e=new Dn().rotate(t);return this.transform(...e.m)}scale(t,e){e==null&&(e=t);const n=new Dn().scale(t,e);return this.transform(...n.m)}skew(t,e){const n=new Dn().skew(t,e);return this.transform(...n.m)}trim(){const[t,e]=this.bounds;return this.translate(-t,-e),this}beginPath(){return this[Cl]=!0,this}toCanvas(t){const e=this[oi],n=this[li];return e.length&&(this[Cl]&&t.beginPath(),e.forEach(r=>{const[s,...a]=r;s==="M"?t.moveTo(...a):t.bezierCurveTo(...a)}),this.isClosed&&t.closePath()),Object.assign(t,n),{stroke(){return t.stroke(),this},fill(){return t.fill(),this}}}strokeStyle(t){return this[li].strokeStyle=t,this}fillStyle(t){return this[li].fillStyle=t,this}lineWidth(t){return this[li].lineWidth=t,this}lineCap(t){return this[li].lineCap=t,this}lineJoin(t){return this[li].lineJoin=t,this}}class Gf{paths=[];add(t){const e=new Bf(t);this.paths.push(e)}get size(){let t=0,e=0;return this.paths.forEach(n=>{const[r,s,a,o]=n.bounds,[l,h]=n.size;t=Math.max(t,r+l),e=Math.max(e,s+h)}),[t,e]}}function kl(i,t,e,n,r=1){let s="";for(let a=0;a<=r*e;a+=1){const o=Math.floor(a/r)/e*2*Math.PI,l=i+Math.cos(o)*n,h=t+Math.sin(o)*n;s+=(a===0?"M":"L")+l+","+h}return s}var $f={exports:{}};(function(i,t){(function(e,n){i.exports=n()})(window,function(){return function(e){var n={};function r(s){if(n[s])return n[s].exports;var a=n[s]={i:s,l:!1,exports:{}};return e[s].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=n,r.d=function(s,a,o){r.o(s,a)||Object.defineProperty(s,a,{enumerable:!0,get:o})},r.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},r.t=function(s,a){if(1&a&&(s=r(s)),8&a||4&a&&typeof s=="object"&&s&&s.__esModule)return s;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:s}),2&a&&typeof s!="string")for(var l in s)r.d(o,l,function(h){return s[h]}.bind(null,l));return o},r.n=function(s){var a=s&&s.__esModule?function(){return s.default}:function(){return s};return r.d(a,"a",a),a},r.o=function(s,a){return Object.prototype.hasOwnProperty.call(s,a)},r.p="",r(r.s=1)}([function(e,n,r){var s,a;s=[r(2)],(a=function(o){function l(g){if(l.is(g,"function"))return h?g():o.on("raphael.DOMload",g);if(l.is(g,_t))return l._engine.create[C](l,g.splice(0,3+l.is(g[0],dt))).add(g);var v=Array.prototype.slice.call(arguments,0);if(l.is(v[v.length-1],"function")){var b=v.pop();return h?b.call(l._engine.create[C](l,v)):o.on("raphael.DOMload",function(){b.call(l._engine.create[C](l,v))})}return l._engine.create[C](l,arguments)}l.version="2.3.0",l.eve=o;var h,c,d=/[, ]+/,f={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},u=/\{(\d+)\}/g,p="hasOwnProperty",m={doc:document,win:window},y={was:Object.prototype[p].call(m.win,"Raphael"),is:m.win.Raphael},S=function(){this.ca=this.customAttributes={}},C="apply",_="concat",w="ontouchstart"in window||window.TouchEvent||window.DocumentTouch&&document instanceof DocumentTouch,k="",A=" ",R=String,P="split",U="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[P](A),I={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},N=R.prototype.toLowerCase,q=Math,W=q.max,K=q.min,it=q.abs,pt=q.pow,vt=q.PI,dt="number",_t="array",yt=Object.prototype.toString,L=(l._ISURL=/^url\(['"]?(.+?)['"]?\)$/i,/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i),M={NaN:1,Infinity:1,"-Infinity":1},T=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,F=q.round,z=parseFloat,Y=parseInt,D=R.prototype.toUpperCase,V=l._availableAttrs={"arrow-end":"none","arrow-start":"none",blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",transform:"",width:0,x:0,y:0,class:""},X=l._availableAnimAttrs={blur:dt,"clip-rect":"csv",cx:dt,cy:dt,fill:"colour","fill-opacity":dt,"font-size":dt,height:dt,opacity:dt,path:"path",r:dt,rx:dt,ry:dt,stroke:"colour","stroke-opacity":dt,"stroke-width":dt,transform:"transform",width:dt,x:dt,y:dt},tt=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,at={hs:1,rg:1},gt=/,?([achlmqrstvxz]),?/gi,Ct=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,Et=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,bt=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/gi,Nt=(l._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,{}),Lt=function(g,v){return z(g)-z(v)},Dt=function(g){return g},Tt=l._rectPath=function(g,v,b,x,E){return E?[["M",g+E,v],["l",b-2*E,0],["a",E,E,0,0,1,E,E],["l",0,x-2*E],["a",E,E,0,0,1,-E,E],["l",2*E-b,0],["a",E,E,0,0,1,-E,-E],["l",0,2*E-x],["a",E,E,0,0,1,E,-E],["z"]]:[["M",g,v],["l",b,0],["l",0,x],["l",-b,0],["z"]]},le=function(g,v,b,x){return x==null&&(x=b),[["M",g,v],["m",0,-x],["a",b,x,0,1,1,0,2*x],["a",b,x,0,1,1,0,-2*x],["z"]]},re=l._getPath={path:function(g){return g.attr("path")},circle:function(g){var v=g.attrs;return le(v.cx,v.cy,v.r)},ellipse:function(g){var v=g.attrs;return le(v.cx,v.cy,v.rx,v.ry)},rect:function(g){var v=g.attrs;return Tt(v.x,v.y,v.width,v.height,v.r)},image:function(g){var v=g.attrs;return Tt(v.x,v.y,v.width,v.height)},text:function(g){var v=g._getBBox();return Tt(v.x,v.y,v.width,v.height)},set:function(g){var v=g._getBBox();return Tt(v.x,v.y,v.width,v.height)}},fe=l.mapPath=function(g,v){if(!v)return g;var b,x,E,O,G,B,$;for(E=0,G=(g=Gs(g)).length;E<G;E++)for(O=1,B=($=g[E]).length;O<B;O+=2)b=v.x($[O],$[O+1]),x=v.y($[O],$[O+1]),$[O]=b,$[O+1]=x;return g};if(l._g=m,l.type=m.win.SVGAngle||m.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML",l.type=="VML"){var qt,Le=m.doc.createElement("div");if(Le.innerHTML='<v:shape adj="1"/>',(qt=Le.firstChild).style.behavior="url(#default#VML)",!qt||typeof qt.adj!="object")return l.type=k;Le=null}function Se(g){if(typeof g=="function"||Object(g)!==g)return g;var v=new g.constructor;for(var b in g)g[p](b)&&(v[b]=Se(g[b]));return v}l.svg=!(l.vml=l.type=="VML"),l._Paper=S,l.fn=c=S.prototype=l.prototype,l._id=0,l.is=function(g,v){return(v=N.call(v))=="finite"?!M[p](+g):v=="array"?g instanceof Array:v=="null"&&g===null||v==typeof g&&g!==null||v=="object"&&g===Object(g)||v=="array"&&Array.isArray&&Array.isArray(g)||yt.call(g).slice(8,-1).toLowerCase()==v},l.angle=function(g,v,b,x,E,O){if(E==null){var G=g-b,B=v-x;return G||B?(180+180*q.atan2(-B,-G)/vt+360)%360:0}return l.angle(g,v,E,O)-l.angle(b,x,E,O)},l.rad=function(g){return g%360*vt/180},l.deg=function(g){return Math.round(180*g/vt%360*1e3)/1e3},l.snapTo=function(g,v,b){if(b=l.is(b,"finite")?b:10,l.is(g,_t)){for(var x=g.length;x--;)if(it(g[x]-v)<=b)return g[x]}else{var E=v%(g=+g);if(E<b)return v-E;if(E>g-b)return v-E+g}return v};var Gi,Fs;l.createUUID=(Gi=/[xy]/g,Fs=function(g){var v=16*q.random()|0;return(g=="x"?v:3&v|8).toString(16)},function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(Gi,Fs).toUpperCase()}),l.setWindow=function(g){o("raphael.setWindow",l,m.win,g),m.win=g,m.doc=m.win.document,l._engine.initWin&&l._engine.initWin(m.win)};var $i=function(g){if(l.vml){var v,b=/^\s+|\s+$/g;try{var x=new ActiveXObject("htmlfile");x.write("<body>"),x.close(),v=x.body}catch{v=createPopup().document.body}var E=v.createTextRange();$i=ye(function(G){try{v.style.color=R(G).replace(b,k);var B=E.queryCommandValue("ForeColor");return"#"+("000000"+(B=(255&B)<<16|65280&B|(16711680&B)>>>16).toString(16)).slice(-6)}catch{return"none"}})}else{var O=m.doc.createElement("i");O.title="Raphaël Colour Picker",O.style.display="none",m.doc.body.appendChild(O),$i=ye(function(G){return O.style.color=G,m.doc.defaultView.getComputedStyle(O,k).getPropertyValue("color")})}return $i(g)},Yn=function(){return"hsb("+[this.h,this.s,this.b]+")"},Wn=function(){return"hsl("+[this.h,this.s,this.l]+")"},Ns=function(){return this.hex},Kn=function(g,v,b){if(v==null&&l.is(g,"object")&&"r"in g&&"g"in g&&"b"in g&&(b=g.b,v=g.g,g=g.r),v==null&&l.is(g,"string")){var x=l.getRGB(g);g=x.r,v=x.g,b=x.b}return(g>1||v>1||b>1)&&(g/=255,v/=255,b/=255),[g,v,b]},io=function(g,v,b,x){var E={r:g*=255,g:v*=255,b:b*=255,hex:l.rgb(g,v,b),toString:Ns};return l.is(x,"finite")&&(E.opacity=x),E};function ye(g,v,b){return function x(){var E=Array.prototype.slice.call(arguments,0),O=E.join("␀"),G=x.cache=x.cache||{},B=x.count=x.count||[];return G[p](O)?(function($,j){for(var J=0,ot=$.length;J<ot;J++)if($[J]===j)return $.push($.splice(J,1)[0])}(B,O),b?b(G[O]):G[O]):(B.length>=1e3&&delete G[B.shift()],B.push(O),G[O]=g[C](v,E),b?b(G[O]):G[O])}}l.color=function(g){var v;return l.is(g,"object")&&"h"in g&&"s"in g&&"b"in g?(v=l.hsb2rgb(g),g.r=v.r,g.g=v.g,g.b=v.b,g.hex=v.hex):l.is(g,"object")&&"h"in g&&"s"in g&&"l"in g?(v=l.hsl2rgb(g),g.r=v.r,g.g=v.g,g.b=v.b,g.hex=v.hex):(l.is(g,"string")&&(g=l.getRGB(g)),l.is(g,"object")&&"r"in g&&"g"in g&&"b"in g?(v=l.rgb2hsl(g),g.h=v.h,g.s=v.s,g.l=v.l,v=l.rgb2hsb(g),g.v=v.b):(g={hex:"none"}).r=g.g=g.b=g.h=g.s=g.v=g.l=-1),g.toString=Ns,g},l.hsb2rgb=function(g,v,b,x){var E,O,G,B,$;return this.is(g,"object")&&"h"in g&&"s"in g&&"b"in g&&(b=g.b,v=g.s,x=g.o,g=g.h),B=($=b*v)*(1-it((g=(g*=360)%360/60)%2-1)),E=O=G=b-$,io(E+=[$,B,0,0,B,$][g=~~g],O+=[B,$,$,B,0,0][g],G+=[0,0,B,$,$,B][g],x)},l.hsl2rgb=function(g,v,b,x){var E,O,G,B,$;return this.is(g,"object")&&"h"in g&&"s"in g&&"l"in g&&(b=g.l,v=g.s,g=g.h),(g>1||v>1||b>1)&&(g/=360,v/=100,b/=100),B=($=2*v*(b<.5?b:1-b))*(1-it((g=(g*=360)%360/60)%2-1)),E=O=G=b-$/2,io(E+=[$,B,0,0,B,$][g=~~g],O+=[B,$,$,B,0,0][g],G+=[0,0,B,$,$,B][g],x)},l.rgb2hsb=function(g,v,b){var x,E;return g=(b=Kn(g,v,b))[0],v=b[1],b=b[2],{h:(((E=(x=W(g,v,b))-K(g,v,b))==0?null:x==g?(v-b)/E:x==v?(b-g)/E+2:(g-v)/E+4)+360)%6*60/360,s:E==0?0:E/x,b:x,toString:Yn}},l.rgb2hsl=function(g,v,b){var x,E,O,G;return g=(b=Kn(g,v,b))[0],v=b[1],b=b[2],x=((E=W(g,v,b))+(O=K(g,v,b)))/2,{h:(((G=E-O)==0?null:E==g?(v-b)/G:E==v?(b-g)/G+2:(g-v)/G+4)+360)%6*60/360,s:G==0?0:x<.5?G/(2*x):G/(2-2*x),l:x,toString:Wn}},l._path2string=function(){return this.join(",").replace(gt,"$1")},l._preload=function(g,v){var b=m.doc.createElement("img");b.style.cssText="position:absolute;left:-9999em;top:-9999em",b.onload=function(){v.call(this),this.onload=null,m.doc.body.removeChild(this)},b.onerror=function(){m.doc.body.removeChild(this)},m.doc.body.appendChild(b),b.src=g};function zi(){return this.hex}function Zn(g,v){for(var b=[],x=0,E=g.length;E-2*!v>x;x+=2){var O=[{x:+g[x-2],y:+g[x-1]},{x:+g[x],y:+g[x+1]},{x:+g[x+2],y:+g[x+3]},{x:+g[x+4],y:+g[x+5]}];v?x?E-4==x?O[3]={x:+g[0],y:+g[1]}:E-2==x&&(O[2]={x:+g[0],y:+g[1]},O[3]={x:+g[2],y:+g[3]}):O[0]={x:+g[E-2],y:+g[E-1]}:E-4==x?O[3]=O[2]:x||(O[0]={x:+g[x],y:+g[x+1]}),b.push(["C",(-O[0].x+6*O[1].x+O[2].x)/6,(-O[0].y+6*O[1].y+O[2].y)/6,(O[1].x+6*O[2].x-O[3].x)/6,(O[1].y+6*O[2].y-O[3].y)/6,O[2].x,O[2].y])}return b}l.getRGB=ye(function(g){if(!g||(g=R(g)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:zi};if(g=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:zi};!at[p](g.toLowerCase().substring(0,2))&&g.charAt()!="#"&&(g=$i(g));var v,b,x,E,O,G,B=g.match(L);return B?(B[2]&&(x=Y(B[2].substring(5),16),b=Y(B[2].substring(3,5),16),v=Y(B[2].substring(1,3),16)),B[3]&&(x=Y((O=B[3].charAt(3))+O,16),b=Y((O=B[3].charAt(2))+O,16),v=Y((O=B[3].charAt(1))+O,16)),B[4]&&(G=B[4][P](tt),v=z(G[0]),G[0].slice(-1)=="%"&&(v*=2.55),b=z(G[1]),G[1].slice(-1)=="%"&&(b*=2.55),x=z(G[2]),G[2].slice(-1)=="%"&&(x*=2.55),B[1].toLowerCase().slice(0,4)=="rgba"&&(E=z(G[3])),G[3]&&G[3].slice(-1)=="%"&&(E/=100)),B[5]?(G=B[5][P](tt),v=z(G[0]),G[0].slice(-1)=="%"&&(v*=2.55),b=z(G[1]),G[1].slice(-1)=="%"&&(b*=2.55),x=z(G[2]),G[2].slice(-1)=="%"&&(x*=2.55),(G[0].slice(-3)=="deg"||G[0].slice(-1)=="°")&&(v/=360),B[1].toLowerCase().slice(0,4)=="hsba"&&(E=z(G[3])),G[3]&&G[3].slice(-1)=="%"&&(E/=100),l.hsb2rgb(v,b,x,E)):B[6]?(G=B[6][P](tt),v=z(G[0]),G[0].slice(-1)=="%"&&(v*=2.55),b=z(G[1]),G[1].slice(-1)=="%"&&(b*=2.55),x=z(G[2]),G[2].slice(-1)=="%"&&(x*=2.55),(G[0].slice(-3)=="deg"||G[0].slice(-1)=="°")&&(v/=360),B[1].toLowerCase().slice(0,4)=="hsla"&&(E=z(G[3])),G[3]&&G[3].slice(-1)=="%"&&(E/=100),l.hsl2rgb(v,b,x,E)):((B={r:v,g:b,b:x,toString:zi}).hex="#"+(16777216|x|b<<8|v<<16).toString(16).slice(1),l.is(E,"finite")&&(B.opacity=E),B)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:zi}},l),l.hsb=ye(function(g,v,b){return l.hsb2rgb(g,v,b).hex}),l.hsl=ye(function(g,v,b){return l.hsl2rgb(g,v,b).hex}),l.rgb=ye(function(g,v,b){function x(E){return E+.5|0}return"#"+(16777216|x(b)|x(v)<<8|x(g)<<16).toString(16).slice(1)}),l.getColor=function(g){var v=this.getColor.start=this.getColor.start||{h:0,s:1,b:g||.75},b=this.hsb2rgb(v.h,v.s,v.b);return v.h+=.075,v.h>1&&(v.h=0,v.s-=.2,v.s<=0&&(this.getColor.start={h:0,s:1,b:v.b})),b.hex},l.getColor.reset=function(){delete this.start},l.parsePathString=function(g){if(!g)return null;var v=Ge(g);if(v.arr)return ke(v.arr);var b={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},x=[];return l.is(g,_t)&&l.is(g[0],_t)&&(x=ke(g)),x.length||R(g).replace(Ct,function(E,O,G){var B=[],$=O.toLowerCase();if(G.replace(bt,function(j,J){J&&B.push(+J)}),$=="m"&&B.length>2&&(x.push([O][_](B.splice(0,2))),$="l",O=O=="m"?"l":"L"),$=="r")x.push([O][_](B));else for(;B.length>=b[$]&&(x.push([O][_](B.splice(0,b[$]))),b[$]););}),x.toString=l._path2string,v.arr=ke(x),x},l.parseTransformString=ye(function(g){if(!g)return null;var v=[];return l.is(g,_t)&&l.is(g[0],_t)&&(v=ke(g)),v.length||R(g).replace(Et,function(b,x,E){var O=[];N.call(x),E.replace(bt,function(G,B){B&&O.push(+B)}),v.push([x][_](O))}),v.toString=l._path2string,v},this,function(g){if(!g)return g;for(var v=[],b=0;b<g.length;b++){for(var x=[],E=0;E<g[b].length;E++)x.push(g[b][E]);v.push(x)}return v});var Ge=function(g){var v=Ge.ps=Ge.ps||{};return v[g]?v[g].sleep=100:v[g]={sleep:100},setTimeout(function(){for(var b in v)v[p](b)&&b!=g&&(v[b].sleep--,!v[b].sleep&&delete v[b])}),v[g]};function Jn(g,v,b,x,E){return g*(g*(-3*v+9*b-9*x+3*E)+6*v-12*b+6*x)-3*v+3*b}function He(g,v,b,x,E,O,G,B,$){$==null&&($=1);for(var j=($=$>1?1:$<0?0:$)/2,J=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],ot=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],et=0,Z=0;Z<12;Z++){var nt=j*J[Z]+j,lt=Jn(nt,g,b,E,G),rt=Jn(nt,v,x,O,B),Q=lt*lt+rt*rt;et+=ot[Z]*q.sqrt(Q)}return j*et}function Us(g,v,b,x,E,O,G,B){if(!(W(g,b)<K(E,G)||K(g,b)>W(E,G)||W(v,x)<K(O,B)||K(v,x)>W(O,B))){var $=(g-b)*(O-B)-(v-x)*(E-G);if($){var j=((g*x-v*b)*(E-G)-(g-b)*(E*B-O*G))/$,J=((g*x-v*b)*(O-B)-(v-x)*(E*B-O*G))/$,ot=+j.toFixed(2),et=+J.toFixed(2);if(!(ot<+K(g,b).toFixed(2)||ot>+W(g,b).toFixed(2)||ot<+K(E,G).toFixed(2)||ot>+W(E,G).toFixed(2)||et<+K(v,x).toFixed(2)||et>+W(v,x).toFixed(2)||et<+K(O,B).toFixed(2)||et>+W(O,B).toFixed(2)))return{x:j,y:J}}}}function Qn(g,v,b){var x=l.bezierBBox(g),E=l.bezierBBox(v);if(!l.isBBoxIntersect(x,E))return b?0:[];for(var O=He.apply(0,g),G=He.apply(0,v),B=W(~~(O/5),1),$=W(~~(G/5),1),j=[],J=[],ot={},et=b?0:[],Z=0;Z<B+1;Z++){var nt=l.findDotsAtSegment.apply(l,g.concat(Z/B));j.push({x:nt.x,y:nt.y,t:Z/B})}for(Z=0;Z<$+1;Z++)nt=l.findDotsAtSegment.apply(l,v.concat(Z/$)),J.push({x:nt.x,y:nt.y,t:Z/$});for(Z=0;Z<B;Z++)for(var lt=0;lt<$;lt++){var rt=j[Z],Q=j[Z+1],mt=J[lt],ht=J[lt+1],ft=it(Q.x-rt.x)<.001?"y":"x",ct=it(ht.x-mt.x)<.001?"y":"x",At=Us(rt.x,rt.y,Q.x,Q.y,mt.x,mt.y,ht.x,ht.y);if(At){if(ot[At.x.toFixed(4)]==At.y.toFixed(4))continue;ot[At.x.toFixed(4)]=At.y.toFixed(4);var kt=rt.t+it((At[ft]-rt[ft])/(Q[ft]-rt[ft]))*(Q.t-rt.t),Pt=mt.t+it((At[ct]-mt[ct])/(ht[ct]-mt[ct]))*(ht.t-mt.t);kt>=0&&kt<=1.001&&Pt>=0&&Pt<=1.001&&(b?et++:et.push({x:At.x,y:At.y,t1:K(kt,1),t2:K(Pt,1)}))}}return et}function Bs(g,v,b){g=l._path2curve(g),v=l._path2curve(v);for(var x,E,O,G,B,$,j,J,ot,et,Z=b?0:[],nt=0,lt=g.length;nt<lt;nt++){var rt=g[nt];if(rt[0]=="M")x=B=rt[1],E=$=rt[2];else{rt[0]=="C"?(ot=[x,E].concat(rt.slice(1)),x=ot[6],E=ot[7]):(ot=[x,E,x,E,B,$,B,$],x=B,E=$);for(var Q=0,mt=v.length;Q<mt;Q++){var ht=v[Q];if(ht[0]=="M")O=j=ht[1],G=J=ht[2];else{ht[0]=="C"?(et=[O,G].concat(ht.slice(1)),O=et[6],G=et[7]):(et=[O,G,O,G,j,J,j,J],O=j,G=J);var ft=Qn(ot,et,b);if(b)Z+=ft;else{for(var ct=0,At=ft.length;ct<At;ct++)ft[ct].segment1=nt,ft[ct].segment2=Q,ft[ct].bez1=ot,ft[ct].bez2=et;Z=Z.concat(ft)}}}}}return Z}l.findDotsAtSegment=function(g,v,b,x,E,O,G,B,$){var j=1-$,J=pt(j,3),ot=pt(j,2),et=$*$,Z=et*$,nt=J*g+3*ot*$*b+3*j*$*$*E+Z*G,lt=J*v+3*ot*$*x+3*j*$*$*O+Z*B,rt=g+2*$*(b-g)+et*(E-2*b+g),Q=v+2*$*(x-v)+et*(O-2*x+v),mt=b+2*$*(E-b)+et*(G-2*E+b),ht=x+2*$*(O-x)+et*(B-2*O+x),ft=j*g+$*b,ct=j*v+$*x,At=j*E+$*G,kt=j*O+$*B,Pt=90-180*q.atan2(rt-mt,Q-ht)/vt;return(rt>mt||Q<ht)&&(Pt+=180),{x:nt,y:lt,m:{x:rt,y:Q},n:{x:mt,y:ht},start:{x:ft,y:ct},end:{x:At,y:kt},alpha:Pt}},l.bezierBBox=function(g,v,b,x,E,O,G,B){l.is(g,"array")||(g=[g,v,b,x,E,O,G,B]);var $=ro.apply(null,g);return{x:$.min.x,y:$.min.y,x2:$.max.x,y2:$.max.y,width:$.max.x-$.min.x,height:$.max.y-$.min.y}},l.isPointInsideBBox=function(g,v,b){return v>=g.x&&v<=g.x2&&b>=g.y&&b<=g.y2},l.isBBoxIntersect=function(g,v){var b=l.isPointInsideBBox;return b(v,g.x,g.y)||b(v,g.x2,g.y)||b(v,g.x,g.y2)||b(v,g.x2,g.y2)||b(g,v.x,v.y)||b(g,v.x2,v.y)||b(g,v.x,v.y2)||b(g,v.x2,v.y2)||(g.x<v.x2&&g.x>v.x||v.x<g.x2&&v.x>g.x)&&(g.y<v.y2&&g.y>v.y||v.y<g.y2&&v.y>g.y)},l.pathIntersection=function(g,v){return Bs(g,v)},l.pathIntersectionNumber=function(g,v){return Bs(g,v,1)},l.isPointInsidePath=function(g,v,b){var x=l.pathBBox(g);return l.isPointInsideBBox(x,v,b)&&Bs(g,[["M",v,b],["H",x.x2+10]],1)%2==1},l._removedFactory=function(g){return function(){o("raphael.log",null,"Raphaël: you are calling to method “"+g+"” of removed object",g)}};var Hi=l.pathBBox=function(g){var v=Ge(g);if(v.bbox)return Se(v.bbox);if(!g)return{x:0,y:0,width:0,height:0,x2:0,y2:0};for(var b,x=0,E=0,O=[],G=[],B=0,$=(g=Gs(g)).length;B<$;B++)if((b=g[B])[0]=="M")x=b[1],E=b[2],O.push(x),G.push(E);else{var j=ro(x,E,b[1],b[2],b[3],b[4],b[5],b[6]);O=O[_](j.min.x,j.max.x),G=G[_](j.min.y,j.max.y),x=b[5],E=b[6]}var J=K[C](0,O),ot=K[C](0,G),et=W[C](0,O),Z=W[C](0,G),nt=et-J,lt=Z-ot,rt={x:J,y:ot,x2:et,y2:Z,width:nt,height:lt,cx:J+nt/2,cy:ot+lt/2};return v.bbox=Se(rt),rt},ke=function(g){var v=Se(g);return v.toString=l._path2string,v},F1=l._pathToRelative=function(g){var v=Ge(g);if(v.rel)return ke(v.rel);l.is(g,_t)&&l.is(g&&g[0],_t)||(g=l.parsePathString(g));var b=[],x=0,E=0,O=0,G=0,B=0;g[0][0]=="M"&&(O=x=g[0][1],G=E=g[0][2],B++,b.push(["M",x,E]));for(var $=B,j=g.length;$<j;$++){var J=b[$]=[],ot=g[$];if(ot[0]!=N.call(ot[0]))switch(J[0]=N.call(ot[0]),J[0]){case"a":J[1]=ot[1],J[2]=ot[2],J[3]=ot[3],J[4]=ot[4],J[5]=ot[5],J[6]=+(ot[6]-x).toFixed(3),J[7]=+(ot[7]-E).toFixed(3);break;case"v":J[1]=+(ot[1]-E).toFixed(3);break;case"m":O=ot[1],G=ot[2];default:for(var et=1,Z=ot.length;et<Z;et++)J[et]=+(ot[et]-(et%2?x:E)).toFixed(3)}else{J=b[$]=[],ot[0]=="m"&&(O=ot[1]+x,G=ot[2]+E);for(var nt=0,lt=ot.length;nt<lt;nt++)b[$][nt]=ot[nt]}var rt=b[$].length;switch(b[$][0]){case"z":x=O,E=G;break;case"h":x+=+b[$][rt-1];break;case"v":E+=+b[$][rt-1];break;default:x+=+b[$][rt-2],E+=+b[$][rt-1]}}return b.toString=l._path2string,v.rel=ke(b),b},tr=l._pathToAbsolute=function(g){var v=Ge(g);if(v.abs)return ke(v.abs);if(l.is(g,_t)&&l.is(g&&g[0],_t)||(g=l.parsePathString(g)),!g||!g.length)return[["M",0,0]];var b=[],x=0,E=0,O=0,G=0,B=0;g[0][0]=="M"&&(O=x=+g[0][1],G=E=+g[0][2],B++,b[0]=["M",x,E]);for(var $,j,J=g.length==3&&g[0][0]=="M"&&g[1][0].toUpperCase()=="R"&&g[2][0].toUpperCase()=="Z",ot=B,et=g.length;ot<et;ot++){if(b.push($=[]),(j=g[ot])[0]!=D.call(j[0]))switch($[0]=D.call(j[0]),$[0]){case"A":$[1]=j[1],$[2]=j[2],$[3]=j[3],$[4]=j[4],$[5]=j[5],$[6]=+(j[6]+x),$[7]=+(j[7]+E);break;case"V":$[1]=+j[1]+E;break;case"H":$[1]=+j[1]+x;break;case"R":for(var Z=[x,E][_](j.slice(1)),nt=2,lt=Z.length;nt<lt;nt++)Z[nt]=+Z[nt]+x,Z[++nt]=+Z[nt]+E;b.pop(),b=b[_](Zn(Z,J));break;case"M":O=+j[1]+x,G=+j[2]+E;default:for(nt=1,lt=j.length;nt<lt;nt++)$[nt]=+j[nt]+(nt%2?x:E)}else if(j[0]=="R")Z=[x,E][_](j.slice(1)),b.pop(),b=b[_](Zn(Z,J)),$=["R"][_](j.slice(-2));else for(var rt=0,Q=j.length;rt<Q;rt++)$[rt]=j[rt];switch($[0]){case"Z":x=O,E=G;break;case"H":x=$[1];break;case"V":E=$[1];break;case"M":O=$[$.length-2],G=$[$.length-1];default:x=$[$.length-2],E=$[$.length-1]}}return b.toString=l._path2string,v.abs=ke(b),b},er=function(g,v,b,x){return[g,v,b,x,b,x]},ji=function(g,v,b,x,E,O){return[1/3*g+2/3*b,1/3*v+2/3*x,1/3*E+2/3*b,1/3*O+2/3*x,E,O]},no=function(g,v,b,x,E,O,G,B,$,j){var J,ot=120*vt/180,et=vt/180*(+E||0),Z=[],nt=ye(function(tg,eg,lo){return{x:tg*q.cos(lo)-eg*q.sin(lo),y:tg*q.sin(lo)+eg*q.cos(lo)}});if(j)kt=j[0],Pt=j[1],ct=j[2],At=j[3];else{g=(J=nt(g,v,-et)).x,v=J.y,B=(J=nt(B,$,-et)).x,$=J.y;var lt=(g-B)/2,rt=(v-$)/2,Q=lt*lt/(b*b)+rt*rt/(x*x);Q>1&&(b*=Q=q.sqrt(Q),x*=Q);var mt=b*b,ht=x*x,ft=(O==G?-1:1)*q.sqrt(it((mt*ht-mt*rt*rt-ht*lt*lt)/(mt*rt*rt+ht*lt*lt))),ct=ft*b*rt/x+(g+B)/2,At=ft*-x*lt/b+(v+$)/2,kt=q.asin(((v-At)/x).toFixed(9)),Pt=q.asin((($-At)/x).toFixed(9));(kt=g<ct?vt-kt:kt)<0&&(kt=2*vt+kt),(Pt=B<ct?vt-Pt:Pt)<0&&(Pt=2*vt+Pt),G&&kt>Pt&&(kt-=2*vt),!G&&Pt>kt&&(Pt-=2*vt)}var nr=Pt-kt;if(it(nr)>ot){var Hs=Pt,Te=B,Qe=$;Pt=kt+ot*(G&&Pt>kt?1:-1),B=ct+b*q.cos(Pt),$=At+x*q.sin(Pt),Z=no(B,$,b,x,E,0,G,Te,Qe,[Pt,Hs,ct,At])}nr=Pt-kt;var rr=q.cos(kt),sr=q.sin(kt),ao=q.cos(Pt),yi=q.sin(Pt),_n=q.tan(nr/4),oo=4/3*b*_n,W1=4/3*x*_n,K1=[g,v],ar=[g+oo*sr,v-W1*rr],Z1=[B+oo*yi,$-W1*ao],J1=[B,$];if(ar[0]=2*K1[0]-ar[0],ar[1]=2*K1[1]-ar[1],j)return[ar,Z1,J1][_](Z);for(var Q1=[],qi=0,bw=(Z=[ar,Z1,J1][_](Z).join()[P](",")).length;qi<bw;qi++)Q1[qi]=qi%2?nt(Z[qi-1],Z[qi],et).y:nt(Z[qi],Z[qi+1],et).x;return Q1},pn=function(g,v,b,x,E,O,G,B,$){var j=1-$;return{x:pt(j,3)*g+3*pt(j,2)*$*b+3*j*$*$*E+pt($,3)*G,y:pt(j,3)*v+3*pt(j,2)*$*x+3*j*$*$*O+pt($,3)*B}},ro=ye(function(g,v,b,x,E,O,G,B){var $,j=E-2*b+g-(G-2*E+b),J=2*(b-g)-2*(E-b),ot=g-b,et=(-J+q.sqrt(J*J-4*j*ot))/2/j,Z=(-J-q.sqrt(J*J-4*j*ot))/2/j,nt=[v,B],lt=[g,G];return it(et)>"1e12"&&(et=.5),it(Z)>"1e12"&&(Z=.5),et>0&&et<1&&($=pn(g,v,b,x,E,O,G,B,et),lt.push($.x),nt.push($.y)),Z>0&&Z<1&&($=pn(g,v,b,x,E,O,G,B,Z),lt.push($.x),nt.push($.y)),j=O-2*x+v-(B-2*O+x),ot=v-x,et=(-(J=2*(x-v)-2*(O-x))+q.sqrt(J*J-4*j*ot))/2/j,Z=(-J-q.sqrt(J*J-4*j*ot))/2/j,it(et)>"1e12"&&(et=.5),it(Z)>"1e12"&&(Z=.5),et>0&&et<1&&($=pn(g,v,b,x,E,O,G,B,et),lt.push($.x),nt.push($.y)),Z>0&&Z<1&&($=pn(g,v,b,x,E,O,G,B,Z),lt.push($.x),nt.push($.y)),{min:{x:K[C](0,lt),y:K[C](0,nt)},max:{x:W[C](0,lt),y:W[C](0,nt)}}}),Gs=l._path2curve=ye(function(g,v){var b=!v&&Ge(g);if(!v&&b.curve)return ke(b.curve);for(var x=tr(g),E=v&&tr(v),O={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},G={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},B=function(ft,ct,At){var kt,Pt;if(!ft)return["C",ct.x,ct.y,ct.x,ct.y,ct.x,ct.y];switch(!(ft[0]in{T:1,Q:1})&&(ct.qx=ct.qy=null),ft[0]){case"M":ct.X=ft[1],ct.Y=ft[2];break;case"A":ft=["C"][_](no[C](0,[ct.x,ct.y][_](ft.slice(1))));break;case"S":At=="C"||At=="S"?(kt=2*ct.x-ct.bx,Pt=2*ct.y-ct.by):(kt=ct.x,Pt=ct.y),ft=["C",kt,Pt][_](ft.slice(1));break;case"T":At=="Q"||At=="T"?(ct.qx=2*ct.x-ct.qx,ct.qy=2*ct.y-ct.qy):(ct.qx=ct.x,ct.qy=ct.y),ft=["C"][_](ji(ct.x,ct.y,ct.qx,ct.qy,ft[1],ft[2]));break;case"Q":ct.qx=ft[1],ct.qy=ft[2],ft=["C"][_](ji(ct.x,ct.y,ft[1],ft[2],ft[3],ft[4]));break;case"L":ft=["C"][_](er(ct.x,ct.y,ft[1],ft[2]));break;case"H":ft=["C"][_](er(ct.x,ct.y,ft[1],ct.y));break;case"V":ft=["C"][_](er(ct.x,ct.y,ct.x,ft[1]));break;case"Z":ft=["C"][_](er(ct.x,ct.y,ct.X,ct.Y))}return ft},$=function(ft,ct){if(ft[ct].length>7){ft[ct].shift();for(var At=ft[ct];At.length;)J[ct]="A",E&&(ot[ct]="A"),ft.splice(ct++,0,["C"][_](At.splice(0,6)));ft.splice(ct,1),lt=W(x.length,E&&E.length||0)}},j=function(ft,ct,At,kt,Pt){ft&&ct&&ft[Pt][0]=="M"&&ct[Pt][0]!="M"&&(ct.splice(Pt,0,["M",kt.x,kt.y]),At.bx=0,At.by=0,At.x=ft[Pt][1],At.y=ft[Pt][2],lt=W(x.length,E&&E.length||0))},J=[],ot=[],et="",Z="",nt=0,lt=W(x.length,E&&E.length||0);nt<lt;nt++){x[nt]&&(et=x[nt][0]),et!="C"&&(J[nt]=et,nt&&(Z=J[nt-1])),x[nt]=B(x[nt],O,Z),J[nt]!="A"&&et=="C"&&(J[nt]="C"),$(x,nt),E&&(E[nt]&&(et=E[nt][0]),et!="C"&&(ot[nt]=et,nt&&(Z=ot[nt-1])),E[nt]=B(E[nt],G,Z),ot[nt]!="A"&&et=="C"&&(ot[nt]="C"),$(E,nt)),j(x,E,O,G,nt),j(E,x,G,O,nt);var rt=x[nt],Q=E&&E[nt],mt=rt.length,ht=E&&Q.length;O.x=rt[mt-2],O.y=rt[mt-1],O.bx=z(rt[mt-4])||O.x,O.by=z(rt[mt-3])||O.y,G.bx=E&&(z(Q[ht-4])||G.x),G.by=E&&(z(Q[ht-3])||G.y),G.x=E&&Q[ht-2],G.y=E&&Q[ht-1]}return E||(b.curve=ke(x)),E?[x,E]:x},null,ke),so=(l._parseDots=ye(function(g){for(var v=[],b=0,x=g.length;b<x;b++){var E={},O=g[b].match(/^([^:]*):?([\d\.]*)/);if(E.color=l.getRGB(O[1]),E.color.error)return null;E.opacity=E.color.opacity,E.color=E.color.hex,O[2]&&(E.offset=O[2]+"%"),v.push(E)}for(b=1,x=v.length-1;b<x;b++)if(!v[b].offset){for(var G=z(v[b-1].offset||0),B=0,$=b+1;$<x;$++)if(v[$].offset){B=v[$].offset;break}B||(B=100,$=x);for(var j=((B=z(B))-G)/($-b+1);b<$;b++)G+=j,v[b].offset=G+"%"}return v}),l._tear=function(g,v){g==v.top&&(v.top=g.prev),g==v.bottom&&(v.bottom=g.next),g.next&&(g.next.prev=g.prev),g.prev&&(g.prev.next=g.next)}),fw=(l._tofront=function(g,v){v.top!==g&&(so(g,v),g.next=null,g.prev=v.top,v.top.next=g,v.top=g)},l._toback=function(g,v){v.bottom!==g&&(so(g,v),g.next=v.bottom,g.prev=null,v.bottom.prev=g,v.bottom=g)},l._insertafter=function(g,v,b){so(g,b),v==b.top&&(b.top=g),v.next&&(v.next.prev=g),g.next=v.next,g.prev=v,v.next=g},l._insertbefore=function(g,v,b){so(g,b),v==b.bottom&&(b.bottom=g),v.prev&&(v.prev.next=g),g.prev=v.prev,v.prev=g,g.next=v},l.toMatrix=function(g,v){var b=Hi(g),x={_:{transform:k},getBBox:function(){return b}};return N1(x,v),x.matrix}),N1=(l.transformPath=function(g,v){return fe(g,fw(g,v))},l._extractTransform=function(g,v){if(v==null)return g._.transform;v=R(v).replace(/\.{3}|\u2026/g,g._.transform||k);var b,x,E=l.parseTransformString(v),O=0,G=1,B=1,$=g._,j=new mn;if($.transform=E||[],E)for(var J=0,ot=E.length;J<ot;J++){var et,Z,nt,lt,rt,Q=E[J],mt=Q.length,ht=R(Q[0]).toLowerCase(),ft=Q[0]!=ht,ct=ft?j.invert():0;ht=="t"&&mt==3?ft?(et=ct.x(0,0),Z=ct.y(0,0),nt=ct.x(Q[1],Q[2]),lt=ct.y(Q[1],Q[2]),j.translate(nt-et,lt-Z)):j.translate(Q[1],Q[2]):ht=="r"?mt==2?(rt=rt||g.getBBox(1),j.rotate(Q[1],rt.x+rt.width/2,rt.y+rt.height/2),O+=Q[1]):mt==4&&(ft?(nt=ct.x(Q[2],Q[3]),lt=ct.y(Q[2],Q[3]),j.rotate(Q[1],nt,lt)):j.rotate(Q[1],Q[2],Q[3]),O+=Q[1]):ht=="s"?mt==2||mt==3?(rt=rt||g.getBBox(1),j.scale(Q[1],Q[mt-1],rt.x+rt.width/2,rt.y+rt.height/2),G*=Q[1],B*=Q[mt-1]):mt==5&&(ft?(nt=ct.x(Q[3],Q[4]),lt=ct.y(Q[3],Q[4]),j.scale(Q[1],Q[2],nt,lt)):j.scale(Q[1],Q[2],Q[3],Q[4]),G*=Q[1],B*=Q[2]):ht=="m"&&mt==7&&j.add(Q[1],Q[2],Q[3],Q[4],Q[5],Q[6]),$.dirtyT=1,g.matrix=j}g.matrix=j,$.sx=G,$.sy=B,$.deg=O,$.dx=b=j.e,$.dy=x=j.f,G==1&&B==1&&!O&&$.bbox?($.bbox.x+=+b,$.bbox.y+=+x):$.dirtyT=1}),U1=function(g){var v=g[0];switch(v.toLowerCase()){case"t":return[v,0,0];case"m":return[v,1,0,0,1,0,0];case"r":return g.length==4?[v,0,g[2],g[3]]:[v,0];case"s":return g.length==5?[v,1,1,g[3],g[4]]:g.length==3?[v,1,1]:[v,1]}},dw=l._equaliseTransform=function(g,v){v=R(v).replace(/\.{3}|\u2026/g,g),g=l.parseTransformString(g)||[],v=l.parseTransformString(v)||[];for(var b,x,E,O,G=W(g.length,v.length),B=[],$=[],j=0;j<G;j++){if(E=g[j]||U1(v[j]),O=v[j]||U1(E),E[0]!=O[0]||E[0].toLowerCase()=="r"&&(E[2]!=O[2]||E[3]!=O[3])||E[0].toLowerCase()=="s"&&(E[3]!=O[3]||E[4]!=O[4]))return;for(B[j]=[],$[j]=[],b=0,x=W(E.length,O.length);b<x;b++)b in E&&(B[j][b]=E[b]),b in O&&($[j][b]=O[b])}return{from:B,to:$}};function mn(g,v,b,x,E,O){g!=null?(this.a=+g,this.b=+v,this.c=+b,this.d=+x,this.e=+E,this.f=+O):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}l._getContainer=function(g,v,b,x){var E;if((E=x!=null||l.is(g,"object")?g:m.doc.getElementById(g))!=null)return E.tagName?v==null?{container:E,width:E.style.pixelWidth||E.offsetWidth,height:E.style.pixelHeight||E.offsetHeight}:{container:E,width:v,height:b}:{container:1,x:g,y:v,width:b,height:x}},l.pathToRelative=F1,l._engine={},l.path2curve=Gs,l.matrix=function(g,v,b,x,E,O){return new mn(g,v,b,x,E,O)},function(g){function v(x){return x[0]*x[0]+x[1]*x[1]}function b(x){var E=q.sqrt(v(x));x[0]&&(x[0]/=E),x[1]&&(x[1]/=E)}g.add=function(x,E,O,G,B,$){var j,J,ot,et,Z=[[],[],[]],nt=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],lt=[[x,O,B],[E,G,$],[0,0,1]];for(x&&x instanceof mn&&(lt=[[x.a,x.c,x.e],[x.b,x.d,x.f],[0,0,1]]),j=0;j<3;j++)for(J=0;J<3;J++){for(et=0,ot=0;ot<3;ot++)et+=nt[j][ot]*lt[ot][J];Z[j][J]=et}this.a=Z[0][0],this.b=Z[1][0],this.c=Z[0][1],this.d=Z[1][1],this.e=Z[0][2],this.f=Z[1][2]},g.invert=function(){var x=this,E=x.a*x.d-x.b*x.c;return new mn(x.d/E,-x.b/E,-x.c/E,x.a/E,(x.c*x.f-x.d*x.e)/E,(x.b*x.e-x.a*x.f)/E)},g.clone=function(){return new mn(this.a,this.b,this.c,this.d,this.e,this.f)},g.translate=function(x,E){this.add(1,0,0,1,x,E)},g.scale=function(x,E,O,G){E==null&&(E=x),(O||G)&&this.add(1,0,0,1,O,G),this.add(x,0,0,E,0,0),(O||G)&&this.add(1,0,0,1,-O,-G)},g.rotate=function(x,E,O){x=l.rad(x),E=E||0,O=O||0;var G=+q.cos(x).toFixed(9),B=+q.sin(x).toFixed(9);this.add(G,B,-B,G,E,O),this.add(1,0,0,1,-E,-O)},g.x=function(x,E){return x*this.a+E*this.c+this.e},g.y=function(x,E){return x*this.b+E*this.d+this.f},g.get=function(x){return+this[R.fromCharCode(97+x)].toFixed(4)},g.toString=function(){return l.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},g.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},g.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},g.split=function(){var x={};x.dx=this.e,x.dy=this.f;var E=[[this.a,this.c],[this.b,this.d]];x.scalex=q.sqrt(v(E[0])),b(E[0]),x.shear=E[0][0]*E[1][0]+E[0][1]*E[1][1],E[1]=[E[1][0]-E[0][0]*x.shear,E[1][1]-E[0][1]*x.shear],x.scaley=q.sqrt(v(E[1])),b(E[1]),x.shear/=x.scaley;var O=-E[0][1],G=E[1][1];return G<0?(x.rotate=l.deg(q.acos(G)),O<0&&(x.rotate=360-x.rotate)):x.rotate=l.deg(q.asin(O)),x.isSimple=!(+x.shear.toFixed(9)||x.scalex.toFixed(9)!=x.scaley.toFixed(9)&&x.rotate),x.isSuperSimple=!+x.shear.toFixed(9)&&x.scalex.toFixed(9)==x.scaley.toFixed(9)&&!x.rotate,x.noRotation=!+x.shear.toFixed(9)&&!x.rotate,x},g.toTransformString=function(x){var E=x||this[P]();return E.isSimple?(E.scalex=+E.scalex.toFixed(4),E.scaley=+E.scaley.toFixed(4),E.rotate=+E.rotate.toFixed(4),(E.dx||E.dy?"t"+[E.dx,E.dy]:k)+(E.scalex!=1||E.scaley!=1?"s"+[E.scalex,E.scaley,0,0]:k)+(E.rotate?"r"+[E.rotate,0,0]:k)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(mn.prototype);for(var gw=function(){this.returnValue=!1},pw=function(){return this.originalEvent.preventDefault()},mw=function(){this.cancelBubble=!0},vw=function(){return this.originalEvent.stopPropagation()},B1=function(g){var v=m.doc.documentElement.scrollTop||m.doc.body.scrollTop,b=m.doc.documentElement.scrollLeft||m.doc.body.scrollLeft;return{x:g.clientX+b,y:g.clientY+v}},_w=m.doc.addEventListener?function(g,v,b,x){var E=function(G){var B=B1(G);return b.call(x,G,B.x,B.y)};if(g.addEventListener(v,E,!1),w&&I[v]){var O=function(G){for(var B=B1(G),$=G,j=0,J=G.targetTouches&&G.targetTouches.length;j<J;j++)if(G.targetTouches[j].target==g){(G=G.targetTouches[j]).originalEvent=$,G.preventDefault=pw,G.stopPropagation=vw;break}return b.call(x,G,B.x,B.y)};g.addEventListener(I[v],O,!1)}return function(){return g.removeEventListener(v,E,!1),w&&I[v]&&g.removeEventListener(I[v],O,!1),!0}}:m.doc.attachEvent?function(g,v,b,x){var E=function(O){O=O||m.win.event;var G=m.doc.documentElement.scrollTop||m.doc.body.scrollTop,B=m.doc.documentElement.scrollLeft||m.doc.body.scrollLeft,$=O.clientX+B,j=O.clientY+G;return O.preventDefault=O.preventDefault||gw,O.stopPropagation=O.stopPropagation||mw,b.call(x,O,$,j)};return g.attachEvent("on"+v,E),function(){return g.detachEvent("on"+v,E),!0}}:void 0,Vi=[],xh=function(g){for(var v,b=g.clientX,x=g.clientY,E=m.doc.documentElement.scrollTop||m.doc.body.scrollTop,O=m.doc.documentElement.scrollLeft||m.doc.body.scrollLeft,G=Vi.length;G--;){if(v=Vi[G],w&&g.touches){for(var B,$=g.touches.length;$--;)if((B=g.touches[$]).identifier==v.el._drag.id){b=B.clientX,x=B.clientY,(g.originalEvent?g.originalEvent:g).preventDefault();break}}else g.preventDefault();var j,J=v.el.node,ot=J.nextSibling,et=J.parentNode,Z=J.style.display;m.win.opera&&et.removeChild(J),J.style.display="none",j=v.el.paper.getElementByPoint(b,x),J.style.display=Z,m.win.opera&&(ot?et.insertBefore(J,ot):et.appendChild(J)),j&&o("raphael.drag.over."+v.el.id,v.el,j),b+=O,x+=E,o("raphael.drag.move."+v.el.id,v.move_scope||v.el,b-v.el._drag.x,x-v.el._drag.y,b,x,g)}},Sh=function(g){l.unmousemove(xh).unmouseup(Sh);for(var v,b=Vi.length;b--;)(v=Vi[b]).el._drag={},o("raphael.drag.end."+v.el.id,v.end_scope||v.start_scope||v.move_scope||v.el,g);Vi=[]},jt=l.el={},G1=U.length;G1--;)(function(g){l[g]=jt[g]=function(v,b){return l.is(v,"function")&&(this.events=this.events||[],this.events.push({name:g,f:v,unbind:_w(this.shape||this.node||m.doc,g,v,b||this)})),this},l["un"+g]=jt["un"+g]=function(v){for(var b=this.events||[],x=b.length;x--;)b[x].name!=g||!l.is(v,"undefined")&&b[x].f!=v||(b[x].unbind(),b.splice(x,1),!b.length&&delete this.events);return this}})(U[G1]);jt.data=function(g,v){var b=Nt[this.id]=Nt[this.id]||{};if(arguments.length==0)return b;if(arguments.length==1){if(l.is(g,"object")){for(var x in g)g[p](x)&&this.data(x,g[x]);return this}return o("raphael.data.get."+this.id,this,b[g],g),b[g]}return b[g]=v,o("raphael.data.set."+this.id,this,v,g),this},jt.removeData=function(g){return g==null?delete Nt[this.id]:Nt[this.id]&&delete Nt[this.id][g],this},jt.getData=function(){return Se(Nt[this.id]||{})},jt.hover=function(g,v,b,x){return this.mouseover(g,b).mouseout(v,x||b)},jt.unhover=function(g,v){return this.unmouseover(g).unmouseout(v)};var ir=[];jt.drag=function(g,v,b,x,E,O){function G(B){(B.originalEvent||B).preventDefault();var $=B.clientX,j=B.clientY,J=m.doc.documentElement.scrollTop||m.doc.body.scrollTop,ot=m.doc.documentElement.scrollLeft||m.doc.body.scrollLeft;if(this._drag.id=B.identifier,w&&B.touches){for(var et,Z=B.touches.length;Z--;)if(et=B.touches[Z],this._drag.id=et.identifier,et.identifier==this._drag.id){$=et.clientX,j=et.clientY;break}}this._drag.x=$+ot,this._drag.y=j+J,!Vi.length&&l.mousemove(xh).mouseup(Sh),Vi.push({el:this,move_scope:x,start_scope:E,end_scope:O}),v&&o.on("raphael.drag.start."+this.id,v),g&&o.on("raphael.drag.move."+this.id,g),b&&o.on("raphael.drag.end."+this.id,b),o("raphael.drag.start."+this.id,E||x||this,this._drag.x,this._drag.y,B)}return this._drag={},ir.push({el:this,start:G}),this.mousedown(G),this},jt.onDragOver=function(g){g?o.on("raphael.drag.over."+this.id,g):o.unbind("raphael.drag.over."+this.id)},jt.undrag=function(){for(var g=ir.length;g--;)ir[g].el==this&&(this.unmousedown(ir[g].start),ir.splice(g,1),o.unbind("raphael.drag.*."+this.id));!ir.length&&l.unmousemove(xh).unmouseup(Sh),Vi=[]},c.circle=function(g,v,b){var x=l._engine.circle(this,g||0,v||0,b||0);return this.__set__&&this.__set__.push(x),x},c.rect=function(g,v,b,x,E){var O=l._engine.rect(this,g||0,v||0,b||0,x||0,E||0);return this.__set__&&this.__set__.push(O),O},c.ellipse=function(g,v,b,x){var E=l._engine.ellipse(this,g||0,v||0,b||0,x||0);return this.__set__&&this.__set__.push(E),E},c.path=function(g){g&&!l.is(g,"string")&&!l.is(g[0],_t)&&(g+=k);var v=l._engine.path(l.format[C](l,arguments),this);return this.__set__&&this.__set__.push(v),v},c.image=function(g,v,b,x,E){var O=l._engine.image(this,g||"about:blank",v||0,b||0,x||0,E||0);return this.__set__&&this.__set__.push(O),O},c.text=function(g,v,b){var x=l._engine.text(this,g||0,v||0,R(b));return this.__set__&&this.__set__.push(x),x},c.set=function(g){!l.is(g,"array")&&(g=Array.prototype.splice.call(arguments,0,arguments.length));var v=new zs(g);return this.__set__&&this.__set__.push(v),v.paper=this,v.type="set",v},c.setStart=function(g){this.__set__=g||this.set()},c.setFinish=function(g){var v=this.__set__;return delete this.__set__,v},c.getSize=function(){var g=this.canvas.parentNode;return{width:g.offsetWidth,height:g.offsetHeight}},c.setSize=function(g,v){return l._engine.setSize.call(this,g,v)},c.setViewBox=function(g,v,b,x,E){return l._engine.setViewBox.call(this,g,v,b,x,E)},c.top=c.bottom=null,c.raphael=l;function $1(){return this.x+A+this.y+A+this.width+" × "+this.height}c.getElementByPoint=function(g,v){var b,x,E,O,G,B,$,j=this.canvas,J=m.doc.elementFromPoint(g,v);if(m.win.opera&&J.tagName=="svg"){var ot=(x=(b=j).getBoundingClientRect(),E=b.ownerDocument,O=E.body,G=E.documentElement,B=G.clientTop||O.clientTop||0,$=G.clientLeft||O.clientLeft||0,{y:x.top+(m.win.pageYOffset||G.scrollTop||O.scrollTop)-B,x:x.left+(m.win.pageXOffset||G.scrollLeft||O.scrollLeft)-$}),et=j.createSVGRect();et.x=g-ot.x,et.y=v-ot.y,et.width=et.height=1;var Z=j.getIntersectionList(et,null);Z.length&&(J=Z[Z.length-1])}if(!J)return null;for(;J.parentNode&&J!=j.parentNode&&!J.raphael;)J=J.parentNode;return J==this.canvas.parentNode&&(J=j),J=J&&J.raphael?this.getById(J.raphaelid):null},c.getElementsByBBox=function(g){var v=this.set();return this.forEach(function(b){l.isBBoxIntersect(b.getBBox(),g)&&v.push(b)}),v},c.getById=function(g){for(var v=this.bottom;v;){if(v.id==g)return v;v=v.next}return null},c.forEach=function(g,v){for(var b=this.bottom;b;){if(g.call(v,b)===!1)return this;b=b.next}return this},c.getElementsByPoint=function(g,v){var b=this.set();return this.forEach(function(x){x.isPointInside(g,v)&&b.push(x)}),b},jt.isPointInside=function(g,v){var b=this.realPath=re[this.type](this);return this.attr("transform")&&this.attr("transform").length&&(b=l.transformPath(b,this.attr("transform"))),l.isPointInsidePath(b,g,v)},jt.getBBox=function(g){if(this.removed)return{};var v=this._;return g?(!v.dirty&&v.bboxwt||(this.realPath=re[this.type](this),v.bboxwt=Hi(this.realPath),v.bboxwt.toString=$1,v.dirty=0),v.bboxwt):((v.dirty||v.dirtyT||!v.bbox)&&(!v.dirty&&this.realPath||(v.bboxwt=0,this.realPath=re[this.type](this)),v.bbox=Hi(fe(this.realPath,this.matrix)),v.bbox.toString=$1,v.dirty=v.dirtyT=0),v.bbox)},jt.clone=function(){if(this.removed)return null;var g=this.paper[this.type]().attr(this.attr());return this.__set__&&this.__set__.push(g),g},jt.glow=function(g){if(this.type=="text")return null;var v={width:((g=g||{}).width||10)+(+this.attr("stroke-width")||1),fill:g.fill||!1,opacity:g.opacity==null?.5:g.opacity,offsetx:g.offsetx||0,offsety:g.offsety||0,color:g.color||"#000"},b=v.width/2,x=this.paper,E=x.set(),O=this.realPath||re[this.type](this);O=this.matrix?fe(O,this.matrix):O;for(var G=1;G<b+1;G++)E.push(x.path(O).attr({stroke:v.color,fill:v.fill?v.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(v.width/b*G).toFixed(3),opacity:+(v.opacity/b).toFixed(3)}));return E.insertBefore(this).translate(v.offsetx,v.offsety)};var Ch=function(g,v,b,x,E,O,G,B,$){return $==null?He(g,v,b,x,E,O,G,B):l.findDotsAtSegment(g,v,b,x,E,O,G,B,function(j,J,ot,et,Z,nt,lt,rt,Q){if(!(Q<0||He(j,J,ot,et,Z,nt,lt,rt)<Q)){var mt,ht=.5,ft=1-ht;for(mt=He(j,J,ot,et,Z,nt,lt,rt,ft);it(mt-Q)>.01;)mt=He(j,J,ot,et,Z,nt,lt,rt,ft+=(mt<Q?1:-1)*(ht/=2));return ft}}(g,v,b,x,E,O,G,B,$))},kh=function(g,v){return function(b,x,E){for(var O,G,B,$,j,J="",ot={},et=0,Z=0,nt=(b=Gs(b)).length;Z<nt;Z++){if((B=b[Z])[0]=="M")O=+B[1],G=+B[2];else{if(et+($=Ch(O,G,B[1],B[2],B[3],B[4],B[5],B[6]))>x){if(v&&!ot.start){if(J+=["C"+(j=Ch(O,G,B[1],B[2],B[3],B[4],B[5],B[6],x-et)).start.x,j.start.y,j.m.x,j.m.y,j.x,j.y],E)return J;ot.start=J,J=["M"+j.x,j.y+"C"+j.n.x,j.n.y,j.end.x,j.end.y,B[5],B[6]].join(),et+=$,O=+B[5],G=+B[6];continue}if(!g&&!v)return{x:(j=Ch(O,G,B[1],B[2],B[3],B[4],B[5],B[6],x-et)).x,y:j.y,alpha:j.alpha}}et+=$,O=+B[5],G=+B[6]}J+=B.shift()+B}return ot.end=J,(j=g?et:v?ot:l.findDotsAtSegment(O,G,B[0],B[1],B[2],B[3],B[4],B[5],1)).alpha&&(j={x:j.x,y:j.y,alpha:j.alpha}),j}},z1=kh(1),H1=kh(),Th=kh(0,1);l.getTotalLength=z1,l.getPointAtLength=H1,l.getSubpath=function(g,v,b){if(this.getTotalLength(g)-b<1e-6)return Th(g,v).end;var x=Th(g,b,1);return v?Th(x,v).end:x},jt.getTotalLength=function(){var g=this.getPath();if(g)return this.node.getTotalLength?this.node.getTotalLength():z1(g)},jt.getPointAtLength=function(g){var v=this.getPath();if(v)return H1(v,g)},jt.getPath=function(){var g,v=l._getPath[this.type];if(this.type!="text"&&this.type!="set")return v&&(g=v(this)),g},jt.getSubpath=function(g,v){var b=this.getPath();if(b)return l.getSubpath(b,g,v)};var De=l.easing_formulas={linear:function(g){return g},"<":function(g){return pt(g,1.7)},">":function(g){return pt(g,.48)},"<>":function(g){var v=.48-g/1.04,b=q.sqrt(.1734+v*v),x=b-v,E=-b-v,O=pt(it(x),1/3)*(x<0?-1:1)+pt(it(E),1/3)*(E<0?-1:1)+.5;return 3*(1-O)*O*O+O*O*O},backIn:function(g){var v=1.70158;return g*g*((v+1)*g-v)},backOut:function(g){var v=1.70158;return(g-=1)*g*((v+1)*g+v)+1},elastic:function(g){return g==!!g?g:pt(2,-10*g)*q.sin(2*vt*(g-.075)/.3)+1},bounce:function(g){var v=7.5625,b=2.75;return g<1/b?v*g*g:g<2/b?v*(g-=1.5/b)*g+.75:g<2.5/b?v*(g-=2.25/b)*g+.9375:v*(g-=2.625/b)*g+.984375}};De.easeIn=De["ease-in"]=De["<"],De.easeOut=De["ease-out"]=De[">"],De.easeInOut=De["ease-in-out"]=De["<>"],De["back-in"]=De.backIn,De["back-out"]=De.backOut;var Gt=[],j1=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(g){setTimeout(g,16)},Eh=function(){for(var g=+new Date,v=0;v<Gt.length;v++){var b=Gt[v];if(!b.el.removed&&!b.paused){var x,E,O=g-b.start,G=b.ms,B=b.easing,$=b.from,j=b.diff,J=b.to,ot=(b.t,b.el),et={},Z={};if(b.initstatus?(O=(b.initstatus*b.anim.top-b.prev)/(b.percent-b.prev)*G,b.status=b.initstatus,delete b.initstatus,b.stop&&Gt.splice(v--,1)):b.status=(b.prev+(b.percent-b.prev)*(O/G))/b.anim.top,!(O<0))if(O<G){var nt=B(O/G);for(var lt in $)if($[p](lt)){switch(X[lt]){case dt:x=+$[lt]+nt*G*j[lt];break;case"colour":x="rgb("+[Ah(F($[lt].r+nt*G*j[lt].r)),Ah(F($[lt].g+nt*G*j[lt].g)),Ah(F($[lt].b+nt*G*j[lt].b))].join(",")+")";break;case"path":x=[];for(var rt=0,Q=$[lt].length;rt<Q;rt++){x[rt]=[$[lt][rt][0]];for(var mt=1,ht=$[lt][rt].length;mt<ht;mt++)x[rt][mt]=+$[lt][rt][mt]+nt*G*j[lt][rt][mt];x[rt]=x[rt].join(A)}x=x.join(A);break;case"transform":if(j[lt].real)for(x=[],rt=0,Q=$[lt].length;rt<Q;rt++)for(x[rt]=[$[lt][rt][0]],mt=1,ht=$[lt][rt].length;mt<ht;mt++)x[rt][mt]=$[lt][rt][mt]+nt*G*j[lt][rt][mt];else{var ft=function(At){return+$[lt][At]+nt*G*j[lt][At]};x=[["m",ft(0),ft(1),ft(2),ft(3),ft(4),ft(5)]]}break;case"csv":if(lt=="clip-rect")for(x=[],rt=4;rt--;)x[rt]=+$[lt][rt]+nt*G*j[lt][rt];break;default:var ct=[][_]($[lt]);for(x=[],rt=ot.paper.customAttributes[lt].length;rt--;)x[rt]=+ct[rt]+nt*G*j[lt][rt]}et[lt]=x}ot.attr(et),function(At,kt,Pt){setTimeout(function(){o("raphael.anim.frame."+At,kt,Pt)})}(ot.id,ot,b.anim)}else{if(function(At,kt,Pt){setTimeout(function(){o("raphael.anim.frame."+kt.id,kt,Pt),o("raphael.anim.finish."+kt.id,kt,Pt),l.is(At,"function")&&At.call(kt)})}(b.callback,ot,b.anim),ot.attr(J),Gt.splice(v--,1),b.repeat>1&&!b.next){for(E in J)J[p](E)&&(Z[E]=b.totalOrigin[E]);b.el.attr(Z),$s(b.anim,b.el,b.anim.percents[0],null,b.totalOrigin,b.repeat-1)}b.next&&!b.stop&&$s(b.anim,b.el,b.next,null,b.totalOrigin,b.repeat)}}}Gt.length&&j1(Eh)},Ah=function(g){return g>255?255:g<0?0:g};function yw(g,v,b,x,E,O){var G=3*v,B=3*(x-v)-G,$=1-G-B,j=3*b,J=3*(E-b)-j,ot=1-j-J;function et(Z){return(($*Z+B)*Z+G)*Z}return function(Z,nt){var lt=function(rt,Q){var mt,ht,ft,ct,At,kt;for(ft=rt,kt=0;kt<8;kt++){if(ct=et(ft)-rt,it(ct)<Q)return ft;if(it(At=(3*$*ft+2*B)*ft+G)<1e-6)break;ft-=ct/At}if(ht=1,(ft=rt)<(mt=0))return mt;if(ft>ht)return ht;for(;mt<ht;){if(ct=et(ft),it(ct-rt)<Q)return ft;rt>ct?mt=ft:ht=ft,ft=(ht-mt)/2+mt}return ft}(Z,nt);return((ot*lt+J)*lt+j)*lt}(g,1/(200*O))}function _i(g,v){var b=[],x={};if(this.ms=v,this.times=1,g){for(var E in g)g[p](E)&&(x[z(E)]=g[E],b.push(z(E)));b.sort(Lt)}this.anim=x,this.top=b[b.length-1],this.percents=b}function $s(g,v,b,x,E,O){b=z(b);var G,B,$,j,J,ot,et=g.ms,Z={},nt={},lt={};if(x)for(Q=0,mt=Gt.length;Q<mt;Q++){var rt=Gt[Q];if(rt.el.id==v.id&&rt.anim==g){rt.percent!=b?(Gt.splice(Q,1),$=1):B=rt,v.attr(rt.totalOrigin);break}}else x=+nt;for(var Q=0,mt=g.percents.length;Q<mt;Q++){if(g.percents[Q]==b||g.percents[Q]>x*g.top){b=g.percents[Q],J=g.percents[Q-1]||0,et=et/g.top*(b-J),j=g.percents[Q+1],G=g.anim[b];break}x&&v.attr(g.anim[g.percents[Q]])}if(G){if(B)B.initstatus=x,B.start=new Date-B.ms*x;else{for(var ht in G)if(G[p](ht)&&(X[p](ht)||v.paper.customAttributes[p](ht)))switch(Z[ht]=v.attr(ht),Z[ht]==null&&(Z[ht]=V[ht]),nt[ht]=G[ht],X[ht]){case dt:lt[ht]=(nt[ht]-Z[ht])/et;break;case"colour":Z[ht]=l.getRGB(Z[ht]);var ft=l.getRGB(nt[ht]);lt[ht]={r:(ft.r-Z[ht].r)/et,g:(ft.g-Z[ht].g)/et,b:(ft.b-Z[ht].b)/et};break;case"path":var ct=Gs(Z[ht],nt[ht]),At=ct[1];for(Z[ht]=ct[0],lt[ht]=[],Q=0,mt=Z[ht].length;Q<mt;Q++){lt[ht][Q]=[0];for(var kt=1,Pt=Z[ht][Q].length;kt<Pt;kt++)lt[ht][Q][kt]=(At[Q][kt]-Z[ht][Q][kt])/et}break;case"transform":var nr=v._,Hs=dw(nr[ht],nt[ht]);if(Hs)for(Z[ht]=Hs.from,nt[ht]=Hs.to,lt[ht]=[],lt[ht].real=!0,Q=0,mt=Z[ht].length;Q<mt;Q++)for(lt[ht][Q]=[Z[ht][Q][0]],kt=1,Pt=Z[ht][Q].length;kt<Pt;kt++)lt[ht][Q][kt]=(nt[ht][Q][kt]-Z[ht][Q][kt])/et;else{var Te=v.matrix||new mn,Qe={_:{transform:nr.transform},getBBox:function(){return v.getBBox(1)}};Z[ht]=[Te.a,Te.b,Te.c,Te.d,Te.e,Te.f],N1(Qe,nt[ht]),nt[ht]=Qe._.transform,lt[ht]=[(Qe.matrix.a-Te.a)/et,(Qe.matrix.b-Te.b)/et,(Qe.matrix.c-Te.c)/et,(Qe.matrix.d-Te.d)/et,(Qe.matrix.e-Te.e)/et,(Qe.matrix.f-Te.f)/et]}break;case"csv":var rr=R(G[ht])[P](d),sr=R(Z[ht])[P](d);if(ht=="clip-rect")for(Z[ht]=sr,lt[ht]=[],Q=sr.length;Q--;)lt[ht][Q]=(rr[Q]-Z[ht][Q])/et;nt[ht]=rr;break;default:for(rr=[][_](G[ht]),sr=[][_](Z[ht]),lt[ht]=[],Q=v.paper.customAttributes[ht].length;Q--;)lt[ht][Q]=((rr[Q]||0)-(sr[Q]||0))/et}var ao=G.easing,yi=l.easing_formulas[ao];if(!yi)if((yi=R(ao).match(T))&&yi.length==5){var _n=yi;yi=function(oo){return yw(oo,+_n[1],+_n[2],+_n[3],+_n[4],et)}}else yi=Dt;if(rt={anim:g,percent:b,timestamp:ot=G.start||g.start||+new Date,start:ot+(g.del||0),status:0,initstatus:x||0,stop:!1,ms:et,easing:yi,from:Z,diff:lt,to:nt,el:v,callback:G.callback,prev:J,next:j,repeat:O||g.times,origin:v.attr(),totalOrigin:E},Gt.push(rt),x&&!B&&!$&&(rt.stop=!0,rt.start=new Date-et*x,Gt.length==1))return Eh();$&&(rt.start=new Date-rt.ms*x),Gt.length==1&&j1(Eh)}o("raphael.anim.start."+v.id,v,g)}}function V1(g){for(var v=0;v<Gt.length;v++)Gt[v].el.paper==g&&Gt.splice(v--,1)}jt.animateWith=function(g,v,b,x,E,O){if(this.removed)return O&&O.call(this),this;var G=b instanceof _i?b:l.animation(b,x,E,O);$s(G,this,G.percents[0],null,this.attr());for(var B=0,$=Gt.length;B<$;B++)if(Gt[B].anim==v&&Gt[B].el==g){Gt[$-1].start=Gt[B].start;break}return this},jt.onAnimation=function(g){return g?o.on("raphael.anim.frame."+this.id,g):o.unbind("raphael.anim.frame."+this.id),this},_i.prototype.delay=function(g){var v=new _i(this.anim,this.ms);return v.times=this.times,v.del=+g||0,v},_i.prototype.repeat=function(g){var v=new _i(this.anim,this.ms);return v.del=this.del,v.times=q.floor(W(g,0))||1,v},l.animation=function(g,v,b,x){if(g instanceof _i)return g;!l.is(b,"function")&&b||(x=x||b||null,b=null),g=Object(g),v=+v||0;var E,O,G={};for(O in g)g[p](O)&&z(O)!=O&&z(O)+"%"!=O&&(E=!0,G[O]=g[O]);if(E)return b&&(G.easing=b),x&&(G.callback=x),new _i({100:G},v);if(x){var B=0;for(var $ in g){var j=Y($);g[p]($)&&j>B&&(B=j)}!g[B+="%"].callback&&(g[B].callback=x)}return new _i(g,v)},jt.animate=function(g,v,b,x){if(this.removed)return x&&x.call(this),this;var E=g instanceof _i?g:l.animation(g,v,b,x);return $s(E,this,E.percents[0],null,this.attr()),this},jt.setTime=function(g,v){return g&&v!=null&&this.status(g,K(v,g.ms)/g.ms),this},jt.status=function(g,v){var b,x,E=[],O=0;if(v!=null)return $s(g,this,-1,K(v,1)),this;for(b=Gt.length;O<b;O++)if((x=Gt[O]).el.id==this.id&&(!g||x.anim==g)){if(g)return x.status;E.push({anim:x.anim,status:x.status})}return g?0:E},jt.pause=function(g){for(var v=0;v<Gt.length;v++)Gt[v].el.id!=this.id||g&&Gt[v].anim!=g||o("raphael.anim.pause."+this.id,this,Gt[v].anim)!==!1&&(Gt[v].paused=!0);return this},jt.resume=function(g){for(var v=0;v<Gt.length;v++)if(Gt[v].el.id==this.id&&(!g||Gt[v].anim==g)){var b=Gt[v];o("raphael.anim.resume."+this.id,this,b.anim)!==!1&&(delete b.paused,this.status(b.anim,b.status))}return this},jt.stop=function(g){for(var v=0;v<Gt.length;v++)Gt[v].el.id!=this.id||g&&Gt[v].anim!=g||o("raphael.anim.stop."+this.id,this,Gt[v].anim)!==!1&&Gt.splice(v--,1);return this},o.on("raphael.remove",V1),o.on("raphael.clear",V1),jt.toString=function(){return"Raphaël’s object"};var q1,X1,vn,Y1,zs=function(g){if(this.items=[],this.length=0,this.type="set",g)for(var v=0,b=g.length;v<b;v++)!g[v]||g[v].constructor!=jt.constructor&&g[v].constructor!=zs||(this[this.items.length]=this.items[this.items.length]=g[v],this.length++)},be=zs.prototype;for(var Ph in be.push=function(){for(var g,v,b=0,x=arguments.length;b<x;b++)!(g=arguments[b])||g.constructor!=jt.constructor&&g.constructor!=zs||(this[v=this.items.length]=this.items[v]=g,this.length++);return this},be.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},be.forEach=function(g,v){for(var b=0,x=this.items.length;b<x;b++)if(g.call(v,this.items[b],b)===!1)return this;return this},jt)jt[p](Ph)&&(be[Ph]=function(g){return function(){var v=arguments;return this.forEach(function(b){b[g][C](b,v)})}}(Ph));return be.attr=function(g,v){if(g&&l.is(g,_t)&&l.is(g[0],"object"))for(var b=0,x=g.length;b<x;b++)this.items[b].attr(g[b]);else for(var E=0,O=this.items.length;E<O;E++)this.items[E].attr(g,v);return this},be.clear=function(){for(;this.length;)this.pop()},be.splice=function(g,v,b){g=g<0?W(this.length+g,0):g,v=W(0,K(this.length-g,v));var x,E=[],O=[],G=[];for(x=2;x<arguments.length;x++)G.push(arguments[x]);for(x=0;x<v;x++)O.push(this[g+x]);for(;x<this.length-g;x++)E.push(this[g+x]);var B=G.length;for(x=0;x<B+E.length;x++)this.items[g+x]=this[g+x]=x<B?G[x]:E[x-B];for(x=this.items.length=this.length-=v-B;this[x];)delete this[x++];return new zs(O)},be.exclude=function(g){for(var v=0,b=this.length;v<b;v++)if(this[v]==g)return this.splice(v,1),!0},be.animate=function(g,v,b,x){(l.is(b,"function")||!b)&&(x=b||null);var E,O,G=this.items.length,B=G,$=this;if(!G)return this;x&&(O=function(){!--G&&x.call($)}),b=l.is(b,"string")?b:O;var j=l.animation(g,v,b,O);for(E=this.items[--B].animate(j);B--;)this.items[B]&&!this.items[B].removed&&this.items[B].animateWith(E,j,j),this.items[B]&&!this.items[B].removed||G--;return this},be.insertAfter=function(g){for(var v=this.items.length;v--;)this.items[v].insertAfter(g);return this},be.getBBox=function(){for(var g=[],v=[],b=[],x=[],E=this.items.length;E--;)if(!this.items[E].removed){var O=this.items[E].getBBox();g.push(O.x),v.push(O.y),b.push(O.x+O.width),x.push(O.y+O.height)}return{x:g=K[C](0,g),y:v=K[C](0,v),x2:b=W[C](0,b),y2:x=W[C](0,x),width:b-g,height:x-v}},be.clone=function(g){g=this.paper.set();for(var v=0,b=this.items.length;v<b;v++)g.push(this.items[v].clone());return g},be.toString=function(){return"Raphaël‘s set"},be.glow=function(g){var v=this.paper.set();return this.forEach(function(b,x){var E=b.glow(g);E?.forEach(function(O,G){v.push(O)})}),v},be.isPointInside=function(g,v){var b=!1;return this.forEach(function(x){if(x.isPointInside(g,v))return b=!0,!1}),b},l.registerFont=function(g){if(!g.face)return g;this.fonts=this.fonts||{};var v={w:g.w,face:{},glyphs:{}},b=g.face["font-family"];for(var x in g.face)g.face[p](x)&&(v.face[x]=g.face[x]);if(this.fonts[b]?this.fonts[b].push(v):this.fonts[b]=[v],!g.svg){for(var E in v.face["units-per-em"]=Y(g.face["units-per-em"],10),g.glyphs)if(g.glyphs[p](E)){var O=g.glyphs[E];if(v.glyphs[E]={w:O.w,k:{},d:O.d&&"M"+O.d.replace(/[mlcxtrv]/g,function(B){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[B]||"M"})+"z"},O.k)for(var G in O.k)O[p](G)&&(v.glyphs[E].k[G]=O.k[G])}}return g},c.getFont=function(g,v,b,x){if(x=x||"normal",b=b||"normal",v=+v||{normal:400,bold:700,lighter:300,bolder:800}[v]||400,l.fonts){var E,O=l.fonts[g];if(!O){var G=new RegExp("(^|\\s)"+g.replace(/[^\w\d\s+!~.:_-]/g,k)+"(\\s|$)","i");for(var B in l.fonts)if(l.fonts[p](B)&&G.test(B)){O=l.fonts[B];break}}if(O)for(var $=0,j=O.length;$<j&&((E=O[$]).face["font-weight"]!=v||E.face["font-style"]!=b&&E.face["font-style"]||E.face["font-stretch"]!=x);$++);return E}},c.print=function(g,v,b,x,E,O,G,B){O=O||"middle",G=W(K(G||0,1),-1),B=W(K(B||1,3),1);var $,j=R(b)[P](k),J=0,ot=0,et=k;if(l.is(x,"string")&&(x=this.getFont(x)),x){$=(E||16)/x.face["units-per-em"];for(var Z=x.face.bbox[P](d),nt=+Z[0],lt=Z[3]-Z[1],rt=0,Q=+Z[1]+(O=="baseline"?lt+ +x.face.descent:lt/2),mt=0,ht=j.length;mt<ht;mt++){if(j[mt]==`
|
|
25
|
+
`)J=0,ct=0,ot=0,rt+=lt*B;else{var ft=ot&&x.glyphs[j[mt-1]]||{},ct=x.glyphs[j[mt]];J+=ot?(ft.w||x.w)+(ft.k&&ft.k[j[mt]]||0)+x.w*G:0,ot=1}ct&&ct.d&&(et+=l.transformPath(ct.d,["t",J*$,rt*$,"s",$,$,nt,Q,"t",(g-nt)/$,(v-Q)/$]))}}return this.path(et).attr({fill:"#000",stroke:"none"})},c.add=function(g){if(l.is(g,"array"))for(var v,b=this.set(),x=0,E=g.length;x<E;x++)v=g[x]||{},f[p](v.type)&&b.push(this[v.type]().attr(v));return b},l.format=function(g,v){var b=l.is(v,_t)?[0][_](v):arguments;return g&&l.is(g,"string")&&b.length-1&&(g=g.replace(u,function(x,E){return b[++E]==null?k:b[E]})),g||k},l.fullfill=(q1=/\{([^\}]+)\}/g,X1=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,function(g,v){return String(g).replace(q1,function(b,x){return function(E,O,G){var B=G;return O.replace(X1,function($,j,J,ot,et){j=j||ot,B&&(j in B&&(B=B[j]),typeof B=="function"&&et&&(B=B()))}),B=(B==null||B==G?E:B)+""}(b,x,v)})}),l.ninja=function(){if(y.was)m.win.Raphael=y.is;else{window.Raphael=void 0;try{delete window.Raphael}catch{}}return l},l.st=be,o.on("raphael.DOMload",function(){h=!0}),(vn=document).readyState==null&&vn.addEventListener&&(vn.addEventListener("DOMContentLoaded",Y1=function(){vn.removeEventListener("DOMContentLoaded",Y1,!1),vn.readyState="complete"},!1),vn.readyState="loading"),function g(){/in/.test(vn.readyState)?setTimeout(g,9):l.eve("raphael.DOMload")}(),l}.apply(n,s))===void 0||(e.exports=a)},function(e,n,r){var s,a;s=[r(0),r(3),r(4)],(a=function(o){return o}.apply(n,s))===void 0||(e.exports=a)},function(e,n,r){var s,a,o,l,h,c,d,f,u,p,m,y,S,C;l="hasOwnProperty",h=/[\.\/]/,c=/\s*,\s*/,d=function(_,w){return _-w},f={n:{}},u=function(){for(var _=0,w=this.length;_<w;_++)if(this[_]!==void 0)return this[_]},p=function(){for(var _=this.length;--_;)if(this[_]!==void 0)return this[_]},m=Object.prototype.toString,y=String,S=Array.isArray||function(_){return _ instanceof Array||m.call(_)=="[object Array]"},(C=function(_,w){var k,A=o,R=Array.prototype.slice.call(arguments,2),P=C.listeners(_),U=0,I=[],N={},q=[],W=a;q.firstDefined=u,q.lastDefined=p,a=_,o=0;for(var K=0,it=P.length;K<it;K++)"zIndex"in P[K]&&(I.push(P[K].zIndex),P[K].zIndex<0&&(N[P[K].zIndex]=P[K]));for(I.sort(d);I[U]<0;)if(k=N[I[U++]],q.push(k.apply(w,R)),o)return o=A,q;for(K=0;K<it;K++)if("zIndex"in(k=P[K]))if(k.zIndex==I[U]){if(q.push(k.apply(w,R)),o)break;do if((k=N[I[++U]])&&q.push(k.apply(w,R)),o)break;while(k)}else N[k.zIndex]=k;else if(q.push(k.apply(w,R)),o)break;return o=A,a=W,q})._events=f,C.listeners=function(_){var w,k,A,R,P,U,I,N,q=S(_)?_:_.split(h),W=f,K=[W],it=[];for(R=0,P=q.length;R<P;R++){for(N=[],U=0,I=K.length;U<I;U++)for(k=[(W=K[U].n)[q[R]],W["*"]],A=2;A--;)(w=k[A])&&(N.push(w),it=it.concat(w.f||[]));K=N}return it},C.separator=function(_){_?(_="["+(_=y(_).replace(/(?=[\.\^\]\[\-])/g,"\\"))+"]",h=new RegExp(_)):h=/[\.\/]/},C.on=function(_,w){if(typeof w!="function")return function(){};for(var k=S(_)?S(_[0])?_:[_]:y(_).split(c),A=0,R=k.length;A<R;A++)(function(P){for(var U,I=S(P)?P:y(P).split(h),N=f,q=0,W=I.length;q<W;q++)N=(N=N.n).hasOwnProperty(I[q])&&N[I[q]]||(N[I[q]]={n:{}});for(N.f=N.f||[],q=0,W=N.f.length;q<W;q++)if(N.f[q]==w){U=!0;break}!U&&N.f.push(w)})(k[A]);return function(P){+P==+P&&(w.zIndex=+P)}},C.f=function(_){var w=[].slice.call(arguments,1);return function(){C.apply(null,[_,null].concat(w).concat([].slice.call(arguments,0)))}},C.stop=function(){o=1},C.nt=function(_){var w=S(a)?a.join("."):a;return _?new RegExp("(?:\\.|\\/|^)"+_+"(?:\\.|\\/|$)").test(w):w},C.nts=function(){return S(a)?a:a.split(h)},C.off=C.unbind=function(_,w){if(_){var k=S(_)?S(_[0])?_:[_]:y(_).split(c);if(k.length>1)for(var A=0,R=k.length;A<R;A++)C.off(k[A],w);else{k=S(_)?_:y(_).split(h);var P,U,I,N,q,W=[f];for(A=0,R=k.length;A<R;A++)for(N=0;N<W.length;N+=I.length-2){if(I=[N,1],P=W[N].n,k[A]!="*")P[k[A]]&&I.push(P[k[A]]);else for(U in P)P[l](U)&&I.push(P[U]);W.splice.apply(W,I)}for(A=0,R=W.length;A<R;A++)for(P=W[A];P.n;){if(w){if(P.f){for(N=0,q=P.f.length;N<q;N++)if(P.f[N]==w){P.f.splice(N,1);break}!P.f.length&&delete P.f}for(U in P.n)if(P.n[l](U)&&P.n[U].f){var K=P.n[U].f;for(N=0,q=K.length;N<q;N++)if(K[N]==w){K.splice(N,1);break}!K.length&&delete P.n[U].f}}else for(U in delete P.f,P.n)P.n[l](U)&&P.n[U].f&&delete P.n[U].f;P=P.n}}}else C._events=f={n:{}}},C.once=function(_,w){var k=function(){return C.off(_,k),w.apply(this,arguments)};return C.on(_,k)},C.version="0.5.0",C.toString=function(){return"You are running Eve 0.5.0"},e.exports?e.exports=C:(s=function(){return C}.apply(n,[]))===void 0||(e.exports=s)},function(e,n,r){var s,a;s=[r(0)],(a=function(o){if(!o||o.svg){var l="hasOwnProperty",h=String,c=parseFloat,d=parseInt,f=Math,u=f.max,p=f.abs,m=f.pow,y=/[, ]+/,S=o.eve,C="",_=" ",w="http://www.w3.org/1999/xlink",k={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},A={};o.toString=function(){return`Your browser supports SVG.
|
|
26
|
+
You are running Raphaël `+this.version};var R=function(L,M){if(M)for(var T in typeof L=="string"&&(L=R(L)),M)M[l](T)&&(T.substring(0,6)=="xlink:"?L.setAttributeNS(w,T.substring(6),h(M[T])):L.setAttribute(T,h(M[T])));else(L=o._g.doc.createElementNS("http://www.w3.org/2000/svg",L)).style&&(L.style.webkitTapHighlightColor="rgba(0,0,0,0)");return L},P=function(L,M){var T="linear",F=L.id+M,z=.5,Y=.5,D=L.node,V=L.paper,X=D.style,tt=o._g.doc.getElementById(F);if(!tt){if(M=(M=h(M).replace(o._radial_gradient,function(Lt,Dt,Tt){if(T="radial",Dt&&Tt){z=c(Dt);var le=2*((Y=c(Tt))>.5)-1;m(z-.5,2)+m(Y-.5,2)>.25&&(Y=f.sqrt(.25-m(z-.5,2))*le+.5)&&Y!=.5&&(Y=Y.toFixed(5)-1e-5*le)}return C})).split(/\s*\-\s*/),T=="linear"){var at=M.shift();if(at=-c(at),isNaN(at))return null;var gt=[0,0,f.cos(o.rad(at)),f.sin(o.rad(at))],Ct=1/(u(p(gt[2]),p(gt[3]))||1);gt[2]*=Ct,gt[3]*=Ct,gt[2]<0&&(gt[0]=-gt[2],gt[2]=0),gt[3]<0&&(gt[1]=-gt[3],gt[3]=0)}var Et=o._parseDots(M);if(!Et)return null;if(F=F.replace(/[\(\)\s,\xb0#]/g,"_"),L.gradient&&F!=L.gradient.id&&(V.defs.removeChild(L.gradient),delete L.gradient),!L.gradient){tt=R(T+"Gradient",{id:F}),L.gradient=tt,R(tt,T=="radial"?{fx:z,fy:Y}:{x1:gt[0],y1:gt[1],x2:gt[2],y2:gt[3],gradientTransform:L.matrix.invert()}),V.defs.appendChild(tt);for(var bt=0,Nt=Et.length;bt<Nt;bt++)tt.appendChild(R("stop",{offset:Et[bt].offset?Et[bt].offset:bt?"100%":"0%","stop-color":Et[bt].color||"#fff","stop-opacity":isFinite(Et[bt].opacity)?Et[bt].opacity:1}))}}return R(D,{fill:U(F),opacity:1,"fill-opacity":1}),X.fill=C,X.opacity=1,X.fillOpacity=1,1},U=function(L){if((M=document.documentMode)&&(M===9||M===10))return"url('#"+L+"')";var M,T=document.location;return"url('"+(T.protocol+"//"+T.host+T.pathname+T.search)+"#"+L+"')"},I=function(L){var M=L.getBBox(1);R(L.pattern,{patternTransform:L.matrix.invert()+" translate("+M.x+","+M.y+")"})},N=function(L,M,T){if(L.type=="path"){for(var F,z,Y,D,V,X=h(M).toLowerCase().split("-"),tt=L.paper,at=T?"end":"start",gt=L.node,Ct=L.attrs,Et=Ct["stroke-width"],bt=X.length,Nt="classic",Lt=3,Dt=3,Tt=5;bt--;)switch(X[bt]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":Nt=X[bt];break;case"wide":Dt=5;break;case"narrow":Dt=2;break;case"long":Lt=5;break;case"short":Lt=2}if(Nt=="open"?(Lt+=2,Dt+=2,Tt+=2,Y=1,D=T?4:1,V={fill:"none",stroke:Ct.stroke}):(D=Y=Lt/2,V={fill:Ct.stroke,stroke:"none"}),L._.arrows?T?(L._.arrows.endPath&&A[L._.arrows.endPath]--,L._.arrows.endMarker&&A[L._.arrows.endMarker]--):(L._.arrows.startPath&&A[L._.arrows.startPath]--,L._.arrows.startMarker&&A[L._.arrows.startMarker]--):L._.arrows={},Nt!="none"){var le="raphael-marker-"+Nt,re="raphael-marker-"+at+Nt+Lt+Dt+"-obj"+L.id;o._g.doc.getElementById(le)?A[le]++:(tt.defs.appendChild(R(R("path"),{"stroke-linecap":"round",d:k[Nt],id:le})),A[le]=1);var fe,qt=o._g.doc.getElementById(re);qt?(A[re]++,fe=qt.getElementsByTagName("use")[0]):(qt=R(R("marker"),{id:re,markerHeight:Dt,markerWidth:Lt,orient:"auto",refX:D,refY:Dt/2}),fe=R(R("use"),{"xlink:href":"#"+le,transform:(T?"rotate(180 "+Lt/2+" "+Dt/2+") ":C)+"scale("+Lt/Tt+","+Dt/Tt+")","stroke-width":(1/((Lt/Tt+Dt/Tt)/2)).toFixed(4)}),qt.appendChild(fe),tt.defs.appendChild(qt),A[re]=1),R(fe,V);var Le=Y*(Nt!="diamond"&&Nt!="oval");T?(F=L._.arrows.startdx*Et||0,z=o.getTotalLength(Ct.path)-Le*Et):(F=Le*Et,z=o.getTotalLength(Ct.path)-(L._.arrows.enddx*Et||0)),(V={})["marker-"+at]="url(#"+re+")",(z||F)&&(V.d=o.getSubpath(Ct.path,F,z)),R(gt,V),L._.arrows[at+"Path"]=le,L._.arrows[at+"Marker"]=re,L._.arrows[at+"dx"]=Le,L._.arrows[at+"Type"]=Nt,L._.arrows[at+"String"]=M}else T?(F=L._.arrows.startdx*Et||0,z=o.getTotalLength(Ct.path)-F):(F=0,z=o.getTotalLength(Ct.path)-(L._.arrows.enddx*Et||0)),L._.arrows[at+"Path"]&&R(gt,{d:o.getSubpath(Ct.path,F,z)}),delete L._.arrows[at+"Path"],delete L._.arrows[at+"Marker"],delete L._.arrows[at+"dx"],delete L._.arrows[at+"Type"],delete L._.arrows[at+"String"];for(V in A)if(A[l](V)&&!A[V]){var Se=o._g.doc.getElementById(V);Se&&Se.parentNode.removeChild(Se)}}},q={"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},W=function(L,M,T){if(M=q[h(M).toLowerCase()]){for(var F=L.attrs["stroke-width"]||"1",z={round:F,square:F,butt:0}[L.attrs["stroke-linecap"]||T["stroke-linecap"]]||0,Y=[],D=M.length;D--;)Y[D]=M[D]*F+(D%2?1:-1)*z;R(L.node,{"stroke-dasharray":Y.join(",")})}else R(L.node,{"stroke-dasharray":"none"})},K=function(L,M){var T=L.node,F=L.attrs,z=T.style.visibility;for(var Y in T.style.visibility="hidden",M)if(M[l](Y)){if(!o._availableAttrs[l](Y))continue;var D=M[Y];switch(F[Y]=D,Y){case"blur":L.blur(D);break;case"title":var V=T.getElementsByTagName("title");if(V.length&&(V=V[0]))V.firstChild.nodeValue=D;else{V=R("title");var X=o._g.doc.createTextNode(D);V.appendChild(X),T.appendChild(V)}break;case"href":case"target":var tt=T.parentNode;if(tt.tagName.toLowerCase()!="a"){var at=R("a");tt.insertBefore(at,T),at.appendChild(T),tt=at}Y=="target"?tt.setAttributeNS(w,"show",D=="blank"?"new":D):tt.setAttributeNS(w,Y,D);break;case"cursor":T.style.cursor=D;break;case"transform":L.transform(D);break;case"arrow-start":N(L,D);break;case"arrow-end":N(L,D,1);break;case"clip-rect":var gt=h(D).split(y);if(gt.length==4){L.clip&&L.clip.parentNode.parentNode.removeChild(L.clip.parentNode);var Ct=R("clipPath"),Et=R("rect");Ct.id=o.createUUID(),R(Et,{x:gt[0],y:gt[1],width:gt[2],height:gt[3]}),Ct.appendChild(Et),L.paper.defs.appendChild(Ct),R(T,{"clip-path":"url(#"+Ct.id+")"}),L.clip=Et}if(!D){var bt=T.getAttribute("clip-path");if(bt){var Nt=o._g.doc.getElementById(bt.replace(/(^url\(#|\)$)/g,C));Nt&&Nt.parentNode.removeChild(Nt),R(T,{"clip-path":C}),delete L.clip}}break;case"path":L.type=="path"&&(R(T,{d:D?F.path=o._pathToAbsolute(D):"M0,0"}),L._.dirty=1,L._.arrows&&("startString"in L._.arrows&&N(L,L._.arrows.startString),"endString"in L._.arrows&&N(L,L._.arrows.endString,1)));break;case"width":if(T.setAttribute(Y,D),L._.dirty=1,!F.fx)break;Y="x",D=F.x;case"x":F.fx&&(D=-F.x-(F.width||0));case"rx":if(Y=="rx"&&L.type=="rect")break;case"cx":T.setAttribute(Y,D),L.pattern&&I(L),L._.dirty=1;break;case"height":if(T.setAttribute(Y,D),L._.dirty=1,!F.fy)break;Y="y",D=F.y;case"y":F.fy&&(D=-F.y-(F.height||0));case"ry":if(Y=="ry"&&L.type=="rect")break;case"cy":T.setAttribute(Y,D),L.pattern&&I(L),L._.dirty=1;break;case"r":L.type=="rect"?R(T,{rx:D,ry:D}):T.setAttribute(Y,D),L._.dirty=1;break;case"src":L.type=="image"&&T.setAttributeNS(w,"href",D);break;case"stroke-width":L._.sx==1&&L._.sy==1||(D/=u(p(L._.sx),p(L._.sy))||1),T.setAttribute(Y,D),F["stroke-dasharray"]&&W(L,F["stroke-dasharray"],M),L._.arrows&&("startString"in L._.arrows&&N(L,L._.arrows.startString),"endString"in L._.arrows&&N(L,L._.arrows.endString,1));break;case"stroke-dasharray":W(L,D,M);break;case"fill":var Lt=h(D).match(o._ISURL);if(Lt){Ct=R("pattern");var Dt=R("image");Ct.id=o.createUUID(),R(Ct,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),R(Dt,{x:0,y:0,"xlink:href":Lt[1]}),Ct.appendChild(Dt),function(qt){o._preload(Lt[1],function(){var Le=this.offsetWidth,Se=this.offsetHeight;R(qt,{width:Le,height:Se}),R(Dt,{width:Le,height:Se})})}(Ct),L.paper.defs.appendChild(Ct),R(T,{fill:"url(#"+Ct.id+")"}),L.pattern=Ct,L.pattern&&I(L);break}var Tt=o.getRGB(D);if(Tt.error){if((L.type=="circle"||L.type=="ellipse"||h(D).charAt()!="r")&&P(L,D)){if("opacity"in F||"fill-opacity"in F){var le=o._g.doc.getElementById(T.getAttribute("fill").replace(/^url\(#|\)$/g,C));if(le){var re=le.getElementsByTagName("stop");R(re[re.length-1],{"stop-opacity":("opacity"in F?F.opacity:1)*("fill-opacity"in F?F["fill-opacity"]:1)})}}F.gradient=D,F.fill="none";break}}else delete M.gradient,delete F.gradient,!o.is(F.opacity,"undefined")&&o.is(M.opacity,"undefined")&&R(T,{opacity:F.opacity}),!o.is(F["fill-opacity"],"undefined")&&o.is(M["fill-opacity"],"undefined")&&R(T,{"fill-opacity":F["fill-opacity"]});Tt[l]("opacity")&&R(T,{"fill-opacity":Tt.opacity>1?Tt.opacity/100:Tt.opacity});case"stroke":Tt=o.getRGB(D),T.setAttribute(Y,Tt.hex),Y=="stroke"&&Tt[l]("opacity")&&R(T,{"stroke-opacity":Tt.opacity>1?Tt.opacity/100:Tt.opacity}),Y=="stroke"&&L._.arrows&&("startString"in L._.arrows&&N(L,L._.arrows.startString),"endString"in L._.arrows&&N(L,L._.arrows.endString,1));break;case"gradient":(L.type=="circle"||L.type=="ellipse"||h(D).charAt()!="r")&&P(L,D);break;case"opacity":F.gradient&&!F[l]("stroke-opacity")&&R(T,{"stroke-opacity":D>1?D/100:D});case"fill-opacity":if(F.gradient){(le=o._g.doc.getElementById(T.getAttribute("fill").replace(/^url\(#|\)$/g,C)))&&(re=le.getElementsByTagName("stop"),R(re[re.length-1],{"stop-opacity":D}));break}default:Y=="font-size"&&(D=d(D,10)+"px");var fe=Y.replace(/(\-.)/g,function(qt){return qt.substring(1).toUpperCase()});T.style[fe]=D,L._.dirty=1,T.setAttribute(Y,D)}}it(L,M),T.style.visibility=z},it=function(L,M){if(L.type=="text"&&(M[l]("text")||M[l]("font")||M[l]("font-size")||M[l]("x")||M[l]("y"))){var T=L.attrs,F=L.node,z=F.firstChild?d(o._g.doc.defaultView.getComputedStyle(F.firstChild,C).getPropertyValue("font-size"),10):10;if(M[l]("text")){for(T.text=M.text;F.firstChild;)F.removeChild(F.firstChild);for(var Y,D=h(M.text).split(`
|
|
27
|
+
`),V=[],X=0,tt=D.length;X<tt;X++)Y=R("tspan"),X&&R(Y,{dy:1.2*z,x:T.x}),Y.appendChild(o._g.doc.createTextNode(D[X])),F.appendChild(Y),V[X]=Y}else for(X=0,tt=(V=F.getElementsByTagName("tspan")).length;X<tt;X++)X?R(V[X],{dy:1.2*z,x:T.x}):R(V[0],{dy:0});R(F,{x:T.x,y:T.y}),L._.dirty=1;var at=L._getBBox(),gt=T.y-(at.y+at.height/2);gt&&o.is(gt,"finite")&&R(V[0],{dy:gt})}},pt=function(L){return L.parentNode&&L.parentNode.tagName.toLowerCase()==="a"?L.parentNode:L},vt=function(L,M){this[0]=this.node=L,L.raphael=!0,this.id=("0000"+(Math.random()*Math.pow(36,5)<<0).toString(36)).slice(-5),L.raphaelid=this.id,this.matrix=o.matrix(),this.realPath=null,this.paper=M,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!M.bottom&&(M.bottom=this),this.prev=M.top,M.top&&(M.top.next=this),M.top=this,this.next=null},dt=o.el;vt.prototype=dt,dt.constructor=vt,o._engine.path=function(L,M){var T=R("path");M.canvas&&M.canvas.appendChild(T);var F=new vt(T,M);return F.type="path",K(F,{fill:"none",stroke:"#000",path:L}),F},dt.rotate=function(L,M,T){if(this.removed)return this;if((L=h(L).split(y)).length-1&&(M=c(L[1]),T=c(L[2])),L=c(L[0]),T==null&&(M=T),M==null||T==null){var F=this.getBBox(1);M=F.x+F.width/2,T=F.y+F.height/2}return this.transform(this._.transform.concat([["r",L,M,T]])),this},dt.scale=function(L,M,T,F){if(this.removed)return this;if((L=h(L).split(y)).length-1&&(M=c(L[1]),T=c(L[2]),F=c(L[3])),L=c(L[0]),M==null&&(M=L),F==null&&(T=F),T==null||F==null)var z=this.getBBox(1);return T=T??z.x+z.width/2,F=F??z.y+z.height/2,this.transform(this._.transform.concat([["s",L,M,T,F]])),this},dt.translate=function(L,M){return this.removed?this:((L=h(L).split(y)).length-1&&(M=c(L[1])),L=c(L[0])||0,M=+M||0,this.transform(this._.transform.concat([["t",L,M]])),this)},dt.transform=function(L){var M=this._;if(L==null)return M.transform;if(o._extractTransform(this,L),this.clip&&R(this.clip,{transform:this.matrix.invert()}),this.pattern&&I(this),this.node&&R(this.node,{transform:this.matrix}),M.sx!=1||M.sy!=1){var T=this.attrs[l]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":T})}return this},dt.hide=function(){return this.removed||(this.node.style.display="none"),this},dt.show=function(){return this.removed||(this.node.style.display=""),this},dt.remove=function(){var L=pt(this.node);if(!this.removed&&L.parentNode){var M=this.paper;for(var T in M.__set__&&M.__set__.exclude(this),S.unbind("raphael.*.*."+this.id),this.gradient&&M.defs.removeChild(this.gradient),o._tear(this,M),L.parentNode.removeChild(L),this.removeData(),this)this[T]=typeof this[T]=="function"?o._removedFactory(T):null;this.removed=!0}},dt._getBBox=function(){if(this.node.style.display=="none"){this.show();var L=!0}var M,T=!1;this.paper.canvas.parentElement?M=this.paper.canvas.parentElement.style:this.paper.canvas.parentNode&&(M=this.paper.canvas.parentNode.style),M&&M.display=="none"&&(T=!0,M.display="");var F={};try{F=this.node.getBBox()}catch{F={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}finally{F=F||{},T&&(M.display="none")}return L&&this.hide(),F},dt.attr=function(L,M){if(this.removed)return this;if(L==null){var T={};for(var F in this.attrs)this.attrs[l](F)&&(T[F]=this.attrs[F]);return T.gradient&&T.fill=="none"&&(T.fill=T.gradient)&&delete T.gradient,T.transform=this._.transform,T}if(M==null&&o.is(L,"string")){if(L=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;if(L=="transform")return this._.transform;for(var z=L.split(y),Y={},D=0,V=z.length;D<V;D++)(L=z[D])in this.attrs?Y[L]=this.attrs[L]:o.is(this.paper.customAttributes[L],"function")?Y[L]=this.paper.customAttributes[L].def:Y[L]=o._availableAttrs[L];return V-1?Y:Y[z[0]]}if(M==null&&o.is(L,"array")){for(Y={},D=0,V=L.length;D<V;D++)Y[L[D]]=this.attr(L[D]);return Y}if(M!=null){var X={};X[L]=M}else L!=null&&o.is(L,"object")&&(X=L);for(var tt in X)S("raphael.attr."+tt+"."+this.id,this,X[tt]);for(tt in this.paper.customAttributes)if(this.paper.customAttributes[l](tt)&&X[l](tt)&&o.is(this.paper.customAttributes[tt],"function")){var at=this.paper.customAttributes[tt].apply(this,[].concat(X[tt]));for(var gt in this.attrs[tt]=X[tt],at)at[l](gt)&&(X[gt]=at[gt])}return K(this,X),this},dt.toFront=function(){if(this.removed)return this;var L=pt(this.node);L.parentNode.appendChild(L);var M=this.paper;return M.top!=this&&o._tofront(this,M),this},dt.toBack=function(){if(this.removed)return this;var L=pt(this.node),M=L.parentNode;return M.insertBefore(L,M.firstChild),o._toback(this,this.paper),this.paper,this},dt.insertAfter=function(L){if(this.removed||!L)return this;var M=pt(this.node),T=pt(L.node||L[L.length-1].node);return T.nextSibling?T.parentNode.insertBefore(M,T.nextSibling):T.parentNode.appendChild(M),o._insertafter(this,L,this.paper),this},dt.insertBefore=function(L){if(this.removed||!L)return this;var M=pt(this.node),T=pt(L.node||L[0].node);return T.parentNode.insertBefore(M,T),o._insertbefore(this,L,this.paper),this},dt.blur=function(L){var M=this;if(+L!=0){var T=R("filter"),F=R("feGaussianBlur");M.attrs.blur=L,T.id=o.createUUID(),R(F,{stdDeviation:+L||1.5}),T.appendChild(F),M.paper.defs.appendChild(T),M._blur=T,R(M.node,{filter:"url(#"+T.id+")"})}else M._blur&&(M._blur.parentNode.removeChild(M._blur),delete M._blur,delete M.attrs.blur),M.node.removeAttribute("filter");return M},o._engine.circle=function(L,M,T,F){var z=R("circle");L.canvas&&L.canvas.appendChild(z);var Y=new vt(z,L);return Y.attrs={cx:M,cy:T,r:F,fill:"none",stroke:"#000"},Y.type="circle",R(z,Y.attrs),Y},o._engine.rect=function(L,M,T,F,z,Y){var D=R("rect");L.canvas&&L.canvas.appendChild(D);var V=new vt(D,L);return V.attrs={x:M,y:T,width:F,height:z,rx:Y||0,ry:Y||0,fill:"none",stroke:"#000"},V.type="rect",R(D,V.attrs),V},o._engine.ellipse=function(L,M,T,F,z){var Y=R("ellipse");L.canvas&&L.canvas.appendChild(Y);var D=new vt(Y,L);return D.attrs={cx:M,cy:T,rx:F,ry:z,fill:"none",stroke:"#000"},D.type="ellipse",R(Y,D.attrs),D},o._engine.image=function(L,M,T,F,z,Y){var D=R("image");R(D,{x:T,y:F,width:z,height:Y,preserveAspectRatio:"none"}),D.setAttributeNS(w,"href",M),L.canvas&&L.canvas.appendChild(D);var V=new vt(D,L);return V.attrs={x:T,y:F,width:z,height:Y,src:M},V.type="image",V},o._engine.text=function(L,M,T,F){var z=R("text");L.canvas&&L.canvas.appendChild(z);var Y=new vt(z,L);return Y.attrs={x:M,y:T,"text-anchor":"middle",text:F,"font-family":o._availableAttrs["font-family"],"font-size":o._availableAttrs["font-size"],stroke:"none",fill:"#000"},Y.type="text",K(Y,Y.attrs),Y},o._engine.setSize=function(L,M){return this.width=L||this.width,this.height=M||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox),this},o._engine.create=function(){var L=o._getContainer.apply(0,arguments),M=L&&L.container;if(!M)throw new Error("SVG container not found.");var T,F=L.x,z=L.y,Y=L.width,D=L.height,V=R("svg"),X="overflow:hidden;";return F=F||0,z=z||0,R(V,{height:D=D||342,version:1.1,width:Y=Y||512,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}),M==1?(V.style.cssText=X+"position:absolute;left:"+F+"px;top:"+z+"px",o._g.doc.body.appendChild(V),T=1):(V.style.cssText=X+"position:relative",M.firstChild?M.insertBefore(V,M.firstChild):M.appendChild(V)),(M=new o._Paper).width=Y,M.height=D,M.canvas=V,M.clear(),M._left=M._top=0,T&&(M.renderfix=function(){}),M.renderfix(),M},o._engine.setViewBox=function(L,M,T,F,z){S("raphael.setViewBox",this,this._viewBox,[L,M,T,F,z]);var Y,D,V=this.getSize(),X=u(T/V.width,F/V.height),tt=this.top,at=z?"xMidYMid meet":"xMinYMin";for(L==null?(this._vbSize&&(X=1),delete this._vbSize,Y="0 0 "+this.width+_+this.height):(this._vbSize=X,Y=L+_+M+_+T+_+F),R(this.canvas,{viewBox:Y,preserveAspectRatio:at});X&&tt;)D="stroke-width"in tt.attrs?tt.attrs["stroke-width"]:1,tt.attr({"stroke-width":D}),tt._.dirty=1,tt._.dirtyT=1,tt=tt.prev;return this._viewBox=[L,M,T,F,!!z],this},o.prototype.renderfix=function(){var L,M=this.canvas,T=M.style;try{L=M.getScreenCTM()||M.createSVGMatrix()}catch{L=M.createSVGMatrix()}var F=-L.e%1,z=-L.f%1;(F||z)&&(F&&(this._left=(this._left+F)%1,T.left=this._left+"px"),z&&(this._top=(this._top+z)%1,T.top=this._top+"px"))},o.prototype.clear=function(){o.eve("raphael.clear",this);for(var L=this.canvas;L.firstChild;)L.removeChild(L.firstChild);this.bottom=this.top=null,(this.desc=R("desc")).appendChild(o._g.doc.createTextNode("Created with Raphaël "+o.version)),L.appendChild(this.desc),L.appendChild(this.defs=R("defs"))},o.prototype.remove=function(){for(var L in S("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this)this[L]=typeof this[L]=="function"?o._removedFactory(L):null};var _t=o.st;for(var yt in dt)dt[l](yt)&&!_t[l](yt)&&(_t[yt]=function(L){return function(){var M=arguments;return this.forEach(function(T){T[L].apply(T,M)})}}(yt))}}.apply(n,s))===void 0||(e.exports=a)},function(e,n,r){var s,a;s=[r(0)],(a=function(o){if(!o||o.vml){var l="hasOwnProperty",h=String,c=parseFloat,d=Math,f=d.round,u=d.max,p=d.min,m=d.abs,y=/[, ]+/,S=o.eve,C=" ",_="",w={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},k=/([clmz]),?([^clmz]*)/gi,A=/ progid:\S+Blur\([^\)]+\)/g,R=/-?[^,\s-]+/g,P="position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)",U=21600,I={path:1,rect:1,image:1},N={circle:1,ellipse:1},q=function(M,T,F){var z=o.matrix();return z.rotate(-M,.5,.5),{dx:z.x(T,F),dy:z.y(T,F)}},W=function(M,T,F,z,Y,D){var V=M._,X=M.matrix,tt=V.fillpos,at=M.node,gt=at.style,Ct=1,Et="",bt=U/T,Nt=U/F;if(gt.visibility="hidden",T&&F){if(at.coordsize=m(bt)+C+m(Nt),gt.rotation=D*(T*F<0?-1:1),D){var Lt=q(D,z,Y);z=Lt.dx,Y=Lt.dy}if(T<0&&(Et+="x"),F<0&&(Et+=" y")&&(Ct=-1),gt.flip=Et,at.coordorigin=z*-bt+C+Y*-Nt,tt||V.fillsize){var Dt=at.getElementsByTagName("fill");Dt=Dt&&Dt[0],at.removeChild(Dt),tt&&(Lt=q(D,X.x(tt[0],tt[1]),X.y(tt[0],tt[1])),Dt.position=Lt.dx*Ct+C+Lt.dy*Ct),V.fillsize&&(Dt.size=V.fillsize[0]*m(T)+C+V.fillsize[1]*m(F)),at.appendChild(Dt)}gt.visibility="visible"}};o.toString=function(){return`Your browser doesn’t support SVG. Falling down to VML.
|
|
28
|
+
You are running Raphaël `+this.version};var K,it=function(M,T,F){for(var z=h(T).toLowerCase().split("-"),Y=F?"end":"start",D=z.length,V="classic",X="medium",tt="medium";D--;)switch(z[D]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":V=z[D];break;case"wide":case"narrow":tt=z[D];break;case"long":case"short":X=z[D]}var at=M.node.getElementsByTagName("stroke")[0];at[Y+"arrow"]=V,at[Y+"arrowlength"]=X,at[Y+"arrowwidth"]=tt},pt=function(M,T){M.attrs=M.attrs||{};var F=M.node,z=M.attrs,Y=F.style,D=I[M.type]&&(T.x!=z.x||T.y!=z.y||T.width!=z.width||T.height!=z.height||T.cx!=z.cx||T.cy!=z.cy||T.rx!=z.rx||T.ry!=z.ry||T.r!=z.r),V=N[M.type]&&(z.cx!=T.cx||z.cy!=T.cy||z.r!=T.r||z.rx!=T.rx||z.ry!=T.ry),X=M;for(var tt in T)T[l](tt)&&(z[tt]=T[tt]);if(D&&(z.path=o._getPath[M.type](M),M._.dirty=1),T.href&&(F.href=T.href),T.title&&(F.title=T.title),T.target&&(F.target=T.target),T.cursor&&(Y.cursor=T.cursor),"blur"in T&&M.blur(T.blur),(T.path&&M.type=="path"||D)&&(F.path=function(ye){var zi=/[ahqstv]/gi,Zn=o._pathToAbsolute;if(h(ye).match(zi)&&(Zn=o._path2curve),zi=/[clmz]/g,Zn==o._pathToAbsolute&&!h(ye).match(zi)){var Ge=h(ye).replace(k,function(F1,tr,er){var ji=[],no=tr.toLowerCase()=="m",pn=w[tr];return er.replace(R,function(ro){no&&ji.length==2&&(pn+=ji+w[tr=="m"?"l":"L"],ji=[]),ji.push(f(ro*U))}),pn+ji});return Ge}var Jn,He,Us=Zn(ye);Ge=[];for(var Qn=0,Bs=Us.length;Qn<Bs;Qn++){Jn=Us[Qn],(He=Us[Qn][0].toLowerCase())=="z"&&(He="x");for(var Hi=1,ke=Jn.length;Hi<ke;Hi++)He+=f(Jn[Hi]*U)+(Hi!=ke-1?",":_);Ge.push(He)}return Ge.join(C)}(~h(z.path).toLowerCase().indexOf("r")?o._pathToAbsolute(z.path):z.path),M._.dirty=1,M.type=="image"&&(M._.fillpos=[z.x,z.y],M._.fillsize=[z.width,z.height],W(M,1,1,0,0,0))),"transform"in T&&M.transform(T.transform),V){var at=+z.cx,gt=+z.cy,Ct=+z.rx||+z.r||0,Et=+z.ry||+z.r||0;F.path=o.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((at-Ct)*U),f((gt-Et)*U),f((at+Ct)*U),f((gt+Et)*U),f(at*U)),M._.dirty=1}if("clip-rect"in T){var bt=h(T["clip-rect"]).split(y);if(bt.length==4){bt[2]=+bt[2]+ +bt[0],bt[3]=+bt[3]+ +bt[1];var Nt=F.clipRect||o._g.doc.createElement("div"),Lt=Nt.style;Lt.clip=o.format("rect({1}px {2}px {3}px {0}px)",bt),F.clipRect||(Lt.position="absolute",Lt.top=0,Lt.left=0,Lt.width=M.paper.width+"px",Lt.height=M.paper.height+"px",F.parentNode.insertBefore(Nt,F),Nt.appendChild(F),F.clipRect=Nt)}T["clip-rect"]||F.clipRect&&(F.clipRect.style.clip="auto")}if(M.textpath){var Dt=M.textpath.style;T.font&&(Dt.font=T.font),T["font-family"]&&(Dt.fontFamily='"'+T["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,_)+'"'),T["font-size"]&&(Dt.fontSize=T["font-size"]),T["font-weight"]&&(Dt.fontWeight=T["font-weight"]),T["font-style"]&&(Dt.fontStyle=T["font-style"])}if("arrow-start"in T&&it(X,T["arrow-start"]),"arrow-end"in T&&it(X,T["arrow-end"],1),T.opacity!=null||T.fill!=null||T.src!=null||T.stroke!=null||T["stroke-width"]!=null||T["stroke-opacity"]!=null||T["fill-opacity"]!=null||T["stroke-dasharray"]!=null||T["stroke-miterlimit"]!=null||T["stroke-linejoin"]!=null||T["stroke-linecap"]!=null){var Tt=F.getElementsByTagName("fill");if(!(Tt=Tt&&Tt[0])&&(Tt=K("fill")),M.type=="image"&&T.src&&(Tt.src=T.src),T.fill&&(Tt.on=!0),Tt.on!=null&&T.fill!="none"&&T.fill!==null||(Tt.on=!1),Tt.on&&T.fill){var le=h(T.fill).match(o._ISURL);if(le){Tt.parentNode==F&&F.removeChild(Tt),Tt.rotate=!0,Tt.src=le[1],Tt.type="tile";var re=M.getBBox(1);Tt.position=re.x+C+re.y,M._.fillpos=[re.x,re.y],o._preload(le[1],function(){M._.fillsize=[this.offsetWidth,this.offsetHeight]})}else Tt.color=o.getRGB(T.fill).hex,Tt.src=_,Tt.type="solid",o.getRGB(T.fill).error&&(X.type in{circle:1,ellipse:1}||h(T.fill).charAt()!="r")&&vt(X,T.fill,Tt)&&(z.fill="none",z.gradient=T.fill,Tt.rotate=!1)}if("fill-opacity"in T||"opacity"in T){var fe=((+z["fill-opacity"]+1||2)-1)*((+z.opacity+1||2)-1)*((+o.getRGB(T.fill).o+1||2)-1);fe=p(u(fe,0),1),Tt.opacity=fe,Tt.src&&(Tt.color="none")}F.appendChild(Tt);var qt=F.getElementsByTagName("stroke")&&F.getElementsByTagName("stroke")[0],Le=!1;!qt&&(Le=qt=K("stroke")),(T.stroke&&T.stroke!="none"||T["stroke-width"]||T["stroke-opacity"]!=null||T["stroke-dasharray"]||T["stroke-miterlimit"]||T["stroke-linejoin"]||T["stroke-linecap"])&&(qt.on=!0),(T.stroke=="none"||T.stroke===null||qt.on==null||T.stroke==0||T["stroke-width"]==0)&&(qt.on=!1);var Se=o.getRGB(T.stroke);qt.on&&T.stroke&&(qt.color=Se.hex),fe=((+z["stroke-opacity"]+1||2)-1)*((+z.opacity+1||2)-1)*((+Se.o+1||2)-1);var Gi=.75*(c(T["stroke-width"])||1);if(fe=p(u(fe,0),1),T["stroke-width"]==null&&(Gi=z["stroke-width"]),T["stroke-width"]&&(qt.weight=Gi),Gi&&Gi<1&&(fe*=Gi)&&(qt.weight=1),qt.opacity=fe,T["stroke-linejoin"]&&(qt.joinstyle=T["stroke-linejoin"]||"miter"),qt.miterlimit=T["stroke-miterlimit"]||8,T["stroke-linecap"]&&(qt.endcap=T["stroke-linecap"]=="butt"?"flat":T["stroke-linecap"]=="square"?"square":"round"),"stroke-dasharray"in T){var Fs={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};qt.dashstyle=Fs[l](T["stroke-dasharray"])?Fs[T["stroke-dasharray"]]:_}Le&&F.appendChild(qt)}if(X.type=="text"){X.paper.canvas.style.display=_;var $i=X.paper.span,Yn=z.font&&z.font.match(/\d+(?:\.\d*)?(?=px)/);Y=$i.style,z.font&&(Y.font=z.font),z["font-family"]&&(Y.fontFamily=z["font-family"]),z["font-weight"]&&(Y.fontWeight=z["font-weight"]),z["font-style"]&&(Y.fontStyle=z["font-style"]),Yn=c(z["font-size"]||Yn&&Yn[0])||10,Y.fontSize=100*Yn+"px",X.textpath.string&&($i.innerHTML=h(X.textpath.string).replace(/</g,"<").replace(/&/g,"&").replace(/\n/g,"<br>"));var Wn=$i.getBoundingClientRect();X.W=z.w=(Wn.right-Wn.left)/100,X.H=z.h=(Wn.bottom-Wn.top)/100,X.X=z.x,X.Y=z.y+X.H/2,("x"in T||"y"in T)&&(X.path.v=o.format("m{0},{1}l{2},{1}",f(z.x*U),f(z.y*U),f(z.x*U)+1));for(var Ns=["x","y","text","font","font-family","font-weight","font-style","font-size"],Kn=0,io=Ns.length;Kn<io;Kn++)if(Ns[Kn]in T){X._.dirty=1;break}switch(z["text-anchor"]){case"start":X.textpath.style["v-text-align"]="left",X.bbx=X.W/2;break;case"end":X.textpath.style["v-text-align"]="right",X.bbx=-X.W/2;break;default:X.textpath.style["v-text-align"]="center",X.bbx=0}X.textpath.style["v-text-kern"]=!0}},vt=function(M,T,F){M.attrs=M.attrs||{},M.attrs;var z=Math.pow,Y="linear",D=".5 .5";if(M.attrs.gradient=T,T=(T=h(T).replace(o._radial_gradient,function(Ct,Et,bt){return Y="radial",Et&&bt&&(Et=c(Et),bt=c(bt),z(Et-.5,2)+z(bt-.5,2)>.25&&(bt=d.sqrt(.25-z(Et-.5,2))*(2*(bt>.5)-1)+.5),D=Et+C+bt),_})).split(/\s*\-\s*/),Y=="linear"){var V=T.shift();if(V=-c(V),isNaN(V))return null}var X=o._parseDots(T);if(!X)return null;if(M=M.shape||M.node,X.length){M.removeChild(F),F.on=!0,F.method="none",F.color=X[0].color,F.color2=X[X.length-1].color;for(var tt=[],at=0,gt=X.length;at<gt;at++)X[at].offset&&tt.push(X[at].offset+C+X[at].color);F.colors=tt.length?tt.join():"0% "+F.color,Y=="radial"?(F.type="gradientTitle",F.focus="100%",F.focussize="0 0",F.focusposition=D,F.angle=0):(F.type="gradient",F.angle=(270-V)%360),M.appendChild(F)}return 1},dt=function(M,T){this[0]=this.node=M,M.raphael=!0,this.id=o._oid++,M.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=T,this.matrix=o.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!T.bottom&&(T.bottom=this),this.prev=T.top,T.top&&(T.top.next=this),T.top=this,this.next=null},_t=o.el;dt.prototype=_t,_t.constructor=dt,_t.transform=function(M){if(M==null)return this._.transform;var T,F=this.paper._viewBoxShift,z=F?"s"+[F.scale,F.scale]+"-1-1t"+[F.dx,F.dy]:_;F&&(T=M=h(M).replace(/\.{3}|\u2026/g,this._.transform||_)),o._extractTransform(this,z+M);var Y,D=this.matrix.clone(),V=this.skew,X=this.node,tt=~h(this.attrs.fill).indexOf("-"),at=!h(this.attrs.fill).indexOf("url(");if(D.translate(1,1),at||tt||this.type=="image")if(V.matrix="1 0 0 1",V.offset="0 0",Y=D.split(),tt&&Y.noRotation||!Y.isSimple){X.style.filter=D.toFilter();var gt=this.getBBox(),Ct=this.getBBox(1),Et=gt.x-Ct.x,bt=gt.y-Ct.y;X.coordorigin=Et*-U+C+bt*-U,W(this,1,1,Et,bt,0)}else X.style.filter=_,W(this,Y.scalex,Y.scaley,Y.dx,Y.dy,Y.rotate);else X.style.filter=_,V.matrix=h(D),V.offset=D.offset();return T!==null&&(this._.transform=T,o._extractTransform(this,T)),this},_t.rotate=function(M,T,F){if(this.removed)return this;if(M!=null){if((M=h(M).split(y)).length-1&&(T=c(M[1]),F=c(M[2])),M=c(M[0]),F==null&&(T=F),T==null||F==null){var z=this.getBBox(1);T=z.x+z.width/2,F=z.y+z.height/2}return this._.dirtyT=1,this.transform(this._.transform.concat([["r",M,T,F]])),this}},_t.translate=function(M,T){return this.removed?this:((M=h(M).split(y)).length-1&&(T=c(M[1])),M=c(M[0])||0,T=+T||0,this._.bbox&&(this._.bbox.x+=M,this._.bbox.y+=T),this.transform(this._.transform.concat([["t",M,T]])),this)},_t.scale=function(M,T,F,z){if(this.removed)return this;if((M=h(M).split(y)).length-1&&(T=c(M[1]),F=c(M[2]),z=c(M[3]),isNaN(F)&&(F=null),isNaN(z)&&(z=null)),M=c(M[0]),T==null&&(T=M),z==null&&(F=z),F==null||z==null)var Y=this.getBBox(1);return F=F??Y.x+Y.width/2,z=z??Y.y+Y.height/2,this.transform(this._.transform.concat([["s",M,T,F,z]])),this._.dirtyT=1,this},_t.hide=function(){return!this.removed&&(this.node.style.display="none"),this},_t.show=function(){return!this.removed&&(this.node.style.display=_),this},_t.auxGetBBox=o.el.getBBox,_t.getBBox=function(){var M=this.auxGetBBox();if(this.paper&&this.paper._viewBoxShift){var T={},F=1/this.paper._viewBoxShift.scale;return T.x=M.x-this.paper._viewBoxShift.dx,T.x*=F,T.y=M.y-this.paper._viewBoxShift.dy,T.y*=F,T.width=M.width*F,T.height=M.height*F,T.x2=T.x+T.width,T.y2=T.y+T.height,T}return M},_t._getBBox=function(){return this.removed?{}:{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},_t.remove=function(){if(!this.removed&&this.node.parentNode){for(var M in this.paper.__set__&&this.paper.__set__.exclude(this),o.eve.unbind("raphael.*.*."+this.id),o._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape),this)this[M]=typeof this[M]=="function"?o._removedFactory(M):null;this.removed=!0}},_t.attr=function(M,T){if(this.removed)return this;if(M==null){var F={};for(var z in this.attrs)this.attrs[l](z)&&(F[z]=this.attrs[z]);return F.gradient&&F.fill=="none"&&(F.fill=F.gradient)&&delete F.gradient,F.transform=this._.transform,F}if(T==null&&o.is(M,"string")){if(M=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;for(var Y=M.split(y),D={},V=0,X=Y.length;V<X;V++)(M=Y[V])in this.attrs?D[M]=this.attrs[M]:o.is(this.paper.customAttributes[M],"function")?D[M]=this.paper.customAttributes[M].def:D[M]=o._availableAttrs[M];return X-1?D:D[Y[0]]}if(this.attrs&&T==null&&o.is(M,"array")){for(D={},V=0,X=M.length;V<X;V++)D[M[V]]=this.attr(M[V]);return D}var tt;for(var at in T!=null&&((tt={})[M]=T),T==null&&o.is(M,"object")&&(tt=M),tt)S("raphael.attr."+at+"."+this.id,this,tt[at]);if(tt){for(at in this.paper.customAttributes)if(this.paper.customAttributes[l](at)&&tt[l](at)&&o.is(this.paper.customAttributes[at],"function")){var gt=this.paper.customAttributes[at].apply(this,[].concat(tt[at]));for(var Ct in this.attrs[at]=tt[at],gt)gt[l](Ct)&&(tt[Ct]=gt[Ct])}tt.text&&this.type=="text"&&(this.textpath.string=tt.text),pt(this,tt)}return this},_t.toFront=function(){return!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&o._tofront(this,this.paper),this},_t.toBack=function(){return this.removed?this:(this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),o._toback(this,this.paper)),this)},_t.insertAfter=function(M){return this.removed?this:(M.constructor==o.st.constructor&&(M=M[M.length-1]),M.node.nextSibling?M.node.parentNode.insertBefore(this.node,M.node.nextSibling):M.node.parentNode.appendChild(this.node),o._insertafter(this,M,this.paper),this)},_t.insertBefore=function(M){return this.removed?this:(M.constructor==o.st.constructor&&(M=M[0]),M.node.parentNode.insertBefore(this.node,M.node),o._insertbefore(this,M,this.paper),this)},_t.blur=function(M){var T=this.node.runtimeStyle,F=T.filter;return F=F.replace(A,_),+M!=0?(this.attrs.blur=M,T.filter=F+C+" progid:DXImageTransform.Microsoft.Blur(pixelradius="+(+M||1.5)+")",T.margin=o.format("-{0}px 0 0 -{0}px",f(+M||1.5))):(T.filter=F,T.margin=0,delete this.attrs.blur),this},o._engine.path=function(M,T){var F=K("shape");F.style.cssText=P,F.coordsize=U+C+U,F.coordorigin=T.coordorigin;var z=new dt(F,T),Y={fill:"none",stroke:"#000"};M&&(Y.path=M),z.type="path",z.path=[],z.Path=_,pt(z,Y),T.canvas&&T.canvas.appendChild(F);var D=K("skew");return D.on=!0,F.appendChild(D),z.skew=D,z.transform(_),z},o._engine.rect=function(M,T,F,z,Y,D){var V=o._rectPath(T,F,z,Y,D),X=M.path(V),tt=X.attrs;return X.X=tt.x=T,X.Y=tt.y=F,X.W=tt.width=z,X.H=tt.height=Y,tt.r=D,tt.path=V,X.type="rect",X},o._engine.ellipse=function(M,T,F,z,Y){var D=M.path();return D.attrs,D.X=T-z,D.Y=F-Y,D.W=2*z,D.H=2*Y,D.type="ellipse",pt(D,{cx:T,cy:F,rx:z,ry:Y}),D},o._engine.circle=function(M,T,F,z){var Y=M.path();return Y.attrs,Y.X=T-z,Y.Y=F-z,Y.W=Y.H=2*z,Y.type="circle",pt(Y,{cx:T,cy:F,r:z}),Y},o._engine.image=function(M,T,F,z,Y,D){var V=o._rectPath(F,z,Y,D),X=M.path(V).attr({stroke:"none"}),tt=X.attrs,at=X.node,gt=at.getElementsByTagName("fill")[0];return tt.src=T,X.X=tt.x=F,X.Y=tt.y=z,X.W=tt.width=Y,X.H=tt.height=D,tt.path=V,X.type="image",gt.parentNode==at&&at.removeChild(gt),gt.rotate=!0,gt.src=T,gt.type="tile",X._.fillpos=[F,z],X._.fillsize=[Y,D],at.appendChild(gt),W(X,1,1,0,0,0),X},o._engine.text=function(M,T,F,z){var Y=K("shape"),D=K("path"),V=K("textpath");T=T||0,F=F||0,z=z||"",D.v=o.format("m{0},{1}l{2},{1}",f(T*U),f(F*U),f(T*U)+1),D.textpathok=!0,V.string=h(z),V.on=!0,Y.style.cssText=P,Y.coordsize=U+C+U,Y.coordorigin="0 0";var X=new dt(Y,M),tt={fill:"#000",stroke:"none",font:o._availableAttrs.font,text:z};X.shape=Y,X.path=D,X.textpath=V,X.type="text",X.attrs.text=h(z),X.attrs.x=T,X.attrs.y=F,X.attrs.w=1,X.attrs.h=1,pt(X,tt),Y.appendChild(V),Y.appendChild(D),M.canvas.appendChild(Y);var at=K("skew");return at.on=!0,Y.appendChild(at),X.skew=at,X.transform(_),X},o._engine.setSize=function(M,T){var F=this.canvas.style;return this.width=M,this.height=T,M==+M&&(M+="px"),T==+T&&(T+="px"),F.width=M,F.height=T,F.clip="rect(0 "+M+" "+T+" 0)",this._viewBox&&o._engine.setViewBox.apply(this,this._viewBox),this},o._engine.setViewBox=function(M,T,F,z,Y){o.eve("raphael.setViewBox",this,this._viewBox,[M,T,F,z,Y]);var D,V,X=this.getSize(),tt=X.width,at=X.height;return Y&&(F*(D=at/z)<tt&&(M-=(tt-F*D)/2/D),z*(V=tt/F)<at&&(T-=(at-z*V)/2/V)),this._viewBox=[M,T,F,z,!!Y],this._viewBoxShift={dx:-M,dy:-T,scale:X},this.forEach(function(gt){gt.transform("...")}),this},o._engine.initWin=function(M){var T=M.document;T.styleSheets.length<31?T.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)"):T.styleSheets[0].addRule(".rvml","behavior:url(#default#VML)");try{!T.namespaces.rvml&&T.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),K=function(F){return T.createElement("<rvml:"+F+' class="rvml">')}}catch{K=function(z){return T.createElement("<"+z+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},o._engine.initWin(o._g.win),o._engine.create=function(){var M=o._getContainer.apply(0,arguments),T=M.container,F=M.height,z=M.width,Y=M.x,D=M.y;if(!T)throw new Error("VML container not found.");var V=new o._Paper,X=V.canvas=o._g.doc.createElement("div"),tt=X.style;return Y=Y||0,D=D||0,z=z||512,F=F||342,V.width=z,V.height=F,z==+z&&(z+="px"),F==+F&&(F+="px"),V.coordsize=216e5+C+216e5,V.coordorigin="0 0",V.span=o._g.doc.createElement("span"),V.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",X.appendChild(V.span),tt.cssText=o.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",z,F),T==1?(o._g.doc.body.appendChild(X),tt.left=Y+"px",tt.top=D+"px",tt.position="absolute"):T.firstChild?T.insertBefore(X,T.firstChild):T.appendChild(X),V.renderfix=function(){},V},o.prototype.clear=function(){o.eve("raphael.clear",this),this.canvas.innerHTML=_,this.span=o._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},o.prototype.remove=function(){for(var M in o.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas),this)this[M]=typeof this[M]=="function"?o._removedFactory(M):null;return!0};var yt=o.st;for(var L in _t)_t[l](L)&&!yt[l](L)&&(yt[L]=function(M){return function(){var T=arguments;return this.forEach(function(F){F[M].apply(F,T)})}}(L))}}.apply(n,s))===void 0||(e.exports=a)}])})})($f);var ly=$f.exports;const Fn=Ee(ly);function hy(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zf={},Tl={exports:{}},Hf;function cy(){return Hf||(Hf=1,function(i){(function(t){var e="0.4.0",n="hasOwnProperty",r=/[\.\/]/,s="*",a=function(){},o=function(f,u){return f-u},l,h,c={n:{}},d=function(f,u){var p=h,m=Array.prototype.slice.call(arguments,2),y=d.listeners(f),S=0,C,_=[],w={},k=[];l=f,h=0;for(var A=0,R=y.length;A<R;A++)"zIndex"in y[A]&&(_.push(y[A].zIndex),y[A].zIndex<0&&(w[y[A].zIndex]=y[A]));for(_.sort(o);_[S]<0;)if(C=w[_[S++]],k.push(C.apply(u,m)),h)return h=p,k;for(A=0;A<R;A++)if(C=y[A],"zIndex"in C)if(C.zIndex==_[S]){if(k.push(C.apply(u,m)),h)return h=p,k;do if(S++,C=w[_[S]],C&&k.push(C.apply(u,m)),h)return h=p,k;while(C)}else w[C.zIndex]=C;else if(k.push(C.apply(u,m)),h)return h=p,k;return h=p,k.length?k:null};d.listeners=function(f){var u=f.split(r),p=c,m,y,S,C,_,w,k,A,R=[p],P=[];for(C=0,_=u.length;C<_;C++){for(A=[],w=0,k=R.length;w<k;w++)for(p=R[w].n,y=[p[u[C]],p[s]],S=2;S--;)m=y[S],m&&(A.push(m),P=P.concat(m.f||[]));R=A}return P},d.on=function(f,u){for(var p=f.split(r),m=c,y=0,S=p.length;y<S;y++)m=m.n,!m[p[y]]&&(m[p[y]]={n:{}}),m=m[p[y]];for(m.f=m.f||[],y=0,S=m.f.length;y<S;y++)if(m.f[y]==u)return a;return m.f.push(u),function(C){+C==+C&&(u.zIndex=+C)}},d.stop=function(){h=1},d.nt=function(f){return f?new RegExp("(?:\\.|\\/|^)"+f+"(?:\\.|\\/|$)").test(l):l},d.unbind=function(f,u){var p=f.split(r),m,y,S,C,_,w,k,A=[c];for(C=0,_=p.length;C<_;C++)for(w=0;w<A.length;w+=S.length-2){if(S=[w,1],m=A[w].n,p[C]!=s)m[p[C]]&&S.push(m[p[C]]);else for(y in m)m[n](y)&&S.push(m[y]);A.splice.apply(A,S)}for(C=0,_=A.length;C<_;C++)for(m=A[C];m.n;){if(u){if(m.f){for(w=0,k=m.f.length;w<k;w++)if(m.f[w]==u){m.f.splice(w,1);break}!m.f.length&&delete m.f}for(y in m.n)if(m.n[n](y)&&m.n[y].f){var R=m.n[y].f;for(w=0,k=R.length;w<k;w++)if(R[w]==u){R.splice(w,1);break}!R.length&&delete m.n[y].f}}else{delete m.f;for(y in m.n)m.n[n](y)&&m.n[y].f&&delete m.n[y].f}m=m.n}},d.once=function(f,u){var p=function(){u.apply(this,arguments),d.unbind(f,p)};return d.on(f,p)},d.version=e,d.toString=function(){return"You are running Eve "+e},i.exports?i.exports=d:t.eve=d})(Bo)}(Tl)),Tl.exports}(function(i){if(typeof hy=="function")var t=cy();(function(){function e(f){var u=function(p){u.parse(p)};return u.mode="text",u.type=String(f||"html").toLowerCase(),u.textchunk="",u.raw="",u.parse=l,u.on=a,u.event=s,u.end=r,u}function n(f,u,p){f==`
|
|
29
|
+
`&&this.event("newline"),d[this.mode].call(this,f,u,p)}function r(){n.call(this,"eof"),this.event("eof")}function s(f,u,p){typeof t=="function"&&t("elemental."+f+"."+u,null,u,p||"",this.raw);for(var m=this.events&&this.events[f],y=m&&m.length;y--;)try{this.events[f][y](u,p||"",this.raw)}catch{}this.raw=""}function a(f,u){this.events=this.events||{},this.events[f]=this.events[f]||[],this.events[f].push(u)}function o(f,u){return f&&(f.charAt?f.charAt(u):f[u])}function l(f){f=f||Object(f);for(var u=1,p=f.length+1,m,y,S=o(f,0);u<p;u++)m=y,y=S,S=o(f,u),this.raw+=y,n.call(this,y,S,m);this._beforeEnd=function(){n.call(this,"","",y)}}var h=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000]/,c=function(){for(var f in this.attr)this.attr.hasOwnProperty(f)&&this.event("attr",f,{value:this.attr[f],tagname:this.tagname,attr:this.attr})},d={text:function(f,u,p){switch(f){case"<":case"eof":this.nodename="",this.attr={},this.mode="tag name start",this.raw=this.raw.slice(0,-1),this.textchunk&&this.event("text",this.textchunk),this.raw+=f,this.textchunk="";break;default:this.textchunk+=f}},special:function(f,u,p){if(p=="!"&&f=="-"&&u=="-")this.mode="comment start";else{if(this.textchunk=="[CDATA"&&f=="["){this.mode="cdata",this.textchunk="";return}if(f==">"||f=="eof"){this.event("special",this.textchunk),this.mode="text",this.textchunk="";return}this.textchunk+=f}},cdata:function(f,u,p){p=="]"&&f=="]"&&u==">"?(this.mode="cdata end",this.textchunk=this.textchunk.slice(0,-1)):(f=="eof"&&d["cdata end"].call(this),this.textchunk+=f)},"cdata end":function(f,u,p){this.event("cdata",this.textchunk),this.textchunk="",this.mode="text"},"comment start":function(f,u,p){u==">"||f=="eof"?(this.event("comment",""),this.mode="comment instant end"):this.mode="comment"},"comment instant end":function(f,u,p){this.mode="text"},comment:function(f,u,p){f=="-"&&p=="-"&&u==">"?(this.mode="comment end",this.textchunk=this.textchunk.slice(0,-1)):f=="eof"?this.event("comment",this.textchunk):this.textchunk+=f},"comment end":function(f,u,p){this.event("comment",this.textchunk),this.textchunk="",this.mode="text"},declaration:function(f,u,p){f=="?"&&u==">"?this.mode="declaration end":(f=="eof"&&this.event("comment",this.textchunk),this.textchunk+=f)},"declaration end":function(f,u,p){this.event("comment",this.textchunk),this.textchunk="",this.mode="text"},"tag name start":function(f,u,p){if(f=="eof")this.event("text","<");else if(!h.test(f)){if(this.mode="tag name",f=="/"){this.mode="close tag name start";return}if(f=="!"){this.mode="special",this.textchunk="";return}if(f=="?"){this.mode="declaration";return}d[this.mode].call(this,f,u,p)}},"close tag name start":function(f,u,p){h.test(f)||(this.mode="close tag name",this.tagname="",this.nodename="",d[this.mode].call(this,f,u,p))},"close tag name":function(f,u,p){if(h.test(f))this.tagname=this.nodename;else switch(f){case">":this.event("/tag",this.tagname||this.nodename),this.mode="text";break;default:!this.tagname&&(this.nodename+=f)}},"tag name":function(f,u,p){if(h.test(f))this.tagname=this.nodename,this.nodename="",this.mode="attr start";else switch(f){case">":this.event("tag",this.nodename),this.mode="text";break;default:this.nodename+=f}},"attr start":function(f,u,p){h.test(f)||(this.mode="attr",this.nodename="",d[this.mode].call(this,f,u,p))},attr:function(f,u,p){if(h.test(f)||f=="=")this.attr[this.nodename]="",this.mode="attr value start";else switch(f){case">":this.nodename=="/"?(delete this.attr["/"],this.event("tag",this.tagname,this.attr),c.call(this),this.event("/tag",this.tagname,!0)):(this.nodename&&(this.attr[this.nodename]=""),this.event("tag",this.tagname,this.attr),c.call(this)),this.mode="text";break;default:this.nodename+=f}},"attr value start":function(f,u,p){if(!h.test(f)){if(this.mode="attr value",this.quote=!1,f=="'"||f=='"'){this.quote=f;return}d[this.mode].call(this,f,u,p)}},"attr value":function(f,u,p){if(h.test(f)&&!this.quote)this.mode="attr start";else if(f==">"&&!this.quote)this.event("tag",this.tagname,this.attr),this.mode="text";else switch(f){case'"':case"'":this.quote==f&&p!="\\"&&(this.mode="attr start");break;default:this.attr[this.nodename]+=f}}};e.version="0.2.1",i.elemental=e,i.eve=t})()})(zf);const jf=Ee(zf),Rt=jf.eve,uy=jf.elemental;var El={cursor:1,cx:0,cy:0,fill:1,"fill-opacity":0,font:1,"font-family":1,"font-size":0,"font-style":1,"font-weight":1,height:0,"letter-spacing":0,opacity:0,r:0,rx:0,ry:0,src:1,stroke:1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":0,"stroke-opacity":0,"stroke-width":0,"text-anchor":1,width:0,x:0,y:0},Ur,Nn=Ur={angle:function(i,t,e,n,r,s){if(r==null){var a=i-e,o=t-n;return!a&&!o?0:(180+Math.atan2(-o,-a)*180/Math.PI+360)%360}else return Nn.angle(i,t,r,s)-Nn.angle(e,n,r,s)},rad:function(i){return i%360*Math.PI/180},deg:function(i){return i*180/Math.PI%360},matrix:function(i,t,e,n,r,s){return new Br(i,t,e,n,r,s)}};function Br(i,t,e,n,r,s){i!=null?(this.a=+i,this.b=+t,this.c=+e,this.d=+n,this.e=+r,this.f=+s):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}(function(i){i.add=function(n,r,s,a,o,l){var h=[[],[],[]],c=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],d=[[n,s,o],[r,a,l],[0,0,1]],f,u,p,m;for(n&&n instanceof Br&&(d=[[n.a,n.c,n.e],[n.b,n.d,n.f],[0,0,1]]),f=0;f<3;f++)for(u=0;u<3;u++){for(m=0,p=0;p<3;p++)m+=c[f][p]*d[p][u];h[f][u]=m}this.a=h[0][0],this.b=h[1][0],this.c=h[0][1],this.d=h[1][1],this.e=h[0][2],this.f=h[1][2]},i.invert=function(){var n=this,r=n.a*n.d-n.b*n.c;return new Br(n.d/r,-n.b/r,-n.c/r,n.a/r,(n.c*n.f-n.d*n.e)/r,(n.b*n.e-n.a*n.f)/r)},i.clone=function(){return new Br(this.a,this.b,this.c,this.d,this.e,this.f)},i.translate=function(n,r){this.add(1,0,0,1,n,r)},i.scale=function(n,r,s,a){r==null&&(r=n),(s||a)&&this.add(1,0,0,1,s,a),this.add(n,0,0,r,0,0),(s||a)&&this.add(1,0,0,1,-s,-a)},i.rotate=function(n,r,s){n=Ur.rad(n),r=r||0,s=s||0;var a=+Math.cos(n).toFixed(9),o=+Math.sin(n).toFixed(9);this.add(a,o,-o,a,r,s),this.add(1,0,0,1,-r,-s)},i.x=function(n,r){return n*this.a+r*this.c+this.e},i.y=function(n,r){return n*this.b+r*this.d+this.f},i.get=function(n){return+this[String.fromCharCode(97+n)].toFixed(4)},i.toString=function(){return Ur.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},i.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},i.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]};function t(n){return n[0]*n[0]+n[1]*n[1]}function e(n){var r=Math.sqrt(t(n));n[0]&&(n[0]/=r),n[1]&&(n[1]/=r)}i.split=function(){var n={};n.dx=this.e,n.dy=this.f;var r=[[this.a,this.c],[this.b,this.d]];n.scalex=Math.sqrt(t(r[0])),e(r[0]),n.shear=r[0][0]*r[1][0]+r[0][1]*r[1][1],r[1]=[r[1][0]-r[0][0]*n.shear,r[1][1]-r[0][1]*n.shear],n.scaley=Math.sqrt(t(r[1])),e(r[1]),n.shear/=n.scaley;var s=-r[0][1],a=r[1][1];return a<0?(n.rotate=Ur.deg(Math.acos(a)),s<0&&(n.rotate=360-n.rotate)):n.rotate=Ur.deg(Math.asin(s)),n.isSimple=!+n.shear.toFixed(9)&&(n.scalex.toFixed(9)==n.scaley.toFixed(9)||!n.rotate),n.isSuperSimple=!+n.shear.toFixed(9)&&n.scalex.toFixed(9)==n.scaley.toFixed(9)&&!n.rotate,n.noRotation=!+n.shear.toFixed(9)&&!n.rotate,n},i.toTransformString=function(n){var r=n||this.split();return r.isSimple?(r.scalex=+r.scalex.toFixed(4),r.scaley=+r.scaley.toFixed(4),r.rotate=+r.rotate.toFixed(4),(r.dx&&r.dy?"t"+[r.dx,r.dy]:"")+(r.scalex!=1||r.scaley!=1?"s"+[r.scalex,r.scaley,0,0]:"")+(r.rotate?"r"+[r.rotate,0,0]:"")):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}})(Br.prototype);function fy(i){var t=Nn.matrix(),e=/\s+,?\s*|,\s*/;return(i+"").replace(/([a-z]+)\(([^)]+)\)(?:\s+,?\s*|,\s*|$)/gi,function(n,r,s){switch(s=s.split(e),r.toLowerCase()){case"translate":t.add(1,0,0,1,s[0],s[1]);break;case"scale":t.add(s[0],0,0,s[1],0,0);break;case"rotate":t.rotate(s[0],s[1],s[2]);break;case"skewx":t.add(1,0,Math.tan(Nn.rad(s[0])),1,0,0);break;case"skewy":t.add(1,Math.tan(Nn.rad(s[0])),0,1,0,0);break;case"matrix":t.add(s[0],s[1],s[2],s[3],s[4],s[5]);break}}),t.toTransformString()}function Vf(i,t,e){for(var n=(i+"").split(";"),r=/^\s+|\s+$/g,s,a=0,o=n.length;a<o;a++){var l=n[a].split(":");s=l[0].replace(r,"").replace(/[A-Z]/g,function(h){return"-"+h.toLowerCase()}),(!e||s in e)&&(t[s]=l[1].replace(r,""),e&&!e[s]&&(t[s]=parseFloat(t[s])))}}function qf(i){var t=uy(),e=[],n=[],r={},s,a,o;function l(h,c){return function(d,f){var u={type:c||h,fill:"#000",stroke:"none"};e.push(u);for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&Rt("rappar."+h+".attr."+p,u,f[p],p);Rt("rappar."+h+".attrend",u,f)}}return Rt.on("rappar.polygon.attr.points",function(h){this.path="M"+h+"z",Rt.stop()}),Rt.on("rappar.image.attr.xlink:href",function(h){this.src=h,Rt.stop()}),Rt.on("rappar.path.attr.d",function(h){this.path=h,Rt.stop()}),Rt.on("rappar.*.attr.transform",function(h){this.transform=fy(h),Rt.stop()}),Rt.on("rappar.*.attr.fill",function(h){var c=h.match(/url\(#([^)]+)\)/),d=this;c&&(c=c[1],r[c]?this.fill=r[c]:Rt.on("rappar.found."+c,function(f){d.fill=f}),Rt.stop())}),Rt.on("rappar.line.attrend",function(h){this.path="M"+[h.x1,h.y1,h.x2,h.y2]}),Rt.on("rappar.*.attrend",function(){for(var h=n.length;h--;)if(n[h]!=this)for(var c in n[h])c=="transform"&&this.transform?this.transform=n[h].transform+this.transform:this[c]=n[h][c]}),Rt.on("rappar.*.attr.style",function(h){var c=function(){Vf(h,this,El),Rt.unbind("rappar.*.attrend",c)};Rt.on("rappar.*.attrend",c),Rt.stop()}),Rt.on("rappar.*.attr.*",function(h,c){c in El&&(this[c]=El[c]?h:parseFloat(h))}),Rt.on("elemental.tag.circle",l("circle")),Rt.on("elemental.tag.ellipse",l("ellipse")),Rt.on("elemental.tag.polygon",l("polygon","path")),Rt.on("elemental.tag.path",l("path")),Rt.on("elemental.tag.line",l("line","path")),Rt.on("elemental.tag.rect",l("rect")),Rt.on("elemental.tag.image",l("image")),Rt.on("elemental.tag.text",l("text")),Rt.on("rappar.text.attrend",function(){s="",a=this,this["text-anchor"]=this["text-anchor"]||"start"}),Rt.on("elemental.text",function(h,c,d){a&&(s+=d)}),Rt.on("elemental./tag.text",function(){a.text=s,a=null}),Rt.on("elemental.tag.g",function(h,c){var d={};n.push(d);for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&Rt("rappar.g.attr."+f,d,c[f],f);Rt("rappar.g.attrend",d)}),Rt.on("elemental./tag.g",function(h,c){n.pop()}),Rt.on("elemental.tag.linearGradient",function(h,c){o={id:c.id,angle:+(360+Nn.angle(c.x1,c.y1,c.x2,c.y2,c.x1+100,c.y1)).toFixed(2),stops:[]}}),Rt.on("elemental./tag.linearGradient",function(){for(var h=[o.angle],c,d=0,f=o.stops.length;d<f;d++)c=o.stops[d],d&&d!=f-1?h.push(c.color+":"+c.offset):h.push(c.color);r[o.id]=h.join("-"),Rt("rappar.found."+o.id,null,r[o.id])}),Rt.on("elemental.tag.radialGradient",function(h,c){o={id:c.id,stops:[]}}),Rt.on("elemental./tag.radialGradient",function(){for(var h=[],c,d=0,f=o.stops.length;d<f;d++)c=o.stops[d],d&&d!=f-1?h.push(c.color+":"+c.offset):h.push(c.color);r[o.id]="r"+h.join("-"),Rt("rappar.found."+o.id,null,r[o.id])}),Rt.on("elemental.tag.stop",function(h,c){var d={};c.style&&Vf(c.style,d),d.offset=d.offset||c.offset,d.color=d["stop-color"]||c["stop-color"],d.opacity=d["stop-opacity"]||c["stop-opacity"],~(d.offset+"").indexOf("%")?d.offset=parseFloat(d.offset):d.offset=parseFloat(d.offset)*100,d.offset=+d.offset.toFixed(2),o.stops.push(d)}),t(i),t.end(),e}Fn.fn.NPolygonPath=function(i,t,e,n,r=2){return{shape:this.path(kl(i,t,e,n,r)),afterPath:kl(i,t,e*r,n,1)}},Fn.el.redder=function(){const i=Fn.getRGB(this.attr("fill"));i.r+=51,this.attr("fill","rgb("+i.r+","+i.g+","+i.b+")")},Fn.fn.importSVG=function(i){const t=new Gf,e=qf(i);for(let s=0,a=e.length;s<a;s++){const o=e[s],l={};let h;for(let c in o)c==="type"||c==="path"||(l[c]=o[c]);switch(o.type){case"path":h=this.path(o.path),h.attr(l),t.add(o.path);break}}const[n,r]=t.size;this.setSize(Math.ceil(n),Math.ceil(r))},Fn.fn.brickwall=function(i,t,e,n,r){for(var s=n/r,a=e/3,o={fill:"firebrick",stroke:"#CCC"},l=0;l<r;l+=1){var h=this.rect(0,0,a,s).attr(o),c=this.rect(0,0,2*a,s).attr(o);l%2?(h.transform("T"+i+","+(t+l*s)),c.transform("T"+(i+a)+","+(t+l*s))):(c.transform("T"+i+","+(t+l*s)),h.transform("T"+(i+2*a)+","+(t+l*s)))}};const dy=Fn,Xf=gy("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32);function gy(i,t=10){const e={},n=i.split(",");for(let r=0;r<n.length;r+=2){const s="&"+n[r+1]+";",a=parseInt(n[r],t);e[s]="&#"+a+";"}return e["\\xa0"]=" ",e}function xe(i,t){const e=Object.keys(t);for(let n=0;n<e.length;n++)i=i.replace(new RegExp("{"+e[n]+"}","gi"),""+t[e[n]]);return i}function Aa(i){let t,e;if(!i)throw new Error("cannot create a random attribute name for an undefined object");const n="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";t="";do for(t="",e=0;e<12;e++)t+=n[Math.floor(Math.random()*n.length)];while(i[t]);return t}function py(i){const t={left:"start",right:"end",center:"middle",start:"start",end:"end"};return t[i]||t.start}function my(i){const t={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return t[i]||t.alphabetic}const Gr={strokeStyle:{svgAttr:"stroke",canvas:"#000000",svg:"none",apply:"stroke"},fillStyle:{svgAttr:"fill",canvas:"#000000",svg:null,apply:"fill"},lineCap:{svgAttr:"stroke-linecap",canvas:"butt",svg:"butt",apply:"stroke"},lineJoin:{svgAttr:"stroke-linejoin",canvas:"miter",svg:"miter",apply:"stroke"},miterLimit:{svgAttr:"stroke-miterlimit",canvas:10,svg:4,apply:"stroke"},lineWidth:{svgAttr:"stroke-width",canvas:1,svg:1,apply:"stroke"},globalAlpha:{svgAttr:"opacity",canvas:1,svg:1,apply:"fill stroke"},font:{canvas:"10px sans-serif"},shadowColor:{canvas:"#000000"},shadowOffsetX:{canvas:0},shadowOffsetY:{canvas:0},shadowBlur:{canvas:0},textAlign:{canvas:"start"},textBaseline:{canvas:"alphabetic"},lineDash:{svgAttr:"stroke-dasharray",canvas:[],svg:null,apply:"stroke"}};class Al{__root;__ctx;constructor(t,e){this.__root=t,this.__ctx=e}addColorStop(t,e){const n=this.__ctx.__createElement("stop");if(n.setAttribute("offset",""+t),e.indexOf("rgba")!==-1){const s=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(e);s&&(n.setAttribute("stop-color",xe("rgb({r},{g},{b})",{r:s[1],g:s[2],b:s[3]})),n.setAttribute("stop-opacity",s[4]))}else n.setAttribute("stop-color",e);this.__root.appendChild(n)}}class Yf{__root;__ctx;constructor(t,e){this.__root=t,this.__ctx=e}}class Pa{__document=document;__canvas;__ctx;width;height;__styleStack;__groupStack;__rootSVG;__ids;__SVGdefs;__currentElement;__currentElementsToStyle=null;constructor({canvas:t,width:e=500,height:n=500,enableMirroring:r=!1}){this.enableMirroring=r,t?(this.__canvas=t,this.__ctx=t.getContext("2d"),this.width=t.width,this.height=t.height):(this.__canvas=this.__document.createElement("canvas"),this.__ctx=this.__canvas.getContext("2d"),this.width=e,this.height=n),this.__setDefaultStyles(),this.__styleStack=[this.__getStyleState()],this.__groupStack=[],this.__rootSVG=this.__document.createElementNS("http://www.w3.org/2000/svg","svg"),this.__rootSVG.setAttribute("version","1.1"),this.__rootSVG.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.__rootSVG.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),this.__rootSVG.setAttribute("width",""+this.width),this.__rootSVG.setAttribute("height",""+this.height),this.__ids={},this.__SVGdefs=this.__document.createElementNS("http://www.w3.org/2000/svg","defs"),this.__rootSVG.appendChild(this.__SVGdefs),this.__currentElement=this.__document.createElementNS("http://www.w3.org/2000/svg","g"),this.__rootSVG.appendChild(this.__currentElement)}__setDefaultStyles(){const t=Object.keys(Gr);for(let e=0,n=t.length;e<n;e++){const r=t[e];this[r]=Gr[r].canvas}}__getStyleState(){const t={},e=Object.keys(Gr);for(let n=0,r=e.length;n<r;n++){const s=e[n];t[s]=this[s]}return t}__applyStyleState(t){const e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){const s=e[n];this[s]=t[s]}}__createElement(t,e={},n=!1){const r=this.__document.createElementNS("http://www.w3.org/2000/svg",t),s=Object.keys(e);n&&(r.setAttribute("fill","none"),r.setAttribute("stroke","none"));for(let a=0;a<s.length;a++){const o=s[a];r.setAttribute(o,e[o])}return r}__applyStyleToCurrentElement(t){let e=this.__currentElement;const n=this.__currentElementsToStyle;n&&(e.setAttribute(t,""),e=n.element,n.children.forEach(s=>{s.setAttribute(t,"")}));const r=Object.keys(Gr);for(let s=0;s<r.length;s++){const a=Gr[r[s]],o=this[r[s]];if(a.apply){if(o instanceof Yf){if(o.__ctx)for(;o.__ctx.__SVGdefs.childNodes.length;){const l=o.__ctx.__SVGdefs.childNodes[0].getAttribute("id");this.__ids[l]=l,this.__SVGdefs.appendChild(o.__ctx.__SVGdefs.childNodes[0])}e.setAttribute(a.apply,xe("url(#{id})",{id:o.__root.getAttribute("id")}))}else if(o instanceof Al)e.setAttribute(a.apply,xe("url(#{id})",{id:o.__root.getAttribute("id")}));else if(a.apply.indexOf(t)!==-1&&a.svg!==o)if((a.svgAttr==="stroke"||a.svgAttr==="fill")&&o.indexOf("rgba")!==-1){const h=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(o);e.setAttribute(a.svgAttr,xe("rgb({r},{g},{b})",{r:h[1],g:h[2],b:h[3]}));let c=parseFloat(h[4]);const d=this.globalAlpha;d!=null&&(c*=d),e.setAttribute(a.svgAttr+"-opacity",""+c)}else{let l=a.svgAttr;if(r[s]==="globalAlpha"&&(l=t+"-"+a.svgAttr,e.getAttribute(l)))continue;l&&e.setAttribute(l,o)}}}}__closestGroupOrSvg(t){return t=t||this.__currentElement,t.nodeName==="g"||t.nodeName==="svg"?t:this.__closestGroupOrSvg(t.parentNode)}getSerializedSvg(t){let e=new XMLSerializer().serializeToString(this.__rootSVG);if(/xmlns="http:\/\/www\.w3\.org\/2000\/svg".+xmlns="http:\/\/www\.w3\.org\/2000\/svg/gi.test(e)&&(e=e.replace('xmlns="http://www.w3.org/2000/svg','xmlns:xlink="http://www.w3.org/1999/xlink')),t){const r=Object.keys(Xf);for(let s=0,a=r.length;s<a;s++){const o=r[s],l=Xf[o],h=new RegExp(o,"gi");h.test(e)&&(e=e.replace(h,l))}}return e}getSvg(){return this.__rootSVG}save(){const t=this.__createElement("g"),e=this.__closestGroupOrSvg();this.__groupStack.push(e),e.appendChild(t),this.__currentElement=t,this.__styleStack.push(this.__getStyleState())}restore(){this.__currentElementsToStyle=null;const t=this.__groupStack.pop();t?this.__currentElement=t:this.__currentElement=this.__rootSVG.childNodes[1];const e=this.__styleStack.pop();e&&this.__applyStyleState(e)}__addTransform(t){const e=this.__closestGroupOrSvg();if(e.childNodes.length>0){this.__currentElement.nodeName==="path"&&(this.__currentElementsToStyle||(this.__currentElementsToStyle={element:e,children:[]}),this.__currentElementsToStyle.children.push(this.__currentElement),this.__applyCurrentDefaultPath());const r=this.__createElement("g");e.appendChild(r),this.__currentElement=r}let n=this.__currentElement.getAttribute("transform");n?n+=" ":n="",n+=t,this.__currentElement.setAttribute("transform",n)}scale(t,e){e===void 0&&(e=t),this.__addTransform(xe("scale({x},{y})",{x:t,y:e}))}rotate(t){const e=t*180/Math.PI;this.__addTransform(xe("rotate({angle},{cx},{cy})",{angle:e,cx:0,cy:0}))}translate(t,e){this.__addTransform(xe("translate({x},{y})",{x:t,y:e}))}transform(t,e,n,r,s,a){this.__addTransform(xe("matrix({a},{b},{c},{d},{e},{f})",{a:t,b:e,c:n,d:r,e:s,f:a}))}beginPath(){this.__currentDefaultPath="",this.__currentPosition={};const t=this.__createElement("path",{},!0);this.__closestGroupOrSvg().appendChild(t),this.__currentElement=t}__applyCurrentDefaultPath(){const t=this.__currentElement;t.nodeName==="path"?t.setAttribute("d",this.__currentDefaultPath):console.error("Attempted to apply path command to node",t.nodeName)}__addPathCommand(t){this.__currentDefaultPath+=" ",this.__currentDefaultPath+=t}moveTo(t,e){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.__currentPosition={x:t,y:e},this.__addPathCommand(xe("M {x} {y}",this.__currentPosition))}closePath(){this.__currentDefaultPath&&this.__addPathCommand("Z")}lineTo(t,e){this.__currentPosition={x:t,y:e},this.__currentDefaultPath.indexOf("M")>-1?this.__addPathCommand(xe("L {x} {y}",this.__currentPosition)):this.__addPathCommand(xe("M {x} {y}",this.__currentPosition))}bezierCurveTo(t,e,n,r,s,a){this.__currentPosition={x:s,y:a},this.__addPathCommand(xe("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:t,cp1y:e,cp2x:n,cp2y:r,x:s,y:a}))}quadraticCurveTo(t,e,n,r){this.__currentPosition={x:n,y:r},this.__addPathCommand(xe("Q {cpx} {cpy} {x} {y}",{cpx:t,cpy:e,x:n,y:r}))}normalize(t){const e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]/e,t[1]/e]}arcTo(t,e,n,r,s){const a=this.__currentPosition&&this.__currentPosition.x,o=this.__currentPosition&&this.__currentPosition.y;if(typeof a>"u"||typeof o>"u")return;if(s<0)throw new Error("IndexSizeError: The radius provided ("+s+") is negative.");if(a===t&&o===e||t===n&&e===r||s===0){this.lineTo(t,e);return}const l=this.normalize([a-t,o-e]),h=this.normalize([n-t,r-e]);if(l[0]*h[1]===l[1]*h[0]){this.lineTo(t,e);return}const c=l[0]*h[0]+l[1]*h[1],d=Math.acos(Math.abs(c)),f=this.normalize([l[0]+h[0],l[1]+h[1]]),u=s/Math.sin(d/2),p=t+u*f[0],m=e+u*f[1],y=[-l[1],l[0]],S=[h[1],-h[0]],C=function(k){const A=k[0];return k[1]>=0?Math.acos(A):-Math.acos(A)},_=C(y),w=C(S);this.lineTo(p+y[0]*s,m+y[1]*s),this.arc(p,m,s,_,w)}stroke(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","fill stroke markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("stroke")}fill(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","stroke fill markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("fill")}rect(t,e,n,r){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.moveTo(t,e),this.lineTo(t+n,e),this.lineTo(t+n,e+r),this.lineTo(t,e+r),this.lineTo(t,e),this.closePath()}fillRect(t,e,n,r){const s=this.__createElement("rect",{x:t,y:e,width:n,height:r},!0);this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("fill")}strokeRect(t,e,n,r){const s=this.__createElement("rect",{x:t,y:e,width:n,height:r},!0);this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("stroke")}__clearCanvas(){const e=this.__closestGroupOrSvg().getAttribute("transform"),n=this.__rootSVG.childNodes[1],r=n.childNodes;for(let s=r.length-1;s>=0;s--)r[s]&&n.removeChild(r[s]);this.__currentElement=n,this.__groupStack=[],e&&this.__addTransform(e)}clearRect(t,e,n,r){if(t===0&&e===0&&n===this.width&&r===this.height){this.__clearCanvas();return}const s=this.__closestGroupOrSvg(),a=this.__createElement("rect",{x:t,y:e,width:n,height:r,fill:"#FFFFFF"},!0);s.appendChild(a)}createLinearGradient(t,e,n,r){const s=this.__createElement("linearGradient",{id:Aa(this.__ids),x1:t+"px",x2:n+"px",y1:e+"px",y2:r+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__SVGdefs.appendChild(s),new Al(s,this)}createRadialGradient(t,e,n,r,s,a){const o=this.__createElement("radialGradient",{id:Aa(this.__ids),cx:r+"px",cy:s+"px",r:a+"px",fx:t+"px",fy:e+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__SVGdefs.appendChild(o),new Al(o,this)}__parseFont(){const e=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:%|in|[cem]m|ex|p[CustomCanvasContext]))(?:\s*\/\s*(normal|[.\d]+(?:%|in|[cem]m|ex|p[CustomCanvasContext])))?\s*([-,'"\sa-z0-9]+?)\s*$/i.exec(this.font),n={style:e[1]||"normal",size:e[4]||"10px",family:e[6]||"sans-serif",weight:e[3]||"normal",decoration:e[2]||"normal",href:null};return this.__fontUnderline==="underline"&&(n.decoration="underline"),this.__fontHref&&(n.href=this.__fontHref),n}__wrapTextLink(t,e){if(t.href){const n=this.__createElement("a");return n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.href),n.appendChild(e),n}return e}__applyText(t,e,n,r){const s=this.__parseFont(),a=this.__closestGroupOrSvg(),o=this.__createElement("text",{"font-family":s.family,"font-size":s.size,"font-style":s.style,"font-weight":s.weight,"text-decoration":s.decoration,x:e,y:n,"text-anchor":py(this.textAlign),"dominant-baseline":my(this.textBaseline)},!0);o.appendChild(this.__document.createTextNode(t)),this.__currentElement=o,this.__applyStyleToCurrentElement(r),a.appendChild(this.__wrapTextLink(s,o))}fillText(t,e,n){this.__applyText(t,e,n,"fill")}strokeText(t,e,n){this.__applyText(t,e,n,"stroke")}measureText(t){return this.__ctx.font=this.font,this.__ctx.measureText(t)}arc(t,e,n,r,s,a){if(r===s)return;r=r%(2*Math.PI),s=s%(2*Math.PI),r===s&&(s=(s+2*Math.PI-.001*(a?-1:1))%(2*Math.PI));const o=t+n*Math.cos(s),l=e+n*Math.sin(s),h=t+n*Math.cos(r),c=e+n*Math.sin(r),d=a?0:1;let f=0,u=s-r;u<0&&(u+=2*Math.PI),a?f=u>Math.PI?0:1:f=u>Math.PI?1:0,this.lineTo(h,c),this.__addPathCommand(xe("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:n,ry:n,xAxisRotation:0,largeArcFlag:f,sweepFlag:d,endX:o,endY:l})),this.__currentPosition={x:o,y:l}}clip(){const t=this.__closestGroupOrSvg(),e=this.__createElement("clipPath"),n=Aa(this.__ids),r=this.__createElement("g");this.__applyCurrentDefaultPath(),t.removeChild(this.__currentElement),e.setAttribute("id",n),e.appendChild(this.__currentElement),this.__SVGdefs.appendChild(e),t.setAttribute("clip-path",xe("url(#{id})",{id:n})),t.appendChild(r),this.__currentElement=r}drawImage(...t){let e=t[0],n,r,s,a,o=0,l=0,h,c,d,f,u,p,m,y;if(t.length===3)n=t[1],r=t[2],h=e.width,c=e.height,s=h,a=c;else if(t.length===5)n=t[1],r=t[2],s=t[3],a=t[4],h=e.width,c=e.height;else if(t.length===9)o=t[1],l=t[2],h=t[3],c=t[4],n=t[5],r=t[6],s=t[7],a=t[8];else throw new Error("Invalid number of arguments passed to drawImage: "+arguments.length);const S=this.__closestGroupOrSvg();this.__currentElement;const C="translate("+n+", "+r+")";if(e instanceof Pa){if(d=e.getSvg().cloneNode(!0),d.childNodes&&d.childNodes.length>1){for(f=d.childNodes[0];f.childNodes.length;)y=f.childNodes[0].getAttribute("id"),this.__ids[y]=y,this.__SVGdefs.appendChild(f.childNodes[0]);if(u=d.childNodes[1],u){const _=u.getAttribute("transform");let w;_?w=_+" "+C:w=C,u.setAttribute("transform",w),S.appendChild(u)}}}else(e.nodeName==="CANVAS"||e.nodeName==="IMG")&&(p=this.__createElement("image"),p.setAttribute("width",s),p.setAttribute("height",a),p.setAttribute("preserveAspectRatio","none"),(o||l||h!==e.width||c!==e.height)&&(m=this.__document.createElement("canvas"),m.width=s,m.height=a,m.getContext("2d")?.drawImage(e,o,l,h,c,0,0,s,a),e=m),p.setAttribute("transform",C),p.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e.nodeName==="CANVAS"?e.toDataURL():e.getAttribute("src")),S.appendChild(p))}createPattern(t,e){const n=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),r=Aa(this.__ids);let s;return n.setAttribute("id",r),t.nodeName==="CANVAS"||t.nodeName==="IMG"?(s=this.__document.createElementNS("http://www.w3.org/2000/svg","image"),s.setAttribute("width",""+t.width),s.setAttribute("height",""+t.height),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.nodeName==="CANVAS"?t.toDataURL():t.getAttribute("src")),n.appendChild(s),this.__SVGdefs.appendChild(n)):t instanceof Pa&&(n.setAttribute("width",""+t.width),n.setAttribute("height",""+t.height),n.appendChild(t.__rootSVG.childNodes[1]),this.__SVGdefs.appendChild(n)),new Yf(n,this)}setLineDash(t){t&&t.length>0?this.lineDash=t.join(","):this.lineDash=null}drawFocusRing(){}createImageData(){}getImageData(){}putImageData(){}globalCompositeOperation(){}setTransform(){}}const vy=Pa,_y=function(i,t,e,n,r,s){i.beginPath(),i.moveTo(t,e+s),i.lineTo(t,e+r-s),i.quadraticCurveTo(t,e+r,t+s,e+r),i.lineTo(t+n-s,e+r),i.quadraticCurveTo(t+n,e+r,t+n,e+r-s),i.lineTo(t+n,e+s),i.quadraticCurveTo(t+n,e,t+n-s,e),i.lineTo(t+s,e),i.quadraticCurveTo(t,e,t,e+s),i.stroke()},yy=function(i,t,e,n){var r=t-n,s=0,a=1;i.beginPath(),i.moveTo(r,s);do{if(a>2e4)break;var o=(t+e)*Math.cos(a*Math.PI/72)-(e+n)*Math.cos((t+e)/e*(a*Math.PI/72)),l=(t+e)*Math.sin(a*Math.PI/72)-(e+n)*Math.sin((t+e)/e*(a*Math.PI/72));i.lineTo(o,l),r=o,s=l,a++}while(o!=t-n&&l!=0);i.stroke()},by=function(i,t){i.save(),i.beginPath(),i.moveTo(t,0);for(var e=0;e<9;e++)i.rotate(Math.PI/5),e%2==0?i.lineTo(t/.525731*.200811,0):i.lineTo(t,0);i.closePath(),i.fill(),i.restore()},wy=function(i,t,e,n,r){var s=0;function a(){i.clearRect(t,e,n,r),i.setLineDash([4,2]),i.lineDashOffset=-s,i.strokeRect(t,e,n,r)}function o(){s++,s>16&&(s=0),a(),setTimeout(o,40)}o()},xy=function(i){i.beginPath(),i.arc(75,75,50,0,Math.PI*2,!0),i.moveTo(110,75),i.arc(75,75,35,0,Math.PI,!1),i.moveTo(65,65),i.arc(60,65,5,0,Math.PI*2,!0),i.moveTo(95,65),i.arc(90,65,5,0,Math.PI*2,!0),i.stroke()};let Sy=class{constructor(t=0,e=0,n="#ffff00",r=0){this.x=t,this.y=e,this.color=n,this.rotation=r}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.lineWidth=2,t.fillStyle=this.color,t.beginPath(),t.moveTo(-50,-25),t.lineTo(0,-25),t.lineTo(0,-50),t.lineTo(50,0),t.lineTo(0,50),t.lineTo(0,25),t.lineTo(-50,25),t.lineTo(-50,-25),t.closePath(),t.fill(),t.stroke(),t.restore()}};class Cy extends te{constructor(t=40,e="#ff0000"){super(0,0,{vx:0,vy:0,radius:t}),this.x=0,this.y=0,this.radius=t,this.vx=0,this.vy=0,this.mass=1,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=e,this.lineWidth=1}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.fillStyle=this.color,t.beginPath(),t.arc(0,0,this.radius,0,Math.PI*2,!0),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore()}getBounds(){return new xl(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}class ky{constructor(t=40,e="#ff0000"){this.x=0,this.y=0,this.xpos=0,this.ypos=0,this.zpos=0,this.radius=t,this.vx=0,this.vy=0,this.vz=0,this.mass=1,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=e,this.lineWidth=1,this.visible=!0}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.fillStyle=this.color,t.beginPath(),t.arc(0,0,this.radius,0,Math.PI*2,!0),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore()}}class Ty{constructor(t=50,e=50,n="#ff0000"){this.x=0,this.y=0,this.width=t,this.height=e,this.vx=0,this.vy=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=n,this.lineWidth=1}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.fillStyle=this.color,t.beginPath(),t.rect(0,0,this.width,this.height),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore()}isIntersectRect(t){return!(this.x+this.width<t.x||t.x+t.width<this.x||this.y+this.height<t.y||t.y+t.height<this.y)}}class Ey{constructor(t,e,n,r){this.x=t===void 0?-100:t,this.y=e===void 0?-100:e,this.z=n===void 0?-100:n,this.brightness=r===void 0?1:r}setBrightness(t){this.brightness=Math.min(Math.max(t,0),1)}}let Ay=class{constructor(t,e,n,r){this.x=0,this.y=0,this.x1=t===void 0?0:t,this.y1=e===void 0?0:e,this.x2=n===void 0?0:n,this.y2=r===void 0?0:r,this.rotation=0,this.scaleX=1,this.scaleY=1,this.lineWidth=1}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.beginPath(),t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2),t.closePath(),t.stroke(),t.restore()}getBounds(){if(this.rotation===0){var t=Math.min(this.x1,this.x2),e=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),r=Math.max(this.y1,this.y2);return{x:this.x+t,y:this.y+e,width:n-t,height:r-e}}else{var s=Math.sin(this.rotation),a=Math.cos(this.rotation),o=a*this.x1-s*this.y1,l=a*this.x2-s*this.y2,h=a*this.y1+s*this.x1,c=a*this.y2+s*this.x2;return{x:this.x+Math.min(o,l),y:this.y+Math.min(h,c),width:Math.max(o,l)-Math.min(o,l),height:Math.max(h,c)-Math.min(h,c)}}}};class Py{constructor(t,e,n){this.x=t===void 0?0:t,this.y=e===void 0?0:e,this.z=n===void 0?0:n,this.fl=250,this.vpX=0,this.vpY=0,this.cX=0,this.cY=0,this.cZ=0}setVanishingPoint(t,e){this.vpX=t,this.vpY=e}setCenter(t,e,n){this.cX=t,this.cY=e,this.cZ=n}rotateX(t){var e=Math.cos(t),n=Math.sin(t),r=this.y*e-this.z*n,s=this.z*e+this.y*n;this.y=r,this.z=s}rotateY(t){var e=Math.cos(t),n=Math.sin(t),r=this.x*e-this.z*n,s=this.z*e+this.x*n;this.x=r,this.z=s}rotateZ(t){var e=Math.cos(t),n=Math.sin(t),r=this.x*e-this.y*n,s=this.y*e+this.x*n;this.x=r,this.y=s}getScreenX(){var t=this.fl/(this.fl+this.z+this.cZ);return this.vpX+(this.cX+this.x)*t}getScreenY(){var t=this.fl/(this.fl+this.z+this.cZ);return this.vpY+(this.cY+this.y)*t}}class My{constructor(){this.x=0,this.y=0,this.width=25,this.height=20,this.rotation=0,this.showFlame=!1}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.lineWidth=1,t.strokeStyle="#ffffff",t.beginPath(),t.moveTo(10,0),t.lineTo(-10,10),t.lineTo(-5,0),t.lineTo(-10,-10),t.lineTo(10,0),t.closePath(),t.stroke(),this.showFlame&&(t.beginPath(),t.moveTo(-7.5,-5),t.lineTo(-15,0),t.lineTo(-7.5,5),t.closePath(),t.stroke()),t.restore()}}class Ry{constructor(t,e,n){this.min=t===void 0?0:t,this.max=e===void 0?100:e,this.value=n===void 0?100:n,this.onchange=null,this.x=0,this.y=0,this.width=16,this.height=100,this.backColor="#cccccc",this.backBorderColor="#999999",this.backWidth=4,this.backX=this.width/2-this.backWidth/2,this.handleColor="#eeeeee",this.handleBorderColor="#cccccc",this.handleHeight=6,this.handleY=0,this.updatePosition()}draw(t){t.save(),t.translate(this.x,this.y),t.fillStyle=this.backColor,t.beginPath(),t.fillRect(this.backX,0,this.backWidth,this.height),t.closePath(),t.strokeStyle=this.handleBorderColor,t.fillStyle=this.handleColor,t.beginPath(),t.rect(0,this.handleY,this.width,this.handleHeight),t.closePath(),t.fill(),t.stroke(),t.restore()}updateValue(){var t=this.value,e=this.height-this.handleHeight,n=this.max-this.min;this.value=(e-this.handleY)/e*n+this.min,typeof this.onchange=="function"&&this.value!==t&&this.onchange()}updatePosition(){var t=this.height-this.handleHeight,e=this.max-this.min;this.handleY=t-(this.value-this.min)/e*t}captureMouse(t){var e=this,n=No.captureMouse(t),r=new xl(0,0,0,0);o(),t.addEventListener("mousedown",function(){r.isContainPoint(n)&&(t.addEventListener("mouseup",s,!1),t.addEventListener("mousemove",a,!1))},!1);function s(){t.removeEventListener("mousemove",a,!1),t.removeEventListener("mouseup",s,!1),o()}function a(){var l=n.y-e.y;e.handleY=Math.min(e.height-e.handleHeight,Math.max(l,0)),e.updateValue()}function o(){r.x=e.x,r.y=e.y+e.handleY,r.width=e.width,r.height=e.handleHeight}}}class Ly{constructor(t,e,n,r="#ff0000"){this.pointA=t,this.pointB=e,this.pointC=n,this.color=r,this.lineWidth=1,this.alpha=1}draw(t){this.isBackface()||(t.save(),t.lineWidth=this.lineWidth,t.fillStyle=t.strokeStyle=wl(this.color,this.alpha),t.beginPath(),t.moveTo(this.pointA.getScreenX(),this.pointA.getScreenY()),t.lineTo(this.pointB.getScreenX(),this.pointB.getScreenY()),t.lineTo(this.pointC.getScreenX(),this.pointC.getScreenY()),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore())}getDepth(){return Math.min(this.pointA.z,this.pointB.z,this.pointC.z)}isBackface(){var t=this.pointC.getScreenX()-this.pointA.getScreenX(),e=this.pointC.getScreenY()-this.pointA.getScreenY(),n=this.pointB.getScreenX()-this.pointC.getScreenX(),r=this.pointB.getScreenY()-this.pointC.getScreenY();return t*r>e*n}}class Dy{constructor(t,e,n,r="#ff0000"){this.pointA=t,this.pointB=e,this.pointC=n,this.color=r,this.lineWidth=1,this.alpha=1,this.light=null}draw(t){this.isBackface()||(t.save(),t.lineWidth=this.lineWidth,t.fillStyle=t.strokeStyle=this.getAdjustedColor(),t.beginPath(),t.moveTo(this.pointA.getScreenX(),this.pointA.getScreenY()),t.lineTo(this.pointB.getScreenX(),this.pointB.getScreenY()),t.lineTo(this.pointC.getScreenX(),this.pointC.getScreenY()),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore())}getDepth(){return Math.min(this.pointA.z,this.pointB.z,this.pointC.z)}isBackface(){var t=this.pointC.getScreenX()-this.pointA.getScreenX(),e=this.pointC.getScreenY()-this.pointA.getScreenY(),n=this.pointB.getScreenX()-this.pointC.getScreenX(),r=this.pointB.getScreenY()-this.pointC.getScreenY();return t*r>e*n}getAdjustedColor(){var t=xa(this.color),e=t>>16,n=t>>8&255,r=t&255,s=this.getLightFactor();return e*=s,n*=s,r*=s,Lf(e<<16|n<<8|r)}getLightFactor(){var t={x:this.pointA.x-this.pointB.x,y:this.pointA.y-this.pointB.y,z:this.pointA.z-this.pointB.z},e={x:this.pointB.x-this.pointC.x,y:this.pointB.y-this.pointC.y,z:this.pointB.z-this.pointC.z},n={x:t.y*e.z-t.z*e.y,y:-(t.x*e.z-t.z*e.x),z:t.x*e.y-t.y*e.x},r=n.x*this.light.x+n.y*this.light.y+n.z*this.light.z,s=Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z),a=Math.sqrt(this.light.x*this.light.x+this.light.y*this.light.y+this.light.z*this.light.z);return Math.acos(r/(s*a))/Math.PI*this.light.brightness}}class Iy{constructor(){this.x=0,this.y=0,this.xpos=0,this.ypos=0,this.zpos=0,this.scaleX=1,this.scaleY=1,this.color="#ffffff",this.alpha=1,this.lineWidth=1,this.branch=[],this.branch[0]=-140-Math.random()*20,this.branch[1]=-30-Math.random()*30,this.branch[2]=Math.random()*80-40,this.branch[3]=-100-Math.random()*40,this.branch[4]=-60-Math.random()*40,this.branch[5]=Math.random()*60-30,this.branch[6]=-110-Math.random()*20}draw(t){t.save(),t.translate(this.x,this.y),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.strokeStyle=wl(this.color,this.alpha),t.beginPath(),t.moveTo(0,0),t.lineTo(0,this.branch[0]),t.moveTo(0,this.branch[1]),t.lineTo(this.branch[2],this.branch[3]),t.moveTo(0,this.branch[4]),t.lineTo(this.branch[5],this.branch[6]),t.stroke(),t.restore()}}class Oy{constructor(t,e,n="#ffffff"){this.x=0,this.y=0,this.width=t,this.height=e,this.vx=0,this.vy=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=n,this.lineWidth=1}draw(t){var e=this.height,n=this.width+e,r=e/2;t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.fillStyle=this.color,t.beginPath(),t.moveTo(0,-r),t.lineTo(n-2*r,-r),t.quadraticCurveTo(-r+n,-r,-r+n,0),t.lineTo(-r+n,e-2*r),t.quadraticCurveTo(-r+n,-r+e,n-2*r,-r+e),t.lineTo(0,-r+e),t.quadraticCurveTo(-r,-r+e,-r,e-2*r),t.lineTo(-r,0),t.quadraticCurveTo(-r,-r,0,-r),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.beginPath(),t.arc(0,0,2,0,Math.PI*2,!0),t.closePath(),t.stroke(),t.beginPath(),t.arc(this.width,0,2,0,Math.PI*2,!0),t.closePath(),t.stroke(),t.restore()}getPin(){return{x:this.x+Math.cos(this.rotation)*this.width,y:this.y+Math.sin(this.rotation)*this.width}}}class Fy{canvas;context;mouse;constructor(t){this.canvas=t,this.context=t.getContext("2d",{willReadFrequently:!0}),this.mouse=No.captureMouse(this.canvas)}getMouseRotation(t){return t.angleTo(this.mouse)}followMouse(t,e){const n=this.getMouseRotation(t),{x:r,y:s}=t.fromRadian(n,e);return t.x+=r,t.y+=s,t}followMouseWithAcceleration(t,e=.05){const n=this.getMouseRotation(t),{x:r,y:s}=t.fromRadian(n,e);return t.ax=r,t.ay=s,t.nextFrame(),t}getMouseDistance(t){return t.distanceTo(this.mouse)}clearRect(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this}lineWidth(t){return this.context.lineWidth=t,this}fillStyle(t){return this.context.fillStyle=t,this}fill(){return this.context.fill(),this}strokeStyle(t){return this.context.strokeStyle=t,this}stroke(){return this.context.stroke(),this}createLinearGradient(t,e,n){const r=this.context.createLinearGradient(t.x,t.y,e.x,e.y);return Object.keys(n).forEach(s=>r.addColorStop(parseFloat(s),n[parseFloat(s)])),r}createRadialGradient(t,e,n){const r=this.context.createRadialGradient(t.x,t.y,t.radius,e.x,e.y,e.radius);return Object.keys(n).forEach(s=>r.addColorStop(parseFloat(s),n[parseFloat(s)])),r}moveTo(t){this.context.moveTo(t.x,t.y)}closePath(){this.context.closePath()}lineTo(t,e){this.context.save(),this.context.beginPath(),this.context.moveTo(t.x,t.y),this.context.lineTo(e.x,e.y),this.context.stroke(),this.context.restore()}drawMouseMoveLine(){const t=()=>{this.context.lineTo(this.mouse.x,this.mouse.y),this.stroke()};this.canvas.addEventListener("mousedown",()=>{this.context.beginPath(),this.context.moveTo(this.mouse.x,this.mouse.y),this.canvas.addEventListener("mousemove",t,!1)},!1),this.canvas.addEventListener("mouseup",()=>{this.canvas.removeEventListener("mousemove",t,!1)},!1)}drawMouseMoveBrushLine({brush_size:t,brush_density:e,brush_color:n}={brush_size:25,brush_density:50,brush_color:"#000000"}){const r=this.getImageData(),s=r.data,a=xa(n),o=()=>{for(let l=0;l<e;l++){const h=Math.random()*Math.PI*2,c=Math.random()*t,d=this.mouse.x+Math.cos(h)*c|0,f=this.mouse.y+Math.sin(h)*c|0,u=(d+f*r.width)*4;s[u]=a>>16&255,s[u+1]=a>>8&255,s[u+2]=a&255,s[u+3]=255}this.putImageData(r)};this.canvas.addEventListener("mousedown",()=>{this.canvas.addEventListener("mousemove",o,!1)},!1),this.canvas.addEventListener("mouseup",()=>{this.canvas.removeEventListener("mousemove",o,!1)},!1)}quadraticCurveTo(t,e,n){this.context.save(),this.context.beginPath(),this.context.moveTo(t.x,t.y),this.context.quadraticCurveTo(e.x,e.y,n.x,n.y),this.context.stroke(),this.context.restore()}drawQuadraticCurveLine(t){const e=t.length;if(e<3)return new Error("points length must >= 3");this.context.beginPath(),this.context.moveTo(t[0].x,t[0].y);for(let n=1;n<e;n+=2)this.context.quadraticCurveTo(t[n].x,t[n].y,t[n+1].x,t[n+1].y);this.context.stroke()}quadraticThroughCurveTo(t,e,n){e.x=e.x*2-(t.x+n.x)/2,e.y=e.y*2-(t.y+n.y)/2,this.quadraticCurveTo(t,e,n)}drawQuadraticThroughCurveLine(t){const e=t.length;if(e<3)return new Error("points length must >= 3");this.context.beginPath(),this.context.moveTo(t[0].x,t[0].y);let n=1;for(;n<e-2;n++)this.context.quadraticCurveTo(t[n].x,t[n].y,(t[n].x+t[n+1].x)/2,(t[n].y+t[n+1].y)/2);this.context.quadraticCurveTo(t[n].x,t[n].y,t[n+1].x,t[n+1].y),this.context.stroke()}drawQuadraticThroughCurveLineBetter(t){const e=t.length;if(e<3)return new Error("points length must >= 3");const n=(t[0].x+t[e-1].x)/2,r=(t[0].y+t[e-1].y)/2;this.context.beginPath(),this.context.moveTo(n,r);let s=0;for(;s<e-1;s++){const a=(t[s].x+t[s+1].x)/2,o=(t[s].y+t[s+1].y)/2;this.context.quadraticCurveTo(t[s].x,t[s].y,a,o)}this.context.quadraticCurveTo(t[s].x,t[s].y,r,r),this.context.stroke()}fillRect(t){this.context.save(),this.context.fillRect(t.x,t.y,t.width,t.height),this.context.stroke(),this.context.restore()}drawImage(t,e=0,n=0){this.context.drawImage(t,e,n)}getImageData(t={x:0,y:0,width:this.canvas.width,height:this.canvas.height},e){return this.context.getImageData(t.x,t.y,t.width,t.height,e)}putImageData(t,e=0,n=0){return this.context.putImageData(t,e,n)}drawShape(t){t.draw(this.context)}}var Wf=null;if(navigator.mozGetUserMedia)console.log("This appears to be Firefox"),window.webrtcDetectedBrowser="firefox",window.webrtcDetectedVersion=parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1],10),RTCSessionDescription=mozRTCSessionDescription,RTCIceCandidate=mozRTCIceCandidate,window.getUserMedia=navigator.mozGetUserMedia.bind(navigator),navigator.getUserMedia=Wf,window.createIceServer=function(i,t,e){var n=null,r=i.split(":");if(r[0].indexOf("stun")===0)n={url:i};else if(r[0].indexOf("turn")===0){var s=i.split("?");(s.length===1||s[1].indexOf("transport=udp")===0)&&(n={url:s[0],credential:e,username:t})}return n},window.createIceServers=function(i,t,e){for(var n=[],r=0;r<i.length;r++){var s=createIceServer(i[r],t,e);s!==null&&n.push(s)}return n},window.attachMediaStream=function(i,t){console.log("Attaching media stream"),i.mozSrcObject=t,i.play()},window.reattachMediaStream=function(i,t){console.log("Reattaching media stream"),i.mozSrcObject=t.mozSrcObject,i.play()};else if(navigator.webkitGetUserMedia){console.log("This appears to be Chrome"),window.webrtcDetectedBrowser="chrome";var Kf=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);Kf!==null?window.webrtcDetectedVersion=parseInt(Kf[2],10):window.webrtcDetectedVersion=999,window.createIceServer=function(i,t,e){var n=null,r=i.split(":");return r[0].indexOf("stun")===0?n={url:i}:r[0].indexOf("turn")===0&&(n={url:i,credential:e,username:t}),n},window.createIceServers=function(i,t,e){for(var n=[],r=0;r<i.length;r++){var s=createIceServer(i[r],t,e);s!==null&&n.push(s)}return n},window.getUserMedia=navigator.webkitGetUserMedia.bind(navigator),navigator.getUserMedia=Wf,window.attachMediaStream=function(i,t){typeof i.srcObject<"u"?i.srcObject=t:typeof i.mozSrcObject<"u"?i.mozSrcObject=t:typeof i.src<"u"?i.src=URL.createObjectURL(t):console.log("Error attaching stream to element.")},window.reattachMediaStream=function(i,t){i.src=t.src}}else console.log("Browser does not appear to be WebRTC-capable");class $r{video;constructor(t){this.video=t}setSrcObject(t){this.video.addEventListener("loadedmetadata",e=>{const n=e.target;n instanceof HTMLVideoElement&&console.log(`${n.id} videoWidth: ${n.videoWidth}px, videoHeight: ${n.videoHeight}px.`)}),this.video.srcObject=t}static captureWebCameraPhoto(t,e){navigator.mediaDevices.getUserMedia({video:!0}).then(n=>{t.srcObject=n;const r=t.videoWidth,s=t.videoHeight,a=e.getContext("2d");e.width=r,e.height=s,a?.drawImage(t,0,0,r,s)})}static tryAutoPlayOrAutoPlayAfterClick(t){return new Promise(e=>{t.play().then(()=>{t.autoplay=!0,e(!0)}).catch(()=>{$r.setAutoPlayWhenClick(t),e(!1)})})}static setAutoPlayWhenClick(t){function e(){t.autoplay=!0,t.play(),document.removeEventListener("click",e),document.removeEventListener("touchend",e)}document.addEventListener("click",e),document.addEventListener("touchend",e)}}class Ny{localVideoUtil;remoteVideoUtil;localPeerConnection=null;remotePeerConnection=null;constructor(t,e){this.localVideoUtil=new $r(t),this.remoteVideoUtil=new $r(e)}start(){this.getLocalMediaStream().then(t=>{this.call(t)})}end(){this.localPeerConnection?.close(),this.remotePeerConnection?.close(),this.localPeerConnection=null,this.remotePeerConnection=null,this.trace("Ending call.")}getLocalMediaStream(){return new Promise((t,e)=>{navigator.mediaDevices.getUserMedia({audio:!0,video:!0}).then(n=>{this.localVideoUtil.setSrcObject(n),t(n)}).catch(n=>{this.trace(`navigator.getUserMedia error: ${n}.`),e(n)})})}gotRemoteMediaStream(t){const e=t.streams[0];this.remoteVideoUtil.setSrcObject(e),this.trace("Remote peer connection received remote stream.")}call(t){const e=t.getVideoTracks(),n=t.getAudioTracks();e.length>0&&this.trace(`Using video device: ${e[0].label}.`),n.length>0&&this.trace(`Using audio device: ${n[0].label}.`);const r=void 0,s=new RTCPeerConnection(r);this.localPeerConnection=s,this.trace("Created local peer connection object localPeerConnection."),s.addEventListener("icecandidate",this.handleConnection),s.addEventListener("iceconnectionstatechange",this.handleConnectionChange);const a=new RTCPeerConnection(r);this.remotePeerConnection=a,this.trace("Created remote peer connection object remotePeerConnection."),a.addEventListener("icecandidate",this.handleConnection),a.addEventListener("iceconnectionstatechange",this.handleConnectionChange),a.addEventListener("track",this.gotRemoteMediaStream),this.trace("Add local localStream to localPeerConnection."),s.addTrack(e[0],t),s.addTrack(n[0],t),this.trace("localPeerConnection createOffer start."),s.createOffer({offerToReceiveVideo:!0}).then(o=>this.createdOffer(o)).catch(o=>this.setSessionDescriptionError(o))}handleConnection(t){const e=t.target,n=t.candidate;if(e&&n){const r=new RTCIceCandidate(n),s=this.getOtherPeer(e);s&&(s.addIceCandidate(r).then(()=>{this.handleConnectionSuccess(e)}).catch(a=>{this.handleConnectionFailure(e,a)}),this.trace(`${this.getPeerName(e)} ICE candidate:
|
|
25
30
|
${t.candidate.candidate}.`))}}handleConnectionSuccess(t){this.trace(`${this.getPeerName(t)} addIceCandidate success.`)}handleConnectionFailure(t,e){this.trace(`${this.getPeerName(t)} failed to add ICE Candidate:
|
|
26
31
|
${e.toString()}.`)}handleConnectionChange(t){const e=t.target;console.log("ICE state change event: ",t),e&&this.trace(`${this.getPeerName(e)} ICE state: ${e.iceConnectionState}.`)}createdOffer(t){this.trace(`Offer from localPeerConnection:
|
|
27
32
|
${t.sdp}`),this.localPeerConnection&&(this.trace("localPeerConnection setLocalDescription start."),this.localPeerConnection.setLocalDescription(t).then(()=>{this.setLocalDescriptionSuccess(this.localPeerConnection)}).catch(e=>this.setSessionDescriptionError(e))),this.remotePeerConnection&&(this.trace("remotePeerConnection setRemoteDescription start."),this.remotePeerConnection.setRemoteDescription(t).then(()=>{this.setRemoteDescriptionSuccess(this.remotePeerConnection)}).catch(e=>this.setSessionDescriptionError(e)),this.trace("remotePeerConnection createAnswer start."),this.remotePeerConnection.createAnswer().then(e=>this.createdAnswer(e)).catch(e=>this.setSessionDescriptionError(e)))}createdAnswer(t){this.trace(`Answer from remotePeerConnection:
|
|
28
|
-
${t.sdp}.`),this.remotePeerConnection&&(this.trace("remotePeerConnection setLocalDescription start."),this.remotePeerConnection.setLocalDescription(t).then(()=>{this.setLocalDescriptionSuccess(this.remotePeerConnection)}).catch(e=>this.setSessionDescriptionError(e))),this.localPeerConnection&&(this.trace("localPeerConnection setRemoteDescription start."),this.localPeerConnection.setRemoteDescription(t).then(()=>{this.setRemoteDescriptionSuccess(this.localPeerConnection)}).catch(e=>this.setSessionDescriptionError(e)))}setSessionDescriptionError(t){this.trace(`Failed to create session description: ${t.toString()}.`)}setDescriptionSuccess(t,e){const n=this.getPeerName(t);this.trace(`${n} ${e} complete.`)}setLocalDescriptionSuccess(t){this.setDescriptionSuccess(t,"setLocalDescription")}setRemoteDescriptionSuccess(t){this.setDescriptionSuccess(t,"setRemoteDescription")}trace(t){t=t.trim();const e=(window.performance.now()/1e3).toFixed(3);console.log(e,t);const n=document.createElement("div");n.innerHTML=`<div>${e}, ${t}</div>`,document.getElementById("trace")?.appendChild(n)}getOtherPeer(t){return t===this.localPeerConnection?this.remotePeerConnection:this.localPeerConnection}getPeerName(t){return t===this.localPeerConnection?"localPeerConnection":"remotePeerConnection"}}class Zm{canvas;gl;constructor(t){this.canvas=t;const e={alpha:!0,premultipliedAlpha:!1};if(this.gl=this.canvas.getContext("webgl",e),!this.gl)throw new Error("WebGL failed to initialize.")}}function Lc(i,t){return!i||i.parentElement===null?t:Lc(i.parentElement,t.concat([i]))}const Ga=function(i,t){return getComputedStyle(i,null).getPropertyValue(t)},Jm=function(i){return Ga(i,"overflow")+Ga(i,"overflow-y")+Ga(i,"overflow-x")},Qm=function(i){return/(auto|scroll)/.test(Jm(i))};function t5(i){if(!(i instanceof HTMLElement||i instanceof SVGElement))return;const t=Lc(i.parentElement,[]);for(let e=0;e<t.length;e+=1)if(Qm(t[e]))return t[e];return document.scrollingElement||document.documentElement}var Ba={exports:{}},br={},Oc={},Y={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i._registerNode=i.Konva=i.glob=void 0;const t=Math.PI/180;function e(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}i.glob=typeof zl<"u"?zl:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},i.Konva={_global:i.glob,version:"9.2.2",isBrowser:e(),isUnminified:/param/.test(function(r){}.toString()),dblClickWindow:400,getAngle(r){return i.Konva.angleDeg?r*t:r},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return i.Konva.DD.isDragging},isDragReady(){return!!i.Konva.DD.node},releaseCanvasOnDestroy:!0,document:i.glob.document,_injectGlobal(r){i.glob.Konva=r}};const n=r=>{i.Konva[r.prototype.getClassName()]=r};i._registerNode=n,i.Konva._injectGlobal(i.Konva)})(Y);var gt={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Util=i.Transform=void 0;const t=Y;class e{constructor(v=[1,0,0,1,0,0]){this.dirty=!1,this.m=v&&v.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(){return new e(this.m)}copyInto(v){v.m[0]=this.m[0],v.m[1]=this.m[1],v.m[2]=this.m[2],v.m[3]=this.m[3],v.m[4]=this.m[4],v.m[5]=this.m[5]}point(v){var w=this.m;return{x:w[0]*v.x+w[2]*v.y+w[4],y:w[1]*v.x+w[3]*v.y+w[5]}}translate(v,w){return this.m[4]+=this.m[0]*v+this.m[2]*w,this.m[5]+=this.m[1]*v+this.m[3]*w,this}scale(v,w){return this.m[0]*=v,this.m[1]*=v,this.m[2]*=w,this.m[3]*=w,this}rotate(v){var w=Math.cos(v),S=Math.sin(v),k=this.m[0]*w+this.m[2]*S,C=this.m[1]*w+this.m[3]*S,A=this.m[0]*-S+this.m[2]*w,x=this.m[1]*-S+this.m[3]*w;return this.m[0]=k,this.m[1]=C,this.m[2]=A,this.m[3]=x,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(v,w){var S=this.m[0]+this.m[2]*w,k=this.m[1]+this.m[3]*w,C=this.m[2]+this.m[0]*v,A=this.m[3]+this.m[1]*v;return this.m[0]=S,this.m[1]=k,this.m[2]=C,this.m[3]=A,this}multiply(v){var w=this.m[0]*v.m[0]+this.m[2]*v.m[1],S=this.m[1]*v.m[0]+this.m[3]*v.m[1],k=this.m[0]*v.m[2]+this.m[2]*v.m[3],C=this.m[1]*v.m[2]+this.m[3]*v.m[3],A=this.m[0]*v.m[4]+this.m[2]*v.m[5]+this.m[4],x=this.m[1]*v.m[4]+this.m[3]*v.m[5]+this.m[5];return this.m[0]=w,this.m[1]=S,this.m[2]=k,this.m[3]=C,this.m[4]=A,this.m[5]=x,this}invert(){var v=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),w=this.m[3]*v,S=-this.m[1]*v,k=-this.m[2]*v,C=this.m[0]*v,A=v*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),x=v*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=w,this.m[1]=S,this.m[2]=k,this.m[3]=C,this.m[4]=A,this.m[5]=x,this}getMatrix(){return this.m}decompose(){var v=this.m[0],w=this.m[1],S=this.m[2],k=this.m[3],C=this.m[4],A=this.m[5],x=v*k-w*S;let T={x:C,y:A,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(v!=0||w!=0){var M=Math.sqrt(v*v+w*w);T.rotation=w>0?Math.acos(v/M):-Math.acos(v/M),T.scaleX=M,T.scaleY=x/M,T.skewX=(v*S+w*k)/x,T.skewY=0}else if(S!=0||k!=0){var D=Math.sqrt(S*S+k*k);T.rotation=Math.PI/2-(k>0?Math.acos(-S/D):-Math.acos(S/D)),T.scaleX=x/D,T.scaleY=D,T.skewX=0,T.skewY=(v*S+w*k)/x}return T.rotation=i.Util._getRotation(T.rotation),T}}i.Transform=e;var n="[object Array]",r="[object Number]",s="[object String]",a="[object Boolean]",o=Math.PI/180,h=180/Math.PI,l="#",c="",d="0",f="Konva warning: ",u="Konva error: ",g="rgb(",p={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,132,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,255,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,203],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:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,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,5]},_=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,y=[];const b=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(m){setTimeout(m,60)};i.Util={_isElement(m){return!!(m&&m.nodeType==1)},_isFunction(m){return!!(m&&m.constructor&&m.call&&m.apply)},_isPlainObject(m){return!!m&&m.constructor===Object},_isArray(m){return Object.prototype.toString.call(m)===n},_isNumber(m){return Object.prototype.toString.call(m)===r&&!isNaN(m)&&isFinite(m)},_isString(m){return Object.prototype.toString.call(m)===s},_isBoolean(m){return Object.prototype.toString.call(m)===a},isObject(m){return m instanceof Object},isValidSelector(m){if(typeof m!="string")return!1;var v=m[0];return v==="#"||v==="."||v===v.toUpperCase()},_sign(m){return m===0||m>0?1:-1},requestAnimFrame(m){y.push(m),y.length===1&&b(function(){const v=y;y=[],v.forEach(function(w){w()})})},createCanvasElement(){var m=document.createElement("canvas");try{m.style=m.style||{}}catch{}return m},createImageElement(){return document.createElement("img")},_isInDocument(m){for(;m=m.parentNode;)if(m==document)return!0;return!1},_urlToImage(m,v){var w=i.Util.createImageElement();w.onload=function(){v(w)},w.src=m},_rgbToHex(m,v,w){return(16777216+(m<<16)+(v<<8)+w).toString(16).slice(1)},_hexToRgb(m){m=m.replace(l,c);var v=parseInt(m,16);return{r:v>>16&255,g:v>>8&255,b:v&255}},getRandomColor(){for(var m=(Math.random()*16777215<<0).toString(16);m.length<6;)m=d+m;return l+m},getRGB(m){var v;return m in p?(v=p[m],{r:v[0],g:v[1],b:v[2]}):m[0]===l?this._hexToRgb(m.substring(1)):m.substr(0,4)===g?(v=_.exec(m.replace(/ /g,"")),{r:parseInt(v[1],10),g:parseInt(v[2],10),b:parseInt(v[3],10)}):{r:0,g:0,b:0}},colorToRGBA(m){return m=m||"black",i.Util._namedColorToRBA(m)||i.Util._hex3ColorToRGBA(m)||i.Util._hex4ColorToRGBA(m)||i.Util._hex6ColorToRGBA(m)||i.Util._hex8ColorToRGBA(m)||i.Util._rgbColorToRGBA(m)||i.Util._rgbaColorToRGBA(m)||i.Util._hslColorToRGBA(m)},_namedColorToRBA(m){var v=p[m.toLowerCase()];return v?{r:v[0],g:v[1],b:v[2],a:1}:null},_rgbColorToRGBA(m){if(m.indexOf("rgb(")===0){m=m.match(/rgb\(([^)]+)\)/)[1];var v=m.split(/ *, */).map(Number);return{r:v[0],g:v[1],b:v[2],a:1}}},_rgbaColorToRGBA(m){if(m.indexOf("rgba(")===0){m=m.match(/rgba\(([^)]+)\)/)[1];var v=m.split(/ *, */).map((w,S)=>w.slice(-1)==="%"?S===3?parseInt(w)/100:parseInt(w)/100*255:Number(w));return{r:v[0],g:v[1],b:v[2],a:v[3]}}},_hex8ColorToRGBA(m){if(m[0]==="#"&&m.length===9)return{r:parseInt(m.slice(1,3),16),g:parseInt(m.slice(3,5),16),b:parseInt(m.slice(5,7),16),a:parseInt(m.slice(7,9),16)/255}},_hex6ColorToRGBA(m){if(m[0]==="#"&&m.length===7)return{r:parseInt(m.slice(1,3),16),g:parseInt(m.slice(3,5),16),b:parseInt(m.slice(5,7),16),a:1}},_hex4ColorToRGBA(m){if(m[0]==="#"&&m.length===5)return{r:parseInt(m[1]+m[1],16),g:parseInt(m[2]+m[2],16),b:parseInt(m[3]+m[3],16),a:parseInt(m[4]+m[4],16)/255}},_hex3ColorToRGBA(m){if(m[0]==="#"&&m.length===4)return{r:parseInt(m[1]+m[1],16),g:parseInt(m[2]+m[2],16),b:parseInt(m[3]+m[3],16),a:1}},_hslColorToRGBA(m){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(m)){const[v,...w]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(m),S=Number(w[0])/360,k=Number(w[1])/100,C=Number(w[2])/100;let A,x,T;if(k===0)return T=C*255,{r:Math.round(T),g:Math.round(T),b:Math.round(T),a:1};C<.5?A=C*(1+k):A=C+k-C*k;const M=2*C-A,D=[0,0,0];for(let O=0;O<3;O++)x=S+.3333333333333333*-(O-1),x<0&&x++,x>1&&x--,6*x<1?T=M+(A-M)*6*x:2*x<1?T=A:3*x<2?T=M+(A-M)*(.6666666666666666-x)*6:T=M,D[O]=T*255;return{r:Math.round(D[0]),g:Math.round(D[1]),b:Math.round(D[2]),a:1}}},haveIntersection(m,v){return!(v.x>m.x+m.width||v.x+v.width<m.x||v.y>m.y+m.height||v.y+v.height<m.y)},cloneObject(m){var v={};for(var w in m)this._isPlainObject(m[w])?v[w]=this.cloneObject(m[w]):this._isArray(m[w])?v[w]=this.cloneArray(m[w]):v[w]=m[w];return v},cloneArray(m){return m.slice(0)},degToRad(m){return m*o},radToDeg(m){return m*h},_degToRad(m){return i.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),i.Util.degToRad(m)},_radToDeg(m){return i.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),i.Util.radToDeg(m)},_getRotation(m){return t.Konva.angleDeg?i.Util.radToDeg(m):m},_capitalize(m){return m.charAt(0).toUpperCase()+m.slice(1)},throw(m){throw new Error(u+m)},error(m){console.error(u+m)},warn(m){t.Konva.showWarnings&&console.warn(f+m)},each(m,v){for(var w in m)v(w,m[w])},_inRange(m,v,w){return v<=m&&m<w},_getProjectionToSegment(m,v,w,S,k,C){var A,x,T,M=(m-w)*(m-w)+(v-S)*(v-S);if(M==0)A=m,x=v,T=(k-w)*(k-w)+(C-S)*(C-S);else{var D=((k-m)*(w-m)+(C-v)*(S-v))/M;D<0?(A=m,x=v,T=(m-k)*(m-k)+(v-C)*(v-C)):D>1?(A=w,x=S,T=(w-k)*(w-k)+(S-C)*(S-C)):(A=m+D*(w-m),x=v+D*(S-v),T=(A-k)*(A-k)+(x-C)*(x-C))}return[A,x,T]},_getProjectionToLine(m,v,w){var S=i.Util.cloneObject(m),k=Number.MAX_VALUE;return v.forEach(function(C,A){if(!(!w&&A===v.length-1)){var x=v[(A+1)%v.length],T=i.Util._getProjectionToSegment(C.x,C.y,x.x,x.y,m.x,m.y),M=T[0],D=T[1],O=T[2];O<k&&(S.x=M,S.y=D,k=O)}}),S},_prepareArrayForTween(m,v,w){var S,k=[],C=[];if(m.length>v.length){var A=v;v=m,m=A}for(S=0;S<m.length;S+=2)k.push({x:m[S],y:m[S+1]});for(S=0;S<v.length;S+=2)C.push({x:v[S],y:v[S+1]});var x=[];return C.forEach(function(T){var M=i.Util._getProjectionToLine(T,k,w);x.push(M.x),x.push(M.y)}),x},_prepareToStringify(m){var v;m.visitedByCircularReferenceRemoval=!0;for(var w in m)if(m.hasOwnProperty(w)&&m[w]&&typeof m[w]=="object"){if(v=Object.getOwnPropertyDescriptor(m,w),m[w].visitedByCircularReferenceRemoval||i.Util._isElement(m[w]))if(v.configurable)delete m[w];else return null;else if(i.Util._prepareToStringify(m[w])===null)if(v.configurable)delete m[w];else return null}return delete m.visitedByCircularReferenceRemoval,m},_assign(m,v){for(var w in v)m[w]=v[w];return m},_getFirstPointerId(m){return m.touches?m.changedTouches[0].identifier:m.pointerId||999},releaseCanvas(...m){t.Konva.releaseCanvasOnDestroy&&m.forEach(v=>{v.width=0,v.height=0})},drawRoundedRectPath(m,v,w,S){let k=0,C=0,A=0,x=0;typeof S=="number"?k=C=A=x=Math.min(S,v/2,w/2):(k=Math.min(S[0]||0,v/2,w/2),C=Math.min(S[1]||0,v/2,w/2),x=Math.min(S[2]||0,v/2,w/2),A=Math.min(S[3]||0,v/2,w/2)),m.moveTo(k,0),m.lineTo(v-C,0),m.arc(v-C,C,C,Math.PI*3/2,0,!1),m.lineTo(v,w-x),m.arc(v-x,w-x,x,0,Math.PI/2,!1),m.lineTo(A,w),m.arc(A,w-A,A,Math.PI/2,Math.PI,!1),m.lineTo(0,k),m.arc(k,k,k,Math.PI,Math.PI*3/2,!1)}}})(gt);var dt={},X={},N={};Object.defineProperty(N,"__esModule",{value:!0}),N.getComponentValidator=N.getBooleanValidator=N.getNumberArrayValidator=N.getFunctionValidator=N.getStringOrGradientValidator=N.getStringValidator=N.getNumberOrAutoValidator=N.getNumberOrArrayOfNumbersValidator=N.getNumberValidator=N.alphaComponent=N.RGBComponent=void 0;const fe=Y,mt=gt;function ge(i){return mt.Util._isString(i)?'"'+i+'"':Object.prototype.toString.call(i)==="[object Number]"||mt.Util._isBoolean(i)?i:Object.prototype.toString.call(i)}function e5(i){return i>255?255:i<0?0:Math.round(i)}N.RGBComponent=e5;function i5(i){return i>1?1:i<1e-4?1e-4:i}N.alphaComponent=i5;function n5(){if(fe.Konva.isUnminified)return function(i,t){return mt.Util._isNumber(i)||mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),i}}N.getNumberValidator=n5;function r5(i){if(fe.Konva.isUnminified)return function(t,e){let n=mt.Util._isNumber(t),r=mt.Util._isArray(t)&&t.length==i;return!n&&!r&&mt.Util.warn(ge(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or Array<number>('+i+")"),t}}N.getNumberOrArrayOfNumbersValidator=r5;function s5(){if(fe.Konva.isUnminified)return function(i,t){var e=mt.Util._isNumber(i),n=i==="auto";return e||n||mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),i}}N.getNumberOrAutoValidator=s5;function a5(){if(fe.Konva.isUnminified)return function(i,t){return mt.Util._isString(i)||mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),i}}N.getStringValidator=a5;function o5(){if(fe.Konva.isUnminified)return function(i,t){const e=mt.Util._isString(i),n=Object.prototype.toString.call(i)==="[object CanvasGradient]"||i&&i.addColorStop;return e||n||mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),i}}N.getStringOrGradientValidator=o5;function l5(){if(fe.Konva.isUnminified)return function(i,t){return mt.Util._isFunction(i)||mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),i}}N.getFunctionValidator=l5;function h5(){if(fe.Konva.isUnminified)return function(i,t){const e=Int8Array?Object.getPrototypeOf(Int8Array):null;return e&&i instanceof e||(mt.Util._isArray(i)?i.forEach(function(n){mt.Util._isNumber(n)||mt.Util.warn('"'+t+'" attribute has non numeric element '+n+". Make sure that all elements are numbers.")}):mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),i}}N.getNumberArrayValidator=h5;function c5(){if(fe.Konva.isUnminified)return function(i,t){var e=i===!0||i===!1;return e||mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),i}}N.getBooleanValidator=c5;function u5(i){if(fe.Konva.isUnminified)return function(t,e){return t==null||mt.Util.isObject(t)||mt.Util.warn(ge(t)+' is a not valid value for "'+e+'" attribute. The value should be an object with properties '+i),t}}N.getComponentValidator=u5,function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Factory=void 0;const t=gt,e=N;var n="get",r="set";i.Factory={addGetterSetter(s,a,o,h,l){i.Factory.addGetter(s,a,o),i.Factory.addSetter(s,a,h,l),i.Factory.addOverloadedGetterSetter(s,a)},addGetter(s,a,o){var h=n+t.Util._capitalize(a);s.prototype[h]=s.prototype[h]||function(){var l=this.attrs[a];return l===void 0?o:l}},addSetter(s,a,o,h){var l=r+t.Util._capitalize(a);s.prototype[l]||i.Factory.overWriteSetter(s,a,o,h)},overWriteSetter(s,a,o,h){var l=r+t.Util._capitalize(a);s.prototype[l]=function(c){return o&&c!==void 0&&c!==null&&(c=o.call(this,c,a)),this._setAttr(a,c),h&&h.call(this),this}},addComponentsGetterSetter(s,a,o,h,l){var c=o.length,d=t.Util._capitalize,f=n+d(a),u=r+d(a),g,p;s.prototype[f]=function(){var y={};for(g=0;g<c;g++)p=o[g],y[p]=this.getAttr(a+d(p));return y};var _=(0,e.getComponentValidator)(o);s.prototype[u]=function(y){var b=this.attrs[a],m;h&&(y=h.call(this,y)),_&&_.call(this,y,a);for(m in y)y.hasOwnProperty(m)&&this._setAttr(a+d(m),y[m]);return y||o.forEach(v=>{this._setAttr(a+d(v),void 0)}),this._fireChangeEvent(a,b,y),l&&l.call(this),this},i.Factory.addOverloadedGetterSetter(s,a)},addOverloadedGetterSetter(s,a){var o=t.Util._capitalize(a),h=r+o,l=n+o;s.prototype[a]=function(){return arguments.length?(this[h](arguments[0]),this):this[l]()}},addDeprecatedGetterSetter(s,a,o,h){t.Util.error("Adding deprecated "+a);var l=n+t.Util._capitalize(a),c=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";s.prototype[l]=function(){t.Util.error(c);var d=this.attrs[a];return d===void 0?o:d},i.Factory.addSetter(s,a,h,function(){t.Util.error(c)}),i.Factory.addOverloadedGetterSetter(s,a)},backCompat(s,a){t.Util.each(a,function(o,h){var l=s.prototype[h],c=n+t.Util._capitalize(o),d=r+t.Util._capitalize(o);function f(){l.apply(this,arguments),t.Util.error('"'+o+'" method is deprecated and will be removed soon. Use ""'+h+'" instead.')}s.prototype[o]=f,s.prototype[c]=f,s.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}}(X);var $t={},pe={};Object.defineProperty(pe,"__esModule",{value:!0}),pe.HitContext=pe.SceneContext=pe.Context=void 0;const Ic=gt,d5=Y;function f5(i){var t=[],e=i.length,n=Ic.Util,r,s;for(r=0;r<e;r++)s=i[r],n._isNumber(s)?s=Math.round(s*1e3)/1e3:n._isString(s)||(s=s+""),t.push(s);return t}var Fc=",",g5="(",p5=")",m5="([",_5="])",v5=";",y5="()",b5="=",Nc=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],w5=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"];const S5=100;class wr{constructor(t){this.canvas=t,d5.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(t,e){var n=this.traceArr,r=n.length,s="",a,o,h,l;for(a=0;a<r;a++)o=n[a],h=o.method,h?(l=o.args,s+=h,t?s+=y5:Ic.Util._isArray(l[0])?s+=m5+l.join(Fc)+_5:(e&&(l=l.map(c=>typeof c=="number"?Math.floor(c):c)),s+=g5+l.join(Fc)+p5)):(s+=o.property,t||(s+=b5+o.val)),s+=v5;return s}clearTrace(){this.traceArr=[]}_trace(t){var e=this.traceArr,n;e.push(t),n=e.length,n>=S5&&e.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)}_applyLineCap(t){const e=t.attrs.lineCap;e&&this.setAttr("lineCap",e)}_applyOpacity(t){var e=t.getAbsoluteOpacity();e!==1&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){const e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}setAttr(t,e){this._context[t]=e}arc(t,e,n,r,s,a){this._context.arc(t,e,n,r,s,a)}arcTo(t,e,n,r,s){this._context.arcTo(t,e,n,r,s)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,n,r,s,a){this._context.bezierCurveTo(t,e,n,r,s,a)}clearRect(t,e,n,r){this._context.clearRect(t,e,n,r)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){var n=arguments;if(n.length===2)return this._context.createImageData(t,e);if(n.length===1)return this._context.createImageData(t)}createLinearGradient(t,e,n,r){return this._context.createLinearGradient(t,e,n,r)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,n,r,s,a){return this._context.createRadialGradient(t,e,n,r,s,a)}drawImage(t,e,n,r,s,a,o,h,l){var c=arguments,d=this._context;c.length===3?d.drawImage(t,e,n):c.length===5?d.drawImage(t,e,n,r,s):c.length===9&&d.drawImage(t,e,n,r,s,a,o,h,l)}ellipse(t,e,n,r,s,a,o,h){this._context.ellipse(t,e,n,r,s,a,o,h)}isPointInPath(t,e,n,r){return n?this._context.isPointInPath(n,t,e,r):this._context.isPointInPath(t,e,r)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,n,r){this._context.fillRect(t,e,n,r)}strokeRect(t,e,n,r){this._context.strokeRect(t,e,n,r)}fillText(t,e,n,r){r?this._context.fillText(t,e,n,r):this._context.fillText(t,e,n)}measureText(t){return this._context.measureText(t)}getImageData(t,e,n,r){return this._context.getImageData(t,e,n,r)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,n,r){this._context.rect(t,e,n,r)}putImageData(t,e,n){this._context.putImageData(t,e,n)}quadraticCurveTo(t,e,n,r){this._context.quadraticCurveTo(t,e,n,r)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,n,r,s,a){this._context.setTransform(t,e,n,r,s,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,n,r){this._context.strokeText(t,e,n,r)}transform(t,e,n,r,s,a){this._context.transform(t,e,n,r,s,a)}translate(t,e){this._context.translate(t,e)}_enableTrace(){var t=this,e=Nc.length,n=this.setAttr,r,s,a=function(o){var h=t[o],l;t[o]=function(){return s=f5(Array.prototype.slice.call(arguments,0)),l=h.apply(t,arguments),t._trace({method:o,args:s}),l}};for(r=0;r<e;r++)a(Nc[r]);t.setAttr=function(){n.apply(t,arguments);var o=arguments[0],h=arguments[1];(o==="shadowOffsetX"||o==="shadowOffsetY"||o==="shadowBlur")&&(h=h/this.canvas.getPixelRatio()),t._trace({property:o,val:h})}}_applyGlobalCompositeOperation(t){const e=t.attrs.globalCompositeOperation;var n=!e||e==="source-over";n||this.setAttr("globalCompositeOperation",e)}}pe.Context=wr,w5.forEach(function(i){Object.defineProperty(wr.prototype,i,{get(){return this._context[i]},set(t){this._context[i]=t}})});class C5 extends wr{constructor(t,{willReadFrequently:e=!1}={}){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){var e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){var e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){const e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){const e=t.fill(),n=t.getFillPriority();if(e&&n==="color"){this._fillColor(t);return}const r=t.getFillPatternImage();if(r&&n==="pattern"){this._fillPattern(t);return}const s=t.getFillLinearGradientColorStops();if(s&&n==="linear-gradient"){this._fillLinearGradient(t);return}const a=t.getFillRadialGradientColorStops();if(a&&n==="radial-gradient"){this._fillRadialGradient(t);return}e?this._fillColor(t):r?this._fillPattern(t):s?this._fillLinearGradient(t):a&&this._fillRadialGradient(t)}_strokeLinearGradient(t){const e=t.getStrokeLinearGradientStartPoint(),n=t.getStrokeLinearGradientEndPoint(),r=t.getStrokeLinearGradientColorStops(),s=this.createLinearGradient(e.x,e.y,n.x,n.y);if(r){for(var a=0;a<r.length;a+=2)s.addColorStop(r[a],r[a+1]);this.setAttr("strokeStyle",s)}}_stroke(t){var e=t.dash(),n=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!n){this.save();var r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)");var s=t.getStrokeLinearGradientColorStops();s?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),n||this.restore()}}_applyShadow(t){var e,n,r,s=(e=t.getShadowRGBA())!==null&&e!==void 0?e:"black",a=(n=t.getShadowBlur())!==null&&n!==void 0?n:5,o=(r=t.getShadowOffset())!==null&&r!==void 0?r:{x:0,y:0},h=t.getAbsoluteScale(),l=this.canvas.getPixelRatio(),c=h.x*l,d=h.y*l;this.setAttr("shadowColor",s),this.setAttr("shadowBlur",a*Math.min(Math.abs(c),Math.abs(d))),this.setAttr("shadowOffsetX",o.x*c),this.setAttr("shadowOffsetY",o.y*d)}}pe.SceneContext=C5;class x5 extends wr{constructor(t){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:!0})}_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()}strokeShape(t){t.hasHitStroke()&&this._stroke(t)}_stroke(t){if(t.hasHitStroke()){const s=t.getStrokeScaleEnabled();if(!s){this.save();var e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(t);var n=t.hitStrokeWidth(),r=n==="auto"?t.strokeWidth():n;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),s||this.restore()}}}pe.HitContext=x5,Object.defineProperty($t,"__esModule",{value:!0}),$t.HitCanvas=$t.SceneCanvas=$t.Canvas=void 0;const Sr=gt,Uc=pe,Gc=Y,T5=X,E5=N;var Cr;function k5(){if(Cr)return Cr;var i=Sr.Util.createCanvasElement(),t=i.getContext("2d");return Cr=function(){var e=Gc.Konva._global.devicePixelRatio||1,n=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return e/n}(),Sr.Util.releaseCanvas(i),Cr}class xr{constructor(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var e=t||{},n=e.pixelRatio||Gc.Konva.pixelRatio||k5();this.pixelRatio=n,this._canvas=Sr.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"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(t){var e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)}setWidth(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";var e=this.pixelRatio,n=this.getContext()._context;n.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio,n=this.getContext()._context;n.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(t,e){try{return this._canvas.toDataURL(t,e)}catch{try{return this._canvas.toDataURL()}catch(r){return Sr.Util.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}$t.Canvas=xr,T5.Factory.addGetterSetter(xr,"pixelRatio",void 0,(0,E5.getNumberValidator)());class A5 extends xr{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new Uc.SceneContext(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}}$t.SceneCanvas=A5;class P5 extends xr{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new Uc.HitContext(this),this.setSize(t.width,t.height)}}$t.HitCanvas=P5;var Tr={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.DD=void 0;const t=Y,e=gt;i.DD={get isDragging(){var n=!1;return i.DD._dragElements.forEach(r=>{r.dragStatus==="dragging"&&(n=!0)}),n},justDragged:!1,get node(){var n;return i.DD._dragElements.forEach(r=>{n=r.node}),n},_dragElements:new Map,_drag(n){const r=[];i.DD._dragElements.forEach((s,a)=>{const{node:o}=s,h=o.getStage();h.setPointersPositions(n),s.pointerId===void 0&&(s.pointerId=e.Util._getFirstPointerId(n));const l=h._changedPointerPositions.find(f=>f.id===s.pointerId);if(l){if(s.dragStatus!=="dragging"){var c=o.dragDistance(),d=Math.max(Math.abs(l.x-s.startPointerPos.x),Math.abs(l.y-s.startPointerPos.y));if(d<c||(o.startDrag({evt:n}),!o.isDragging()))return}o._setDragPosition(n,s),r.push(o)}}),r.forEach(s=>{s.fire("dragmove",{type:"dragmove",target:s,evt:n},!0)})},_endDragBefore(n){const r=[];i.DD._dragElements.forEach(s=>{const{node:a}=s,o=a.getStage();if(n&&o.setPointersPositions(n),!o._changedPointerPositions.find(c=>c.id===s.pointerId))return;(s.dragStatus==="dragging"||s.dragStatus==="stopped")&&(i.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,s.dragStatus="stopped");const l=s.node.getLayer()||s.node instanceof t.Konva.Stage&&s.node;l&&r.indexOf(l)===-1&&r.push(l)}),r.forEach(s=>{s.draw()})},_endDragAfter(n){i.DD._dragElements.forEach((r,s)=>{r.dragStatus==="stopped"&&r.node.fire("dragend",{type:"dragend",target:r.node,evt:n},!0),r.dragStatus!=="dragging"&&i.DD._dragElements.delete(s)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",i.DD._endDragBefore,!0),window.addEventListener("touchend",i.DD._endDragBefore,!0),window.addEventListener("mousemove",i.DD._drag),window.addEventListener("touchmove",i.DD._drag),window.addEventListener("mouseup",i.DD._endDragAfter,!1),window.addEventListener("touchend",i.DD._endDragAfter,!1))})(Tr),Object.defineProperty(dt,"__esModule",{value:!0}),dt.Node=void 0;const q=gt,Tn=X,Er=$t,ti=Y,jt=Tr,yt=N;var kr="absoluteOpacity",Ar="allEventListeners",me="absoluteTransform",Bc="absoluteScale",ei="canvas",M5="Change",R5="children",D5="konva",za="listening",zc="mouseenter",Hc="mouseleave",jc="set",Vc="Shape",Pr=" ",$c="stage",Oe="transform",L5="Stage",Ha="visible",O5=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Pr);let I5=1,V=class bo{constructor(t){this._id=I5++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===Oe||t===me)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,e){var n=this._cache.get(t),r=t===Oe||t===me,s=n===void 0||r&&n.dirty===!0;return s&&(n=e.call(this),this._cache.set(t,n)),n}_calculate(t,e,n){if(!this._attachedDepsListeners.get(t)){const r=e.map(s=>s+"Change.konva").join(Pr);this.on(r,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,n)}_getCanvasCache(){return this._cache.get(ei)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===me&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(ei)){const{scene:t,filter:e,hit:n}=this._cache.get(ei);q.Util.releaseCanvas(t,e,n),this._cache.delete(ei)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var e=t||{},n={};(e.x===void 0||e.y===void 0||e.width===void 0||e.height===void 0)&&(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));var r=Math.ceil(e.width||n.width),s=Math.ceil(e.height||n.height),a=e.pixelRatio,o=e.x===void 0?Math.floor(n.x):e.x,h=e.y===void 0?Math.floor(n.y):e.y,l=e.offset||0,c=e.drawBorder||!1,d=e.hitCanvasPixelRatio||1;if(!r||!s){q.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}r+=l*2+1,s+=l*2+1,o-=l,h-=l;var f=new Er.SceneCanvas({pixelRatio:a,width:r,height:s}),u=new Er.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),g=new Er.HitCanvas({pixelRatio:d,width:r,height:s}),p=f.getContext(),_=g.getContext();return g.isCache=!0,f.isCache=!0,this._cache.delete(ei),this._filterUpToDate=!1,e.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,u.getContext()._context.imageSmoothingEnabled=!1),p.save(),_.save(),p.translate(-o,-h),_.translate(-o,-h),this._isUnderCache=!0,this._clearSelfAndDescendantCache(kr),this._clearSelfAndDescendantCache(Bc),this.drawScene(f,this),this.drawHit(g,this),this._isUnderCache=!1,p.restore(),_.restore(),c&&(p.save(),p.beginPath(),p.rect(0,0,r,s),p.closePath(),p.setAttr("strokeStyle","red"),p.setAttr("lineWidth",5),p.stroke(),p.restore()),this._cache.set(ei,{scene:f,filter:u,hit:g,x:o,y:h}),this._requestDraw(),this}isCached(){return this._cache.has(ei)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){var n=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],r=1/0,s=1/0,a=-1/0,o=-1/0,h=this.getAbsoluteTransform(e);return n.forEach(function(l){var c=h.point(l);r===void 0&&(r=a=c.x,s=o=c.y),r=Math.min(r,c.x),s=Math.min(s,c.y),a=Math.max(a,c.x),o=Math.max(o,c.y)}),{x:r,y:s,width:a-r,height:o-s}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const e=this._getCanvasCache();t.translate(e.x,e.y);var n=this._getCachedSceneCanvas(),r=n.pixelRatio;t.drawImage(n._canvas,0,0,n.width/r,n.height/r),t.restore()}_drawCachedHitCanvas(t){var e=this._getCanvasCache(),n=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),e=this._getCanvasCache(),n=e.scene,r=e.filter,s=r.getContext(),a,o,h,l;if(t){if(!this._filterUpToDate){var c=n.pixelRatio;r.setSize(n.width/n.pixelRatio,n.height/n.pixelRatio);try{for(a=t.length,s.clear(),s.drawImage(n._canvas,0,0,n.getWidth()/c,n.getHeight()/c),o=s.getImageData(0,0,r.getWidth(),r.getHeight()),h=0;h<a;h++){if(l=t[h],typeof l!="function"){q.Util.error("Filter should be type of function, but got "+typeof l+" instead. Please check correct filters");continue}l.call(this,o),s.putImageData(o,0,0)}}catch(d){q.Util.error("Unable to apply filter. "+d.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return r}return n}on(t,e){if(this._cache&&this._cache.delete(Ar),arguments.length===3)return this._delegate.apply(this,arguments);var n=t.split(Pr),r=n.length,s,a,o,h,l;for(s=0;s<r;s++)a=n[s],o=a.split("."),h=o[0],l=o[1]||"",this.eventListeners[h]||(this.eventListeners[h]=[]),this.eventListeners[h].push({name:l,handler:e});return this}off(t,e){var n=(t||"").split(Pr),r=n.length,s,a,o,h,l,c;if(this._cache&&this._cache.delete(Ar),!t)for(a in this.eventListeners)this._off(a);for(s=0;s<r;s++)if(o=n[s],h=o.split("."),l=h[0],c=h[1],l)this.eventListeners[l]&&this._off(l,c,e);else for(a in this.eventListeners)this._off(a,c,e);return this}dispatchEvent(t){var e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,function(n){e.call(this,n.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,e,n){var r=this;this.on(t,function(s){for(var a=s.target.findAncestors(e,!0,r),o=0;o<a.length;o++)s=q.Util.cloneObject(s),s.currentTarget=a[o],n.call(a[o],s)})}remove(){return this.isDragging()&&this.stopDrag(),jt.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(me),this._clearSelfAndDescendantCache(kr),this._clearSelfAndDescendantCache(Bc),this._clearSelfAndDescendantCache($c),this._clearSelfAndDescendantCache(Ha),this._clearSelfAndDescendantCache(za)}_remove(){this._clearCaches();var t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){var e="get"+q.Util._capitalize(t);return q.Util._isFunction(this[e])?this[e]():this.attrs[t]}getAncestors(){for(var t=this.getParent(),e=[];t;)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges(()=>{var e,n;if(!t)return this;for(e in t)e!==R5&&(n=jc+q.Util._capitalize(e),q.Util._isFunction(this[n])?this[n](t[e]):this._setAttr(e,t[e]))}),this}isListening(){return this._getCache(za,this._isListening)}_isListening(t){if(!this.listening())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isListening(t):!0}isVisible(){return this._getCache(Ha,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isVisible(t):!0}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);var n=this.getLayer(),r=!1;jt.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===n)&&(r=!0)});var s=!e&&!ti.Konva.hitOnDragEnabled&&r;return this.isListening()&&this.isVisible()&&!s}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),e=this,n=0,r,s,a,o;function h(c){for(r=[],s=c.length,a=0;a<s;a++)o=c[a],n++,o.nodeType!==Vc&&(r=r.concat(o.getChildren().slice())),o._id===e._id&&(a=s);r.length>0&&r[0].getDepth()<=t&&h(r)}const l=this.getStage();return e.nodeType!==L5&&l&&h(l.getChildren()),n}getDepth(){for(var t=0,e=this.parent;e;)t++,e=e.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Oe),this._clearSelfAndDescendantCache(me)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;var e=t.getPointerPosition();if(!e)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(e)}getAbsolutePosition(t){let e=!1,n=this.parent;for(;n;){if(n.isCached()){e=!0;break}n=n.parent}e&&!t&&(t=!0);var r=this.getAbsoluteTransform(t).getMatrix(),s=new q.Transform,a=this.offset();return s.m=r.slice(),s.translate(a.x,a.y),s.getTranslation()}setAbsolutePosition(t){const{x:e,y:n,...r}=this._clearTransform();this.attrs.x=e,this.attrs.y=n,this._clearCache(Oe);var s=this._getAbsoluteTransform().copy();return s.invert(),s.translate(t.x,t.y),t={x:this.attrs.x+s.getTranslation().x,y:this.attrs.y+s.getTranslation().y},this._setTransform(r),this.setPosition({x:t.x,y:t.y}),this._clearCache(Oe),this._clearSelfAndDescendantCache(me),this}_setTransform(t){var e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){var t={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()};return 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,t}move(t){var e=t.x,n=t.y,r=this.x(),s=this.y();return e!==void 0&&(r+=e),n!==void 0&&(s+=n),this.setPosition({x:r,y:s}),this}_eachAncestorReverse(t,e){var n=[],r=this.getParent(),s,a;if(!(e&&e._id===this._id)){for(n.unshift(this);r&&(!e||r._id!==e._id);)n.unshift(r),r=r.parent;for(s=n.length,a=0;a<s;a++)t(n[a])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return q.Util.warn("Node has no parent. moveToTop function is ignored."),!1;var t=this.index,e=this.parent.getChildren().length;return t<e-1?(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return q.Util.warn("Node has no parent. moveUp function is ignored."),!1;var t=this.index,e=this.parent.getChildren().length;return t<e-1?(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return q.Util.warn("Node has no parent. moveDown function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return q.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return q.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&q.Util.warn("Unexpected value "+t+" 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)+".");var e=this.index;return this.parent.children.splice(e,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(kr,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),e=this.getParent();return e&&!e._isUnderCache&&(t*=e.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},e=this.getAttrs(),n,r,s,a,o;t.attrs={};for(n in e)r=e[n],o=q.Util.isObject(r)&&!q.Util._isPlainObject(r)&&!q.Util._isArray(r),!o&&(s=typeof this[n]=="function"&&this[n],delete e[n],a=s?s.call(this):null,e[n]=r,a!==r&&(t.attrs[n]=r));return t.className=this.getClassName(),q.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,n){var r=[];e&&this._isMatch(t)&&r.push(this);for(var s=this.parent;s;){if(s===n)return r;s._isMatch(t)&&r.push(s),s=s.parent}return r}isAncestorOf(t){return!1}findAncestor(t,e,n){return this.findAncestors(t,e,n)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var e=t.replace(/ /g,"").split(","),n=e.length,r,s;for(r=0;r<n;r++)if(s=e[r],q.Util.isValidSelector(s)||(q.Util.warn('Selector "'+s+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),q.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),q.Util.warn("Konva is awesome, right?")),s.charAt(0)==="#"){if(this.id()===s.slice(1))return!0}else if(s.charAt(0)==="."){if(this.hasName(s.slice(1)))return!0}else if(this.className===s||this.nodeType===s)return!0;return!1}getLayer(){var t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache($c,this._getStage)}_getStage(){var t=this.getParent();return t?t.getStage():null}fire(t,e={},n){return e.target=e.target||this,n?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(me,this._getAbsoluteTransform)}_getAbsoluteTransform(t){var e;if(t)return e=new q.Transform,this._eachAncestorReverse(function(r){var s=r.transformsEnabled();s==="all"?e.multiply(r.getTransform()):s==="position"&&e.translate(r.x()-r.offsetX(),r.y()-r.offsetY())},t),e;e=this._cache.get(me)||new q.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(e):e.reset();var n=this.transformsEnabled();if(n==="all")e.multiply(this.getTransform());else if(n==="position"){const r=this.attrs.x||0,s=this.attrs.y||0,a=this.attrs.offsetX||0,o=this.attrs.offsetY||0;e.translate(r-a,s-o)}return e.dirty=!1,e}getAbsoluteScale(t){for(var e=this;e;)e._isUnderCache&&(t=e),e=e.getParent();const r=this.getAbsoluteTransform(t).decompose();return{x:r.scaleX,y:r.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Oe,this._getTransform)}_getTransform(){var t,e,n=this._cache.get(Oe)||new q.Transform;n.reset();var r=this.x(),s=this.y(),a=ti.Konva.getAngle(this.rotation()),o=(t=this.attrs.scaleX)!==null&&t!==void 0?t:1,h=(e=this.attrs.scaleY)!==null&&e!==void 0?e:1,l=this.attrs.skewX||0,c=this.attrs.skewY||0,d=this.attrs.offsetX||0,f=this.attrs.offsetY||0;return(r!==0||s!==0)&&n.translate(r,s),a!==0&&n.rotate(a),(l!==0||c!==0)&&n.skew(l,c),(o!==1||h!==1)&&n.scale(o,h),(d!==0||f!==0)&&n.translate(-1*d,-1*f),n.dirty=!1,n}clone(t){var e=q.Util.cloneObject(this.attrs),n,r,s,a,o;for(n in t)e[n]=t[n];var h=new this.constructor(e);for(n in this.eventListeners)for(r=this.eventListeners[n],s=r.length,a=0;a<s;a++)o=r[a],o.name.indexOf(D5)<0&&(h.eventListeners[n]||(h.eventListeners[n]=[]),h.eventListeners[n].push(o));return h}_toKonvaCanvas(t){t=t||{};var e=this.getClientRect(),n=this.getStage(),r=t.x!==void 0?t.x:Math.floor(e.x),s=t.y!==void 0?t.y:Math.floor(e.y),a=t.pixelRatio||1,o=new Er.SceneCanvas({width:t.width||Math.ceil(e.width)||(n?n.width():0),height:t.height||Math.ceil(e.height)||(n?n.height():0),pixelRatio:a}),h=o.getContext();return t.imageSmoothingEnabled===!1&&(h._context.imageSmoothingEnabled=!1),h.save(),(r||s)&&h.translate(-1*r,-1*s),this.drawScene(o),h.restore(),o}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){t=t||{};var e=t.mimeType||null,n=t.quality||null,r=this._toKonvaCanvas(t).toDataURL(e,n);return t.callback&&t.callback(r),r}toImage(t){return new Promise((e,n)=>{try{const r=t?.callback;r&&delete t.callback,q.Util._urlToImage(this.toDataURL(t),function(s){e(s),r?.(s)})}catch(r){n(r)}})}toBlob(t){return new Promise((e,n)=>{try{const r=t?.callback;r&&delete t.callback,this.toCanvas(t).toBlob(s=>{e(s),r?.(s)})}catch(r){n(r)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():ti.Konva.dragDistance}_off(t,e,n){var r=this.eventListeners[t],s,a,o;for(s=0;s<r.length;s++)if(a=r[s].name,o=r[s].handler,(a!=="konva"||e==="konva")&&(!e||a===e)&&(!n||n===o)){if(r.splice(s,1),r.length===0){delete this.eventListeners[t];break}s--}}_fireChangeEvent(t,e,n){this._fire(t+M5,{oldVal:e,newVal:n})}addName(t){if(!this.hasName(t)){var e=this.name(),n=e?e+" "+t:t;this.name(n)}return this}hasName(t){if(!t)return!1;const e=this.name();if(!e)return!1;var n=(e||"").split(/\s/g);return n.indexOf(t)!==-1}removeName(t){var e=(this.name()||"").split(/\s/g),n=e.indexOf(t);return n!==-1&&(e.splice(n,1),this.name(e.join(" "))),this}setAttr(t,e){var n=this[jc+q.Util._capitalize(t)];return q.Util._isFunction(n)?n.call(this,e):this._setAttr(t,e),this}_requestDraw(){if(ti.Konva.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,e){var n=this.attrs[t];n===e&&!q.Util.isObject(e)||(e==null?delete this.attrs[t]:this.attrs[t]=e,this._shouldFireChangeEvents&&this._fireChangeEvent(t,n,e),this._requestDraw())}_setComponentAttr(t,e,n){var r;n!==void 0&&(r=this.attrs[t],r||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=n,this._fireChangeEvent(t,r,n))}_fireAndBubble(t,e,n){e&&this.nodeType===Vc&&(e.target=this);var r=(t===zc||t===Hc)&&(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||this.nodeType==="Stage"&&!n);if(!r){this._fire(t,e);var s=(t===zc||t===Hc)&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!s&&(n&&n.parent?this._fireAndBubble.call(this.parent,t,e,n):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,n,r;const s=(e=this._cache.get(Ar))!==null&&e!==void 0?e:{};let a=s?.[t];if(a===void 0){a=[];let o=Object.getPrototypeOf(this);for(;o;){const h=(r=(n=o.eventListeners)===null||n===void 0?void 0:n[t])!==null&&r!==void 0?r:[];a.push(...h),o=Object.getPrototypeOf(o)}s[t]=a,this._cache.set(Ar,s)}return a}_fire(t,e){e=e||{},e.currentTarget=this,e.type=t;const n=this._getProtoListeners(t);if(n)for(var r=0;r<n.length;r++)n[r].handler.call(this,e);const s=this.eventListeners[t];if(s)for(var r=0;r<s.length;r++)s[r].handler.call(this,e)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){var e=t?t.pointerId:void 0,n=this.getStage(),r=this.getAbsolutePosition();if(n){var s=n._getPointerById(e)||n._changedPointerPositions[0]||r;jt.DD._dragElements.set(this._id,{node:this,startPointerPos:s,offset:{x:s.x-r.x,y:s.y-r.y},dragStatus:"ready",pointerId:e})}}startDrag(t,e=!0){jt.DD._dragElements.has(this._id)||this._createDragElement(t);const n=jt.DD._dragElements.get(this._id);n.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(t,e){const n=this.getStage()._getPointerById(e.pointerId);if(n){var r={x:n.x-e.offset.x,y:n.y-e.offset.y},s=this.dragBoundFunc();if(s!==void 0){const a=s.call(this,r,t);a?r=a:q.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==r.x||this._lastPos.y!==r.y)&&(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}}stopDrag(t){const e=jt.DD._dragElements.get(this._id);e&&(e.dragStatus="stopped"),jt.DD._endDragBefore(t),jt.DD._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=jt.DD._dragElements.get(this._id);return t?t.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){var e=t.evt.button!==void 0,n=!e||ti.Konva.dragButtons.indexOf(t.evt.button)>=0;if(n&&!this.isDragging()){var r=!1;jt.DD._dragElements.forEach(s=>{this.isAncestorOf(s.node)&&(r=!0)}),r||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const e=jt.DD._dragElements.get(this._id),n=e&&e.dragStatus==="dragging",r=e&&e.dragStatus==="ready";n?this.stopDrag():r&&jt.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const e=this.getStage();if(!e)return!1;const n={x:-t.x,y:-t.y,width:e.width()+2*t.x,height:e.height()+2*t.y};return q.Util.haveIntersection(n,this.getClientRect())}static create(t,e){return q.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,e)}static _createNode(t,e){var n=bo.prototype.getClassName.call(t),r=t.children,s,a,o;e&&(t.attrs.container=e),ti.Konva[n]||(q.Util.warn('Can not find a node with class name "'+n+'". Fallback to "Shape".'),n="Shape");const h=ti.Konva[n];if(s=new h(t.attrs),r)for(a=r.length,o=0;o<a;o++)s.add(bo._createNode(r[o]));return s}};dt.Node=V,V.prototype.nodeType="Node",V.prototype._attrsAffectingSize=[],V.prototype.eventListeners={},V.prototype.on.call(V.prototype,O5,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Oe),this._clearSelfAndDescendantCache(me)}),V.prototype.on.call(V.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Ha)}),V.prototype.on.call(V.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(za)}),V.prototype.on.call(V.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(kr)});const at=Tn.Factory.addGetterSetter;at(V,"zIndex"),at(V,"absolutePosition"),at(V,"position"),at(V,"x",0,(0,yt.getNumberValidator)()),at(V,"y",0,(0,yt.getNumberValidator)()),at(V,"globalCompositeOperation","source-over",(0,yt.getStringValidator)()),at(V,"opacity",1,(0,yt.getNumberValidator)()),at(V,"name","",(0,yt.getStringValidator)()),at(V,"id","",(0,yt.getStringValidator)()),at(V,"rotation",0,(0,yt.getNumberValidator)()),Tn.Factory.addComponentsGetterSetter(V,"scale",["x","y"]),at(V,"scaleX",1,(0,yt.getNumberValidator)()),at(V,"scaleY",1,(0,yt.getNumberValidator)()),Tn.Factory.addComponentsGetterSetter(V,"skew",["x","y"]),at(V,"skewX",0,(0,yt.getNumberValidator)()),at(V,"skewY",0,(0,yt.getNumberValidator)()),Tn.Factory.addComponentsGetterSetter(V,"offset",["x","y"]),at(V,"offsetX",0,(0,yt.getNumberValidator)()),at(V,"offsetY",0,(0,yt.getNumberValidator)()),at(V,"dragDistance",null,(0,yt.getNumberValidator)()),at(V,"width",0,(0,yt.getNumberValidator)()),at(V,"height",0,(0,yt.getNumberValidator)()),at(V,"listening",!0,(0,yt.getBooleanValidator)()),at(V,"preventDefault",!0,(0,yt.getBooleanValidator)()),at(V,"filters",null,function(i){return this._filterUpToDate=!1,i}),at(V,"visible",!0,(0,yt.getBooleanValidator)()),at(V,"transformsEnabled","all",(0,yt.getStringValidator)()),at(V,"size"),at(V,"dragBoundFunc"),at(V,"draggable",!1,(0,yt.getBooleanValidator)()),Tn.Factory.backCompat(V,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var ii={};Object.defineProperty(ii,"__esModule",{value:!0}),ii.Container=void 0;const ki=X,ja=dt,Mr=N;class ni extends ja.Node{constructor(){super(...arguments),this.children=[]}getChildren(t){if(!t)return this.children||[];const e=this.children||[];var n=[];return e.forEach(function(r){t(r)&&n.push(r)}),n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var e=0;e<t.length;e++)this.add(t[e]);return this}const n=t[0];return n.getParent()?(n.moveTo(this),this):(this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){var e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){var n=[];return this._descendants(r=>{const s=r._isMatch(t);return s&&n.push(r),!!(s&&e)}),n}_descendants(t){let e=!1;const n=this.getChildren();for(const r of n){if(e=t(r),e)return!0;if(r.hasChildren()&&(e=r._descendants(t),e))return!0}return!1}toObject(){var t=ja.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(e=>{t.children.push(e.toObject())}),t}isAncestorOf(t){for(var e=t.getParent();e;){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){var e=ja.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(n){e.add(n.clone())}),e}getAllIntersections(t){var e=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(t)&&e.push(n)}),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),!this.isCached()&&((e=this.children)===null||e===void 0||e.forEach(function(n){n._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(e,n){e.index=n}),this._requestDraw()}drawScene(t,e){var n=this.getLayer(),r=t||n&&n.getCanvas(),s=r&&r.getContext(),a=this._getCanvasCache(),o=a&&a.scene,h=r&&r.isCache;if(!this.isVisible()&&!h)return this;if(o){s.save();var l=this.getAbsoluteTransform(e).getMatrix();s.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedSceneCanvas(s),s.restore()}else this._drawChildren("drawScene",r,e);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;var n=this.getLayer(),r=t||n&&n.hitCanvas,s=r&&r.getContext(),a=this._getCanvasCache(),o=a&&a.hit;if(o){s.save();var h=this.getAbsoluteTransform(e).getMatrix();s.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(s),s.restore()}else this._drawChildren("drawHit",r,e);return this}_drawChildren(t,e,n){var r,s=e&&e.getContext(),a=this.clipWidth(),o=this.clipHeight(),h=this.clipFunc(),l=a&&o||h;const c=n===this;if(l){s.save();var d=this.getAbsoluteTransform(n),f=d.getMatrix();s.transform(f[0],f[1],f[2],f[3],f[4],f[5]),s.beginPath();let _;if(h)_=h.call(this,s,this);else{var u=this.clipX(),g=this.clipY();s.rect(u,g,a,o)}s.clip.apply(s,_),f=d.copy().invert().getMatrix(),s.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var p=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";p&&(s.save(),s._applyGlobalCompositeOperation(this)),(r=this.children)===null||r===void 0||r.forEach(function(_){_[t](e,n)}),p&&s.restore(),l&&s.restore()}getClientRect(t={}){var e,n=t.skipTransform,r=t.relativeTo,s,a,o,h,l={x:1/0,y:1/0,width:0,height:0},c=this;(e=this.children)===null||e===void 0||e.forEach(function(p){if(p.visible()){var _=p.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});_.width===0&&_.height===0||(s===void 0?(s=_.x,a=_.y,o=_.x+_.width,h=_.y+_.height):(s=Math.min(s,_.x),a=Math.min(a,_.y),o=Math.max(o,_.x+_.width),h=Math.max(h,_.y+_.height)))}});for(var d=this.find("Shape"),f=!1,u=0;u<d.length;u++){var g=d[u];if(g._isVisible(this)){f=!0;break}}return f&&s!==void 0?l={x:s,y:a,width:o-s,height:h-a}:l={x:0,y:0,width:0,height:0},n?l:this._transformedRect(l,r)}}ii.Container=ni,ki.Factory.addComponentsGetterSetter(ni,"clip",["x","y","width","height"]),ki.Factory.addGetterSetter(ni,"clipX",void 0,(0,Mr.getNumberValidator)()),ki.Factory.addGetterSetter(ni,"clipY",void 0,(0,Mr.getNumberValidator)()),ki.Factory.addGetterSetter(ni,"clipWidth",void 0,(0,Mr.getNumberValidator)()),ki.Factory.addGetterSetter(ni,"clipHeight",void 0,(0,Mr.getNumberValidator)()),ki.Factory.addGetterSetter(ni,"clipFunc");var Xc={},Ft={};Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.releaseCapture=Ft.setPointerCapture=Ft.hasPointerCapture=Ft.createEvent=Ft.getCapturedShape=void 0;const F5=Y,En=new Map,Yc=F5.Konva._global.PointerEvent!==void 0;function N5(i){return En.get(i)}Ft.getCapturedShape=N5;function Va(i){return{evt:i,pointerId:i.pointerId}}Ft.createEvent=Va;function U5(i,t){return En.get(i)===t}Ft.hasPointerCapture=U5;function G5(i,t){Wc(i),t.getStage()&&(En.set(i,t),Yc&&t._fire("gotpointercapture",Va(new PointerEvent("gotpointercapture"))))}Ft.setPointerCapture=G5;function Wc(i,t){const e=En.get(i);if(!e)return;const n=e.getStage();n&&n.content,En.delete(i),Yc&&e._fire("lostpointercapture",Va(new PointerEvent("lostpointercapture")))}Ft.releaseCapture=Wc,function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Stage=i.stages=void 0;const t=gt,e=X,n=ii,r=Y,s=$t,a=Tr,o=Y,h=Ft;var l="Stage",c="string",d="px",f="mouseout",u="mouseleave",g="mouseover",p="mouseenter",_="mousemove",y="mousedown",b="mouseup",m="pointermove",v="pointerdown",w="pointerup",S="pointercancel",k="lostpointercapture",C="pointerout",A="pointerleave",x="pointerover",T="pointerenter",M="contextmenu",D="touchstart",O="touchend",I="touchmove",H="touchcancel",j="wheel",$=5,et=[[p,"_pointerenter"],[y,"_pointerdown"],[_,"_pointermove"],[b,"_pointerup"],[u,"_pointerleave"],[D,"_pointerdown"],[I,"_pointermove"],[O,"_pointerup"],[H,"_pointercancel"],[g,"_pointerover"],[j,"_wheel"],[M,"_contextmenu"],[v,"_pointerdown"],[m,"_pointermove"],[w,"_pointerup"],[S,"_pointercancel"],[k,"_lostpointercapture"]];const G={mouse:{[C]:f,[A]:u,[x]:g,[T]:p,[m]:_,[v]:y,[w]:b,[S]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[C]:"touchout",[A]:"touchleave",[x]:"touchover",[T]:"touchenter",[m]:I,[v]:D,[w]:O,[S]:H,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[C]:C,[A]:A,[x]:x,[T]:T,[m]:m,[v]:v,[w]:w,[S]:S,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},z=Nt=>Nt.indexOf("pointer")>=0?"pointer":Nt.indexOf("touch")>=0?"touch":"mouse",W=Nt=>{const P=z(Nt);if(P==="pointer")return r.Konva.pointerEventsEnabled&&G.pointer;if(P==="touch")return G.touch;if(P==="mouse")return G.mouse};function J(Nt={}){return(Nt.clipFunc||Nt.clipWidth||Nt.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),Nt}const lt="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);";i.stages=[];class we extends n.Container{constructor(P){super(J(P)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),i.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",()=>{J(this.attrs)}),this._checkVisibility()}_validateAdd(P){const F=P.getType()==="Layer",B=P.getType()==="FastLayer";F||B||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const P=this.visible()?"":"none";this.content.style.display=P}setContainer(P){if(typeof P===c){if(P.charAt(0)==="."){var F=P.slice(1);P=document.getElementsByClassName(F)[0]}else{var B;P.charAt(0)!=="#"?B=P:B=P.slice(1),P=document.getElementById(B)}if(!P)throw"Can not find container in document with id "+B}return this._setAttr("container",P),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),P.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var P=this.children,F=P.length,B;for(B=0;B<F;B++)P[B].clear();return this}clone(P){return P||(P={}),P.container=typeof document<"u"&&document.createElement("div"),n.Container.prototype.clone.call(this,P)}destroy(){super.destroy();var P=this.content;P&&t.Util._isInDocument(P)&&this.container().removeChild(P);var F=i.stages.indexOf(this);return F>-1&&i.stages.splice(F,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const P=this._pointerPositions[0]||this._changedPointerPositions[0];return P?{x:P.x,y:P.y}:(t.Util.warn(lt),null)}_getPointerById(P){return this._pointerPositions.find(F=>F.id===P)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(P){P=P||{},P.x=P.x||0,P.y=P.y||0,P.width=P.width||this.width(),P.height=P.height||this.height();var F=new s.SceneCanvas({width:P.width,height:P.height,pixelRatio:P.pixelRatio||1}),B=F.getContext()._context,ft=this.children;return(P.x||P.y)&&B.translate(-1*P.x,-1*P.y),ft.forEach(function(st){if(st.isVisible()){var bt=st._toKonvaCanvas(P);B.drawImage(bt._canvas,P.x,P.y,bt.getWidth()/bt.getPixelRatio(),bt.getHeight()/bt.getPixelRatio())}}),F}getIntersection(P){if(!P)return null;var F=this.children,B=F.length,ft=B-1,st;for(st=ft;st>=0;st--){const bt=F[st].getIntersection(P);if(bt)return bt}return null}_resizeDOM(){var P=this.width(),F=this.height();this.content&&(this.content.style.width=P+d,this.content.style.height=F+d),this.bufferCanvas.setSize(P,F),this.bufferHitCanvas.setSize(P,F),this.children.forEach(B=>{B.setSize({width:P,height:F}),B.draw()})}add(P,...F){if(arguments.length>1){for(var B=0;B<arguments.length;B++)this.add(arguments[B]);return this}super.add(P);var ft=this.children.length;return ft>$&&t.Util.warn("The stage has "+ft+" 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."),P.setSize({width:this.width(),height:this.height()}),P.draw(),r.Konva.isBrowser&&this.content.appendChild(P.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(P){return h.hasPointerCapture(P,this)}setPointerCapture(P){h.setPointerCapture(P,this)}releaseCapture(P){h.releaseCapture(P,this)}getLayers(){return this.children}_bindContentEvents(){r.Konva.isBrowser&&et.forEach(([P,F])=>{this.content.addEventListener(P,B=>{this[F](B)},{passive:!1})})}_pointerenter(P){this.setPointersPositions(P);const F=W(P.type);F&&this._fire(F.pointerenter,{evt:P,target:this,currentTarget:this})}_pointerover(P){this.setPointersPositions(P);const F=W(P.type);F&&this._fire(F.pointerover,{evt:P,target:this,currentTarget:this})}_getTargetShape(P){let F=this[P+"targetShape"];return F&&!F.getStage()&&(F=null),F}_pointerleave(P){const F=W(P.type),B=z(P.type);if(F){this.setPointersPositions(P);var ft=this._getTargetShape(B),st=!a.DD.isDragging||r.Konva.hitOnDragEnabled;ft&&st?(ft._fireAndBubble(F.pointerout,{evt:P}),ft._fireAndBubble(F.pointerleave,{evt:P}),this._fire(F.pointerleave,{evt:P,target:this,currentTarget:this}),this[B+"targetShape"]=null):st&&(this._fire(F.pointerleave,{evt:P,target:this,currentTarget:this}),this._fire(F.pointerout,{evt:P,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(P){const F=W(P.type),B=z(P.type);if(F){this.setPointersPositions(P);var ft=!1;this._changedPointerPositions.forEach(st=>{var bt=this.getIntersection(st);if(a.DD.justDragged=!1,r.Konva["_"+B+"ListenClick"]=!0,!bt||!bt.isListening())return;r.Konva.capturePointerEventsEnabled&&bt.setPointerCapture(st.id),this[B+"ClickStartShape"]=bt,bt._fireAndBubble(F.pointerdown,{evt:P,pointerId:st.id}),ft=!0;const Vt=P.type.indexOf("touch")>=0;bt.preventDefault()&&P.cancelable&&Vt&&P.preventDefault()}),ft||this._fire(F.pointerdown,{evt:P,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(P){const F=W(P.type),B=z(P.type);if(!F)return;a.DD.isDragging&&a.DD.node.preventDefault()&&P.cancelable&&P.preventDefault(),this.setPointersPositions(P);var ft=!a.DD.isDragging||r.Konva.hitOnDragEnabled;if(!ft)return;var st={};let bt=!1;var Vt=this._getTargetShape(B);this._changedPointerPositions.forEach(je=>{const ht=h.getCapturedShape(je.id)||this.getIntersection(je),zi=je.id,Se={evt:P,pointerId:zi};var Hi=Vt!==ht;if(Hi&&Vt&&(Vt._fireAndBubble(F.pointerout,{...Se},ht),Vt._fireAndBubble(F.pointerleave,{...Se},ht)),ht){if(st[ht._id])return;st[ht._id]=!0}ht&&ht.isListening()?(bt=!0,Hi&&(ht._fireAndBubble(F.pointerover,{...Se},Vt),ht._fireAndBubble(F.pointerenter,{...Se},Vt),this[B+"targetShape"]=ht),ht._fireAndBubble(F.pointermove,{...Se})):Vt&&(this._fire(F.pointerover,{evt:P,target:this,currentTarget:this,pointerId:zi}),this[B+"targetShape"]=null)}),bt||this._fire(F.pointermove,{evt:P,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(P){const F=W(P.type),B=z(P.type);if(!F)return;this.setPointersPositions(P);const ft=this[B+"ClickStartShape"],st=this[B+"ClickEndShape"];var bt={};let Vt=!1;this._changedPointerPositions.forEach(je=>{const ht=h.getCapturedShape(je.id)||this.getIntersection(je);if(ht){if(ht.releaseCapture(je.id),bt[ht._id])return;bt[ht._id]=!0}const zi=je.id,Se={evt:P,pointerId:zi};let Hi=!1;r.Konva["_"+B+"InDblClickWindow"]?(Hi=!0,clearTimeout(this[B+"DblTimeout"])):a.DD.justDragged||(r.Konva["_"+B+"InDblClickWindow"]=!0,clearTimeout(this[B+"DblTimeout"])),this[B+"DblTimeout"]=setTimeout(function(){r.Konva["_"+B+"InDblClickWindow"]=!1},r.Konva.dblClickWindow),ht&&ht.isListening()?(Vt=!0,this[B+"ClickEndShape"]=ht,ht._fireAndBubble(F.pointerup,{...Se}),r.Konva["_"+B+"ListenClick"]&&ft&&ft===ht&&(ht._fireAndBubble(F.pointerclick,{...Se}),Hi&&st&&st===ht&&ht._fireAndBubble(F.pointerdblclick,{...Se}))):(this[B+"ClickEndShape"]=null,r.Konva["_"+B+"ListenClick"]&&this._fire(F.pointerclick,{evt:P,target:this,currentTarget:this,pointerId:zi}),Hi&&this._fire(F.pointerdblclick,{evt:P,target:this,currentTarget:this,pointerId:zi}))}),Vt||this._fire(F.pointerup,{evt:P,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),r.Konva["_"+B+"ListenClick"]=!1,P.cancelable&&B!=="touch"&&P.preventDefault()}_contextmenu(P){this.setPointersPositions(P);var F=this.getIntersection(this.getPointerPosition());F&&F.isListening()?F._fireAndBubble(M,{evt:P}):this._fire(M,{evt:P,target:this,currentTarget:this})}_wheel(P){this.setPointersPositions(P);var F=this.getIntersection(this.getPointerPosition());F&&F.isListening()?F._fireAndBubble(j,{evt:P}):this._fire(j,{evt:P,target:this,currentTarget:this})}_pointercancel(P){this.setPointersPositions(P);const F=h.getCapturedShape(P.pointerId)||this.getIntersection(this.getPointerPosition());F&&F._fireAndBubble(w,h.createEvent(P)),h.releaseCapture(P.pointerId)}_lostpointercapture(P){h.releaseCapture(P.pointerId)}setPointersPositions(P){var F=this._getContentPosition(),B=null,ft=null;P=P||window.event,P.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(P.touches,st=>{this._pointerPositions.push({id:st.identifier,x:(st.clientX-F.left)/F.scaleX,y:(st.clientY-F.top)/F.scaleY})}),Array.prototype.forEach.call(P.changedTouches||P.touches,st=>{this._changedPointerPositions.push({id:st.identifier,x:(st.clientX-F.left)/F.scaleX,y:(st.clientY-F.top)/F.scaleY})})):(B=(P.clientX-F.left)/F.scaleX,ft=(P.clientY-F.top)/F.scaleY,this.pointerPos={x:B,y:ft},this._pointerPositions=[{x:B,y:ft,id:t.Util._getFirstPointerId(P)}],this._changedPointerPositions=[{x:B,y:ft,id:t.Util._getFirstPointerId(P)}])}_setPointerPosition(P){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(P)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var P=this.content.getBoundingClientRect();return{top:P.top,left:P.left,scaleX:P.width/this.content.clientWidth||1,scaleY:P.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new s.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new s.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!r.Konva.isBrowser){var P=this.container();if(!P)throw"Stage has no container. A container is required.";P.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),P.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(P){P.batchDraw()}),this}}i.Stage=we,we.prototype.nodeType=l,(0,o._registerNode)(we),e.Factory.addGetterSetter(we,"container")}(Xc);var kn={},St={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Shape=i.shapes=void 0;const t=Y,e=gt,n=X,r=dt,s=N,a=Y,o=Ft;var h="hasShadow",l="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let u;function g(){return u||(u=e.Util.createCanvasElement().getContext("2d"),u)}i.shapes={};function p(A){const x=this.attrs.fillRule;x?A.fill(x):A.fill()}function _(A){A.stroke()}function y(A){A.fill()}function b(A){A.stroke()}function m(){this._clearCache(h)}function v(){this._clearCache(l)}function w(){this._clearCache(c)}function S(){this._clearCache(d)}function k(){this._clearCache(f)}class C extends r.Node{constructor(x){super(x);let T;for(;T=e.Util.getRandomColor(),!(T&&!(T in i.shapes)););this.colorKey=T,i.shapes[T]=this}getContext(){return e.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return e.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(h,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var x=g();const T=x.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(T&&T.setTransform){const M=new e.Transform;M.translate(this.fillPatternX(),this.fillPatternY()),M.rotate(t.Konva.getAngle(this.fillPatternRotation())),M.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),M.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const D=M.getMatrix(),O=typeof DOMMatrix>"u"?{a:D[0],b:D[1],c:D[2],d:D[3],e:D[4],f:D[5]}:new DOMMatrix(D);T.setTransform(O)}return T}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var x=this.fillLinearGradientColorStops();if(x){for(var T=g(),M=this.fillLinearGradientStartPoint(),D=this.fillLinearGradientEndPoint(),O=T.createLinearGradient(M.x,M.y,D.x,D.y),I=0;I<x.length;I+=2)O.addColorStop(x[I],x[I+1]);return O}}_getRadialGradient(){return this._getCache(f,this.__getRadialGradient)}__getRadialGradient(){var x=this.fillRadialGradientColorStops();if(x){for(var T=g(),M=this.fillRadialGradientStartPoint(),D=this.fillRadialGradientEndPoint(),O=T.createRadialGradient(M.x,M.y,this.fillRadialGradientStartRadius(),D.x,D.y,this.fillRadialGradientEndRadius()),I=0;I<x.length;I+=2)O.addColorStop(x[I],x[I+1]);return O}}getShadowRGBA(){return this._getCache(l,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var x=e.Util.colorToRGBA(this.shadowColor());if(x)return"rgba("+x.r+","+x.g+","+x.b+","+x.a*(this.shadowOpacity()||1)+")"}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const x=this.hitStrokeWidth();return x==="auto"?this.hasStroke():this.strokeEnabled()&&!!x}intersects(x){var T=this.getStage();if(!T)return!1;const M=T.bufferHitCanvas;return M.getContext().clear(),this.drawHit(M,void 0,!0),M.context.getImageData(Math.round(x.x),Math.round(x.y),1,1).data[3]>0}destroy(){return r.Node.prototype.destroy.call(this),delete i.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(x){var T;if(!this.getStage()||!((T=this.attrs.perfectDrawEnabled)!==null&&T!==void 0?T:!0))return!1;const D=x||this.hasFill(),O=this.hasStroke(),I=this.getAbsoluteOpacity()!==1;if(D&&O&&I)return!0;const H=this.hasShadow(),j=this.shadowForStrokeEnabled();return!!(D&&O&&H&&j)}setStrokeHitEnabled(x){e.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),x?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var x=this.size();return{x:this._centroid?-x.width/2:0,y:this._centroid?-x.height/2:0,width:x.width,height:x.height}}getClientRect(x={}){const T=x.skipTransform,M=x.relativeTo,D=this.getSelfRect(),I=!x.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,H=D.width+I,j=D.height+I,$=!x.skipShadow&&this.hasShadow(),et=$?this.shadowOffsetX():0,G=$?this.shadowOffsetY():0,z=H+Math.abs(et),W=j+Math.abs(G),J=$&&this.shadowBlur()||0,lt=z+J*2,we=W+J*2,Nt={width:lt,height:we,x:-(I/2+J)+Math.min(et,0)+D.x,y:-(I/2+J)+Math.min(G,0)+D.y};return T?Nt:this._transformedRect(Nt,M)}drawScene(x,T){var M=this.getLayer(),D=x||M.getCanvas(),O=D.getContext(),I=this._getCanvasCache(),H=this.getSceneFunc(),j=this.hasShadow(),$,et,G,z=D.isCache,W=T===this;if(!this.isVisible()&&!W)return this;if(I){O.save();var J=this.getAbsoluteTransform(T).getMatrix();return O.transform(J[0],J[1],J[2],J[3],J[4],J[5]),this._drawCachedSceneCanvas(O),O.restore(),this}if(!H)return this;if(O.save(),this._useBufferCanvas()&&!z){$=this.getStage(),et=$.bufferCanvas,G=et.getContext(),G.clear(),G.save(),G._applyLineJoin(this);var lt=this.getAbsoluteTransform(T).getMatrix();G.transform(lt[0],lt[1],lt[2],lt[3],lt[4],lt[5]),H.call(this,G,this),G.restore();var we=et.pixelRatio;j&&O._applyShadow(this),O._applyOpacity(this),O._applyGlobalCompositeOperation(this),O.drawImage(et._canvas,0,0,et.width/we,et.height/we)}else{if(O._applyLineJoin(this),!W){var lt=this.getAbsoluteTransform(T).getMatrix();O.transform(lt[0],lt[1],lt[2],lt[3],lt[4],lt[5]),O._applyOpacity(this),O._applyGlobalCompositeOperation(this)}j&&O._applyShadow(this),H.call(this,O,this)}return O.restore(),this}drawHit(x,T,M=!1){if(!this.shouldDrawHit(T,M))return this;var D=this.getLayer(),O=x||D.hitCanvas,I=O&&O.getContext(),H=this.hitFunc()||this.sceneFunc(),j=this._getCanvasCache(),$=j&&j.hit;if(this.colorKey||e.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()"),$){I.save();var et=this.getAbsoluteTransform(T).getMatrix();return I.transform(et[0],et[1],et[2],et[3],et[4],et[5]),this._drawCachedHitCanvas(I),I.restore(),this}if(!H)return this;if(I.save(),I._applyLineJoin(this),!(this===T)){var z=this.getAbsoluteTransform(T).getMatrix();I.transform(z[0],z[1],z[2],z[3],z[4],z[5])}return H.call(this,I,this),I.restore(),this}drawHitFromCache(x=0){var T=this._getCanvasCache(),M=this._getCachedSceneCanvas(),D=T.hit,O=D.getContext(),I=D.getWidth(),H=D.getHeight(),j,$,et,G,z,W;O.clear(),O.drawImage(M._canvas,0,0,I,H);try{for(j=O.getImageData(0,0,I,H),$=j.data,et=$.length,G=e.Util._hexToRgb(this.colorKey),z=0;z<et;z+=4)W=$[z+3],W>x?($[z]=G.r,$[z+1]=G.g,$[z+2]=G.b,$[z+3]=255):$[z+3]=0;O.putImageData(j,0,0)}catch(J){e.Util.error("Unable to draw hit graph from cached scene canvas. "+J.message)}return this}hasPointerCapture(x){return o.hasPointerCapture(x,this)}setPointerCapture(x){o.setPointerCapture(x,this)}releaseCapture(x){o.releaseCapture(x,this)}}i.Shape=C,C.prototype._fillFunc=p,C.prototype._strokeFunc=_,C.prototype._fillFuncHit=y,C.prototype._strokeFuncHit=b,C.prototype._centroid=!1,C.prototype.nodeType="Shape",(0,a._registerNode)(C),C.prototype.eventListeners={},C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",m),C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",v),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",w),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",S),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",k),n.Factory.addGetterSetter(C,"stroke",void 0,(0,s.getStringOrGradientValidator)()),n.Factory.addGetterSetter(C,"strokeWidth",2,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"fillAfterStrokeEnabled",!1),n.Factory.addGetterSetter(C,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),n.Factory.addGetterSetter(C,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),n.Factory.addGetterSetter(C,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),n.Factory.addGetterSetter(C,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),n.Factory.addGetterSetter(C,"lineJoin"),n.Factory.addGetterSetter(C,"lineCap"),n.Factory.addGetterSetter(C,"sceneFunc"),n.Factory.addGetterSetter(C,"hitFunc"),n.Factory.addGetterSetter(C,"dash"),n.Factory.addGetterSetter(C,"dashOffset",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"shadowColor",void 0,(0,s.getStringValidator)()),n.Factory.addGetterSetter(C,"shadowBlur",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"shadowOpacity",1,(0,s.getNumberValidator)()),n.Factory.addComponentsGetterSetter(C,"shadowOffset",["x","y"]),n.Factory.addGetterSetter(C,"shadowOffsetX",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"shadowOffsetY",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"fillPatternImage"),n.Factory.addGetterSetter(C,"fill",void 0,(0,s.getStringOrGradientValidator)()),n.Factory.addGetterSetter(C,"fillPatternX",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"fillPatternY",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"fillLinearGradientColorStops"),n.Factory.addGetterSetter(C,"strokeLinearGradientColorStops"),n.Factory.addGetterSetter(C,"fillRadialGradientStartRadius",0),n.Factory.addGetterSetter(C,"fillRadialGradientEndRadius",0),n.Factory.addGetterSetter(C,"fillRadialGradientColorStops"),n.Factory.addGetterSetter(C,"fillPatternRepeat","repeat"),n.Factory.addGetterSetter(C,"fillEnabled",!0),n.Factory.addGetterSetter(C,"strokeEnabled",!0),n.Factory.addGetterSetter(C,"shadowEnabled",!0),n.Factory.addGetterSetter(C,"dashEnabled",!0),n.Factory.addGetterSetter(C,"strokeScaleEnabled",!0),n.Factory.addGetterSetter(C,"fillPriority","color"),n.Factory.addComponentsGetterSetter(C,"fillPatternOffset",["x","y"]),n.Factory.addGetterSetter(C,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),n.Factory.addComponentsGetterSetter(C,"fillPatternScale",["x","y"]),n.Factory.addGetterSetter(C,"fillPatternScaleX",1,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"fillPatternScaleY",1,(0,s.getNumberValidator)()),n.Factory.addComponentsGetterSetter(C,"fillLinearGradientStartPoint",["x","y"]),n.Factory.addComponentsGetterSetter(C,"strokeLinearGradientStartPoint",["x","y"]),n.Factory.addGetterSetter(C,"fillLinearGradientStartPointX",0),n.Factory.addGetterSetter(C,"strokeLinearGradientStartPointX",0),n.Factory.addGetterSetter(C,"fillLinearGradientStartPointY",0),n.Factory.addGetterSetter(C,"strokeLinearGradientStartPointY",0),n.Factory.addComponentsGetterSetter(C,"fillLinearGradientEndPoint",["x","y"]),n.Factory.addComponentsGetterSetter(C,"strokeLinearGradientEndPoint",["x","y"]),n.Factory.addGetterSetter(C,"fillLinearGradientEndPointX",0),n.Factory.addGetterSetter(C,"strokeLinearGradientEndPointX",0),n.Factory.addGetterSetter(C,"fillLinearGradientEndPointY",0),n.Factory.addGetterSetter(C,"strokeLinearGradientEndPointY",0),n.Factory.addComponentsGetterSetter(C,"fillRadialGradientStartPoint",["x","y"]),n.Factory.addGetterSetter(C,"fillRadialGradientStartPointX",0),n.Factory.addGetterSetter(C,"fillRadialGradientStartPointY",0),n.Factory.addComponentsGetterSetter(C,"fillRadialGradientEndPoint",["x","y"]),n.Factory.addGetterSetter(C,"fillRadialGradientEndPointX",0),n.Factory.addGetterSetter(C,"fillRadialGradientEndPointY",0),n.Factory.addGetterSetter(C,"fillPatternRotation",0),n.Factory.addGetterSetter(C,"fillRule",void 0,(0,s.getStringValidator)()),n.Factory.backCompat(C,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(St),Object.defineProperty(kn,"__esModule",{value:!0}),kn.Layer=void 0;const _e=gt,$a=ii,Ai=dt,Xa=X,qc=$t,B5=N,z5=St,H5=Y;var j5="#",V5="beforeDraw",$5="draw",Kc=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],X5=Kc.length;class Pi extends $a.Container{constructor(t){super(t),this.canvas=new qc.SceneCanvas,this.hitCanvas=new qc.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),t<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[t+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){Ai.Node.prototype.moveToTop.call(this);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){var t=Ai.Node.prototype.moveUp.call(this);if(!t)return!1;var e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(Ai.Node.prototype.moveDown.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(Ai.Node.prototype.moveToBottom.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var t=this.getNativeCanvasElement();return Ai.Node.prototype.remove.call(this),t&&t.parentNode&&_e.Util._isInDocument(t)&&t.parentNode.removeChild(t),this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&_e.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(t){return t=t||{},t.width=t.width||this.getWidth(),t.height=t.height||this.getHeight(),t.x=t.x!==void 0?t.x:this.x(),t.y=t.y!==void 0?t.y:this.y(),Ai.Node.prototype._toKonvaCanvas.call(this,t)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){_e.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){_e.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,_e.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var e=1,n=!1;;){for(let r=0;r<X5;r++){const s=Kc[r],a=this._getIntersection({x:t.x+s.x*e,y:t.y+s.y*e}),o=a.shape;if(o)return o;if(n=!!a.antialiased,!a.antialiased)break}if(n)e+=1;else return null}}_getIntersection(t){const e=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(t.x*e),Math.round(t.y*e),1,1).data,r=n[3];if(r===255){const s=_e.Util._rgbToHex(n[0],n[1],n[2]),a=z5.shapes[j5+s];return a?{shape:a}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(t,e){var n=this.getLayer(),r=t||n&&n.getCanvas();return this._fire(V5,{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),$a.Container.prototype.drawScene.call(this,r,e),this._fire($5,{node:this}),this}drawHit(t,e){var n=this.getLayer(),r=t||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),$a.Container.prototype.drawHit.call(this,r,e),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){_e.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return _e.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,e=!!this.hitCanvas._canvas.parentNode;e?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return _e.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}kn.Layer=Pi,Pi.prototype.nodeType="Layer",(0,H5._registerNode)(Pi),Xa.Factory.addGetterSetter(Pi,"imageSmoothingEnabled",!0),Xa.Factory.addGetterSetter(Pi,"clearBeforeDraw",!0),Xa.Factory.addGetterSetter(Pi,"hitGraphEnabled",!0,(0,B5.getBooleanValidator)());var Rr={};Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.FastLayer=void 0;const Y5=gt,W5=kn,q5=Y;class Ya extends W5.Layer{constructor(t){super(t),this.listening(!1),Y5.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Rr.FastLayer=Ya,Ya.prototype.nodeType="FastLayer",(0,q5._registerNode)(Ya);var Mi={};Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.Group=void 0;const K5=gt,Z5=ii,J5=Y;class Wa extends Z5.Container{_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&K5.Util.throw("You may only add groups and shapes to groups.")}}Mi.Group=Wa,Wa.prototype.nodeType="Group",(0,J5._registerNode)(Wa);var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.Animation=void 0;const qa=Y,Zc=gt,Ka=function(){return qa.glob.performance&&qa.glob.performance.now?function(){return qa.glob.performance.now()}:function(){return new Date().getTime()}}();class te{constructor(t,e){this.id=te.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Ka(),frameRate:0},this.func=t,this.setLayers(e)}setLayers(t){let e=[];return t&&(e=Array.isArray(t)?t:[t]),this.layers=e,this}getLayers(){return this.layers}addLayer(t){const e=this.layers,n=e.length;for(let r=0;r<n;r++)if(e[r]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const e=te.animations,n=e.length;for(let r=0;r<n;r++)if(e[r].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=Ka(),te._addAnimation(this),this}stop(){return te._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const e=t.id,n=this.animations,r=n.length;for(let s=0;s<r;s++)if(n[s].id===e){this.animations.splice(s,1);break}}static _runFrames(){const t={},e=this.animations;for(let n=0;n<e.length;n++){const r=e[n],s=r.layers,a=r.func;r._updateFrameObject(Ka());const o=s.length;let h;if(a?h=a.call(r,r.frame)!==!1:h=!0,!!h)for(let l=0;l<o;l++){const c=s[l];c._id!==void 0&&(t[c._id]=c)}}for(let n in t)t.hasOwnProperty(n)&&t[n].batchDraw()}static _animationLoop(){const t=te;t.animations.length?(t._runFrames(),Zc.Util.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Zc.Util.requestAnimFrame(this._animationLoop))}}Ri.Animation=te,te.animations=[],te.animIdCounter=0,te.animRunning=!1;var Jc={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Easings=i.Tween=void 0;const t=gt,e=Ri,n=dt,r=Y;var s={node:1,duration:1,easing:1,onFinish:1,yoyo:1},a=1,o=2,h=3,l=0,c=["fill","stroke","shadowColor"];class d{constructor(g,p,_,y,b,m,v){this.prop=g,this.propFunc=p,this.begin=y,this._pos=y,this.duration=m,this._change=0,this.prevPos=0,this.yoyo=v,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=_,this._change=b-this.begin,this.pause()}fire(g){var p=this[g];p&&p()}setTime(g){g>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():g<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=g,this.update())}getTime(){return this._time}setPosition(g){this.prevPos=this._pos,this.propFunc(g),this._pos=g}getPosition(g){return g===void 0&&(g=this._time),this.func(g,this.begin,this._change,this.duration)}play(){this.state=o,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=h,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(g){this.pause(),this._time=g,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(){var g=this.getTimer()-this._startTime;this.state===o?this.setTime(g):this.state===h&&this.setTime(this.duration-g)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(g){var p=this,_=g.node,y=_._id,b,m=g.easing||i.Easings.Linear,v=!!g.yoyo,w;typeof g.duration>"u"?b=.3:g.duration===0?b=.001:b=g.duration,this.node=_,this._id=l++;var S=_.getLayer()||(_ instanceof r.Konva.Stage?_.getLayers():null);S||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new e.Animation(function(){p.tween.onEnterFrame()},S),this.tween=new d(w,function(k){p._tweenFunc(k)},m,0,1,b*1e3,v),this._addListeners(),f.attrs[y]||(f.attrs[y]={}),f.attrs[y][this._id]||(f.attrs[y][this._id]={}),f.tweens[y]||(f.tweens[y]={});for(w in g)s[w]===void 0&&this._addAttr(w,g[w]);this.reset(),this.onFinish=g.onFinish,this.onReset=g.onReset,this.onUpdate=g.onUpdate}_addAttr(g,p){var _=this.node,y=_._id,b,m,v,w,S,k,C,A;if(v=f.tweens[y][g],v&&delete f.attrs[y][v][g],b=_.getAttr(g),t.Util._isArray(p))if(m=[],S=Math.max(p.length,b.length),g==="points"&&p.length!==b.length&&(p.length>b.length?(C=b,b=t.Util._prepareArrayForTween(b,p,_.closed())):(k=p,p=t.Util._prepareArrayForTween(p,b,_.closed()))),g.indexOf("fill")===0)for(w=0;w<S;w++)if(w%2===0)m.push(p[w]-b[w]);else{var x=t.Util.colorToRGBA(b[w]);A=t.Util.colorToRGBA(p[w]),b[w]=x,m.push({r:A.r-x.r,g:A.g-x.g,b:A.b-x.b,a:A.a-x.a})}else for(w=0;w<S;w++)m.push(p[w]-b[w]);else c.indexOf(g)!==-1?(b=t.Util.colorToRGBA(b),A=t.Util.colorToRGBA(p),m={r:A.r-b.r,g:A.g-b.g,b:A.b-b.b,a:A.a-b.a}):m=p-b;f.attrs[y][this._id][g]={start:b,diff:m,end:p,trueEnd:k,trueStart:C},f.tweens[y][g]=this._id}_tweenFunc(g){var p=this.node,_=f.attrs[p._id][this._id],y,b,m,v,w,S,k,C;for(y in _){if(b=_[y],m=b.start,v=b.diff,C=b.end,t.Util._isArray(m))if(w=[],k=Math.max(m.length,C.length),y.indexOf("fill")===0)for(S=0;S<k;S++)S%2===0?w.push((m[S]||0)+v[S]*g):w.push("rgba("+Math.round(m[S].r+v[S].r*g)+","+Math.round(m[S].g+v[S].g*g)+","+Math.round(m[S].b+v[S].b*g)+","+(m[S].a+v[S].a*g)+")");else for(S=0;S<k;S++)w.push((m[S]||0)+v[S]*g);else c.indexOf(y)!==-1?w="rgba("+Math.round(m.r+v.r*g)+","+Math.round(m.g+v.g*g)+","+Math.round(m.b+v.b*g)+","+(m.a+v.a*g)+")":w=m+v*g;p.setAttr(y,w)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var g=this.node,p=f.attrs[g._id][this._id];p.points&&p.points.trueEnd&&g.setAttr("points",p.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var g=this.node,p=f.attrs[g._id][this._id];p.points&&p.points.trueStart&&g.points(p.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(g){return this.tween.seek(g*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var g=this.node._id,p=this._id,_=f.tweens[g],y;this.pause();for(y in _)delete f.tweens[g][y];delete f.attrs[g][p]}}i.Tween=f,f.attrs={},f.tweens={},n.Node.prototype.to=function(u){var g=u.onFinish;u.node=this,u.onFinish=function(){this.destroy(),g&&g()};var p=new f(u);p.play()},i.Easings={BackEaseIn(u,g,p,_){var y=1.70158;return p*(u/=_)*u*((y+1)*u-y)+g},BackEaseOut(u,g,p,_){var y=1.70158;return p*((u=u/_-1)*u*((y+1)*u+y)+1)+g},BackEaseInOut(u,g,p,_){var y=1.70158;return(u/=_/2)<1?p/2*(u*u*(((y*=1.525)+1)*u-y))+g:p/2*((u-=2)*u*(((y*=1.525)+1)*u+y)+2)+g},ElasticEaseIn(u,g,p,_,y,b){var m=0;return u===0?g:(u/=_)===1?g+p:(b||(b=_*.3),!y||y<Math.abs(p)?(y=p,m=b/4):m=b/(2*Math.PI)*Math.asin(p/y),-(y*Math.pow(2,10*(u-=1))*Math.sin((u*_-m)*(2*Math.PI)/b))+g)},ElasticEaseOut(u,g,p,_,y,b){var m=0;return u===0?g:(u/=_)===1?g+p:(b||(b=_*.3),!y||y<Math.abs(p)?(y=p,m=b/4):m=b/(2*Math.PI)*Math.asin(p/y),y*Math.pow(2,-10*u)*Math.sin((u*_-m)*(2*Math.PI)/b)+p+g)},ElasticEaseInOut(u,g,p,_,y,b){var m=0;return u===0?g:(u/=_/2)===2?g+p:(b||(b=_*.44999999999999996),!y||y<Math.abs(p)?(y=p,m=b/4):m=b/(2*Math.PI)*Math.asin(p/y),u<1?-.5*(y*Math.pow(2,10*(u-=1))*Math.sin((u*_-m)*(2*Math.PI)/b))+g:y*Math.pow(2,-10*(u-=1))*Math.sin((u*_-m)*(2*Math.PI)/b)*.5+p+g)},BounceEaseOut(u,g,p,_){return(u/=_)<.36363636363636365?p*(7.5625*u*u)+g:u<.7272727272727273?p*(7.5625*(u-=.5454545454545454)*u+.75)+g:u<.9090909090909091?p*(7.5625*(u-=.8181818181818182)*u+.9375)+g:p*(7.5625*(u-=.9545454545454546)*u+.984375)+g},BounceEaseIn(u,g,p,_){return p-i.Easings.BounceEaseOut(_-u,0,p,_)+g},BounceEaseInOut(u,g,p,_){return u<_/2?i.Easings.BounceEaseIn(u*2,0,p,_)*.5+g:i.Easings.BounceEaseOut(u*2-_,0,p,_)*.5+p*.5+g},EaseIn(u,g,p,_){return p*(u/=_)*u+g},EaseOut(u,g,p,_){return-p*(u/=_)*(u-2)+g},EaseInOut(u,g,p,_){return(u/=_/2)<1?p/2*u*u+g:-p/2*(--u*(u-2)-1)+g},StrongEaseIn(u,g,p,_){return p*(u/=_)*u*u*u*u+g},StrongEaseOut(u,g,p,_){return p*((u=u/_-1)*u*u*u*u+1)+g},StrongEaseInOut(u,g,p,_){return(u/=_/2)<1?p/2*u*u*u*u*u+g:p/2*((u-=2)*u*u*u*u+2)+g},Linear(u,g,p,_){return p*u/_+g}}})(Jc),function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Konva=void 0;const t=Y,e=gt,n=dt,r=ii,s=Xc,a=kn,o=Rr,h=Mi,l=Tr,c=St,d=Ri,f=Jc,u=pe,g=$t;i.Konva=e.Util._assign(t.Konva,{Util:e.Util,Transform:e.Transform,Node:n.Node,Container:r.Container,Stage:s.Stage,stages:s.stages,Layer:a.Layer,FastLayer:o.FastLayer,Group:h.Group,DD:l.DD,Shape:c.Shape,shapes:c.shapes,Animation:d.Animation,Tween:f.Tween,Easings:f.Easings,Context:u.Context,Canvas:g.Canvas}),i.default=i.Konva}(Oc);var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.Arc=void 0;const Lr=X,Q5=St,Qc=Y,Or=N,t3=Y;class ve extends Q5.Shape{_sceneFunc(t){var e=Qc.Konva.getAngle(this.angle()),n=this.clockwise();t.beginPath(),t.arc(0,0,this.outerRadius(),0,e,n),t.arc(0,0,this.innerRadius(),e,0,!n),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}getSelfRect(){const t=this.innerRadius(),e=this.outerRadius(),n=this.clockwise(),r=Qc.Konva.getAngle(n?360-this.angle():this.angle()),s=Math.cos(Math.min(r,Math.PI)),a=1,o=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),h=Math.sin(Math.min(r,Math.PI/2)),l=s*(s>0?t:e),c=a*e,d=o*(o>0?t:e),f=h*(h>0?e:t);return{x:l,y:n?-1*f:d,width:c-l,height:f-d}}}Dr.Arc=ve,ve.prototype._centroid=!0,ve.prototype.className="Arc",ve.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,t3._registerNode)(ve),Lr.Factory.addGetterSetter(ve,"innerRadius",0,(0,Or.getNumberValidator)()),Lr.Factory.addGetterSetter(ve,"outerRadius",0,(0,Or.getNumberValidator)()),Lr.Factory.addGetterSetter(ve,"angle",0,(0,Or.getNumberValidator)()),Lr.Factory.addGetterSetter(ve,"clockwise",!1,(0,Or.getBooleanValidator)());var Ir={},An={};Object.defineProperty(An,"__esModule",{value:!0}),An.Line=void 0;const Fr=X,e3=St,tu=N,i3=Y;function Za(i,t,e,n,r,s,a){var o=Math.sqrt(Math.pow(e-i,2)+Math.pow(n-t,2)),h=Math.sqrt(Math.pow(r-e,2)+Math.pow(s-n,2)),l=a*o/(o+h),c=a*h/(o+h),d=e-l*(r-i),f=n-l*(s-t),u=e+c*(r-i),g=n+c*(s-t);return[d,f,u,g]}function eu(i,t){var e=i.length,n=[],r,s;for(r=2;r<e-2;r+=2)s=Za(i[r-2],i[r-1],i[r],i[r+1],i[r+2],i[r+3],t),!isNaN(s[0])&&(n.push(s[0]),n.push(s[1]),n.push(i[r]),n.push(i[r+1]),n.push(s[2]),n.push(s[3]));return n}class Ie extends e3.Shape{constructor(t){super(t),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(t){var e=this.points(),n=e.length,r=this.tension(),s=this.closed(),a=this.bezier(),o,h,l;if(n){if(t.beginPath(),t.moveTo(e[0],e[1]),r!==0&&n>4){for(o=this.getTensionPoints(),h=o.length,l=s?0:4,s||t.quadraticCurveTo(o[0],o[1],o[2],o[3]);l<h-2;)t.bezierCurveTo(o[l++],o[l++],o[l++],o[l++],o[l++],o[l++]);s||t.quadraticCurveTo(o[h-2],o[h-1],e[n-2],e[n-1])}else if(a)for(l=2;l<n;)t.bezierCurveTo(e[l++],e[l++],e[l++],e[l++],e[l++],e[l++]);else for(l=2;l<n;l+=2)t.lineTo(e[l],e[l+1]);s?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():eu(this.points(),this.tension())}_getTensionPointsClosed(){var t=this.points(),e=t.length,n=this.tension(),r=Za(t[e-2],t[e-1],t[0],t[1],t[2],t[3],n),s=Za(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],n),a=eu(t,n),o=[r[2],r[3]].concat(a).concat([s[0],s[1],t[e-2],t[e-1],s[2],s[3],r[0],r[1],t[0],t[1]]);return o}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};this.tension()!==0?t=[t[0],t[1],...this._getTensionPoints(),t[t.length-2],t[t.length-1]]:t=this.points();for(var e=t[0],n=t[0],r=t[1],s=t[1],a,o,h=0;h<t.length/2;h++)a=t[h*2],o=t[h*2+1],e=Math.min(e,a),n=Math.max(n,a),r=Math.min(r,o),s=Math.max(s,o);return{x:e,y:r,width:n-e,height:s-r}}}An.Line=Ie,Ie.prototype.className="Line",Ie.prototype._attrsAffectingSize=["points","bezier","tension"],(0,i3._registerNode)(Ie),Fr.Factory.addGetterSetter(Ie,"closed",!1),Fr.Factory.addGetterSetter(Ie,"bezier",!1),Fr.Factory.addGetterSetter(Ie,"tension",0,(0,tu.getNumberValidator)()),Fr.Factory.addGetterSetter(Ie,"points",[],(0,tu.getNumberArrayValidator)());var Di={},iu={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.t2length=i.getQuadraticArcLength=i.getCubicArcLength=i.binomialCoefficients=i.cValues=i.tValues=void 0,i.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],i.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],i.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const t=(a,o,h)=>{let l,c,d;l=h/2,c=0;for(let u=0;u<20;u++)d=l*i.tValues[20][u]+l,c+=i.cValues[20][u]*n(a,o,d);return l*c};i.getCubicArcLength=t;const e=(a,o,h)=>{h===void 0&&(h=1);const l=a[0]-2*a[1]+a[2],c=o[0]-2*o[1]+o[2],d=2*a[1]-2*a[0],f=2*o[1]-2*o[0],u=4*(l*l+c*c),g=4*(l*d+c*f),p=d*d+f*f;if(u===0)return h*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(o[2]-o[0],2));const _=g/(2*u),y=p/u,b=h+_,m=y-_*_,v=b*b+m>0?Math.sqrt(b*b+m):0,w=_*_+m>0?Math.sqrt(_*_+m):0,S=_+Math.sqrt(_*_+m)!==0?m*Math.log(Math.abs((b+v)/(_+w))):0;return Math.sqrt(u)/2*(b*v-_*w+S)};i.getQuadraticArcLength=e;function n(a,o,h){const l=r(1,h,a),c=r(1,h,o),d=l*l+c*c;return Math.sqrt(d)}const r=(a,o,h)=>{const l=h.length-1;let c,d;if(l===0)return 0;if(a===0){d=0;for(let f=0;f<=l;f++)d+=i.binomialCoefficients[l][f]*Math.pow(1-o,l-f)*Math.pow(o,f)*h[f];return d}else{c=new Array(l);for(let f=0;f<l;f++)c[f]=l*(h[f+1]-h[f]);return r(a-1,o,c)}},s=(a,o,h)=>{let l=1,c=a/o,d=(a-h(c))/o,f=0;for(;l>.001;){const u=h(c+d),g=Math.abs(a-u)/o;if(g<l)l=g,c+=d;else{const p=h(c-d),_=Math.abs(a-p)/o;_<l?(l=_,c-=d):d/=2}if(f++,f>500)break}return c};i.t2length=s})(iu),Object.defineProperty(Di,"__esModule",{value:!0}),Di.Path=void 0;const n3=X,r3=St,s3=Y,Li=iu;class Ct extends r3.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Ct.parsePathData(this.data()),this.pathLength=Ct.getPathLength(this.dataArray)}_sceneFunc(t){var e=this.dataArray;t.beginPath();for(var n=!1,r=0;r<e.length;r++){var s=e[r].command,a=e[r].points;switch(s){case"L":t.lineTo(a[0],a[1]);break;case"M":t.moveTo(a[0],a[1]);break;case"C":t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"Q":t.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case"A":var o=a[0],h=a[1],l=a[2],c=a[3],d=a[4],f=a[5],u=a[6],g=a[7],p=l>c?l:c,_=l>c?1:l/c,y=l>c?c/l:1;t.translate(o,h),t.rotate(u),t.scale(_,y),t.arc(0,0,p,d,d+f,1-g),t.scale(1/_,1/y),t.rotate(-u),t.translate(-o,-h);break;case"z":n=!0,t.closePath();break}}!n&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(l){if(l.command==="A"){var c=l.points[4],d=l.points[5],f=l.points[4]+d,u=Math.PI/180;if(Math.abs(c-f)<u&&(u=Math.abs(c-f)),d<0)for(let g=c-u;g>f;g-=u){const p=Ct.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(p.x,p.y)}else for(let g=c+u;g<f;g+=u){const p=Ct.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(p.x,p.y)}}else if(l.command==="C")for(let g=0;g<=1;g+=.01){const p=Ct.getPointOnCubicBezier(g,l.start.x,l.start.y,l.points[0],l.points[1],l.points[2],l.points[3],l.points[4],l.points[5]);t.push(p.x,p.y)}else t=t.concat(l.points)});for(var e=t[0],n=t[0],r=t[1],s=t[1],a,o,h=0;h<t.length/2;h++)a=t[h*2],o=t[h*2+1],isNaN(a)||(e=Math.min(e,a),n=Math.max(n,a)),isNaN(o)||(r=Math.min(r,o),s=Math.max(s,o));return{x:e,y:r,width:n-e,height:s-r}}getLength(){return this.pathLength}getPointAtLength(t){return Ct.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}static getPathLength(t){let e=0;for(var n=0;n<t.length;++n)e+=t[n].pathLength;return e}static getPointAtLengthOfDataArray(t,e){var n,r=0,s=e.length;if(!s)return null;for(;r<s&&t>e[r].pathLength;)t-=e[r].pathLength,++r;if(r===s)return n=e[r-1].points.slice(-2),{x:n[0],y:n[1]};if(t<.01)return n=e[r].points.slice(0,2),{x:n[0],y:n[1]};var a=e[r],o=a.points;switch(a.command){case"L":return Ct.getPointOnLine(t,a.start.x,a.start.y,o[0],o[1]);case"C":return Ct.getPointOnCubicBezier((0,Li.t2length)(t,Ct.getPathLength(e),p=>(0,Li.getCubicArcLength)([a.start.x,o[0],o[2],o[4]],[a.start.y,o[1],o[3],o[5]],p)),a.start.x,a.start.y,o[0],o[1],o[2],o[3],o[4],o[5]);case"Q":return Ct.getPointOnQuadraticBezier((0,Li.t2length)(t,Ct.getPathLength(e),p=>(0,Li.getQuadraticArcLength)([a.start.x,o[0],o[2]],[a.start.y,o[1],o[3]],p)),a.start.x,a.start.y,o[0],o[1],o[2],o[3]);case"A":var h=o[0],l=o[1],c=o[2],d=o[3],f=o[4],u=o[5],g=o[6];return f+=u*t/a.pathLength,Ct.getPointOnEllipticalArc(h,l,c,d,f,g)}return null}static getPointOnLine(t,e,n,r,s,a,o){a===void 0&&(a=e),o===void 0&&(o=n);var h=(s-n)/(r-e+1e-8),l=Math.sqrt(t*t/(1+h*h));r<e&&(l*=-1);var c=h*l,d;if(r===e)d={x:a,y:o+c};else if((o-n)/(a-e+1e-8)===h)d={x:a+l,y:o+c};else{var f,u,g=this.getLineLength(e,n,r,s),p=(a-e)*(r-e)+(o-n)*(s-n);p=p/(g*g),f=e+p*(r-e),u=n+p*(s-n);var _=this.getLineLength(a,o,f,u),y=Math.sqrt(t*t-_*_);l=Math.sqrt(y*y/(1+h*h)),r<e&&(l*=-1),c=h*l,d={x:f+l,y:u+c}}return d}static getPointOnCubicBezier(t,e,n,r,s,a,o,h,l){function c(_){return _*_*_}function d(_){return 3*_*_*(1-_)}function f(_){return 3*_*(1-_)*(1-_)}function u(_){return(1-_)*(1-_)*(1-_)}var g=h*c(t)+a*d(t)+r*f(t)+e*u(t),p=l*c(t)+o*d(t)+s*f(t)+n*u(t);return{x:g,y:p}}static getPointOnQuadraticBezier(t,e,n,r,s,a,o){function h(u){return u*u}function l(u){return 2*u*(1-u)}function c(u){return(1-u)*(1-u)}var d=a*h(t)+r*l(t)+e*c(t),f=o*h(t)+s*l(t)+n*c(t);return{x:d,y:f}}static getPointOnEllipticalArc(t,e,n,r,s,a){var o=Math.cos(a),h=Math.sin(a),l={x:n*Math.cos(s),y:r*Math.sin(s)};return{x:t+(l.x*o-l.y*h),y:e+(l.x*h+l.y*o)}}static parsePathData(t){if(!t)return[];var e=t,n=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];e=e.replace(new RegExp(" ","g"),",");for(var r=0;r<n.length;r++)e=e.replace(new RegExp(n[r],"g"),"|"+n[r]);var s=e.split("|"),a=[],o=[],h=0,l=0,c=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,d;for(r=1;r<s.length;r++){var f=s[r],u=f.charAt(0);for(f=f.slice(1),o.length=0;d=c.exec(f);)o.push(d[0]);for(var g=[],p=0,_=o.length;p<_;p++){if(o[p]==="00"){g.push(0,0);continue}var y=parseFloat(o[p]);isNaN(y)?g.push(0):g.push(y)}for(;g.length>0&&!isNaN(g[0]);){var b="",m=[],v=h,w=l,S,k,C,A,x,T,M,D,O,I;switch(u){case"l":h+=g.shift(),l+=g.shift(),b="L",m.push(h,l);break;case"L":h=g.shift(),l=g.shift(),m.push(h,l);break;case"m":var H=g.shift(),j=g.shift();if(h+=H,l+=j,b="M",a.length>2&&a[a.length-1].command==="z"){for(var $=a.length-2;$>=0;$--)if(a[$].command==="M"){h=a[$].points[0]+H,l=a[$].points[1]+j;break}}m.push(h,l),u="l";break;case"M":h=g.shift(),l=g.shift(),b="M",m.push(h,l),u="L";break;case"h":h+=g.shift(),b="L",m.push(h,l);break;case"H":h=g.shift(),b="L",m.push(h,l);break;case"v":l+=g.shift(),b="L",m.push(h,l);break;case"V":l=g.shift(),b="L",m.push(h,l);break;case"C":m.push(g.shift(),g.shift(),g.shift(),g.shift()),h=g.shift(),l=g.shift(),m.push(h,l);break;case"c":m.push(h+g.shift(),l+g.shift(),h+g.shift(),l+g.shift()),h+=g.shift(),l+=g.shift(),b="C",m.push(h,l);break;case"S":k=h,C=l,S=a[a.length-1],S.command==="C"&&(k=h+(h-S.points[2]),C=l+(l-S.points[3])),m.push(k,C,g.shift(),g.shift()),h=g.shift(),l=g.shift(),b="C",m.push(h,l);break;case"s":k=h,C=l,S=a[a.length-1],S.command==="C"&&(k=h+(h-S.points[2]),C=l+(l-S.points[3])),m.push(k,C,h+g.shift(),l+g.shift()),h+=g.shift(),l+=g.shift(),b="C",m.push(h,l);break;case"Q":m.push(g.shift(),g.shift()),h=g.shift(),l=g.shift(),m.push(h,l);break;case"q":m.push(h+g.shift(),l+g.shift()),h+=g.shift(),l+=g.shift(),b="Q",m.push(h,l);break;case"T":k=h,C=l,S=a[a.length-1],S.command==="Q"&&(k=h+(h-S.points[0]),C=l+(l-S.points[1])),h=g.shift(),l=g.shift(),b="Q",m.push(k,C,h,l);break;case"t":k=h,C=l,S=a[a.length-1],S.command==="Q"&&(k=h+(h-S.points[0]),C=l+(l-S.points[1])),h+=g.shift(),l+=g.shift(),b="Q",m.push(k,C,h,l);break;case"A":A=g.shift(),x=g.shift(),T=g.shift(),M=g.shift(),D=g.shift(),O=h,I=l,h=g.shift(),l=g.shift(),b="A",m=this.convertEndpointToCenterParameterization(O,I,h,l,M,D,A,x,T);break;case"a":A=g.shift(),x=g.shift(),T=g.shift(),M=g.shift(),D=g.shift(),O=h,I=l,h+=g.shift(),l+=g.shift(),b="A",m=this.convertEndpointToCenterParameterization(O,I,h,l,M,D,A,x,T);break}a.push({command:b||u,points:m,start:{x:v,y:w},pathLength:this.calcLength(v,w,b||u,m)})}(u==="z"||u==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,e,n,r){var s,a,o,h,l=Ct;switch(n){case"L":return l.getLineLength(t,e,r[0],r[1]);case"C":return(0,Li.getCubicArcLength)([t,r[0],r[2],r[4]],[e,r[1],r[3],r[5]],1);case"Q":return(0,Li.getQuadraticArcLength)([t,r[0],r[2]],[e,r[1],r[3]],1);case"A":s=0;var c=r[4],d=r[5],f=r[4]+d,u=Math.PI/180;if(Math.abs(c-f)<u&&(u=Math.abs(c-f)),a=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],c,0),d<0)for(h=c-u;h>f;h-=u)o=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],h,0),s+=l.getLineLength(a.x,a.y,o.x,o.y),a=o;else for(h=c+u;h<f;h+=u)o=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],h,0),s+=l.getLineLength(a.x,a.y,o.x,o.y),a=o;return o=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],f,0),s+=l.getLineLength(a.x,a.y,o.x,o.y),s}return 0}static convertEndpointToCenterParameterization(t,e,n,r,s,a,o,h,l){var c=l*(Math.PI/180),d=Math.cos(c)*(t-n)/2+Math.sin(c)*(e-r)/2,f=-1*Math.sin(c)*(t-n)/2+Math.cos(c)*(e-r)/2,u=d*d/(o*o)+f*f/(h*h);u>1&&(o*=Math.sqrt(u),h*=Math.sqrt(u));var g=Math.sqrt((o*o*(h*h)-o*o*(f*f)-h*h*(d*d))/(o*o*(f*f)+h*h*(d*d)));s===a&&(g*=-1),isNaN(g)&&(g=0);var p=g*o*f/h,_=g*-h*d/o,y=(t+n)/2+Math.cos(c)*p-Math.sin(c)*_,b=(e+r)/2+Math.sin(c)*p+Math.cos(c)*_,m=function(x){return Math.sqrt(x[0]*x[0]+x[1]*x[1])},v=function(x,T){return(x[0]*T[0]+x[1]*T[1])/(m(x)*m(T))},w=function(x,T){return(x[0]*T[1]<x[1]*T[0]?-1:1)*Math.acos(v(x,T))},S=w([1,0],[(d-p)/o,(f-_)/h]),k=[(d-p)/o,(f-_)/h],C=[(-1*d-p)/o,(-1*f-_)/h],A=w(k,C);return v(k,C)<=-1&&(A=Math.PI),v(k,C)>=1&&(A=0),a===0&&A>0&&(A=A-2*Math.PI),a===1&&A<0&&(A=A+2*Math.PI),[y,b,o,h,S,A,c,a]}}Di.Path=Ct,Ct.prototype.className="Path",Ct.prototype._attrsAffectingSize=["data"],(0,s3._registerNode)(Ct),n3.Factory.addGetterSetter(Ct,"data"),Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.Arrow=void 0;const Nr=X,a3=An,nu=N,o3=Y,ru=Di;class ri extends a3.Line{_sceneFunc(t){super._sceneFunc(t);var e=Math.PI*2,n=this.points(),r=n,s=this.tension()!==0&&n.length>4;s&&(r=this.getTensionPoints());var a=this.pointerLength(),o=n.length,h,l;if(s){const f=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[o-2],n[o-1]],u=ru.Path.calcLength(r[r.length-4],r[r.length-3],"C",f),g=ru.Path.getPointOnQuadraticBezier(Math.min(1,1-a/u),f[0],f[1],f[2],f[3],f[4],f[5]);h=n[o-2]-g.x,l=n[o-1]-g.y}else h=n[o-2]-n[o-4],l=n[o-1]-n[o-3];var c=(Math.atan2(l,h)+e)%e,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(n[o-2],n[o-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(n[0],n[1]),s?(h=(r[0]+r[2])/2-n[0],l=(r[1]+r[3])/2-n[1]):(h=n[2]-n[0],l=n[3]-n[1]),t.rotate((Math.atan2(-l,-h)+e)%e),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var e=this.dashEnabled();e&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),e&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),e=this.pointerWidth()/2;return{x:t.x-e,y:t.y-e,width:t.width+e*2,height:t.height+e*2}}}Ir.Arrow=ri,ri.prototype.className="Arrow",(0,o3._registerNode)(ri),Nr.Factory.addGetterSetter(ri,"pointerLength",10,(0,nu.getNumberValidator)()),Nr.Factory.addGetterSetter(ri,"pointerWidth",10,(0,nu.getNumberValidator)()),Nr.Factory.addGetterSetter(ri,"pointerAtBeginning",!1),Nr.Factory.addGetterSetter(ri,"pointerAtEnding",!0);var Ur={};Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.Circle=void 0;const l3=X,h3=St,c3=N,u3=Y;class Oi extends h3.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}}Ur.Circle=Oi,Oi.prototype._centroid=!0,Oi.prototype.className="Circle",Oi.prototype._attrsAffectingSize=["radius"],(0,u3._registerNode)(Oi),l3.Factory.addGetterSetter(Oi,"radius",0,(0,c3.getNumberValidator)());var Gr={};Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.Ellipse=void 0;const Ja=X,d3=St,su=N,f3=Y;class Fe extends d3.Shape{_sceneFunc(t){var e=this.radiusX(),n=this.radiusY();t.beginPath(),t.save(),e!==n&&t.scale(1,n/e),t.arc(0,0,e,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}Gr.Ellipse=Fe,Fe.prototype.className="Ellipse",Fe.prototype._centroid=!0,Fe.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,f3._registerNode)(Fe),Ja.Factory.addComponentsGetterSetter(Fe,"radius",["x","y"]),Ja.Factory.addGetterSetter(Fe,"radiusX",0,(0,su.getNumberValidator)()),Ja.Factory.addGetterSetter(Fe,"radiusY",0,(0,su.getNumberValidator)());var Br={};Object.defineProperty(Br,"__esModule",{value:!0}),Br.Image=void 0;const Qa=gt,si=X,g3=St,p3=Y,Pn=N;let ee=class nd extends g3.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const e=this.getWidth(),n=this.getHeight(),r=this.cornerRadius(),s=this.attrs.image;let a;if(s){const o=this.attrs.cropWidth,h=this.attrs.cropHeight;o&&h?a=[s,this.cropX(),this.cropY(),o,h,0,0,e,n]:a=[s,0,0,e,n]}(this.hasFill()||this.hasStroke()||r)&&(t.beginPath(),r?Qa.Util.drawRoundedRectPath(t,e,n,r):t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)),s&&(r&&t.clip(),t.drawImage.apply(t,a))}_hitFunc(t){var e=this.width(),n=this.height(),r=this.cornerRadius();t.beginPath(),r?Qa.Util.drawRoundedRectPath(t,e,n,r):t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,e;return(t=this.attrs.width)!==null&&t!==void 0?t:(e=this.image())===null||e===void 0?void 0:e.width}getHeight(){var t,e;return(t=this.attrs.height)!==null&&t!==void 0?t:(e=this.image())===null||e===void 0?void 0:e.height}static fromURL(t,e,n=null){var r=Qa.Util.createImageElement();r.onload=function(){var s=new nd({image:r});e(s)},r.onerror=n,r.crossOrigin="Anonymous",r.src=t}};Br.Image=ee,ee.prototype.className="Image",(0,p3._registerNode)(ee),si.Factory.addGetterSetter(ee,"cornerRadius",0,(0,Pn.getNumberOrArrayOfNumbersValidator)(4)),si.Factory.addGetterSetter(ee,"image"),si.Factory.addComponentsGetterSetter(ee,"crop",["x","y","width","height"]),si.Factory.addGetterSetter(ee,"cropX",0,(0,Pn.getNumberValidator)()),si.Factory.addGetterSetter(ee,"cropY",0,(0,Pn.getNumberValidator)()),si.Factory.addGetterSetter(ee,"cropWidth",0,(0,Pn.getNumberValidator)()),si.Factory.addGetterSetter(ee,"cropHeight",0,(0,Pn.getNumberValidator)());var Ii={};Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.Tag=Ii.Label=void 0;const zr=X,m3=St,_3=Mi,to=N,au=Y;var ou=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],v3="Change.konva",y3="none",eo="up",io="right",no="down",ro="left",b3=ou.length;class so extends _3.Group{constructor(t){super(t),this.on("add.konva",function(e){this._addListeners(e.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var e=this,n,r=function(){e._sync()};for(n=0;n<b3;n++)t.on(ou[n]+v3,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var t=this.getText(),e=this.getTag(),n,r,s,a,o,h,l;if(t&&e){switch(n=t.width(),r=t.height(),s=e.pointerDirection(),a=e.pointerWidth(),l=e.pointerHeight(),o=0,h=0,s){case eo:o=n/2,h=-1*l;break;case io:o=n+a,h=r/2;break;case no:o=n/2,h=r+l;break;case ro:o=-1*a,h=r/2;break}e.setAttrs({x:-1*o,y:-1*h,width:n,height:r}),t.setAttrs({x:-1*o,y:-1*h})}}}Ii.Label=so,so.prototype.className="Label",(0,au._registerNode)(so);class ai extends m3.Shape{_sceneFunc(t){var e=this.width(),n=this.height(),r=this.pointerDirection(),s=this.pointerWidth(),a=this.pointerHeight(),o=this.cornerRadius();let h=0,l=0,c=0,d=0;typeof o=="number"?h=l=c=d=Math.min(o,e/2,n/2):(h=Math.min(o[0]||0,e/2,n/2),l=Math.min(o[1]||0,e/2,n/2),d=Math.min(o[2]||0,e/2,n/2),c=Math.min(o[3]||0,e/2,n/2)),t.beginPath(),t.moveTo(h,0),r===eo&&(t.lineTo((e-s)/2,0),t.lineTo(e/2,-1*a),t.lineTo((e+s)/2,0)),t.lineTo(e-l,0),t.arc(e-l,l,l,Math.PI*3/2,0,!1),r===io&&(t.lineTo(e,(n-a)/2),t.lineTo(e+s,n/2),t.lineTo(e,(n+a)/2)),t.lineTo(e,n-d),t.arc(e-d,n-d,d,0,Math.PI/2,!1),r===no&&(t.lineTo((e+s)/2,n),t.lineTo(e/2,n+a),t.lineTo((e-s)/2,n)),t.lineTo(c,n),t.arc(c,n-c,c,Math.PI/2,Math.PI,!1),r===ro&&(t.lineTo(0,(n+a)/2),t.lineTo(-1*s,n/2),t.lineTo(0,(n-a)/2)),t.lineTo(0,h),t.arc(h,h,h,Math.PI,Math.PI*3/2,!1),t.closePath(),t.fillStrokeShape(this)}getSelfRect(){var t=0,e=0,n=this.pointerWidth(),r=this.pointerHeight(),s=this.pointerDirection(),a=this.width(),o=this.height();return s===eo?(e-=r,o+=r):s===no?o+=r:s===ro?(t-=n*1.5,a+=n):s===io&&(a+=n*1.5),{x:t,y:e,width:a,height:o}}}Ii.Tag=ai,ai.prototype.className="Tag",(0,au._registerNode)(ai),zr.Factory.addGetterSetter(ai,"pointerDirection",y3),zr.Factory.addGetterSetter(ai,"pointerWidth",0,(0,to.getNumberValidator)()),zr.Factory.addGetterSetter(ai,"pointerHeight",0,(0,to.getNumberValidator)()),zr.Factory.addGetterSetter(ai,"cornerRadius",0,(0,to.getNumberOrArrayOfNumbersValidator)(4));var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.Rect=void 0;const w3=X,S3=St,C3=Y,x3=gt,T3=N;class Hr extends S3.Shape{_sceneFunc(t){var e=this.cornerRadius(),n=this.width(),r=this.height();t.beginPath(),e?x3.Util.drawRoundedRectPath(t,n,r,e):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}}Mn.Rect=Hr,Hr.prototype.className="Rect",(0,C3._registerNode)(Hr),w3.Factory.addGetterSetter(Hr,"cornerRadius",0,(0,T3.getNumberOrArrayOfNumbersValidator)(4));var jr={};Object.defineProperty(jr,"__esModule",{value:!0}),jr.RegularPolygon=void 0;const lu=X,E3=St,hu=N,k3=Y;class oi extends E3.Shape{_sceneFunc(t){const e=this._getPoints();t.beginPath(),t.moveTo(e[0].x,e[0].y);for(var n=1;n<e.length;n++)t.lineTo(e[n].x,e[n].y);t.closePath(),t.fillStrokeShape(this)}_getPoints(){const t=this.attrs.sides,e=this.attrs.radius||0,n=[];for(var r=0;r<t;r++)n.push({x:e*Math.sin(r*2*Math.PI/t),y:-1*e*Math.cos(r*2*Math.PI/t)});return n}getSelfRect(){const t=this._getPoints();var e=t[0].x,n=t[0].y,r=t[0].x,s=t[0].y;return t.forEach(a=>{e=Math.min(e,a.x),n=Math.max(n,a.x),r=Math.min(r,a.y),s=Math.max(s,a.y)}),{x:e,y:r,width:n-e,height:s-r}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}jr.RegularPolygon=oi,oi.prototype.className="RegularPolygon",oi.prototype._centroid=!0,oi.prototype._attrsAffectingSize=["radius"],(0,k3._registerNode)(oi),lu.Factory.addGetterSetter(oi,"radius",0,(0,hu.getNumberValidator)()),lu.Factory.addGetterSetter(oi,"sides",0,(0,hu.getNumberValidator)());var Vr={};Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.Ring=void 0;const cu=X,A3=St,uu=N,P3=Y;var du=Math.PI*2;class li extends A3.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,du,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),du,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}Vr.Ring=li,li.prototype.className="Ring",li.prototype._centroid=!0,li.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,P3._registerNode)(li),cu.Factory.addGetterSetter(li,"innerRadius",0,(0,uu.getNumberValidator)()),cu.Factory.addGetterSetter(li,"outerRadius",0,(0,uu.getNumberValidator)());var $r={};Object.defineProperty($r,"__esModule",{value:!0}),$r.Sprite=void 0;const hi=X,M3=St,R3=Ri,fu=N,D3=Y;class ie extends M3.Shape{constructor(t){super(t),this._updated=!0,this.anim=new R3.Animation(()=>{var e=this._updated;return this._updated=!1,e}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var e=this.animation(),n=this.frameIndex(),r=n*4,s=this.animations()[e],a=this.frameOffsets(),o=s[r+0],h=s[r+1],l=s[r+2],c=s[r+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,l,c),t.closePath(),t.fillStrokeShape(this)),d)if(a){var f=a[e],u=n*2;t.drawImage(d,o,h,l,c,f[u+0],f[u+1],l,c)}else t.drawImage(d,o,h,l,c,0,0,l,c)}_hitFunc(t){var e=this.animation(),n=this.frameIndex(),r=n*4,s=this.animations()[e],a=this.frameOffsets(),o=s[r+2],h=s[r+3];if(t.beginPath(),a){var l=a[e],c=n*2;t.rect(l[c+0],l[c+1],o,h)}else t.rect(0,0,o,h);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),e=this.animation(),n=this.animations(),r=n[e],s=r.length/4;t<s-1?this.frameIndex(t+1):this.frameIndex(0)}}$r.Sprite=ie,ie.prototype.className="Sprite",(0,D3._registerNode)(ie),hi.Factory.addGetterSetter(ie,"animation"),hi.Factory.addGetterSetter(ie,"animations"),hi.Factory.addGetterSetter(ie,"frameOffsets"),hi.Factory.addGetterSetter(ie,"image"),hi.Factory.addGetterSetter(ie,"frameIndex",0,(0,fu.getNumberValidator)()),hi.Factory.addGetterSetter(ie,"frameRate",17,(0,fu.getNumberValidator)()),hi.Factory.backCompat(ie,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var Xr={};Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.Star=void 0;const ao=X,L3=St,oo=N,O3=Y;class Ne extends L3.Shape{_sceneFunc(t){var e=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();t.beginPath(),t.moveTo(0,0-n);for(var s=1;s<r*2;s++){var a=s%2===0?n:e,o=a*Math.sin(s*Math.PI/r),h=-1*a*Math.cos(s*Math.PI/r);t.lineTo(o,h)}t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}Xr.Star=Ne,Ne.prototype.className="Star",Ne.prototype._centroid=!0,Ne.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,O3._registerNode)(Ne),ao.Factory.addGetterSetter(Ne,"numPoints",5,(0,oo.getNumberValidator)()),ao.Factory.addGetterSetter(Ne,"innerRadius",0,(0,oo.getNumberValidator)()),ao.Factory.addGetterSetter(Ne,"outerRadius",0,(0,oo.getNumberValidator)());var ci={};Object.defineProperty(ci,"__esModule",{value:!0}),ci.Text=ci.stringToArray=void 0;const lo=gt,Pt=X,I3=St,Ue=N,F3=Y;function gu(i){return Array.from(i)}ci.stringToArray=gu;var Fi="auto",N3="center",pu="inherit",Rn="justify",U3="Change.konva",G3="2d",mu="-",_u="left",B3="text",z3="Text",H3="top",j3="bottom",vu="middle",yu="normal",V3="px ",Yr=" ",$3="right",bu="rtl",X3="word",Y3="char",wu="none",ho="…",Su=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],W3=Su.length;function q3(i){return i.split(",").map(t=>{t=t.trim();const e=t.indexOf(" ")>=0,n=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!n&&(t=`"${t}"`),t}).join(", ")}var Wr;function co(){return Wr||(Wr=lo.Util.createCanvasElement().getContext(G3),Wr)}function K3(i){i.fillText(this._partialText,this._partialTextX,this._partialTextY)}function Z3(i){i.setAttr("miterLimit",2),i.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function J3(i){return i=i||{},!i.fillLinearGradientColorStops&&!i.fillRadialGradientColorStops&&!i.fillPatternImage&&(i.fill=i.fill||"black"),i}class _t extends I3.Shape{constructor(t){super(J3(t)),this._partialTextX=0,this._partialTextY=0;for(var e=0;e<W3;e++)this.on(Su[e]+U3,this._setTextData);this._setTextData()}_sceneFunc(t){var e=this.textArr,n=e.length;if(this.text()){var r=this.padding(),s=this.fontSize(),a=this.lineHeight()*s,o=this.verticalAlign(),h=this.direction(),l=0,c=this.align(),d=this.getWidth(),f=this.letterSpacing(),u=this.fill(),g=this.textDecoration(),p=g.indexOf("underline")!==-1,_=g.indexOf("line-through")!==-1,y;h=h===pu?t.direction:h;var b=0,b=a/2,m=0,v=0;for(h===bu&&t.setAttr("direction",h),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",vu),t.setAttr("textAlign",_u),o===vu?l=(this.getHeight()-n*a-r*2)/2:o===j3&&(l=this.getHeight()-n*a-r*2),t.translate(r,l+r),y=0;y<n;y++){var m=0,v=0,w=e[y],S=w.text,k=w.width,C=w.lastInParagraph,A,x,T;if(t.save(),c===$3?m+=d-k-r*2:c===N3&&(m+=(d-k-r*2)/2),p){t.save(),t.beginPath(),t.moveTo(m,b+v+Math.round(s/2)),A=S.split(" ").length-1,x=A===0,T=c===Rn&&!C?d-r*2:k,t.lineTo(m+Math.round(T),b+v+Math.round(s/2)),t.lineWidth=s/15;const j=this._getLinearGradient();t.strokeStyle=j||u,t.stroke(),t.restore()}if(_){t.save(),t.beginPath(),t.moveTo(m,b+v),A=S.split(" ").length-1,x=A===0,T=c===Rn&&C&&!x?d-r*2:k,t.lineTo(m+Math.round(T),b+v),t.lineWidth=s/15;const j=this._getLinearGradient();t.strokeStyle=j||u,t.stroke(),t.restore()}if(h!==bu&&(f!==0||c===Rn)){A=S.split(" ").length-1;for(var M=gu(S),D=0;D<M.length;D++){var O=M[D];O===" "&&!C&&c===Rn&&(m+=(d-r*2-k)/A),this._partialTextX=m,this._partialTextY=b+v,this._partialText=O,t.fillStrokeShape(this),m+=this.measureSize(O).width+f}}else f!==0&&t.setAttr("letterSpacing",`${f}px`),this._partialTextX=m,this._partialTextY=b+v,this._partialText=S,t.fillStrokeShape(this);t.restore(),n>1&&(b+=a)}}}_hitFunc(t){var e=this.getWidth(),n=this.getHeight();t.beginPath(),t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)}setText(t){var e=lo.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(B3,e),this}getWidth(){var t=this.attrs.width===Fi||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===Fi||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return lo.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var e=co(),n=this.fontSize(),r;return e.save(),e.font=this._getContextFont(),r=e.measureText(t),e.restore(),{width:r.width,height:n}}_getContextFont(){return this.fontStyle()+Yr+this.fontVariant()+Yr+(this.fontSize()+V3)+q3(this.fontFamily())}_addTextLine(t){this.align()===Rn&&(t=t.trim());var n=this._getTextWidth(t);return this.textArr.push({text:t,width:n,lastInParagraph:!1})}_getTextWidth(t){var e=this.letterSpacing(),n=t.length;return co().measureText(t).width+(n?e*(n-1):0)}_setTextData(){var t=this.text().split(`
|
|
29
|
-
`),e=+this.fontSize(),n=0,r=this.lineHeight()*e,s=this.attrs.width,a=this.attrs.height,o=s!==Fi&&s!==void 0,h=a!==Fi&&a!==void 0,l=this.padding(),c=s-l*2,d=a-l*2,f=0,u=this.wrap(),g=u!==wu,p=u!==Y3&&g,_=this.ellipsis();this.textArr=[],co().font=this._getContextFont();for(var y=_?this._getTextWidth(ho):0,b=0,m=t.length;b<m;++b){var v=t[b],w=this._getTextWidth(v);if(o&&w>c)for(;v.length>0;){for(var S=0,k=v.length,C="",A=0;S<k;){var x=S+k>>>1,T=v.slice(0,x+1),M=this._getTextWidth(T)+y;M<=c?(S=x+1,C=T,A=M):k=x}if(C){if(p){var D,O=v[C.length],I=O===Yr||O===mu;I&&A<=c?D=C.length:D=Math.max(C.lastIndexOf(Yr),C.lastIndexOf(mu))+1,D>0&&(S=D,C=C.slice(0,S),A=this._getTextWidth(C))}C=C.trimRight(),this._addTextLine(C),n=Math.max(n,A),f+=r;var H=this._shouldHandleEllipsis(f);if(H){this._tryToAddEllipsisToLastLine();break}if(v=v.slice(S),v=v.trimLeft(),v.length>0&&(w=this._getTextWidth(v),w<=c)){this._addTextLine(v),f+=r,n=Math.max(n,w);break}}else break}else this._addTextLine(v),f+=r,n=Math.max(n,w),this._shouldHandleEllipsis(f)&&b<m-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),h&&f+r>d)break}this.textHeight=e,this.textWidth=n}_shouldHandleEllipsis(t){var e=+this.fontSize(),n=this.lineHeight()*e,r=this.attrs.height,s=r!==Fi&&r!==void 0,a=this.padding(),o=r-a*2,h=this.wrap(),l=h!==wu;return!l||s&&t+n>o}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,e=t!==Fi&&t!==void 0,n=this.padding(),r=t-n*2,s=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!s)){if(e){var o=this._getTextWidth(a.text+ho)<r;o||(a.text=a.text.slice(0,a.text.length-3))}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(a.text+ho)}}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const t=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,e=this.hasShadow();return t&&e?!0:super._useBufferCanvas()}}ci.Text=_t,_t.prototype._fillFunc=K3,_t.prototype._strokeFunc=Z3,_t.prototype.className=z3,_t.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],(0,F3._registerNode)(_t),Pt.Factory.overWriteSetter(_t,"width",(0,Ue.getNumberOrAutoValidator)()),Pt.Factory.overWriteSetter(_t,"height",(0,Ue.getNumberOrAutoValidator)()),Pt.Factory.addGetterSetter(_t,"direction",pu),Pt.Factory.addGetterSetter(_t,"fontFamily","Arial"),Pt.Factory.addGetterSetter(_t,"fontSize",12,(0,Ue.getNumberValidator)()),Pt.Factory.addGetterSetter(_t,"fontStyle",yu),Pt.Factory.addGetterSetter(_t,"fontVariant",yu),Pt.Factory.addGetterSetter(_t,"padding",0,(0,Ue.getNumberValidator)()),Pt.Factory.addGetterSetter(_t,"align",_u),Pt.Factory.addGetterSetter(_t,"verticalAlign",H3),Pt.Factory.addGetterSetter(_t,"lineHeight",1,(0,Ue.getNumberValidator)()),Pt.Factory.addGetterSetter(_t,"wrap",X3),Pt.Factory.addGetterSetter(_t,"ellipsis",!1,(0,Ue.getBooleanValidator)()),Pt.Factory.addGetterSetter(_t,"letterSpacing",0,(0,Ue.getNumberValidator)()),Pt.Factory.addGetterSetter(_t,"text","",(0,Ue.getStringValidator)()),Pt.Factory.addGetterSetter(_t,"textDecoration","");var qr={};Object.defineProperty(qr,"__esModule",{value:!0}),qr.TextPath=void 0;const uo=gt,Xt=X,Q3=St,Dn=Di,fo=ci,Cu=N,t4=Y;var e4="",xu="normal";function Tu(i){i.fillText(this.partialText,0,0)}function Eu(i){i.strokeText(this.partialText,0,0)}class xt extends Q3.Shape{constructor(t){super(t),this.dummyCanvas=uo.Util.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return Dn.Path.getPathLength(this.dataArray)}_getPointAtLength(t){if(!this.attrs.data)return null;const e=this.pathLength;return t-1>e?null:Dn.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=Dn.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var e=this.textDecoration(),n=this.fill(),r=this.fontSize(),s=this.glyphInfo;e==="underline"&&t.beginPath();for(var a=0;a<s.length;a++){t.save();var o=s[a].p0;t.translate(o.x,o.y),t.rotate(s[a].rotation),this.partialText=s[a].text,t.fillStrokeShape(this),e==="underline"&&(a===0&&t.moveTo(0,r/2+1),t.lineTo(r,r/2+1)),t.restore()}e==="underline"&&(t.strokeStyle=n,t.lineWidth=r/20,t.stroke()),t.restore()}_hitFunc(t){t.beginPath();var e=this.glyphInfo;if(e.length>=1){var n=e[0].p0;t.moveTo(n.x,n.y)}for(var r=0;r<e.length;r++){var s=e[r].p1;t.lineTo(s.x,s.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return uo.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(t){return fo.Text.prototype.setText.call(this,t)}_getContextFont(){return fo.Text.prototype._getContextFont.call(this)}_getTextSize(t){var e=this.dummyCanvas,n=e.getContext("2d");n.save(),n.font=this._getContextFont();var r=n.measureText(t);return n.restore(),{width:r.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:t,height:e}=this._getTextSize(this.attrs.text);if(this.textWidth=t,this.textHeight=e,this.glyphInfo=[],!this.attrs.data)return null;const n=this.letterSpacing(),r=this.align(),s=this.kerningFunc(),a=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,0);let o=0;r==="center"&&(o=Math.max(0,this.pathLength/2-a/2)),r==="right"&&(o=Math.max(0,this.pathLength-a));const h=(0,fo.stringToArray)(this.text());let l=o;for(var c=0;c<h.length;c++){const d=this._getPointAtLength(l);if(!d)return;let f=this._getTextSize(h[c]).width+n;if(h[c]===" "&&r==="justify"){const b=this.text().split(" ").length-1;f+=(this.pathLength-a)/b}const u=this._getPointAtLength(l+f);if(!u)return;const g=Dn.Path.getLineLength(d.x,d.y,u.x,u.y);let p=0;if(s)try{p=s(h[c-1],h[c])*this.fontSize()}catch{p=0}d.x+=p,u.x+=p,this.textWidth+=p;const _=Dn.Path.getPointOnLine(p+g/2,d.x,d.y,u.x,u.y),y=Math.atan2(u.y-d.y,u.x-d.x);this.glyphInfo.push({transposeX:_.x,transposeY:_.y,text:h[c],rotation:y,p0:d,p1:u}),l+=f}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var t=[];this.glyphInfo.forEach(function(c){t.push(c.p0.x),t.push(c.p0.y),t.push(c.p1.x),t.push(c.p1.y)});for(var e=t[0]||0,n=t[0]||0,r=t[1]||0,s=t[1]||0,a,o,h=0;h<t.length/2;h++)a=t[h*2],o=t[h*2+1],e=Math.min(e,a),n=Math.max(n,a),r=Math.min(r,o),s=Math.max(s,o);var l=this.fontSize();return{x:e-l/2,y:r-l/2,width:n-e+l,height:s-r+l}}destroy(){return uo.Util.releaseCanvas(this.dummyCanvas),super.destroy()}}qr.TextPath=xt,xt.prototype._fillFunc=Tu,xt.prototype._strokeFunc=Eu,xt.prototype._fillFuncHit=Tu,xt.prototype._strokeFuncHit=Eu,xt.prototype.className="TextPath",xt.prototype._attrsAffectingSize=["text","fontSize","data"],(0,t4._registerNode)(xt),Xt.Factory.addGetterSetter(xt,"data"),Xt.Factory.addGetterSetter(xt,"fontFamily","Arial"),Xt.Factory.addGetterSetter(xt,"fontSize",12,(0,Cu.getNumberValidator)()),Xt.Factory.addGetterSetter(xt,"fontStyle",xu),Xt.Factory.addGetterSetter(xt,"align","left"),Xt.Factory.addGetterSetter(xt,"letterSpacing",0,(0,Cu.getNumberValidator)()),Xt.Factory.addGetterSetter(xt,"textBaseline","middle"),Xt.Factory.addGetterSetter(xt,"fontVariant",xu),Xt.Factory.addGetterSetter(xt,"text",e4),Xt.Factory.addGetterSetter(xt,"textDecoration",null),Xt.Factory.addGetterSetter(xt,"kerningFunc",null);var Kr={};Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.Transformer=void 0;const rt=gt,it=X,ku=dt,i4=St,n4=Mn,Au=Mi,Yt=Y,Ge=N,r4=Y;var Pu="tr-konva",s4=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(i=>i+`.${Pu}`).join(" "),Mu="nodesRect",a4=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],o4={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const l4="ontouchstart"in Yt.Konva._global;function h4(i,t,e){if(i==="rotater")return e;t+=rt.Util.degToRad(o4[i]||0);var n=(rt.Util.radToDeg(t)%360+360)%360;return rt.Util._inRange(n,337.5,360)||rt.Util._inRange(n,0,22.5)?"ns-resize":rt.Util._inRange(n,22.5,67.5)?"nesw-resize":rt.Util._inRange(n,67.5,112.5)?"ew-resize":rt.Util._inRange(n,112.5,157.5)?"nwse-resize":rt.Util._inRange(n,157.5,202.5)?"ns-resize":rt.Util._inRange(n,202.5,247.5)?"nesw-resize":rt.Util._inRange(n,247.5,292.5)?"ew-resize":rt.Util._inRange(n,292.5,337.5)?"nwse-resize":(rt.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var Zr=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],Ru=1e8;function c4(i){return{x:i.x+i.width/2*Math.cos(i.rotation)+i.height/2*Math.sin(-i.rotation),y:i.y+i.height/2*Math.cos(i.rotation)+i.width/2*Math.sin(i.rotation)}}function Du(i,t,e){const n=e.x+(i.x-e.x)*Math.cos(t)-(i.y-e.y)*Math.sin(t),r=e.y+(i.x-e.x)*Math.sin(t)+(i.y-e.y)*Math.cos(t);return{...i,rotation:i.rotation+t,x:n,y:r}}function u4(i,t){const e=c4(i);return Du(i,t,e)}function d4(i,t,e){let n=t;for(let r=0;r<i.length;r++){const s=Yt.Konva.getAngle(i[r]),a=Math.abs(s-t)%(Math.PI*2);Math.min(a,Math.PI*2-a)<e&&(n=s)}return n}class Q extends Au.Group{constructor(t){super(t),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(s4,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(t){return rt.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([t])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return Pu+this._id}setNodes(t=[]){this._nodes&&this._nodes.length&&this.detach();const e=t.filter(r=>r.isAncestorOf(this)?(rt.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=e,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(r=>{const s=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=r._attrsAffectingSize.map(o=>o+"Change."+this._getEventNamespace()).join(" ");r.on(a,s),r.on(a4.map(o=>o+`.${this._getEventNamespace()}`).join(" "),s),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,s),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,n=>{e=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(n,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,n=>{if(!e)return;const r=t.getAbsolutePosition(),s=r.x-e.x,a=r.y-e.y;this.nodes().forEach(o=>{if(o===t||o.isDragging())return;const h=o.getAbsolutePosition();o.setAbsolutePosition({x:h.x+s,y:h.y+a}),o.startDrag(n)}),e=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(Mu),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Mu,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),n){var r=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),s=t.getAbsoluteScale(n),a=t.getAbsolutePosition(n),o=r.x*s.x-t.offsetX()*s.x,h=r.y*s.y-t.offsetY()*s.y;const l=(Yt.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:a.x+o*Math.cos(l)+h*Math.sin(-l),y:a.y+h*Math.cos(l)+o*Math.sin(l),width:r.width*s.x,height:r.height*s.y,rotation:l};return Du(c,-Yt.Konva.getAngle(e),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-Ru,y:-Ru,width:0,height:0,rotation:0};const e=[];this.nodes().map(l=>{const c=l.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=l.getAbsoluteTransform();d.forEach(function(u){var g=f.point(u);e.push(g)})});const n=new rt.Transform;n.rotate(-Yt.Konva.getAngle(this.rotation()));var r=1/0,s=1/0,a=-1/0,o=-1/0;e.forEach(function(l){var c=n.point(l);r===void 0&&(r=a=c.x,s=o=c.y),r=Math.min(r,c.x),s=Math.min(s,c.y),a=Math.max(a,c.x),o=Math.max(o,c.y)}),n.invert();const h=n.point({x:r,y:s});return{x:h.x,y:h.y,width:a-r,height:o-s,rotation:Yt.Konva.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(),Zr.forEach(t=>{this._createAnchor(t)}),this._createAnchor("rotater")}_createAnchor(t){var e=new n4.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:l4?10:"auto"}),n=this;e.on("mousedown touchstart",function(r){n._handleMouseDown(r)}),e.on("dragstart",r=>{e.stopDrag(),r.cancelBubble=!0}),e.on("dragend",r=>{r.cancelBubble=!0}),e.on("mouseenter",()=>{var r=Yt.Konva.getAngle(this.rotation()),s=this.rotateAnchorCursor(),a=h4(t,r,s);e.getStage().content&&(e.getStage().content.style.cursor=a),this._cursorChange=!0}),e.on("mouseout",()=>{e.getStage().content&&(e.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(e)}_createBack(){var t=new i4.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(e,n){var r=n.getParent(),s=r.padding();e.beginPath(),e.rect(-s,-s,n.width()+s*2,n.height()+s*2),e.moveTo(n.width()/2,-s),r.rotateEnabled()&&e.lineTo(n.width()/2,-r.rotateAnchorOffset()*rt.Util._sign(n.height())-s),e.fillStrokeShape(n)},hitFunc:(e,n)=>{if(this.shouldOverdrawWholeArea()){var r=this.padding();e.beginPath(),e.rect(-r,-r,n.width()+r*2,n.height()+r*2),e.fillStrokeShape(n)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",e=>{e.cancelBubble=!0}),t.on("dragmove",e=>{e.cancelBubble=!0}),t.on("dragend",e=>{e.cancelBubble=!0}),this.on("dragmove",e=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var e=this._getNodeRect(),n=e.width,r=e.height,s=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/s),this.cos=Math.abs(n/s),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var a=t.target.getAbsolutePosition(),o=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:o.x-a.x,y:o.y-a.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(h=>{h._fire("transformstart",{evt:t.evt,target:h})})}_handleMouseMove(t){var e,n,r,s=this.findOne("."+this._movingAnchorName),a=s.getStage();a.setPointersPositions(t);const o=a.getPointerPosition();let h={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y};const l=s.getAbsolutePosition();this.anchorDragBoundFunc()&&(h=this.anchorDragBoundFunc()(l,h,t)),s.setAbsolutePosition(h);const c=s.getAbsolutePosition();if(!(l.x===c.x&&l.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();e=s.x()-d.width/2,n=-s.y()+d.height/2;let D=Math.atan2(-n,e)+Math.PI/2;d.height<0&&(D-=Math.PI);var f=Yt.Konva.getAngle(this.rotation());const O=f+D,I=Yt.Konva.getAngle(this.rotationSnapTolerance()),j=d4(this.rotationSnaps(),O,I)-d.rotation,$=u4(d,j);this._fitNodesInto($,t);return}var u=this.shiftBehavior(),g;u==="inverted"?g=this.keepRatio()&&!t.shiftKey:u==="none"?g=this.keepRatio():g=this.keepRatio()||t.shiftKey;var m=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(g){var p=m?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(p.x-s.x(),2)+Math.pow(p.y-s.y(),2));var _=this.findOne(".top-left").x()>p.x?-1:1,y=this.findOne(".top-left").y()>p.y?-1:1;e=r*this.cos*_,n=r*this.sin*y,this.findOne(".top-left").x(p.x-e),this.findOne(".top-left").y(p.y-n)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(s.y());else if(this._movingAnchorName==="top-right"){if(g){var p=m?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(s.x()-p.x,2)+Math.pow(p.y-s.y(),2));var _=this.findOne(".top-right").x()<p.x?-1:1,y=this.findOne(".top-right").y()>p.y?-1:1;e=r*this.cos*_,n=r*this.sin*y,this.findOne(".top-right").x(p.x+e),this.findOne(".top-right").y(p.y-n)}var b=s.position();this.findOne(".top-left").y(b.y),this.findOne(".bottom-right").x(b.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(s.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(s.x());else if(this._movingAnchorName==="bottom-left"){if(g){var p=m?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(p.x-s.x(),2)+Math.pow(s.y()-p.y,2));var _=p.x<s.x()?-1:1,y=s.y()<p.y?-1:1;e=r*this.cos*_,n=r*this.sin*y,s.x(p.x-e),s.y(p.y+n)}b=s.position(),this.findOne(".top-left").x(b.x),this.findOne(".bottom-right").y(b.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(s.y());else if(this._movingAnchorName==="bottom-right"){if(g){var p=m?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(s.x()-p.x,2)+Math.pow(s.y()-p.y,2));var _=this.findOne(".bottom-right").x()<p.x?-1:1,y=this.findOne(".bottom-right").y()<p.y?-1:1;e=r*this.cos*_,n=r*this.sin*y,this.findOne(".bottom-right").x(p.x+e),this.findOne(".bottom-right").y(p.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));var m=this.centeredScaling()||t.altKey;if(m){var v=this.findOne(".top-left"),w=this.findOne(".bottom-right"),S=v.x(),k=v.y(),C=this.getWidth()-w.x(),A=this.getHeight()-w.y();w.move({x:-S,y:-k}),v.move({x:C,y:A})}var x=this.findOne(".top-left").getAbsolutePosition();e=x.x,n=x.y;var T=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),M=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:n,width:T,height:M,rotation:Yt.Konva.getAngle(this.rotation())},t)}}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var e=this.getNode();this._fire("transformend",{evt:t,target:e}),e&&this._nodes.forEach(n=>{n._fire("transformend",{evt:t,target:n})}),this._movingAnchorName=null}}_fitNodesInto(t,e){var n=this._getNodeRect();const r=1;if(rt.Util._inRange(t.width,-this.padding()*2-r,r)){this.update();return}if(rt.Util._inRange(t.height,-this.padding()*2-r,r)){this.update();return}const s=this.flipEnabled();var a=new rt.Transform;if(a.rotate(Yt.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=a.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!s){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!s){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=a.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!s){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!s){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(n,t);d?t=d:rt.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const o=1e7,h=new rt.Transform;h.translate(n.x,n.y),h.rotate(n.rotation),h.scale(n.width/o,n.height/o);const l=new rt.Transform;l.translate(t.x,t.y),l.rotate(t.rotation),l.scale(t.width/o,t.height/o);const c=l.multiply(h.invert());this._nodes.forEach(d=>{var f;const u=d.getParent().getAbsoluteTransform(),g=d.getTransform().copy();g.translate(d.offsetX(),d.offsetY());const p=new rt.Transform;p.multiply(u.copy().invert()).multiply(c).multiply(u).multiply(g);const _=p.decompose();d.setAttrs(_),this._fire("transform",{evt:e,target:d}),d._fire("transform",{evt:e,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(rt.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var t,e=this._getNodeRect();this.rotation(rt.Util._getRotation(e.rotation));var n=e.width,r=e.height,s=this.enabledAnchors(),a=this.resizeEnabled(),o=this.padding(),h=this.anchorSize();const l=this.find("._anchor");l.forEach(d=>{d.setAttrs({width:h,height:h,offsetX:h/2,offsetY:h/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:h/2+o,offsetY:h/2+o,visible:a&&s.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:h/2+o,visible:a&&s.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:h/2-o,offsetY:h/2+o,visible:a&&s.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:h/2+o,visible:a&&s.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:h/2-o,visible:a&&s.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:h/2+o,offsetY:h/2-o,visible:a&&s.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:h/2-o,visible:a&&s.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:h/2-o,offsetY:h/2-o,visible:a&&s.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:n/2,y:-this.rotateAnchorOffset()*rt.Util._sign(r)-o,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&l.forEach(d=>{c(d)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Au.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return ku.Node.prototype.toObject.call(this)}clone(t){var e=ku.Node.prototype.clone.call(this,t);return e}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}Kr.Transformer=Q;function f4(i){return i instanceof Array||rt.Util.warn("enabledAnchors value should be an array"),i instanceof Array&&i.forEach(function(t){Zr.indexOf(t)===-1&&rt.Util.warn("Unknown anchor name: "+t+". Available names are: "+Zr.join(", "))}),i||[]}Q.prototype.className="Transformer",(0,r4._registerNode)(Q),it.Factory.addGetterSetter(Q,"enabledAnchors",Zr,f4),it.Factory.addGetterSetter(Q,"flipEnabled",!0,(0,Ge.getBooleanValidator)()),it.Factory.addGetterSetter(Q,"resizeEnabled",!0),it.Factory.addGetterSetter(Q,"anchorSize",10,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"rotateEnabled",!0),it.Factory.addGetterSetter(Q,"rotationSnaps",[]),it.Factory.addGetterSetter(Q,"rotateAnchorOffset",50,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"rotateAnchorCursor","crosshair"),it.Factory.addGetterSetter(Q,"rotationSnapTolerance",5,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"borderEnabled",!0),it.Factory.addGetterSetter(Q,"anchorStroke","rgb(0, 161, 255)"),it.Factory.addGetterSetter(Q,"anchorStrokeWidth",1,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"anchorFill","white"),it.Factory.addGetterSetter(Q,"anchorCornerRadius",0,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"borderStroke","rgb(0, 161, 255)"),it.Factory.addGetterSetter(Q,"borderStrokeWidth",1,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"borderDash"),it.Factory.addGetterSetter(Q,"keepRatio",!0),it.Factory.addGetterSetter(Q,"shiftBehavior","default"),it.Factory.addGetterSetter(Q,"centeredScaling",!1),it.Factory.addGetterSetter(Q,"ignoreStroke",!1),it.Factory.addGetterSetter(Q,"padding",0,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"node"),it.Factory.addGetterSetter(Q,"nodes"),it.Factory.addGetterSetter(Q,"boundBoxFunc"),it.Factory.addGetterSetter(Q,"anchorDragBoundFunc"),it.Factory.addGetterSetter(Q,"anchorStyleFunc"),it.Factory.addGetterSetter(Q,"shouldOverdrawWholeArea",!1),it.Factory.addGetterSetter(Q,"useSingleNodeRotation",!0),it.Factory.backCompat(Q,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Jr={};Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.Wedge=void 0;const Qr=X,g4=St,p4=Y,Lu=N,m4=Y;class ye extends g4.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,p4.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Jr.Wedge=ye,ye.prototype.className="Wedge",ye.prototype._centroid=!0,ye.prototype._attrsAffectingSize=["radius"],(0,m4._registerNode)(ye),Qr.Factory.addGetterSetter(ye,"radius",0,(0,Lu.getNumberValidator)()),Qr.Factory.addGetterSetter(ye,"angle",0,(0,Lu.getNumberValidator)()),Qr.Factory.addGetterSetter(ye,"clockwise",!1),Qr.Factory.backCompat(ye,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var ts={};Object.defineProperty(ts,"__esModule",{value:!0}),ts.Blur=void 0;const Ou=X,_4=dt,v4=N;function Iu(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var y4=[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],b4=[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 w4(i,t){var e=i.data,n=i.width,r=i.height,s,a,o,h,l,c,d,f,u,g,p,_,y,b,m,v,w,S,k,C,A,x,T,M,D=t+t+1,O=n-1,I=r-1,H=t+1,j=H*(H+1)/2,$=new Iu,et=null,G=$,z=null,W=null,J=y4[t],lt=b4[t];for(o=1;o<D;o++)G=G.next=new Iu,o===H&&(et=G);for(G.next=$,d=c=0,a=0;a<r;a++){for(v=w=S=k=f=u=g=p=0,_=H*(C=e[c]),y=H*(A=e[c+1]),b=H*(x=e[c+2]),m=H*(T=e[c+3]),f+=j*C,u+=j*A,g+=j*x,p+=j*T,G=$,o=0;o<H;o++)G.r=C,G.g=A,G.b=x,G.a=T,G=G.next;for(o=1;o<H;o++)h=c+((O<o?O:o)<<2),f+=(G.r=C=e[h])*(M=H-o),u+=(G.g=A=e[h+1])*M,g+=(G.b=x=e[h+2])*M,p+=(G.a=T=e[h+3])*M,v+=C,w+=A,S+=x,k+=T,G=G.next;for(z=$,W=et,s=0;s<n;s++)e[c+3]=T=p*J>>lt,T!==0?(T=255/T,e[c]=(f*J>>lt)*T,e[c+1]=(u*J>>lt)*T,e[c+2]=(g*J>>lt)*T):e[c]=e[c+1]=e[c+2]=0,f-=_,u-=y,g-=b,p-=m,_-=z.r,y-=z.g,b-=z.b,m-=z.a,h=d+((h=s+t+1)<O?h:O)<<2,v+=z.r=e[h],w+=z.g=e[h+1],S+=z.b=e[h+2],k+=z.a=e[h+3],f+=v,u+=w,g+=S,p+=k,z=z.next,_+=C=W.r,y+=A=W.g,b+=x=W.b,m+=T=W.a,v-=C,w-=A,S-=x,k-=T,W=W.next,c+=4;d+=n}for(s=0;s<n;s++){for(w=S=k=v=u=g=p=f=0,c=s<<2,_=H*(C=e[c]),y=H*(A=e[c+1]),b=H*(x=e[c+2]),m=H*(T=e[c+3]),f+=j*C,u+=j*A,g+=j*x,p+=j*T,G=$,o=0;o<H;o++)G.r=C,G.g=A,G.b=x,G.a=T,G=G.next;for(l=n,o=1;o<=t;o++)c=l+s<<2,f+=(G.r=C=e[c])*(M=H-o),u+=(G.g=A=e[c+1])*M,g+=(G.b=x=e[c+2])*M,p+=(G.a=T=e[c+3])*M,v+=C,w+=A,S+=x,k+=T,G=G.next,o<I&&(l+=n);for(c=s,z=$,W=et,a=0;a<r;a++)h=c<<2,e[h+3]=T=p*J>>lt,T>0?(T=255/T,e[h]=(f*J>>lt)*T,e[h+1]=(u*J>>lt)*T,e[h+2]=(g*J>>lt)*T):e[h]=e[h+1]=e[h+2]=0,f-=_,u-=y,g-=b,p-=m,_-=z.r,y-=z.g,b-=z.b,m-=z.a,h=s+((h=a+H)<I?h:I)*n<<2,f+=v+=z.r=e[h],u+=w+=z.g=e[h+1],g+=S+=z.b=e[h+2],p+=k+=z.a=e[h+3],z=z.next,_+=C=W.r,y+=A=W.g,b+=x=W.b,m+=T=W.a,v-=C,w-=A,S-=x,k-=T,W=W.next,c+=n}}const S4=function(t){var e=Math.round(this.blurRadius());e>0&&w4(t,e)};ts.Blur=S4,Ou.Factory.addGetterSetter(_4.Node,"blurRadius",0,(0,v4.getNumberValidator)(),Ou.Factory.afterSetFilter);var es={};Object.defineProperty(es,"__esModule",{value:!0}),es.Brighten=void 0;const Fu=X,C4=dt,x4=N,T4=function(i){var t=this.brightness()*255,e=i.data,n=e.length,r;for(r=0;r<n;r+=4)e[r]+=t,e[r+1]+=t,e[r+2]+=t};es.Brighten=T4,Fu.Factory.addGetterSetter(C4.Node,"brightness",0,(0,x4.getNumberValidator)(),Fu.Factory.afterSetFilter);var is={};Object.defineProperty(is,"__esModule",{value:!0}),is.Contrast=void 0;const Nu=X,E4=dt,k4=N,A4=function(i){var t=Math.pow((this.contrast()+100)/100,2),e=i.data,n=e.length,r=150,s=150,a=150,o;for(o=0;o<n;o+=4)r=e[o],s=e[o+1],a=e[o+2],r/=255,r-=.5,r*=t,r+=.5,r*=255,s/=255,s-=.5,s*=t,s+=.5,s*=255,a/=255,a-=.5,a*=t,a+=.5,a*=255,r=r<0?0:r>255?255:r,s=s<0?0:s>255?255:s,a=a<0?0:a>255?255:a,e[o]=r,e[o+1]=s,e[o+2]=a};is.Contrast=A4,Nu.Factory.addGetterSetter(E4.Node,"contrast",0,(0,k4.getNumberValidator)(),Nu.Factory.afterSetFilter);var ns={};Object.defineProperty(ns,"__esModule",{value:!0}),ns.Emboss=void 0;const Be=X,rs=dt,P4=gt,Uu=N,M4=function(i){var t=this.embossStrength()*10,e=this.embossWhiteLevel()*255,n=this.embossDirection(),r=this.embossBlend(),s=0,a=0,o=i.data,h=i.width,l=i.height,c=h*4,d=l;switch(n){case"top-left":s=-1,a=-1;break;case"top":s=-1,a=0;break;case"top-right":s=-1,a=1;break;case"right":s=0,a=1;break;case"bottom-right":s=1,a=1;break;case"bottom":s=1,a=0;break;case"bottom-left":s=1,a=-1;break;case"left":s=0,a=-1;break;default:P4.Util.error("Unknown emboss direction: "+n)}do{var f=(d-1)*c,u=s;d+u<1&&(u=0),d+u>l&&(u=0);var g=(d-1+u)*h*4,p=h;do{var _=f+(p-1)*4,y=a;p+y<1&&(y=0),p+y>h&&(y=0);var b=g+(p-1+y)*4,m=o[_]-o[b],v=o[_+1]-o[b+1],w=o[_+2]-o[b+2],S=m,k=S>0?S:-S,C=v>0?v:-v,A=w>0?w:-w;if(C>k&&(S=v),A>k&&(S=w),S*=t,r){var x=o[_]+S,T=o[_+1]+S,M=o[_+2]+S;o[_]=x>255?255:x<0?0:x,o[_+1]=T>255?255:T<0?0:T,o[_+2]=M>255?255:M<0?0:M}else{var D=e-S;D<0?D=0:D>255&&(D=255),o[_]=o[_+1]=o[_+2]=D}}while(--p)}while(--d)};ns.Emboss=M4,Be.Factory.addGetterSetter(rs.Node,"embossStrength",.5,(0,Uu.getNumberValidator)(),Be.Factory.afterSetFilter),Be.Factory.addGetterSetter(rs.Node,"embossWhiteLevel",.5,(0,Uu.getNumberValidator)(),Be.Factory.afterSetFilter),Be.Factory.addGetterSetter(rs.Node,"embossDirection","top-left",null,Be.Factory.afterSetFilter),Be.Factory.addGetterSetter(rs.Node,"embossBlend",!1,null,Be.Factory.afterSetFilter);var ss={};Object.defineProperty(ss,"__esModule",{value:!0}),ss.Enhance=void 0;const Gu=X,R4=dt,D4=N;function go(i,t,e,n,r){var s=e-t,a=r-n,o;return s===0?n+a/2:a===0?n:(o=(i-t)/s,o=a*o+n,o)}const L4=function(i){var t=i.data,e=t.length,n=t[0],r=n,s,a=t[1],o=a,h,l=t[2],c=l,d,f,u=this.enhance();if(u!==0){for(f=0;f<e;f+=4)s=t[f+0],s<n?n=s:s>r&&(r=s),h=t[f+1],h<a?a=h:h>o&&(o=h),d=t[f+2],d<l?l=d:d>c&&(c=d);r===n&&(r=255,n=0),o===a&&(o=255,a=0),c===l&&(c=255,l=0);var g,p,_,y,b,m,v,w,S;for(u>0?(p=r+u*(255-r),_=n-u*(n-0),b=o+u*(255-o),m=a-u*(a-0),w=c+u*(255-c),S=l-u*(l-0)):(g=(r+n)*.5,p=r+u*(r-g),_=n+u*(n-g),y=(o+a)*.5,b=o+u*(o-y),m=a+u*(a-y),v=(c+l)*.5,w=c+u*(c-v),S=l+u*(l-v)),f=0;f<e;f+=4)t[f+0]=go(t[f+0],n,r,_,p),t[f+1]=go(t[f+1],a,o,m,b),t[f+2]=go(t[f+2],l,c,S,w)}};ss.Enhance=L4,Gu.Factory.addGetterSetter(R4.Node,"enhance",0,(0,D4.getNumberValidator)(),Gu.Factory.afterSetFilter);var as={};Object.defineProperty(as,"__esModule",{value:!0}),as.Grayscale=void 0;const O4=function(i){var t=i.data,e=t.length,n,r;for(n=0;n<e;n+=4)r=.34*t[n]+.5*t[n+1]+.16*t[n+2],t[n]=r,t[n+1]=r,t[n+2]=r};as.Grayscale=O4;var os={};Object.defineProperty(os,"__esModule",{value:!0}),os.HSL=void 0;const Ni=X,po=dt,mo=N;Ni.Factory.addGetterSetter(po.Node,"hue",0,(0,mo.getNumberValidator)(),Ni.Factory.afterSetFilter),Ni.Factory.addGetterSetter(po.Node,"saturation",0,(0,mo.getNumberValidator)(),Ni.Factory.afterSetFilter),Ni.Factory.addGetterSetter(po.Node,"luminance",0,(0,mo.getNumberValidator)(),Ni.Factory.afterSetFilter);const I4=function(i){var t=i.data,e=t.length,n=1,r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a=this.luminance()*127,o,h=n*r*Math.cos(s*Math.PI/180),l=n*r*Math.sin(s*Math.PI/180),c=.299*n+.701*h+.167*l,d=.587*n-.587*h+.33*l,f=.114*n-.114*h-.497*l,u=.299*n-.299*h-.328*l,g=.587*n+.413*h+.035*l,p=.114*n-.114*h+.293*l,_=.299*n-.3*h+1.25*l,y=.587*n-.586*h-1.05*l,b=.114*n+.886*h-.2*l,m,v,w,S;for(o=0;o<e;o+=4)m=t[o+0],v=t[o+1],w=t[o+2],S=t[o+3],t[o+0]=c*m+d*v+f*w+a,t[o+1]=u*m+g*v+p*w+a,t[o+2]=_*m+y*v+b*w+a,t[o+3]=S};os.HSL=I4;var ls={};Object.defineProperty(ls,"__esModule",{value:!0}),ls.HSV=void 0;const Ui=X,_o=dt,vo=N,F4=function(i){var t=i.data,e=t.length,n=Math.pow(2,this.value()),r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a,o=n*r*Math.cos(s*Math.PI/180),h=n*r*Math.sin(s*Math.PI/180),l=.299*n+.701*o+.167*h,c=.587*n-.587*o+.33*h,d=.114*n-.114*o-.497*h,f=.299*n-.299*o-.328*h,u=.587*n+.413*o+.035*h,g=.114*n-.114*o+.293*h,p=.299*n-.3*o+1.25*h,_=.587*n-.586*o-1.05*h,y=.114*n+.886*o-.2*h,b,m,v,w;for(a=0;a<e;a+=4)b=t[a+0],m=t[a+1],v=t[a+2],w=t[a+3],t[a+0]=l*b+c*m+d*v,t[a+1]=f*b+u*m+g*v,t[a+2]=p*b+_*m+y*v,t[a+3]=w};ls.HSV=F4,Ui.Factory.addGetterSetter(_o.Node,"hue",0,(0,vo.getNumberValidator)(),Ui.Factory.afterSetFilter),Ui.Factory.addGetterSetter(_o.Node,"saturation",0,(0,vo.getNumberValidator)(),Ui.Factory.afterSetFilter),Ui.Factory.addGetterSetter(_o.Node,"value",0,(0,vo.getNumberValidator)(),Ui.Factory.afterSetFilter);var hs={};Object.defineProperty(hs,"__esModule",{value:!0}),hs.Invert=void 0;const N4=function(i){var t=i.data,e=t.length,n;for(n=0;n<e;n+=4)t[n]=255-t[n],t[n+1]=255-t[n+1],t[n+2]=255-t[n+2]};hs.Invert=N4;var cs={};Object.defineProperty(cs,"__esModule",{value:!0}),cs.Kaleidoscope=void 0;const us=X,Bu=dt,zu=gt,Hu=N;var U4=function(i,t,e){var n=i.data,r=t.data,s=i.width,a=i.height,o=e.polarCenterX||s/2,h=e.polarCenterY||a/2,l,c,d,f=0,u=0,g=0,p=0,_,y=Math.sqrt(o*o+h*h);c=s-o,d=a-h,_=Math.sqrt(c*c+d*d),y=_>y?_:y;var b=a,m=s,v,w,S=360/m*Math.PI/180,k,C;for(w=0;w<m;w+=1)for(k=Math.sin(w*S),C=Math.cos(w*S),v=0;v<b;v+=1)c=Math.floor(o+y*v/b*C),d=Math.floor(h+y*v/b*k),l=(d*s+c)*4,f=n[l+0],u=n[l+1],g=n[l+2],p=n[l+3],l=(w+v*s)*4,r[l+0]=f,r[l+1]=u,r[l+2]=g,r[l+3]=p},G4=function(i,t,e){var n=i.data,r=t.data,s=i.width,a=i.height,o=e.polarCenterX||s/2,h=e.polarCenterY||a/2,l,c,d,f,u,g=0,p=0,_=0,y=0,b,m=Math.sqrt(o*o+h*h);c=s-o,d=a-h,b=Math.sqrt(c*c+d*d),m=b>m?b:m;var v=a,w=s,S,k,C=e.polarRotation||0,A,x;for(c=0;c<s;c+=1)for(d=0;d<a;d+=1)f=c-o,u=d-h,S=Math.sqrt(f*f+u*u)*v/m,k=(Math.atan2(u,f)*180/Math.PI+360+C)%360,k=k*w/360,A=Math.floor(k),x=Math.floor(S),l=(x*s+A)*4,g=n[l+0],p=n[l+1],_=n[l+2],y=n[l+3],l=(d*s+c)*4,r[l+0]=g,r[l+1]=p,r[l+2]=_,r[l+3]=y};const B4=function(i){var t=i.width,e=i.height,n,r,s,a,o,h,l,c,d,f,u=Math.round(this.kaleidoscopePower()),g=Math.round(this.kaleidoscopeAngle()),p=Math.floor(t*(g%360)/360);if(!(u<1)){var _=zu.Util.createCanvasElement();_.width=t,_.height=e;var y=_.getContext("2d").getImageData(0,0,t,e);zu.Util.releaseCanvas(_),U4(i,y,{polarCenterX:t/2,polarCenterY:e/2});for(var b=t/Math.pow(2,u);b<=8;)b=b*2,u-=1;b=Math.ceil(b);var m=b,v=0,w=m,S=1;for(p+b>t&&(v=m,w=0,S=-1),r=0;r<e;r+=1)for(n=v;n!==w;n+=S)s=Math.round(n+p)%t,d=(t*r+s)*4,o=y.data[d+0],h=y.data[d+1],l=y.data[d+2],c=y.data[d+3],f=(t*r+n)*4,y.data[f+0]=o,y.data[f+1]=h,y.data[f+2]=l,y.data[f+3]=c;for(r=0;r<e;r+=1)for(m=Math.floor(b),a=0;a<u;a+=1){for(n=0;n<m+1;n+=1)d=(t*r+n)*4,o=y.data[d+0],h=y.data[d+1],l=y.data[d+2],c=y.data[d+3],f=(t*r+m*2-n-1)*4,y.data[f+0]=o,y.data[f+1]=h,y.data[f+2]=l,y.data[f+3]=c;m*=2}G4(y,i,{polarRotation:0})}};cs.Kaleidoscope=B4,us.Factory.addGetterSetter(Bu.Node,"kaleidoscopePower",2,(0,Hu.getNumberValidator)(),us.Factory.afterSetFilter),us.Factory.addGetterSetter(Bu.Node,"kaleidoscopeAngle",0,(0,Hu.getNumberValidator)(),us.Factory.afterSetFilter);var ds={};Object.defineProperty(ds,"__esModule",{value:!0}),ds.Mask=void 0;const ju=X,z4=dt,H4=N;function fs(i,t,e){var n=(e*i.width+t)*4,r=[];return r.push(i.data[n++],i.data[n++],i.data[n++],i.data[n++]),r}function Ln(i,t){return Math.sqrt(Math.pow(i[0]-t[0],2)+Math.pow(i[1]-t[1],2)+Math.pow(i[2]-t[2],2))}function j4(i){for(var t=[0,0,0],e=0;e<i.length;e++)t[0]+=i[e][0],t[1]+=i[e][1],t[2]+=i[e][2];return t[0]/=i.length,t[1]/=i.length,t[2]/=i.length,t}function V4(i,t){var e=fs(i,0,0),n=fs(i,i.width-1,0),r=fs(i,0,i.height-1),s=fs(i,i.width-1,i.height-1),a=t||10;if(Ln(e,n)<a&&Ln(n,s)<a&&Ln(s,r)<a&&Ln(r,e)<a){for(var o=j4([n,e,s,r]),h=[],l=0;l<i.width*i.height;l++){var c=Ln(o,[i.data[l*4],i.data[l*4+1],i.data[l*4+2]]);h[l]=c<a?0:255}return h}}function $4(i,t){for(var e=0;e<i.width*i.height;e++)i.data[4*e+3]=t[e]}function X4(i,t,e){for(var n=[1,1,1,1,0,1,1,1,1],r=Math.round(Math.sqrt(n.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var h=0;h<t;h++){for(var l=o*t+h,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,g=h+f-s;if(u>=0&&u<e&&g>=0&&g<t){var p=u*t+g,_=n[d*r+f];c+=i[p]*_}}a[l]=c===2040?255:0}return a}function Y4(i,t,e){for(var n=[1,1,1,1,1,1,1,1,1],r=Math.round(Math.sqrt(n.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var h=0;h<t;h++){for(var l=o*t+h,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,g=h+f-s;if(u>=0&&u<e&&g>=0&&g<t){var p=u*t+g,_=n[d*r+f];c+=i[p]*_}}a[l]=c>=1020?255:0}return a}function W4(i,t,e){for(var n=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],r=Math.round(Math.sqrt(n.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var h=0;h<t;h++){for(var l=o*t+h,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,g=h+f-s;if(u>=0&&u<e&&g>=0&&g<t){var p=u*t+g,_=n[d*r+f];c+=i[p]*_}}a[l]=c}return a}const q4=function(i){var t=this.threshold(),e=V4(i,t);return e&&(e=X4(e,i.width,i.height),e=Y4(e,i.width,i.height),e=W4(e,i.width,i.height),$4(i,e)),i};ds.Mask=q4,ju.Factory.addGetterSetter(z4.Node,"threshold",0,(0,H4.getNumberValidator)(),ju.Factory.afterSetFilter);var gs={};Object.defineProperty(gs,"__esModule",{value:!0}),gs.Noise=void 0;const Vu=X,K4=dt,Z4=N,J4=function(i){var t=this.noise()*255,e=i.data,n=e.length,r=t/2,s;for(s=0;s<n;s+=4)e[s+0]+=r-2*r*Math.random(),e[s+1]+=r-2*r*Math.random(),e[s+2]+=r-2*r*Math.random()};gs.Noise=J4,Vu.Factory.addGetterSetter(K4.Node,"noise",.2,(0,Z4.getNumberValidator)(),Vu.Factory.afterSetFilter);var ps={};Object.defineProperty(ps,"__esModule",{value:!0}),ps.Pixelate=void 0;const $u=X,Q4=gt,t_=dt,e_=N,i_=function(i){var t=Math.ceil(this.pixelSize()),e=i.width,n=i.height,r,s,a,o,h,l,c,d=Math.ceil(e/t),f=Math.ceil(n/t),u,g,p,_,y,b,m,v=i.data;if(t<=0){Q4.Util.error("pixelSize value can not be <= 0");return}for(y=0;y<d;y+=1)for(b=0;b<f;b+=1){for(o=0,h=0,l=0,c=0,u=y*t,g=u+t,p=b*t,_=p+t,m=0,r=u;r<g;r+=1)if(!(r>=e))for(s=p;s<_;s+=1)s>=n||(a=(e*s+r)*4,o+=v[a+0],h+=v[a+1],l+=v[a+2],c+=v[a+3],m+=1);for(o=o/m,h=h/m,l=l/m,c=c/m,r=u;r<g;r+=1)if(!(r>=e))for(s=p;s<_;s+=1)s>=n||(a=(e*s+r)*4,v[a+0]=o,v[a+1]=h,v[a+2]=l,v[a+3]=c)}};ps.Pixelate=i_,$u.Factory.addGetterSetter(t_.Node,"pixelSize",8,(0,e_.getNumberValidator)(),$u.Factory.afterSetFilter);var ms={};Object.defineProperty(ms,"__esModule",{value:!0}),ms.Posterize=void 0;const Xu=X,n_=dt,r_=N,s_=function(i){var t=Math.round(this.levels()*254)+1,e=i.data,n=e.length,r=255/t,s;for(s=0;s<n;s+=1)e[s]=Math.floor(e[s]/r)*r};ms.Posterize=s_,Xu.Factory.addGetterSetter(n_.Node,"levels",.5,(0,r_.getNumberValidator)(),Xu.Factory.afterSetFilter);var _s={};Object.defineProperty(_s,"__esModule",{value:!0}),_s.RGB=void 0;const vs=X,yo=dt,a_=N,o_=function(i){var t=i.data,e=t.length,n=this.red(),r=this.green(),s=this.blue(),a,o;for(a=0;a<e;a+=4)o=(.34*t[a]+.5*t[a+1]+.16*t[a+2])/255,t[a]=o*n,t[a+1]=o*r,t[a+2]=o*s,t[a+3]=t[a+3]};_s.RGB=o_,vs.Factory.addGetterSetter(yo.Node,"red",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),vs.Factory.addGetterSetter(yo.Node,"green",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),vs.Factory.addGetterSetter(yo.Node,"blue",0,a_.RGBComponent,vs.Factory.afterSetFilter);var ys={};Object.defineProperty(ys,"__esModule",{value:!0}),ys.RGBA=void 0;const On=X,bs=dt,l_=N,h_=function(i){var t=i.data,e=t.length,n=this.red(),r=this.green(),s=this.blue(),a=this.alpha(),o,h;for(o=0;o<e;o+=4)h=1-a,t[o]=n*a+t[o]*h,t[o+1]=r*a+t[o+1]*h,t[o+2]=s*a+t[o+2]*h};ys.RGBA=h_,On.Factory.addGetterSetter(bs.Node,"red",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),On.Factory.addGetterSetter(bs.Node,"green",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),On.Factory.addGetterSetter(bs.Node,"blue",0,l_.RGBComponent,On.Factory.afterSetFilter),On.Factory.addGetterSetter(bs.Node,"alpha",1,function(i){return this._filterUpToDate=!1,i>1?1:i<0?0:i});var ws={};Object.defineProperty(ws,"__esModule",{value:!0}),ws.Sepia=void 0;const c_=function(i){var t=i.data,e=t.length,n,r,s,a;for(n=0;n<e;n+=4)r=t[n+0],s=t[n+1],a=t[n+2],t[n+0]=Math.min(255,r*.393+s*.769+a*.189),t[n+1]=Math.min(255,r*.349+s*.686+a*.168),t[n+2]=Math.min(255,r*.272+s*.534+a*.131)};ws.Sepia=c_;var Ss={};Object.defineProperty(Ss,"__esModule",{value:!0}),Ss.Solarize=void 0;const u_=function(i){var t=i.data,e=i.width,n=i.height,r=e*4,s=n;do{var a=(s-1)*r,o=e;do{var h=a+(o-1)*4,l=t[h],c=t[h+1],d=t[h+2];l>127&&(l=255-l),c>127&&(c=255-c),d>127&&(d=255-d),t[h]=l,t[h+1]=c,t[h+2]=d}while(--o)}while(--s)};Ss.Solarize=u_;var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.Threshold=void 0;const Yu=X,d_=dt,f_=N,g_=function(i){var t=this.threshold()*255,e=i.data,n=e.length,r;for(r=0;r<n;r+=1)e[r]=e[r]<t?0:255};Cs.Threshold=g_,Yu.Factory.addGetterSetter(d_.Node,"threshold",.5,(0,f_.getNumberValidator)(),Yu.Factory.afterSetFilter),Object.defineProperty(br,"__esModule",{value:!0}),br.Konva=void 0;const Wu=Oc,p_=Dr,m_=Ir,__=Ur,v_=Gr,y_=Br,qu=Ii,b_=An,w_=Di,S_=Mn,C_=jr,x_=Vr,T_=$r,E_=Xr,k_=ci,A_=qr,P_=Kr,M_=Jr,R_=ts,D_=es,L_=is,O_=ns,I_=ss,F_=as,N_=os,U_=ls,G_=hs,B_=cs,z_=ds,H_=gs,j_=ps,V_=ms,$_=_s,X_=ys,Y_=ws,W_=Ss,q_=Cs;br.Konva=Wu.Konva.Util._assign(Wu.Konva,{Arc:p_.Arc,Arrow:m_.Arrow,Circle:__.Circle,Ellipse:v_.Ellipse,Image:y_.Image,Label:qu.Label,Tag:qu.Tag,Line:b_.Line,Path:w_.Path,Rect:S_.Rect,RegularPolygon:C_.RegularPolygon,Ring:x_.Ring,Sprite:T_.Sprite,Star:E_.Star,Text:k_.Text,TextPath:A_.TextPath,Transformer:P_.Transformer,Wedge:M_.Wedge,Filters:{Blur:R_.Blur,Brighten:D_.Brighten,Contrast:L_.Contrast,Emboss:O_.Emboss,Enhance:I_.Enhance,Grayscale:F_.Grayscale,HSL:N_.HSL,HSV:U_.HSV,Invert:G_.Invert,Kaleidoscope:B_.Kaleidoscope,Mask:z_.Mask,Noise:H_.Noise,Pixelate:j_.Pixelate,Posterize:V_.Posterize,RGB:$_.RGB,RGBA:X_.RGBA,Sepia:Y_.Sepia,Solarize:W_.Solarize,Threshold:q_.Threshold}});var K_=Ba.exports;Object.defineProperty(K_,"__esModule",{value:!0});const Z_=br;Ba.exports=Z_.Konva;var J_=Ba.exports;const U=Hl(J_),Q_=U.Ellipse.prototype.toObject;U.Ellipse.prototype.toObject=function(){const i=Q_.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash()}}};const tv=U.Line.prototype.toObject;U.Line.prototype.toObject=function(){const i=tv.call(this);return{...i,attrs:{...i.attrs,x:this.getAbsolutePosition().x,y:this.getAbsolutePosition().y,strokeWidth:this.strokeWidth(),dash:this.dash()}}};const ev=U.Node.prototype.toObject,iv=function(){const i=ev.call(this);return{...i,attrs:{...i.attrs,x:this.getAbsolutePosition().x,y:this.getAbsolutePosition().y,scaleX:this.getAbsoluteScale().x,scaleY:this.getAbsoluteScale().y,rotation:this.getAbsoluteRotation(),opacity:this.getAbsoluteOpacity()}}};U.Node.prototype.toObject=iv;const nv=U.Node.prototype.remove;U.Node.prototype.remove=function(){return nv.call(this),this.fire("removed",{target:this}),this};const rv=U.Node.prototype.moveUp;U.Node.prototype.moveUp=function(){const i=rv.call(this);return i&&this.fire("move:up"),i};const sv=U.Node.prototype.moveDown;U.Node.prototype.moveDown=function(){const i=sv.call(this);return i&&this.fire("move:down"),i};const av=U.Node.prototype.moveToTop;U.Node.prototype.moveToTop=function(){const i=av.call(this);return i&&this.fire("move:top"),i};const ov=U.Node.prototype.moveToBottom;U.Node.prototype.moveToBottom=function(){const i=ov.call(this);return i&&this.fire("move:bottom"),i};const lv=U.Node.prototype.moveTo;U.Node.prototype.moveTo=function(i){const t=lv.call(this,i);return this.fire("move:to"),t};const hv=U.Rect.prototype.toObject;U.Rect.prototype.toObject=function(){const i=hv.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash(),cornerRadius:this.cornerRadius()}}};const cv=U.RegularPolygon.prototype.toObject;U.RegularPolygon.prototype.toObject=function(){const i=cv.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash()}}};const uv=U.Text.prototype.toObject;U.Text.prototype.toObject=function(){const i=uv.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth()}}};const dv=U.Image.prototype.toObject;U.Image.prototype.toObject=function(){const i=dv.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash(),image:this.image()}}};const Ku=(i,t)=>{if(i.length!==t.length)return!1;for(let e=0;e<i.length;e++){const n=i[e],r=t.find(s=>s.id===n.id);if(!r||!fv(n,r))return!1}return!0},fv=(i,t)=>i.attrs.id===i.attrs.id&&i._id===t._id,Gi=i=>i.reduce((t,e)=>[...t,...e.toArray()],[]),gv=i=>{i.sort(function(e,n){return e-n});const t=Math.floor(i.length/2);return i[t]},Zu=i=>{const t=Math.atan2(i[1],i[0]),e=Math.pow(i[0],2)+Math.pow(i[1],2),n=Math.sqrt(e),r=(i[0]*i[3]-i[2]*i[1])/n;return{rotation:t/(Math.PI/180),scaleX:n,scaleY:r,x:i[4],y:i[5]}},pv=(i,t)=>{const e=i.getTransform().getMatrix(),n=t.getTransform().getMatrix(),r=e[0],s=e[1],a=e[2],o=e[3],h=e[4],l=e[5],c=n[0],d=n[1],f=n[2],u=n[3],g=n[4],p=n[5],_=c*u,y=d*f,b=(f*s-r*u)/(y-_),m=(c*s-r*d)/(_-y),v=(f*o-a*u)/(y-_),w=(c*o-a*d)/(_-y),S=(f*(l-p)+u*(g-h))/(y-_),k=(c*(l-p)+d*(g-h))/(_-y);return Zu([b,m,v,w,S,k])};class Ju{app;constructor(t){this.app=t}}class mv extends Ju{constructor(t){super(t),this.app.stage.on("mousedown",this.onMouseDown),this.app.stage.on("mouseup",this.onMouseUp),this.app.stage.on("mousemove",this.onMouseMove),this.app.stage.on("mouseover",this.onMouseOver),this.app.stage.on("mouseout",this.onMouseOut),this.app.stage.on("dblclick",this.onMouseDoubleClick),this.app.stage.on("click",this.onMouseClick),this.app.stage.on("contextmenu",this.onMouseContextmenu),this.app.stage.on("wheel",this.onWheel)}onMouseDown=t=>{t.evt.button===1&&this.app.triggerPanning(!0),!this.app.stage.draggable()&&this.app.emit("mouseDown",t)};onMouseUp=t=>{t.evt.button===1&&this.app.triggerPanning(!1),!this.app.stage.draggable()&&this.app.emit("mouseUp",t)};onMouseMove=t=>{this.app.stage.draggable()||this.app.emit("mouseMove",t)};onMouseOver=t=>{this.app.stage.draggable()||this.app.emit("mouseOver",t)};onMouseOut=t=>{this.app.stage.draggable()||this.app.emit("mouseOut",t)};onMouseDoubleClick=t=>{this.app.stage.draggable()||this.app.emit("mouseDoubleClick",t)};onMouseClick=t=>{this.app.stage.draggable()||this.app.emit("mouseClick",t)};onMouseContextmenu=t=>{this.app.triggerTool(!1),this.app.emit("mouseContextMenu",t),setTimeout(()=>this.app.triggerTool(!0),100)};onWheel=t=>{if(t.evt.preventDefault(),!this.app.config.mousewheel.enabled)return;const e=this.app.stage.scaleX();this.app.emit("canvasZoomStart",e);const n=this.app.stage.getPointerPosition()??new pt(0,0),r=new pt((n.x-this.app.stage.x())/e,(n.y-this.app.stage.y())/e),s=(t.evt.shiftKey&&!t.evt.ctrlKey?t.evt.deltaX:t.evt.deltaY)>0?1:-1;let a=e;s>0?a+=this.app.config.mousewheel.factor:a-=this.app.config.mousewheel.factor,a=Math.min(Math.max(a,this.app.config.scale.min),this.app.config.scale.max),this.app.stage.scale({x:a,y:a}),this.app.stage.position({x:n.x-r.x*a,y:n.y-r.y*a}),this.app.emit("canvasZoomEnd",a)};destroy(){this.app.stage.off("mousedown",this.onMouseDown),this.app.stage.off("mouseup",this.onMouseUp),this.app.stage.off("mousemove",this.onMouseMove),this.app.stage.off("mouseover",this.onMouseOver),this.app.stage.off("mouseout",this.onMouseOut),this.app.stage.off("dblclick",this.onMouseDoubleClick),this.app.stage.off("click",this.onMouseClick),this.app.stage.off("contextmenu",this.onMouseContextmenu),this.app.stage.off("wheel",this.onWheel)}}const Qu=i=>typeof i=="function";class _v extends Ju{currentTool=null;enable=!0;constructor(t){super(t),this.app.on("mouseDown",this.onMousedown),this.app.on("mouseMove",this.onMousemove),this.app.on("mouseUp",this.onMouseup),this.app.on("mouseClick",this.onClick),this.app.on("mouseDoubleClick",this.onDoubleClick)}get available(){return this.currentTool!==null&&this.enable&&!this.app.stage.draggable()}async setTool(t){const e=this.currentTool;e?.name!==t.name&&(e?.hooks&&Qu(e?.hooks?.onInactive)&&await e.hooks.onInactive?.(this.app,e),this.currentTool=t,this.currentTool?.hooks&&Qu(this.currentTool?.hooks?.onActive)&&await this.currentTool.hooks.onActive?.(this.app,this.currentTool),this.app.render(),this.app.emit("toolChanged",e,t))}trigger(t){const e=this.enable;t===void 0?this.enable=!this.enable:this.enable=t,this.currentTool?.enableChanged?.(e,this.enable)}onMousedown=t=>{!this.available||!this.currentTool?.mousedown||t.evt.button!==0||this.currentTool.mousedown({event:t,pointer:this.app.pointer,app:this.app})};onMouseup=t=>{!this.available||!this.currentTool?.mouseup||t.evt.button!==0||this.currentTool.mouseup({event:t,pointer:this.app.pointer,app:this.app})};onMousemove=t=>{!this.available||!this.currentTool?.mousemove||t.evt.button!==0||this.currentTool.mousemove({event:t,pointer:this.app.pointer,app:this.app})};onClick=t=>{!this.available||!this.currentTool?.click||t.evt.button!==0||this.currentTool.click({event:t,pointer:this.app.pointer,app:this.app})};onDoubleClick=t=>{!this.available||!this.currentTool?.doubleClick||t.evt.button!==0||this.currentTool.doubleClick({event:t,pointer:this.app.pointer,app:this.app})};destroy(){this.app.off("mouseDown",this.onMousedown),this.app.off("mouseMove",this.onMousemove),this.app.off("mouseUp",this.onMouseup),this.app.off("mouseClick",this.onClick),this.app.off("mouseDoubleClick",this.onDoubleClick),this.currentTool=null}}var vv=Object.defineProperty,yv=Object.getOwnPropertyDescriptor,ze=(i,t,e,n)=>{for(var r=n>1?void 0:n?yv(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&vv(t,e,r),r};class bv{name="alignmentPlugin";alignment;app;options;keyFns=[];constructor(t){this.options={enabled:!0,...t}}install(t){this.app=t,this.alignment=new be(t,this.options),this.app.alignLeft=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignLeft(e),this},this.app.alignRight=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignRight(e),this},this.app.alignTop=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignTop(e),this},this.app.alignBottom=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignBottom(e),this},this.app.alignCenterX=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignCenterX(e),this},this.app.alignCenterY=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignCenterY(e),this},this.app.dispersionX=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.dispersionX(e),this},this.app.dispersionY=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.dispersionY(e),this},this.keyFns.push(this.app.domKey.on({key:"a",title:"左对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"h",title:"水平居中",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"d",title:"右对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"w",title:"顶对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"v",title:"垂直居中",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"s",title:"底对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"h",title:"水平分布",ctrl:!0,shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"v",title:"垂直分布",ctrl:!0,shift:!0},()=>{})),this.app.emit("alignmentInstalled",this)}destroy(){this.keyFns.forEach(t=>t.removeListener?.()),this.keyFns=[],this.app?.emit("alignmentDestroy",this)}enable(){this.alignment&&(this.options.enabled=!0,this.alignment.enabled=!0)}disable(){this.alignment&&(this.options.enabled=!1,this.alignment.enabled=!1)}isEnabled(){return this.options.enabled&&(this.alignment?.enabled??!1)}}function He(i,t,e){const n=e.value;return e.value=function(...r){if(this.enabled)return n.apply(this,r);console.log(`Method ${t} is disabled.`)},e}class be{app;enabled;constructor(t,e){const{enabled:n}=e;this.app=t,this.enabled=n}alignLeft(t){const e=t.map(r=>r.getClientRect()),n=Math.min(...e.map(r=>r.x));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=e[s].x-n;return a.attrs={...a.attrs,x:a.attrs.x-o},a}))}alignRight(t){const e=t.map(r=>r.getClientRect()),n=Math.max(...e.map(r=>r.x+r.width));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=n-(e[s].x+e[s].width);return a.attrs={...a.attrs,x:a.attrs.x+o},a}))}alignTop(t){const e=t.map(r=>r.getClientRect()),n=Math.min(...e.map(r=>r.y));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=e[s].y-n;return a.attrs={...a.attrs,y:a.attrs.y-o},a}))}alignBottom(t){const e=t.map(r=>r.getClientRect()),n=Math.max(...e.map(r=>r.y+r.height));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=n-(e[s].y+e[s].height);return a.attrs={...a.attrs,y:a.attrs.y+o},a}))}alignCenterX(t){const e=t.map(r=>r.getClientRect()),n=e.reduce((r,s)=>r+(s.x+s.width/2),0)/e.length;this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=n-(e[s].x+e[s].width/2);return a.attrs={...a.attrs,x:a.attrs.x+o},a}))}alignCenterY(t){const e=t.map(r=>r.getClientRect()),n=e.reduce((r,s)=>r+(s.y+s.height/2),0)/e.length;this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=n-(e[s].y+e[s].height/2);return a.attrs={...a.attrs,y:a.attrs.y+o},a}))}dispersionX(t){t.map(r=>r.getClientRect().x+r.getClientRect().width/2).every((r,s,a)=>r===a[0])||this.distributeNodes(t,"x")}dispersionY(t){t.map(r=>r.getClientRect().y+r.getClientRect().height/2).every((r,s,a)=>r===a[0])||this.distributeNodes(t,"y")}distributeNodes(t,e){if(t.length<=2)return;t.sort((d,f)=>d.getClientRect()[e]-f.getClientRect()[e]);const n=t[0],r=t[t.length-1],s=n.getClientRect()[e]+(e==="x"?n.getClientRect().width:n.getClientRect().height),a=r.getClientRect()[e]-s,h=t.slice(1,-1).reduce((d,f)=>d+(e==="x"?f.getClientRect().width:f.getClientRect().height),0),l=Math.max((a-h)/(t.length-1),0);let c=s;this.app.update(...t.map((d,f)=>{const u=d.toObject();if(f===0||f===t.length-1)return u;const g=c+l;return u.attrs[e]=g-d.getClientRect()[e]+u.attrs[e],c=g+(e==="x"?d.getClientRect().width:d.getClientRect().height),u}))}}ze([He],be.prototype,"alignLeft",1),ze([He],be.prototype,"alignRight",1),ze([He],be.prototype,"alignTop",1),ze([He],be.prototype,"alignBottom",1),ze([He],be.prototype,"alignCenterX",1),ze([He],be.prototype,"alignCenterY",1),ze([He],be.prototype,"dispersionX",1),ze([He],be.prototype,"dispersionY",1);class td{app;selected;optionLayer;enabled;multipleSelect;hightLightConfig;transformerConfig;rubberConfig;transformer;rubberRect;rubberStartPoint=new pt(0,0);rubberEnable=!1;hightLightRects;constructor(t,e){const{enabled:n,multipleSelect:r,transformer:s,hightLight:a,rubber:o}=e;this.app=t,this.selected=new Map,this.hightLightRects=new Map,this.enabled=n,this.multipleSelect=r,this.transformerConfig=s,this.hightLightConfig=a,this.rubberConfig=o,this.optionLayer=new U.Layer,this.optionLayer.name("pictode:option:layer"),this.app.stage.add(this.optionLayer),this.transformer=new U.Transformer({...this.transformerConfig,shouldOverdrawWholeArea:!1,flipEnabled:!1}),this.transformer.anchorStyleFunc(h=>{["middle-left","middle-right","top-center","bottom-center"].some(c=>h.hasName(c))&&([...this.selected.values()][0]instanceof U.Text||[...this.selected.values()][0]instanceof U.Group||this.selected.size>1)&&h.visible(!1);const l=(c="")=>{const d=h.getStage();!d||!d.content||(d.content.style.cursor=c)};h.on("mousedown",()=>{this.enabled=!1}),h.on("mouseup",()=>{this.enabled=!0}),h.on("mouseenter",()=>{this.enabled=!1,h.hasName("rotater")&&l("grabbing")}),h.on("mouseout",()=>{this.enabled=!0,h.hasName("rotater")&&l()})}),this.optionLayer.add(this.transformer),this.rubberRect=new U.Rect({stroke:this.rubberConfig.stroke,fill:this.rubberConfig.fill,strokeWidth:this.rubberConfig.strokeWidth,strokeScaleEnabled:!1}),this.optionLayer.add(this.rubberRect),this.transformer.on("transformstart",this.onTransformStart),this.transformer.on("transformend",this.onTransformEnd),this.transformer.on("dragstart",this.onDragStart),this.transformer.on("dragend",this.onDragEnd),this.app.on("mouseDown",this.onMouseDown),this.app.on("mouseMove",this.onMouseMove),this.app.on("mouseUp",this.onMouseUp),this.app.on("mouseClick",this.onMouseClick),this.app.on("mouseOut",this.onMouseOut)}handleNodeRemoved=({target:t})=>{this.cancelSelect(t),t.off("removed",this.handleNodeRemoved)};select(...t){this.enabled&&(Ku(t,[...this.selected.values()])||(this.cancelSelect(),this.transformer.nodes(t.filter(e=>(e.draggable(!0),e.on("removed",this.handleNodeRemoved),this.selected.set(e.id(),e),e!==this.rubberRect))),this.setHightRect(...t),this.app.render(),this.app.emit("selectedChanged",Array.from(this.selected.values()))))}cancelSelect(...t){this.selected.size!==0&&(t.length===0&&(t=[...this.selected.values()]),t.forEach(e=>{e.draggable(!1),e.off("removed",this.handleNodeRemoved),this.selected.delete(e.id())}),this.removeHightRect(...t),this.transformer.nodes([...this.selected.values()]),this.app.emit("selectedChanged",Array.from(this.selected.values())))}selectAll(){this.select(...this.app.mainLayer.getChildren())}triggerSelector(t){t===void 0?this.enabled=!this.enabled:this.enabled=t,this.enabled||(this.rubberEnable=!1)}isSelected(t){return this.selected.has(t.id())}getSelectClientRect(){return this.transformer.getClientRect()}setHightRect(...t){this.hightLightRects=t.reduce((e,n)=>{const r=new U.Rect({stroke:this.hightLightConfig.stroke,strokeWidth:this.hightLightConfig.strokeWidth,dash:this.hightLightConfig.dash,fillEnabled:!1,strokeScaleEnabled:!1});this.calculateNodeRect(n,r,this.hightLightConfig.padding??0),this.optionLayer.add(r);const s=()=>requestAnimationFrame(()=>this.calculateNodeRect(n,r,this.hightLightConfig.padding??0));return n.on("dragmove transform xChange yChange",s),e.set(n.id(),{rect:r,transformHandler:s}),e},new Map)}removeHightRect(...t){t.forEach(e=>{const n=this.hightLightRects.get(e.id());n&&(e.off("dragmove transform xChange yChange",n.transformHandler),n.rect.remove(),this.hightLightRects.delete(e.id()))})}calculateNodeRect(t,e,n=0){const{x:r,y:s,width:a,height:o}=this.getNodeRect(t,n);e.position({x:(r-this.app.stage.x())/this.app.stage.scaleX(),y:(s-this.app.stage.y())/this.app.stage.scaleY()}),e.width(a/this.app.stage.scaleX()),e.height(o/this.app.stage.scaleY()),e.rotation(t.rotation())}getNodeRect(t,e=0){const n=f=>U.angleDeg?f*Math.PI/180:f,r=[];let s=[];t instanceof U.Group?s=t.getChildren():s=[t],s.map(f=>{const u=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.transformer.ignoreStroke()}),g=[{x:u.x,y:u.y},{x:u.x+u.width,y:u.y},{x:u.x+u.width,y:u.y+u.height},{x:u.x,y:u.y+u.height}],p=f.getAbsoluteTransform();g.forEach(function(_){const y=p.point(_);r.push(new pt(y.x,y.y))})});const a=new U.Transform;a.rotate(-n(t.rotation()));let o,h,l,c;r.forEach(function(f){const u=a.point(f);(o===void 0||h===void 0||l===void 0||c===void 0)&&(o=l=u.x,h=c=u.y),o=Math.min(o,u.x),h=Math.min(h,u.y),l=Math.max(l,u.x),c=Math.max(c,u.y)}),a.invert();const d=a.point({x:(o??0)-e,y:(h??0)-e});return{x:d.x,y:d.y,width:(l??0)-(o??0)+e*2,height:(c??0)-(h??0)+e*2}}onTransformStart=()=>{this.app.emit("nodeTransformStart",Array.from(this.selected.values())),this.app.emit("nodeUpdateBefore",Array.from(this.selected.values()))};onTransformEnd=()=>{this.app.emit("nodeTransformEnd",Array.from(this.selected.values())),this.app.emit("nodeUpdated",Array.from(this.selected.values()))};onDragStart=()=>{this.app.emit("nodeTransformStart",Array.from(this.selected.values())),this.app.emit("nodeUpdateBefore",Array.from(this.selected.values()))};onDragEnd=()=>{this.app.emit("nodeTransformEnd",Array.from(this.selected.values())),this.app.emit("nodeUpdated",Array.from(this.selected.values()))};onMouseDown=t=>{!this.enabled||t.evt.button!==0||t.target instanceof U.Stage&&(this.cancelSelect(),this.rubberStartPoint.clone(this.app.pointer),this.rubberRect.setPosition(this.rubberStartPoint),this.rubberRect.width(0),this.rubberRect.height(0),this.rubberRect.visible(!1),this.rubberEnable=!0)};onMouseMove=()=>{if(!this.enabled||!this.rubberEnable)return;const t=new pt(Math.min(this.app.pointer.x,this.rubberStartPoint.x),Math.min(this.app.pointer.y,this.rubberStartPoint.y));this.rubberRect.setPosition(t),this.rubberRect.width(Math.max(this.app.pointer.x,this.rubberStartPoint.x)-t.x),this.rubberRect.height(Math.max(this.app.pointer.y,this.rubberStartPoint.y)-t.y),this.rubberRect.visible(!0)};onMouseUp=t=>{if(!(!this.enabled||t.evt.button!==0)&&this.rubberEnable){const e=this.app.getShapesInArea(this.rubberRect);this.select(...e),this.rubberRect.visible(!1),this.rubberEnable=!1;return}};onMouseClick=t=>{if(!this.enabled||t.evt.button!==0||t.target instanceof U.Stage||!t.target.attrs.id)return;const n=this.app.findTopGroup(t.target)??t.target;t.evt.shiftKey&&this.multipleSelect?this.selected.has(n.attrs.id)?this.cancelSelect(n):this.select(...this.selected.values(),n):this.select(n)};onMouseOut=t=>{t.target instanceof U.Stage&&(this.rubberEnable=!1)};destroy(){this.transformer.off("transformstart",this.onTransformStart),this.transformer.off("transformend",this.onTransformEnd),this.transformer.off("dragstart",this.onDragStart),this.transformer.off("dragend",this.onDragEnd),this.app.off("mouseDown",this.onMouseDown),this.app.off("mouseMove",this.onMouseMove),this.app.off("mouseUp",this.onMouseUp),this.app.off("mouseClick",this.onMouseClick),this.app.off("mouseOut",this.onMouseOut),this.selected.clear(),this.enabled=!1,this.transformer.remove(),this.optionLayer.remove()}}const wv={enabled:!0,multipleSelect:!0,transformer:{padding:6,ignoreStroke:!0,borderStroke:"#4e86e3",borderStrokeWidth:1,borderDash:[3,3],anchorSize:8,anchorStroke:"#4e86e3",anchorCornerRadius:3,anchorStrokeWidth:1,rotateAnchorOffset:20},hightLight:{padding:3,stroke:"#4e86e3",strokeWidth:1},rubber:{stroke:"#4e86e3",strokeWidth:1,fill:"#4e86e350"}};class Sv{name="selectorPlugin";selector;app;options;keyFns=[];constructor(t){this.options={...wv,...t}}install(t){this.app=t,this.selector=new td(t,this.options),this.app.on("canvasCleared",this.onCanvasCleared),this.app.select=function(...e){const n=this.app.getPlugin("selectorPlugin");return n&&n.selector?.select(...e),this},this.app.cancelSelect=function(...e){const n=this.app.getPlugin("selectorPlugin");return n&&n.selector?.cancelSelect(...e),this},this.app.selectByEvent=function(e){return this.app.getPlugin("selectorPlugin")&&(e.target instanceof U.Stage?this.cancelSelect():this.select(e.target)),this},this.app.selectAll=function(){const e=this.app.getPlugin("selectorPlugin");return e&&e.selector?.selectAll(),this},this.app.triggerSelector=function(e){const n=this.app.getPlugin("selectorPlugin");return n&&n.selector?.triggerSelector(e),this},this.app.isSelected=function(e){const n=this.app.getPlugin("selectorPlugin");return n?n.selector?.isSelected(e)??!1:!1},this.keyFns.push(this.app.domKey.on({key:"a",title:"全部选中",exact:!0,ctrl:!0},()=>{const e=this.app?.isPluginEnable("selectorPlugin");this.app?.triggerSelector(!0),this.app?.selectAll(),this.app?.triggerSelector(e)})),this.keyFns.push(this.app.domKey.on({key:"g",title:"组合",ctrl:!0,shift:!0,exact:!0},()=>{})),this.app.emit("selectorInstalled",this)}destroy(){this.keyFns.forEach(t=>t.removeListener?.()),this.keyFns=[],this.selector?.destroy(),this.app?.off("canvasCleared",this.onCanvasCleared),this.app?.emit("selectorDestroy",this)}enable(){this.selector&&(this.selector.triggerSelector(!0),this.options.enabled=!0)}disable(){this.selector&&(this.selector.cancelSelect(),this.selector.triggerSelector(!1),this.options.enabled=!1)}isEnabled(){return this.options.enabled&&(this.selector?.enabled??!1)}onCanvasCleared=()=>{this.selector?.cancelSelect()}}class Bi{app;id=0;name;options;executed=!1;executeTime=new Date().getTime();constructor(t,e){this.app=t,this.name=this.constructor.name,this.options=e}toJSON(){return{id:this.id,name:this.name,options:this.options,executed:this.executed,executeTime:this.executeTime}}fromJSON(t){this.id=t.id,this.name=t.name,this.options=t.options,this.executed=t.executed,this.executeTime=t.executeTime}}class Cv extends Bi{constructor(t,e){super(t,e)}execute(){this.app._add(...this.options.nodes)}undo(){this.app._remove(...this.options.nodes)}}class xv extends Bi{constructor(t,e){super(t,e)}execute(){this.app._remove(...this.options.nodes)}undo(){this.app._add(...this.options.nodes)}}class Tv extends Bi{constructor(t,e){super(t,e)}execute(){this.app._update(...this.options.newNodes)}undo(){this.app._update(...this.options.oldNodes)}}class Ev extends Bi{constructor(t,e){super(t,e)}execute(){this.options.nodes.forEach(({node:t,newZIndex:e})=>{t.setZIndex(e)})}undo(){this.options.nodes.forEach(({node:t,oldZIndex:e})=>{t.setZIndex(e)})}}class kv extends Bi{constructor(t,e){super(t,e)}execute(){this.app._makeGroup(this.options.nodes)}undo(){this.app._decomposeGroup(this.options.group)}}class Av extends Bi{constructor(t,e){super(t,e)}execute(){this.app._decomposeGroup(this.options.group)}undo(){this.app._makeGroup(this.options.nodes)}}class ed{name="history";app;enabled;stackSize;undoStack=[];redoStack=[];idCounter=0;constructor(t,e){const{enabled:n,stackSize:r}=e;this.app=t,this.enabled=n,this.stackSize=r}execute(t,e){this.undoStack.length>this.stackSize&&this.undoStack.shift(),this.undoStack.push(t),t.id=++this.idCounter,e&&t.execute(),t.executed=!0,t.executeTime=new Date().getTime(),this.redoStack=[],this.app.emit("stackChanged",this.undoStack,this.redoStack)}undo(t=1){if(!this.enabled)return;let e;for(;t;)this.undoStack.length>0&&(e=this.undoStack.pop(),e&&(e.undo(),this.redoStack.push(e),this.app.emit("stackChanged",this.undoStack,this.redoStack))),--t;return this.app.emit("historyUndo",t,e?.toJSON()),e}redo(t=1){if(!this.enabled)return;let e;for(;t;)this.redoStack.length>0&&(e=this.redoStack.pop(),e&&(e.execute(),this.undoStack.push(e),this.app.emit("stackChanged",this.undoStack,this.redoStack))),--t;return this.app.emit("historyRedo",t,e?.toJSON()),e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}jump(t){if(!this.enabled)return;let e=this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0;if(e===void 0||t>e.id)for(e=this.redo();e!==void 0&&t>e.id;)e=this.redo();else for(;e=this.undoStack[this.undoStack.length-1],!(e===void 0||t===e.id);)this.undo();this.app.emit("stackChanged",this.undoStack,this.redoStack)}destroy(){this.undoStack=[],this.redoStack=[],this.app.emit("stackChanged",this.undoStack,this.redoStack)}}class Pv{name="historyPlugin";history;app;options;keyFns=[];oldNodes=[];constructor(t){this.options={enabled:!0,stackSize:100,...t}}install(t){this.app=t,this.history=new ed(t,this.options),this.history.app=t,this.app.on("nodeAdded",this.onNodeAdded),this.app.on("nodeRemoved",this.onNodeRemove),this.app.on("nodeUpdateBefore",this.onNodeUpdateBefore),this.app.on("nodeZindexChanged",this.onNodeZIndexChanged),this.app.on("nodeGroupMake",this.onMakeGroup),this.app.on("nodeGroupDecompose",this.onDecomposeGroup),this.app.on("nodeUpdated",this.onNodeUpdated),this.app.undo=function(e=1){const n=this.app.getPlugin("historyPlugin");return n&&n.history?.undo(e),this},this.app.redo=function(e=1){const n=this.app.getPlugin("historyPlugin");return n&&n.history?.redo(e),this},this.app.canUndo=function(){const e=this.app.getPlugin("historyPlugin");return e?e.history?.canUndo()??!1:!1},this.app.canRedo=function(){const e=this.app.getPlugin("historyPlugin");return e?e.history?.canRedo()??!1:!1},this.app.jump=function(e){const n=this.app.getPlugin("historyPlugin");return n&&n.history?.jump(e),this},this.keyFns.push(this.app.domKey.on({key:"z",title:"撤销",exact:!0,ctrl:!0},()=>{this.app?.undo()})),this.keyFns.push(this.app.domKey.on({key:"y",title:"重做",exact:!0,ctrl:!0},()=>{this.app?.redo()})),this.app.emit("historyInstalled",this)}destroy(){this.keyFns.forEach(t=>t.removeListener?.()),this.keyFns=[],this.history?.destroy(),this.app?.off("nodeAdded",this.onNodeAdded),this.app?.off("nodeRemoved",this.onNodeRemove),this.app?.off("nodeUpdateBefore",this.onNodeUpdateBefore),this.app?.off("nodeUpdated",this.onNodeUpdated),this.app?.off("nodeGroupMake",this.onMakeGroup),this.app?.off("nodeGroupDecompose",this.onDecomposeGroup),this.app?.emit("historyDestroy",this)}enable(){this.history&&(this.options.enabled=!0,this.history.enabled=!0)}disable(){this.history&&(this.options.enabled=!1,this.history.enabled=!1)}isEnabled(){return this.options.enabled&&(this.history?.enabled??!1)}onNodeAdded=t=>{!this.app||!this.history||this.history.execute(new Cv(this.app,{nodes:t}))};onNodeRemove=t=>{!this.app||!this.history||this.history.execute(new xv(this.app,{nodes:t}))};onNodeUpdateBefore=t=>{this.oldNodes=t.map(e=>e.toObject())};onNodeUpdated=t=>{!this.app||!this.history||this.history.execute(new Tv(this.app,{oldNodes:this.oldNodes,newNodes:t.map(e=>e.toObject())}))};onNodeZIndexChanged=t=>{!this.app||!this.history||this.history.execute(new Ev(this.app,{nodes:t}))};onMakeGroup=(t,e)=>{!this.app||!this.history||this.history.execute(new kv(this.app,{nodes:e,group:t}))};onDecomposeGroup=(t,e)=>{!this.app||!this.history||this.history.execute(new Av(this.app,{nodes:e,group:t}))}}class Mv{name="diamondTool";hooks;config;diamond=null;startPointer=new pt(0,0);constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.diamond||(this.startPointer.clone(t.pointer),this.diamond=new U.RegularPolygon({sides:4,radius:0,strokeScaleEnabled:!1,...this.config}),this.diamond.setPosition(this.startPointer),t.add(this.diamond),this.hooks?.onStartDrawing?.(t,this.diamond))}mousemove({app:t}){if(!this.diamond)return;const e=t.pointer.x-this.startPointer.x,n=t.pointer.y-this.startPointer.y,r=new pt(this.startPointer.x+e/2,this.startPointer.y+n/2);this.diamond.setPosition(r),this.diamond.radius(r.distanceTo(t.pointer)),t.render()}mouseup({app:t,pointer:e}){if(this.diamond){if(this.startPointer.eq(e)){this.diamond?.destroy(),this.diamond=null;return}this.hooks?.onCompleteDrawing?.(t,this.diamond),this.diamond=null,this.startPointer.setXY(0,0)}}enableChanged(){this.diamond=null,this.startPointer.setXY(0,0)}}class Rv{name="drawingTool";config;hooks;line=null;points=[];constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){const e=this.points.at(-1);(!e||!e.eq(t.pointer))&&this.points.push(t.pointer),!this.line&&(this.line=new U.Line({points:Gi(this.points),globalCompositeOperation:"source-over",lineCap:"round",lineJoin:"round",strokeScaleEnabled:!1,hitStrokeWidth:20,...this.config}),t.add(this.line),this.hooks?.onStartDrawing?.(t,this.line))}mousemove({app:t,event:e}){this.line&&(e.evt.stopPropagation(),this.points.push(t.pointer),this.line.points(Gi(this.points)))}mouseup({app:t,pointer:e}){if(!this.line)return;const n=this.points.at(-1);this.points.length<=6&&n&&e.distanceTo(n)<10&&this.line&&this.line.destroy(),this.hooks?.onCompleteDrawing?.(t,this.line),this.line=null,this.points=[]}enableChanged(){this.line=null,this.points=[]}}class Dv{name="ellipseTool";config;hooks;ellipse=null;startPointer=new pt(0,0);constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.ellipse||(this.startPointer.clone(t.pointer),this.ellipse=new U.Ellipse({radiusX:0,radiusY:0,strokeScaleEnabled:!1,...this.config}),this.ellipse.setPosition(this.startPointer),this.ellipse.radius(new pt(0,0)),t.add(this.ellipse))}mousemove({app:t}){if(!this.ellipse)return;const e=t.pointer.x-this.startPointer.x,n=t.pointer.y-this.startPointer.y,r=new pt(Math.abs(e)/2,Math.abs(n)/2);this.ellipse.setPosition(new pt(this.startPointer.x+e/2,this.startPointer.y+n/2)),this.ellipse.radius(r),t.render()}mouseup({app:t,pointer:e}){if(this.ellipse){if(this.startPointer.eq(e)){this.ellipse?.destroy(),this.ellipse=null;return}this.hooks?.onCompleteDrawing?.(t,this.ellipse),this.ellipse=null,this.startPointer.setXY(0,0)}}enableChanged(){this.ellipse=null,this.startPointer.setXY(0,0)}}class Lv{name="imageTool";config;hooks;image=null;isAdded=!1;imageElement=new Image;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.image&&(this.image.opacity(1),this.hooks?.onCompleteDrawing?.(t,this.image),this.image=null)}mousemove({app:t,pointer:e}){if(this.isAdded||(this.image=new U.Image({strokeScaleEnabled:!1,image:this.imageElement,...this.config}),this.image.opacity(.5),this.image.image(this.imageElement),t.add(this.image),this.isAdded=!0),!this.image)return;const n=200,r=n*((this.imageElement.height??1)/(this.imageElement.width??1));this.image.width(n),this.image.height(r),this.image.position(new pt(e.x-n/2,e.y-r/2)),t.render()}enableChanged(){this.image=null,this.imageElement=new Image}}class Ov{name="lineTool";config;hooks;points=[];line=null;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.line||(this.line=new U.Line({points:Gi(this.points),fill:"transparent",strokeScaleEnabled:!1,hitStrokeWidth:20,...this.config}),t.add(this.line),this.hooks?.onStartDrawing?.(t,this.line));const e=this.points.at(-1);(!e||!e.eq(t.pointer))&&this.points.push(t.pointer),this.line.points(Gi(this.points))}mousemove({app:t,pointer:e}){this.line&&(this.line.points(Gi(this.points).concat(e.x,e.y)),t.render())}doubleClick({app:t}){this.line&&(this.hooks?.onCompleteDrawing?.(t,this.line),this.line=null,this.points=[])}enableChanged(){this.line=null,this.points=[]}}class Iv{name="rectTool";config;hooks;startPointer=new pt(0,0);rectangle=null;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.rectangle||(this.startPointer.clone(t.pointer),this.rectangle=new U.Rect({strokeScaleEnabled:!1,...this.config}),this.rectangle.setPosition(this.startPointer),this.rectangle.width(0),this.rectangle.height(0),t.add(this.rectangle),this.hooks?.onStartDrawing?.(t,this.rectangle))}mousemove({app:t}){this.rectangle&&(this.rectangle.setPosition(new pt(Math.min(this.startPointer.x,t.pointer.x),Math.min(this.startPointer.y,t.pointer.y))),this.rectangle.width(Math.abs(t.pointer.x-this.startPointer.x)),this.rectangle.height(Math.abs(t.pointer.y-this.startPointer.y)),t.render())}mouseup({app:t,pointer:e}){if(this.rectangle){if(this.startPointer.eq(e)){this.rectangle?.destroy(),this.rectangle=null;return}this.hooks?.onCompleteDrawing?.(t,this.rectangle),this.rectangle=null,this.startPointer.setXY(0,0)}}enableChanged(){this.rectangle=null,this.startPointer.setXY(0,0)}}class Fv{name="selectTool";hooks;constructor(t){this.hooks=t.hooks}}const Nv=(i,t,e)=>{t.hide();const n=t.absolutePosition(),r={x:i.stage.container().offsetLeft+n.x,y:i.stage.container().offsetTop+n.y},s=document.createElement("textarea");document.body.appendChild(s),s.value=t.text(),s.style.position="absolute",s.style.top=r.y+"px",s.style.left=r.x+"px",s.style.width=t.width()*t.scaleX()-t.padding()*2+"px",s.style.height=t.height()*t.scaleX()-t.padding()*2+5+"px",s.style.fontSize=t.fontSize()*t.scaleX()+"px",s.style.border="none",s.style.padding="0px",s.style.margin="0px",s.style.overflow="hidden",s.style.background="none",s.style.outline="none",s.style.resize="none",s.style.lineHeight=t.lineHeight().toString(),s.style.fontFamily=t.fontFamily(),s.style.transformOrigin="left top",s.style.textAlign=t.align(),s.style.color=t.stroke(),s.style.caretColor=t.stroke();const a=t.rotation();let o="";a&&(o+="rotateZ("+a+"deg)");let h=0;navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&(h+=2+Math.round(t.fontSize()/20)),o+="translateY(-"+h+"px)",s.style.transform=o,s.style.height=s.scrollHeight+3+"px",s.focus();function c(){s.parentNode?.removeChild(s),window.removeEventListener("click",f),t.show()}function d(u){u=Math.max(s.value.length*t.fontSize(),u);const g=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),p=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;(g||p)&&(u=Math.ceil(u)),(document.DOCUMENT_NODE||/Edge/.test(navigator.userAgent))&&(u+=1),s.style.width=u+"px"}s.addEventListener("keydown",function(u){u.key==="Enter"&&!u.shiftKey&&(s.value.trim().length>=1?t.text(s.value.charAt(0)===" "?s.value.substring(1):s.value):i.remove(t),c(),e()),u.key==="Escape"&&c()}),s.addEventListener("keydown",function(){const u=t.getAbsoluteScale().x;d(t.width()*u),s.style.height="auto",s.style.height=s.scrollHeight+t.fontSize()+"px"});function f(u){u.target!==s&&(t.text(s.value),c())}setTimeout(()=>{window.addEventListener("click",f)})};class Uv{name="textTool";config;hooks;textNode=null;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}doubleClick({app:t,pointer:e}){this.textNode=new U.Text({...this.config,text:" ",x:e.x,y:e.y,fontFamily:"JiaYouYa"}),this.textNode.on("dblclick",({target:n})=>{Nv(t,n,()=>{this.hooks?.onCompleteDrawing?.(t,n)})}),t.add(this.textNode),this.textNode.fire("dblclick")}enableChanged(){this.textNode=null}}class Gv{name="eraserTool";hooks;targetMap=new Map;isEraser=!1;constructor(t){this.hooks=t.hooks}mousedown({event:t}){this.isEraser=!0,!(t.target instanceof U.Stage)&&(this.targetMap.set(t.target.id(),{node:t.target,opacity:t.target.attrs.opacity}),t.target.opacity(.3))}mouseup({app:t}){this.targetMap.size&&(t.remove(...[...this.targetMap.values()].map(({node:e,opacity:n})=>(e.opacity(n),e))),this.targetMap.clear(),this.isEraser=!1)}mousemove({event:t}){!this.isEraser||t.target instanceof U.Stage||this.targetMap.get(t.target.id())||(this.targetMap.set(t.target.id(),{node:t.target,opacity:t.target.attrs.opacity}),t.target.opacity(.3))}enableChanged(){this.targetMap.clear(),this.isEraser=!1}}const id={backgroundColor:"#ffffff",scale:{min:.05,max:5},panning:{enabled:!1,cursor:"grabbing"},mousewheel:{enabled:!1,factor:.1}};class Bv extends Wf{stage;mainLayer;config;domKey=new Zn;mouse;tooler;installedPlugins=new Map;resizeObserver;constructor(t){super(),this.config={...id,...t},this.stage=new U.Stage({container:document.createElement("div"),width:500,height:500}),this.stage.container().style.backgroundColor=this.config.backgroundColor,this.mainLayer=new U.Layer,this.mainLayer.name("main:layer"),this.stage.add(this.mainLayer),this.tooler=new _v(this),this.mouse=new mv(this),this.resizeObserver=new ResizeObserver(e=>{const{width:n,height:r}=e[0].contentRect;this.stage.width(n),this.stage.height(r),this.emit("resizeRoot",n,r),this.render()}),this.triggerPanning(this.config.panning.enabled),this.triggerMouseWheel(this.config.mousewheel.enabled),this.registerKeyFns()}registerKeyFns(){this.domKey.on({key:"o",title:"打开",exact:!0,ctrl:!0},()=>{Cl().then(t=>Ws(t[0])).then(t=>{this.fromJSON(t)})}),this.domKey.on({key:"e",title:"导出图片",exact:!0,ctrl:!0,shift:!0},()=>{}),this.domKey.on({key:"[",title:"下移一层",exact:!0,ctrl:!0},()=>{}),this.domKey.on({key:"]",title:"上移一层",exact:!0,ctrl:!0},()=>{}),this.domKey.on({key:"[",title:"置于底层",exact:!0,ctrl:!0,shift:!0},()=>{}),this.domKey.on({key:"]",title:"置于顶层",exact:!0,ctrl:!0,shift:!0},()=>{}),this.domKey.on({key:["delete","backspace"],title:"删除"},()=>{console.log("删除")}),this.domKey.on({key:"r",title:"重置画布",exact:!0,ctrl:!0},()=>{}),this.domKey.on({key:" ",title:"移动画布"},()=>(console.log("移动画布"),this.triggerPanning(!0),()=>{this.triggerPanning(!1)})),this.domKey.on({key:["Control","Meta"],title:"缩放画布"},()=>(this.triggerMouseWheel(!0),()=>{this.triggerMouseWheel(!1)})),this.domKey.on({key:"j",title:"解除组合",ctrl:!0,shift:!0,exact:!0},()=>{})}get pointer(){const{x:t,y:e}=this.stage.getRelativePointerPosition()??{x:0,y:0};return new pt(t,e)}get curTool(){return this.tooler.currentTool}get containerElement(){return this.stage.container()}mount(t){this.stage.container(t),this.resizeObserver.observe(this.stage.container())}async setTool(t){await this.tooler.setTool(t)}triggerPanning(t){return t===void 0?this.stage.draggable(this.stage.draggable()):this.stage.draggable(t),this.stage.draggable()?this.stage.container().style.cursor=this.config.panning.cursor??"grabbing":this.stage.container().style.cursor="default",this}triggerMouseWheel(t){return t===void 0?this.config.mousewheel.enabled=!this.config.mousewheel.enabled:this.config.mousewheel.enabled=t,this}triggerTool(t){return this.tooler.trigger(t),this}add(...t){return this._add(...t),this.emit("nodeAdded",t),this}_add(...t){return this.mainLayer.add(...t.map(e=>(e.attrs.id||e.id(`#${rd()}`),e))),this.render(),this}remove(...t){return this._remove(...t),this.emit("nodeRemoved",t),this}_remove(...t){return t.forEach(e=>{e.remove()}),this.render(),this}update(...t){const e=n=>n.reduce((r,s)=>{const a=this.getNodeById(s.attrs.id);return a&&r.push(a),r},[]);return this.emit("nodeUpdateBefore",e(t)),this._update(...t),this.emit("nodeUpdated",e(t)),this}_update(...t){return t.forEach(e=>{this.getNodeById(e.attrs.id)?.setAttrs(e.attrs)}),this.render(),this}makeGroup(t){const e=this._makeGroup(t);return e instanceof U.Group&&this.emit("nodeGroupMake",e,t),e}_makeGroup(t){if(t.length<2)return t;const e=new U.Group({draggable:!0});return e.add(...t.map(n=>(n.draggable(!1),n))),this._add(e),e}decomposeGroup(t){const e=this._decomposeGroup(t);return this.emit("nodeGroupDecompose",t,e),e}_decomposeGroup(t){const e=t.getParent()??this.mainLayer,n=[...t.getChildren()].map(r=>{const{x:s,y:a,scaleX:o,scaleY:h,skewX:l,skewY:c,rotation:d}=r.getTransform().decompose();return r.moveTo(e),r.x(s),r.y(a),r.scaleX(o),r.scaleY(h),r.skewX(l),r.skewY(c),r.rotation(d),r});return this._remove(t),n}findTopGroup(t){return t.parent instanceof U.Group&&t.parent.parent instanceof U.Group?this.findTopGroup(t.parent):t.parent instanceof U.Group?t.parent:null}moveUp(...t){return this.moveZIndexNodes(t,e=>e.moveUp()),this}moveDown(...t){return this.moveZIndexNodes(t,e=>e.moveDown()),this}moveTop(...t){return this.moveZIndexNodes(t,e=>e.moveToTop()),this}moveBottom(...t){return t.forEach(e=>e.moveToBottom()),this.moveZIndexNodes(t,e=>e.moveToBottom()),this}moveZIndexNodes(t,e){const n=t.map(r=>{const s={node:r,oldZIndex:r.getZIndex(),newZIndex:r.getZIndex()};return e(r),s.newZIndex=r.getZIndex(),s});n.some(({oldZIndex:r,newZIndex:s})=>r!==s)&&this.emit("nodeZindexChanged",n)}getNodeById(t){return this.getNodes(e=>e.id()===t)?.[0]}getNodes(t){return this.mainLayer.find(t)??[]}isPointInArea(t,e){const{width:n,height:r,x:s,y:a}=e;return t.x>=s&&t.x<=s+n&&t.y>=a&&t.y<=a+r}getShapesInArea(t){return this.mainLayer.getChildren(e=>e.visible()&&e!==t&&this.haveIntersection(t,e))}haveIntersection(t,e){const n=t.getClientRect({relativeTo:this.stage}),r=e.getClientRect({relativeTo:this.stage}),s=n.x<=r.x&&n.y<=r.y,a=n.x+n.width>=r.x+r.width&&n.y<=r.y,o=n.x<=r.x&&n.y+n.height>=r.y+r.height,h=n.x+n.width>=r.x+r.width&&n.y+n.height>=r.y+r.height;return s&&a&&o&&h}render(){this.mainLayer.draw()}scale(){return this.stage.scaleX()}scaleTo(t,e=new pt(0,0)){const n=this.scale();this.emit("canvasZoomStart",n);const r=Math.min(Math.max(t,this.config.scale.min),this.config.scale.max),s=new pt((e.x-this.stage.x())/n,(e.y-this.stage.y())/n);return this.stage.scale({x:r,y:r}),this.stage.position({x:e.x-s.x*r,y:e.y-s.y*r}),this.emit("canvasZoomEnd",this.scale()),this}clear(){this.mainLayer.removeChildren(),this.emit("canvasCleared"),this.render()}async toDataURL(t,e){const{padding:n=10,pixelRatio:r=2,mimeType:s="image/png",quality:a=1,haveBackground:o=!1}=e??{},h=new U.Layer;this.stage.add(h);let l=[];t&&t.length>0?l=t.map(S=>S.toObject()):l=this.mainLayer.children?.map(S=>S.toObject())??[];const c=l.map(S=>U.Node.create(S));h.add(...c);const d=new U.Transformer({rotateAnchorOffset:0});d.nodes(c);const f=d.getClientRect(),u=this.stage.scaleX(),g=this.stage.scaleY(),p=this.stage.x(),_=this.stage.y(),y=f.width+n*2,b=f.height+n*2,m=f.x-n,v=f.y-n,w=new U.Rect({width:y,height:b,x:(m-p)/u,y:(v-_)/g,fill:this.stage.container().style.backgroundColor});return o&&(h.add(w),w.moveToBottom()),new Promise((S,k)=>{try{h.toDataURL({width:y,height:b,x:m,y:v,pixelRatio:r,mimeType:s,quality:a,callback:C=>{S({dataURL:C,width:y,height:b}),d.remove(),h.remove()}})}catch(C){k(C)}})}toJSON(){return JSON.stringify(this.mainLayer.toObject())}fromJSON(t){this.clear(),this.mainLayer.remove();const e=U.Node.create(t,"layer");return this.mainLayer=e,this.stage.add(this.mainLayer),this.render(),this}use(t,...e){return this.installedPlugins.has(t.name)||(this.installedPlugins.set(t.name,t),t.install(this,...e)),this}getPlugin(t){return this.installedPlugins.get(t)}getPlugins(t){return t.map(e=>this.getPlugin(e))}enablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(n=>n?.enable?.()),this}disablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(n=>n?.disable?.()),this}isPluginEnable(t){return this.getPlugin(t)?.isEnabled?.()??!1}destroyPlugins(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(n=>n?.destroy()),this}destroy(){this.resizeObserver.disconnect(),this.destroyPlugins(Array.from(this.installedPlugins.keys())),this.mouse.destroy(),this.tooler.destroy(),this.stage.destroy(),this.removeAllListeners()}}return E.$=vt,E.AlignmentPlugin=bv,E.Arrow=Fm,E.Ball=Nm,E.Ball3d=Um,E.Box=Gm,E.C2S=Mm,E.CanvasWrap=qm,E.DEFAULT_APP_CONFIG=id,E.DOMEvent=a1,E.DOMKey=Zn,E.DOMMedia=s1,E.DOMMouse=Zs,E.DOMQuery=kt,E.DOMScroll=o1,E.DOMUtil=t1,E.Dep=wc,E.DiamondTool=Mv,E.DrawingTool=Rv,E.EllipseTool=Dv,E.EraserTool=Gv,E.History=ed,E.HistoryPlugin=Pv,E.ImageTool=Lv,E.KonvaApp=Bv,E.Light=Bm,E.Line=zm,E.LineTool=Ov,E.Matrix=ce,E.Point=pt,E.Point3d=Hm,E.Polygon=rm,E.QRCode=Re,E.Query=ot,E.Rect=Ia,E.RectTool=Iv,E.Segment=Wm,E.SelectTool=Fv,E.Selector=td,E.SelectorPlugin=Sv,E.Ship=jm,E.Slider=Vm,E.SvgPath=Em,E.TWEEN=dm,E.TextTool=Uv,E.Tree=Ym,E.Triangle=$m,E.TriangleLight=Xm,E.Vector=fr,E.VideoUtil=xn,E.WebGLRenderer=Zm,E.WebRTCClient=Km,E.WebSocket=Zi,E.addWatermark=Np,E.ajax=$p,E.angle2radian=im,E.animateCanvas=l1,E.animateInWeb=Bl,E.appendUrlSearch=Ks,E.base64URLDecode=T0,E.base64URLEncode=x0,E.blobToRawImage=hp,E.changeBrightness=Ip,E.changeDiaphaneity=Fp,E.changeSize=Op,E.clearCookies=r1,E.clickEvent=J0,E.compileTemplate=Z0,E.compression=Gp,E.copyToClipboard=N0,E.createXMLHttpRequest=yc,E.cssTransition=h1,E.dom=F0,E.dquery=Gl,E.drawQRCodeToCanvas=jp,E.drawSpirograph=Dm,E.drawStar=Lm,E.dynamicStrokeLine=Om,E.encodeHTML=K0,E.fileOrBlobToDataURL=Ra,E.fileToArrayBufferPromise=xl,E.flatPoints=Gi,E.flipSideToSide=up,E.flipUpsideDown=dp,E.formDataToSearch=Ul,E.getBrowserClient=c0,E.getBrowserClientVersion=u0,E.getBrowserLanguage=f0,E.getCanvasImageData=Ma,E.getCanvasImageDataByBitmap=sp,E.getCanvasImageDataByVideo=rp,E.getCookie=i1,E.getCookieObject=n1,E.getDocumentElement=qs,E.getElementLeftInPage=Pl,E.getElementPositionInPage=Al,E.getElementPositionInPage2=a0,E.getElementPositionInViewport=o0,E.getElementTopInPage=Ml,E.getFileExtensionFromFile=Tl,E.getFileTypeFromFile=Jf,E.getFilesImageInfo=np,E.getFixedWidthText=W0,E.getFormElementData=Vp,E.getGroupCoords=pv,E.getImageDataByAIData=Bp,E.getImageMainColor=cp,E.getInternetExplorerVersion=Il,E.getMiddleValue=gv,E.getMouseButton=Q0,E.getMousePositionInElement=Kn,E.getMousePositionInPage=Rl,E.getMousePositionInViewport=l0,E.getOperatingSystem=Ve,E.getOperatingSystemVersion=h0,E.getPageClient=qn,E.getPageScroll=pi,E.getPageSize=n0,E.getRawImageInfo=Pa,E.getScrollParent=t5,E.getSelectedText=U0,E.getTextWidth=Y0,E.getTimeZone=g0,E.getURL=Nl,E.getUserGeolocationPromise=d0,E.getViewportSize=Ji,E.gifImage=gc,E.h=i0,E.handleDragAndDropFiles=t0,E.handleHashChange=O0,E.handleHistoryChange=I0,E.handleInputFiles=Qf,E.handleURLChange=L0,E.hasDocument=b0,E.hasHistory=w0,E.hasWindow=Fl,E.hexStr2num=dr,E.hexStr2rgbStr=Oa,E.hsv2rgb=tm,E.htmlElementToBlob=Kf,E.htmlIncodeOrDecode=q0,E.ifWebFileHasChanged=Xp,E.imageDataToBitmap=ap,E.imageDataToBlob=lp,E.imageDataToDataURL=op,E.isAndroid=Ol,E.isAppleDevice=p0,E.isBrowserSupportFileAPI=S0,E.isDarkMode=v0,E.isElementFocus=G0,E.isElementInViewport=s0,E.isElementInViewportSimple=r0,E.isIE=y0,E.isIOS=Dl,E.isMacOS=Ll,E.isMobile=m0,E.isTabInView=z0,E.isURL=A0,E.isWechat=_0,E.jpgToPng=Mp,E.lazyloadImages=$0,E.leftRotate=fp,E.linkExport=Zf,E.localstorage=Js,E.marginSharpen=Pp,E.microTask=e0,E.mosaic=Up,E.mount=Ki,E.navigateBack=j0,E.navigateBack2=V0,E.num2HexStr=Sc,E.num2rgbStr=Cc,E.outputGifBase64=pc,E.outputQRCodeBase64=Hp,E.parseURL=E0,E.parseUrlParams=k0,E.patch=El,E.patchDOM=kl,E.pngToJpg=Rp,E.qrDecompose=Zu,E.query=vt,E.radian2angle=nm,E.radiusClip=Lp,E.randomColorHexStr=Zp,E.randomColorHexStr2=Jp,E.randomColorNumber=Kp,E.reactiveVue2=Wp,E.reactiveVue3=qp,E.readFileInBrowser=Ws,E.recordToSearch=P0,E.recordToSearch2=M0,E.rectClip=Dp,E.rgb2hsv=em,E.rgbStr2hexStr=Qp,E.rightRotate=gp,E.rotate=De,E.roundedRect=Rm,E.scrollTo=H0,E.searchToRecord=R0,E.searchToRecord2=D0,E.selectFileInBrowser=Cl,E.setCookie=e1,E.setRem=C0,E.shapeArrayEqual=Ku,E.sharpen=Ap,E.siblings=B0,E.smileFace=Im,E.stringToBlob=wl,E.stringToXml=qf,E.toBlackAndWhite=_p,E.toBlue=wp,E.toBlueAndGreen=xp,E.toBlueAndGrey=kp,E.toGreen=bp,E.toGreenAndGrey=Ep,E.toGrey=pp,E.toGrey2=mp,E.toOpposite=vp,E.toRed=yp,E.toRedAndBlue=Cp,E.toRedAndGreen=Sp,E.toRedAndGrey=Tp,E.waitForStyleSheetsLoaded=X0,E.watchEffect=Yp,E.xmlToString=Sl,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"}),E}({});
|
|
33
|
+
${t.sdp}.`),this.remotePeerConnection&&(this.trace("remotePeerConnection setLocalDescription start."),this.remotePeerConnection.setLocalDescription(t).then(()=>{this.setLocalDescriptionSuccess(this.remotePeerConnection)}).catch(e=>this.setSessionDescriptionError(e))),this.localPeerConnection&&(this.trace("localPeerConnection setRemoteDescription start."),this.localPeerConnection.setRemoteDescription(t).then(()=>{this.setRemoteDescriptionSuccess(this.localPeerConnection)}).catch(e=>this.setSessionDescriptionError(e)))}setSessionDescriptionError(t){this.trace(`Failed to create session description: ${t.toString()}.`)}setDescriptionSuccess(t,e){const n=this.getPeerName(t);this.trace(`${n} ${e} complete.`)}setLocalDescriptionSuccess(t){this.setDescriptionSuccess(t,"setLocalDescription")}setRemoteDescriptionSuccess(t){this.setDescriptionSuccess(t,"setRemoteDescription")}trace(t){t=t.trim();const e=(window.performance.now()/1e3).toFixed(3);console.log(e,t);const n=document.createElement("div");n.innerHTML=`<div>${e}, ${t}</div>`,document.getElementById("trace")?.appendChild(n)}getOtherPeer(t){return t===this.localPeerConnection?this.remotePeerConnection:this.localPeerConnection}getPeerName(t){return t===this.localPeerConnection?"localPeerConnection":"remotePeerConnection"}}class Uy{canvas;gl;constructor(t){this.canvas=t;const e={alpha:!0,premultipliedAlpha:!1};if(this.gl=this.canvas.getContext("webgl",e),!this.gl)throw new Error("WebGL failed to initialize.")}}function Zf(i,t){return!i||i.parentElement===null?t:Zf(i.parentElement,t.concat([i]))}const Pl=function(i,t){return getComputedStyle(i,null).getPropertyValue(t)},By=function(i){return Pl(i,"overflow")+Pl(i,"overflow-y")+Pl(i,"overflow-x")},Gy=function(i){return/(auto|scroll)/.test(By(i))};function $y(i){if(!(i instanceof HTMLElement||i instanceof SVGElement))return;const t=Zf(i.parentElement,[]);for(let e=0;e<t.length;e+=1)if(Gy(t[e]))return t[e];return document.scrollingElement||document.documentElement}var Ml={exports:{}},zr={},Rl={},Ll={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i._registerNode=i.Konva=i.glob=void 0;const t=Math.PI/180;function e(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}i.glob=typeof Bo<"u"?Bo:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},i.Konva={_global:i.glob,version:"9.2.2",isBrowser:e(),isUnminified:/param/.test(function(r){}.toString()),dblClickWindow:400,getAngle(r){return i.Konva.angleDeg?r*t:r},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return i.Konva.DD.isDragging},isDragReady(){return!!i.Konva.DD.node},releaseCanvasOnDestroy:!0,document:i.glob.document,_injectGlobal(r){i.glob.Konva=r}};const n=r=>{i.Konva[r.prototype.getClassName()]=r};i._registerNode=n,i.Konva._injectGlobal(i.Konva)})(Ll);const Ot=St(xt({__proto__:null,default:Ee(Ll)},[Ll]));var Dl={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Util=i.Transform=void 0;const t=Ot;class e{constructor(w=[1,0,0,1,0,0]){this.dirty=!1,this.m=w&&w.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(){return new e(this.m)}copyInto(w){w.m[0]=this.m[0],w.m[1]=this.m[1],w.m[2]=this.m[2],w.m[3]=this.m[3],w.m[4]=this.m[4],w.m[5]=this.m[5]}point(w){var k=this.m;return{x:k[0]*w.x+k[2]*w.y+k[4],y:k[1]*w.x+k[3]*w.y+k[5]}}translate(w,k){return this.m[4]+=this.m[0]*w+this.m[2]*k,this.m[5]+=this.m[1]*w+this.m[3]*k,this}scale(w,k){return this.m[0]*=w,this.m[1]*=w,this.m[2]*=k,this.m[3]*=k,this}rotate(w){var k=Math.cos(w),A=Math.sin(w),R=this.m[0]*k+this.m[2]*A,P=this.m[1]*k+this.m[3]*A,U=this.m[0]*-A+this.m[2]*k,I=this.m[1]*-A+this.m[3]*k;return this.m[0]=R,this.m[1]=P,this.m[2]=U,this.m[3]=I,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(w,k){var A=this.m[0]+this.m[2]*k,R=this.m[1]+this.m[3]*k,P=this.m[2]+this.m[0]*w,U=this.m[3]+this.m[1]*w;return this.m[0]=A,this.m[1]=R,this.m[2]=P,this.m[3]=U,this}multiply(w){var k=this.m[0]*w.m[0]+this.m[2]*w.m[1],A=this.m[1]*w.m[0]+this.m[3]*w.m[1],R=this.m[0]*w.m[2]+this.m[2]*w.m[3],P=this.m[1]*w.m[2]+this.m[3]*w.m[3],U=this.m[0]*w.m[4]+this.m[2]*w.m[5]+this.m[4],I=this.m[1]*w.m[4]+this.m[3]*w.m[5]+this.m[5];return this.m[0]=k,this.m[1]=A,this.m[2]=R,this.m[3]=P,this.m[4]=U,this.m[5]=I,this}invert(){var w=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),k=this.m[3]*w,A=-this.m[1]*w,R=-this.m[2]*w,P=this.m[0]*w,U=w*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),I=w*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=k,this.m[1]=A,this.m[2]=R,this.m[3]=P,this.m[4]=U,this.m[5]=I,this}getMatrix(){return this.m}decompose(){var w=this.m[0],k=this.m[1],A=this.m[2],R=this.m[3],P=this.m[4],U=this.m[5],I=w*R-k*A;let N={x:P,y:U,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(w!=0||k!=0){var q=Math.sqrt(w*w+k*k);N.rotation=k>0?Math.acos(w/q):-Math.acos(w/q),N.scaleX=q,N.scaleY=I/q,N.skewX=(w*A+k*R)/I,N.skewY=0}else if(A!=0||R!=0){var W=Math.sqrt(A*A+R*R);N.rotation=Math.PI/2-(R>0?Math.acos(-A/W):-Math.acos(A/W)),N.scaleX=I/W,N.scaleY=W,N.skewX=0,N.skewY=(w*A+k*R)/I}return N.rotation=i.Util._getRotation(N.rotation),N}}i.Transform=e;var n="[object Array]",r="[object Number]",s="[object String]",a="[object Boolean]",o=Math.PI/180,l=180/Math.PI,h="#",c="",d="0",f="Konva warning: ",u="Konva error: ",p="rgb(",m={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,132,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,255,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,203],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:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,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,5]},y=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,S=[];const C=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(_){setTimeout(_,60)};i.Util={_isElement(_){return!!(_&&_.nodeType==1)},_isFunction(_){return!!(_&&_.constructor&&_.call&&_.apply)},_isPlainObject(_){return!!_&&_.constructor===Object},_isArray(_){return Object.prototype.toString.call(_)===n},_isNumber(_){return Object.prototype.toString.call(_)===r&&!isNaN(_)&&isFinite(_)},_isString(_){return Object.prototype.toString.call(_)===s},_isBoolean(_){return Object.prototype.toString.call(_)===a},isObject(_){return _ instanceof Object},isValidSelector(_){if(typeof _!="string")return!1;var w=_[0];return w==="#"||w==="."||w===w.toUpperCase()},_sign(_){return _===0||_>0?1:-1},requestAnimFrame(_){S.push(_),S.length===1&&C(function(){const w=S;S=[],w.forEach(function(k){k()})})},createCanvasElement(){var _=document.createElement("canvas");try{_.style=_.style||{}}catch{}return _},createImageElement(){return document.createElement("img")},_isInDocument(_){for(;_=_.parentNode;)if(_==document)return!0;return!1},_urlToImage(_,w){var k=i.Util.createImageElement();k.onload=function(){w(k)},k.src=_},_rgbToHex(_,w,k){return(16777216+(_<<16)+(w<<8)+k).toString(16).slice(1)},_hexToRgb(_){_=_.replace(h,c);var w=parseInt(_,16);return{r:w>>16&255,g:w>>8&255,b:w&255}},getRandomColor(){for(var _=(Math.random()*16777215<<0).toString(16);_.length<6;)_=d+_;return h+_},getRGB(_){var w;return _ in m?(w=m[_],{r:w[0],g:w[1],b:w[2]}):_[0]===h?this._hexToRgb(_.substring(1)):_.substr(0,4)===p?(w=y.exec(_.replace(/ /g,"")),{r:parseInt(w[1],10),g:parseInt(w[2],10),b:parseInt(w[3],10)}):{r:0,g:0,b:0}},colorToRGBA(_){return _=_||"black",i.Util._namedColorToRBA(_)||i.Util._hex3ColorToRGBA(_)||i.Util._hex4ColorToRGBA(_)||i.Util._hex6ColorToRGBA(_)||i.Util._hex8ColorToRGBA(_)||i.Util._rgbColorToRGBA(_)||i.Util._rgbaColorToRGBA(_)||i.Util._hslColorToRGBA(_)},_namedColorToRBA(_){var w=m[_.toLowerCase()];return w?{r:w[0],g:w[1],b:w[2],a:1}:null},_rgbColorToRGBA(_){if(_.indexOf("rgb(")===0){_=_.match(/rgb\(([^)]+)\)/)[1];var w=_.split(/ *, */).map(Number);return{r:w[0],g:w[1],b:w[2],a:1}}},_rgbaColorToRGBA(_){if(_.indexOf("rgba(")===0){_=_.match(/rgba\(([^)]+)\)/)[1];var w=_.split(/ *, */).map((k,A)=>k.slice(-1)==="%"?A===3?parseInt(k)/100:parseInt(k)/100*255:Number(k));return{r:w[0],g:w[1],b:w[2],a:w[3]}}},_hex8ColorToRGBA(_){if(_[0]==="#"&&_.length===9)return{r:parseInt(_.slice(1,3),16),g:parseInt(_.slice(3,5),16),b:parseInt(_.slice(5,7),16),a:parseInt(_.slice(7,9),16)/255}},_hex6ColorToRGBA(_){if(_[0]==="#"&&_.length===7)return{r:parseInt(_.slice(1,3),16),g:parseInt(_.slice(3,5),16),b:parseInt(_.slice(5,7),16),a:1}},_hex4ColorToRGBA(_){if(_[0]==="#"&&_.length===5)return{r:parseInt(_[1]+_[1],16),g:parseInt(_[2]+_[2],16),b:parseInt(_[3]+_[3],16),a:parseInt(_[4]+_[4],16)/255}},_hex3ColorToRGBA(_){if(_[0]==="#"&&_.length===4)return{r:parseInt(_[1]+_[1],16),g:parseInt(_[2]+_[2],16),b:parseInt(_[3]+_[3],16),a:1}},_hslColorToRGBA(_){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(_)){const[w,...k]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(_),A=Number(k[0])/360,R=Number(k[1])/100,P=Number(k[2])/100;let U,I,N;if(R===0)return N=P*255,{r:Math.round(N),g:Math.round(N),b:Math.round(N),a:1};P<.5?U=P*(1+R):U=P+R-P*R;const q=2*P-U,W=[0,0,0];for(let K=0;K<3;K++)I=A+.3333333333333333*-(K-1),I<0&&I++,I>1&&I--,6*I<1?N=q+(U-q)*6*I:2*I<1?N=U:3*I<2?N=q+(U-q)*(.6666666666666666-I)*6:N=q,W[K]=N*255;return{r:Math.round(W[0]),g:Math.round(W[1]),b:Math.round(W[2]),a:1}}},haveIntersection(_,w){return!(w.x>_.x+_.width||w.x+w.width<_.x||w.y>_.y+_.height||w.y+w.height<_.y)},cloneObject(_){var w={};for(var k in _)this._isPlainObject(_[k])?w[k]=this.cloneObject(_[k]):this._isArray(_[k])?w[k]=this.cloneArray(_[k]):w[k]=_[k];return w},cloneArray(_){return _.slice(0)},degToRad(_){return _*o},radToDeg(_){return _*l},_degToRad(_){return i.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),i.Util.degToRad(_)},_radToDeg(_){return i.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),i.Util.radToDeg(_)},_getRotation(_){return t.Konva.angleDeg?i.Util.radToDeg(_):_},_capitalize(_){return _.charAt(0).toUpperCase()+_.slice(1)},throw(_){throw new Error(u+_)},error(_){console.error(u+_)},warn(_){t.Konva.showWarnings&&console.warn(f+_)},each(_,w){for(var k in _)w(k,_[k])},_inRange(_,w,k){return w<=_&&_<k},_getProjectionToSegment(_,w,k,A,R,P){var U,I,N,q=(_-k)*(_-k)+(w-A)*(w-A);if(q==0)U=_,I=w,N=(R-k)*(R-k)+(P-A)*(P-A);else{var W=((R-_)*(k-_)+(P-w)*(A-w))/q;W<0?(U=_,I=w,N=(_-R)*(_-R)+(w-P)*(w-P)):W>1?(U=k,I=A,N=(k-R)*(k-R)+(A-P)*(A-P)):(U=_+W*(k-_),I=w+W*(A-w),N=(U-R)*(U-R)+(I-P)*(I-P))}return[U,I,N]},_getProjectionToLine(_,w,k){var A=i.Util.cloneObject(_),R=Number.MAX_VALUE;return w.forEach(function(P,U){if(!(!k&&U===w.length-1)){var I=w[(U+1)%w.length],N=i.Util._getProjectionToSegment(P.x,P.y,I.x,I.y,_.x,_.y),q=N[0],W=N[1],K=N[2];K<R&&(A.x=q,A.y=W,R=K)}}),A},_prepareArrayForTween(_,w,k){var A,R=[],P=[];if(_.length>w.length){var U=w;w=_,_=U}for(A=0;A<_.length;A+=2)R.push({x:_[A],y:_[A+1]});for(A=0;A<w.length;A+=2)P.push({x:w[A],y:w[A+1]});var I=[];return P.forEach(function(N){var q=i.Util._getProjectionToLine(N,R,k);I.push(q.x),I.push(q.y)}),I},_prepareToStringify(_){var w;_.visitedByCircularReferenceRemoval=!0;for(var k in _)if(_.hasOwnProperty(k)&&_[k]&&typeof _[k]=="object"){if(w=Object.getOwnPropertyDescriptor(_,k),_[k].visitedByCircularReferenceRemoval||i.Util._isElement(_[k]))if(w.configurable)delete _[k];else return null;else if(i.Util._prepareToStringify(_[k])===null)if(w.configurable)delete _[k];else return null}return delete _.visitedByCircularReferenceRemoval,_},_assign(_,w){for(var k in w)_[k]=w[k];return _},_getFirstPointerId(_){return _.touches?_.changedTouches[0].identifier:_.pointerId||999},releaseCanvas(..._){t.Konva.releaseCanvasOnDestroy&&_.forEach(w=>{w.width=0,w.height=0})},drawRoundedRectPath(_,w,k,A){let R=0,P=0,U=0,I=0;typeof A=="number"?R=P=U=I=Math.min(A,w/2,k/2):(R=Math.min(A[0]||0,w/2,k/2),P=Math.min(A[1]||0,w/2,k/2),I=Math.min(A[2]||0,w/2,k/2),U=Math.min(A[3]||0,w/2,k/2)),_.moveTo(R,0),_.lineTo(w-P,0),_.arc(w-P,P,P,Math.PI*3/2,0,!1),_.lineTo(w,k-I),_.arc(w-I,k-I,I,0,Math.PI/2,!1),_.lineTo(U,k),_.arc(U,k-U,U,Math.PI/2,Math.PI,!1),_.lineTo(0,R),_.arc(R,R,R,Math.PI,Math.PI*3/2,!1)}}})(Dl);const ee=St(xt({__proto__:null,default:Ee(Dl)},[Dl]));var Hr={},Il={},Zt={};Object.defineProperty(Zt,"__esModule",{value:!0});var Jf=Zt.getComponentValidator=ld=Zt.getBooleanValidator=od=Zt.getNumberArrayValidator=ad=Zt.getFunctionValidator=sd=Zt.getStringOrGradientValidator=rd=Zt.getStringValidator=nd=Zt.getNumberOrAutoValidator=id=Zt.getNumberOrArrayOfNumbersValidator=ed=Zt.getNumberValidator=td=Zt.alphaComponent=Qf=Zt.RGBComponent=void 0;const hi=Ot,ie=ee;function ci(i){return ie.Util._isString(i)?'"'+i+'"':Object.prototype.toString.call(i)==="[object Number]"||ie.Util._isBoolean(i)?i:Object.prototype.toString.call(i)}function zy(i){return i>255?255:i<0?0:Math.round(i)}var Qf=Zt.RGBComponent=zy;function Hy(i){return i>1?1:i<1e-4?1e-4:i}var td=Zt.alphaComponent=Hy;function jy(){if(hi.Konva.isUnminified)return function(i,t){return ie.Util._isNumber(i)||ie.Util.warn(ci(i)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),i}}var ed=Zt.getNumberValidator=jy;function Vy(i){if(hi.Konva.isUnminified)return function(t,e){let n=ie.Util._isNumber(t),r=ie.Util._isArray(t)&&t.length==i;return!n&&!r&&ie.Util.warn(ci(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or Array<number>('+i+")"),t}}var id=Zt.getNumberOrArrayOfNumbersValidator=Vy;function qy(){if(hi.Konva.isUnminified)return function(i,t){var e=ie.Util._isNumber(i),n=i==="auto";return e||n||ie.Util.warn(ci(i)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),i}}var nd=Zt.getNumberOrAutoValidator=qy;function Xy(){if(hi.Konva.isUnminified)return function(i,t){return ie.Util._isString(i)||ie.Util.warn(ci(i)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),i}}var rd=Zt.getStringValidator=Xy;function Yy(){if(hi.Konva.isUnminified)return function(i,t){const e=ie.Util._isString(i),n=Object.prototype.toString.call(i)==="[object CanvasGradient]"||i&&i.addColorStop;return e||n||ie.Util.warn(ci(i)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),i}}var sd=Zt.getStringOrGradientValidator=Yy;function Wy(){if(hi.Konva.isUnminified)return function(i,t){return ie.Util._isFunction(i)||ie.Util.warn(ci(i)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),i}}var ad=Zt.getFunctionValidator=Wy;function Ky(){if(hi.Konva.isUnminified)return function(i,t){const e=Int8Array?Object.getPrototypeOf(Int8Array):null;return e&&i instanceof e||(ie.Util._isArray(i)?i.forEach(function(n){ie.Util._isNumber(n)||ie.Util.warn('"'+t+'" attribute has non numeric element '+n+". Make sure that all elements are numbers.")}):ie.Util.warn(ci(i)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),i}}var od=Zt.getNumberArrayValidator=Ky;function Zy(){if(hi.Konva.isUnminified)return function(i,t){var e=i===!0||i===!1;return e||ie.Util.warn(ci(i)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),i}}var ld=Zt.getBooleanValidator=Zy;function Jy(i){if(hi.Konva.isUnminified)return function(t,e){return t==null||ie.Util.isObject(t)||ie.Util.warn(ci(t)+' is a not valid value for "'+e+'" attribute. The value should be an object with properties '+i),t}}Jf=Zt.getComponentValidator=Jy;const Ft=St(xt({__proto__:null,get RGBComponent(){return Qf},get alphaComponent(){return td},default:Zt,get getBooleanValidator(){return ld},get getComponentValidator(){return Jf},get getFunctionValidator(){return ad},get getNumberArrayValidator(){return od},get getNumberOrArrayOfNumbersValidator(){return id},get getNumberOrAutoValidator(){return nd},get getNumberValidator(){return ed},get getStringOrGradientValidator(){return sd},get getStringValidator(){return rd}},[Zt]));(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Factory=void 0;const t=ee,e=Ft;var n="get",r="set";i.Factory={addGetterSetter(s,a,o,l,h){i.Factory.addGetter(s,a,o),i.Factory.addSetter(s,a,l,h),i.Factory.addOverloadedGetterSetter(s,a)},addGetter(s,a,o){var l=n+t.Util._capitalize(a);s.prototype[l]=s.prototype[l]||function(){var h=this.attrs[a];return h===void 0?o:h}},addSetter(s,a,o,l){var h=r+t.Util._capitalize(a);s.prototype[h]||i.Factory.overWriteSetter(s,a,o,l)},overWriteSetter(s,a,o,l){var h=r+t.Util._capitalize(a);s.prototype[h]=function(c){return o&&c!==void 0&&c!==null&&(c=o.call(this,c,a)),this._setAttr(a,c),l&&l.call(this),this}},addComponentsGetterSetter(s,a,o,l,h){var c=o.length,d=t.Util._capitalize,f=n+d(a),u=r+d(a),p,m;s.prototype[f]=function(){var S={};for(p=0;p<c;p++)m=o[p],S[m]=this.getAttr(a+d(m));return S};var y=(0,e.getComponentValidator)(o);s.prototype[u]=function(S){var C=this.attrs[a],_;l&&(S=l.call(this,S)),y&&y.call(this,S,a);for(_ in S)S.hasOwnProperty(_)&&this._setAttr(a+d(_),S[_]);return S||o.forEach(w=>{this._setAttr(a+d(w),void 0)}),this._fireChangeEvent(a,C,S),h&&h.call(this),this},i.Factory.addOverloadedGetterSetter(s,a)},addOverloadedGetterSetter(s,a){var o=t.Util._capitalize(a),l=r+o,h=n+o;s.prototype[a]=function(){return arguments.length?(this[l](arguments[0]),this):this[h]()}},addDeprecatedGetterSetter(s,a,o,l){t.Util.error("Adding deprecated "+a);var h=n+t.Util._capitalize(a),c=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";s.prototype[h]=function(){t.Util.error(c);var d=this.attrs[a];return d===void 0?o:d},i.Factory.addSetter(s,a,l,function(){t.Util.error(c)}),i.Factory.addOverloadedGetterSetter(s,a)},backCompat(s,a){t.Util.each(a,function(o,l){var h=s.prototype[l],c=n+t.Util._capitalize(o),d=r+t.Util._capitalize(o);function f(){h.apply(this,arguments),t.Util.error('"'+o+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}s.prototype[o]=f,s.prototype[c]=f,s.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(Il);const It=St(xt({__proto__:null,default:Ee(Il)},[Il]));var ui={},fi={};Object.defineProperty(fi,"__esModule",{value:!0});var hd=fi.HitContext=gd=fi.SceneContext=dd=fi.Context=void 0;const cd=ee,Qy=Ot;function t3(i){var t=[],e=i.length,n=cd.Util,r,s;for(r=0;r<e;r++)s=i[r],n._isNumber(s)?s=Math.round(s*1e3)/1e3:n._isString(s)||(s=s+""),t.push(s);return t}var ud=",",e3="(",i3=")",n3="([",r3="])",s3=";",a3="()",o3="=",fd=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],l3=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"];const h3=100;class Ma{constructor(t){this.canvas=t,Qy.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(t,e){var n=this.traceArr,r=n.length,s="",a,o,l,h;for(a=0;a<r;a++)o=n[a],l=o.method,l?(h=o.args,s+=l,t?s+=a3:cd.Util._isArray(h[0])?s+=n3+h.join(ud)+r3:(e&&(h=h.map(c=>typeof c=="number"?Math.floor(c):c)),s+=e3+h.join(ud)+i3)):(s+=o.property,t||(s+=o3+o.val)),s+=s3;return s}clearTrace(){this.traceArr=[]}_trace(t){var e=this.traceArr,n;e.push(t),n=e.length,n>=h3&&e.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)}_applyLineCap(t){const e=t.attrs.lineCap;e&&this.setAttr("lineCap",e)}_applyOpacity(t){var e=t.getAbsoluteOpacity();e!==1&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){const e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}setAttr(t,e){this._context[t]=e}arc(t,e,n,r,s,a){this._context.arc(t,e,n,r,s,a)}arcTo(t,e,n,r,s){this._context.arcTo(t,e,n,r,s)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,n,r,s,a){this._context.bezierCurveTo(t,e,n,r,s,a)}clearRect(t,e,n,r){this._context.clearRect(t,e,n,r)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){var n=arguments;if(n.length===2)return this._context.createImageData(t,e);if(n.length===1)return this._context.createImageData(t)}createLinearGradient(t,e,n,r){return this._context.createLinearGradient(t,e,n,r)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,n,r,s,a){return this._context.createRadialGradient(t,e,n,r,s,a)}drawImage(t,e,n,r,s,a,o,l,h){var c=arguments,d=this._context;c.length===3?d.drawImage(t,e,n):c.length===5?d.drawImage(t,e,n,r,s):c.length===9&&d.drawImage(t,e,n,r,s,a,o,l,h)}ellipse(t,e,n,r,s,a,o,l){this._context.ellipse(t,e,n,r,s,a,o,l)}isPointInPath(t,e,n,r){return n?this._context.isPointInPath(n,t,e,r):this._context.isPointInPath(t,e,r)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,n,r){this._context.fillRect(t,e,n,r)}strokeRect(t,e,n,r){this._context.strokeRect(t,e,n,r)}fillText(t,e,n,r){r?this._context.fillText(t,e,n,r):this._context.fillText(t,e,n)}measureText(t){return this._context.measureText(t)}getImageData(t,e,n,r){return this._context.getImageData(t,e,n,r)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,n,r){this._context.rect(t,e,n,r)}putImageData(t,e,n){this._context.putImageData(t,e,n)}quadraticCurveTo(t,e,n,r){this._context.quadraticCurveTo(t,e,n,r)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,n,r,s,a){this._context.setTransform(t,e,n,r,s,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,n,r){this._context.strokeText(t,e,n,r)}transform(t,e,n,r,s,a){this._context.transform(t,e,n,r,s,a)}translate(t,e){this._context.translate(t,e)}_enableTrace(){var t=this,e=fd.length,n=this.setAttr,r,s,a=function(o){var l=t[o],h;t[o]=function(){return s=t3(Array.prototype.slice.call(arguments,0)),h=l.apply(t,arguments),t._trace({method:o,args:s}),h}};for(r=0;r<e;r++)a(fd[r]);t.setAttr=function(){n.apply(t,arguments);var o=arguments[0],l=arguments[1];(o==="shadowOffsetX"||o==="shadowOffsetY"||o==="shadowBlur")&&(l=l/this.canvas.getPixelRatio()),t._trace({property:o,val:l})}}_applyGlobalCompositeOperation(t){const e=t.attrs.globalCompositeOperation;var n=!e||e==="source-over";n||this.setAttr("globalCompositeOperation",e)}}var dd=fi.Context=Ma;l3.forEach(function(i){Object.defineProperty(Ma.prototype,i,{get(){return this._context[i]},set(t){this._context[i]=t}})});class c3 extends Ma{constructor(t,{willReadFrequently:e=!1}={}){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){var e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){var e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){const e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){const e=t.fill(),n=t.getFillPriority();if(e&&n==="color"){this._fillColor(t);return}const r=t.getFillPatternImage();if(r&&n==="pattern"){this._fillPattern(t);return}const s=t.getFillLinearGradientColorStops();if(s&&n==="linear-gradient"){this._fillLinearGradient(t);return}const a=t.getFillRadialGradientColorStops();if(a&&n==="radial-gradient"){this._fillRadialGradient(t);return}e?this._fillColor(t):r?this._fillPattern(t):s?this._fillLinearGradient(t):a&&this._fillRadialGradient(t)}_strokeLinearGradient(t){const e=t.getStrokeLinearGradientStartPoint(),n=t.getStrokeLinearGradientEndPoint(),r=t.getStrokeLinearGradientColorStops(),s=this.createLinearGradient(e.x,e.y,n.x,n.y);if(r){for(var a=0;a<r.length;a+=2)s.addColorStop(r[a],r[a+1]);this.setAttr("strokeStyle",s)}}_stroke(t){var e=t.dash(),n=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!n){this.save();var r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)");var s=t.getStrokeLinearGradientColorStops();s?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),n||this.restore()}}_applyShadow(t){var e,n,r,s=(e=t.getShadowRGBA())!==null&&e!==void 0?e:"black",a=(n=t.getShadowBlur())!==null&&n!==void 0?n:5,o=(r=t.getShadowOffset())!==null&&r!==void 0?r:{x:0,y:0},l=t.getAbsoluteScale(),h=this.canvas.getPixelRatio(),c=l.x*h,d=l.y*h;this.setAttr("shadowColor",s),this.setAttr("shadowBlur",a*Math.min(Math.abs(c),Math.abs(d))),this.setAttr("shadowOffsetX",o.x*c),this.setAttr("shadowOffsetY",o.y*d)}}var gd=fi.SceneContext=c3;class u3 extends Ma{constructor(t){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:!0})}_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()}strokeShape(t){t.hasHitStroke()&&this._stroke(t)}_stroke(t){if(t.hasHitStroke()){const s=t.getStrokeScaleEnabled();if(!s){this.save();var e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(t);var n=t.hitStrokeWidth(),r=n==="auto"?t.strokeWidth():n;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),s||this.restore()}}}hd=fi.HitContext=u3;const pd=St(xt({__proto__:null,get Context(){return dd},get HitContext(){return hd},get SceneContext(){return gd},default:fi},[fi]));Object.defineProperty(ui,"__esModule",{value:!0});var md=ui.HitCanvas=bd=ui.SceneCanvas=yd=ui.Canvas=void 0;const Ra=ee,vd=pd,_d=Ot,f3=It,d3=Ft;var La;function g3(){if(La)return La;var i=Ra.Util.createCanvasElement(),t=i.getContext("2d");return La=function(){var e=_d.Konva._global.devicePixelRatio||1,n=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return e/n}(),Ra.Util.releaseCanvas(i),La}class Da{constructor(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var e=t||{},n=e.pixelRatio||_d.Konva.pixelRatio||g3();this.pixelRatio=n,this._canvas=Ra.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"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(t){var e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)}setWidth(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";var e=this.pixelRatio,n=this.getContext()._context;n.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio,n=this.getContext()._context;n.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(t,e){try{return this._canvas.toDataURL(t,e)}catch{try{return this._canvas.toDataURL()}catch(r){return Ra.Util.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}var yd=ui.Canvas=Da;f3.Factory.addGetterSetter(Da,"pixelRatio",void 0,(0,d3.getNumberValidator)());class p3 extends Da{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new vd.SceneContext(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}}var bd=ui.SceneCanvas=p3;class m3 extends Da{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new vd.HitContext(this),this.setSize(t.width,t.height)}}md=ui.HitCanvas=m3;const Ia=St(xt({__proto__:null,get Canvas(){return yd},get HitCanvas(){return md},get SceneCanvas(){return bd},default:ui},[ui]));var Ol={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.DD=void 0;const t=Ot,e=ee;i.DD={get isDragging(){var n=!1;return i.DD._dragElements.forEach(r=>{r.dragStatus==="dragging"&&(n=!0)}),n},justDragged:!1,get node(){var n;return i.DD._dragElements.forEach(r=>{n=r.node}),n},_dragElements:new Map,_drag(n){const r=[];i.DD._dragElements.forEach((s,a)=>{const{node:o}=s,l=o.getStage();l.setPointersPositions(n),s.pointerId===void 0&&(s.pointerId=e.Util._getFirstPointerId(n));const h=l._changedPointerPositions.find(f=>f.id===s.pointerId);if(h){if(s.dragStatus!=="dragging"){var c=o.dragDistance(),d=Math.max(Math.abs(h.x-s.startPointerPos.x),Math.abs(h.y-s.startPointerPos.y));if(d<c||(o.startDrag({evt:n}),!o.isDragging()))return}o._setDragPosition(n,s),r.push(o)}}),r.forEach(s=>{s.fire("dragmove",{type:"dragmove",target:s,evt:n},!0)})},_endDragBefore(n){const r=[];i.DD._dragElements.forEach(s=>{const{node:a}=s,o=a.getStage();if(n&&o.setPointersPositions(n),!o._changedPointerPositions.find(c=>c.id===s.pointerId))return;(s.dragStatus==="dragging"||s.dragStatus==="stopped")&&(i.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,s.dragStatus="stopped");const h=s.node.getLayer()||s.node instanceof t.Konva.Stage&&s.node;h&&r.indexOf(h)===-1&&r.push(h)}),r.forEach(s=>{s.draw()})},_endDragAfter(n){i.DD._dragElements.forEach((r,s)=>{r.dragStatus==="stopped"&&r.node.fire("dragend",{type:"dragend",target:r.node,evt:n},!0),r.dragStatus!=="dragging"&&i.DD._dragElements.delete(s)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",i.DD._endDragBefore,!0),window.addEventListener("touchend",i.DD._endDragBefore,!0),window.addEventListener("mousemove",i.DD._drag),window.addEventListener("touchmove",i.DD._drag),window.addEventListener("mouseup",i.DD._endDragAfter,!1),window.addEventListener("touchend",i.DD._endDragAfter,!1))})(Ol);const Fl=St(xt({__proto__:null,default:Ee(Ol)},[Ol]));Object.defineProperty(Hr,"__esModule",{value:!0});var wd=Hr.Node=void 0;const Ut=ee,jr=It,Oa=Ia,rn=Ot,Be=Fl,ae=Ft;var Fa="absoluteOpacity",Na="allEventListeners",di="absoluteTransform",xd="absoluteScale",sn="canvas",v3="Change",_3="children",y3="konva",Nl="listening",Sd="mouseenter",Cd="mouseleave",kd="set",Td="Shape",Ua=" ",Ed="stage",Ri="transform",b3="Stage",Ul="visible",w3=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Ua);let x3=1,Mt=class Rh{constructor(t){this._id=x3++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===Ri||t===di)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,e){var n=this._cache.get(t),r=t===Ri||t===di,s=n===void 0||r&&n.dirty===!0;return s&&(n=e.call(this),this._cache.set(t,n)),n}_calculate(t,e,n){if(!this._attachedDepsListeners.get(t)){const r=e.map(s=>s+"Change.konva").join(Ua);this.on(r,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,n)}_getCanvasCache(){return this._cache.get(sn)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===di&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(sn)){const{scene:t,filter:e,hit:n}=this._cache.get(sn);Ut.Util.releaseCanvas(t,e,n),this._cache.delete(sn)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var e=t||{},n={};(e.x===void 0||e.y===void 0||e.width===void 0||e.height===void 0)&&(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));var r=Math.ceil(e.width||n.width),s=Math.ceil(e.height||n.height),a=e.pixelRatio,o=e.x===void 0?Math.floor(n.x):e.x,l=e.y===void 0?Math.floor(n.y):e.y,h=e.offset||0,c=e.drawBorder||!1,d=e.hitCanvasPixelRatio||1;if(!r||!s){Ut.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}r+=h*2+1,s+=h*2+1,o-=h,l-=h;var f=new Oa.SceneCanvas({pixelRatio:a,width:r,height:s}),u=new Oa.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),p=new Oa.HitCanvas({pixelRatio:d,width:r,height:s}),m=f.getContext(),y=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(sn),this._filterUpToDate=!1,e.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,u.getContext()._context.imageSmoothingEnabled=!1),m.save(),y.save(),m.translate(-o,-l),y.translate(-o,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Fa),this._clearSelfAndDescendantCache(xd),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),y.restore(),c&&(m.save(),m.beginPath(),m.rect(0,0,r,s),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(sn,{scene:f,filter:u,hit:p,x:o,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(sn)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){var n=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],r=1/0,s=1/0,a=-1/0,o=-1/0,l=this.getAbsoluteTransform(e);return n.forEach(function(h){var c=l.point(h);r===void 0&&(r=a=c.x,s=o=c.y),r=Math.min(r,c.x),s=Math.min(s,c.y),a=Math.max(a,c.x),o=Math.max(o,c.y)}),{x:r,y:s,width:a-r,height:o-s}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const e=this._getCanvasCache();t.translate(e.x,e.y);var n=this._getCachedSceneCanvas(),r=n.pixelRatio;t.drawImage(n._canvas,0,0,n.width/r,n.height/r),t.restore()}_drawCachedHitCanvas(t){var e=this._getCanvasCache(),n=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),e=this._getCanvasCache(),n=e.scene,r=e.filter,s=r.getContext(),a,o,l,h;if(t){if(!this._filterUpToDate){var c=n.pixelRatio;r.setSize(n.width/n.pixelRatio,n.height/n.pixelRatio);try{for(a=t.length,s.clear(),s.drawImage(n._canvas,0,0,n.getWidth()/c,n.getHeight()/c),o=s.getImageData(0,0,r.getWidth(),r.getHeight()),l=0;l<a;l++){if(h=t[l],typeof h!="function"){Ut.Util.error("Filter should be type of function, but got "+typeof h+" instead. Please check correct filters");continue}h.call(this,o),s.putImageData(o,0,0)}}catch(d){Ut.Util.error("Unable to apply filter. "+d.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return r}return n}on(t,e){if(this._cache&&this._cache.delete(Na),arguments.length===3)return this._delegate.apply(this,arguments);var n=t.split(Ua),r=n.length,s,a,o,l,h;for(s=0;s<r;s++)a=n[s],o=a.split("."),l=o[0],h=o[1]||"",this.eventListeners[l]||(this.eventListeners[l]=[]),this.eventListeners[l].push({name:h,handler:e});return this}off(t,e){var n=(t||"").split(Ua),r=n.length,s,a,o,l,h,c;if(this._cache&&this._cache.delete(Na),!t)for(a in this.eventListeners)this._off(a);for(s=0;s<r;s++)if(o=n[s],l=o.split("."),h=l[0],c=l[1],h)this.eventListeners[h]&&this._off(h,c,e);else for(a in this.eventListeners)this._off(a,c,e);return this}dispatchEvent(t){var e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,function(n){e.call(this,n.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,e,n){var r=this;this.on(t,function(s){for(var a=s.target.findAncestors(e,!0,r),o=0;o<a.length;o++)s=Ut.Util.cloneObject(s),s.currentTarget=a[o],n.call(a[o],s)})}remove(){return this.isDragging()&&this.stopDrag(),Be.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(di),this._clearSelfAndDescendantCache(Fa),this._clearSelfAndDescendantCache(xd),this._clearSelfAndDescendantCache(Ed),this._clearSelfAndDescendantCache(Ul),this._clearSelfAndDescendantCache(Nl)}_remove(){this._clearCaches();var t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){var e="get"+Ut.Util._capitalize(t);return Ut.Util._isFunction(this[e])?this[e]():this.attrs[t]}getAncestors(){for(var t=this.getParent(),e=[];t;)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges(()=>{var e,n;if(!t)return this;for(e in t)e!==_3&&(n=kd+Ut.Util._capitalize(e),Ut.Util._isFunction(this[n])?this[n](t[e]):this._setAttr(e,t[e]))}),this}isListening(){return this._getCache(Nl,this._isListening)}_isListening(t){if(!this.listening())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isListening(t):!0}isVisible(){return this._getCache(Ul,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isVisible(t):!0}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);var n=this.getLayer(),r=!1;Be.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===n)&&(r=!0)});var s=!e&&!rn.Konva.hitOnDragEnabled&&r;return this.isListening()&&this.isVisible()&&!s}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),e=this,n=0,r,s,a,o;function l(c){for(r=[],s=c.length,a=0;a<s;a++)o=c[a],n++,o.nodeType!==Td&&(r=r.concat(o.getChildren().slice())),o._id===e._id&&(a=s);r.length>0&&r[0].getDepth()<=t&&l(r)}const h=this.getStage();return e.nodeType!==b3&&h&&l(h.getChildren()),n}getDepth(){for(var t=0,e=this.parent;e;)t++,e=e.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Ri),this._clearSelfAndDescendantCache(di)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;var e=t.getPointerPosition();if(!e)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(e)}getAbsolutePosition(t){let e=!1,n=this.parent;for(;n;){if(n.isCached()){e=!0;break}n=n.parent}e&&!t&&(t=!0);var r=this.getAbsoluteTransform(t).getMatrix(),s=new Ut.Transform,a=this.offset();return s.m=r.slice(),s.translate(a.x,a.y),s.getTranslation()}setAbsolutePosition(t){const{x:e,y:n,...r}=this._clearTransform();this.attrs.x=e,this.attrs.y=n,this._clearCache(Ri);var s=this._getAbsoluteTransform().copy();return s.invert(),s.translate(t.x,t.y),t={x:this.attrs.x+s.getTranslation().x,y:this.attrs.y+s.getTranslation().y},this._setTransform(r),this.setPosition({x:t.x,y:t.y}),this._clearCache(Ri),this._clearSelfAndDescendantCache(di),this}_setTransform(t){var e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){var t={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()};return 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,t}move(t){var e=t.x,n=t.y,r=this.x(),s=this.y();return e!==void 0&&(r+=e),n!==void 0&&(s+=n),this.setPosition({x:r,y:s}),this}_eachAncestorReverse(t,e){var n=[],r=this.getParent(),s,a;if(!(e&&e._id===this._id)){for(n.unshift(this);r&&(!e||r._id!==e._id);)n.unshift(r),r=r.parent;for(s=n.length,a=0;a<s;a++)t(n[a])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return Ut.Util.warn("Node has no parent. moveToTop function is ignored."),!1;var t=this.index,e=this.parent.getChildren().length;return t<e-1?(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return Ut.Util.warn("Node has no parent. moveUp function is ignored."),!1;var t=this.index,e=this.parent.getChildren().length;return t<e-1?(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return Ut.Util.warn("Node has no parent. moveDown function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Ut.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return Ut.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Ut.Util.warn("Unexpected value "+t+" 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)+".");var e=this.index;return this.parent.children.splice(e,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Fa,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),e=this.getParent();return e&&!e._isUnderCache&&(t*=e.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},e=this.getAttrs(),n,r,s,a,o;t.attrs={};for(n in e)r=e[n],o=Ut.Util.isObject(r)&&!Ut.Util._isPlainObject(r)&&!Ut.Util._isArray(r),!o&&(s=typeof this[n]=="function"&&this[n],delete e[n],a=s?s.call(this):null,e[n]=r,a!==r&&(t.attrs[n]=r));return t.className=this.getClassName(),Ut.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,n){var r=[];e&&this._isMatch(t)&&r.push(this);for(var s=this.parent;s;){if(s===n)return r;s._isMatch(t)&&r.push(s),s=s.parent}return r}isAncestorOf(t){return!1}findAncestor(t,e,n){return this.findAncestors(t,e,n)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var e=t.replace(/ /g,"").split(","),n=e.length,r,s;for(r=0;r<n;r++)if(s=e[r],Ut.Util.isValidSelector(s)||(Ut.Util.warn('Selector "'+s+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Ut.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Ut.Util.warn("Konva is awesome, right?")),s.charAt(0)==="#"){if(this.id()===s.slice(1))return!0}else if(s.charAt(0)==="."){if(this.hasName(s.slice(1)))return!0}else if(this.className===s||this.nodeType===s)return!0;return!1}getLayer(){var t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(Ed,this._getStage)}_getStage(){var t=this.getParent();return t?t.getStage():null}fire(t,e={},n){return e.target=e.target||this,n?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(di,this._getAbsoluteTransform)}_getAbsoluteTransform(t){var e;if(t)return e=new Ut.Transform,this._eachAncestorReverse(function(r){var s=r.transformsEnabled();s==="all"?e.multiply(r.getTransform()):s==="position"&&e.translate(r.x()-r.offsetX(),r.y()-r.offsetY())},t),e;e=this._cache.get(di)||new Ut.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(e):e.reset();var n=this.transformsEnabled();if(n==="all")e.multiply(this.getTransform());else if(n==="position"){const r=this.attrs.x||0,s=this.attrs.y||0,a=this.attrs.offsetX||0,o=this.attrs.offsetY||0;e.translate(r-a,s-o)}return e.dirty=!1,e}getAbsoluteScale(t){for(var e=this;e;)e._isUnderCache&&(t=e),e=e.getParent();const r=this.getAbsoluteTransform(t).decompose();return{x:r.scaleX,y:r.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Ri,this._getTransform)}_getTransform(){var t,e,n=this._cache.get(Ri)||new Ut.Transform;n.reset();var r=this.x(),s=this.y(),a=rn.Konva.getAngle(this.rotation()),o=(t=this.attrs.scaleX)!==null&&t!==void 0?t:1,l=(e=this.attrs.scaleY)!==null&&e!==void 0?e:1,h=this.attrs.skewX||0,c=this.attrs.skewY||0,d=this.attrs.offsetX||0,f=this.attrs.offsetY||0;return(r!==0||s!==0)&&n.translate(r,s),a!==0&&n.rotate(a),(h!==0||c!==0)&&n.skew(h,c),(o!==1||l!==1)&&n.scale(o,l),(d!==0||f!==0)&&n.translate(-1*d,-1*f),n.dirty=!1,n}clone(t){var e=Ut.Util.cloneObject(this.attrs),n,r,s,a,o;for(n in t)e[n]=t[n];var l=new this.constructor(e);for(n in this.eventListeners)for(r=this.eventListeners[n],s=r.length,a=0;a<s;a++)o=r[a],o.name.indexOf(y3)<0&&(l.eventListeners[n]||(l.eventListeners[n]=[]),l.eventListeners[n].push(o));return l}_toKonvaCanvas(t){t=t||{};var e=this.getClientRect(),n=this.getStage(),r=t.x!==void 0?t.x:Math.floor(e.x),s=t.y!==void 0?t.y:Math.floor(e.y),a=t.pixelRatio||1,o=new Oa.SceneCanvas({width:t.width||Math.ceil(e.width)||(n?n.width():0),height:t.height||Math.ceil(e.height)||(n?n.height():0),pixelRatio:a}),l=o.getContext();return t.imageSmoothingEnabled===!1&&(l._context.imageSmoothingEnabled=!1),l.save(),(r||s)&&l.translate(-1*r,-1*s),this.drawScene(o),l.restore(),o}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){t=t||{};var e=t.mimeType||null,n=t.quality||null,r=this._toKonvaCanvas(t).toDataURL(e,n);return t.callback&&t.callback(r),r}toImage(t){return new Promise((e,n)=>{try{const r=t?.callback;r&&delete t.callback,Ut.Util._urlToImage(this.toDataURL(t),function(s){e(s),r?.(s)})}catch(r){n(r)}})}toBlob(t){return new Promise((e,n)=>{try{const r=t?.callback;r&&delete t.callback,this.toCanvas(t).toBlob(s=>{e(s),r?.(s)})}catch(r){n(r)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():rn.Konva.dragDistance}_off(t,e,n){var r=this.eventListeners[t],s,a,o;for(s=0;s<r.length;s++)if(a=r[s].name,o=r[s].handler,(a!=="konva"||e==="konva")&&(!e||a===e)&&(!n||n===o)){if(r.splice(s,1),r.length===0){delete this.eventListeners[t];break}s--}}_fireChangeEvent(t,e,n){this._fire(t+v3,{oldVal:e,newVal:n})}addName(t){if(!this.hasName(t)){var e=this.name(),n=e?e+" "+t:t;this.name(n)}return this}hasName(t){if(!t)return!1;const e=this.name();if(!e)return!1;var n=(e||"").split(/\s/g);return n.indexOf(t)!==-1}removeName(t){var e=(this.name()||"").split(/\s/g),n=e.indexOf(t);return n!==-1&&(e.splice(n,1),this.name(e.join(" "))),this}setAttr(t,e){var n=this[kd+Ut.Util._capitalize(t)];return Ut.Util._isFunction(n)?n.call(this,e):this._setAttr(t,e),this}_requestDraw(){if(rn.Konva.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,e){var n=this.attrs[t];n===e&&!Ut.Util.isObject(e)||(e==null?delete this.attrs[t]:this.attrs[t]=e,this._shouldFireChangeEvents&&this._fireChangeEvent(t,n,e),this._requestDraw())}_setComponentAttr(t,e,n){var r;n!==void 0&&(r=this.attrs[t],r||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=n,this._fireChangeEvent(t,r,n))}_fireAndBubble(t,e,n){e&&this.nodeType===Td&&(e.target=this);var r=(t===Sd||t===Cd)&&(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||this.nodeType==="Stage"&&!n);if(!r){this._fire(t,e);var s=(t===Sd||t===Cd)&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!s&&(n&&n.parent?this._fireAndBubble.call(this.parent,t,e,n):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,n,r;const s=(e=this._cache.get(Na))!==null&&e!==void 0?e:{};let a=s?.[t];if(a===void 0){a=[];let o=Object.getPrototypeOf(this);for(;o;){const l=(r=(n=o.eventListeners)===null||n===void 0?void 0:n[t])!==null&&r!==void 0?r:[];a.push(...l),o=Object.getPrototypeOf(o)}s[t]=a,this._cache.set(Na,s)}return a}_fire(t,e){e=e||{},e.currentTarget=this,e.type=t;const n=this._getProtoListeners(t);if(n)for(var r=0;r<n.length;r++)n[r].handler.call(this,e);const s=this.eventListeners[t];if(s)for(var r=0;r<s.length;r++)s[r].handler.call(this,e)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){var e=t?t.pointerId:void 0,n=this.getStage(),r=this.getAbsolutePosition();if(n){var s=n._getPointerById(e)||n._changedPointerPositions[0]||r;Be.DD._dragElements.set(this._id,{node:this,startPointerPos:s,offset:{x:s.x-r.x,y:s.y-r.y},dragStatus:"ready",pointerId:e})}}startDrag(t,e=!0){Be.DD._dragElements.has(this._id)||this._createDragElement(t);const n=Be.DD._dragElements.get(this._id);n.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(t,e){const n=this.getStage()._getPointerById(e.pointerId);if(n){var r={x:n.x-e.offset.x,y:n.y-e.offset.y},s=this.dragBoundFunc();if(s!==void 0){const a=s.call(this,r,t);a?r=a:Ut.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==r.x||this._lastPos.y!==r.y)&&(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}}stopDrag(t){const e=Be.DD._dragElements.get(this._id);e&&(e.dragStatus="stopped"),Be.DD._endDragBefore(t),Be.DD._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=Be.DD._dragElements.get(this._id);return t?t.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){var e=t.evt.button!==void 0,n=!e||rn.Konva.dragButtons.indexOf(t.evt.button)>=0;if(n&&!this.isDragging()){var r=!1;Be.DD._dragElements.forEach(s=>{this.isAncestorOf(s.node)&&(r=!0)}),r||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const e=Be.DD._dragElements.get(this._id),n=e&&e.dragStatus==="dragging",r=e&&e.dragStatus==="ready";n?this.stopDrag():r&&Be.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const e=this.getStage();if(!e)return!1;const n={x:-t.x,y:-t.y,width:e.width()+2*t.x,height:e.height()+2*t.y};return Ut.Util.haveIntersection(n,this.getClientRect())}static create(t,e){return Ut.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,e)}static _createNode(t,e){var n=Rh.prototype.getClassName.call(t),r=t.children,s,a,o;e&&(t.attrs.container=e),rn.Konva[n]||(Ut.Util.warn('Can not find a node with class name "'+n+'". Fallback to "Shape".'),n="Shape");const l=rn.Konva[n];if(s=new l(t.attrs),r)for(a=r.length,o=0;o<a;o++)s.add(Rh._createNode(r[o]));return s}};wd=Hr.Node=Mt,Mt.prototype.nodeType="Node",Mt.prototype._attrsAffectingSize=[],Mt.prototype.eventListeners={},Mt.prototype.on.call(Mt.prototype,w3,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Ri),this._clearSelfAndDescendantCache(di)}),Mt.prototype.on.call(Mt.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Ul)}),Mt.prototype.on.call(Mt.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(Nl)}),Mt.prototype.on.call(Mt.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(Fa)});const Wt=jr.Factory.addGetterSetter;Wt(Mt,"zIndex"),Wt(Mt,"absolutePosition"),Wt(Mt,"position"),Wt(Mt,"x",0,(0,ae.getNumberValidator)()),Wt(Mt,"y",0,(0,ae.getNumberValidator)()),Wt(Mt,"globalCompositeOperation","source-over",(0,ae.getStringValidator)()),Wt(Mt,"opacity",1,(0,ae.getNumberValidator)()),Wt(Mt,"name","",(0,ae.getStringValidator)()),Wt(Mt,"id","",(0,ae.getStringValidator)()),Wt(Mt,"rotation",0,(0,ae.getNumberValidator)()),jr.Factory.addComponentsGetterSetter(Mt,"scale",["x","y"]),Wt(Mt,"scaleX",1,(0,ae.getNumberValidator)()),Wt(Mt,"scaleY",1,(0,ae.getNumberValidator)()),jr.Factory.addComponentsGetterSetter(Mt,"skew",["x","y"]),Wt(Mt,"skewX",0,(0,ae.getNumberValidator)()),Wt(Mt,"skewY",0,(0,ae.getNumberValidator)()),jr.Factory.addComponentsGetterSetter(Mt,"offset",["x","y"]),Wt(Mt,"offsetX",0,(0,ae.getNumberValidator)()),Wt(Mt,"offsetY",0,(0,ae.getNumberValidator)()),Wt(Mt,"dragDistance",null,(0,ae.getNumberValidator)()),Wt(Mt,"width",0,(0,ae.getNumberValidator)()),Wt(Mt,"height",0,(0,ae.getNumberValidator)()),Wt(Mt,"listening",!0,(0,ae.getBooleanValidator)()),Wt(Mt,"preventDefault",!0,(0,ae.getBooleanValidator)()),Wt(Mt,"filters",null,function(i){return this._filterUpToDate=!1,i}),Wt(Mt,"visible",!0,(0,ae.getBooleanValidator)()),Wt(Mt,"transformsEnabled","all",(0,ae.getStringValidator)()),Wt(Mt,"size"),Wt(Mt,"dragBoundFunc"),Wt(Mt,"draggable",!1,(0,ae.getBooleanValidator)()),jr.Factory.backCompat(Mt,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});const oe=St(xt({__proto__:null,get Node(){return wd},default:Hr},[Hr]));var Vr={};Object.defineProperty(Vr,"__esModule",{value:!0});var Ad=Vr.Container=void 0;const Un=It,Bl=oe,Ba=Ft;class an extends Bl.Node{constructor(){super(...arguments),this.children=[]}getChildren(t){if(!t)return this.children||[];const e=this.children||[];var n=[];return e.forEach(function(r){t(r)&&n.push(r)}),n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var e=0;e<t.length;e++)this.add(t[e]);return this}const n=t[0];return n.getParent()?(n.moveTo(this),this):(this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){var e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){var n=[];return this._descendants(r=>{const s=r._isMatch(t);return s&&n.push(r),!!(s&&e)}),n}_descendants(t){let e=!1;const n=this.getChildren();for(const r of n){if(e=t(r),e)return!0;if(r.hasChildren()&&(e=r._descendants(t),e))return!0}return!1}toObject(){var t=Bl.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(e=>{t.children.push(e.toObject())}),t}isAncestorOf(t){for(var e=t.getParent();e;){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){var e=Bl.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(n){e.add(n.clone())}),e}getAllIntersections(t){var e=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(t)&&e.push(n)}),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),!this.isCached()&&((e=this.children)===null||e===void 0||e.forEach(function(n){n._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(e,n){e.index=n}),this._requestDraw()}drawScene(t,e){var n=this.getLayer(),r=t||n&&n.getCanvas(),s=r&&r.getContext(),a=this._getCanvasCache(),o=a&&a.scene,l=r&&r.isCache;if(!this.isVisible()&&!l)return this;if(o){s.save();var h=this.getAbsoluteTransform(e).getMatrix();s.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedSceneCanvas(s),s.restore()}else this._drawChildren("drawScene",r,e);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;var n=this.getLayer(),r=t||n&&n.hitCanvas,s=r&&r.getContext(),a=this._getCanvasCache(),o=a&&a.hit;if(o){s.save();var l=this.getAbsoluteTransform(e).getMatrix();s.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(s),s.restore()}else this._drawChildren("drawHit",r,e);return this}_drawChildren(t,e,n){var r,s=e&&e.getContext(),a=this.clipWidth(),o=this.clipHeight(),l=this.clipFunc(),h=a&&o||l;const c=n===this;if(h){s.save();var d=this.getAbsoluteTransform(n),f=d.getMatrix();s.transform(f[0],f[1],f[2],f[3],f[4],f[5]),s.beginPath();let y;if(l)y=l.call(this,s,this);else{var u=this.clipX(),p=this.clipY();s.rect(u,p,a,o)}s.clip.apply(s,y),f=d.copy().invert().getMatrix(),s.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var m=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";m&&(s.save(),s._applyGlobalCompositeOperation(this)),(r=this.children)===null||r===void 0||r.forEach(function(y){y[t](e,n)}),m&&s.restore(),h&&s.restore()}getClientRect(t={}){var e,n=t.skipTransform,r=t.relativeTo,s,a,o,l,h={x:1/0,y:1/0,width:0,height:0},c=this;(e=this.children)===null||e===void 0||e.forEach(function(m){if(m.visible()){var y=m.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});y.width===0&&y.height===0||(s===void 0?(s=y.x,a=y.y,o=y.x+y.width,l=y.y+y.height):(s=Math.min(s,y.x),a=Math.min(a,y.y),o=Math.max(o,y.x+y.width),l=Math.max(l,y.y+y.height)))}});for(var d=this.find("Shape"),f=!1,u=0;u<d.length;u++){var p=d[u];if(p._isVisible(this)){f=!0;break}}return f&&s!==void 0?h={x:s,y:a,width:o-s,height:l-a}:h={x:0,y:0,width:0,height:0},n?h:this._transformedRect(h,r)}}Ad=Vr.Container=an,Un.Factory.addComponentsGetterSetter(an,"clip",["x","y","width","height"]),Un.Factory.addGetterSetter(an,"clipX",void 0,(0,Ba.getNumberValidator)()),Un.Factory.addGetterSetter(an,"clipY",void 0,(0,Ba.getNumberValidator)()),Un.Factory.addGetterSetter(an,"clipWidth",void 0,(0,Ba.getNumberValidator)()),Un.Factory.addGetterSetter(an,"clipHeight",void 0,(0,Ba.getNumberValidator)()),Un.Factory.addGetterSetter(an,"clipFunc");const Ga=St(xt({__proto__:null,get Container(){return Ad},default:Vr},[Vr]));var Gl={},Re={};Object.defineProperty(Re,"__esModule",{value:!0});var Pd=Re.releaseCapture=Id=Re.setPointerCapture=Dd=Re.hasPointerCapture=Ld=Re.createEvent=Rd=Re.getCapturedShape=void 0;const S3=Ot,qr=new Map,Md=S3.Konva._global.PointerEvent!==void 0;function C3(i){return qr.get(i)}var Rd=Re.getCapturedShape=C3;function $l(i){return{evt:i,pointerId:i.pointerId}}var Ld=Re.createEvent=$l;function k3(i,t){return qr.get(i)===t}var Dd=Re.hasPointerCapture=k3;function T3(i,t){Od(i),t.getStage()&&(qr.set(i,t),Md&&t._fire("gotpointercapture",$l(new PointerEvent("gotpointercapture"))))}var Id=Re.setPointerCapture=T3;function Od(i,t){const e=qr.get(i);if(!e)return;const n=e.getStage();n&&n.content,qr.delete(i),Md&&e._fire("lostpointercapture",$l(new PointerEvent("lostpointercapture")))}Pd=Re.releaseCapture=Od;const Fd=St(xt({__proto__:null,get createEvent(){return Ld},default:Re,get getCapturedShape(){return Rd},get hasPointerCapture(){return Dd},get releaseCapture(){return Pd},get setPointerCapture(){return Id}},[Re]));(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Stage=i.stages=void 0;const t=ee,e=It,n=Ga,r=Ot,s=Ia,a=Fl,o=Ot,l=Fd;var h="Stage",c="string",d="px",f="mouseout",u="mouseleave",p="mouseover",m="mouseenter",y="mousemove",S="mousedown",C="mouseup",_="pointermove",w="pointerdown",k="pointerup",A="pointercancel",R="lostpointercapture",P="pointerout",U="pointerleave",I="pointerover",N="pointerenter",q="contextmenu",W="touchstart",K="touchend",it="touchmove",pt="touchcancel",vt="wheel",dt=5,_t=[[m,"_pointerenter"],[S,"_pointerdown"],[y,"_pointermove"],[C,"_pointerup"],[u,"_pointerleave"],[W,"_pointerdown"],[it,"_pointermove"],[K,"_pointerup"],[pt,"_pointercancel"],[p,"_pointerover"],[vt,"_wheel"],[q,"_contextmenu"],[w,"_pointerdown"],[_,"_pointermove"],[k,"_pointerup"],[A,"_pointercancel"],[R,"_lostpointercapture"]];const yt={mouse:{[P]:f,[U]:u,[I]:p,[N]:m,[_]:y,[w]:S,[k]:C,[A]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[P]:"touchout",[U]:"touchleave",[I]:"touchover",[N]:"touchenter",[_]:it,[w]:W,[k]:K,[A]:pt,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[P]:P,[U]:U,[I]:I,[N]:N,[_]:_,[w]:w,[k]:k,[A]:A,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},L=Y=>Y.indexOf("pointer")>=0?"pointer":Y.indexOf("touch")>=0?"touch":"mouse",M=Y=>{const D=L(Y);if(D==="pointer")return r.Konva.pointerEventsEnabled&&yt.pointer;if(D==="touch")return yt.touch;if(D==="mouse")return yt.mouse};function T(Y={}){return(Y.clipFunc||Y.clipWidth||Y.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),Y}const F="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);";i.stages=[];class z extends n.Container{constructor(D){super(T(D)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),i.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",()=>{T(this.attrs)}),this._checkVisibility()}_validateAdd(D){const V=D.getType()==="Layer",X=D.getType()==="FastLayer";V||X||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const D=this.visible()?"":"none";this.content.style.display=D}setContainer(D){if(typeof D===c){if(D.charAt(0)==="."){var V=D.slice(1);D=document.getElementsByClassName(V)[0]}else{var X;D.charAt(0)!=="#"?X=D:X=D.slice(1),D=document.getElementById(X)}if(!D)throw"Can not find container in document with id "+X}return this._setAttr("container",D),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),D.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var D=this.children,V=D.length,X;for(X=0;X<V;X++)D[X].clear();return this}clone(D){return D||(D={}),D.container=typeof document<"u"&&document.createElement("div"),n.Container.prototype.clone.call(this,D)}destroy(){super.destroy();var D=this.content;D&&t.Util._isInDocument(D)&&this.container().removeChild(D);var V=i.stages.indexOf(this);return V>-1&&i.stages.splice(V,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const D=this._pointerPositions[0]||this._changedPointerPositions[0];return D?{x:D.x,y:D.y}:(t.Util.warn(F),null)}_getPointerById(D){return this._pointerPositions.find(V=>V.id===D)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(D){D=D||{},D.x=D.x||0,D.y=D.y||0,D.width=D.width||this.width(),D.height=D.height||this.height();var V=new s.SceneCanvas({width:D.width,height:D.height,pixelRatio:D.pixelRatio||1}),X=V.getContext()._context,tt=this.children;return(D.x||D.y)&&X.translate(-1*D.x,-1*D.y),tt.forEach(function(at){if(at.isVisible()){var gt=at._toKonvaCanvas(D);X.drawImage(gt._canvas,D.x,D.y,gt.getWidth()/gt.getPixelRatio(),gt.getHeight()/gt.getPixelRatio())}}),V}getIntersection(D){if(!D)return null;var V=this.children,X=V.length,tt=X-1,at;for(at=tt;at>=0;at--){const gt=V[at].getIntersection(D);if(gt)return gt}return null}_resizeDOM(){var D=this.width(),V=this.height();this.content&&(this.content.style.width=D+d,this.content.style.height=V+d),this.bufferCanvas.setSize(D,V),this.bufferHitCanvas.setSize(D,V),this.children.forEach(X=>{X.setSize({width:D,height:V}),X.draw()})}add(D,...V){if(arguments.length>1){for(var X=0;X<arguments.length;X++)this.add(arguments[X]);return this}super.add(D);var tt=this.children.length;return tt>dt&&t.Util.warn("The stage has "+tt+" 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."),D.setSize({width:this.width(),height:this.height()}),D.draw(),r.Konva.isBrowser&&this.content.appendChild(D.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(D){return l.hasPointerCapture(D,this)}setPointerCapture(D){l.setPointerCapture(D,this)}releaseCapture(D){l.releaseCapture(D,this)}getLayers(){return this.children}_bindContentEvents(){r.Konva.isBrowser&&_t.forEach(([D,V])=>{this.content.addEventListener(D,X=>{this[V](X)},{passive:!1})})}_pointerenter(D){this.setPointersPositions(D);const V=M(D.type);V&&this._fire(V.pointerenter,{evt:D,target:this,currentTarget:this})}_pointerover(D){this.setPointersPositions(D);const V=M(D.type);V&&this._fire(V.pointerover,{evt:D,target:this,currentTarget:this})}_getTargetShape(D){let V=this[D+"targetShape"];return V&&!V.getStage()&&(V=null),V}_pointerleave(D){const V=M(D.type),X=L(D.type);if(V){this.setPointersPositions(D);var tt=this._getTargetShape(X),at=!a.DD.isDragging||r.Konva.hitOnDragEnabled;tt&&at?(tt._fireAndBubble(V.pointerout,{evt:D}),tt._fireAndBubble(V.pointerleave,{evt:D}),this._fire(V.pointerleave,{evt:D,target:this,currentTarget:this}),this[X+"targetShape"]=null):at&&(this._fire(V.pointerleave,{evt:D,target:this,currentTarget:this}),this._fire(V.pointerout,{evt:D,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(D){const V=M(D.type),X=L(D.type);if(V){this.setPointersPositions(D);var tt=!1;this._changedPointerPositions.forEach(at=>{var gt=this.getIntersection(at);if(a.DD.justDragged=!1,r.Konva["_"+X+"ListenClick"]=!0,!gt||!gt.isListening())return;r.Konva.capturePointerEventsEnabled&>.setPointerCapture(at.id),this[X+"ClickStartShape"]=gt,gt._fireAndBubble(V.pointerdown,{evt:D,pointerId:at.id}),tt=!0;const Ct=D.type.indexOf("touch")>=0;gt.preventDefault()&&D.cancelable&&Ct&&D.preventDefault()}),tt||this._fire(V.pointerdown,{evt:D,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(D){const V=M(D.type),X=L(D.type);if(!V)return;a.DD.isDragging&&a.DD.node.preventDefault()&&D.cancelable&&D.preventDefault(),this.setPointersPositions(D);var tt=!a.DD.isDragging||r.Konva.hitOnDragEnabled;if(!tt)return;var at={};let gt=!1;var Ct=this._getTargetShape(X);this._changedPointerPositions.forEach(Et=>{const bt=l.getCapturedShape(Et.id)||this.getIntersection(Et),Nt=Et.id,Lt={evt:D,pointerId:Nt};var Dt=Ct!==bt;if(Dt&&Ct&&(Ct._fireAndBubble(V.pointerout,{...Lt},bt),Ct._fireAndBubble(V.pointerleave,{...Lt},bt)),bt){if(at[bt._id])return;at[bt._id]=!0}bt&&bt.isListening()?(gt=!0,Dt&&(bt._fireAndBubble(V.pointerover,{...Lt},Ct),bt._fireAndBubble(V.pointerenter,{...Lt},Ct),this[X+"targetShape"]=bt),bt._fireAndBubble(V.pointermove,{...Lt})):Ct&&(this._fire(V.pointerover,{evt:D,target:this,currentTarget:this,pointerId:Nt}),this[X+"targetShape"]=null)}),gt||this._fire(V.pointermove,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(D){const V=M(D.type),X=L(D.type);if(!V)return;this.setPointersPositions(D);const tt=this[X+"ClickStartShape"],at=this[X+"ClickEndShape"];var gt={};let Ct=!1;this._changedPointerPositions.forEach(Et=>{const bt=l.getCapturedShape(Et.id)||this.getIntersection(Et);if(bt){if(bt.releaseCapture(Et.id),gt[bt._id])return;gt[bt._id]=!0}const Nt=Et.id,Lt={evt:D,pointerId:Nt};let Dt=!1;r.Konva["_"+X+"InDblClickWindow"]?(Dt=!0,clearTimeout(this[X+"DblTimeout"])):a.DD.justDragged||(r.Konva["_"+X+"InDblClickWindow"]=!0,clearTimeout(this[X+"DblTimeout"])),this[X+"DblTimeout"]=setTimeout(function(){r.Konva["_"+X+"InDblClickWindow"]=!1},r.Konva.dblClickWindow),bt&&bt.isListening()?(Ct=!0,this[X+"ClickEndShape"]=bt,bt._fireAndBubble(V.pointerup,{...Lt}),r.Konva["_"+X+"ListenClick"]&&tt&&tt===bt&&(bt._fireAndBubble(V.pointerclick,{...Lt}),Dt&&at&&at===bt&&bt._fireAndBubble(V.pointerdblclick,{...Lt}))):(this[X+"ClickEndShape"]=null,r.Konva["_"+X+"ListenClick"]&&this._fire(V.pointerclick,{evt:D,target:this,currentTarget:this,pointerId:Nt}),Dt&&this._fire(V.pointerdblclick,{evt:D,target:this,currentTarget:this,pointerId:Nt}))}),Ct||this._fire(V.pointerup,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),r.Konva["_"+X+"ListenClick"]=!1,D.cancelable&&X!=="touch"&&D.preventDefault()}_contextmenu(D){this.setPointersPositions(D);var V=this.getIntersection(this.getPointerPosition());V&&V.isListening()?V._fireAndBubble(q,{evt:D}):this._fire(q,{evt:D,target:this,currentTarget:this})}_wheel(D){this.setPointersPositions(D);var V=this.getIntersection(this.getPointerPosition());V&&V.isListening()?V._fireAndBubble(vt,{evt:D}):this._fire(vt,{evt:D,target:this,currentTarget:this})}_pointercancel(D){this.setPointersPositions(D);const V=l.getCapturedShape(D.pointerId)||this.getIntersection(this.getPointerPosition());V&&V._fireAndBubble(k,l.createEvent(D)),l.releaseCapture(D.pointerId)}_lostpointercapture(D){l.releaseCapture(D.pointerId)}setPointersPositions(D){var V=this._getContentPosition(),X=null,tt=null;D=D||window.event,D.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(D.touches,at=>{this._pointerPositions.push({id:at.identifier,x:(at.clientX-V.left)/V.scaleX,y:(at.clientY-V.top)/V.scaleY})}),Array.prototype.forEach.call(D.changedTouches||D.touches,at=>{this._changedPointerPositions.push({id:at.identifier,x:(at.clientX-V.left)/V.scaleX,y:(at.clientY-V.top)/V.scaleY})})):(X=(D.clientX-V.left)/V.scaleX,tt=(D.clientY-V.top)/V.scaleY,this.pointerPos={x:X,y:tt},this._pointerPositions=[{x:X,y:tt,id:t.Util._getFirstPointerId(D)}],this._changedPointerPositions=[{x:X,y:tt,id:t.Util._getFirstPointerId(D)}])}_setPointerPosition(D){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(D)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var D=this.content.getBoundingClientRect();return{top:D.top,left:D.left,scaleX:D.width/this.content.clientWidth||1,scaleY:D.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new s.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new s.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!r.Konva.isBrowser){var D=this.container();if(!D)throw"Stage has no container. A container is required.";D.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),D.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(D){D.batchDraw()}),this}}i.Stage=z,z.prototype.nodeType=h,(0,o._registerNode)(z),e.Factory.addGetterSetter(z,"container")})(Gl);const E3=St(xt({__proto__:null,default:Ee(Gl)},[Gl]));var Xr={},zl={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Shape=i.shapes=void 0;const t=Ot,e=ee,n=It,r=oe,s=Ft,a=Ot,o=Fd;var l="hasShadow",h="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let u;function p(){return u||(u=e.Util.createCanvasElement().getContext("2d"),u)}i.shapes={};function m(U){const I=this.attrs.fillRule;I?U.fill(I):U.fill()}function y(U){U.stroke()}function S(U){U.fill()}function C(U){U.stroke()}function _(){this._clearCache(l)}function w(){this._clearCache(h)}function k(){this._clearCache(c)}function A(){this._clearCache(d)}function R(){this._clearCache(f)}class P extends r.Node{constructor(I){super(I);let N;for(;N=e.Util.getRandomColor(),!(N&&!(N in i.shapes)););this.colorKey=N,i.shapes[N]=this}getContext(){return e.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return e.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var I=p();const N=I.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(N&&N.setTransform){const q=new e.Transform;q.translate(this.fillPatternX(),this.fillPatternY()),q.rotate(t.Konva.getAngle(this.fillPatternRotation())),q.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),q.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const W=q.getMatrix(),K=typeof DOMMatrix>"u"?{a:W[0],b:W[1],c:W[2],d:W[3],e:W[4],f:W[5]}:new DOMMatrix(W);N.setTransform(K)}return N}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var I=this.fillLinearGradientColorStops();if(I){for(var N=p(),q=this.fillLinearGradientStartPoint(),W=this.fillLinearGradientEndPoint(),K=N.createLinearGradient(q.x,q.y,W.x,W.y),it=0;it<I.length;it+=2)K.addColorStop(I[it],I[it+1]);return K}}_getRadialGradient(){return this._getCache(f,this.__getRadialGradient)}__getRadialGradient(){var I=this.fillRadialGradientColorStops();if(I){for(var N=p(),q=this.fillRadialGradientStartPoint(),W=this.fillRadialGradientEndPoint(),K=N.createRadialGradient(q.x,q.y,this.fillRadialGradientStartRadius(),W.x,W.y,this.fillRadialGradientEndRadius()),it=0;it<I.length;it+=2)K.addColorStop(I[it],I[it+1]);return K}}getShadowRGBA(){return this._getCache(h,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var I=e.Util.colorToRGBA(this.shadowColor());if(I)return"rgba("+I.r+","+I.g+","+I.b+","+I.a*(this.shadowOpacity()||1)+")"}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const I=this.hitStrokeWidth();return I==="auto"?this.hasStroke():this.strokeEnabled()&&!!I}intersects(I){var N=this.getStage();if(!N)return!1;const q=N.bufferHitCanvas;return q.getContext().clear(),this.drawHit(q,void 0,!0),q.context.getImageData(Math.round(I.x),Math.round(I.y),1,1).data[3]>0}destroy(){return r.Node.prototype.destroy.call(this),delete i.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(I){var N;if(!this.getStage()||!((N=this.attrs.perfectDrawEnabled)!==null&&N!==void 0?N:!0))return!1;const W=I||this.hasFill(),K=this.hasStroke(),it=this.getAbsoluteOpacity()!==1;if(W&&K&&it)return!0;const pt=this.hasShadow(),vt=this.shadowForStrokeEnabled();return!!(W&&K&&pt&&vt)}setStrokeHitEnabled(I){e.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),I?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var I=this.size();return{x:this._centroid?-I.width/2:0,y:this._centroid?-I.height/2:0,width:I.width,height:I.height}}getClientRect(I={}){const N=I.skipTransform,q=I.relativeTo,W=this.getSelfRect(),it=!I.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,pt=W.width+it,vt=W.height+it,dt=!I.skipShadow&&this.hasShadow(),_t=dt?this.shadowOffsetX():0,yt=dt?this.shadowOffsetY():0,L=pt+Math.abs(_t),M=vt+Math.abs(yt),T=dt&&this.shadowBlur()||0,F=L+T*2,z=M+T*2,Y={width:F,height:z,x:-(it/2+T)+Math.min(_t,0)+W.x,y:-(it/2+T)+Math.min(yt,0)+W.y};return N?Y:this._transformedRect(Y,q)}drawScene(I,N){var q=this.getLayer(),W=I||q.getCanvas(),K=W.getContext(),it=this._getCanvasCache(),pt=this.getSceneFunc(),vt=this.hasShadow(),dt,_t,yt,L=W.isCache,M=N===this;if(!this.isVisible()&&!M)return this;if(it){K.save();var T=this.getAbsoluteTransform(N).getMatrix();return K.transform(T[0],T[1],T[2],T[3],T[4],T[5]),this._drawCachedSceneCanvas(K),K.restore(),this}if(!pt)return this;if(K.save(),this._useBufferCanvas()&&!L){dt=this.getStage(),_t=dt.bufferCanvas,yt=_t.getContext(),yt.clear(),yt.save(),yt._applyLineJoin(this);var F=this.getAbsoluteTransform(N).getMatrix();yt.transform(F[0],F[1],F[2],F[3],F[4],F[5]),pt.call(this,yt,this),yt.restore();var z=_t.pixelRatio;vt&&K._applyShadow(this),K._applyOpacity(this),K._applyGlobalCompositeOperation(this),K.drawImage(_t._canvas,0,0,_t.width/z,_t.height/z)}else{if(K._applyLineJoin(this),!M){var F=this.getAbsoluteTransform(N).getMatrix();K.transform(F[0],F[1],F[2],F[3],F[4],F[5]),K._applyOpacity(this),K._applyGlobalCompositeOperation(this)}vt&&K._applyShadow(this),pt.call(this,K,this)}return K.restore(),this}drawHit(I,N,q=!1){if(!this.shouldDrawHit(N,q))return this;var W=this.getLayer(),K=I||W.hitCanvas,it=K&&K.getContext(),pt=this.hitFunc()||this.sceneFunc(),vt=this._getCanvasCache(),dt=vt&&vt.hit;if(this.colorKey||e.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()"),dt){it.save();var _t=this.getAbsoluteTransform(N).getMatrix();return it.transform(_t[0],_t[1],_t[2],_t[3],_t[4],_t[5]),this._drawCachedHitCanvas(it),it.restore(),this}if(!pt)return this;if(it.save(),it._applyLineJoin(this),!(this===N)){var L=this.getAbsoluteTransform(N).getMatrix();it.transform(L[0],L[1],L[2],L[3],L[4],L[5])}return pt.call(this,it,this),it.restore(),this}drawHitFromCache(I=0){var N=this._getCanvasCache(),q=this._getCachedSceneCanvas(),W=N.hit,K=W.getContext(),it=W.getWidth(),pt=W.getHeight(),vt,dt,_t,yt,L,M;K.clear(),K.drawImage(q._canvas,0,0,it,pt);try{for(vt=K.getImageData(0,0,it,pt),dt=vt.data,_t=dt.length,yt=e.Util._hexToRgb(this.colorKey),L=0;L<_t;L+=4)M=dt[L+3],M>I?(dt[L]=yt.r,dt[L+1]=yt.g,dt[L+2]=yt.b,dt[L+3]=255):dt[L+3]=0;K.putImageData(vt,0,0)}catch(T){e.Util.error("Unable to draw hit graph from cached scene canvas. "+T.message)}return this}hasPointerCapture(I){return o.hasPointerCapture(I,this)}setPointerCapture(I){o.setPointerCapture(I,this)}releaseCapture(I){o.releaseCapture(I,this)}}i.Shape=P,P.prototype._fillFunc=m,P.prototype._strokeFunc=y,P.prototype._fillFuncHit=S,P.prototype._strokeFuncHit=C,P.prototype._centroid=!1,P.prototype.nodeType="Shape",(0,a._registerNode)(P),P.prototype.eventListeners={},P.prototype.on.call(P.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",_),P.prototype.on.call(P.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",w),P.prototype.on.call(P.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",k),P.prototype.on.call(P.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",A),P.prototype.on.call(P.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",R),n.Factory.addGetterSetter(P,"stroke",void 0,(0,s.getStringOrGradientValidator)()),n.Factory.addGetterSetter(P,"strokeWidth",2,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(P,"fillAfterStrokeEnabled",!1),n.Factory.addGetterSetter(P,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),n.Factory.addGetterSetter(P,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),n.Factory.addGetterSetter(P,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),n.Factory.addGetterSetter(P,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),n.Factory.addGetterSetter(P,"lineJoin"),n.Factory.addGetterSetter(P,"lineCap"),n.Factory.addGetterSetter(P,"sceneFunc"),n.Factory.addGetterSetter(P,"hitFunc"),n.Factory.addGetterSetter(P,"dash"),n.Factory.addGetterSetter(P,"dashOffset",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(P,"shadowColor",void 0,(0,s.getStringValidator)()),n.Factory.addGetterSetter(P,"shadowBlur",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(P,"shadowOpacity",1,(0,s.getNumberValidator)()),n.Factory.addComponentsGetterSetter(P,"shadowOffset",["x","y"]),n.Factory.addGetterSetter(P,"shadowOffsetX",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(P,"shadowOffsetY",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(P,"fillPatternImage"),n.Factory.addGetterSetter(P,"fill",void 0,(0,s.getStringOrGradientValidator)()),n.Factory.addGetterSetter(P,"fillPatternX",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(P,"fillPatternY",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(P,"fillLinearGradientColorStops"),n.Factory.addGetterSetter(P,"strokeLinearGradientColorStops"),n.Factory.addGetterSetter(P,"fillRadialGradientStartRadius",0),n.Factory.addGetterSetter(P,"fillRadialGradientEndRadius",0),n.Factory.addGetterSetter(P,"fillRadialGradientColorStops"),n.Factory.addGetterSetter(P,"fillPatternRepeat","repeat"),n.Factory.addGetterSetter(P,"fillEnabled",!0),n.Factory.addGetterSetter(P,"strokeEnabled",!0),n.Factory.addGetterSetter(P,"shadowEnabled",!0),n.Factory.addGetterSetter(P,"dashEnabled",!0),n.Factory.addGetterSetter(P,"strokeScaleEnabled",!0),n.Factory.addGetterSetter(P,"fillPriority","color"),n.Factory.addComponentsGetterSetter(P,"fillPatternOffset",["x","y"]),n.Factory.addGetterSetter(P,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(P,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),n.Factory.addComponentsGetterSetter(P,"fillPatternScale",["x","y"]),n.Factory.addGetterSetter(P,"fillPatternScaleX",1,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(P,"fillPatternScaleY",1,(0,s.getNumberValidator)()),n.Factory.addComponentsGetterSetter(P,"fillLinearGradientStartPoint",["x","y"]),n.Factory.addComponentsGetterSetter(P,"strokeLinearGradientStartPoint",["x","y"]),n.Factory.addGetterSetter(P,"fillLinearGradientStartPointX",0),n.Factory.addGetterSetter(P,"strokeLinearGradientStartPointX",0),n.Factory.addGetterSetter(P,"fillLinearGradientStartPointY",0),n.Factory.addGetterSetter(P,"strokeLinearGradientStartPointY",0),n.Factory.addComponentsGetterSetter(P,"fillLinearGradientEndPoint",["x","y"]),n.Factory.addComponentsGetterSetter(P,"strokeLinearGradientEndPoint",["x","y"]),n.Factory.addGetterSetter(P,"fillLinearGradientEndPointX",0),n.Factory.addGetterSetter(P,"strokeLinearGradientEndPointX",0),n.Factory.addGetterSetter(P,"fillLinearGradientEndPointY",0),n.Factory.addGetterSetter(P,"strokeLinearGradientEndPointY",0),n.Factory.addComponentsGetterSetter(P,"fillRadialGradientStartPoint",["x","y"]),n.Factory.addGetterSetter(P,"fillRadialGradientStartPointX",0),n.Factory.addGetterSetter(P,"fillRadialGradientStartPointY",0),n.Factory.addComponentsGetterSetter(P,"fillRadialGradientEndPoint",["x","y"]),n.Factory.addGetterSetter(P,"fillRadialGradientEndPointX",0),n.Factory.addGetterSetter(P,"fillRadialGradientEndPointY",0),n.Factory.addGetterSetter(P,"fillPatternRotation",0),n.Factory.addGetterSetter(P,"fillRule",void 0,(0,s.getStringValidator)()),n.Factory.backCompat(P,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(zl);const pe=St(xt({__proto__:null,default:Ee(zl)},[zl]));Object.defineProperty(Xr,"__esModule",{value:!0});var Nd=Xr.Layer=void 0;const gi=ee,Hl=Ga,Bn=oe,jl=It,Ud=Ia,A3=Ft,P3=pe,M3=Ot;var R3="#",L3="beforeDraw",D3="draw",Bd=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],I3=Bd.length;class Gn extends Hl.Container{constructor(t){super(t),this.canvas=new Ud.SceneCanvas,this.hitCanvas=new Ud.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),t<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[t+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){Bn.Node.prototype.moveToTop.call(this);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){var t=Bn.Node.prototype.moveUp.call(this);if(!t)return!1;var e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(Bn.Node.prototype.moveDown.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(Bn.Node.prototype.moveToBottom.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var t=this.getNativeCanvasElement();return Bn.Node.prototype.remove.call(this),t&&t.parentNode&&gi.Util._isInDocument(t)&&t.parentNode.removeChild(t),this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&gi.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(t){return t=t||{},t.width=t.width||this.getWidth(),t.height=t.height||this.getHeight(),t.x=t.x!==void 0?t.x:this.x(),t.y=t.y!==void 0?t.y:this.y(),Bn.Node.prototype._toKonvaCanvas.call(this,t)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){gi.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){gi.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,gi.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var e=1,n=!1;;){for(let r=0;r<I3;r++){const s=Bd[r],a=this._getIntersection({x:t.x+s.x*e,y:t.y+s.y*e}),o=a.shape;if(o)return o;if(n=!!a.antialiased,!a.antialiased)break}if(n)e+=1;else return null}}_getIntersection(t){const e=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(t.x*e),Math.round(t.y*e),1,1).data,r=n[3];if(r===255){const s=gi.Util._rgbToHex(n[0],n[1],n[2]),a=P3.shapes[R3+s];return a?{shape:a}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(t,e){var n=this.getLayer(),r=t||n&&n.getCanvas();return this._fire(L3,{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),Hl.Container.prototype.drawScene.call(this,r,e),this._fire(D3,{node:this}),this}drawHit(t,e){var n=this.getLayer(),r=t||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),Hl.Container.prototype.drawHit.call(this,r,e),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){gi.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return gi.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,e=!!this.hitCanvas._canvas.parentNode;e?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return gi.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Nd=Xr.Layer=Gn,Gn.prototype.nodeType="Layer",(0,M3._registerNode)(Gn),jl.Factory.addGetterSetter(Gn,"imageSmoothingEnabled",!0),jl.Factory.addGetterSetter(Gn,"clearBeforeDraw",!0),jl.Factory.addGetterSetter(Gn,"hitGraphEnabled",!0,(0,A3.getBooleanValidator)());const Gd=St(xt({__proto__:null,get Layer(){return Nd},default:Xr},[Xr]));var Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});var $d=Yr.FastLayer=void 0;const O3=ee,F3=Gd,N3=Ot;class Vl extends F3.Layer{constructor(t){super(t),this.listening(!1),O3.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}$d=Yr.FastLayer=Vl,Vl.prototype.nodeType="FastLayer",(0,N3._registerNode)(Vl);const U3=St(xt({__proto__:null,get FastLayer(){return $d},default:Yr},[Yr]));var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});var zd=Wr.Group=void 0;const B3=ee,G3=Ga,$3=Ot;class ql extends G3.Container{_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&B3.Util.throw("You may only add groups and shapes to groups.")}}zd=Wr.Group=ql,ql.prototype.nodeType="Group",(0,$3._registerNode)(ql);const Xl=St(xt({__proto__:null,get Group(){return zd},default:Wr},[Wr]));var Kr={};Object.defineProperty(Kr,"__esModule",{value:!0});var Hd=Kr.Animation=void 0;const Yl=Ot,jd=ee,Wl=function(){return Yl.glob.performance&&Yl.glob.performance.now?function(){return Yl.glob.performance.now()}:function(){return new Date().getTime()}}();class Ke{constructor(t,e){this.id=Ke.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Wl(),frameRate:0},this.func=t,this.setLayers(e)}setLayers(t){let e=[];return t&&(e=Array.isArray(t)?t:[t]),this.layers=e,this}getLayers(){return this.layers}addLayer(t){const e=this.layers,n=e.length;for(let r=0;r<n;r++)if(e[r]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const e=Ke.animations,n=e.length;for(let r=0;r<n;r++)if(e[r].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=Wl(),Ke._addAnimation(this),this}stop(){return Ke._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const e=t.id,n=this.animations,r=n.length;for(let s=0;s<r;s++)if(n[s].id===e){this.animations.splice(s,1);break}}static _runFrames(){const t={},e=this.animations;for(let n=0;n<e.length;n++){const r=e[n],s=r.layers,a=r.func;r._updateFrameObject(Wl());const o=s.length;let l;if(a?l=a.call(r,r.frame)!==!1:l=!0,!!l)for(let h=0;h<o;h++){const c=s[h];c._id!==void 0&&(t[c._id]=c)}}for(let n in t)t.hasOwnProperty(n)&&t[n].batchDraw()}static _animationLoop(){const t=Ke;t.animations.length?(t._runFrames(),jd.Util.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,jd.Util.requestAnimFrame(this._animationLoop))}}Hd=Kr.Animation=Ke,Ke.animations=[],Ke.animIdCounter=0,Ke.animRunning=!1;const Kl=St(xt({__proto__:null,get Animation(){return Hd},default:Kr},[Kr]));var Zl={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Easings=i.Tween=void 0;const t=ee,e=Kl,n=oe,r=Ot;var s={node:1,duration:1,easing:1,onFinish:1,yoyo:1},a=1,o=2,l=3,h=0,c=["fill","stroke","shadowColor"];class d{constructor(p,m,y,S,C,_,w){this.prop=p,this.propFunc=m,this.begin=S,this._pos=S,this.duration=_,this._change=0,this.prevPos=0,this.yoyo=w,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=y,this._change=C-this.begin,this.pause()}fire(p){var m=this[p];m&&m()}setTime(p){p>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=o,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(p){this.pause(),this._time=p,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(){var p=this.getTimer()-this._startTime;this.state===o?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var m=this,y=p.node,S=y._id,C,_=p.easing||i.Easings.Linear,w=!!p.yoyo,k;typeof p.duration>"u"?C=.3:p.duration===0?C=.001:C=p.duration,this.node=y,this._id=h++;var A=y.getLayer()||(y instanceof r.Konva.Stage?y.getLayers():null);A||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new e.Animation(function(){m.tween.onEnterFrame()},A),this.tween=new d(k,function(R){m._tweenFunc(R)},_,0,1,C*1e3,w),this._addListeners(),f.attrs[S]||(f.attrs[S]={}),f.attrs[S][this._id]||(f.attrs[S][this._id]={}),f.tweens[S]||(f.tweens[S]={});for(k in p)s[k]===void 0&&this._addAttr(k,p[k]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,m){var y=this.node,S=y._id,C,_,w,k,A,R,P,U;if(w=f.tweens[S][p],w&&delete f.attrs[S][w][p],C=y.getAttr(p),t.Util._isArray(m))if(_=[],A=Math.max(m.length,C.length),p==="points"&&m.length!==C.length&&(m.length>C.length?(P=C,C=t.Util._prepareArrayForTween(C,m,y.closed())):(R=m,m=t.Util._prepareArrayForTween(m,C,y.closed()))),p.indexOf("fill")===0)for(k=0;k<A;k++)if(k%2===0)_.push(m[k]-C[k]);else{var I=t.Util.colorToRGBA(C[k]);U=t.Util.colorToRGBA(m[k]),C[k]=I,_.push({r:U.r-I.r,g:U.g-I.g,b:U.b-I.b,a:U.a-I.a})}else for(k=0;k<A;k++)_.push(m[k]-C[k]);else c.indexOf(p)!==-1?(C=t.Util.colorToRGBA(C),U=t.Util.colorToRGBA(m),_={r:U.r-C.r,g:U.g-C.g,b:U.b-C.b,a:U.a-C.a}):_=m-C;f.attrs[S][this._id][p]={start:C,diff:_,end:m,trueEnd:R,trueStart:P},f.tweens[S][p]=this._id}_tweenFunc(p){var m=this.node,y=f.attrs[m._id][this._id],S,C,_,w,k,A,R,P;for(S in y){if(C=y[S],_=C.start,w=C.diff,P=C.end,t.Util._isArray(_))if(k=[],R=Math.max(_.length,P.length),S.indexOf("fill")===0)for(A=0;A<R;A++)A%2===0?k.push((_[A]||0)+w[A]*p):k.push("rgba("+Math.round(_[A].r+w[A].r*p)+","+Math.round(_[A].g+w[A].g*p)+","+Math.round(_[A].b+w[A].b*p)+","+(_[A].a+w[A].a*p)+")");else for(A=0;A<R;A++)k.push((_[A]||0)+w[A]*p);else c.indexOf(S)!==-1?k="rgba("+Math.round(_.r+w.r*p)+","+Math.round(_.g+w.g*p)+","+Math.round(_.b+w.b*p)+","+(_.a+w.a*p)+")":k=_+w*p;m.setAttr(S,k)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueEnd&&p.setAttr("points",m.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueStart&&p.points(m.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var p=this.node._id,m=this._id,y=f.tweens[p],S;this.pause();for(S in y)delete f.tweens[p][S];delete f.attrs[p][m]}}i.Tween=f,f.attrs={},f.tweens={},n.Node.prototype.to=function(u){var p=u.onFinish;u.node=this,u.onFinish=function(){this.destroy(),p&&p()};var m=new f(u);m.play()},i.Easings={BackEaseIn(u,p,m,y){var S=1.70158;return m*(u/=y)*u*((S+1)*u-S)+p},BackEaseOut(u,p,m,y){var S=1.70158;return m*((u=u/y-1)*u*((S+1)*u+S)+1)+p},BackEaseInOut(u,p,m,y){var S=1.70158;return(u/=y/2)<1?m/2*(u*u*(((S*=1.525)+1)*u-S))+p:m/2*((u-=2)*u*(((S*=1.525)+1)*u+S)+2)+p},ElasticEaseIn(u,p,m,y,S,C){var _=0;return u===0?p:(u/=y)===1?p+m:(C||(C=y*.3),!S||S<Math.abs(m)?(S=m,_=C/4):_=C/(2*Math.PI)*Math.asin(m/S),-(S*Math.pow(2,10*(u-=1))*Math.sin((u*y-_)*(2*Math.PI)/C))+p)},ElasticEaseOut(u,p,m,y,S,C){var _=0;return u===0?p:(u/=y)===1?p+m:(C||(C=y*.3),!S||S<Math.abs(m)?(S=m,_=C/4):_=C/(2*Math.PI)*Math.asin(m/S),S*Math.pow(2,-10*u)*Math.sin((u*y-_)*(2*Math.PI)/C)+m+p)},ElasticEaseInOut(u,p,m,y,S,C){var _=0;return u===0?p:(u/=y/2)===2?p+m:(C||(C=y*.44999999999999996),!S||S<Math.abs(m)?(S=m,_=C/4):_=C/(2*Math.PI)*Math.asin(m/S),u<1?-.5*(S*Math.pow(2,10*(u-=1))*Math.sin((u*y-_)*(2*Math.PI)/C))+p:S*Math.pow(2,-10*(u-=1))*Math.sin((u*y-_)*(2*Math.PI)/C)*.5+m+p)},BounceEaseOut(u,p,m,y){return(u/=y)<.36363636363636365?m*(7.5625*u*u)+p:u<.7272727272727273?m*(7.5625*(u-=.5454545454545454)*u+.75)+p:u<.9090909090909091?m*(7.5625*(u-=.8181818181818182)*u+.9375)+p:m*(7.5625*(u-=.9545454545454546)*u+.984375)+p},BounceEaseIn(u,p,m,y){return m-i.Easings.BounceEaseOut(y-u,0,m,y)+p},BounceEaseInOut(u,p,m,y){return u<y/2?i.Easings.BounceEaseIn(u*2,0,m,y)*.5+p:i.Easings.BounceEaseOut(u*2-y,0,m,y)*.5+m*.5+p},EaseIn(u,p,m,y){return m*(u/=y)*u+p},EaseOut(u,p,m,y){return-m*(u/=y)*(u-2)+p},EaseInOut(u,p,m,y){return(u/=y/2)<1?m/2*u*u+p:-m/2*(--u*(u-2)-1)+p},StrongEaseIn(u,p,m,y){return m*(u/=y)*u*u*u*u+p},StrongEaseOut(u,p,m,y){return m*((u=u/y-1)*u*u*u*u+1)+p},StrongEaseInOut(u,p,m,y){return(u/=y/2)<1?m/2*u*u*u*u*u+p:m/2*((u-=2)*u*u*u*u+2)+p},Linear(u,p,m,y){return m*u/y+p}}})(Zl);const z3=St(xt({__proto__:null,default:Ee(Zl)},[Zl]));(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Konva=void 0;const t=Ot,e=ee,n=oe,r=Ga,s=E3,a=Gd,o=U3,l=Xl,h=Fl,c=pe,d=Kl,f=z3,u=pd,p=Ia;i.Konva=e.Util._assign(t.Konva,{Util:e.Util,Transform:e.Transform,Node:n.Node,Container:r.Container,Stage:s.Stage,stages:s.stages,Layer:a.Layer,FastLayer:o.FastLayer,Group:l.Group,DD:h.DD,Shape:c.Shape,shapes:c.shapes,Animation:d.Animation,Tween:f.Tween,Easings:f.Easings,Context:u.Context,Canvas:p.Canvas}),i.default=i.Konva})(Rl);const H3=St(xt({__proto__:null,default:Ee(Rl)},[Rl]));var Zr={};Object.defineProperty(Zr,"__esModule",{value:!0});var Vd=Zr.Arc=void 0;const $a=It,j3=pe,qd=Ot,za=Ft,V3=Ot;class pi extends j3.Shape{_sceneFunc(t){var e=qd.Konva.getAngle(this.angle()),n=this.clockwise();t.beginPath(),t.arc(0,0,this.outerRadius(),0,e,n),t.arc(0,0,this.innerRadius(),e,0,!n),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}getSelfRect(){const t=this.innerRadius(),e=this.outerRadius(),n=this.clockwise(),r=qd.Konva.getAngle(n?360-this.angle():this.angle()),s=Math.cos(Math.min(r,Math.PI)),a=1,o=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),l=Math.sin(Math.min(r,Math.PI/2)),h=s*(s>0?t:e),c=a*e,d=o*(o>0?t:e),f=l*(l>0?e:t);return{x:h,y:n?-1*f:d,width:c-h,height:f-d}}}Vd=Zr.Arc=pi,pi.prototype._centroid=!0,pi.prototype.className="Arc",pi.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,V3._registerNode)(pi),$a.Factory.addGetterSetter(pi,"innerRadius",0,(0,za.getNumberValidator)()),$a.Factory.addGetterSetter(pi,"outerRadius",0,(0,za.getNumberValidator)()),$a.Factory.addGetterSetter(pi,"angle",0,(0,za.getNumberValidator)()),$a.Factory.addGetterSetter(pi,"clockwise",!1,(0,za.getBooleanValidator)());const q3=St(xt({__proto__:null,get Arc(){return Vd},default:Zr},[Zr]));var Jr={},Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});var Xd=Qr.Line=void 0;const Ha=It,X3=pe,Yd=Ft,Y3=Ot;function Jl(i,t,e,n,r,s,a){var o=Math.sqrt(Math.pow(e-i,2)+Math.pow(n-t,2)),l=Math.sqrt(Math.pow(r-e,2)+Math.pow(s-n,2)),h=a*o/(o+l),c=a*l/(o+l),d=e-h*(r-i),f=n-h*(s-t),u=e+c*(r-i),p=n+c*(s-t);return[d,f,u,p]}function Wd(i,t){var e=i.length,n=[],r,s;for(r=2;r<e-2;r+=2)s=Jl(i[r-2],i[r-1],i[r],i[r+1],i[r+2],i[r+3],t),!isNaN(s[0])&&(n.push(s[0]),n.push(s[1]),n.push(i[r]),n.push(i[r+1]),n.push(s[2]),n.push(s[3]));return n}class Li extends X3.Shape{constructor(t){super(t),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(t){var e=this.points(),n=e.length,r=this.tension(),s=this.closed(),a=this.bezier(),o,l,h;if(n){if(t.beginPath(),t.moveTo(e[0],e[1]),r!==0&&n>4){for(o=this.getTensionPoints(),l=o.length,h=s?0:4,s||t.quadraticCurveTo(o[0],o[1],o[2],o[3]);h<l-2;)t.bezierCurveTo(o[h++],o[h++],o[h++],o[h++],o[h++],o[h++]);s||t.quadraticCurveTo(o[l-2],o[l-1],e[n-2],e[n-1])}else if(a)for(h=2;h<n;)t.bezierCurveTo(e[h++],e[h++],e[h++],e[h++],e[h++],e[h++]);else for(h=2;h<n;h+=2)t.lineTo(e[h],e[h+1]);s?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():Wd(this.points(),this.tension())}_getTensionPointsClosed(){var t=this.points(),e=t.length,n=this.tension(),r=Jl(t[e-2],t[e-1],t[0],t[1],t[2],t[3],n),s=Jl(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],n),a=Wd(t,n),o=[r[2],r[3]].concat(a).concat([s[0],s[1],t[e-2],t[e-1],s[2],s[3],r[0],r[1],t[0],t[1]]);return o}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};this.tension()!==0?t=[t[0],t[1],...this._getTensionPoints(),t[t.length-2],t[t.length-1]]:t=this.points();for(var e=t[0],n=t[0],r=t[1],s=t[1],a,o,l=0;l<t.length/2;l++)a=t[l*2],o=t[l*2+1],e=Math.min(e,a),n=Math.max(n,a),r=Math.min(r,o),s=Math.max(s,o);return{x:e,y:r,width:n-e,height:s-r}}}Xd=Qr.Line=Li,Li.prototype.className="Line",Li.prototype._attrsAffectingSize=["points","bezier","tension"],(0,Y3._registerNode)(Li),Ha.Factory.addGetterSetter(Li,"closed",!1),Ha.Factory.addGetterSetter(Li,"bezier",!1),Ha.Factory.addGetterSetter(Li,"tension",0,(0,Yd.getNumberValidator)()),Ha.Factory.addGetterSetter(Li,"points",[],(0,Yd.getNumberArrayValidator)());const Kd=St(xt({__proto__:null,get Line(){return Xd},default:Qr},[Qr]));var ts={},Ql={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.t2length=i.getQuadraticArcLength=i.getCubicArcLength=i.binomialCoefficients=i.cValues=i.tValues=void 0,i.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],i.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],i.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const t=(a,o,l)=>{let h,c,d;h=l/2,c=0;for(let u=0;u<20;u++)d=h*i.tValues[20][u]+h,c+=i.cValues[20][u]*n(a,o,d);return h*c};i.getCubicArcLength=t;const e=(a,o,l)=>{l===void 0&&(l=1);const h=a[0]-2*a[1]+a[2],c=o[0]-2*o[1]+o[2],d=2*a[1]-2*a[0],f=2*o[1]-2*o[0],u=4*(h*h+c*c),p=4*(h*d+c*f),m=d*d+f*f;if(u===0)return l*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(o[2]-o[0],2));const y=p/(2*u),S=m/u,C=l+y,_=S-y*y,w=C*C+_>0?Math.sqrt(C*C+_):0,k=y*y+_>0?Math.sqrt(y*y+_):0,A=y+Math.sqrt(y*y+_)!==0?_*Math.log(Math.abs((C+w)/(y+k))):0;return Math.sqrt(u)/2*(C*w-y*k+A)};i.getQuadraticArcLength=e;function n(a,o,l){const h=r(1,l,a),c=r(1,l,o),d=h*h+c*c;return Math.sqrt(d)}const r=(a,o,l)=>{const h=l.length-1;let c,d;if(h===0)return 0;if(a===0){d=0;for(let f=0;f<=h;f++)d+=i.binomialCoefficients[h][f]*Math.pow(1-o,h-f)*Math.pow(o,f)*l[f];return d}else{c=new Array(h);for(let f=0;f<h;f++)c[f]=h*(l[f+1]-l[f]);return r(a-1,o,c)}},s=(a,o,l)=>{let h=1,c=a/o,d=(a-l(c))/o,f=0;for(;h>.001;){const u=l(c+d),p=Math.abs(a-u)/o;if(p<h)h=p,c+=d;else{const m=l(c-d),y=Math.abs(a-m)/o;y<h?(h=y,c-=d):d/=2}if(f++,f>500)break}return c};i.t2length=s})(Ql);const W3=St(xt({__proto__:null,default:Ee(Ql)},[Ql]));Object.defineProperty(ts,"__esModule",{value:!0});var Zd=ts.Path=void 0;const K3=It,Z3=pe,J3=Ot,$n=W3;class ce extends Z3.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ce.parsePathData(this.data()),this.pathLength=ce.getPathLength(this.dataArray)}_sceneFunc(t){var e=this.dataArray;t.beginPath();for(var n=!1,r=0;r<e.length;r++){var s=e[r].command,a=e[r].points;switch(s){case"L":t.lineTo(a[0],a[1]);break;case"M":t.moveTo(a[0],a[1]);break;case"C":t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"Q":t.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case"A":var o=a[0],l=a[1],h=a[2],c=a[3],d=a[4],f=a[5],u=a[6],p=a[7],m=h>c?h:c,y=h>c?1:h/c,S=h>c?c/h:1;t.translate(o,l),t.rotate(u),t.scale(y,S),t.arc(0,0,m,d,d+f,1-p),t.scale(1/y,1/S),t.rotate(-u),t.translate(-o,-l);break;case"z":n=!0,t.closePath();break}}!n&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(h){if(h.command==="A"){var c=h.points[4],d=h.points[5],f=h.points[4]+d,u=Math.PI/180;if(Math.abs(c-f)<u&&(u=Math.abs(c-f)),d<0)for(let p=c-u;p>f;p-=u){const m=ce.getPointOnEllipticalArc(h.points[0],h.points[1],h.points[2],h.points[3],p,0);t.push(m.x,m.y)}else for(let p=c+u;p<f;p+=u){const m=ce.getPointOnEllipticalArc(h.points[0],h.points[1],h.points[2],h.points[3],p,0);t.push(m.x,m.y)}}else if(h.command==="C")for(let p=0;p<=1;p+=.01){const m=ce.getPointOnCubicBezier(p,h.start.x,h.start.y,h.points[0],h.points[1],h.points[2],h.points[3],h.points[4],h.points[5]);t.push(m.x,m.y)}else t=t.concat(h.points)});for(var e=t[0],n=t[0],r=t[1],s=t[1],a,o,l=0;l<t.length/2;l++)a=t[l*2],o=t[l*2+1],isNaN(a)||(e=Math.min(e,a),n=Math.max(n,a)),isNaN(o)||(r=Math.min(r,o),s=Math.max(s,o));return{x:e,y:r,width:n-e,height:s-r}}getLength(){return this.pathLength}getPointAtLength(t){return ce.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}static getPathLength(t){let e=0;for(var n=0;n<t.length;++n)e+=t[n].pathLength;return e}static getPointAtLengthOfDataArray(t,e){var n,r=0,s=e.length;if(!s)return null;for(;r<s&&t>e[r].pathLength;)t-=e[r].pathLength,++r;if(r===s)return n=e[r-1].points.slice(-2),{x:n[0],y:n[1]};if(t<.01)return n=e[r].points.slice(0,2),{x:n[0],y:n[1]};var a=e[r],o=a.points;switch(a.command){case"L":return ce.getPointOnLine(t,a.start.x,a.start.y,o[0],o[1]);case"C":return ce.getPointOnCubicBezier((0,$n.t2length)(t,ce.getPathLength(e),m=>(0,$n.getCubicArcLength)([a.start.x,o[0],o[2],o[4]],[a.start.y,o[1],o[3],o[5]],m)),a.start.x,a.start.y,o[0],o[1],o[2],o[3],o[4],o[5]);case"Q":return ce.getPointOnQuadraticBezier((0,$n.t2length)(t,ce.getPathLength(e),m=>(0,$n.getQuadraticArcLength)([a.start.x,o[0],o[2]],[a.start.y,o[1],o[3]],m)),a.start.x,a.start.y,o[0],o[1],o[2],o[3]);case"A":var l=o[0],h=o[1],c=o[2],d=o[3],f=o[4],u=o[5],p=o[6];return f+=u*t/a.pathLength,ce.getPointOnEllipticalArc(l,h,c,d,f,p)}return null}static getPointOnLine(t,e,n,r,s,a,o){a===void 0&&(a=e),o===void 0&&(o=n);var l=(s-n)/(r-e+1e-8),h=Math.sqrt(t*t/(1+l*l));r<e&&(h*=-1);var c=l*h,d;if(r===e)d={x:a,y:o+c};else if((o-n)/(a-e+1e-8)===l)d={x:a+h,y:o+c};else{var f,u,p=this.getLineLength(e,n,r,s),m=(a-e)*(r-e)+(o-n)*(s-n);m=m/(p*p),f=e+m*(r-e),u=n+m*(s-n);var y=this.getLineLength(a,o,f,u),S=Math.sqrt(t*t-y*y);h=Math.sqrt(S*S/(1+l*l)),r<e&&(h*=-1),c=l*h,d={x:f+h,y:u+c}}return d}static getPointOnCubicBezier(t,e,n,r,s,a,o,l,h){function c(y){return y*y*y}function d(y){return 3*y*y*(1-y)}function f(y){return 3*y*(1-y)*(1-y)}function u(y){return(1-y)*(1-y)*(1-y)}var p=l*c(t)+a*d(t)+r*f(t)+e*u(t),m=h*c(t)+o*d(t)+s*f(t)+n*u(t);return{x:p,y:m}}static getPointOnQuadraticBezier(t,e,n,r,s,a,o){function l(u){return u*u}function h(u){return 2*u*(1-u)}function c(u){return(1-u)*(1-u)}var d=a*l(t)+r*h(t)+e*c(t),f=o*l(t)+s*h(t)+n*c(t);return{x:d,y:f}}static getPointOnEllipticalArc(t,e,n,r,s,a){var o=Math.cos(a),l=Math.sin(a),h={x:n*Math.cos(s),y:r*Math.sin(s)};return{x:t+(h.x*o-h.y*l),y:e+(h.x*l+h.y*o)}}static parsePathData(t){if(!t)return[];var e=t,n=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];e=e.replace(new RegExp(" ","g"),",");for(var r=0;r<n.length;r++)e=e.replace(new RegExp(n[r],"g"),"|"+n[r]);var s=e.split("|"),a=[],o=[],l=0,h=0,c=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,d;for(r=1;r<s.length;r++){var f=s[r],u=f.charAt(0);for(f=f.slice(1),o.length=0;d=c.exec(f);)o.push(d[0]);for(var p=[],m=0,y=o.length;m<y;m++){if(o[m]==="00"){p.push(0,0);continue}var S=parseFloat(o[m]);isNaN(S)?p.push(0):p.push(S)}for(;p.length>0&&!isNaN(p[0]);){var C="",_=[],w=l,k=h,A,R,P,U,I,N,q,W,K,it;switch(u){case"l":l+=p.shift(),h+=p.shift(),C="L",_.push(l,h);break;case"L":l=p.shift(),h=p.shift(),_.push(l,h);break;case"m":var pt=p.shift(),vt=p.shift();if(l+=pt,h+=vt,C="M",a.length>2&&a[a.length-1].command==="z"){for(var dt=a.length-2;dt>=0;dt--)if(a[dt].command==="M"){l=a[dt].points[0]+pt,h=a[dt].points[1]+vt;break}}_.push(l,h),u="l";break;case"M":l=p.shift(),h=p.shift(),C="M",_.push(l,h),u="L";break;case"h":l+=p.shift(),C="L",_.push(l,h);break;case"H":l=p.shift(),C="L",_.push(l,h);break;case"v":h+=p.shift(),C="L",_.push(l,h);break;case"V":h=p.shift(),C="L",_.push(l,h);break;case"C":_.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),h=p.shift(),_.push(l,h);break;case"c":_.push(l+p.shift(),h+p.shift(),l+p.shift(),h+p.shift()),l+=p.shift(),h+=p.shift(),C="C",_.push(l,h);break;case"S":R=l,P=h,A=a[a.length-1],A.command==="C"&&(R=l+(l-A.points[2]),P=h+(h-A.points[3])),_.push(R,P,p.shift(),p.shift()),l=p.shift(),h=p.shift(),C="C",_.push(l,h);break;case"s":R=l,P=h,A=a[a.length-1],A.command==="C"&&(R=l+(l-A.points[2]),P=h+(h-A.points[3])),_.push(R,P,l+p.shift(),h+p.shift()),l+=p.shift(),h+=p.shift(),C="C",_.push(l,h);break;case"Q":_.push(p.shift(),p.shift()),l=p.shift(),h=p.shift(),_.push(l,h);break;case"q":_.push(l+p.shift(),h+p.shift()),l+=p.shift(),h+=p.shift(),C="Q",_.push(l,h);break;case"T":R=l,P=h,A=a[a.length-1],A.command==="Q"&&(R=l+(l-A.points[0]),P=h+(h-A.points[1])),l=p.shift(),h=p.shift(),C="Q",_.push(R,P,l,h);break;case"t":R=l,P=h,A=a[a.length-1],A.command==="Q"&&(R=l+(l-A.points[0]),P=h+(h-A.points[1])),l+=p.shift(),h+=p.shift(),C="Q",_.push(R,P,l,h);break;case"A":U=p.shift(),I=p.shift(),N=p.shift(),q=p.shift(),W=p.shift(),K=l,it=h,l=p.shift(),h=p.shift(),C="A",_=this.convertEndpointToCenterParameterization(K,it,l,h,q,W,U,I,N);break;case"a":U=p.shift(),I=p.shift(),N=p.shift(),q=p.shift(),W=p.shift(),K=l,it=h,l+=p.shift(),h+=p.shift(),C="A",_=this.convertEndpointToCenterParameterization(K,it,l,h,q,W,U,I,N);break}a.push({command:C||u,points:_,start:{x:w,y:k},pathLength:this.calcLength(w,k,C||u,_)})}(u==="z"||u==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,e,n,r){var s,a,o,l,h=ce;switch(n){case"L":return h.getLineLength(t,e,r[0],r[1]);case"C":return(0,$n.getCubicArcLength)([t,r[0],r[2],r[4]],[e,r[1],r[3],r[5]],1);case"Q":return(0,$n.getQuadraticArcLength)([t,r[0],r[2]],[e,r[1],r[3]],1);case"A":s=0;var c=r[4],d=r[5],f=r[4]+d,u=Math.PI/180;if(Math.abs(c-f)<u&&(u=Math.abs(c-f)),a=h.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],c,0),d<0)for(l=c-u;l>f;l-=u)o=h.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],l,0),s+=h.getLineLength(a.x,a.y,o.x,o.y),a=o;else for(l=c+u;l<f;l+=u)o=h.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],l,0),s+=h.getLineLength(a.x,a.y,o.x,o.y),a=o;return o=h.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],f,0),s+=h.getLineLength(a.x,a.y,o.x,o.y),s}return 0}static convertEndpointToCenterParameterization(t,e,n,r,s,a,o,l,h){var c=h*(Math.PI/180),d=Math.cos(c)*(t-n)/2+Math.sin(c)*(e-r)/2,f=-1*Math.sin(c)*(t-n)/2+Math.cos(c)*(e-r)/2,u=d*d/(o*o)+f*f/(l*l);u>1&&(o*=Math.sqrt(u),l*=Math.sqrt(u));var p=Math.sqrt((o*o*(l*l)-o*o*(f*f)-l*l*(d*d))/(o*o*(f*f)+l*l*(d*d)));s===a&&(p*=-1),isNaN(p)&&(p=0);var m=p*o*f/l,y=p*-l*d/o,S=(t+n)/2+Math.cos(c)*m-Math.sin(c)*y,C=(e+r)/2+Math.sin(c)*m+Math.cos(c)*y,_=function(I){return Math.sqrt(I[0]*I[0]+I[1]*I[1])},w=function(I,N){return(I[0]*N[0]+I[1]*N[1])/(_(I)*_(N))},k=function(I,N){return(I[0]*N[1]<I[1]*N[0]?-1:1)*Math.acos(w(I,N))},A=k([1,0],[(d-m)/o,(f-y)/l]),R=[(d-m)/o,(f-y)/l],P=[(-1*d-m)/o,(-1*f-y)/l],U=k(R,P);return w(R,P)<=-1&&(U=Math.PI),w(R,P)>=1&&(U=0),a===0&&U>0&&(U=U-2*Math.PI),a===1&&U<0&&(U=U+2*Math.PI),[S,C,o,l,A,U,c,a]}}Zd=ts.Path=ce,ce.prototype.className="Path",ce.prototype._attrsAffectingSize=["data"],(0,J3._registerNode)(ce),K3.Factory.addGetterSetter(ce,"data");const th=St(xt({__proto__:null,get Path(){return Zd},default:ts},[ts]));Object.defineProperty(Jr,"__esModule",{value:!0});var Jd=Jr.Arrow=void 0;const ja=It,Q3=Kd,Qd=Ft,t4=Ot,t0=th;class on extends Q3.Line{_sceneFunc(t){super._sceneFunc(t);var e=Math.PI*2,n=this.points(),r=n,s=this.tension()!==0&&n.length>4;s&&(r=this.getTensionPoints());var a=this.pointerLength(),o=n.length,l,h;if(s){const f=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[o-2],n[o-1]],u=t0.Path.calcLength(r[r.length-4],r[r.length-3],"C",f),p=t0.Path.getPointOnQuadraticBezier(Math.min(1,1-a/u),f[0],f[1],f[2],f[3],f[4],f[5]);l=n[o-2]-p.x,h=n[o-1]-p.y}else l=n[o-2]-n[o-4],h=n[o-1]-n[o-3];var c=(Math.atan2(h,l)+e)%e,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(n[o-2],n[o-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(n[0],n[1]),s?(l=(r[0]+r[2])/2-n[0],h=(r[1]+r[3])/2-n[1]):(l=n[2]-n[0],h=n[3]-n[1]),t.rotate((Math.atan2(-h,-l)+e)%e),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var e=this.dashEnabled();e&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),e&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),e=this.pointerWidth()/2;return{x:t.x-e,y:t.y-e,width:t.width+e*2,height:t.height+e*2}}}Jd=Jr.Arrow=on,on.prototype.className="Arrow",(0,t4._registerNode)(on),ja.Factory.addGetterSetter(on,"pointerLength",10,(0,Qd.getNumberValidator)()),ja.Factory.addGetterSetter(on,"pointerWidth",10,(0,Qd.getNumberValidator)()),ja.Factory.addGetterSetter(on,"pointerAtBeginning",!1),ja.Factory.addGetterSetter(on,"pointerAtEnding",!0);const e4=St(xt({__proto__:null,get Arrow(){return Jd},default:Jr},[Jr]));var es={};Object.defineProperty(es,"__esModule",{value:!0});var e0=es.Circle=void 0;const i4=It,n4=pe,r4=Ft,s4=Ot;class zn extends n4.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}}e0=es.Circle=zn,zn.prototype._centroid=!0,zn.prototype.className="Circle",zn.prototype._attrsAffectingSize=["radius"],(0,s4._registerNode)(zn),i4.Factory.addGetterSetter(zn,"radius",0,(0,r4.getNumberValidator)());const a4=St(xt({__proto__:null,get Circle(){return e0},default:es},[es]));var is={};Object.defineProperty(is,"__esModule",{value:!0});var i0=is.Ellipse=void 0;const eh=It,o4=pe,n0=Ft,l4=Ot;class Di extends o4.Shape{_sceneFunc(t){var e=this.radiusX(),n=this.radiusY();t.beginPath(),t.save(),e!==n&&t.scale(1,n/e),t.arc(0,0,e,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}i0=is.Ellipse=Di,Di.prototype.className="Ellipse",Di.prototype._centroid=!0,Di.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,l4._registerNode)(Di),eh.Factory.addComponentsGetterSetter(Di,"radius",["x","y"]),eh.Factory.addGetterSetter(Di,"radiusX",0,(0,n0.getNumberValidator)()),eh.Factory.addGetterSetter(Di,"radiusY",0,(0,n0.getNumberValidator)());const h4=St(xt({__proto__:null,get Ellipse(){return i0},default:is},[is]));var ns={};Object.defineProperty(ns,"__esModule",{value:!0});var r0=ns.Image=void 0;const ih=ee,ln=It,c4=pe,u4=Ot,rs=Ft;let Ze=class ig extends c4.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const e=this.getWidth(),n=this.getHeight(),r=this.cornerRadius(),s=this.attrs.image;let a;if(s){const o=this.attrs.cropWidth,l=this.attrs.cropHeight;o&&l?a=[s,this.cropX(),this.cropY(),o,l,0,0,e,n]:a=[s,0,0,e,n]}(this.hasFill()||this.hasStroke()||r)&&(t.beginPath(),r?ih.Util.drawRoundedRectPath(t,e,n,r):t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)),s&&(r&&t.clip(),t.drawImage.apply(t,a))}_hitFunc(t){var e=this.width(),n=this.height(),r=this.cornerRadius();t.beginPath(),r?ih.Util.drawRoundedRectPath(t,e,n,r):t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,e;return(t=this.attrs.width)!==null&&t!==void 0?t:(e=this.image())===null||e===void 0?void 0:e.width}getHeight(){var t,e;return(t=this.attrs.height)!==null&&t!==void 0?t:(e=this.image())===null||e===void 0?void 0:e.height}static fromURL(t,e,n=null){var r=ih.Util.createImageElement();r.onload=function(){var s=new ig({image:r});e(s)},r.onerror=n,r.crossOrigin="Anonymous",r.src=t}};r0=ns.Image=Ze,Ze.prototype.className="Image",(0,u4._registerNode)(Ze),ln.Factory.addGetterSetter(Ze,"cornerRadius",0,(0,rs.getNumberOrArrayOfNumbersValidator)(4)),ln.Factory.addGetterSetter(Ze,"image"),ln.Factory.addComponentsGetterSetter(Ze,"crop",["x","y","width","height"]),ln.Factory.addGetterSetter(Ze,"cropX",0,(0,rs.getNumberValidator)()),ln.Factory.addGetterSetter(Ze,"cropY",0,(0,rs.getNumberValidator)()),ln.Factory.addGetterSetter(Ze,"cropWidth",0,(0,rs.getNumberValidator)()),ln.Factory.addGetterSetter(Ze,"cropHeight",0,(0,rs.getNumberValidator)());const f4=St(xt({__proto__:null,get Image(){return r0},default:ns},[ns]));var hn={};Object.defineProperty(hn,"__esModule",{value:!0});var s0=hn.Tag=l0=hn.Label=void 0;const Va=It,d4=pe,g4=Xl,nh=Ft,a0=Ot;var o0=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],p4="Change.konva",m4="none",rh="up",sh="right",ah="down",oh="left",v4=o0.length;class lh extends g4.Group{constructor(t){super(t),this.on("add.konva",function(e){this._addListeners(e.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var e=this,n,r=function(){e._sync()};for(n=0;n<v4;n++)t.on(o0[n]+p4,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var t=this.getText(),e=this.getTag(),n,r,s,a,o,l,h;if(t&&e){switch(n=t.width(),r=t.height(),s=e.pointerDirection(),a=e.pointerWidth(),h=e.pointerHeight(),o=0,l=0,s){case rh:o=n/2,l=-1*h;break;case sh:o=n+a,l=r/2;break;case ah:o=n/2,l=r+h;break;case oh:o=-1*a,l=r/2;break}e.setAttrs({x:-1*o,y:-1*l,width:n,height:r}),t.setAttrs({x:-1*o,y:-1*l})}}}var l0=hn.Label=lh;lh.prototype.className="Label",(0,a0._registerNode)(lh);class cn extends d4.Shape{_sceneFunc(t){var e=this.width(),n=this.height(),r=this.pointerDirection(),s=this.pointerWidth(),a=this.pointerHeight(),o=this.cornerRadius();let l=0,h=0,c=0,d=0;typeof o=="number"?l=h=c=d=Math.min(o,e/2,n/2):(l=Math.min(o[0]||0,e/2,n/2),h=Math.min(o[1]||0,e/2,n/2),d=Math.min(o[2]||0,e/2,n/2),c=Math.min(o[3]||0,e/2,n/2)),t.beginPath(),t.moveTo(l,0),r===rh&&(t.lineTo((e-s)/2,0),t.lineTo(e/2,-1*a),t.lineTo((e+s)/2,0)),t.lineTo(e-h,0),t.arc(e-h,h,h,Math.PI*3/2,0,!1),r===sh&&(t.lineTo(e,(n-a)/2),t.lineTo(e+s,n/2),t.lineTo(e,(n+a)/2)),t.lineTo(e,n-d),t.arc(e-d,n-d,d,0,Math.PI/2,!1),r===ah&&(t.lineTo((e+s)/2,n),t.lineTo(e/2,n+a),t.lineTo((e-s)/2,n)),t.lineTo(c,n),t.arc(c,n-c,c,Math.PI/2,Math.PI,!1),r===oh&&(t.lineTo(0,(n+a)/2),t.lineTo(-1*s,n/2),t.lineTo(0,(n-a)/2)),t.lineTo(0,l),t.arc(l,l,l,Math.PI,Math.PI*3/2,!1),t.closePath(),t.fillStrokeShape(this)}getSelfRect(){var t=0,e=0,n=this.pointerWidth(),r=this.pointerHeight(),s=this.pointerDirection(),a=this.width(),o=this.height();return s===rh?(e-=r,o+=r):s===ah?o+=r:s===oh?(t-=n*1.5,a+=n):s===sh&&(a+=n*1.5),{x:t,y:e,width:a,height:o}}}s0=hn.Tag=cn,cn.prototype.className="Tag",(0,a0._registerNode)(cn),Va.Factory.addGetterSetter(cn,"pointerDirection",m4),Va.Factory.addGetterSetter(cn,"pointerWidth",0,(0,nh.getNumberValidator)()),Va.Factory.addGetterSetter(cn,"pointerHeight",0,(0,nh.getNumberValidator)()),Va.Factory.addGetterSetter(cn,"cornerRadius",0,(0,nh.getNumberOrArrayOfNumbersValidator)(4));const _4=St(xt({__proto__:null,get Label(){return l0},get Tag(){return s0},default:hn},[hn]));var ss={};Object.defineProperty(ss,"__esModule",{value:!0});var h0=ss.Rect=void 0;const y4=It,b4=pe,w4=Ot,x4=ee,S4=Ft;class qa extends b4.Shape{_sceneFunc(t){var e=this.cornerRadius(),n=this.width(),r=this.height();t.beginPath(),e?x4.Util.drawRoundedRectPath(t,n,r,e):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}}h0=ss.Rect=qa,qa.prototype.className="Rect",(0,w4._registerNode)(qa),y4.Factory.addGetterSetter(qa,"cornerRadius",0,(0,S4.getNumberOrArrayOfNumbersValidator)(4));const c0=St(xt({__proto__:null,get Rect(){return h0},default:ss},[ss]));var as={};Object.defineProperty(as,"__esModule",{value:!0});var u0=as.RegularPolygon=void 0;const f0=It,C4=pe,d0=Ft,k4=Ot;class un extends C4.Shape{_sceneFunc(t){const e=this._getPoints();t.beginPath(),t.moveTo(e[0].x,e[0].y);for(var n=1;n<e.length;n++)t.lineTo(e[n].x,e[n].y);t.closePath(),t.fillStrokeShape(this)}_getPoints(){const t=this.attrs.sides,e=this.attrs.radius||0,n=[];for(var r=0;r<t;r++)n.push({x:e*Math.sin(r*2*Math.PI/t),y:-1*e*Math.cos(r*2*Math.PI/t)});return n}getSelfRect(){const t=this._getPoints();var e=t[0].x,n=t[0].y,r=t[0].x,s=t[0].y;return t.forEach(a=>{e=Math.min(e,a.x),n=Math.max(n,a.x),r=Math.min(r,a.y),s=Math.max(s,a.y)}),{x:e,y:r,width:n-e,height:s-r}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}u0=as.RegularPolygon=un,un.prototype.className="RegularPolygon",un.prototype._centroid=!0,un.prototype._attrsAffectingSize=["radius"],(0,k4._registerNode)(un),f0.Factory.addGetterSetter(un,"radius",0,(0,d0.getNumberValidator)()),f0.Factory.addGetterSetter(un,"sides",0,(0,d0.getNumberValidator)());const T4=St(xt({__proto__:null,get RegularPolygon(){return u0},default:as},[as]));var os={};Object.defineProperty(os,"__esModule",{value:!0});var g0=os.Ring=void 0;const p0=It,E4=pe,m0=Ft,A4=Ot;var v0=Math.PI*2;class fn extends E4.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,v0,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),v0,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}g0=os.Ring=fn,fn.prototype.className="Ring",fn.prototype._centroid=!0,fn.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,A4._registerNode)(fn),p0.Factory.addGetterSetter(fn,"innerRadius",0,(0,m0.getNumberValidator)()),p0.Factory.addGetterSetter(fn,"outerRadius",0,(0,m0.getNumberValidator)());const P4=St(xt({__proto__:null,get Ring(){return g0},default:os},[os]));var ls={};Object.defineProperty(ls,"__esModule",{value:!0});var _0=ls.Sprite=void 0;const dn=It,M4=pe,R4=Kl,y0=Ft,L4=Ot;class Je extends M4.Shape{constructor(t){super(t),this._updated=!0,this.anim=new R4.Animation(()=>{var e=this._updated;return this._updated=!1,e}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var e=this.animation(),n=this.frameIndex(),r=n*4,s=this.animations()[e],a=this.frameOffsets(),o=s[r+0],l=s[r+1],h=s[r+2],c=s[r+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,h,c),t.closePath(),t.fillStrokeShape(this)),d)if(a){var f=a[e],u=n*2;t.drawImage(d,o,l,h,c,f[u+0],f[u+1],h,c)}else t.drawImage(d,o,l,h,c,0,0,h,c)}_hitFunc(t){var e=this.animation(),n=this.frameIndex(),r=n*4,s=this.animations()[e],a=this.frameOffsets(),o=s[r+2],l=s[r+3];if(t.beginPath(),a){var h=a[e],c=n*2;t.rect(h[c+0],h[c+1],o,l)}else t.rect(0,0,o,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),e=this.animation(),n=this.animations(),r=n[e],s=r.length/4;t<s-1?this.frameIndex(t+1):this.frameIndex(0)}}_0=ls.Sprite=Je,Je.prototype.className="Sprite",(0,L4._registerNode)(Je),dn.Factory.addGetterSetter(Je,"animation"),dn.Factory.addGetterSetter(Je,"animations"),dn.Factory.addGetterSetter(Je,"frameOffsets"),dn.Factory.addGetterSetter(Je,"image"),dn.Factory.addGetterSetter(Je,"frameIndex",0,(0,y0.getNumberValidator)()),dn.Factory.addGetterSetter(Je,"frameRate",17,(0,y0.getNumberValidator)()),dn.Factory.backCompat(Je,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});const D4=St(xt({__proto__:null,get Sprite(){return _0},default:ls},[ls]));var hs={};Object.defineProperty(hs,"__esModule",{value:!0});var b0=hs.Star=void 0;const hh=It,I4=pe,ch=Ft,O4=Ot;class Ii extends I4.Shape{_sceneFunc(t){var e=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();t.beginPath(),t.moveTo(0,0-n);for(var s=1;s<r*2;s++){var a=s%2===0?n:e,o=a*Math.sin(s*Math.PI/r),l=-1*a*Math.cos(s*Math.PI/r);t.lineTo(o,l)}t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}b0=hs.Star=Ii,Ii.prototype.className="Star",Ii.prototype._centroid=!0,Ii.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,O4._registerNode)(Ii),hh.Factory.addGetterSetter(Ii,"numPoints",5,(0,ch.getNumberValidator)()),hh.Factory.addGetterSetter(Ii,"innerRadius",0,(0,ch.getNumberValidator)()),hh.Factory.addGetterSetter(Ii,"outerRadius",0,(0,ch.getNumberValidator)());const F4=St(xt({__proto__:null,get Star(){return b0},default:hs},[hs]));var gn={};Object.defineProperty(gn,"__esModule",{value:!0});var w0=gn.Text=S0=gn.stringToArray=void 0;const uh=ee,_e=It,N4=pe,Oi=Ft,U4=Ot;function x0(i){return Array.from(i)}var S0=gn.stringToArray=x0,Hn="auto",B4="center",C0="inherit",cs="justify",G4="Change.konva",$4="2d",k0="-",T0="left",z4="text",H4="Text",j4="top",V4="bottom",E0="middle",A0="normal",q4="px ",Xa=" ",X4="right",P0="rtl",Y4="word",W4="char",M0="none",fh="…",R0=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],K4=R0.length;function Z4(i){return i.split(",").map(t=>{t=t.trim();const e=t.indexOf(" ")>=0,n=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!n&&(t=`"${t}"`),t}).join(", ")}var Ya;function dh(){return Ya||(Ya=uh.Util.createCanvasElement().getContext($4),Ya)}function J4(i){i.fillText(this._partialText,this._partialTextX,this._partialTextY)}function Q4(i){i.setAttr("miterLimit",2),i.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function t6(i){return i=i||{},!i.fillLinearGradientColorStops&&!i.fillRadialGradientColorStops&&!i.fillPatternImage&&(i.fill=i.fill||"black"),i}class ne extends N4.Shape{constructor(t){super(t6(t)),this._partialTextX=0,this._partialTextY=0;for(var e=0;e<K4;e++)this.on(R0[e]+G4,this._setTextData);this._setTextData()}_sceneFunc(t){var e=this.textArr,n=e.length;if(this.text()){var r=this.padding(),s=this.fontSize(),a=this.lineHeight()*s,o=this.verticalAlign(),l=this.direction(),h=0,c=this.align(),d=this.getWidth(),f=this.letterSpacing(),u=this.fill(),p=this.textDecoration(),m=p.indexOf("underline")!==-1,y=p.indexOf("line-through")!==-1,S;l=l===C0?t.direction:l;var C=0,C=a/2,_=0,w=0;for(l===P0&&t.setAttr("direction",l),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",E0),t.setAttr("textAlign",T0),o===E0?h=(this.getHeight()-n*a-r*2)/2:o===V4&&(h=this.getHeight()-n*a-r*2),t.translate(r,h+r),S=0;S<n;S++){var _=0,w=0,k=e[S],A=k.text,R=k.width,P=k.lastInParagraph,U,I,N;if(t.save(),c===X4?_+=d-R-r*2:c===B4&&(_+=(d-R-r*2)/2),m){t.save(),t.beginPath(),t.moveTo(_,C+w+Math.round(s/2)),U=A.split(" ").length-1,I=U===0,N=c===cs&&!P?d-r*2:R,t.lineTo(_+Math.round(N),C+w+Math.round(s/2)),t.lineWidth=s/15;const vt=this._getLinearGradient();t.strokeStyle=vt||u,t.stroke(),t.restore()}if(y){t.save(),t.beginPath(),t.moveTo(_,C+w),U=A.split(" ").length-1,I=U===0,N=c===cs&&P&&!I?d-r*2:R,t.lineTo(_+Math.round(N),C+w),t.lineWidth=s/15;const vt=this._getLinearGradient();t.strokeStyle=vt||u,t.stroke(),t.restore()}if(l!==P0&&(f!==0||c===cs)){U=A.split(" ").length-1;for(var q=x0(A),W=0;W<q.length;W++){var K=q[W];K===" "&&!P&&c===cs&&(_+=(d-r*2-R)/U),this._partialTextX=_,this._partialTextY=C+w,this._partialText=K,t.fillStrokeShape(this),_+=this.measureSize(K).width+f}}else f!==0&&t.setAttr("letterSpacing",`${f}px`),this._partialTextX=_,this._partialTextY=C+w,this._partialText=A,t.fillStrokeShape(this);t.restore(),n>1&&(C+=a)}}}_hitFunc(t){var e=this.getWidth(),n=this.getHeight();t.beginPath(),t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)}setText(t){var e=uh.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(z4,e),this}getWidth(){var t=this.attrs.width===Hn||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===Hn||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return uh.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var e=dh(),n=this.fontSize(),r;return e.save(),e.font=this._getContextFont(),r=e.measureText(t),e.restore(),{width:r.width,height:n}}_getContextFont(){return this.fontStyle()+Xa+this.fontVariant()+Xa+(this.fontSize()+q4)+Z4(this.fontFamily())}_addTextLine(t){this.align()===cs&&(t=t.trim());var n=this._getTextWidth(t);return this.textArr.push({text:t,width:n,lastInParagraph:!1})}_getTextWidth(t){var e=this.letterSpacing(),n=t.length;return dh().measureText(t).width+(n?e*(n-1):0)}_setTextData(){var t=this.text().split(`
|
|
34
|
+
`),e=+this.fontSize(),n=0,r=this.lineHeight()*e,s=this.attrs.width,a=this.attrs.height,o=s!==Hn&&s!==void 0,l=a!==Hn&&a!==void 0,h=this.padding(),c=s-h*2,d=a-h*2,f=0,u=this.wrap(),p=u!==M0,m=u!==W4&&p,y=this.ellipsis();this.textArr=[],dh().font=this._getContextFont();for(var S=y?this._getTextWidth(fh):0,C=0,_=t.length;C<_;++C){var w=t[C],k=this._getTextWidth(w);if(o&&k>c)for(;w.length>0;){for(var A=0,R=w.length,P="",U=0;A<R;){var I=A+R>>>1,N=w.slice(0,I+1),q=this._getTextWidth(N)+S;q<=c?(A=I+1,P=N,U=q):R=I}if(P){if(m){var W,K=w[P.length],it=K===Xa||K===k0;it&&U<=c?W=P.length:W=Math.max(P.lastIndexOf(Xa),P.lastIndexOf(k0))+1,W>0&&(A=W,P=P.slice(0,A),U=this._getTextWidth(P))}P=P.trimRight(),this._addTextLine(P),n=Math.max(n,U),f+=r;var pt=this._shouldHandleEllipsis(f);if(pt){this._tryToAddEllipsisToLastLine();break}if(w=w.slice(A),w=w.trimLeft(),w.length>0&&(k=this._getTextWidth(w),k<=c)){this._addTextLine(w),f+=r,n=Math.max(n,k);break}}else break}else this._addTextLine(w),f+=r,n=Math.max(n,k),this._shouldHandleEllipsis(f)&&C<_-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),l&&f+r>d)break}this.textHeight=e,this.textWidth=n}_shouldHandleEllipsis(t){var e=+this.fontSize(),n=this.lineHeight()*e,r=this.attrs.height,s=r!==Hn&&r!==void 0,a=this.padding(),o=r-a*2,l=this.wrap(),h=l!==M0;return!h||s&&t+n>o}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,e=t!==Hn&&t!==void 0,n=this.padding(),r=t-n*2,s=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!s)){if(e){var o=this._getTextWidth(a.text+fh)<r;o||(a.text=a.text.slice(0,a.text.length-3))}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(a.text+fh)}}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const t=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,e=this.hasShadow();return t&&e?!0:super._useBufferCanvas()}}w0=gn.Text=ne,ne.prototype._fillFunc=J4,ne.prototype._strokeFunc=Q4,ne.prototype.className=H4,ne.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],(0,U4._registerNode)(ne),_e.Factory.overWriteSetter(ne,"width",(0,Oi.getNumberOrAutoValidator)()),_e.Factory.overWriteSetter(ne,"height",(0,Oi.getNumberOrAutoValidator)()),_e.Factory.addGetterSetter(ne,"direction",C0),_e.Factory.addGetterSetter(ne,"fontFamily","Arial"),_e.Factory.addGetterSetter(ne,"fontSize",12,(0,Oi.getNumberValidator)()),_e.Factory.addGetterSetter(ne,"fontStyle",A0),_e.Factory.addGetterSetter(ne,"fontVariant",A0),_e.Factory.addGetterSetter(ne,"padding",0,(0,Oi.getNumberValidator)()),_e.Factory.addGetterSetter(ne,"align",T0),_e.Factory.addGetterSetter(ne,"verticalAlign",j4),_e.Factory.addGetterSetter(ne,"lineHeight",1,(0,Oi.getNumberValidator)()),_e.Factory.addGetterSetter(ne,"wrap",Y4),_e.Factory.addGetterSetter(ne,"ellipsis",!1,(0,Oi.getBooleanValidator)()),_e.Factory.addGetterSetter(ne,"letterSpacing",0,(0,Oi.getNumberValidator)()),_e.Factory.addGetterSetter(ne,"text","",(0,Oi.getStringValidator)()),_e.Factory.addGetterSetter(ne,"textDecoration","");const L0=St(xt({__proto__:null,get Text(){return w0},default:gn,get stringToArray(){return S0}},[gn]));var us={};Object.defineProperty(us,"__esModule",{value:!0});var D0=us.TextPath=void 0;const gh=ee,$e=It,e6=pe,fs=th,ph=L0,I0=Ft,i6=Ot;var n6="",O0="normal";function F0(i){i.fillText(this.partialText,0,0)}function N0(i){i.strokeText(this.partialText,0,0)}class ue extends e6.Shape{constructor(t){super(t),this.dummyCanvas=gh.Util.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return fs.Path.getPathLength(this.dataArray)}_getPointAtLength(t){if(!this.attrs.data)return null;const e=this.pathLength;return t-1>e?null:fs.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=fs.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var e=this.textDecoration(),n=this.fill(),r=this.fontSize(),s=this.glyphInfo;e==="underline"&&t.beginPath();for(var a=0;a<s.length;a++){t.save();var o=s[a].p0;t.translate(o.x,o.y),t.rotate(s[a].rotation),this.partialText=s[a].text,t.fillStrokeShape(this),e==="underline"&&(a===0&&t.moveTo(0,r/2+1),t.lineTo(r,r/2+1)),t.restore()}e==="underline"&&(t.strokeStyle=n,t.lineWidth=r/20,t.stroke()),t.restore()}_hitFunc(t){t.beginPath();var e=this.glyphInfo;if(e.length>=1){var n=e[0].p0;t.moveTo(n.x,n.y)}for(var r=0;r<e.length;r++){var s=e[r].p1;t.lineTo(s.x,s.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return gh.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(t){return ph.Text.prototype.setText.call(this,t)}_getContextFont(){return ph.Text.prototype._getContextFont.call(this)}_getTextSize(t){var e=this.dummyCanvas,n=e.getContext("2d");n.save(),n.font=this._getContextFont();var r=n.measureText(t);return n.restore(),{width:r.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:t,height:e}=this._getTextSize(this.attrs.text);if(this.textWidth=t,this.textHeight=e,this.glyphInfo=[],!this.attrs.data)return null;const n=this.letterSpacing(),r=this.align(),s=this.kerningFunc(),a=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,0);let o=0;r==="center"&&(o=Math.max(0,this.pathLength/2-a/2)),r==="right"&&(o=Math.max(0,this.pathLength-a));const l=(0,ph.stringToArray)(this.text());let h=o;for(var c=0;c<l.length;c++){const d=this._getPointAtLength(h);if(!d)return;let f=this._getTextSize(l[c]).width+n;if(l[c]===" "&&r==="justify"){const C=this.text().split(" ").length-1;f+=(this.pathLength-a)/C}const u=this._getPointAtLength(h+f);if(!u)return;const p=fs.Path.getLineLength(d.x,d.y,u.x,u.y);let m=0;if(s)try{m=s(l[c-1],l[c])*this.fontSize()}catch{m=0}d.x+=m,u.x+=m,this.textWidth+=m;const y=fs.Path.getPointOnLine(m+p/2,d.x,d.y,u.x,u.y),S=Math.atan2(u.y-d.y,u.x-d.x);this.glyphInfo.push({transposeX:y.x,transposeY:y.y,text:l[c],rotation:S,p0:d,p1:u}),h+=f}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var t=[];this.glyphInfo.forEach(function(c){t.push(c.p0.x),t.push(c.p0.y),t.push(c.p1.x),t.push(c.p1.y)});for(var e=t[0]||0,n=t[0]||0,r=t[1]||0,s=t[1]||0,a,o,l=0;l<t.length/2;l++)a=t[l*2],o=t[l*2+1],e=Math.min(e,a),n=Math.max(n,a),r=Math.min(r,o),s=Math.max(s,o);var h=this.fontSize();return{x:e-h/2,y:r-h/2,width:n-e+h,height:s-r+h}}destroy(){return gh.Util.releaseCanvas(this.dummyCanvas),super.destroy()}}D0=us.TextPath=ue,ue.prototype._fillFunc=F0,ue.prototype._strokeFunc=N0,ue.prototype._fillFuncHit=F0,ue.prototype._strokeFuncHit=N0,ue.prototype.className="TextPath",ue.prototype._attrsAffectingSize=["text","fontSize","data"],(0,i6._registerNode)(ue),$e.Factory.addGetterSetter(ue,"data"),$e.Factory.addGetterSetter(ue,"fontFamily","Arial"),$e.Factory.addGetterSetter(ue,"fontSize",12,(0,I0.getNumberValidator)()),$e.Factory.addGetterSetter(ue,"fontStyle",O0),$e.Factory.addGetterSetter(ue,"align","left"),$e.Factory.addGetterSetter(ue,"letterSpacing",0,(0,I0.getNumberValidator)()),$e.Factory.addGetterSetter(ue,"textBaseline","middle"),$e.Factory.addGetterSetter(ue,"fontVariant",O0),$e.Factory.addGetterSetter(ue,"text",n6),$e.Factory.addGetterSetter(ue,"textDecoration",null),$e.Factory.addGetterSetter(ue,"kerningFunc",null);const r6=St(xt({__proto__:null,get TextPath(){return D0},default:us},[us]));var ds={};Object.defineProperty(ds,"__esModule",{value:!0});var U0=ds.Transformer=void 0;const Yt=ee,Vt=It,B0=oe,s6=pe,a6=c0,G0=Xl,ze=Ot,Fi=Ft,o6=Ot;var $0="tr-konva",l6=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(i=>i+`.${$0}`).join(" "),z0="nodesRect",h6=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],c6={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const u6="ontouchstart"in ze.Konva._global;function f6(i,t,e){if(i==="rotater")return e;t+=Yt.Util.degToRad(c6[i]||0);var n=(Yt.Util.radToDeg(t)%360+360)%360;return Yt.Util._inRange(n,337.5,360)||Yt.Util._inRange(n,0,22.5)?"ns-resize":Yt.Util._inRange(n,22.5,67.5)?"nesw-resize":Yt.Util._inRange(n,67.5,112.5)?"ew-resize":Yt.Util._inRange(n,112.5,157.5)?"nwse-resize":Yt.Util._inRange(n,157.5,202.5)?"ns-resize":Yt.Util._inRange(n,202.5,247.5)?"nesw-resize":Yt.Util._inRange(n,247.5,292.5)?"ew-resize":Yt.Util._inRange(n,292.5,337.5)?"nwse-resize":(Yt.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var Wa=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],H0=1e8;function d6(i){return{x:i.x+i.width/2*Math.cos(i.rotation)+i.height/2*Math.sin(-i.rotation),y:i.y+i.height/2*Math.cos(i.rotation)+i.width/2*Math.sin(i.rotation)}}function j0(i,t,e){const n=e.x+(i.x-e.x)*Math.cos(t)-(i.y-e.y)*Math.sin(t),r=e.y+(i.x-e.x)*Math.sin(t)+(i.y-e.y)*Math.cos(t);return{...i,rotation:i.rotation+t,x:n,y:r}}function g6(i,t){const e=d6(i);return j0(i,t,e)}function p6(i,t,e){let n=t;for(let r=0;r<i.length;r++){const s=ze.Konva.getAngle(i[r]),a=Math.abs(s-t)%(Math.PI*2);Math.min(a,Math.PI*2-a)<e&&(n=s)}return n}class zt extends G0.Group{constructor(t){super(t),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(l6,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(t){return Yt.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([t])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return $0+this._id}setNodes(t=[]){this._nodes&&this._nodes.length&&this.detach();const e=t.filter(r=>r.isAncestorOf(this)?(Yt.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=e,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(r=>{const s=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=r._attrsAffectingSize.map(o=>o+"Change."+this._getEventNamespace()).join(" ");r.on(a,s),r.on(h6.map(o=>o+`.${this._getEventNamespace()}`).join(" "),s),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,s),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,n=>{e=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(n,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,n=>{if(!e)return;const r=t.getAbsolutePosition(),s=r.x-e.x,a=r.y-e.y;this.nodes().forEach(o=>{if(o===t||o.isDragging())return;const l=o.getAbsolutePosition();o.setAbsolutePosition({x:l.x+s,y:l.y+a}),o.startDrag(n)}),e=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(z0),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(z0,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),n){var r=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),s=t.getAbsoluteScale(n),a=t.getAbsolutePosition(n),o=r.x*s.x-t.offsetX()*s.x,l=r.y*s.y-t.offsetY()*s.y;const h=(ze.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:a.x+o*Math.cos(h)+l*Math.sin(-h),y:a.y+l*Math.cos(h)+o*Math.sin(h),width:r.width*s.x,height:r.height*s.y,rotation:h};return j0(c,-ze.Konva.getAngle(e),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-H0,y:-H0,width:0,height:0,rotation:0};const e=[];this.nodes().map(h=>{const c=h.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=h.getAbsoluteTransform();d.forEach(function(u){var p=f.point(u);e.push(p)})});const n=new Yt.Transform;n.rotate(-ze.Konva.getAngle(this.rotation()));var r=1/0,s=1/0,a=-1/0,o=-1/0;e.forEach(function(h){var c=n.point(h);r===void 0&&(r=a=c.x,s=o=c.y),r=Math.min(r,c.x),s=Math.min(s,c.y),a=Math.max(a,c.x),o=Math.max(o,c.y)}),n.invert();const l=n.point({x:r,y:s});return{x:l.x,y:l.y,width:a-r,height:o-s,rotation:ze.Konva.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(),Wa.forEach(t=>{this._createAnchor(t)}),this._createAnchor("rotater")}_createAnchor(t){var e=new a6.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:u6?10:"auto"}),n=this;e.on("mousedown touchstart",function(r){n._handleMouseDown(r)}),e.on("dragstart",r=>{e.stopDrag(),r.cancelBubble=!0}),e.on("dragend",r=>{r.cancelBubble=!0}),e.on("mouseenter",()=>{var r=ze.Konva.getAngle(this.rotation()),s=this.rotateAnchorCursor(),a=f6(t,r,s);e.getStage().content&&(e.getStage().content.style.cursor=a),this._cursorChange=!0}),e.on("mouseout",()=>{e.getStage().content&&(e.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(e)}_createBack(){var t=new s6.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(e,n){var r=n.getParent(),s=r.padding();e.beginPath(),e.rect(-s,-s,n.width()+s*2,n.height()+s*2),e.moveTo(n.width()/2,-s),r.rotateEnabled()&&e.lineTo(n.width()/2,-r.rotateAnchorOffset()*Yt.Util._sign(n.height())-s),e.fillStrokeShape(n)},hitFunc:(e,n)=>{if(this.shouldOverdrawWholeArea()){var r=this.padding();e.beginPath(),e.rect(-r,-r,n.width()+r*2,n.height()+r*2),e.fillStrokeShape(n)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",e=>{e.cancelBubble=!0}),t.on("dragmove",e=>{e.cancelBubble=!0}),t.on("dragend",e=>{e.cancelBubble=!0}),this.on("dragmove",e=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var e=this._getNodeRect(),n=e.width,r=e.height,s=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/s),this.cos=Math.abs(n/s),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var a=t.target.getAbsolutePosition(),o=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:o.x-a.x,y:o.y-a.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var e,n,r,s=this.findOne("."+this._movingAnchorName),a=s.getStage();a.setPointersPositions(t);const o=a.getPointerPosition();let l={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y};const h=s.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(h,l,t)),s.setAbsolutePosition(l);const c=s.getAbsolutePosition();if(!(h.x===c.x&&h.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();e=s.x()-d.width/2,n=-s.y()+d.height/2;let W=Math.atan2(-n,e)+Math.PI/2;d.height<0&&(W-=Math.PI);var f=ze.Konva.getAngle(this.rotation());const K=f+W,it=ze.Konva.getAngle(this.rotationSnapTolerance()),vt=p6(this.rotationSnaps(),K,it)-d.rotation,dt=g6(d,vt);this._fitNodesInto(dt,t);return}var u=this.shiftBehavior(),p;u==="inverted"?p=this.keepRatio()&&!t.shiftKey:u==="none"?p=this.keepRatio():p=this.keepRatio()||t.shiftKey;var _=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(p){var m=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(m.x-s.x(),2)+Math.pow(m.y-s.y(),2));var y=this.findOne(".top-left").x()>m.x?-1:1,S=this.findOne(".top-left").y()>m.y?-1:1;e=r*this.cos*y,n=r*this.sin*S,this.findOne(".top-left").x(m.x-e),this.findOne(".top-left").y(m.y-n)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(s.y());else if(this._movingAnchorName==="top-right"){if(p){var m=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(s.x()-m.x,2)+Math.pow(m.y-s.y(),2));var y=this.findOne(".top-right").x()<m.x?-1:1,S=this.findOne(".top-right").y()>m.y?-1:1;e=r*this.cos*y,n=r*this.sin*S,this.findOne(".top-right").x(m.x+e),this.findOne(".top-right").y(m.y-n)}var C=s.position();this.findOne(".top-left").y(C.y),this.findOne(".bottom-right").x(C.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(s.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(s.x());else if(this._movingAnchorName==="bottom-left"){if(p){var m=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(m.x-s.x(),2)+Math.pow(s.y()-m.y,2));var y=m.x<s.x()?-1:1,S=s.y()<m.y?-1:1;e=r*this.cos*y,n=r*this.sin*S,s.x(m.x-e),s.y(m.y+n)}C=s.position(),this.findOne(".top-left").x(C.x),this.findOne(".bottom-right").y(C.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(s.y());else if(this._movingAnchorName==="bottom-right"){if(p){var m=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(s.x()-m.x,2)+Math.pow(s.y()-m.y,2));var y=this.findOne(".bottom-right").x()<m.x?-1:1,S=this.findOne(".bottom-right").y()<m.y?-1:1;e=r*this.cos*y,n=r*this.sin*S,this.findOne(".bottom-right").x(m.x+e),this.findOne(".bottom-right").y(m.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));var _=this.centeredScaling()||t.altKey;if(_){var w=this.findOne(".top-left"),k=this.findOne(".bottom-right"),A=w.x(),R=w.y(),P=this.getWidth()-k.x(),U=this.getHeight()-k.y();k.move({x:-A,y:-R}),w.move({x:P,y:U})}var I=this.findOne(".top-left").getAbsolutePosition();e=I.x,n=I.y;var N=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),q=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:n,width:N,height:q,rotation:ze.Konva.getAngle(this.rotation())},t)}}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var e=this.getNode();this._fire("transformend",{evt:t,target:e}),e&&this._nodes.forEach(n=>{n._fire("transformend",{evt:t,target:n})}),this._movingAnchorName=null}}_fitNodesInto(t,e){var n=this._getNodeRect();const r=1;if(Yt.Util._inRange(t.width,-this.padding()*2-r,r)){this.update();return}if(Yt.Util._inRange(t.height,-this.padding()*2-r,r)){this.update();return}const s=this.flipEnabled();var a=new Yt.Transform;if(a.rotate(ze.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=a.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!s){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!s){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=a.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!s){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!s){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(n,t);d?t=d:Yt.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const o=1e7,l=new Yt.Transform;l.translate(n.x,n.y),l.rotate(n.rotation),l.scale(n.width/o,n.height/o);const h=new Yt.Transform;h.translate(t.x,t.y),h.rotate(t.rotation),h.scale(t.width/o,t.height/o);const c=h.multiply(l.invert());this._nodes.forEach(d=>{var f;const u=d.getParent().getAbsoluteTransform(),p=d.getTransform().copy();p.translate(d.offsetX(),d.offsetY());const m=new Yt.Transform;m.multiply(u.copy().invert()).multiply(c).multiply(u).multiply(p);const y=m.decompose();d.setAttrs(y),this._fire("transform",{evt:e,target:d}),d._fire("transform",{evt:e,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(Yt.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var t,e=this._getNodeRect();this.rotation(Yt.Util._getRotation(e.rotation));var n=e.width,r=e.height,s=this.enabledAnchors(),a=this.resizeEnabled(),o=this.padding(),l=this.anchorSize();const h=this.find("._anchor");h.forEach(d=>{d.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+o,offsetY:l/2+o,visible:a&&s.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:l/2+o,visible:a&&s.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:l/2-o,offsetY:l/2+o,visible:a&&s.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:l/2+o,visible:a&&s.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:l/2-o,visible:a&&s.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:l/2+o,offsetY:l/2-o,visible:a&&s.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:l/2-o,visible:a&&s.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:l/2-o,offsetY:l/2-o,visible:a&&s.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:n/2,y:-this.rotateAnchorOffset()*Yt.Util._sign(r)-o,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&h.forEach(d=>{c(d)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),G0.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return B0.Node.prototype.toObject.call(this)}clone(t){var e=B0.Node.prototype.clone.call(this,t);return e}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}U0=ds.Transformer=zt;function m6(i){return i instanceof Array||Yt.Util.warn("enabledAnchors value should be an array"),i instanceof Array&&i.forEach(function(t){Wa.indexOf(t)===-1&&Yt.Util.warn("Unknown anchor name: "+t+". Available names are: "+Wa.join(", "))}),i||[]}zt.prototype.className="Transformer",(0,o6._registerNode)(zt),Vt.Factory.addGetterSetter(zt,"enabledAnchors",Wa,m6),Vt.Factory.addGetterSetter(zt,"flipEnabled",!0,(0,Fi.getBooleanValidator)()),Vt.Factory.addGetterSetter(zt,"resizeEnabled",!0),Vt.Factory.addGetterSetter(zt,"anchorSize",10,(0,Fi.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"rotateEnabled",!0),Vt.Factory.addGetterSetter(zt,"rotationSnaps",[]),Vt.Factory.addGetterSetter(zt,"rotateAnchorOffset",50,(0,Fi.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"rotateAnchorCursor","crosshair"),Vt.Factory.addGetterSetter(zt,"rotationSnapTolerance",5,(0,Fi.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"borderEnabled",!0),Vt.Factory.addGetterSetter(zt,"anchorStroke","rgb(0, 161, 255)"),Vt.Factory.addGetterSetter(zt,"anchorStrokeWidth",1,(0,Fi.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"anchorFill","white"),Vt.Factory.addGetterSetter(zt,"anchorCornerRadius",0,(0,Fi.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"borderStroke","rgb(0, 161, 255)"),Vt.Factory.addGetterSetter(zt,"borderStrokeWidth",1,(0,Fi.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"borderDash"),Vt.Factory.addGetterSetter(zt,"keepRatio",!0),Vt.Factory.addGetterSetter(zt,"shiftBehavior","default"),Vt.Factory.addGetterSetter(zt,"centeredScaling",!1),Vt.Factory.addGetterSetter(zt,"ignoreStroke",!1),Vt.Factory.addGetterSetter(zt,"padding",0,(0,Fi.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"node"),Vt.Factory.addGetterSetter(zt,"nodes"),Vt.Factory.addGetterSetter(zt,"boundBoxFunc"),Vt.Factory.addGetterSetter(zt,"anchorDragBoundFunc"),Vt.Factory.addGetterSetter(zt,"anchorStyleFunc"),Vt.Factory.addGetterSetter(zt,"shouldOverdrawWholeArea",!1),Vt.Factory.addGetterSetter(zt,"useSingleNodeRotation",!0),Vt.Factory.backCompat(zt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});const v6=St(xt({__proto__:null,get Transformer(){return U0},default:ds},[ds]));var gs={};Object.defineProperty(gs,"__esModule",{value:!0});var V0=gs.Wedge=void 0;const Ka=It,_6=pe,y6=Ot,q0=Ft,b6=Ot;class mi extends _6.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,y6.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}V0=gs.Wedge=mi,mi.prototype.className="Wedge",mi.prototype._centroid=!0,mi.prototype._attrsAffectingSize=["radius"],(0,b6._registerNode)(mi),Ka.Factory.addGetterSetter(mi,"radius",0,(0,q0.getNumberValidator)()),Ka.Factory.addGetterSetter(mi,"angle",0,(0,q0.getNumberValidator)()),Ka.Factory.addGetterSetter(mi,"clockwise",!1),Ka.Factory.backCompat(mi,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});const w6=St(xt({__proto__:null,get Wedge(){return V0},default:gs},[gs]));var ps={};Object.defineProperty(ps,"__esModule",{value:!0});var X0=ps.Blur=void 0;const Y0=It,x6=oe,S6=Ft;function W0(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var C6=[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],k6=[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 T6(i,t){var e=i.data,n=i.width,r=i.height,s,a,o,l,h,c,d,f,u,p,m,y,S,C,_,w,k,A,R,P,U,I,N,q,W=t+t+1,K=n-1,it=r-1,pt=t+1,vt=pt*(pt+1)/2,dt=new W0,_t=null,yt=dt,L=null,M=null,T=C6[t],F=k6[t];for(o=1;o<W;o++)yt=yt.next=new W0,o===pt&&(_t=yt);for(yt.next=dt,d=c=0,a=0;a<r;a++){for(w=k=A=R=f=u=p=m=0,y=pt*(P=e[c]),S=pt*(U=e[c+1]),C=pt*(I=e[c+2]),_=pt*(N=e[c+3]),f+=vt*P,u+=vt*U,p+=vt*I,m+=vt*N,yt=dt,o=0;o<pt;o++)yt.r=P,yt.g=U,yt.b=I,yt.a=N,yt=yt.next;for(o=1;o<pt;o++)l=c+((K<o?K:o)<<2),f+=(yt.r=P=e[l])*(q=pt-o),u+=(yt.g=U=e[l+1])*q,p+=(yt.b=I=e[l+2])*q,m+=(yt.a=N=e[l+3])*q,w+=P,k+=U,A+=I,R+=N,yt=yt.next;for(L=dt,M=_t,s=0;s<n;s++)e[c+3]=N=m*T>>F,N!==0?(N=255/N,e[c]=(f*T>>F)*N,e[c+1]=(u*T>>F)*N,e[c+2]=(p*T>>F)*N):e[c]=e[c+1]=e[c+2]=0,f-=y,u-=S,p-=C,m-=_,y-=L.r,S-=L.g,C-=L.b,_-=L.a,l=d+((l=s+t+1)<K?l:K)<<2,w+=L.r=e[l],k+=L.g=e[l+1],A+=L.b=e[l+2],R+=L.a=e[l+3],f+=w,u+=k,p+=A,m+=R,L=L.next,y+=P=M.r,S+=U=M.g,C+=I=M.b,_+=N=M.a,w-=P,k-=U,A-=I,R-=N,M=M.next,c+=4;d+=n}for(s=0;s<n;s++){for(k=A=R=w=u=p=m=f=0,c=s<<2,y=pt*(P=e[c]),S=pt*(U=e[c+1]),C=pt*(I=e[c+2]),_=pt*(N=e[c+3]),f+=vt*P,u+=vt*U,p+=vt*I,m+=vt*N,yt=dt,o=0;o<pt;o++)yt.r=P,yt.g=U,yt.b=I,yt.a=N,yt=yt.next;for(h=n,o=1;o<=t;o++)c=h+s<<2,f+=(yt.r=P=e[c])*(q=pt-o),u+=(yt.g=U=e[c+1])*q,p+=(yt.b=I=e[c+2])*q,m+=(yt.a=N=e[c+3])*q,w+=P,k+=U,A+=I,R+=N,yt=yt.next,o<it&&(h+=n);for(c=s,L=dt,M=_t,a=0;a<r;a++)l=c<<2,e[l+3]=N=m*T>>F,N>0?(N=255/N,e[l]=(f*T>>F)*N,e[l+1]=(u*T>>F)*N,e[l+2]=(p*T>>F)*N):e[l]=e[l+1]=e[l+2]=0,f-=y,u-=S,p-=C,m-=_,y-=L.r,S-=L.g,C-=L.b,_-=L.a,l=s+((l=a+pt)<it?l:it)*n<<2,f+=w+=L.r=e[l],u+=k+=L.g=e[l+1],p+=A+=L.b=e[l+2],m+=R+=L.a=e[l+3],L=L.next,y+=P=M.r,S+=U=M.g,C+=I=M.b,_+=N=M.a,w-=P,k-=U,A-=I,R-=N,M=M.next,c+=n}}const E6=function(t){var e=Math.round(this.blurRadius());e>0&&T6(t,e)};X0=ps.Blur=E6,Y0.Factory.addGetterSetter(x6.Node,"blurRadius",0,(0,S6.getNumberValidator)(),Y0.Factory.afterSetFilter);const A6=St(xt({__proto__:null,get Blur(){return X0},default:ps},[ps]));var ms={};Object.defineProperty(ms,"__esModule",{value:!0});var K0=ms.Brighten=void 0;const Z0=It,P6=oe,M6=Ft,R6=function(i){var t=this.brightness()*255,e=i.data,n=e.length,r;for(r=0;r<n;r+=4)e[r]+=t,e[r+1]+=t,e[r+2]+=t};K0=ms.Brighten=R6,Z0.Factory.addGetterSetter(P6.Node,"brightness",0,(0,M6.getNumberValidator)(),Z0.Factory.afterSetFilter);const L6=St(xt({__proto__:null,get Brighten(){return K0},default:ms},[ms]));var vs={};Object.defineProperty(vs,"__esModule",{value:!0});var J0=vs.Contrast=void 0;const Q0=It,D6=oe,I6=Ft,O6=function(i){var t=Math.pow((this.contrast()+100)/100,2),e=i.data,n=e.length,r=150,s=150,a=150,o;for(o=0;o<n;o+=4)r=e[o],s=e[o+1],a=e[o+2],r/=255,r-=.5,r*=t,r+=.5,r*=255,s/=255,s-=.5,s*=t,s+=.5,s*=255,a/=255,a-=.5,a*=t,a+=.5,a*=255,r=r<0?0:r>255?255:r,s=s<0?0:s>255?255:s,a=a<0?0:a>255?255:a,e[o]=r,e[o+1]=s,e[o+2]=a};J0=vs.Contrast=O6,Q0.Factory.addGetterSetter(D6.Node,"contrast",0,(0,I6.getNumberValidator)(),Q0.Factory.afterSetFilter);const F6=St(xt({__proto__:null,get Contrast(){return J0},default:vs},[vs]));var _s={};Object.defineProperty(_s,"__esModule",{value:!0});var t1=_s.Emboss=void 0;const Ni=It,Za=oe,N6=ee,e1=Ft,U6=function(i){var t=this.embossStrength()*10,e=this.embossWhiteLevel()*255,n=this.embossDirection(),r=this.embossBlend(),s=0,a=0,o=i.data,l=i.width,h=i.height,c=l*4,d=h;switch(n){case"top-left":s=-1,a=-1;break;case"top":s=-1,a=0;break;case"top-right":s=-1,a=1;break;case"right":s=0,a=1;break;case"bottom-right":s=1,a=1;break;case"bottom":s=1,a=0;break;case"bottom-left":s=1,a=-1;break;case"left":s=0,a=-1;break;default:N6.Util.error("Unknown emboss direction: "+n)}do{var f=(d-1)*c,u=s;d+u<1&&(u=0),d+u>h&&(u=0);var p=(d-1+u)*l*4,m=l;do{var y=f+(m-1)*4,S=a;m+S<1&&(S=0),m+S>l&&(S=0);var C=p+(m-1+S)*4,_=o[y]-o[C],w=o[y+1]-o[C+1],k=o[y+2]-o[C+2],A=_,R=A>0?A:-A,P=w>0?w:-w,U=k>0?k:-k;if(P>R&&(A=w),U>R&&(A=k),A*=t,r){var I=o[y]+A,N=o[y+1]+A,q=o[y+2]+A;o[y]=I>255?255:I<0?0:I,o[y+1]=N>255?255:N<0?0:N,o[y+2]=q>255?255:q<0?0:q}else{var W=e-A;W<0?W=0:W>255&&(W=255),o[y]=o[y+1]=o[y+2]=W}}while(--m)}while(--d)};t1=_s.Emboss=U6,Ni.Factory.addGetterSetter(Za.Node,"embossStrength",.5,(0,e1.getNumberValidator)(),Ni.Factory.afterSetFilter),Ni.Factory.addGetterSetter(Za.Node,"embossWhiteLevel",.5,(0,e1.getNumberValidator)(),Ni.Factory.afterSetFilter),Ni.Factory.addGetterSetter(Za.Node,"embossDirection","top-left",null,Ni.Factory.afterSetFilter),Ni.Factory.addGetterSetter(Za.Node,"embossBlend",!1,null,Ni.Factory.afterSetFilter);const B6=St(xt({__proto__:null,get Emboss(){return t1},default:_s},[_s]));var ys={};Object.defineProperty(ys,"__esModule",{value:!0});var i1=ys.Enhance=void 0;const n1=It,G6=oe,$6=Ft;function mh(i,t,e,n,r){var s=e-t,a=r-n,o;return s===0?n+a/2:a===0?n:(o=(i-t)/s,o=a*o+n,o)}const z6=function(i){var t=i.data,e=t.length,n=t[0],r=n,s,a=t[1],o=a,l,h=t[2],c=h,d,f,u=this.enhance();if(u!==0){for(f=0;f<e;f+=4)s=t[f+0],s<n?n=s:s>r&&(r=s),l=t[f+1],l<a?a=l:l>o&&(o=l),d=t[f+2],d<h?h=d:d>c&&(c=d);r===n&&(r=255,n=0),o===a&&(o=255,a=0),c===h&&(c=255,h=0);var p,m,y,S,C,_,w,k,A;for(u>0?(m=r+u*(255-r),y=n-u*(n-0),C=o+u*(255-o),_=a-u*(a-0),k=c+u*(255-c),A=h-u*(h-0)):(p=(r+n)*.5,m=r+u*(r-p),y=n+u*(n-p),S=(o+a)*.5,C=o+u*(o-S),_=a+u*(a-S),w=(c+h)*.5,k=c+u*(c-w),A=h+u*(h-w)),f=0;f<e;f+=4)t[f+0]=mh(t[f+0],n,r,y,m),t[f+1]=mh(t[f+1],a,o,_,C),t[f+2]=mh(t[f+2],h,c,A,k)}};i1=ys.Enhance=z6,n1.Factory.addGetterSetter(G6.Node,"enhance",0,(0,$6.getNumberValidator)(),n1.Factory.afterSetFilter);const H6=St(xt({__proto__:null,get Enhance(){return i1},default:ys},[ys]));var bs={};Object.defineProperty(bs,"__esModule",{value:!0});var r1=bs.Grayscale=void 0;const j6=function(i){var t=i.data,e=t.length,n,r;for(n=0;n<e;n+=4)r=.34*t[n]+.5*t[n+1]+.16*t[n+2],t[n]=r,t[n+1]=r,t[n+2]=r};r1=bs.Grayscale=j6;const V6=St(xt({__proto__:null,get Grayscale(){return r1},default:bs},[bs]));var ws={};Object.defineProperty(ws,"__esModule",{value:!0});var s1=ws.HSL=void 0;const jn=It,vh=oe,_h=Ft;jn.Factory.addGetterSetter(vh.Node,"hue",0,(0,_h.getNumberValidator)(),jn.Factory.afterSetFilter),jn.Factory.addGetterSetter(vh.Node,"saturation",0,(0,_h.getNumberValidator)(),jn.Factory.afterSetFilter),jn.Factory.addGetterSetter(vh.Node,"luminance",0,(0,_h.getNumberValidator)(),jn.Factory.afterSetFilter);const q6=function(i){var t=i.data,e=t.length,n=1,r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a=this.luminance()*127,o,l=n*r*Math.cos(s*Math.PI/180),h=n*r*Math.sin(s*Math.PI/180),c=.299*n+.701*l+.167*h,d=.587*n-.587*l+.33*h,f=.114*n-.114*l-.497*h,u=.299*n-.299*l-.328*h,p=.587*n+.413*l+.035*h,m=.114*n-.114*l+.293*h,y=.299*n-.3*l+1.25*h,S=.587*n-.586*l-1.05*h,C=.114*n+.886*l-.2*h,_,w,k,A;for(o=0;o<e;o+=4)_=t[o+0],w=t[o+1],k=t[o+2],A=t[o+3],t[o+0]=c*_+d*w+f*k+a,t[o+1]=u*_+p*w+m*k+a,t[o+2]=y*_+S*w+C*k+a,t[o+3]=A};s1=ws.HSL=q6;const X6=St(xt({__proto__:null,get HSL(){return s1},default:ws},[ws]));var xs={};Object.defineProperty(xs,"__esModule",{value:!0});var a1=xs.HSV=void 0;const Vn=It,yh=oe,bh=Ft,Y6=function(i){var t=i.data,e=t.length,n=Math.pow(2,this.value()),r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a,o=n*r*Math.cos(s*Math.PI/180),l=n*r*Math.sin(s*Math.PI/180),h=.299*n+.701*o+.167*l,c=.587*n-.587*o+.33*l,d=.114*n-.114*o-.497*l,f=.299*n-.299*o-.328*l,u=.587*n+.413*o+.035*l,p=.114*n-.114*o+.293*l,m=.299*n-.3*o+1.25*l,y=.587*n-.586*o-1.05*l,S=.114*n+.886*o-.2*l,C,_,w,k;for(a=0;a<e;a+=4)C=t[a+0],_=t[a+1],w=t[a+2],k=t[a+3],t[a+0]=h*C+c*_+d*w,t[a+1]=f*C+u*_+p*w,t[a+2]=m*C+y*_+S*w,t[a+3]=k};a1=xs.HSV=Y6,Vn.Factory.addGetterSetter(yh.Node,"hue",0,(0,bh.getNumberValidator)(),Vn.Factory.afterSetFilter),Vn.Factory.addGetterSetter(yh.Node,"saturation",0,(0,bh.getNumberValidator)(),Vn.Factory.afterSetFilter),Vn.Factory.addGetterSetter(yh.Node,"value",0,(0,bh.getNumberValidator)(),Vn.Factory.afterSetFilter);const W6=St(xt({__proto__:null,get HSV(){return a1},default:xs},[xs]));var Ss={};Object.defineProperty(Ss,"__esModule",{value:!0});var o1=Ss.Invert=void 0;const K6=function(i){var t=i.data,e=t.length,n;for(n=0;n<e;n+=4)t[n]=255-t[n],t[n+1]=255-t[n+1],t[n+2]=255-t[n+2]};o1=Ss.Invert=K6;const Z6=St(xt({__proto__:null,get Invert(){return o1},default:Ss},[Ss]));var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});var l1=Cs.Kaleidoscope=void 0;const Ja=It,h1=oe,c1=ee,u1=Ft;var J6=function(i,t,e){var n=i.data,r=t.data,s=i.width,a=i.height,o=e.polarCenterX||s/2,l=e.polarCenterY||a/2,h,c,d,f=0,u=0,p=0,m=0,y,S=Math.sqrt(o*o+l*l);c=s-o,d=a-l,y=Math.sqrt(c*c+d*d),S=y>S?y:S;var C=a,_=s,w,k,A=360/_*Math.PI/180,R,P;for(k=0;k<_;k+=1)for(R=Math.sin(k*A),P=Math.cos(k*A),w=0;w<C;w+=1)c=Math.floor(o+S*w/C*P),d=Math.floor(l+S*w/C*R),h=(d*s+c)*4,f=n[h+0],u=n[h+1],p=n[h+2],m=n[h+3],h=(k+w*s)*4,r[h+0]=f,r[h+1]=u,r[h+2]=p,r[h+3]=m},Q6=function(i,t,e){var n=i.data,r=t.data,s=i.width,a=i.height,o=e.polarCenterX||s/2,l=e.polarCenterY||a/2,h,c,d,f,u,p=0,m=0,y=0,S=0,C,_=Math.sqrt(o*o+l*l);c=s-o,d=a-l,C=Math.sqrt(c*c+d*d),_=C>_?C:_;var w=a,k=s,A,R,P=e.polarRotation||0,U,I;for(c=0;c<s;c+=1)for(d=0;d<a;d+=1)f=c-o,u=d-l,A=Math.sqrt(f*f+u*u)*w/_,R=(Math.atan2(u,f)*180/Math.PI+360+P)%360,R=R*k/360,U=Math.floor(R),I=Math.floor(A),h=(I*s+U)*4,p=n[h+0],m=n[h+1],y=n[h+2],S=n[h+3],h=(d*s+c)*4,r[h+0]=p,r[h+1]=m,r[h+2]=y,r[h+3]=S};const t8=function(i){var t=i.width,e=i.height,n,r,s,a,o,l,h,c,d,f,u=Math.round(this.kaleidoscopePower()),p=Math.round(this.kaleidoscopeAngle()),m=Math.floor(t*(p%360)/360);if(!(u<1)){var y=c1.Util.createCanvasElement();y.width=t,y.height=e;var S=y.getContext("2d").getImageData(0,0,t,e);c1.Util.releaseCanvas(y),J6(i,S,{polarCenterX:t/2,polarCenterY:e/2});for(var C=t/Math.pow(2,u);C<=8;)C=C*2,u-=1;C=Math.ceil(C);var _=C,w=0,k=_,A=1;for(m+C>t&&(w=_,k=0,A=-1),r=0;r<e;r+=1)for(n=w;n!==k;n+=A)s=Math.round(n+m)%t,d=(t*r+s)*4,o=S.data[d+0],l=S.data[d+1],h=S.data[d+2],c=S.data[d+3],f=(t*r+n)*4,S.data[f+0]=o,S.data[f+1]=l,S.data[f+2]=h,S.data[f+3]=c;for(r=0;r<e;r+=1)for(_=Math.floor(C),a=0;a<u;a+=1){for(n=0;n<_+1;n+=1)d=(t*r+n)*4,o=S.data[d+0],l=S.data[d+1],h=S.data[d+2],c=S.data[d+3],f=(t*r+_*2-n-1)*4,S.data[f+0]=o,S.data[f+1]=l,S.data[f+2]=h,S.data[f+3]=c;_*=2}Q6(S,i,{polarRotation:0})}};l1=Cs.Kaleidoscope=t8,Ja.Factory.addGetterSetter(h1.Node,"kaleidoscopePower",2,(0,u1.getNumberValidator)(),Ja.Factory.afterSetFilter),Ja.Factory.addGetterSetter(h1.Node,"kaleidoscopeAngle",0,(0,u1.getNumberValidator)(),Ja.Factory.afterSetFilter);const e8=St(xt({__proto__:null,get Kaleidoscope(){return l1},default:Cs},[Cs]));var ks={};Object.defineProperty(ks,"__esModule",{value:!0});var f1=ks.Mask=void 0;const d1=It,i8=oe,n8=Ft;function Qa(i,t,e){var n=(e*i.width+t)*4,r=[];return r.push(i.data[n++],i.data[n++],i.data[n++],i.data[n++]),r}function Ts(i,t){return Math.sqrt(Math.pow(i[0]-t[0],2)+Math.pow(i[1]-t[1],2)+Math.pow(i[2]-t[2],2))}function r8(i){for(var t=[0,0,0],e=0;e<i.length;e++)t[0]+=i[e][0],t[1]+=i[e][1],t[2]+=i[e][2];return t[0]/=i.length,t[1]/=i.length,t[2]/=i.length,t}function s8(i,t){var e=Qa(i,0,0),n=Qa(i,i.width-1,0),r=Qa(i,0,i.height-1),s=Qa(i,i.width-1,i.height-1),a=t||10;if(Ts(e,n)<a&&Ts(n,s)<a&&Ts(s,r)<a&&Ts(r,e)<a){for(var o=r8([n,e,s,r]),l=[],h=0;h<i.width*i.height;h++){var c=Ts(o,[i.data[h*4],i.data[h*4+1],i.data[h*4+2]]);l[h]=c<a?0:255}return l}}function a8(i,t){for(var e=0;e<i.width*i.height;e++)i.data[4*e+3]=t[e]}function o8(i,t,e){for(var n=[1,1,1,1,0,1,1,1,1],r=Math.round(Math.sqrt(n.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var l=0;l<t;l++){for(var h=o*t+l,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,p=l+f-s;if(u>=0&&u<e&&p>=0&&p<t){var m=u*t+p,y=n[d*r+f];c+=i[m]*y}}a[h]=c===2040?255:0}return a}function l8(i,t,e){for(var n=[1,1,1,1,1,1,1,1,1],r=Math.round(Math.sqrt(n.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var l=0;l<t;l++){for(var h=o*t+l,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,p=l+f-s;if(u>=0&&u<e&&p>=0&&p<t){var m=u*t+p,y=n[d*r+f];c+=i[m]*y}}a[h]=c>=1020?255:0}return a}function h8(i,t,e){for(var n=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],r=Math.round(Math.sqrt(n.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var l=0;l<t;l++){for(var h=o*t+l,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,p=l+f-s;if(u>=0&&u<e&&p>=0&&p<t){var m=u*t+p,y=n[d*r+f];c+=i[m]*y}}a[h]=c}return a}const c8=function(i){var t=this.threshold(),e=s8(i,t);return e&&(e=o8(e,i.width,i.height),e=l8(e,i.width,i.height),e=h8(e,i.width,i.height),a8(i,e)),i};f1=ks.Mask=c8,d1.Factory.addGetterSetter(i8.Node,"threshold",0,(0,n8.getNumberValidator)(),d1.Factory.afterSetFilter);const u8=St(xt({__proto__:null,get Mask(){return f1},default:ks},[ks]));var Es={};Object.defineProperty(Es,"__esModule",{value:!0});var g1=Es.Noise=void 0;const p1=It,f8=oe,d8=Ft,g8=function(i){var t=this.noise()*255,e=i.data,n=e.length,r=t/2,s;for(s=0;s<n;s+=4)e[s+0]+=r-2*r*Math.random(),e[s+1]+=r-2*r*Math.random(),e[s+2]+=r-2*r*Math.random()};g1=Es.Noise=g8,p1.Factory.addGetterSetter(f8.Node,"noise",.2,(0,d8.getNumberValidator)(),p1.Factory.afterSetFilter);const p8=St(xt({__proto__:null,get Noise(){return g1},default:Es},[Es]));var As={};Object.defineProperty(As,"__esModule",{value:!0});var m1=As.Pixelate=void 0;const v1=It,m8=ee,v8=oe,_8=Ft,y8=function(i){var t=Math.ceil(this.pixelSize()),e=i.width,n=i.height,r,s,a,o,l,h,c,d=Math.ceil(e/t),f=Math.ceil(n/t),u,p,m,y,S,C,_,w=i.data;if(t<=0){m8.Util.error("pixelSize value can not be <= 0");return}for(S=0;S<d;S+=1)for(C=0;C<f;C+=1){for(o=0,l=0,h=0,c=0,u=S*t,p=u+t,m=C*t,y=m+t,_=0,r=u;r<p;r+=1)if(!(r>=e))for(s=m;s<y;s+=1)s>=n||(a=(e*s+r)*4,o+=w[a+0],l+=w[a+1],h+=w[a+2],c+=w[a+3],_+=1);for(o=o/_,l=l/_,h=h/_,c=c/_,r=u;r<p;r+=1)if(!(r>=e))for(s=m;s<y;s+=1)s>=n||(a=(e*s+r)*4,w[a+0]=o,w[a+1]=l,w[a+2]=h,w[a+3]=c)}};m1=As.Pixelate=y8,v1.Factory.addGetterSetter(v8.Node,"pixelSize",8,(0,_8.getNumberValidator)(),v1.Factory.afterSetFilter);const b8=St(xt({__proto__:null,get Pixelate(){return m1},default:As},[As]));var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0});var _1=Ps.Posterize=void 0;const y1=It,w8=oe,x8=Ft,S8=function(i){var t=Math.round(this.levels()*254)+1,e=i.data,n=e.length,r=255/t,s;for(s=0;s<n;s+=1)e[s]=Math.floor(e[s]/r)*r};_1=Ps.Posterize=S8,y1.Factory.addGetterSetter(w8.Node,"levels",.5,(0,x8.getNumberValidator)(),y1.Factory.afterSetFilter);const C8=St(xt({__proto__:null,get Posterize(){return _1},default:Ps},[Ps]));var Ms={};Object.defineProperty(Ms,"__esModule",{value:!0});var b1=Ms.RGB=void 0;const to=It,wh=oe,k8=Ft,T8=function(i){var t=i.data,e=t.length,n=this.red(),r=this.green(),s=this.blue(),a,o;for(a=0;a<e;a+=4)o=(.34*t[a]+.5*t[a+1]+.16*t[a+2])/255,t[a]=o*n,t[a+1]=o*r,t[a+2]=o*s,t[a+3]=t[a+3]};b1=Ms.RGB=T8,to.Factory.addGetterSetter(wh.Node,"red",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),to.Factory.addGetterSetter(wh.Node,"green",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),to.Factory.addGetterSetter(wh.Node,"blue",0,k8.RGBComponent,to.Factory.afterSetFilter);const E8=St(xt({__proto__:null,get RGB(){return b1},default:Ms},[Ms]));var Rs={};Object.defineProperty(Rs,"__esModule",{value:!0});var w1=Rs.RGBA=void 0;const Ls=It,eo=oe,A8=Ft,P8=function(i){var t=i.data,e=t.length,n=this.red(),r=this.green(),s=this.blue(),a=this.alpha(),o,l;for(o=0;o<e;o+=4)l=1-a,t[o]=n*a+t[o]*l,t[o+1]=r*a+t[o+1]*l,t[o+2]=s*a+t[o+2]*l};w1=Rs.RGBA=P8,Ls.Factory.addGetterSetter(eo.Node,"red",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),Ls.Factory.addGetterSetter(eo.Node,"green",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),Ls.Factory.addGetterSetter(eo.Node,"blue",0,A8.RGBComponent,Ls.Factory.afterSetFilter),Ls.Factory.addGetterSetter(eo.Node,"alpha",1,function(i){return this._filterUpToDate=!1,i>1?1:i<0?0:i});const M8=St(xt({__proto__:null,get RGBA(){return w1},default:Rs},[Rs]));var Ds={};Object.defineProperty(Ds,"__esModule",{value:!0});var x1=Ds.Sepia=void 0;const R8=function(i){var t=i.data,e=t.length,n,r,s,a;for(n=0;n<e;n+=4)r=t[n+0],s=t[n+1],a=t[n+2],t[n+0]=Math.min(255,r*.393+s*.769+a*.189),t[n+1]=Math.min(255,r*.349+s*.686+a*.168),t[n+2]=Math.min(255,r*.272+s*.534+a*.131)};x1=Ds.Sepia=R8;const L8=St(xt({__proto__:null,get Sepia(){return x1},default:Ds},[Ds]));var Is={};Object.defineProperty(Is,"__esModule",{value:!0});var S1=Is.Solarize=void 0;const D8=function(i){var t=i.data,e=i.width,n=i.height,r=e*4,s=n;do{var a=(s-1)*r,o=e;do{var l=a+(o-1)*4,h=t[l],c=t[l+1],d=t[l+2];h>127&&(h=255-h),c>127&&(c=255-c),d>127&&(d=255-d),t[l]=h,t[l+1]=c,t[l+2]=d}while(--o)}while(--s)};S1=Is.Solarize=D8;const I8=St(xt({__proto__:null,get Solarize(){return S1},default:Is},[Is]));var Os={};Object.defineProperty(Os,"__esModule",{value:!0});var C1=Os.Threshold=void 0;const k1=It,O8=oe,F8=Ft,N8=function(i){var t=this.threshold()*255,e=i.data,n=e.length,r;for(r=0;r<n;r+=1)e[r]=e[r]<t?0:255};C1=Os.Threshold=N8,k1.Factory.addGetterSetter(O8.Node,"threshold",.5,(0,F8.getNumberValidator)(),k1.Factory.afterSetFilter);const U8=St(xt({__proto__:null,get Threshold(){return C1},default:Os},[Os]));Object.defineProperty(zr,"__esModule",{value:!0});var T1=zr.Konva=void 0;const E1=H3,B8=q3,G8=e4,$8=a4,z8=h4,H8=f4,A1=_4,j8=Kd,V8=th,q8=c0,X8=T4,Y8=P4,W8=D4,K8=F4,Z8=L0,J8=r6,Q8=v6,tb=w6,eb=A6,ib=L6,nb=F6,rb=B6,sb=H6,ab=V6,ob=X6,lb=W6,hb=Z6,cb=e8,ub=u8,fb=p8,db=b8,gb=C8,pb=E8,mb=M8,vb=L8,_b=I8,yb=U8;T1=zr.Konva=E1.Konva.Util._assign(E1.Konva,{Arc:B8.Arc,Arrow:G8.Arrow,Circle:$8.Circle,Ellipse:z8.Ellipse,Image:H8.Image,Label:A1.Label,Tag:A1.Tag,Line:j8.Line,Path:V8.Path,Rect:q8.Rect,RegularPolygon:X8.RegularPolygon,Ring:Y8.Ring,Sprite:W8.Sprite,Star:K8.Star,Text:Z8.Text,TextPath:J8.TextPath,Transformer:Q8.Transformer,Wedge:tb.Wedge,Filters:{Blur:eb.Blur,Brighten:ib.Brighten,Contrast:nb.Contrast,Emboss:rb.Emboss,Enhance:sb.Enhance,Grayscale:ab.Grayscale,HSL:ob.HSL,HSV:lb.HSV,Invert:hb.Invert,Kaleidoscope:cb.Kaleidoscope,Mask:ub.Mask,Noise:fb.Noise,Pixelate:db.Pixelate,Posterize:gb.Posterize,RGB:pb.RGB,RGBA:mb.RGBA,Sepia:vb.Sepia,Solarize:_b.Solarize,Threshold:yb.Threshold}});const bb=St(xt({__proto__:null,get Konva(){return T1},default:zr},[zr]));var wb=Ml.exports;Object.defineProperty(wb,"__esModule",{value:!0});const xb=bb;Ml.exports=xb.Konva;var Sb=Ml.exports;const wt=Ee(Sb),Cb=wt.Ellipse.prototype.toObject;wt.Ellipse.prototype.toObject=function(){const i=Cb.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash()}}};const kb=wt.Line.prototype.toObject;wt.Line.prototype.toObject=function(){const i=kb.call(this);return{...i,attrs:{...i.attrs,x:this.getAbsolutePosition().x,y:this.getAbsolutePosition().y,strokeWidth:this.strokeWidth(),dash:this.dash()}}};const Tb=wt.Node.prototype.toObject,Eb=function(){const i=Tb.call(this);return{...i,attrs:{...i.attrs,x:this.getAbsolutePosition().x,y:this.getAbsolutePosition().y,scaleX:this.getAbsoluteScale().x,scaleY:this.getAbsoluteScale().y,rotation:this.getAbsoluteRotation(),opacity:this.getAbsoluteOpacity()}}};wt.Node.prototype.toObject=Eb;const Ab=wt.Node.prototype.remove;wt.Node.prototype.remove=function(){return Ab.call(this),this.fire("removed",{target:this}),this};const Pb=wt.Node.prototype.moveUp;wt.Node.prototype.moveUp=function(){const i=Pb.call(this);return i&&this.fire("move:up"),i};const Mb=wt.Node.prototype.moveDown;wt.Node.prototype.moveDown=function(){const i=Mb.call(this);return i&&this.fire("move:down"),i};const Rb=wt.Node.prototype.moveToTop;wt.Node.prototype.moveToTop=function(){const i=Rb.call(this);return i&&this.fire("move:top"),i};const Lb=wt.Node.prototype.moveToBottom;wt.Node.prototype.moveToBottom=function(){const i=Lb.call(this);return i&&this.fire("move:bottom"),i};const Db=wt.Node.prototype.moveTo;wt.Node.prototype.moveTo=function(i){const t=Db.call(this,i);return this.fire("move:to"),t};const Ib=wt.Rect.prototype.toObject;wt.Rect.prototype.toObject=function(){const i=Ib.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash(),cornerRadius:this.cornerRadius()}}};const Ob=wt.RegularPolygon.prototype.toObject;wt.RegularPolygon.prototype.toObject=function(){const i=Ob.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash()}}};const Fb=wt.Text.prototype.toObject;wt.Text.prototype.toObject=function(){const i=Fb.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth()}}};const Nb=wt.Image.prototype.toObject;wt.Image.prototype.toObject=function(){const i=Nb.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash(),image:this.image()}}};const P1=(i,t)=>{if(i.length!==t.length)return!1;for(let e=0;e<i.length;e++){const n=i[e],r=t.find(s=>s.id===n.id);if(!r||!Ub(n,r))return!1}return!0},Ub=(i,t)=>i.attrs.id===i.attrs.id&&i._id===t._id,qn=i=>i.reduce((t,e)=>[...t,...e.toArray()],[]),Bb=i=>{i.sort(function(e,n){return e-n});const t=Math.floor(i.length/2);return i[t]},M1=i=>{const t=Math.atan2(i[1],i[0]),e=Math.pow(i[0],2)+Math.pow(i[1],2),n=Math.sqrt(e),r=(i[0]*i[3]-i[2]*i[1])/n;return{rotation:t/(Math.PI/180),scaleX:n,scaleY:r,x:i[4],y:i[5]}},Gb=(i,t)=>{const e=i.getTransform().getMatrix(),n=t.getTransform().getMatrix(),r=e[0],s=e[1],a=e[2],o=e[3],l=e[4],h=e[5],c=n[0],d=n[1],f=n[2],u=n[3],p=n[4],m=n[5],y=c*u,S=d*f,C=(f*s-r*u)/(S-y),_=(c*s-r*d)/(y-S),w=(f*o-a*u)/(S-y),k=(c*o-a*d)/(y-S),A=(f*(h-m)+u*(p-l))/(S-y),R=(c*(h-m)+d*(p-l))/(y-S);return M1([C,_,w,k,A,R])};class R1{app;constructor(t){this.app=t}}class $b extends R1{constructor(t){super(t),this.app.stage.on("mousedown",this.onMouseDown),this.app.stage.on("mouseup",this.onMouseUp),this.app.stage.on("mousemove",this.onMouseMove),this.app.stage.on("mouseover",this.onMouseOver),this.app.stage.on("mouseout",this.onMouseOut),this.app.stage.on("dblclick",this.onMouseDoubleClick),this.app.stage.on("click",this.onMouseClick),this.app.stage.on("contextmenu",this.onMouseContextmenu),this.app.stage.on("wheel",this.onWheel)}onMouseDown=t=>{t.evt.button===1&&this.app.triggerPanning(!0),!this.app.stage.draggable()&&this.app.emit("mouseDown",t)};onMouseUp=t=>{t.evt.button===1&&this.app.triggerPanning(!1),!this.app.stage.draggable()&&this.app.emit("mouseUp",t)};onMouseMove=t=>{this.app.stage.draggable()||this.app.emit("mouseMove",t)};onMouseOver=t=>{this.app.stage.draggable()||this.app.emit("mouseOver",t)};onMouseOut=t=>{this.app.stage.draggable()||this.app.emit("mouseOut",t)};onMouseDoubleClick=t=>{this.app.stage.draggable()||this.app.emit("mouseDoubleClick",t)};onMouseClick=t=>{this.app.stage.draggable()||this.app.emit("mouseClick",t)};onMouseContextmenu=t=>{this.app.triggerTool(!1),this.app.emit("mouseContextMenu",t),setTimeout(()=>this.app.triggerTool(!0),100)};onWheel=t=>{if(t.evt.preventDefault(),!this.app.config.mousewheel.enabled)return;const e=this.app.stage.scaleX();this.app.emit("canvasZoomStart",e);const n=this.app.stage.getPointerPosition()??new te(0,0),r=new te((n.x-this.app.stage.x())/e,(n.y-this.app.stage.y())/e),s=(t.evt.shiftKey&&!t.evt.ctrlKey?t.evt.deltaX:t.evt.deltaY)>0?1:-1;let a=e;s>0?a+=this.app.config.mousewheel.factor:a-=this.app.config.mousewheel.factor,a=Math.min(Math.max(a,this.app.config.scale.min),this.app.config.scale.max),this.app.stage.scale({x:a,y:a}),this.app.stage.position({x:n.x-r.x*a,y:n.y-r.y*a}),this.app.emit("canvasZoomEnd",a)};destroy(){this.app.stage.off("mousedown",this.onMouseDown),this.app.stage.off("mouseup",this.onMouseUp),this.app.stage.off("mousemove",this.onMouseMove),this.app.stage.off("mouseover",this.onMouseOver),this.app.stage.off("mouseout",this.onMouseOut),this.app.stage.off("dblclick",this.onMouseDoubleClick),this.app.stage.off("click",this.onMouseClick),this.app.stage.off("contextmenu",this.onMouseContextmenu),this.app.stage.off("wheel",this.onWheel)}}const L1=i=>typeof i=="function";class zb extends R1{currentTool=null;enable=!0;constructor(t){super(t),this.app.on("mouseDown",this.onMousedown),this.app.on("mouseMove",this.onMousemove),this.app.on("mouseUp",this.onMouseup),this.app.on("mouseClick",this.onClick),this.app.on("mouseDoubleClick",this.onDoubleClick)}get available(){return this.currentTool!==null&&this.enable&&!this.app.stage.draggable()}async setTool(t){const e=this.currentTool;e?.name!==t.name&&(e?.hooks&&L1(e?.hooks?.onInactive)&&await e.hooks.onInactive?.(this.app,e),this.currentTool=t,this.currentTool?.hooks&&L1(this.currentTool?.hooks?.onActive)&&await this.currentTool.hooks.onActive?.(this.app,this.currentTool),this.app.render(),this.app.emit("toolChanged",e,t))}trigger(t){const e=this.enable;t===void 0?this.enable=!this.enable:this.enable=t,this.currentTool?.enableChanged?.(e,this.enable)}onMousedown=t=>{!this.available||!this.currentTool?.mousedown||t.evt.button!==0||this.currentTool.mousedown({event:t,pointer:this.app.pointer,app:this.app})};onMouseup=t=>{!this.available||!this.currentTool?.mouseup||t.evt.button!==0||this.currentTool.mouseup({event:t,pointer:this.app.pointer,app:this.app})};onMousemove=t=>{!this.available||!this.currentTool?.mousemove||t.evt.button!==0||this.currentTool.mousemove({event:t,pointer:this.app.pointer,app:this.app})};onClick=t=>{!this.available||!this.currentTool?.click||t.evt.button!==0||this.currentTool.click({event:t,pointer:this.app.pointer,app:this.app})};onDoubleClick=t=>{!this.available||!this.currentTool?.doubleClick||t.evt.button!==0||this.currentTool.doubleClick({event:t,pointer:this.app.pointer,app:this.app})};destroy(){this.app.off("mouseDown",this.onMousedown),this.app.off("mouseMove",this.onMousemove),this.app.off("mouseUp",this.onMouseup),this.app.off("mouseClick",this.onClick),this.app.off("mouseDoubleClick",this.onDoubleClick),this.currentTool=null}}var Hb=Object.defineProperty,jb=Object.getOwnPropertyDescriptor,Ui=(i,t,e,n)=>{for(var r=n>1?void 0:n?jb(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Hb(t,e,r),r};class Vb{name="alignmentPlugin";alignment;app;options;keyFns=[];constructor(t){this.options={enabled:!0,...t}}install(t){this.app=t,this.alignment=new vi(t,this.options),this.app.alignLeft=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignLeft(e),this},this.app.alignRight=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignRight(e),this},this.app.alignTop=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignTop(e),this},this.app.alignBottom=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignBottom(e),this},this.app.alignCenterX=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignCenterX(e),this},this.app.alignCenterY=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignCenterY(e),this},this.app.dispersionX=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.dispersionX(e),this},this.app.dispersionY=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.dispersionY(e),this},this.keyFns.push(this.app.domKey.on({key:"a",title:"左对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"h",title:"水平居中",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"d",title:"右对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"w",title:"顶对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"v",title:"垂直居中",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"s",title:"底对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"h",title:"水平分布",ctrl:!0,shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"v",title:"垂直分布",ctrl:!0,shift:!0},()=>{})),this.app.emit("alignmentInstalled",this)}destroy(){this.keyFns.forEach(t=>t.removeListener?.()),this.keyFns=[],this.app?.emit("alignmentDestroy",this)}enable(){this.alignment&&(this.options.enabled=!0,this.alignment.enabled=!0)}disable(){this.alignment&&(this.options.enabled=!1,this.alignment.enabled=!1)}isEnabled(){return this.options.enabled&&(this.alignment?.enabled??!1)}}function Bi(i,t,e){const n=e.value;return e.value=function(...r){if(this.enabled)return n.apply(this,r);console.log(`Method ${t} is disabled.`)},e}class vi{app;enabled;constructor(t,e){const{enabled:n}=e;this.app=t,this.enabled=n}alignLeft(t){const e=t.map(r=>r.getClientRect()),n=Math.min(...e.map(r=>r.x));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=e[s].x-n;return a.attrs={...a.attrs,x:a.attrs.x-o},a}))}alignRight(t){const e=t.map(r=>r.getClientRect()),n=Math.max(...e.map(r=>r.x+r.width));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=n-(e[s].x+e[s].width);return a.attrs={...a.attrs,x:a.attrs.x+o},a}))}alignTop(t){const e=t.map(r=>r.getClientRect()),n=Math.min(...e.map(r=>r.y));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=e[s].y-n;return a.attrs={...a.attrs,y:a.attrs.y-o},a}))}alignBottom(t){const e=t.map(r=>r.getClientRect()),n=Math.max(...e.map(r=>r.y+r.height));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=n-(e[s].y+e[s].height);return a.attrs={...a.attrs,y:a.attrs.y+o},a}))}alignCenterX(t){const e=t.map(r=>r.getClientRect()),n=e.reduce((r,s)=>r+(s.x+s.width/2),0)/e.length;this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=n-(e[s].x+e[s].width/2);return a.attrs={...a.attrs,x:a.attrs.x+o},a}))}alignCenterY(t){const e=t.map(r=>r.getClientRect()),n=e.reduce((r,s)=>r+(s.y+s.height/2),0)/e.length;this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=n-(e[s].y+e[s].height/2);return a.attrs={...a.attrs,y:a.attrs.y+o},a}))}dispersionX(t){t.map(r=>r.getClientRect().x+r.getClientRect().width/2).every((r,s,a)=>r===a[0])||this.distributeNodes(t,"x")}dispersionY(t){t.map(r=>r.getClientRect().y+r.getClientRect().height/2).every((r,s,a)=>r===a[0])||this.distributeNodes(t,"y")}distributeNodes(t,e){if(t.length<=2)return;t.sort((d,f)=>d.getClientRect()[e]-f.getClientRect()[e]);const n=t[0],r=t[t.length-1],s=n.getClientRect()[e]+(e==="x"?n.getClientRect().width:n.getClientRect().height),a=r.getClientRect()[e]-s,l=t.slice(1,-1).reduce((d,f)=>d+(e==="x"?f.getClientRect().width:f.getClientRect().height),0),h=Math.max((a-l)/(t.length-1),0);let c=s;this.app.update(...t.map((d,f)=>{const u=d.toObject();if(f===0||f===t.length-1)return u;const p=c+h;return u.attrs[e]=p-d.getClientRect()[e]+u.attrs[e],c=p+(e==="x"?d.getClientRect().width:d.getClientRect().height),u}))}}Ui([Bi],vi.prototype,"alignLeft",1),Ui([Bi],vi.prototype,"alignRight",1),Ui([Bi],vi.prototype,"alignTop",1),Ui([Bi],vi.prototype,"alignBottom",1),Ui([Bi],vi.prototype,"alignCenterX",1),Ui([Bi],vi.prototype,"alignCenterY",1),Ui([Bi],vi.prototype,"dispersionX",1),Ui([Bi],vi.prototype,"dispersionY",1);class D1{app;selected;optionLayer;enabled;multipleSelect;hightLightConfig;transformerConfig;rubberConfig;transformer;rubberRect;rubberStartPoint=new te(0,0);rubberEnable=!1;hightLightRects;constructor(t,e){const{enabled:n,multipleSelect:r,transformer:s,hightLight:a,rubber:o}=e;this.app=t,this.selected=new Map,this.hightLightRects=new Map,this.enabled=n,this.multipleSelect=r,this.transformerConfig=s,this.hightLightConfig=a,this.rubberConfig=o,this.optionLayer=new wt.Layer,this.optionLayer.name("pictode:option:layer"),this.app.stage.add(this.optionLayer),this.transformer=new wt.Transformer({...this.transformerConfig,shouldOverdrawWholeArea:!1,flipEnabled:!1}),this.transformer.anchorStyleFunc(l=>{["middle-left","middle-right","top-center","bottom-center"].some(c=>l.hasName(c))&&([...this.selected.values()][0]instanceof wt.Text||[...this.selected.values()][0]instanceof wt.Group||this.selected.size>1)&&l.visible(!1);const h=(c="")=>{const d=l.getStage();!d||!d.content||(d.content.style.cursor=c)};l.on("mousedown",()=>{this.enabled=!1}),l.on("mouseup",()=>{this.enabled=!0}),l.on("mouseenter",()=>{this.enabled=!1,l.hasName("rotater")&&h("grabbing")}),l.on("mouseout",()=>{this.enabled=!0,l.hasName("rotater")&&h()})}),this.optionLayer.add(this.transformer),this.rubberRect=new wt.Rect({stroke:this.rubberConfig.stroke,fill:this.rubberConfig.fill,strokeWidth:this.rubberConfig.strokeWidth,strokeScaleEnabled:!1}),this.optionLayer.add(this.rubberRect),this.transformer.on("transformstart",this.onTransformStart),this.transformer.on("transformend",this.onTransformEnd),this.transformer.on("dragstart",this.onDragStart),this.transformer.on("dragend",this.onDragEnd),this.app.on("mouseDown",this.onMouseDown),this.app.on("mouseMove",this.onMouseMove),this.app.on("mouseUp",this.onMouseUp),this.app.on("mouseClick",this.onMouseClick),this.app.on("mouseOut",this.onMouseOut)}handleNodeRemoved=({target:t})=>{this.cancelSelect(t),t.off("removed",this.handleNodeRemoved)};select(...t){this.enabled&&(P1(t,[...this.selected.values()])||(this.cancelSelect(),this.transformer.nodes(t.filter(e=>(e.draggable(!0),e.on("removed",this.handleNodeRemoved),this.selected.set(e.id(),e),e!==this.rubberRect))),this.setHightRect(...t),this.app.render(),this.app.emit("selectedChanged",Array.from(this.selected.values()))))}cancelSelect(...t){this.selected.size!==0&&(t.length===0&&(t=[...this.selected.values()]),t.forEach(e=>{e.draggable(!1),e.off("removed",this.handleNodeRemoved),this.selected.delete(e.id())}),this.removeHightRect(...t),this.transformer.nodes([...this.selected.values()]),this.app.emit("selectedChanged",Array.from(this.selected.values())))}selectAll(){this.select(...this.app.mainLayer.getChildren())}triggerSelector(t){t===void 0?this.enabled=!this.enabled:this.enabled=t,this.enabled||(this.rubberEnable=!1)}isSelected(t){return this.selected.has(t.id())}getSelectClientRect(){return this.transformer.getClientRect()}setHightRect(...t){this.hightLightRects=t.reduce((e,n)=>{const r=new wt.Rect({stroke:this.hightLightConfig.stroke,strokeWidth:this.hightLightConfig.strokeWidth,dash:this.hightLightConfig.dash,fillEnabled:!1,strokeScaleEnabled:!1});this.calculateNodeRect(n,r,this.hightLightConfig.padding??0),this.optionLayer.add(r);const s=()=>requestAnimationFrame(()=>this.calculateNodeRect(n,r,this.hightLightConfig.padding??0));return n.on("dragmove transform xChange yChange",s),e.set(n.id(),{rect:r,transformHandler:s}),e},new Map)}removeHightRect(...t){t.forEach(e=>{const n=this.hightLightRects.get(e.id());n&&(e.off("dragmove transform xChange yChange",n.transformHandler),n.rect.remove(),this.hightLightRects.delete(e.id()))})}calculateNodeRect(t,e,n=0){const{x:r,y:s,width:a,height:o}=this.getNodeRect(t,n);e.position({x:(r-this.app.stage.x())/this.app.stage.scaleX(),y:(s-this.app.stage.y())/this.app.stage.scaleY()}),e.width(a/this.app.stage.scaleX()),e.height(o/this.app.stage.scaleY()),e.rotation(t.rotation())}getNodeRect(t,e=0){const n=f=>wt.angleDeg?f*Math.PI/180:f,r=[];let s=[];t instanceof wt.Group?s=t.getChildren():s=[t],s.map(f=>{const u=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.transformer.ignoreStroke()}),p=[{x:u.x,y:u.y},{x:u.x+u.width,y:u.y},{x:u.x+u.width,y:u.y+u.height},{x:u.x,y:u.y+u.height}],m=f.getAbsoluteTransform();p.forEach(function(y){const S=m.point(y);r.push(new te(S.x,S.y))})});const a=new wt.Transform;a.rotate(-n(t.rotation()));let o,l,h,c;r.forEach(function(f){const u=a.point(f);(o===void 0||l===void 0||h===void 0||c===void 0)&&(o=h=u.x,l=c=u.y),o=Math.min(o,u.x),l=Math.min(l,u.y),h=Math.max(h,u.x),c=Math.max(c,u.y)}),a.invert();const d=a.point({x:(o??0)-e,y:(l??0)-e});return{x:d.x,y:d.y,width:(h??0)-(o??0)+e*2,height:(c??0)-(l??0)+e*2}}onTransformStart=()=>{this.app.emit("nodeTransformStart",Array.from(this.selected.values())),this.app.emit("nodeUpdateBefore",Array.from(this.selected.values()))};onTransformEnd=()=>{this.app.emit("nodeTransformEnd",Array.from(this.selected.values())),this.app.emit("nodeUpdated",Array.from(this.selected.values()))};onDragStart=()=>{this.app.emit("nodeTransformStart",Array.from(this.selected.values())),this.app.emit("nodeUpdateBefore",Array.from(this.selected.values()))};onDragEnd=()=>{this.app.emit("nodeTransformEnd",Array.from(this.selected.values())),this.app.emit("nodeUpdated",Array.from(this.selected.values()))};onMouseDown=t=>{!this.enabled||t.evt.button!==0||t.target instanceof wt.Stage&&(this.cancelSelect(),this.rubberStartPoint.clone(this.app.pointer),this.rubberRect.setPosition(this.rubberStartPoint),this.rubberRect.width(0),this.rubberRect.height(0),this.rubberRect.visible(!1),this.rubberEnable=!0)};onMouseMove=()=>{if(!this.enabled||!this.rubberEnable)return;const t=new te(Math.min(this.app.pointer.x,this.rubberStartPoint.x),Math.min(this.app.pointer.y,this.rubberStartPoint.y));this.rubberRect.setPosition(t),this.rubberRect.width(Math.max(this.app.pointer.x,this.rubberStartPoint.x)-t.x),this.rubberRect.height(Math.max(this.app.pointer.y,this.rubberStartPoint.y)-t.y),this.rubberRect.visible(!0)};onMouseUp=t=>{if(!(!this.enabled||t.evt.button!==0)&&this.rubberEnable){const e=this.app.getShapesInArea(this.rubberRect);this.select(...e),this.rubberRect.visible(!1),this.rubberEnable=!1;return}};onMouseClick=t=>{if(!this.enabled||t.evt.button!==0||t.target instanceof wt.Stage||!t.target.attrs.id)return;const n=this.app.findTopGroup(t.target)??t.target;t.evt.shiftKey&&this.multipleSelect?this.selected.has(n.attrs.id)?this.cancelSelect(n):this.select(...this.selected.values(),n):this.select(n)};onMouseOut=t=>{t.target instanceof wt.Stage&&(this.rubberEnable=!1)};destroy(){this.transformer.off("transformstart",this.onTransformStart),this.transformer.off("transformend",this.onTransformEnd),this.transformer.off("dragstart",this.onDragStart),this.transformer.off("dragend",this.onDragEnd),this.app.off("mouseDown",this.onMouseDown),this.app.off("mouseMove",this.onMouseMove),this.app.off("mouseUp",this.onMouseUp),this.app.off("mouseClick",this.onMouseClick),this.app.off("mouseOut",this.onMouseOut),this.selected.clear(),this.enabled=!1,this.transformer.remove(),this.optionLayer.remove()}}const qb={enabled:!0,multipleSelect:!0,transformer:{padding:6,ignoreStroke:!0,borderStroke:"#4e86e3",borderStrokeWidth:1,borderDash:[3,3],anchorSize:8,anchorStroke:"#4e86e3",anchorCornerRadius:3,anchorStrokeWidth:1,rotateAnchorOffset:20},hightLight:{padding:3,stroke:"#4e86e3",strokeWidth:1},rubber:{stroke:"#4e86e3",strokeWidth:1,fill:"#4e86e350"}};class Xb{name="selectorPlugin";selector;app;options;keyFns=[];constructor(t){this.options={...qb,...t}}install(t){this.app=t,this.selector=new D1(t,this.options),this.app.on("canvasCleared",this.onCanvasCleared),this.app.select=function(...e){const n=this.app.getPlugin("selectorPlugin");return n&&n.selector?.select(...e),this},this.app.cancelSelect=function(...e){const n=this.app.getPlugin("selectorPlugin");return n&&n.selector?.cancelSelect(...e),this},this.app.selectByEvent=function(e){return this.app.getPlugin("selectorPlugin")&&(e.target instanceof wt.Stage?this.cancelSelect():this.select(e.target)),this},this.app.selectAll=function(){const e=this.app.getPlugin("selectorPlugin");return e&&e.selector?.selectAll(),this},this.app.triggerSelector=function(e){const n=this.app.getPlugin("selectorPlugin");return n&&n.selector?.triggerSelector(e),this},this.app.isSelected=function(e){const n=this.app.getPlugin("selectorPlugin");return n?n.selector?.isSelected(e)??!1:!1},this.keyFns.push(this.app.domKey.on({key:"a",title:"全部选中",exact:!0,ctrl:!0},()=>{const e=this.app?.isPluginEnable("selectorPlugin");this.app?.triggerSelector(!0),this.app?.selectAll(),this.app?.triggerSelector(e)})),this.keyFns.push(this.app.domKey.on({key:"g",title:"组合",ctrl:!0,shift:!0,exact:!0},()=>{})),this.app.emit("selectorInstalled",this)}destroy(){this.keyFns.forEach(t=>t.removeListener?.()),this.keyFns=[],this.selector?.destroy(),this.app?.off("canvasCleared",this.onCanvasCleared),this.app?.emit("selectorDestroy",this)}enable(){this.selector&&(this.selector.triggerSelector(!0),this.options.enabled=!0)}disable(){this.selector&&(this.selector.cancelSelect(),this.selector.triggerSelector(!1),this.options.enabled=!1)}isEnabled(){return this.options.enabled&&(this.selector?.enabled??!1)}onCanvasCleared=()=>{this.selector?.cancelSelect()}}class Xn{app;id=0;name;options;executed=!1;executeTime=new Date().getTime();constructor(t,e){this.app=t,this.name=this.constructor.name,this.options=e}toJSON(){return{id:this.id,name:this.name,options:this.options,executed:this.executed,executeTime:this.executeTime}}fromJSON(t){this.id=t.id,this.name=t.name,this.options=t.options,this.executed=t.executed,this.executeTime=t.executeTime}}class Yb extends Xn{constructor(t,e){super(t,e)}execute(){this.app._add(...this.options.nodes)}undo(){this.app._remove(...this.options.nodes)}}class Wb extends Xn{constructor(t,e){super(t,e)}execute(){this.app._remove(...this.options.nodes)}undo(){this.app._add(...this.options.nodes)}}class Kb extends Xn{constructor(t,e){super(t,e)}execute(){this.app._update(...this.options.newNodes)}undo(){this.app._update(...this.options.oldNodes)}}class Zb extends Xn{constructor(t,e){super(t,e)}execute(){this.options.nodes.forEach(({node:t,newZIndex:e})=>{t.setZIndex(e)})}undo(){this.options.nodes.forEach(({node:t,oldZIndex:e})=>{t.setZIndex(e)})}}class Jb extends Xn{constructor(t,e){super(t,e)}execute(){this.app._makeGroup(this.options.nodes)}undo(){this.app._decomposeGroup(this.options.group)}}class Qb extends Xn{constructor(t,e){super(t,e)}execute(){this.app._decomposeGroup(this.options.group)}undo(){this.app._makeGroup(this.options.nodes)}}class I1{name="history";app;enabled;stackSize;undoStack=[];redoStack=[];idCounter=0;constructor(t,e){const{enabled:n,stackSize:r}=e;this.app=t,this.enabled=n,this.stackSize=r}execute(t,e){this.undoStack.length>this.stackSize&&this.undoStack.shift(),this.undoStack.push(t),t.id=++this.idCounter,e&&t.execute(),t.executed=!0,t.executeTime=new Date().getTime(),this.redoStack=[],this.app.emit("stackChanged",this.undoStack,this.redoStack)}undo(t=1){if(!this.enabled)return;let e;for(;t;)this.undoStack.length>0&&(e=this.undoStack.pop(),e&&(e.undo(),this.redoStack.push(e),this.app.emit("stackChanged",this.undoStack,this.redoStack))),--t;return this.app.emit("historyUndo",t,e?.toJSON()),e}redo(t=1){if(!this.enabled)return;let e;for(;t;)this.redoStack.length>0&&(e=this.redoStack.pop(),e&&(e.execute(),this.undoStack.push(e),this.app.emit("stackChanged",this.undoStack,this.redoStack))),--t;return this.app.emit("historyRedo",t,e?.toJSON()),e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}jump(t){if(!this.enabled)return;let e=this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0;if(e===void 0||t>e.id)for(e=this.redo();e!==void 0&&t>e.id;)e=this.redo();else for(;e=this.undoStack[this.undoStack.length-1],!(e===void 0||t===e.id);)this.undo();this.app.emit("stackChanged",this.undoStack,this.redoStack)}destroy(){this.undoStack=[],this.redoStack=[],this.app.emit("stackChanged",this.undoStack,this.redoStack)}}class tw{name="historyPlugin";history;app;options;keyFns=[];oldNodes=[];constructor(t){this.options={enabled:!0,stackSize:100,...t}}install(t){this.app=t,this.history=new I1(t,this.options),this.history.app=t,this.app.on("nodeAdded",this.onNodeAdded),this.app.on("nodeRemoved",this.onNodeRemove),this.app.on("nodeUpdateBefore",this.onNodeUpdateBefore),this.app.on("nodeZindexChanged",this.onNodeZIndexChanged),this.app.on("nodeGroupMake",this.onMakeGroup),this.app.on("nodeGroupDecompose",this.onDecomposeGroup),this.app.on("nodeUpdated",this.onNodeUpdated),this.app.undo=function(e=1){const n=this.app.getPlugin("historyPlugin");return n&&n.history?.undo(e),this},this.app.redo=function(e=1){const n=this.app.getPlugin("historyPlugin");return n&&n.history?.redo(e),this},this.app.canUndo=function(){const e=this.app.getPlugin("historyPlugin");return e?e.history?.canUndo()??!1:!1},this.app.canRedo=function(){const e=this.app.getPlugin("historyPlugin");return e?e.history?.canRedo()??!1:!1},this.app.jump=function(e){const n=this.app.getPlugin("historyPlugin");return n&&n.history?.jump(e),this},this.keyFns.push(this.app.domKey.on({key:"z",title:"撤销",exact:!0,ctrl:!0},()=>{this.app?.undo()})),this.keyFns.push(this.app.domKey.on({key:"y",title:"重做",exact:!0,ctrl:!0},()=>{this.app?.redo()})),this.app.emit("historyInstalled",this)}destroy(){this.keyFns.forEach(t=>t.removeListener?.()),this.keyFns=[],this.history?.destroy(),this.app?.off("nodeAdded",this.onNodeAdded),this.app?.off("nodeRemoved",this.onNodeRemove),this.app?.off("nodeUpdateBefore",this.onNodeUpdateBefore),this.app?.off("nodeUpdated",this.onNodeUpdated),this.app?.off("nodeGroupMake",this.onMakeGroup),this.app?.off("nodeGroupDecompose",this.onDecomposeGroup),this.app?.emit("historyDestroy",this)}enable(){this.history&&(this.options.enabled=!0,this.history.enabled=!0)}disable(){this.history&&(this.options.enabled=!1,this.history.enabled=!1)}isEnabled(){return this.options.enabled&&(this.history?.enabled??!1)}onNodeAdded=t=>{!this.app||!this.history||this.history.execute(new Yb(this.app,{nodes:t}))};onNodeRemove=t=>{!this.app||!this.history||this.history.execute(new Wb(this.app,{nodes:t}))};onNodeUpdateBefore=t=>{this.oldNodes=t.map(e=>e.toObject())};onNodeUpdated=t=>{!this.app||!this.history||this.history.execute(new Kb(this.app,{oldNodes:this.oldNodes,newNodes:t.map(e=>e.toObject())}))};onNodeZIndexChanged=t=>{!this.app||!this.history||this.history.execute(new Zb(this.app,{nodes:t}))};onMakeGroup=(t,e)=>{!this.app||!this.history||this.history.execute(new Jb(this.app,{nodes:e,group:t}))};onDecomposeGroup=(t,e)=>{!this.app||!this.history||this.history.execute(new Qb(this.app,{nodes:e,group:t}))}}class ew{name="diamondTool";hooks;config;diamond=null;startPointer=new te(0,0);constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.diamond||(this.startPointer.clone(t.pointer),this.diamond=new wt.RegularPolygon({sides:4,radius:0,strokeScaleEnabled:!1,...this.config}),this.diamond.setPosition(this.startPointer),t.add(this.diamond),this.hooks?.onStartDrawing?.(t,this.diamond))}mousemove({app:t}){if(!this.diamond)return;const e=t.pointer.x-this.startPointer.x,n=t.pointer.y-this.startPointer.y,r=new te(this.startPointer.x+e/2,this.startPointer.y+n/2);this.diamond.setPosition(r),this.diamond.radius(r.distanceTo(t.pointer)),t.render()}mouseup({app:t,pointer:e}){if(this.diamond){if(this.startPointer.eq(e)){this.diamond?.destroy(),this.diamond=null;return}this.hooks?.onCompleteDrawing?.(t,this.diamond),this.diamond=null,this.startPointer.setXY(0,0)}}enableChanged(){this.diamond=null,this.startPointer.setXY(0,0)}}class iw{name="drawingTool";config;hooks;line=null;points=[];constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){const e=this.points.at(-1);(!e||!e.eq(t.pointer))&&this.points.push(t.pointer),!this.line&&(this.line=new wt.Line({points:qn(this.points),globalCompositeOperation:"source-over",lineCap:"round",lineJoin:"round",strokeScaleEnabled:!1,hitStrokeWidth:20,...this.config}),t.add(this.line),this.hooks?.onStartDrawing?.(t,this.line))}mousemove({app:t,event:e}){this.line&&(e.evt.stopPropagation(),this.points.push(t.pointer),this.line.points(qn(this.points)))}mouseup({app:t,pointer:e}){if(!this.line)return;const n=this.points.at(-1);this.points.length<=6&&n&&e.distanceTo(n)<10&&this.line&&this.line.destroy(),this.hooks?.onCompleteDrawing?.(t,this.line),this.line=null,this.points=[]}enableChanged(){this.line=null,this.points=[]}}class nw{name="ellipseTool";config;hooks;ellipse=null;startPointer=new te(0,0);constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.ellipse||(this.startPointer.clone(t.pointer),this.ellipse=new wt.Ellipse({radiusX:0,radiusY:0,strokeScaleEnabled:!1,...this.config}),this.ellipse.setPosition(this.startPointer),this.ellipse.radius(new te(0,0)),t.add(this.ellipse))}mousemove({app:t}){if(!this.ellipse)return;const e=t.pointer.x-this.startPointer.x,n=t.pointer.y-this.startPointer.y,r=new te(Math.abs(e)/2,Math.abs(n)/2);this.ellipse.setPosition(new te(this.startPointer.x+e/2,this.startPointer.y+n/2)),this.ellipse.radius(r),t.render()}mouseup({app:t,pointer:e}){if(this.ellipse){if(this.startPointer.eq(e)){this.ellipse?.destroy(),this.ellipse=null;return}this.hooks?.onCompleteDrawing?.(t,this.ellipse),this.ellipse=null,this.startPointer.setXY(0,0)}}enableChanged(){this.ellipse=null,this.startPointer.setXY(0,0)}}class rw{name="imageTool";config;hooks;image=null;isAdded=!1;imageElement=new Image;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.image&&(this.image.opacity(1),this.hooks?.onCompleteDrawing?.(t,this.image),this.image=null)}mousemove({app:t,pointer:e}){if(this.isAdded||(this.image=new wt.Image({strokeScaleEnabled:!1,image:this.imageElement,...this.config}),this.image.opacity(.5),this.image.image(this.imageElement),t.add(this.image),this.isAdded=!0),!this.image)return;const n=200,r=n*((this.imageElement.height??1)/(this.imageElement.width??1));this.image.width(n),this.image.height(r),this.image.position(new te(e.x-n/2,e.y-r/2)),t.render()}enableChanged(){this.image=null,this.imageElement=new Image}}class sw{name="lineTool";config;hooks;points=[];line=null;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.line||(this.line=new wt.Line({points:qn(this.points),fill:"transparent",strokeScaleEnabled:!1,hitStrokeWidth:20,...this.config}),t.add(this.line),this.hooks?.onStartDrawing?.(t,this.line));const e=this.points.at(-1);(!e||!e.eq(t.pointer))&&this.points.push(t.pointer),this.line.points(qn(this.points))}mousemove({app:t,pointer:e}){this.line&&(this.line.points(qn(this.points).concat(e.x,e.y)),t.render())}doubleClick({app:t}){this.line&&(this.hooks?.onCompleteDrawing?.(t,this.line),this.line=null,this.points=[])}enableChanged(){this.line=null,this.points=[]}}class aw{name="rectTool";config;hooks;startPointer=new te(0,0);rectangle=null;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.rectangle||(this.startPointer.clone(t.pointer),this.rectangle=new wt.Rect({strokeScaleEnabled:!1,...this.config}),this.rectangle.setPosition(this.startPointer),this.rectangle.width(0),this.rectangle.height(0),t.add(this.rectangle),this.hooks?.onStartDrawing?.(t,this.rectangle))}mousemove({app:t}){this.rectangle&&(this.rectangle.setPosition(new te(Math.min(this.startPointer.x,t.pointer.x),Math.min(this.startPointer.y,t.pointer.y))),this.rectangle.width(Math.abs(t.pointer.x-this.startPointer.x)),this.rectangle.height(Math.abs(t.pointer.y-this.startPointer.y)),t.render())}mouseup({app:t,pointer:e}){if(this.rectangle){if(this.startPointer.eq(e)){this.rectangle?.destroy(),this.rectangle=null;return}this.hooks?.onCompleteDrawing?.(t,this.rectangle),this.rectangle=null,this.startPointer.setXY(0,0)}}enableChanged(){this.rectangle=null,this.startPointer.setXY(0,0)}}class ow{name="selectTool";hooks;constructor(t){this.hooks=t.hooks}}const lw=(i,t,e)=>{t.hide();const n=t.absolutePosition(),r={x:i.stage.container().offsetLeft+n.x,y:i.stage.container().offsetTop+n.y},s=document.createElement("textarea");document.body.appendChild(s),s.value=t.text(),s.style.position="absolute",s.style.top=r.y+"px",s.style.left=r.x+"px",s.style.width=t.width()*t.scaleX()-t.padding()*2+"px",s.style.height=t.height()*t.scaleX()-t.padding()*2+5+"px",s.style.fontSize=t.fontSize()*t.scaleX()+"px",s.style.border="none",s.style.padding="0px",s.style.margin="0px",s.style.overflow="hidden",s.style.background="none",s.style.outline="none",s.style.resize="none",s.style.lineHeight=t.lineHeight().toString(),s.style.fontFamily=t.fontFamily(),s.style.transformOrigin="left top",s.style.textAlign=t.align(),s.style.color=t.stroke(),s.style.caretColor=t.stroke();const a=t.rotation();let o="";a&&(o+="rotateZ("+a+"deg)");let l=0;navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&(l+=2+Math.round(t.fontSize()/20)),o+="translateY(-"+l+"px)",s.style.transform=o,s.style.height=s.scrollHeight+3+"px",s.focus();function c(){s.parentNode?.removeChild(s),window.removeEventListener("click",f),t.show()}function d(u){u=Math.max(s.value.length*t.fontSize(),u);const p=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),m=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;(p||m)&&(u=Math.ceil(u)),(document.DOCUMENT_NODE||/Edge/.test(navigator.userAgent))&&(u+=1),s.style.width=u+"px"}s.addEventListener("keydown",function(u){u.key==="Enter"&&!u.shiftKey&&(s.value.trim().length>=1?t.text(s.value.charAt(0)===" "?s.value.substring(1):s.value):i.remove(t),c(),e()),u.key==="Escape"&&c()}),s.addEventListener("keydown",function(){const u=t.getAbsoluteScale().x;d(t.width()*u),s.style.height="auto",s.style.height=s.scrollHeight+t.fontSize()+"px"});function f(u){u.target!==s&&(t.text(s.value),c())}setTimeout(()=>{window.addEventListener("click",f)})};class hw{name="textTool";config;hooks;textNode=null;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}doubleClick({app:t,pointer:e}){this.textNode=new wt.Text({...this.config,text:" ",x:e.x,y:e.y,fontFamily:"JiaYouYa"}),this.textNode.on("dblclick",({target:n})=>{lw(t,n,()=>{this.hooks?.onCompleteDrawing?.(t,n)})}),t.add(this.textNode),this.textNode.fire("dblclick")}enableChanged(){this.textNode=null}}class cw{name="eraserTool";hooks;targetMap=new Map;isEraser=!1;constructor(t){this.hooks=t.hooks}mousedown({event:t}){this.isEraser=!0,!(t.target instanceof wt.Stage)&&(this.targetMap.set(t.target.id(),{node:t.target,opacity:t.target.attrs.opacity}),t.target.opacity(.3))}mouseup({app:t}){this.targetMap.size&&(t.remove(...[...this.targetMap.values()].map(({node:e,opacity:n})=>(e.opacity(n),e))),this.targetMap.clear(),this.isEraser=!1)}mousemove({event:t}){!this.isEraser||t.target instanceof wt.Stage||this.targetMap.get(t.target.id())||(this.targetMap.set(t.target.id(),{node:t.target,opacity:t.target.attrs.opacity}),t.target.opacity(.3))}enableChanged(){this.targetMap.clear(),this.isEraser=!1}}const O1={backgroundColor:"#ffffff",scale:{min:.05,max:5},panning:{enabled:!1,cursor:"grabbing"},mousewheel:{enabled:!1,factor:.1}};class uw extends qp{stage;mainLayer;config;domKey=new oa;mouse;tooler;installedPlugins=new Map;resizeObserver;constructor(t){super(),this.config={...O1,...t},this.stage=new wt.Stage({container:document.createElement("div"),width:500,height:500}),this.stage.container().style.backgroundColor=this.config.backgroundColor,this.mainLayer=new wt.Layer,this.mainLayer.name("main:layer"),this.stage.add(this.mainLayer),this.tooler=new zb(this),this.mouse=new $b(this),this.resizeObserver=new ResizeObserver(e=>{const{width:n,height:r}=e[0].contentRect;this.stage.width(n),this.stage.height(r),this.emit("resizeRoot",n,r),this.render()}),this.triggerPanning(this.config.panning.enabled),this.triggerMouseWheel(this.config.mousewheel.enabled),this.registerKeyFns()}registerKeyFns(){this.domKey.on({key:"o",title:"打开",exact:!0,ctrl:!0},()=>{Ic().then(t=>Io(t[0])).then(t=>{this.fromJSON(t)})}),this.domKey.on({key:"e",title:"导出图片",exact:!0,ctrl:!0,shift:!0},()=>{}),this.domKey.on({key:"[",title:"下移一层",exact:!0,ctrl:!0},()=>{}),this.domKey.on({key:"]",title:"上移一层",exact:!0,ctrl:!0},()=>{}),this.domKey.on({key:"[",title:"置于底层",exact:!0,ctrl:!0,shift:!0},()=>{}),this.domKey.on({key:"]",title:"置于顶层",exact:!0,ctrl:!0,shift:!0},()=>{}),this.domKey.on({key:["delete","backspace"],title:"删除"},()=>{console.log("删除")}),this.domKey.on({key:"r",title:"重置画布",exact:!0,ctrl:!0},()=>{}),this.domKey.on({key:" ",title:"移动画布"},()=>(console.log("移动画布"),this.triggerPanning(!0),()=>{this.triggerPanning(!1)})),this.domKey.on({key:["Control","Meta"],title:"缩放画布"},()=>(this.triggerMouseWheel(!0),()=>{this.triggerMouseWheel(!1)})),this.domKey.on({key:"j",title:"解除组合",ctrl:!0,shift:!0,exact:!0},()=>{})}get pointer(){const{x:t,y:e}=this.stage.getRelativePointerPosition()??{x:0,y:0};return new te(t,e)}get curTool(){return this.tooler.currentTool}get containerElement(){return this.stage.container()}mount(t){this.stage.container(t),this.resizeObserver.observe(this.stage.container())}async setTool(t){await this.tooler.setTool(t)}triggerPanning(t){return t===void 0?this.stage.draggable(this.stage.draggable()):this.stage.draggable(t),this.stage.draggable()?this.stage.container().style.cursor=this.config.panning.cursor??"grabbing":this.stage.container().style.cursor="default",this}triggerMouseWheel(t){return t===void 0?this.config.mousewheel.enabled=!this.config.mousewheel.enabled:this.config.mousewheel.enabled=t,this}triggerTool(t){return this.tooler.trigger(t),this}add(...t){return this._add(...t),this.emit("nodeAdded",t),this}_add(...t){return this.mainLayer.add(...t.map(e=>(e.attrs.id||e.id(`#${ng()}`),e))),this.render(),this}remove(...t){return this._remove(...t),this.emit("nodeRemoved",t),this}_remove(...t){return t.forEach(e=>{e.remove()}),this.render(),this}update(...t){const e=n=>n.reduce((r,s)=>{const a=this.getNodeById(s.attrs.id);return a&&r.push(a),r},[]);return this.emit("nodeUpdateBefore",e(t)),this._update(...t),this.emit("nodeUpdated",e(t)),this}_update(...t){return t.forEach(e=>{this.getNodeById(e.attrs.id)?.setAttrs(e.attrs)}),this.render(),this}makeGroup(t){const e=this._makeGroup(t);return e instanceof wt.Group&&this.emit("nodeGroupMake",e,t),e}_makeGroup(t){if(t.length<2)return t;const e=new wt.Group({draggable:!0});return e.add(...t.map(n=>(n.draggable(!1),n))),this._add(e),e}decomposeGroup(t){const e=this._decomposeGroup(t);return this.emit("nodeGroupDecompose",t,e),e}_decomposeGroup(t){const e=t.getParent()??this.mainLayer,n=[...t.getChildren()].map(r=>{const{x:s,y:a,scaleX:o,scaleY:l,skewX:h,skewY:c,rotation:d}=r.getTransform().decompose();return r.moveTo(e),r.x(s),r.y(a),r.scaleX(o),r.scaleY(l),r.skewX(h),r.skewY(c),r.rotation(d),r});return this._remove(t),n}findTopGroup(t){return t.parent instanceof wt.Group&&t.parent.parent instanceof wt.Group?this.findTopGroup(t.parent):t.parent instanceof wt.Group?t.parent:null}moveUp(...t){return this.moveZIndexNodes(t,e=>e.moveUp()),this}moveDown(...t){return this.moveZIndexNodes(t,e=>e.moveDown()),this}moveTop(...t){return this.moveZIndexNodes(t,e=>e.moveToTop()),this}moveBottom(...t){return t.forEach(e=>e.moveToBottom()),this.moveZIndexNodes(t,e=>e.moveToBottom()),this}moveZIndexNodes(t,e){const n=t.map(r=>{const s={node:r,oldZIndex:r.getZIndex(),newZIndex:r.getZIndex()};return e(r),s.newZIndex=r.getZIndex(),s});n.some(({oldZIndex:r,newZIndex:s})=>r!==s)&&this.emit("nodeZindexChanged",n)}getNodeById(t){return this.getNodes(e=>e.id()===t)?.[0]}getNodes(t){return this.mainLayer.find(t)??[]}isPointInArea(t,e){const{width:n,height:r,x:s,y:a}=e;return t.x>=s&&t.x<=s+n&&t.y>=a&&t.y<=a+r}getShapesInArea(t){return this.mainLayer.getChildren(e=>e.visible()&&e!==t&&this.haveIntersection(t,e))}haveIntersection(t,e){const n=t.getClientRect({relativeTo:this.stage}),r=e.getClientRect({relativeTo:this.stage}),s=n.x<=r.x&&n.y<=r.y,a=n.x+n.width>=r.x+r.width&&n.y<=r.y,o=n.x<=r.x&&n.y+n.height>=r.y+r.height,l=n.x+n.width>=r.x+r.width&&n.y+n.height>=r.y+r.height;return s&&a&&o&&l}render(){this.mainLayer.draw()}scale(){return this.stage.scaleX()}scaleTo(t,e=new te(0,0)){const n=this.scale();this.emit("canvasZoomStart",n);const r=Math.min(Math.max(t,this.config.scale.min),this.config.scale.max),s=new te((e.x-this.stage.x())/n,(e.y-this.stage.y())/n);return this.stage.scale({x:r,y:r}),this.stage.position({x:e.x-s.x*r,y:e.y-s.y*r}),this.emit("canvasZoomEnd",this.scale()),this}clear(){this.mainLayer.removeChildren(),this.emit("canvasCleared"),this.render()}async toDataURL(t,e){const{padding:n=10,pixelRatio:r=2,mimeType:s="image/png",quality:a=1,haveBackground:o=!1}=e??{},l=new wt.Layer;this.stage.add(l);let h=[];t&&t.length>0?h=t.map(A=>A.toObject()):h=this.mainLayer.children?.map(A=>A.toObject())??[];const c=h.map(A=>wt.Node.create(A));l.add(...c);const d=new wt.Transformer({rotateAnchorOffset:0});d.nodes(c);const f=d.getClientRect(),u=this.stage.scaleX(),p=this.stage.scaleY(),m=this.stage.x(),y=this.stage.y(),S=f.width+n*2,C=f.height+n*2,_=f.x-n,w=f.y-n,k=new wt.Rect({width:S,height:C,x:(_-m)/u,y:(w-y)/p,fill:this.stage.container().style.backgroundColor});return o&&(l.add(k),k.moveToBottom()),new Promise((A,R)=>{try{l.toDataURL({width:S,height:C,x:_,y:w,pixelRatio:r,mimeType:s,quality:a,callback:P=>{A({dataURL:P,width:S,height:C}),d.remove(),l.remove()}})}catch(P){R(P)}})}toJSON(){return JSON.stringify(this.mainLayer.toObject())}fromJSON(t){this.clear(),this.mainLayer.remove();const e=wt.Node.create(t,"layer");return this.mainLayer=e,this.stage.add(this.mainLayer),this.render(),this}use(t,...e){return this.installedPlugins.has(t.name)||(this.installedPlugins.set(t.name,t),t.install(this,...e)),this}getPlugin(t){return this.installedPlugins.get(t)}getPlugins(t){return t.map(e=>this.getPlugin(e))}enablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(n=>n?.enable?.()),this}disablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(n=>n?.disable?.()),this}isPluginEnable(t){return this.getPlugin(t)?.isEnabled?.()??!1}destroyPlugins(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(n=>n?.destroy()),this}destroy(){this.resizeObserver.disconnect(),this.destroyPlugins(Array.from(this.installedPlugins.keys())),this.mouse.destroy(),this.tooler.destroy(),this.stage.destroy(),this.removeAllListeners()}}return H.$=se,H.AlignmentPlugin=Vb,H.Arrow=Sy,H.Ball=Cy,H.Ball3d=ky,H.Box=Ty,H.C2S=vy,H.CanvasWrap=Fy,H.DEFAULT_APP_CONFIG=O1,H.DOMEvent=$2,H.DOMKey=oa,H.DOMMedia=G2,H.DOMMouse=No,H.DOMQuery=me,H.DOMScroll=z2,H.DOMUtil=O2,H.Dep=Rf,H.DiamondTool=ew,H.DrawingTool=iw,H.EllipseTool=nw,H.EraserTool=cw,H.History=I1,H.HistoryPlugin=tw,H.ImageTool=rw,H.KonvaApp=uw,H.Light=Ey,H.Line=Ay,H.LineTool=sw,H.Matrix=Dn,H.NPolygonPathWithMultiplePoint=kl,H.Point=te,H.Point3d=Py,H.Polygon=G_,H.QRCode=Ai,H.Query=Kt,H.Rect=xl,H.RectTool=aw,H.SVGPath=Bf,H.SVGPaths=Gf,H.Segment=Oy,H.SelectTool=ow,H.Selector=D1,H.SelectorPlugin=Xb,H.Ship=My,H.Slider=Ry,H.TWEEN=Y_,H.TextTool=hw,H.Tree=Iy,H.Triangle=Ly,H.TriangleLight=Dy,H.Vector=Sa,H.VideoUtil=$r,H.WebGLRenderer=Uy,H.WebRTCClient=Ny,H.WebSocketClient=e2,H.YZRaphael=dy,H.addWatermark=__,H.ajax=T_,H.angle2radian=U_,H.animateCanvas=H2,H.animateInWeb=Zc,H.appendUrlSearch=Fo,H.base64URLDecode=C2,H.base64URLEncode=S2,H.blobToRawImage=j5,H.changeBrightness=m_,H.changeDiaphaneity=v_,H.changeSize=p_,H.clearCookies=B2,H.compression=b_,H.createXMLHttpRequest=Pf,H.cssTransition=j2,H.dquery=Kc,H.drawQRCodeToCanvas=C_,H.drawSpirograph=yy,H.drawStar=by,H.dynamicStrokeLine=wy,H.fileOrBlobToDataURL=_l,H.fileToArrayBufferPromise=Oc,H.flatPoints=qn,H.flipSideToSide=q5,H.flipUpsideDown=X5,H.formDataToSearch=Wc,H.getBrowserClient=h2,H.getBrowserClientVersion=c2,H.getBrowserLanguage=f2,H.getCanvasImageData=vl,H.getCanvasImageDataByBitmap=G5,H.getCanvasImageDataByVideo=B5,H.getCookie=N2,H.getCookieObject=U2,H.getDocumentElement=Oo,H.getElementLeftInPage=Gc,H.getElementPositionInPage=Bc,H.getElementPositionInPage2=s2,H.getElementPositionInViewport=a2,H.getElementTopInPage=$c,H.getFileExtensionFromFile=Fc,H.getFileTypeFromFile=Kp,H.getFilesImageInfo=U5,H.getFormElementData=k_,H.getGroupCoords=Gb,H.getImageDataByAIData=w_,H.getImageMainColor=V5,H.getInternetExplorerVersion=qc,H.getMiddleValue=Bb,H.getMousePositionInElement=aa,H.getMousePositionInPage=zc,H.getMousePositionInViewport=o2,H.getOperatingSystem=Xi,H.getOperatingSystemVersion=l2,H.getPageClient=ra,H.getPageScroll=Sn,H.getPageSize=i2,H.getRawImageInfo=ml,H.getScrollParent=$y,H.getTimeZone=d2,H.getURL=Yc,H.getUserGeolocationPromise=u2,H.getViewportSize=sa,H.gifImage=Cf,H.h=t2,H.handleDragAndDropFiles=Jp,H.handleHashChange=D2,H.handleHistoryChange=I2,H.handleInputFiles=Zp,H.handleURLChange=L2,H.hasDocument=y2,H.hasHistory=b2,H.hasWindow=Xc,H.hexStr2num=xa,H.hexStr2rgbStr=wl,H.hsv2rgb=O_,H.htmlElementToBlob=Yp,H.ifWebFileHasChanged=E_,H.imageDataToBitmap=$5,H.imageDataToBlob=H5,H.imageDataToDataURL=z5,H.isAndroid=Vc,H.isAppleDevice=g2,H.isBrowserSupportFileAPI=w2,H.isDarkMode=v2,H.isElementInViewport=r2,H.isElementInViewportSimple=n2,H.isIE=_2,H.isIOS=Hc,H.isMacOS=jc,H.isMobile=p2,H.isURL=E2,H.isWechat=m2,H.jpgToPng=u_,H.leftRotate=Y5,H.linkExport=Wp,H.localstorage=Uo,H.marginSharpen=c_,H.microTask=Qp,H.mosaic=y_,H.mount=gr,H.num2HexStr=Lf,H.num2rgbStr=Df,H.outputGifBase64=kf,H.outputQRCodeBase64=S_,H.parseURL=k2,H.parseUrlParams=T2,H.patch=Nc,H.patchDOM=Uc,H.pngToJpg=f_,H.qrDecompose=M1,H.query=se,H.radian2angle=B_,H.radiusClip=g_,H.randomColorHexStr=L_,H.randomColorHexStr2=D_,H.randomColorNumber=R_,H.rappar=qf,H.reactiveVue2=P_,H.reactiveVue3=M_,H.readFileInBrowser=Io,H.recordToSearch=A2,H.recordToSearch2=P2,H.rectClip=d_,H.rgb2hsv=F_,H.rgbStr2hexStr=I_,H.rightRotate=W5,H.rotate=Pi,H.roundedRect=_y,H.searchToRecord=M2,H.searchToRecord2=R2,H.selectFileInBrowser=Ic,H.setCookie=F2,H.setRem=x2,H.shadeColor=N_,H.shapeArrayEqual=P1,H.sharpen=h_,H.smileFace=xy,H.stringToBlob=Lc,H.stringToXml=Xp,H.toBlackAndWhite=J5,H.toBlue=i_,H.toBlueAndGreen=s_,H.toBlueAndGrey=l_,H.toGreen=e_,H.toGreenAndGrey=o_,H.toGrey=K5,H.toGrey2=Z5,H.toOpposite=Q5,H.toRed=t_,H.toRedAndBlue=r_,H.toRedAndGreen=n_,H.toRedAndGrey=a_,H.watchEffect=A_,H.xmlToString=Dc,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),H}({});
|
|
30
35
|
//# sourceMappingURL=zyzgroup_core_web.iife.js.map
|