build-dxf 0.0.18 → 0.0.19-2

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.
Files changed (42) hide show
  1. package/README.md +30 -0
  2. package/package.json +1 -3
  3. package/src/build.d.ts +10 -1
  4. package/src/build.js +555 -471
  5. package/src/components/Editor.vue.d.ts +26 -0
  6. package/src/index.js +3 -2
  7. package/src/index2.js +373 -3426
  8. package/src/index3.js +1937 -0
  9. package/src/pages/Editor.vue.d.ts +2 -0
  10. package/src/pages/Editor02.vue.d.ts +4 -0
  11. package/src/selectLocalFile.js +3745 -0
  12. package/src/utils/CommandManager/CommandFlow.d.ts +23 -0
  13. package/src/utils/CommandManager/CommandManager.d.ts +59 -0
  14. package/src/utils/CommandManager/index.d.ts +2 -0
  15. package/src/utils/ComponentManager/EventDispatcher.d.ts +11 -1
  16. package/src/utils/DxfSystem/components/Dxf.d.ts +15 -12
  17. package/src/utils/DxfSystem/components/LineAnalysis.d.ts +1 -20
  18. package/src/utils/DxfSystem/components/Variable.d.ts +8 -0
  19. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/CommandFlowComponent.d.ts +36 -0
  20. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/Default.d.ts +57 -0
  21. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawDoorLine.d.ts +19 -0
  22. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawLine.d.ts +20 -0
  23. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawWindow.d.ts +25 -0
  24. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/PointDrag.d.ts +27 -0
  25. package/src/utils/DxfSystem/plugin/Editor/components/Editor.d.ts +22 -3
  26. package/src/utils/DxfSystem/plugin/Editor/components/RenderManager.d.ts +88 -0
  27. package/src/utils/DxfSystem/plugin/Editor/components/index.d.ts +6 -0
  28. package/src/utils/DxfSystem/plugin/Editor/pages/EditorTool.vue.d.ts +6 -0
  29. package/src/utils/DxfSystem/plugin/ModelDataPlugin/components/DxfLineModel.d.ts +7 -3
  30. package/src/utils/DxfSystem/plugin/ModelDataPlugin/index.d.ts +9 -1
  31. package/src/utils/DxfSystem/plugin/RenderPlugin/components/DomContainer.d.ts +1 -0
  32. package/src/utils/DxfSystem/plugin/RenderPlugin/components/DomEventRegister.d.ts +20 -1
  33. package/src/utils/DxfSystem/plugin/RenderPlugin/components/EventInput.d.ts +74 -0
  34. package/src/utils/DxfSystem/plugin/RenderPlugin/components/Renderer.d.ts +0 -11
  35. package/src/utils/DxfSystem/plugin/RenderPlugin/components/index.d.ts +1 -0
  36. package/src/utils/DxfSystem/plugin/RenderPlugin/index.d.ts +11 -1
  37. package/src/utils/PointVirtualGrid/index.d.ts +10 -4
  38. package/src/utils/Quadtree/Box2.d.ts +3 -2
  39. package/src/utils/Quadtree/LineSegment.d.ts +11 -9
  40. package/src/utils/Quadtree/Point.d.ts +11 -6
  41. package/src/utils/Quadtree/Quadtree.d.ts +5 -0
  42. package/src/utils/Quadtree/Rectangle.d.ts +5 -4
package/src/index2.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as Component, P as Point, B as Box2, V as Variable, D as DxfSystem, M as ModelDataPlugin, a as DetailsPoint, W as WhiteModel } from "./build.js";
1
+ import { C as Component, P as Point, V as Variable, D as DxfSystem, M as ModelDataPlugin, a as DetailsPoint, W as WhiteModel } from "./build.js";
2
2
  import * as THREE from "three";
3
3
  import { BufferAttribute, Vector3, Plane, Line3, Vector2, Triangle, Sphere, Matrix4, Box3, BackSide, DoubleSide, REVISION, FrontSide, Mesh, BatchedMesh, Ray, Group } from "three";
4
4
  import "clipper-lib";
@@ -7,7 +7,8 @@ import { CSS3DObject, CSS3DSprite, CSS3DRenderer } from "three/addons/renderers/
7
7
  import { CSS2DObject, CSS2DRenderer } from "three/addons/renderers/CSS2DRenderer.js";
8
8
  import { OrbitControls } from "three/addons/controls/OrbitControls.js";
9
9
  import * as TWEEN from "@tweenjs/tween.js";
10
- import { getCurrentInstance, inject, ref, computed, unref, shallowRef, watchEffect, readonly, warn, defineComponent, createElementBlock, openBlock, mergeProps, renderSlot, createElementVNode, onMounted, watch, toRef, onUnmounted, useSlots, Text, createBlock, resolveDynamicComponent, withCtx, createCommentVNode, Fragment, normalizeClass, provide, reactive, nextTick, toRaw, withDirectives, withModifiers, isRef, vModelCheckbox, createTextVNode, toDisplayString, normalizeStyle, toRefs, createVNode, createApp, createStaticVNode } from "vue";
10
+ import { defineComponent, createElementBlock, openBlock, createElementVNode, toDisplayString, createVNode, unref, withCtx, createTextVNode, createApp, ref, watch, onMounted, onUnmounted, createCommentVNode, createStaticVNode } from "vue";
11
+ import { E as ElButton, L as Lines, a as ElCheckbox, S as SelectLocalFile } from "./selectLocalFile.js";
11
12
  const CENTER = 0;
12
13
  const AVERAGE = 1;
13
14
  const SAH = 2;
@@ -601,10 +602,10 @@ function buildTree(bvh, triangleBounds, offset, count, options) {
601
602
  const totalTriangles = getTriCount(geometry);
602
603
  const cacheCentroidBoundingData = new Float32Array(6);
603
604
  let reachedMaxDepth = false;
604
- const root2 = new MeshBVHNode();
605
- getBounds(triangleBounds, offset, count, root2.boundingData, cacheCentroidBoundingData);
606
- splitNode(root2, offset, count, cacheCentroidBoundingData);
607
- return root2;
605
+ const root = new MeshBVHNode();
606
+ getBounds(triangleBounds, offset, count, root.boundingData, cacheCentroidBoundingData);
607
+ splitNode(root, offset, count, cacheCentroidBoundingData);
608
+ return root;
608
609
  function triggerProgress(trianglesProcessed) {
609
610
  if (onProgress) {
610
611
  onProgress(trianglesProcessed / totalTriangles);
@@ -671,10 +672,10 @@ function buildPackedTree(bvh, options) {
671
672
  const triangleBounds = computeTriangleBounds(geometry);
672
673
  const geometryRanges = options.indirect ? getFullGeometryRange(geometry, options.range) : getRootIndexRanges(geometry, options.range);
673
674
  bvh._roots = geometryRanges.map((range) => {
674
- const root2 = buildTree(bvh, triangleBounds, range.offset, range.count, options);
675
- const nodeCount = countNodes(root2);
675
+ const root = buildTree(bvh, triangleBounds, range.offset, range.count, options);
676
+ const nodeCount = countNodes(root);
676
677
  const buffer = new BufferConstructor(BYTES_PER_NODE * nodeCount);
677
- populateBuffer(0, root2, buffer);
678
+ populateBuffer(0, root, buffer);
678
679
  return buffer;
679
680
  });
680
681
  }
@@ -1474,11 +1475,11 @@ const BufferStack = new _BufferStack();
1474
1475
  let _box1, _box2;
1475
1476
  const boxStack = [];
1476
1477
  const boxPool = /* @__PURE__ */ new PrimitivePool(() => new Box3());
1477
- function shapecast(bvh, root2, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset) {
1478
+ function shapecast(bvh, root, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset) {
1478
1479
  _box1 = boxPool.getPrimitive();
1479
1480
  _box2 = boxPool.getPrimitive();
1480
1481
  boxStack.push(_box1, _box2);
1481
- BufferStack.setBuffer(bvh._roots[root2]);
1482
+ BufferStack.setBuffer(bvh._roots[root]);
1482
1483
  const result = shapecastTraverse(0, bvh.geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset);
1483
1484
  BufferStack.clearBuffer();
1484
1485
  boxPool.releasePrimitive(_box1);
@@ -1952,8 +1953,8 @@ function iterateOverTriangles_indirect(offset, count, bvh, intersectsTriangleFun
1952
1953
  }
1953
1954
  return false;
1954
1955
  }
1955
- function raycast(bvh, root2, side, ray2, intersects, near, far) {
1956
- BufferStack.setBuffer(bvh._roots[root2]);
1956
+ function raycast(bvh, root, side, ray2, intersects, near, far) {
1957
+ BufferStack.setBuffer(bvh._roots[root]);
1957
1958
  _raycast$1(0, bvh, side, ray2, intersects, near, far);
1958
1959
  BufferStack.clearBuffer();
1959
1960
  }
@@ -1977,8 +1978,8 @@ function _raycast$1(nodeIndex32, bvh, side, ray2, intersects, near, far) {
1977
1978
  }
1978
1979
  }
1979
1980
  const _xyzFields$1 = ["x", "y", "z"];
1980
- function raycastFirst(bvh, root2, side, ray2, near, far) {
1981
- BufferStack.setBuffer(bvh._roots[root2]);
1981
+ function raycastFirst(bvh, root, side, ray2, near, far) {
1982
+ BufferStack.setBuffer(bvh._roots[root]);
1982
1983
  const result = _raycastFirst$1(0, bvh, side, ray2, near, far);
1983
1984
  BufferStack.clearBuffer();
1984
1985
  return result;
@@ -2031,8 +2032,8 @@ const triangle2$1 = /* @__PURE__ */ new ExtendedTriangle();
2031
2032
  const invertedMat$1 = /* @__PURE__ */ new Matrix4();
2032
2033
  const obb$4 = /* @__PURE__ */ new OrientedBox();
2033
2034
  const obb2$3 = /* @__PURE__ */ new OrientedBox();
2034
- function intersectsGeometry(bvh, root2, otherGeometry, geometryToBvh) {
2035
- BufferStack.setBuffer(bvh._roots[root2]);
2035
+ function intersectsGeometry(bvh, root, otherGeometry, geometryToBvh) {
2036
+ BufferStack.setBuffer(bvh._roots[root]);
2036
2037
  const result = _intersectsGeometry$1(0, bvh, otherGeometry, geometryToBvh);
2037
2038
  BufferStack.clearBuffer();
2038
2039
  return result;
@@ -2346,8 +2347,8 @@ function refit_indirect(bvh, nodeIndices = null) {
2346
2347
  }
2347
2348
  }
2348
2349
  }
2349
- function raycast_indirect(bvh, root2, side, ray2, intersects, near, far) {
2350
- BufferStack.setBuffer(bvh._roots[root2]);
2350
+ function raycast_indirect(bvh, root, side, ray2, intersects, near, far) {
2351
+ BufferStack.setBuffer(bvh._roots[root]);
2351
2352
  _raycast(0, bvh, side, ray2, intersects, near, far);
2352
2353
  BufferStack.clearBuffer();
2353
2354
  }
@@ -2371,8 +2372,8 @@ function _raycast(nodeIndex32, bvh, side, ray2, intersects, near, far) {
2371
2372
  }
2372
2373
  }
2373
2374
  const _xyzFields = ["x", "y", "z"];
2374
- function raycastFirst_indirect(bvh, root2, side, ray2, near, far) {
2375
- BufferStack.setBuffer(bvh._roots[root2]);
2375
+ function raycastFirst_indirect(bvh, root, side, ray2, near, far) {
2376
+ BufferStack.setBuffer(bvh._roots[root]);
2376
2377
  const result = _raycastFirst(0, bvh, side, ray2, near, far);
2377
2378
  BufferStack.clearBuffer();
2378
2379
  return result;
@@ -2425,8 +2426,8 @@ const triangle2 = /* @__PURE__ */ new ExtendedTriangle();
2425
2426
  const invertedMat = /* @__PURE__ */ new Matrix4();
2426
2427
  const obb$2 = /* @__PURE__ */ new OrientedBox();
2427
2428
  const obb2$1 = /* @__PURE__ */ new OrientedBox();
2428
- function intersectsGeometry_indirect(bvh, root2, otherGeometry, geometryToBvh) {
2429
- BufferStack.setBuffer(bvh._roots[root2]);
2429
+ function intersectsGeometry_indirect(bvh, root, otherGeometry, geometryToBvh) {
2430
+ BufferStack.setBuffer(bvh._roots[root]);
2430
2431
  const result = _intersectsGeometry(0, bvh, otherGeometry, geometryToBvh);
2431
2432
  BufferStack.clearBuffer();
2432
2433
  return result;
@@ -2940,7 +2941,7 @@ class MeshBVH {
2940
2941
  let result;
2941
2942
  if (options.cloneBuffers) {
2942
2943
  result = {
2943
- roots: rootData.map((root2) => root2.slice()),
2944
+ roots: rootData.map((root) => root.slice()),
2944
2945
  index: indexAttribute ? indexAttribute.array.slice() : null,
2945
2946
  indirectBuffer: indirectBuffer ? indirectBuffer.slice() : null
2946
2947
  };
@@ -3120,12 +3121,12 @@ class MeshBVH {
3120
3121
  let byteOffset = 0;
3121
3122
  const roots = this._roots;
3122
3123
  for (let i = 0, l = roots.length; i < l; i++) {
3123
- const root2 = roots[i];
3124
+ const root = roots[i];
3124
3125
  result = shapecast(this, i, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset);
3125
3126
  if (result) {
3126
3127
  break;
3127
3128
  }
3128
- byteOffset += root2.byteLength;
3129
+ byteOffset += root.byteLength;
3129
3130
  }
3130
3131
  ExtendedTrianglePool.releasePrimitive(triangle3);
3131
3132
  return result;
@@ -3341,6 +3342,7 @@ function disposeBoundsTree() {
3341
3342
  THREE.BufferGeometry.prototype.computeBoundsTree = computeBoundsTree;
3342
3343
  THREE.BufferGeometry.prototype.disposeBoundsTree = disposeBoundsTree;
3343
3344
  THREE.Mesh.prototype.raycast = acceleratedRaycast;
3345
+ THREE.Object3D.DEFAULT_UP = new THREE.Vector3(0, 0, 1);
3344
3346
  class Renderer extends Component {
3345
3347
  static name = "Renderer";
3346
3348
  static CSS2DObject = CSS2DObject;
@@ -3363,7 +3365,6 @@ class Renderer extends Component {
3363
3365
  container = new THREE.Group();
3364
3366
  onUpdate;
3365
3367
  onResize;
3366
- pointer = new THREE.Vector2();
3367
3368
  tweenTaskList = [];
3368
3369
  constructor(description) {
3369
3370
  super();
@@ -3379,6 +3380,7 @@ class Renderer extends Component {
3379
3380
  canvas: this.description.canvas,
3380
3381
  antialias: true
3381
3382
  });
3383
+ this.renderer.setPixelRatio(window.devicePixelRatio);
3382
3384
  if (description.htmlRenderer) {
3383
3385
  if (description.htmlRenderer["2d"]) {
3384
3386
  this.html2DRenderer = new CSS2DRenderer();
@@ -3396,10 +3398,10 @@ class Renderer extends Component {
3396
3398
  Object.assign(this.orbitControls, description.orbitControls);
3397
3399
  }
3398
3400
  if (this.description.resizeObserver) {
3399
- const dom2 = this.description.resizeObserver;
3401
+ const dom = this.description.resizeObserver;
3400
3402
  this.resizeObserver = new ResizeObserver(() => {
3401
3403
  const camera2 = this.camera;
3402
- const { width, height } = dom2.getBoundingClientRect();
3404
+ const { width, height } = dom.getBoundingClientRect();
3403
3405
  this.renderer.setSize(width, height);
3404
3406
  if (this.html2DRenderer) this.html2DRenderer.setSize(width, height);
3405
3407
  if (this.html3DRenderer) this.html3DRenderer.setSize(width, height);
@@ -3415,7 +3417,7 @@ class Renderer extends Component {
3415
3417
  this.onResize && this.onResize(width, height);
3416
3418
  this.dispatchEvent({ type: "resize", width, height });
3417
3419
  });
3418
- this.resizeObserver.observe(dom2);
3420
+ this.resizeObserver.observe(dom);
3419
3421
  }
3420
3422
  this.renderer.setAnimationLoop(() => {
3421
3423
  if (this.html2DRenderer) this.html2DRenderer.render(this.scene, this.camera);
@@ -3432,25 +3434,6 @@ class Renderer extends Component {
3432
3434
  directLight.position.set(100, -100, 100);
3433
3435
  this.scene.add(directLight);
3434
3436
  camera.position.set(10, 10, 10);
3435
- const dom = description.orbitControls?.domElement ?? this.description.canvas;
3436
- dom.addEventListener("mousemove", (e) => {
3437
- this.pointer.set(e.offsetX, e.offsetY);
3438
- this.dispatchEvent({
3439
- type: "mousemove",
3440
- x: e.offsetX,
3441
- y: e.offsetY,
3442
- moveX: e.movementX,
3443
- moveY: e.movementY
3444
- });
3445
- });
3446
- dom.addEventListener("mousedown", (e) => {
3447
- this.pointer.set(e.offsetX, e.offsetY);
3448
- this.dispatchEvent({
3449
- type: "mousedown",
3450
- x: e.offsetX,
3451
- y: e.offsetY
3452
- });
3453
- });
3454
3437
  }
3455
3438
  /**
3456
3439
  * 世界坐标转屏幕坐标
@@ -3464,3273 +3447,116 @@ class Renderer extends Component {
3464
3447
  vector.copy(worldPosition);
3465
3448
  vector.project(this.camera);
3466
3449
  const x = (vector.x * 0.5 + 0.5) * this.renderer.domElement.clientWidth;
3467
- const z = (-vector.z * 0.5 + 0.5) * this.renderer.domElement.clientHeight;
3468
- return new THREE.Vector2(x, z);
3469
- }
3470
- cameraPositionRecord = [];
3471
- /**
3472
- * 相机
3473
- * @param position
3474
- * @param lookAt
3475
- * @param onEnd
3476
- */
3477
- cameraTo(position, lookAt, onEnd) {
3478
- this.cameraPositionRecord.push([
3479
- this.camera.position.clone(),
3480
- this.camera.quaternion.clone()
3481
- ]);
3482
- const tween = new TWEEN.Tween(this.camera.position);
3483
- tween.to(position, 600);
3484
- tween.start();
3485
- tween.onUpdate(() => {
3486
- this.camera.lookAt(lookAt);
3487
- });
3488
- tween.onComplete(() => {
3489
- const i = this.tweenTaskList.indexOf(tween);
3490
- this.tweenTaskList.splice(i, 1);
3491
- onEnd && onEnd();
3492
- });
3493
- this.tweenTaskList.push(tween);
3494
- }
3495
- cameraBack() {
3496
- if (this.cameraPositionRecord.length) {
3497
- const [pos, quat] = this.cameraPositionRecord.pop();
3498
- this.camera.position.copy(pos);
3499
- this.camera.quaternion.copy(quat);
3500
- }
3501
- }
3502
- /**
3503
- * 创建点
3504
- * @param pos
3505
- */
3506
- createPointMesh(pos, size = 0.02, parameters, parent = this.container) {
3507
- const box = new THREE.Mesh(
3508
- new THREE.SphereGeometry(size),
3509
- new THREE.MeshBasicMaterial(parameters)
3510
- );
3511
- if (pos instanceof Point) box.position.set(pos.x, pos.y, 0);
3512
- else if (pos instanceof THREE.Vector3) box.position.copy(pos);
3513
- parent.add(box);
3514
- return box;
3515
- }
3516
- /**
3517
- * 创建文本
3518
- * @param text
3519
- * @param pos
3520
- * @param style
3521
- */
3522
- createText(text, pos, style, parent = this.container) {
3523
- const div = document.createElement("div");
3524
- div.innerHTML = text;
3525
- Object.assign(div.style, { fontSize: "10px", color: "#ffffff", ...style });
3526
- const css2DObject = new Renderer.CSS2DObject(div);
3527
- if (pos instanceof Point) css2DObject.position.set(pos.x, pos.y, 0);
3528
- else if (pos instanceof THREE.Vector3) css2DObject.position.copy(pos);
3529
- parent.add(css2DObject);
3530
- return css2DObject;
3531
- }
3532
- /**
3533
- * 创建几何缓冲区
3534
- * @param map
3535
- * @param count
3536
- */
3537
- createLineSegments(map, count, parameters, parent = this.container) {
3538
- const geometry = new THREE.BufferGeometry();
3539
- Object.keys(map).forEach((key) => {
3540
- const value = map[key];
3541
- geometry.setAttribute(key, new THREE.BufferAttribute(new Float32Array(value), value.length / count));
3542
- });
3543
- const lineSegmentList = new THREE.LineSegments(geometry, new THREE.LineBasicMaterial({ ...parameters }));
3544
- parent.add(lineSegmentList);
3545
- return lineSegmentList;
3546
- }
3547
- destroy() {
3548
- if (this.resizeObserver) {
3549
- this.renderer.dispose();
3550
- this.resizeObserver.disconnect();
3551
- this.resizeObserver = void 0;
3552
- }
3553
- }
3554
- }
3555
- function drawLinePathToPng(points, width, height, color = "#fff", lineWidth = 2) {
3556
- const can = document.createElement("canvas"), ctx = can.getContext("2d");
3557
- can.width = width;
3558
- can.height = height;
3559
- ctx?.clearRect(0, 0, width, height);
3560
- ctx?.save();
3561
- ctx.strokeStyle = color;
3562
- ctx.lineWidth = lineWidth;
3563
- ctx?.beginPath();
3564
- points.forEach((p, i) => {
3565
- if (i === 0) ctx?.moveTo(p[0], p[1]);
3566
- else ctx?.lineTo(p[0], p[1]);
3567
- });
3568
- ctx?.stroke();
3569
- ctx?.restore();
3570
- return can.toDataURL("image/png", 1);
3571
- }
3572
- const configProviderContextKey = Symbol();
3573
- const defaultNamespace = "el";
3574
- const statePrefix = "is-";
3575
- const _bem = (namespace, block, blockSuffix, element, modifier) => {
3576
- let cls = `${namespace}-${block}`;
3577
- if (blockSuffix) {
3578
- cls += `-${blockSuffix}`;
3579
- }
3580
- if (element) {
3581
- cls += `__${element}`;
3582
- }
3583
- if (modifier) {
3584
- cls += `--${modifier}`;
3585
- }
3586
- return cls;
3587
- };
3588
- const namespaceContextKey = Symbol("namespaceContextKey");
3589
- const useGetDerivedNamespace = (namespaceOverrides) => {
3590
- const derivedNamespace = getCurrentInstance() ? inject(namespaceContextKey, ref(defaultNamespace)) : ref(defaultNamespace);
3591
- const namespace = computed(() => {
3592
- return unref(derivedNamespace) || defaultNamespace;
3593
- });
3594
- return namespace;
3595
- };
3596
- const useNamespace = (block, namespaceOverrides) => {
3597
- const namespace = useGetDerivedNamespace();
3598
- const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
3599
- const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
3600
- const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
3601
- const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
3602
- const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
3603
- const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
3604
- const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
3605
- const is = (name, ...args) => {
3606
- const state = args.length >= 1 ? args[0] : true;
3607
- return name && state ? `${statePrefix}${name}` : "";
3608
- };
3609
- const cssVar = (object) => {
3610
- const styles = {};
3611
- for (const key in object) {
3612
- if (object[key]) {
3613
- styles[`--${namespace.value}-${key}`] = object[key];
3614
- }
3615
- }
3616
- return styles;
3617
- };
3618
- const cssVarBlock = (object) => {
3619
- const styles = {};
3620
- for (const key in object) {
3621
- if (object[key]) {
3622
- styles[`--${namespace.value}-${block}-${key}`] = object[key];
3623
- }
3624
- }
3625
- return styles;
3626
- };
3627
- const cssVarName = (name) => `--${namespace.value}-${name}`;
3628
- const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
3629
- return {
3630
- namespace,
3631
- b,
3632
- e,
3633
- m,
3634
- be,
3635
- em,
3636
- bm,
3637
- bem,
3638
- is,
3639
- cssVar,
3640
- cssVarName,
3641
- cssVarBlock,
3642
- cssVarBlockName
3643
- };
3644
- };
3645
- /**
3646
- * @vue/shared v3.5.18
3647
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
3648
- * @license MIT
3649
- **/
3650
- !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
3651
- !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
3652
- const NOOP = () => {
3653
- };
3654
- const hasOwnProperty$a = Object.prototype.hasOwnProperty;
3655
- const hasOwn = (val, key) => hasOwnProperty$a.call(val, key);
3656
- const isArray$1 = Array.isArray;
3657
- const isString = (val) => typeof val === "string";
3658
- const isObject$1 = (val) => val !== null && typeof val === "object";
3659
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
3660
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
3661
- var root = freeGlobal || freeSelf || Function("return this")();
3662
- var Symbol$1 = root.Symbol;
3663
- var objectProto$c = Object.prototype;
3664
- var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
3665
- var nativeObjectToString$1 = objectProto$c.toString;
3666
- var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
3667
- function getRawTag(value) {
3668
- var isOwn = hasOwnProperty$9.call(value, symToStringTag$1), tag = value[symToStringTag$1];
3669
- try {
3670
- value[symToStringTag$1] = void 0;
3671
- var unmasked = true;
3672
- } catch (e) {
3673
- }
3674
- var result = nativeObjectToString$1.call(value);
3675
- if (unmasked) {
3676
- if (isOwn) {
3677
- value[symToStringTag$1] = tag;
3678
- } else {
3679
- delete value[symToStringTag$1];
3680
- }
3681
- }
3682
- return result;
3683
- }
3684
- var objectProto$b = Object.prototype;
3685
- var nativeObjectToString = objectProto$b.toString;
3686
- function objectToString(value) {
3687
- return nativeObjectToString.call(value);
3688
- }
3689
- var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
3690
- var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
3691
- function baseGetTag(value) {
3692
- if (value == null) {
3693
- return value === void 0 ? undefinedTag : nullTag;
3694
- }
3695
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
3696
- }
3697
- function isObjectLike(value) {
3698
- return value != null && typeof value == "object";
3699
- }
3700
- var symbolTag$1 = "[object Symbol]";
3701
- function isSymbol(value) {
3702
- return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$1;
3703
- }
3704
- function arrayMap(array, iteratee) {
3705
- var index2 = -1, length = array == null ? 0 : array.length, result = Array(length);
3706
- while (++index2 < length) {
3707
- result[index2] = iteratee(array[index2], index2, array);
3708
- }
3709
- return result;
3710
- }
3711
- var isArray = Array.isArray;
3712
- var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto$1 ? symbolProto$1.toString : void 0;
3713
- function baseToString(value) {
3714
- if (typeof value == "string") {
3715
- return value;
3716
- }
3717
- if (isArray(value)) {
3718
- return arrayMap(value, baseToString) + "";
3719
- }
3720
- if (isSymbol(value)) {
3721
- return symbolToString ? symbolToString.call(value) : "";
3722
- }
3723
- var result = value + "";
3724
- return result == "0" && 1 / value == -Infinity ? "-0" : result;
3725
- }
3726
- function isObject(value) {
3727
- var type = typeof value;
3728
- return value != null && (type == "object" || type == "function");
3729
- }
3730
- function identity(value) {
3731
- return value;
3732
- }
3733
- var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
3734
- function isFunction(value) {
3735
- if (!isObject(value)) {
3736
- return false;
3737
- }
3738
- var tag = baseGetTag(value);
3739
- return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
3740
- }
3741
- var coreJsData = root["__core-js_shared__"];
3742
- var maskSrcKey = (function() {
3743
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
3744
- return uid ? "Symbol(src)_1." + uid : "";
3745
- })();
3746
- function isMasked(func) {
3747
- return !!maskSrcKey && maskSrcKey in func;
3748
- }
3749
- var funcProto$1 = Function.prototype;
3750
- var funcToString$1 = funcProto$1.toString;
3751
- function toSource(func) {
3752
- if (func != null) {
3753
- try {
3754
- return funcToString$1.call(func);
3755
- } catch (e) {
3756
- }
3757
- try {
3758
- return func + "";
3759
- } catch (e) {
3760
- }
3761
- }
3762
- return "";
3763
- }
3764
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
3765
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
3766
- var funcProto = Function.prototype, objectProto$a = Object.prototype;
3767
- var funcToString = funcProto.toString;
3768
- var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
3769
- var reIsNative = RegExp(
3770
- "^" + funcToString.call(hasOwnProperty$8).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
3771
- );
3772
- function baseIsNative(value) {
3773
- if (!isObject(value) || isMasked(value)) {
3774
- return false;
3775
- }
3776
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
3777
- return pattern.test(toSource(value));
3778
- }
3779
- function getValue(object, key) {
3780
- return object == null ? void 0 : object[key];
3781
- }
3782
- function getNative(object, key) {
3783
- var value = getValue(object, key);
3784
- return baseIsNative(value) ? value : void 0;
3785
- }
3786
- var WeakMap = getNative(root, "WeakMap");
3787
- function apply(func, thisArg, args) {
3788
- switch (args.length) {
3789
- case 0:
3790
- return func.call(thisArg);
3791
- case 1:
3792
- return func.call(thisArg, args[0]);
3793
- case 2:
3794
- return func.call(thisArg, args[0], args[1]);
3795
- case 3:
3796
- return func.call(thisArg, args[0], args[1], args[2]);
3797
- }
3798
- return func.apply(thisArg, args);
3799
- }
3800
- var HOT_COUNT = 800, HOT_SPAN = 16;
3801
- var nativeNow = Date.now;
3802
- function shortOut(func) {
3803
- var count = 0, lastCalled = 0;
3804
- return function() {
3805
- var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
3806
- lastCalled = stamp;
3807
- if (remaining > 0) {
3808
- if (++count >= HOT_COUNT) {
3809
- return arguments[0];
3810
- }
3811
- } else {
3812
- count = 0;
3813
- }
3814
- return func.apply(void 0, arguments);
3815
- };
3816
- }
3817
- function constant(value) {
3818
- return function() {
3819
- return value;
3820
- };
3821
- }
3822
- var defineProperty = (function() {
3823
- try {
3824
- var func = getNative(Object, "defineProperty");
3825
- func({}, "", {});
3826
- return func;
3827
- } catch (e) {
3828
- }
3829
- })();
3830
- var baseSetToString = !defineProperty ? identity : function(func, string) {
3831
- return defineProperty(func, "toString", {
3832
- "configurable": true,
3833
- "enumerable": false,
3834
- "value": constant(string),
3835
- "writable": true
3836
- });
3837
- };
3838
- var setToString = shortOut(baseSetToString);
3839
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
3840
- var reIsUint = /^(?:0|[1-9]\d*)$/;
3841
- function isIndex(value, length) {
3842
- var type = typeof value;
3843
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
3844
- return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
3845
- }
3846
- function baseAssignValue(object, key, value) {
3847
- if (key == "__proto__" && defineProperty) {
3848
- defineProperty(object, key, {
3849
- "configurable": true,
3850
- "enumerable": true,
3851
- "value": value,
3852
- "writable": true
3853
- });
3854
- } else {
3855
- object[key] = value;
3856
- }
3857
- }
3858
- function eq(value, other) {
3859
- return value === other || value !== value && other !== other;
3860
- }
3861
- var objectProto$9 = Object.prototype;
3862
- var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
3863
- function assignValue(object, key, value) {
3864
- var objValue = object[key];
3865
- if (!(hasOwnProperty$7.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
3866
- baseAssignValue(object, key, value);
3867
- }
3868
- }
3869
- var nativeMax = Math.max;
3870
- function overRest(func, start, transform) {
3871
- start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
3872
- return function() {
3873
- var args = arguments, index2 = -1, length = nativeMax(args.length - start, 0), array = Array(length);
3874
- while (++index2 < length) {
3875
- array[index2] = args[start + index2];
3876
- }
3877
- index2 = -1;
3878
- var otherArgs = Array(start + 1);
3879
- while (++index2 < start) {
3880
- otherArgs[index2] = args[index2];
3881
- }
3882
- otherArgs[start] = transform(array);
3883
- return apply(func, this, otherArgs);
3884
- };
3885
- }
3886
- var MAX_SAFE_INTEGER = 9007199254740991;
3887
- function isLength(value) {
3888
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
3889
- }
3890
- function isArrayLike(value) {
3891
- return value != null && isLength(value.length) && !isFunction(value);
3892
- }
3893
- var objectProto$8 = Object.prototype;
3894
- function isPrototype(value) {
3895
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$8;
3896
- return value === proto;
3897
- }
3898
- function baseTimes(n, iteratee) {
3899
- var index2 = -1, result = Array(n);
3900
- while (++index2 < n) {
3901
- result[index2] = iteratee(index2);
3902
- }
3903
- return result;
3904
- }
3905
- var argsTag$2 = "[object Arguments]";
3906
- function baseIsArguments(value) {
3907
- return isObjectLike(value) && baseGetTag(value) == argsTag$2;
3908
- }
3909
- var objectProto$7 = Object.prototype;
3910
- var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
3911
- var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
3912
- var isArguments = baseIsArguments(/* @__PURE__ */ (function() {
3913
- return arguments;
3914
- })()) ? baseIsArguments : function(value) {
3915
- return isObjectLike(value) && hasOwnProperty$6.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
3916
- };
3917
- function stubFalse() {
3918
- return false;
3919
- }
3920
- var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
3921
- var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
3922
- var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
3923
- var Buffer = moduleExports$1 ? root.Buffer : void 0;
3924
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
3925
- var isBuffer = nativeIsBuffer || stubFalse;
3926
- var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", objectTag$2 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", weakMapTag$1 = "[object WeakMap]";
3927
- var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
3928
- var typedArrayTags = {};
3929
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
3930
- typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
3931
- function baseIsTypedArray(value) {
3932
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
3933
- }
3934
- function baseUnary(func) {
3935
- return function(value) {
3936
- return func(value);
3937
- };
3938
- }
3939
- var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
3940
- var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
3941
- var moduleExports = freeModule && freeModule.exports === freeExports;
3942
- var freeProcess = moduleExports && freeGlobal.process;
3943
- var nodeUtil = (function() {
3944
- try {
3945
- var types = freeModule && freeModule.require && freeModule.require("util").types;
3946
- if (types) {
3947
- return types;
3948
- }
3949
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
3950
- } catch (e) {
3951
- }
3952
- })();
3953
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
3954
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
3955
- var objectProto$6 = Object.prototype;
3956
- var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
3957
- function arrayLikeKeys(value, inherited) {
3958
- var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
3959
- for (var key in value) {
3960
- if (hasOwnProperty$5.call(value, key) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
3961
- (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
3962
- isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
3963
- isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
3964
- isIndex(key, length)))) {
3965
- result.push(key);
3966
- }
3967
- }
3968
- return result;
3969
- }
3970
- function overArg(func, transform) {
3971
- return function(arg) {
3972
- return func(transform(arg));
3973
- };
3974
- }
3975
- var nativeKeys = overArg(Object.keys, Object);
3976
- var objectProto$5 = Object.prototype;
3977
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
3978
- function baseKeys(object) {
3979
- if (!isPrototype(object)) {
3980
- return nativeKeys(object);
3981
- }
3982
- var result = [];
3983
- for (var key in Object(object)) {
3984
- if (hasOwnProperty$4.call(object, key) && key != "constructor") {
3985
- result.push(key);
3986
- }
3987
- }
3988
- return result;
3989
- }
3990
- function keys(object) {
3991
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
3992
- }
3993
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
3994
- function isKey(value, object) {
3995
- if (isArray(value)) {
3996
- return false;
3997
- }
3998
- var type = typeof value;
3999
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
4000
- return true;
4001
- }
4002
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
4003
- }
4004
- var nativeCreate = getNative(Object, "create");
4005
- function hashClear() {
4006
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
4007
- this.size = 0;
4008
- }
4009
- function hashDelete(key) {
4010
- var result = this.has(key) && delete this.__data__[key];
4011
- this.size -= result ? 1 : 0;
4012
- return result;
4013
- }
4014
- var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
4015
- var objectProto$4 = Object.prototype;
4016
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
4017
- function hashGet(key) {
4018
- var data = this.__data__;
4019
- if (nativeCreate) {
4020
- var result = data[key];
4021
- return result === HASH_UNDEFINED$2 ? void 0 : result;
4022
- }
4023
- return hasOwnProperty$3.call(data, key) ? data[key] : void 0;
4024
- }
4025
- var objectProto$3 = Object.prototype;
4026
- var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
4027
- function hashHas(key) {
4028
- var data = this.__data__;
4029
- return nativeCreate ? data[key] !== void 0 : hasOwnProperty$2.call(data, key);
4030
- }
4031
- var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
4032
- function hashSet(key, value) {
4033
- var data = this.__data__;
4034
- this.size += this.has(key) ? 0 : 1;
4035
- data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
4036
- return this;
4037
- }
4038
- function Hash(entries) {
4039
- var index2 = -1, length = entries == null ? 0 : entries.length;
4040
- this.clear();
4041
- while (++index2 < length) {
4042
- var entry = entries[index2];
4043
- this.set(entry[0], entry[1]);
4044
- }
4045
- }
4046
- Hash.prototype.clear = hashClear;
4047
- Hash.prototype["delete"] = hashDelete;
4048
- Hash.prototype.get = hashGet;
4049
- Hash.prototype.has = hashHas;
4050
- Hash.prototype.set = hashSet;
4051
- function listCacheClear() {
4052
- this.__data__ = [];
4053
- this.size = 0;
4054
- }
4055
- function assocIndexOf(array, key) {
4056
- var length = array.length;
4057
- while (length--) {
4058
- if (eq(array[length][0], key)) {
4059
- return length;
4060
- }
4061
- }
4062
- return -1;
4063
- }
4064
- var arrayProto = Array.prototype;
4065
- var splice = arrayProto.splice;
4066
- function listCacheDelete(key) {
4067
- var data = this.__data__, index2 = assocIndexOf(data, key);
4068
- if (index2 < 0) {
4069
- return false;
4070
- }
4071
- var lastIndex = data.length - 1;
4072
- if (index2 == lastIndex) {
4073
- data.pop();
4074
- } else {
4075
- splice.call(data, index2, 1);
4076
- }
4077
- --this.size;
4078
- return true;
4079
- }
4080
- function listCacheGet(key) {
4081
- var data = this.__data__, index2 = assocIndexOf(data, key);
4082
- return index2 < 0 ? void 0 : data[index2][1];
4083
- }
4084
- function listCacheHas(key) {
4085
- return assocIndexOf(this.__data__, key) > -1;
4086
- }
4087
- function listCacheSet(key, value) {
4088
- var data = this.__data__, index2 = assocIndexOf(data, key);
4089
- if (index2 < 0) {
4090
- ++this.size;
4091
- data.push([key, value]);
4092
- } else {
4093
- data[index2][1] = value;
4094
- }
4095
- return this;
4096
- }
4097
- function ListCache(entries) {
4098
- var index2 = -1, length = entries == null ? 0 : entries.length;
4099
- this.clear();
4100
- while (++index2 < length) {
4101
- var entry = entries[index2];
4102
- this.set(entry[0], entry[1]);
4103
- }
4104
- }
4105
- ListCache.prototype.clear = listCacheClear;
4106
- ListCache.prototype["delete"] = listCacheDelete;
4107
- ListCache.prototype.get = listCacheGet;
4108
- ListCache.prototype.has = listCacheHas;
4109
- ListCache.prototype.set = listCacheSet;
4110
- var Map = getNative(root, "Map");
4111
- function mapCacheClear() {
4112
- this.size = 0;
4113
- this.__data__ = {
4114
- "hash": new Hash(),
4115
- "map": new (Map || ListCache)(),
4116
- "string": new Hash()
4117
- };
4118
- }
4119
- function isKeyable(value) {
4120
- var type = typeof value;
4121
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
4122
- }
4123
- function getMapData(map, key) {
4124
- var data = map.__data__;
4125
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
4126
- }
4127
- function mapCacheDelete(key) {
4128
- var result = getMapData(this, key)["delete"](key);
4129
- this.size -= result ? 1 : 0;
4130
- return result;
4131
- }
4132
- function mapCacheGet(key) {
4133
- return getMapData(this, key).get(key);
4134
- }
4135
- function mapCacheHas(key) {
4136
- return getMapData(this, key).has(key);
4137
- }
4138
- function mapCacheSet(key, value) {
4139
- var data = getMapData(this, key), size = data.size;
4140
- data.set(key, value);
4141
- this.size += data.size == size ? 0 : 1;
4142
- return this;
4143
- }
4144
- function MapCache(entries) {
4145
- var index2 = -1, length = entries == null ? 0 : entries.length;
4146
- this.clear();
4147
- while (++index2 < length) {
4148
- var entry = entries[index2];
4149
- this.set(entry[0], entry[1]);
4150
- }
4151
- }
4152
- MapCache.prototype.clear = mapCacheClear;
4153
- MapCache.prototype["delete"] = mapCacheDelete;
4154
- MapCache.prototype.get = mapCacheGet;
4155
- MapCache.prototype.has = mapCacheHas;
4156
- MapCache.prototype.set = mapCacheSet;
4157
- var FUNC_ERROR_TEXT = "Expected a function";
4158
- function memoize(func, resolver) {
4159
- if (typeof func != "function" || resolver != null && typeof resolver != "function") {
4160
- throw new TypeError(FUNC_ERROR_TEXT);
4161
- }
4162
- var memoized = function() {
4163
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
4164
- if (cache.has(key)) {
4165
- return cache.get(key);
4166
- }
4167
- var result = func.apply(this, args);
4168
- memoized.cache = cache.set(key, result) || cache;
4169
- return result;
4170
- };
4171
- memoized.cache = new (memoize.Cache || MapCache)();
4172
- return memoized;
4173
- }
4174
- memoize.Cache = MapCache;
4175
- var MAX_MEMOIZE_SIZE = 500;
4176
- function memoizeCapped(func) {
4177
- var result = memoize(func, function(key) {
4178
- if (cache.size === MAX_MEMOIZE_SIZE) {
4179
- cache.clear();
4180
- }
4181
- return key;
4182
- });
4183
- var cache = result.cache;
4184
- return result;
4185
- }
4186
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
4187
- var reEscapeChar = /\\(\\)?/g;
4188
- var stringToPath = memoizeCapped(function(string) {
4189
- var result = [];
4190
- if (string.charCodeAt(0) === 46) {
4191
- result.push("");
4192
- }
4193
- string.replace(rePropName, function(match, number, quote, subString) {
4194
- result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
4195
- });
4196
- return result;
4197
- });
4198
- function toString(value) {
4199
- return value == null ? "" : baseToString(value);
4200
- }
4201
- function castPath(value, object) {
4202
- if (isArray(value)) {
4203
- return value;
4204
- }
4205
- return isKey(value, object) ? [value] : stringToPath(toString(value));
4206
- }
4207
- function toKey(value) {
4208
- if (typeof value == "string" || isSymbol(value)) {
4209
- return value;
4210
- }
4211
- var result = value + "";
4212
- return result == "0" && 1 / value == -Infinity ? "-0" : result;
4213
- }
4214
- function baseGet(object, path) {
4215
- path = castPath(path, object);
4216
- var index2 = 0, length = path.length;
4217
- while (object != null && index2 < length) {
4218
- object = object[toKey(path[index2++])];
4219
- }
4220
- return index2 && index2 == length ? object : void 0;
4221
- }
4222
- function arrayPush(array, values) {
4223
- var index2 = -1, length = values.length, offset = array.length;
4224
- while (++index2 < length) {
4225
- array[offset + index2] = values[index2];
4226
- }
4227
- return array;
4228
- }
4229
- var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
4230
- function isFlattenable(value) {
4231
- return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
4232
- }
4233
- function baseFlatten(array, depth, predicate, isStrict, result) {
4234
- var index2 = -1, length = array.length;
4235
- predicate || (predicate = isFlattenable);
4236
- result || (result = []);
4237
- while (++index2 < length) {
4238
- var value = array[index2];
4239
- if (predicate(value)) {
4240
- {
4241
- arrayPush(result, value);
4242
- }
4243
- } else {
4244
- result[result.length] = value;
4245
- }
4246
- }
4247
- return result;
4248
- }
4249
- function flatten(array) {
4250
- var length = array == null ? 0 : array.length;
4251
- return length ? baseFlatten(array) : [];
4252
- }
4253
- function flatRest(func) {
4254
- return setToString(overRest(func, void 0, flatten), func + "");
4255
- }
4256
- function stackClear() {
4257
- this.__data__ = new ListCache();
4258
- this.size = 0;
4259
- }
4260
- function stackDelete(key) {
4261
- var data = this.__data__, result = data["delete"](key);
4262
- this.size = data.size;
4263
- return result;
4264
- }
4265
- function stackGet(key) {
4266
- return this.__data__.get(key);
4267
- }
4268
- function stackHas(key) {
4269
- return this.__data__.has(key);
4270
- }
4271
- var LARGE_ARRAY_SIZE = 200;
4272
- function stackSet(key, value) {
4273
- var data = this.__data__;
4274
- if (data instanceof ListCache) {
4275
- var pairs = data.__data__;
4276
- if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
4277
- pairs.push([key, value]);
4278
- this.size = ++data.size;
4279
- return this;
4280
- }
4281
- data = this.__data__ = new MapCache(pairs);
4282
- }
4283
- data.set(key, value);
4284
- this.size = data.size;
4285
- return this;
4286
- }
4287
- function Stack(entries) {
4288
- var data = this.__data__ = new ListCache(entries);
4289
- this.size = data.size;
4290
- }
4291
- Stack.prototype.clear = stackClear;
4292
- Stack.prototype["delete"] = stackDelete;
4293
- Stack.prototype.get = stackGet;
4294
- Stack.prototype.has = stackHas;
4295
- Stack.prototype.set = stackSet;
4296
- function arrayFilter(array, predicate) {
4297
- var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
4298
- while (++index2 < length) {
4299
- var value = array[index2];
4300
- if (predicate(value, index2, array)) {
4301
- result[resIndex++] = value;
4302
- }
4303
- }
4304
- return result;
4305
- }
4306
- function stubArray() {
4307
- return [];
4308
- }
4309
- var objectProto$2 = Object.prototype;
4310
- var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
4311
- var nativeGetSymbols = Object.getOwnPropertySymbols;
4312
- var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
4313
- if (object == null) {
4314
- return [];
4315
- }
4316
- object = Object(object);
4317
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
4318
- return propertyIsEnumerable.call(object, symbol);
4319
- });
4320
- };
4321
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
4322
- var result = keysFunc(object);
4323
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
4324
- }
4325
- function getAllKeys(object) {
4326
- return baseGetAllKeys(object, keys, getSymbols);
4327
- }
4328
- var DataView = getNative(root, "DataView");
4329
- var Promise$1 = getNative(root, "Promise");
4330
- var Set$1 = getNative(root, "Set");
4331
- var mapTag$1 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
4332
- var dataViewTag$1 = "[object DataView]";
4333
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap);
4334
- var getTag = baseGetTag;
4335
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$1 || Map && getTag(new Map()) != mapTag$1 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$1 || WeakMap && getTag(new WeakMap()) != weakMapTag) {
4336
- getTag = function(value) {
4337
- var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
4338
- if (ctorString) {
4339
- switch (ctorString) {
4340
- case dataViewCtorString:
4341
- return dataViewTag$1;
4342
- case mapCtorString:
4343
- return mapTag$1;
4344
- case promiseCtorString:
4345
- return promiseTag;
4346
- case setCtorString:
4347
- return setTag$1;
4348
- case weakMapCtorString:
4349
- return weakMapTag;
4350
- }
4351
- }
4352
- return result;
4353
- };
4354
- }
4355
- var Uint8Array$1 = root.Uint8Array;
4356
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
4357
- function setCacheAdd(value) {
4358
- this.__data__.set(value, HASH_UNDEFINED);
4359
- return this;
4360
- }
4361
- function setCacheHas(value) {
4362
- return this.__data__.has(value);
4363
- }
4364
- function SetCache(values) {
4365
- var index2 = -1, length = values == null ? 0 : values.length;
4366
- this.__data__ = new MapCache();
4367
- while (++index2 < length) {
4368
- this.add(values[index2]);
4369
- }
4370
- }
4371
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
4372
- SetCache.prototype.has = setCacheHas;
4373
- function arraySome(array, predicate) {
4374
- var index2 = -1, length = array == null ? 0 : array.length;
4375
- while (++index2 < length) {
4376
- if (predicate(array[index2], index2, array)) {
4377
- return true;
4378
- }
4379
- }
4380
- return false;
4381
- }
4382
- function cacheHas(cache, key) {
4383
- return cache.has(key);
4384
- }
4385
- var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
4386
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
4387
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array.length, othLength = other.length;
4388
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
4389
- return false;
4390
- }
4391
- var arrStacked = stack.get(array);
4392
- var othStacked = stack.get(other);
4393
- if (arrStacked && othStacked) {
4394
- return arrStacked == other && othStacked == array;
4395
- }
4396
- var index2 = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
4397
- stack.set(array, other);
4398
- stack.set(other, array);
4399
- while (++index2 < arrLength) {
4400
- var arrValue = array[index2], othValue = other[index2];
4401
- if (customizer) {
4402
- var compared = isPartial ? customizer(othValue, arrValue, index2, other, array, stack) : customizer(arrValue, othValue, index2, array, other, stack);
4403
- }
4404
- if (compared !== void 0) {
4405
- if (compared) {
4406
- continue;
4407
- }
4408
- result = false;
4409
- break;
4410
- }
4411
- if (seen) {
4412
- if (!arraySome(other, function(othValue2, othIndex) {
4413
- if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
4414
- return seen.push(othIndex);
4415
- }
4416
- })) {
4417
- result = false;
4418
- break;
4419
- }
4420
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
4421
- result = false;
4422
- break;
4423
- }
4424
- }
4425
- stack["delete"](array);
4426
- stack["delete"](other);
4427
- return result;
4428
- }
4429
- function mapToArray(map) {
4430
- var index2 = -1, result = Array(map.size);
4431
- map.forEach(function(value, key) {
4432
- result[++index2] = [key, value];
4433
- });
4434
- return result;
4435
- }
4436
- function setToArray(set) {
4437
- var index2 = -1, result = Array(set.size);
4438
- set.forEach(function(value) {
4439
- result[++index2] = value;
4440
- });
4441
- return result;
4442
- }
4443
- var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
4444
- var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
4445
- var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
4446
- var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
4447
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
4448
- switch (tag) {
4449
- case dataViewTag:
4450
- if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
4451
- return false;
4452
- }
4453
- object = object.buffer;
4454
- other = other.buffer;
4455
- case arrayBufferTag:
4456
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {
4457
- return false;
4458
- }
4459
- return true;
4460
- case boolTag:
4461
- case dateTag:
4462
- case numberTag:
4463
- return eq(+object, +other);
4464
- case errorTag:
4465
- return object.name == other.name && object.message == other.message;
4466
- case regexpTag:
4467
- case stringTag:
4468
- return object == other + "";
4469
- case mapTag:
4470
- var convert = mapToArray;
4471
- case setTag:
4472
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
4473
- convert || (convert = setToArray);
4474
- if (object.size != other.size && !isPartial) {
4475
- return false;
4476
- }
4477
- var stacked = stack.get(object);
4478
- if (stacked) {
4479
- return stacked == other;
4480
- }
4481
- bitmask |= COMPARE_UNORDERED_FLAG;
4482
- stack.set(object, other);
4483
- var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
4484
- stack["delete"](object);
4485
- return result;
4486
- case symbolTag:
4487
- if (symbolValueOf) {
4488
- return symbolValueOf.call(object) == symbolValueOf.call(other);
4489
- }
4490
- }
4491
- return false;
4492
- }
4493
- var COMPARE_PARTIAL_FLAG$1 = 1;
4494
- var objectProto$1 = Object.prototype;
4495
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
4496
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
4497
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
4498
- if (objLength != othLength && !isPartial) {
4499
- return false;
4500
- }
4501
- var index2 = objLength;
4502
- while (index2--) {
4503
- var key = objProps[index2];
4504
- if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
4505
- return false;
4506
- }
4507
- }
4508
- var objStacked = stack.get(object);
4509
- var othStacked = stack.get(other);
4510
- if (objStacked && othStacked) {
4511
- return objStacked == other && othStacked == object;
4512
- }
4513
- var result = true;
4514
- stack.set(object, other);
4515
- stack.set(other, object);
4516
- var skipCtor = isPartial;
4517
- while (++index2 < objLength) {
4518
- key = objProps[index2];
4519
- var objValue = object[key], othValue = other[key];
4520
- if (customizer) {
4521
- var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
4522
- }
4523
- if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
4524
- result = false;
4525
- break;
4526
- }
4527
- skipCtor || (skipCtor = key == "constructor");
4528
- }
4529
- if (result && !skipCtor) {
4530
- var objCtor = object.constructor, othCtor = other.constructor;
4531
- if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
4532
- result = false;
4533
- }
4534
- }
4535
- stack["delete"](object);
4536
- stack["delete"](other);
4537
- return result;
4538
- }
4539
- var COMPARE_PARTIAL_FLAG = 1;
4540
- var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
4541
- var objectProto = Object.prototype;
4542
- var hasOwnProperty = objectProto.hasOwnProperty;
4543
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
4544
- var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
4545
- objTag = objTag == argsTag ? objectTag : objTag;
4546
- othTag = othTag == argsTag ? objectTag : othTag;
4547
- var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
4548
- if (isSameTag && isBuffer(object)) {
4549
- if (!isBuffer(other)) {
4550
- return false;
4551
- }
4552
- objIsArr = true;
4553
- objIsObj = false;
4554
- }
4555
- if (isSameTag && !objIsObj) {
4556
- stack || (stack = new Stack());
4557
- return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
4558
- }
4559
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
4560
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
4561
- if (objIsWrapped || othIsWrapped) {
4562
- var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
4563
- stack || (stack = new Stack());
4564
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
4565
- }
4566
- }
4567
- if (!isSameTag) {
4568
- return false;
4569
- }
4570
- stack || (stack = new Stack());
4571
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
4572
- }
4573
- function baseIsEqual(value, other, bitmask, customizer, stack) {
4574
- if (value === other) {
4575
- return true;
4576
- }
4577
- if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
4578
- return value !== value && other !== other;
4579
- }
4580
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
4581
- }
4582
- function baseHasIn(object, key) {
4583
- return object != null && key in Object(object);
4584
- }
4585
- function hasPath(object, path, hasFunc) {
4586
- path = castPath(path, object);
4587
- var index2 = -1, length = path.length, result = false;
4588
- while (++index2 < length) {
4589
- var key = toKey(path[index2]);
4590
- if (!(result = object != null && hasFunc(object, key))) {
4591
- break;
4592
- }
4593
- object = object[key];
4594
- }
4595
- if (result || ++index2 != length) {
4596
- return result;
4597
- }
4598
- length = object == null ? 0 : object.length;
4599
- return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
4600
- }
4601
- function hasIn(object, path) {
4602
- return object != null && hasPath(object, path, baseHasIn);
4603
- }
4604
- function fromPairs(pairs) {
4605
- var index2 = -1, length = pairs == null ? 0 : pairs.length, result = {};
4606
- while (++index2 < length) {
4607
- var pair = pairs[index2];
4608
- result[pair[0]] = pair[1];
4609
- }
4610
- return result;
4611
- }
4612
- function isEqual(value, other) {
4613
- return baseIsEqual(value, other);
4614
- }
4615
- function isNil(value) {
4616
- return value == null;
4617
- }
4618
- function baseSet(object, path, value, customizer) {
4619
- if (!isObject(object)) {
4620
- return object;
4621
- }
4622
- path = castPath(path, object);
4623
- var index2 = -1, length = path.length, lastIndex = length - 1, nested = object;
4624
- while (nested != null && ++index2 < length) {
4625
- var key = toKey(path[index2]), newValue = value;
4626
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
4627
- return object;
4628
- }
4629
- if (index2 != lastIndex) {
4630
- var objValue = nested[key];
4631
- newValue = void 0;
4632
- if (newValue === void 0) {
4633
- newValue = isObject(objValue) ? objValue : isIndex(path[index2 + 1]) ? [] : {};
4634
- }
4635
- }
4636
- assignValue(nested, key, newValue);
4637
- nested = nested[key];
4638
- }
4639
- return object;
4640
- }
4641
- function basePickBy(object, paths, predicate) {
4642
- var index2 = -1, length = paths.length, result = {};
4643
- while (++index2 < length) {
4644
- var path = paths[index2], value = baseGet(object, path);
4645
- if (predicate(value, path)) {
4646
- baseSet(result, castPath(path, object), value);
4647
- }
4648
- }
4649
- return result;
4650
- }
4651
- function basePick(object, paths) {
4652
- return basePickBy(object, paths, function(value, path) {
4653
- return hasIn(object, path);
4654
- });
4655
- }
4656
- var pick = flatRest(function(object, paths) {
4657
- return object == null ? {} : basePick(object, paths);
4658
- });
4659
- const isUndefined = (val) => val === void 0;
4660
- const isBoolean = (val) => typeof val === "boolean";
4661
- const isNumber = (val) => typeof val === "number";
4662
- const isPropAbsent = (prop) => isNil(prop);
4663
- const isStringNumber = (val) => {
4664
- if (!isString(val)) {
4665
- return false;
4666
- }
4667
- return !Number.isNaN(Number(val));
4668
- };
4669
- var __defProp$9 = Object.defineProperty;
4670
- var __defProps$6 = Object.defineProperties;
4671
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
4672
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
4673
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
4674
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
4675
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4676
- var __spreadValues$9 = (a, b) => {
4677
- for (var prop in b || (b = {}))
4678
- if (__hasOwnProp$b.call(b, prop))
4679
- __defNormalProp$9(a, prop, b[prop]);
4680
- if (__getOwnPropSymbols$b)
4681
- for (var prop of __getOwnPropSymbols$b(b)) {
4682
- if (__propIsEnum$b.call(b, prop))
4683
- __defNormalProp$9(a, prop, b[prop]);
4684
- }
4685
- return a;
4686
- };
4687
- var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
4688
- function computedEager(fn, options) {
4689
- var _a2;
4690
- const result = shallowRef();
4691
- watchEffect(() => {
4692
- result.value = fn();
4693
- }, __spreadProps$6(__spreadValues$9({}, options), {
4694
- flush: (_a2 = void 0) != null ? _a2 : "sync"
4695
- }));
4696
- return readonly(result);
4697
- }
4698
- var _a;
4699
- const isClient = typeof window !== "undefined";
4700
- isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
4701
- const epPropKey = "__epPropKey";
4702
- const definePropType = (val) => val;
4703
- const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
4704
- const buildProp = (prop, key) => {
4705
- if (!isObject$1(prop) || isEpProp(prop))
4706
- return prop;
4707
- const { values, required, default: defaultValue, type, validator } = prop;
4708
- const _validator = values || validator ? (val) => {
4709
- let valid = false;
4710
- let allowedValues = [];
4711
- if (values) {
4712
- allowedValues = Array.from(values);
4713
- if (hasOwn(prop, "default")) {
4714
- allowedValues.push(defaultValue);
4715
- }
4716
- valid || (valid = allowedValues.includes(val));
4717
- }
4718
- if (validator)
4719
- valid || (valid = validator(val));
4720
- if (!valid && allowedValues.length > 0) {
4721
- const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
4722
- warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
4723
- }
4724
- return valid;
4725
- } : void 0;
4726
- const epProp = {
4727
- type,
4728
- required: !!required,
4729
- validator: _validator,
4730
- [epPropKey]: true
4731
- };
4732
- if (hasOwn(prop, "default"))
4733
- epProp.default = defaultValue;
4734
- return epProp;
4735
- };
4736
- const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
4737
- key,
4738
- buildProp(option, key)
4739
- ]));
4740
- const componentSizes = ["", "default", "small", "large"];
4741
- const useSizeProp = buildProp({
4742
- type: String,
4743
- values: componentSizes,
4744
- required: false
4745
- });
4746
- const SIZE_INJECTION_KEY = Symbol("size");
4747
- const useGlobalSize = () => {
4748
- const injectedSize = inject(SIZE_INJECTION_KEY, {});
4749
- return computed(() => {
4750
- return unref(injectedSize.size) || "";
4751
- });
4752
- };
4753
- const globalConfig = ref();
4754
- function useGlobalConfig(key, defaultValue = void 0) {
4755
- const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
4756
- {
4757
- return computed(() => {
4758
- var _a2, _b;
4759
- return (_b = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b : defaultValue;
4760
- });
4761
- }
4762
- }
4763
- const UPDATE_MODEL_EVENT = "update:modelValue";
4764
- const CHANGE_EVENT = "change";
4765
- var _export_sfc = (sfc, props) => {
4766
- const target = sfc.__vccOpts || sfc;
4767
- for (const [key, val] of props) {
4768
- target[key] = val;
4769
- }
4770
- return target;
4771
- };
4772
- function addUnit(value, defaultUnit = "px") {
4773
- if (!value)
4774
- return "";
4775
- if (isNumber(value) || isStringNumber(value)) {
4776
- return `${value}${defaultUnit}`;
4777
- } else if (isString(value)) {
4778
- return value;
4779
- }
4780
- }
4781
- function debugWarn(scope, message) {
4782
- }
4783
- const withInstall = (main, extra) => {
4784
- main.install = (app) => {
4785
- for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
4786
- app.component(comp.name, comp);
4787
- }
4788
- };
4789
- if (extra) {
4790
- for (const [key, comp] of Object.entries(extra)) {
4791
- main[key] = comp;
4792
- }
4793
- }
4794
- return main;
4795
- };
4796
- const withNoopInstall = (component) => {
4797
- component.install = NOOP;
4798
- return component;
4799
- };
4800
- const iconProps = buildProps({
4801
- size: {
4802
- type: definePropType([Number, String])
4803
- },
4804
- color: {
4805
- type: String
4806
- }
4807
- });
4808
- const __default__$5 = defineComponent({
4809
- name: "ElIcon",
4810
- inheritAttrs: false
4811
- });
4812
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4813
- ...__default__$5,
4814
- props: iconProps,
4815
- setup(__props) {
4816
- const props = __props;
4817
- const ns = useNamespace("icon");
4818
- const style = computed(() => {
4819
- const { size, color } = props;
4820
- if (!size && !color)
4821
- return {};
4822
- return {
4823
- fontSize: isUndefined(size) ? void 0 : addUnit(size),
4824
- "--color": color
4825
- };
4826
- });
4827
- return (_ctx, _cache) => {
4828
- return openBlock(), createElementBlock("i", mergeProps({
4829
- class: unref(ns).b(),
4830
- style: unref(style)
4831
- }, _ctx.$attrs), [
4832
- renderSlot(_ctx.$slots, "default")
4833
- ], 16);
4834
- };
4835
- }
4836
- });
4837
- var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "icon.vue"]]);
4838
- const ElIcon = withInstall(Icon);
4839
- /*! Element Plus Icons Vue v2.3.2 */
4840
- var _sfc_main150 = /* @__PURE__ */ defineComponent({
4841
- name: "Loading",
4842
- __name: "loading",
4843
- setup(__props) {
4844
- return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
4845
- xmlns: "http://www.w3.org/2000/svg",
4846
- viewBox: "0 0 1024 1024"
4847
- }, [
4848
- createElementVNode("path", {
4849
- fill: "currentColor",
4850
- d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0"
4851
- })
4852
- ]));
4853
- }
4854
- }), loading_default = _sfc_main150;
4855
- const iconPropType = definePropType([
4856
- String,
4857
- Object,
4858
- Function
4859
- ]);
4860
- const ariaProps = buildProps({
4861
- ariaLabel: String,
4862
- ariaOrientation: {
4863
- type: String,
4864
- values: ["horizontal", "vertical", "undefined"]
4865
- },
4866
- ariaControls: String
4867
- });
4868
- const useAriaProps = (arias) => {
4869
- return pick(ariaProps, arias);
4870
- };
4871
- const defaultIdInjection = {
4872
- prefix: Math.floor(Math.random() * 1e4),
4873
- current: 0
4874
- };
4875
- const ID_INJECTION_KEY = Symbol("elIdInjection");
4876
- const useIdInjection = () => {
4877
- return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
4878
- };
4879
- const useId = (deterministicId) => {
4880
- const idInjection = useIdInjection();
4881
- const namespace = useGetDerivedNamespace();
4882
- const idRef = computedEager(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
4883
- return idRef;
4884
- };
4885
- const formContextKey = Symbol("formContextKey");
4886
- const formItemContextKey = Symbol("formItemContextKey");
4887
- const useFormItem = () => {
4888
- const form = inject(formContextKey, void 0);
4889
- const formItem = inject(formItemContextKey, void 0);
4890
- return {
4891
- form,
4892
- formItem
4893
- };
4894
- };
4895
- const useFormItemInputId = (props, {
4896
- formItemContext,
4897
- disableIdGeneration,
4898
- disableIdManagement
4899
- }) => {
4900
- if (!disableIdGeneration) {
4901
- disableIdGeneration = ref(false);
4902
- }
4903
- if (!disableIdManagement) {
4904
- disableIdManagement = ref(false);
4905
- }
4906
- const instance = getCurrentInstance();
4907
- const inLabel = () => {
4908
- let parent = instance == null ? void 0 : instance.parent;
4909
- while (parent) {
4910
- if (parent.type.name === "ElFormItem") {
4911
- return false;
4912
- }
4913
- if (parent.type.name === "ElLabelWrap") {
4914
- return true;
4915
- }
4916
- parent = parent.parent;
4917
- }
4918
- return false;
4919
- };
4920
- const inputId = ref();
4921
- let idUnwatch = void 0;
4922
- const isLabeledByFormItem = computed(() => {
4923
- var _a2;
4924
- return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && ((_a2 = formItemContext.inputIds) == null ? void 0 : _a2.length) <= 1);
4925
- });
4926
- onMounted(() => {
4927
- idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
4928
- const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
4929
- if (newId !== inputId.value) {
4930
- if ((formItemContext == null ? void 0 : formItemContext.removeInputId) && !inLabel()) {
4931
- inputId.value && formItemContext.removeInputId(inputId.value);
4932
- if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
4933
- formItemContext.addInputId(newId);
4934
- }
4935
- }
4936
- inputId.value = newId;
4937
- }
4938
- }, { immediate: true });
4939
- });
4940
- onUnmounted(() => {
4941
- idUnwatch && idUnwatch();
4942
- if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
4943
- inputId.value && formItemContext.removeInputId(inputId.value);
4944
- }
4945
- });
4946
- return {
4947
- isLabeledByFormItem,
4948
- inputId
4949
- };
4950
- };
4951
- const useProp = (name) => {
4952
- const vm = getCurrentInstance();
4953
- return computed(() => {
4954
- var _a2, _b;
4955
- return (_b = (_a2 = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a2.$props) == null ? void 0 : _b[name];
4956
- });
4957
- };
4958
- const useFormSize = (fallback, ignore = {}) => {
4959
- const emptyRef = ref(void 0);
4960
- const size = ignore.prop ? emptyRef : useProp("size");
4961
- const globalConfig2 = ignore.global ? emptyRef : useGlobalSize();
4962
- const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
4963
- const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
4964
- return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
4965
- };
4966
- const useFormDisabled = (fallback) => {
4967
- const disabled = useProp("disabled");
4968
- const form = inject(formContextKey, void 0);
4969
- return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
4970
- };
4971
- const buttonGroupContextKey = Symbol("buttonGroupContextKey");
4972
- const useDeprecated = ({ from, replacement, scope, version, ref: ref2, type = "API" }, condition) => {
4973
- watch(() => unref(condition), (val) => {
4974
- }, {
4975
- immediate: true
4976
- });
4977
- };
4978
- const useButton = (props, emit) => {
4979
- useDeprecated({
4980
- from: "type.text",
4981
- replacement: "link",
4982
- version: "3.0.0",
4983
- scope: "props",
4984
- ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
4985
- }, computed(() => props.type === "text"));
4986
- const buttonGroupContext = inject(buttonGroupContextKey, void 0);
4987
- const globalConfig2 = useGlobalConfig("button");
4988
- const { form } = useFormItem();
4989
- const _size = useFormSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
4990
- const _disabled = useFormDisabled();
4991
- const _ref = ref();
4992
- const slots = useSlots();
4993
- const _type = computed(() => {
4994
- var _a2;
4995
- return props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || ((_a2 = globalConfig2.value) == null ? void 0 : _a2.type) || "";
4996
- });
4997
- const autoInsertSpace = computed(() => {
4998
- var _a2, _b, _c;
4999
- return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
5000
- });
5001
- const _plain = computed(() => {
5002
- var _a2, _b, _c;
5003
- return (_c = (_b = props.plain) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.plain) != null ? _c : false;
5004
- });
5005
- const _round = computed(() => {
5006
- var _a2, _b, _c;
5007
- return (_c = (_b = props.round) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.round) != null ? _c : false;
5008
- });
5009
- const _props = computed(() => {
5010
- if (props.tag === "button") {
5011
- return {
5012
- ariaDisabled: _disabled.value || props.loading,
5013
- disabled: _disabled.value || props.loading,
5014
- autofocus: props.autofocus,
5015
- type: props.nativeType
5016
- };
5017
- }
5018
- return {};
5019
- });
5020
- const shouldAddSpace = computed(() => {
5021
- var _a2;
5022
- const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
5023
- if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
5024
- const slot = defaultSlot[0];
5025
- if ((slot == null ? void 0 : slot.type) === Text) {
5026
- const text = slot.children;
5027
- return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(text.trim());
5028
- }
5029
- }
5030
- return false;
5031
- });
5032
- const handleClick = (evt) => {
5033
- if (_disabled.value || props.loading) {
5034
- evt.stopPropagation();
5035
- return;
5036
- }
5037
- if (props.nativeType === "reset") {
5038
- form == null ? void 0 : form.resetFields();
5039
- }
5040
- emit("click", evt);
5041
- };
5042
- return {
5043
- _disabled,
5044
- _size,
5045
- _type,
5046
- _ref,
5047
- _props,
5048
- _plain,
5049
- _round,
5050
- shouldAddSpace,
5051
- handleClick
5052
- };
5053
- };
5054
- const buttonTypes = [
5055
- "default",
5056
- "primary",
5057
- "success",
5058
- "warning",
5059
- "info",
5060
- "danger",
5061
- "text",
5062
- ""
5063
- ];
5064
- const buttonNativeTypes = ["button", "submit", "reset"];
5065
- const buttonProps = buildProps({
5066
- size: useSizeProp,
5067
- disabled: Boolean,
5068
- type: {
5069
- type: String,
5070
- values: buttonTypes,
5071
- default: ""
5072
- },
5073
- icon: {
5074
- type: iconPropType
5075
- },
5076
- nativeType: {
5077
- type: String,
5078
- values: buttonNativeTypes,
5079
- default: "button"
5080
- },
5081
- loading: Boolean,
5082
- loadingIcon: {
5083
- type: iconPropType,
5084
- default: () => loading_default
5085
- },
5086
- plain: {
5087
- type: Boolean,
5088
- default: void 0
5089
- },
5090
- text: Boolean,
5091
- link: Boolean,
5092
- bg: Boolean,
5093
- autofocus: Boolean,
5094
- round: {
5095
- type: Boolean,
5096
- default: void 0
5097
- },
5098
- circle: Boolean,
5099
- color: String,
5100
- dark: Boolean,
5101
- autoInsertSpace: {
5102
- type: Boolean,
5103
- default: void 0
5104
- },
5105
- tag: {
5106
- type: definePropType([String, Object]),
5107
- default: "button"
5108
- }
5109
- });
5110
- const buttonEmits = {
5111
- click: (evt) => evt instanceof MouseEvent
5112
- };
5113
- function bound01(n, max) {
5114
- if (isOnePointZero(n)) {
5115
- n = "100%";
5116
- }
5117
- var isPercent = isPercentage(n);
5118
- n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
5119
- if (isPercent) {
5120
- n = parseInt(String(n * max), 10) / 100;
5121
- }
5122
- if (Math.abs(n - max) < 1e-6) {
5123
- return 1;
5124
- }
5125
- if (max === 360) {
5126
- n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
5127
- } else {
5128
- n = n % max / parseFloat(String(max));
5129
- }
5130
- return n;
5131
- }
5132
- function clamp01(val) {
5133
- return Math.min(1, Math.max(0, val));
5134
- }
5135
- function isOnePointZero(n) {
5136
- return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
5137
- }
5138
- function isPercentage(n) {
5139
- return typeof n === "string" && n.indexOf("%") !== -1;
5140
- }
5141
- function boundAlpha(a) {
5142
- a = parseFloat(a);
5143
- if (isNaN(a) || a < 0 || a > 1) {
5144
- a = 1;
5145
- }
5146
- return a;
5147
- }
5148
- function convertToPercentage(n) {
5149
- if (n <= 1) {
5150
- return "".concat(Number(n) * 100, "%");
5151
- }
5152
- return n;
5153
- }
5154
- function pad2(c) {
5155
- return c.length === 1 ? "0" + c : String(c);
5156
- }
5157
- function rgbToRgb(r, g, b) {
5158
- return {
5159
- r: bound01(r, 255) * 255,
5160
- g: bound01(g, 255) * 255,
5161
- b: bound01(b, 255) * 255
5162
- };
5163
- }
5164
- function rgbToHsl(r, g, b) {
5165
- r = bound01(r, 255);
5166
- g = bound01(g, 255);
5167
- b = bound01(b, 255);
5168
- var max = Math.max(r, g, b);
5169
- var min = Math.min(r, g, b);
5170
- var h = 0;
5171
- var s = 0;
5172
- var l = (max + min) / 2;
5173
- if (max === min) {
5174
- s = 0;
5175
- h = 0;
5176
- } else {
5177
- var d = max - min;
5178
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
5179
- switch (max) {
5180
- case r:
5181
- h = (g - b) / d + (g < b ? 6 : 0);
5182
- break;
5183
- case g:
5184
- h = (b - r) / d + 2;
5185
- break;
5186
- case b:
5187
- h = (r - g) / d + 4;
5188
- break;
5189
- }
5190
- h /= 6;
5191
- }
5192
- return { h, s, l };
5193
- }
5194
- function hue2rgb(p, q, t) {
5195
- if (t < 0) {
5196
- t += 1;
5197
- }
5198
- if (t > 1) {
5199
- t -= 1;
5200
- }
5201
- if (t < 1 / 6) {
5202
- return p + (q - p) * (6 * t);
5203
- }
5204
- if (t < 1 / 2) {
5205
- return q;
5206
- }
5207
- if (t < 2 / 3) {
5208
- return p + (q - p) * (2 / 3 - t) * 6;
5209
- }
5210
- return p;
5211
- }
5212
- function hslToRgb(h, s, l) {
5213
- var r;
5214
- var g;
5215
- var b;
5216
- h = bound01(h, 360);
5217
- s = bound01(s, 100);
5218
- l = bound01(l, 100);
5219
- if (s === 0) {
5220
- g = l;
5221
- b = l;
5222
- r = l;
5223
- } else {
5224
- var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
5225
- var p = 2 * l - q;
5226
- r = hue2rgb(p, q, h + 1 / 3);
5227
- g = hue2rgb(p, q, h);
5228
- b = hue2rgb(p, q, h - 1 / 3);
5229
- }
5230
- return { r: r * 255, g: g * 255, b: b * 255 };
5231
- }
5232
- function rgbToHsv(r, g, b) {
5233
- r = bound01(r, 255);
5234
- g = bound01(g, 255);
5235
- b = bound01(b, 255);
5236
- var max = Math.max(r, g, b);
5237
- var min = Math.min(r, g, b);
5238
- var h = 0;
5239
- var v = max;
5240
- var d = max - min;
5241
- var s = max === 0 ? 0 : d / max;
5242
- if (max === min) {
5243
- h = 0;
5244
- } else {
5245
- switch (max) {
5246
- case r:
5247
- h = (g - b) / d + (g < b ? 6 : 0);
5248
- break;
5249
- case g:
5250
- h = (b - r) / d + 2;
5251
- break;
5252
- case b:
5253
- h = (r - g) / d + 4;
5254
- break;
5255
- }
5256
- h /= 6;
5257
- }
5258
- return { h, s, v };
5259
- }
5260
- function hsvToRgb(h, s, v) {
5261
- h = bound01(h, 360) * 6;
5262
- s = bound01(s, 100);
5263
- v = bound01(v, 100);
5264
- var i = Math.floor(h);
5265
- var f = h - i;
5266
- var p = v * (1 - s);
5267
- var q = v * (1 - f * s);
5268
- var t = v * (1 - (1 - f) * s);
5269
- var mod = i % 6;
5270
- var r = [v, q, p, p, t, v][mod];
5271
- var g = [t, v, v, q, p, p][mod];
5272
- var b = [p, p, t, v, v, q][mod];
5273
- return { r: r * 255, g: g * 255, b: b * 255 };
5274
- }
5275
- function rgbToHex(r, g, b, allow3Char) {
5276
- var hex = [
5277
- pad2(Math.round(r).toString(16)),
5278
- pad2(Math.round(g).toString(16)),
5279
- pad2(Math.round(b).toString(16))
5280
- ];
5281
- if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
5282
- return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
5283
- }
5284
- return hex.join("");
5285
- }
5286
- function rgbaToHex(r, g, b, a, allow4Char) {
5287
- var hex = [
5288
- pad2(Math.round(r).toString(16)),
5289
- pad2(Math.round(g).toString(16)),
5290
- pad2(Math.round(b).toString(16)),
5291
- pad2(convertDecimalToHex(a))
5292
- ];
5293
- if (allow4Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) && hex[3].startsWith(hex[3].charAt(1))) {
5294
- return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
5295
- }
5296
- return hex.join("");
5297
- }
5298
- function convertDecimalToHex(d) {
5299
- return Math.round(parseFloat(d) * 255).toString(16);
5300
- }
5301
- function convertHexToDecimal(h) {
5302
- return parseIntFromHex(h) / 255;
5303
- }
5304
- function parseIntFromHex(val) {
5305
- return parseInt(val, 16);
5306
- }
5307
- function numberInputToObject(color) {
5308
- return {
5309
- r: color >> 16,
5310
- g: (color & 65280) >> 8,
5311
- b: color & 255
5312
- };
5313
- }
5314
- var names = {
5315
- aliceblue: "#f0f8ff",
5316
- antiquewhite: "#faebd7",
5317
- aqua: "#00ffff",
5318
- aquamarine: "#7fffd4",
5319
- azure: "#f0ffff",
5320
- beige: "#f5f5dc",
5321
- bisque: "#ffe4c4",
5322
- black: "#000000",
5323
- blanchedalmond: "#ffebcd",
5324
- blue: "#0000ff",
5325
- blueviolet: "#8a2be2",
5326
- brown: "#a52a2a",
5327
- burlywood: "#deb887",
5328
- cadetblue: "#5f9ea0",
5329
- chartreuse: "#7fff00",
5330
- chocolate: "#d2691e",
5331
- coral: "#ff7f50",
5332
- cornflowerblue: "#6495ed",
5333
- cornsilk: "#fff8dc",
5334
- crimson: "#dc143c",
5335
- cyan: "#00ffff",
5336
- darkblue: "#00008b",
5337
- darkcyan: "#008b8b",
5338
- darkgoldenrod: "#b8860b",
5339
- darkgray: "#a9a9a9",
5340
- darkgreen: "#006400",
5341
- darkgrey: "#a9a9a9",
5342
- darkkhaki: "#bdb76b",
5343
- darkmagenta: "#8b008b",
5344
- darkolivegreen: "#556b2f",
5345
- darkorange: "#ff8c00",
5346
- darkorchid: "#9932cc",
5347
- darkred: "#8b0000",
5348
- darksalmon: "#e9967a",
5349
- darkseagreen: "#8fbc8f",
5350
- darkslateblue: "#483d8b",
5351
- darkslategray: "#2f4f4f",
5352
- darkslategrey: "#2f4f4f",
5353
- darkturquoise: "#00ced1",
5354
- darkviolet: "#9400d3",
5355
- deeppink: "#ff1493",
5356
- deepskyblue: "#00bfff",
5357
- dimgray: "#696969",
5358
- dimgrey: "#696969",
5359
- dodgerblue: "#1e90ff",
5360
- firebrick: "#b22222",
5361
- floralwhite: "#fffaf0",
5362
- forestgreen: "#228b22",
5363
- fuchsia: "#ff00ff",
5364
- gainsboro: "#dcdcdc",
5365
- ghostwhite: "#f8f8ff",
5366
- goldenrod: "#daa520",
5367
- gold: "#ffd700",
5368
- gray: "#808080",
5369
- green: "#008000",
5370
- greenyellow: "#adff2f",
5371
- grey: "#808080",
5372
- honeydew: "#f0fff0",
5373
- hotpink: "#ff69b4",
5374
- indianred: "#cd5c5c",
5375
- indigo: "#4b0082",
5376
- ivory: "#fffff0",
5377
- khaki: "#f0e68c",
5378
- lavenderblush: "#fff0f5",
5379
- lavender: "#e6e6fa",
5380
- lawngreen: "#7cfc00",
5381
- lemonchiffon: "#fffacd",
5382
- lightblue: "#add8e6",
5383
- lightcoral: "#f08080",
5384
- lightcyan: "#e0ffff",
5385
- lightgoldenrodyellow: "#fafad2",
5386
- lightgray: "#d3d3d3",
5387
- lightgreen: "#90ee90",
5388
- lightgrey: "#d3d3d3",
5389
- lightpink: "#ffb6c1",
5390
- lightsalmon: "#ffa07a",
5391
- lightseagreen: "#20b2aa",
5392
- lightskyblue: "#87cefa",
5393
- lightslategray: "#778899",
5394
- lightslategrey: "#778899",
5395
- lightsteelblue: "#b0c4de",
5396
- lightyellow: "#ffffe0",
5397
- lime: "#00ff00",
5398
- limegreen: "#32cd32",
5399
- linen: "#faf0e6",
5400
- magenta: "#ff00ff",
5401
- maroon: "#800000",
5402
- mediumaquamarine: "#66cdaa",
5403
- mediumblue: "#0000cd",
5404
- mediumorchid: "#ba55d3",
5405
- mediumpurple: "#9370db",
5406
- mediumseagreen: "#3cb371",
5407
- mediumslateblue: "#7b68ee",
5408
- mediumspringgreen: "#00fa9a",
5409
- mediumturquoise: "#48d1cc",
5410
- mediumvioletred: "#c71585",
5411
- midnightblue: "#191970",
5412
- mintcream: "#f5fffa",
5413
- mistyrose: "#ffe4e1",
5414
- moccasin: "#ffe4b5",
5415
- navajowhite: "#ffdead",
5416
- navy: "#000080",
5417
- oldlace: "#fdf5e6",
5418
- olive: "#808000",
5419
- olivedrab: "#6b8e23",
5420
- orange: "#ffa500",
5421
- orangered: "#ff4500",
5422
- orchid: "#da70d6",
5423
- palegoldenrod: "#eee8aa",
5424
- palegreen: "#98fb98",
5425
- paleturquoise: "#afeeee",
5426
- palevioletred: "#db7093",
5427
- papayawhip: "#ffefd5",
5428
- peachpuff: "#ffdab9",
5429
- peru: "#cd853f",
5430
- pink: "#ffc0cb",
5431
- plum: "#dda0dd",
5432
- powderblue: "#b0e0e6",
5433
- purple: "#800080",
5434
- rebeccapurple: "#663399",
5435
- red: "#ff0000",
5436
- rosybrown: "#bc8f8f",
5437
- royalblue: "#4169e1",
5438
- saddlebrown: "#8b4513",
5439
- salmon: "#fa8072",
5440
- sandybrown: "#f4a460",
5441
- seagreen: "#2e8b57",
5442
- seashell: "#fff5ee",
5443
- sienna: "#a0522d",
5444
- silver: "#c0c0c0",
5445
- skyblue: "#87ceeb",
5446
- slateblue: "#6a5acd",
5447
- slategray: "#708090",
5448
- slategrey: "#708090",
5449
- snow: "#fffafa",
5450
- springgreen: "#00ff7f",
5451
- steelblue: "#4682b4",
5452
- tan: "#d2b48c",
5453
- teal: "#008080",
5454
- thistle: "#d8bfd8",
5455
- tomato: "#ff6347",
5456
- turquoise: "#40e0d0",
5457
- violet: "#ee82ee",
5458
- wheat: "#f5deb3",
5459
- white: "#ffffff",
5460
- whitesmoke: "#f5f5f5",
5461
- yellow: "#ffff00",
5462
- yellowgreen: "#9acd32"
5463
- };
5464
- function inputToRGB(color) {
5465
- var rgb = { r: 0, g: 0, b: 0 };
5466
- var a = 1;
5467
- var s = null;
5468
- var v = null;
5469
- var l = null;
5470
- var ok = false;
5471
- var format = false;
5472
- if (typeof color === "string") {
5473
- color = stringInputToObject(color);
5474
- }
5475
- if (typeof color === "object") {
5476
- if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
5477
- rgb = rgbToRgb(color.r, color.g, color.b);
5478
- ok = true;
5479
- format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
5480
- } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
5481
- s = convertToPercentage(color.s);
5482
- v = convertToPercentage(color.v);
5483
- rgb = hsvToRgb(color.h, s, v);
5484
- ok = true;
5485
- format = "hsv";
5486
- } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
5487
- s = convertToPercentage(color.s);
5488
- l = convertToPercentage(color.l);
5489
- rgb = hslToRgb(color.h, s, l);
5490
- ok = true;
5491
- format = "hsl";
5492
- }
5493
- if (Object.prototype.hasOwnProperty.call(color, "a")) {
5494
- a = color.a;
5495
- }
5496
- }
5497
- a = boundAlpha(a);
5498
- return {
5499
- ok,
5500
- format: color.format || format,
5501
- r: Math.min(255, Math.max(rgb.r, 0)),
5502
- g: Math.min(255, Math.max(rgb.g, 0)),
5503
- b: Math.min(255, Math.max(rgb.b, 0)),
5504
- a
5505
- };
5506
- }
5507
- var CSS_INTEGER = "[-\\+]?\\d+%?";
5508
- var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
5509
- var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
5510
- var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
5511
- var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
5512
- var matchers = {
5513
- CSS_UNIT: new RegExp(CSS_UNIT),
5514
- rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
5515
- rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
5516
- hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
5517
- hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
5518
- hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
5519
- hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
5520
- hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
5521
- hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
5522
- hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
5523
- hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
5524
- };
5525
- function stringInputToObject(color) {
5526
- color = color.trim().toLowerCase();
5527
- if (color.length === 0) {
5528
- return false;
5529
- }
5530
- var named = false;
5531
- if (names[color]) {
5532
- color = names[color];
5533
- named = true;
5534
- } else if (color === "transparent") {
5535
- return { r: 0, g: 0, b: 0, a: 0, format: "name" };
5536
- }
5537
- var match = matchers.rgb.exec(color);
5538
- if (match) {
5539
- return { r: match[1], g: match[2], b: match[3] };
5540
- }
5541
- match = matchers.rgba.exec(color);
5542
- if (match) {
5543
- return { r: match[1], g: match[2], b: match[3], a: match[4] };
5544
- }
5545
- match = matchers.hsl.exec(color);
5546
- if (match) {
5547
- return { h: match[1], s: match[2], l: match[3] };
5548
- }
5549
- match = matchers.hsla.exec(color);
5550
- if (match) {
5551
- return { h: match[1], s: match[2], l: match[3], a: match[4] };
5552
- }
5553
- match = matchers.hsv.exec(color);
5554
- if (match) {
5555
- return { h: match[1], s: match[2], v: match[3] };
5556
- }
5557
- match = matchers.hsva.exec(color);
5558
- if (match) {
5559
- return { h: match[1], s: match[2], v: match[3], a: match[4] };
5560
- }
5561
- match = matchers.hex8.exec(color);
5562
- if (match) {
5563
- return {
5564
- r: parseIntFromHex(match[1]),
5565
- g: parseIntFromHex(match[2]),
5566
- b: parseIntFromHex(match[3]),
5567
- a: convertHexToDecimal(match[4]),
5568
- format: named ? "name" : "hex8"
5569
- };
5570
- }
5571
- match = matchers.hex6.exec(color);
5572
- if (match) {
5573
- return {
5574
- r: parseIntFromHex(match[1]),
5575
- g: parseIntFromHex(match[2]),
5576
- b: parseIntFromHex(match[3]),
5577
- format: named ? "name" : "hex"
5578
- };
5579
- }
5580
- match = matchers.hex4.exec(color);
5581
- if (match) {
5582
- return {
5583
- r: parseIntFromHex(match[1] + match[1]),
5584
- g: parseIntFromHex(match[2] + match[2]),
5585
- b: parseIntFromHex(match[3] + match[3]),
5586
- a: convertHexToDecimal(match[4] + match[4]),
5587
- format: named ? "name" : "hex8"
5588
- };
5589
- }
5590
- match = matchers.hex3.exec(color);
5591
- if (match) {
5592
- return {
5593
- r: parseIntFromHex(match[1] + match[1]),
5594
- g: parseIntFromHex(match[2] + match[2]),
5595
- b: parseIntFromHex(match[3] + match[3]),
5596
- format: named ? "name" : "hex"
5597
- };
5598
- }
5599
- return false;
5600
- }
5601
- function isValidCSSUnit(color) {
5602
- return Boolean(matchers.CSS_UNIT.exec(String(color)));
5603
- }
5604
- var TinyColor = (
5605
- /** @class */
5606
- (function() {
5607
- function TinyColor2(color, opts) {
5608
- if (color === void 0) {
5609
- color = "";
5610
- }
5611
- if (opts === void 0) {
5612
- opts = {};
5613
- }
5614
- var _a2;
5615
- if (color instanceof TinyColor2) {
5616
- return color;
5617
- }
5618
- if (typeof color === "number") {
5619
- color = numberInputToObject(color);
5620
- }
5621
- this.originalInput = color;
5622
- var rgb = inputToRGB(color);
5623
- this.originalInput = color;
5624
- this.r = rgb.r;
5625
- this.g = rgb.g;
5626
- this.b = rgb.b;
5627
- this.a = rgb.a;
5628
- this.roundA = Math.round(100 * this.a) / 100;
5629
- this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
5630
- this.gradientType = opts.gradientType;
5631
- if (this.r < 1) {
5632
- this.r = Math.round(this.r);
5633
- }
5634
- if (this.g < 1) {
5635
- this.g = Math.round(this.g);
5636
- }
5637
- if (this.b < 1) {
5638
- this.b = Math.round(this.b);
5639
- }
5640
- this.isValid = rgb.ok;
5641
- }
5642
- TinyColor2.prototype.isDark = function() {
5643
- return this.getBrightness() < 128;
5644
- };
5645
- TinyColor2.prototype.isLight = function() {
5646
- return !this.isDark();
5647
- };
5648
- TinyColor2.prototype.getBrightness = function() {
5649
- var rgb = this.toRgb();
5650
- return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
5651
- };
5652
- TinyColor2.prototype.getLuminance = function() {
5653
- var rgb = this.toRgb();
5654
- var R;
5655
- var G;
5656
- var B;
5657
- var RsRGB = rgb.r / 255;
5658
- var GsRGB = rgb.g / 255;
5659
- var BsRGB = rgb.b / 255;
5660
- if (RsRGB <= 0.03928) {
5661
- R = RsRGB / 12.92;
5662
- } else {
5663
- R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
5664
- }
5665
- if (GsRGB <= 0.03928) {
5666
- G = GsRGB / 12.92;
5667
- } else {
5668
- G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
5669
- }
5670
- if (BsRGB <= 0.03928) {
5671
- B = BsRGB / 12.92;
5672
- } else {
5673
- B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
5674
- }
5675
- return 0.2126 * R + 0.7152 * G + 0.0722 * B;
5676
- };
5677
- TinyColor2.prototype.getAlpha = function() {
5678
- return this.a;
5679
- };
5680
- TinyColor2.prototype.setAlpha = function(alpha) {
5681
- this.a = boundAlpha(alpha);
5682
- this.roundA = Math.round(100 * this.a) / 100;
5683
- return this;
5684
- };
5685
- TinyColor2.prototype.isMonochrome = function() {
5686
- var s = this.toHsl().s;
5687
- return s === 0;
5688
- };
5689
- TinyColor2.prototype.toHsv = function() {
5690
- var hsv = rgbToHsv(this.r, this.g, this.b);
5691
- return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
5692
- };
5693
- TinyColor2.prototype.toHsvString = function() {
5694
- var hsv = rgbToHsv(this.r, this.g, this.b);
5695
- var h = Math.round(hsv.h * 360);
5696
- var s = Math.round(hsv.s * 100);
5697
- var v = Math.round(hsv.v * 100);
5698
- return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
5699
- };
5700
- TinyColor2.prototype.toHsl = function() {
5701
- var hsl = rgbToHsl(this.r, this.g, this.b);
5702
- return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
5703
- };
5704
- TinyColor2.prototype.toHslString = function() {
5705
- var hsl = rgbToHsl(this.r, this.g, this.b);
5706
- var h = Math.round(hsl.h * 360);
5707
- var s = Math.round(hsl.s * 100);
5708
- var l = Math.round(hsl.l * 100);
5709
- return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
5710
- };
5711
- TinyColor2.prototype.toHex = function(allow3Char) {
5712
- if (allow3Char === void 0) {
5713
- allow3Char = false;
5714
- }
5715
- return rgbToHex(this.r, this.g, this.b, allow3Char);
5716
- };
5717
- TinyColor2.prototype.toHexString = function(allow3Char) {
5718
- if (allow3Char === void 0) {
5719
- allow3Char = false;
5720
- }
5721
- return "#" + this.toHex(allow3Char);
5722
- };
5723
- TinyColor2.prototype.toHex8 = function(allow4Char) {
5724
- if (allow4Char === void 0) {
5725
- allow4Char = false;
5726
- }
5727
- return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
5728
- };
5729
- TinyColor2.prototype.toHex8String = function(allow4Char) {
5730
- if (allow4Char === void 0) {
5731
- allow4Char = false;
5732
- }
5733
- return "#" + this.toHex8(allow4Char);
5734
- };
5735
- TinyColor2.prototype.toHexShortString = function(allowShortChar) {
5736
- if (allowShortChar === void 0) {
5737
- allowShortChar = false;
5738
- }
5739
- return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
5740
- };
5741
- TinyColor2.prototype.toRgb = function() {
5742
- return {
5743
- r: Math.round(this.r),
5744
- g: Math.round(this.g),
5745
- b: Math.round(this.b),
5746
- a: this.a
5747
- };
5748
- };
5749
- TinyColor2.prototype.toRgbString = function() {
5750
- var r = Math.round(this.r);
5751
- var g = Math.round(this.g);
5752
- var b = Math.round(this.b);
5753
- return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
5754
- };
5755
- TinyColor2.prototype.toPercentageRgb = function() {
5756
- var fmt = function(x) {
5757
- return "".concat(Math.round(bound01(x, 255) * 100), "%");
5758
- };
5759
- return {
5760
- r: fmt(this.r),
5761
- g: fmt(this.g),
5762
- b: fmt(this.b),
5763
- a: this.a
5764
- };
5765
- };
5766
- TinyColor2.prototype.toPercentageRgbString = function() {
5767
- var rnd = function(x) {
5768
- return Math.round(bound01(x, 255) * 100);
5769
- };
5770
- return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
5771
- };
5772
- TinyColor2.prototype.toName = function() {
5773
- if (this.a === 0) {
5774
- return "transparent";
5775
- }
5776
- if (this.a < 1) {
5777
- return false;
5778
- }
5779
- var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
5780
- for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
5781
- var _b = _a2[_i], key = _b[0], value = _b[1];
5782
- if (hex === value) {
5783
- return key;
5784
- }
5785
- }
5786
- return false;
5787
- };
5788
- TinyColor2.prototype.toString = function(format) {
5789
- var formatSet = Boolean(format);
5790
- format = format !== null && format !== void 0 ? format : this.format;
5791
- var formattedString = false;
5792
- var hasAlpha = this.a < 1 && this.a >= 0;
5793
- var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
5794
- if (needsAlphaFormat) {
5795
- if (format === "name" && this.a === 0) {
5796
- return this.toName();
5797
- }
5798
- return this.toRgbString();
5799
- }
5800
- if (format === "rgb") {
5801
- formattedString = this.toRgbString();
5802
- }
5803
- if (format === "prgb") {
5804
- formattedString = this.toPercentageRgbString();
5805
- }
5806
- if (format === "hex" || format === "hex6") {
5807
- formattedString = this.toHexString();
5808
- }
5809
- if (format === "hex3") {
5810
- formattedString = this.toHexString(true);
5811
- }
5812
- if (format === "hex4") {
5813
- formattedString = this.toHex8String(true);
5814
- }
5815
- if (format === "hex8") {
5816
- formattedString = this.toHex8String();
5817
- }
5818
- if (format === "name") {
5819
- formattedString = this.toName();
5820
- }
5821
- if (format === "hsl") {
5822
- formattedString = this.toHslString();
5823
- }
5824
- if (format === "hsv") {
5825
- formattedString = this.toHsvString();
5826
- }
5827
- return formattedString || this.toHexString();
5828
- };
5829
- TinyColor2.prototype.toNumber = function() {
5830
- return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
5831
- };
5832
- TinyColor2.prototype.clone = function() {
5833
- return new TinyColor2(this.toString());
5834
- };
5835
- TinyColor2.prototype.lighten = function(amount) {
5836
- if (amount === void 0) {
5837
- amount = 10;
5838
- }
5839
- var hsl = this.toHsl();
5840
- hsl.l += amount / 100;
5841
- hsl.l = clamp01(hsl.l);
5842
- return new TinyColor2(hsl);
5843
- };
5844
- TinyColor2.prototype.brighten = function(amount) {
5845
- if (amount === void 0) {
5846
- amount = 10;
5847
- }
5848
- var rgb = this.toRgb();
5849
- rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
5850
- rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
5851
- rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
5852
- return new TinyColor2(rgb);
5853
- };
5854
- TinyColor2.prototype.darken = function(amount) {
5855
- if (amount === void 0) {
5856
- amount = 10;
5857
- }
5858
- var hsl = this.toHsl();
5859
- hsl.l -= amount / 100;
5860
- hsl.l = clamp01(hsl.l);
5861
- return new TinyColor2(hsl);
5862
- };
5863
- TinyColor2.prototype.tint = function(amount) {
5864
- if (amount === void 0) {
5865
- amount = 10;
5866
- }
5867
- return this.mix("white", amount);
5868
- };
5869
- TinyColor2.prototype.shade = function(amount) {
5870
- if (amount === void 0) {
5871
- amount = 10;
5872
- }
5873
- return this.mix("black", amount);
5874
- };
5875
- TinyColor2.prototype.desaturate = function(amount) {
5876
- if (amount === void 0) {
5877
- amount = 10;
5878
- }
5879
- var hsl = this.toHsl();
5880
- hsl.s -= amount / 100;
5881
- hsl.s = clamp01(hsl.s);
5882
- return new TinyColor2(hsl);
5883
- };
5884
- TinyColor2.prototype.saturate = function(amount) {
5885
- if (amount === void 0) {
5886
- amount = 10;
5887
- }
5888
- var hsl = this.toHsl();
5889
- hsl.s += amount / 100;
5890
- hsl.s = clamp01(hsl.s);
5891
- return new TinyColor2(hsl);
5892
- };
5893
- TinyColor2.prototype.greyscale = function() {
5894
- return this.desaturate(100);
5895
- };
5896
- TinyColor2.prototype.spin = function(amount) {
5897
- var hsl = this.toHsl();
5898
- var hue = (hsl.h + amount) % 360;
5899
- hsl.h = hue < 0 ? 360 + hue : hue;
5900
- return new TinyColor2(hsl);
5901
- };
5902
- TinyColor2.prototype.mix = function(color, amount) {
5903
- if (amount === void 0) {
5904
- amount = 50;
5905
- }
5906
- var rgb1 = this.toRgb();
5907
- var rgb2 = new TinyColor2(color).toRgb();
5908
- var p = amount / 100;
5909
- var rgba = {
5910
- r: (rgb2.r - rgb1.r) * p + rgb1.r,
5911
- g: (rgb2.g - rgb1.g) * p + rgb1.g,
5912
- b: (rgb2.b - rgb1.b) * p + rgb1.b,
5913
- a: (rgb2.a - rgb1.a) * p + rgb1.a
5914
- };
5915
- return new TinyColor2(rgba);
5916
- };
5917
- TinyColor2.prototype.analogous = function(results, slices) {
5918
- if (results === void 0) {
5919
- results = 6;
5920
- }
5921
- if (slices === void 0) {
5922
- slices = 30;
5923
- }
5924
- var hsl = this.toHsl();
5925
- var part = 360 / slices;
5926
- var ret = [this];
5927
- for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
5928
- hsl.h = (hsl.h + part) % 360;
5929
- ret.push(new TinyColor2(hsl));
5930
- }
5931
- return ret;
5932
- };
5933
- TinyColor2.prototype.complement = function() {
5934
- var hsl = this.toHsl();
5935
- hsl.h = (hsl.h + 180) % 360;
5936
- return new TinyColor2(hsl);
5937
- };
5938
- TinyColor2.prototype.monochromatic = function(results) {
5939
- if (results === void 0) {
5940
- results = 6;
5941
- }
5942
- var hsv = this.toHsv();
5943
- var h = hsv.h;
5944
- var s = hsv.s;
5945
- var v = hsv.v;
5946
- var res = [];
5947
- var modification = 1 / results;
5948
- while (results--) {
5949
- res.push(new TinyColor2({ h, s, v }));
5950
- v = (v + modification) % 1;
5951
- }
5952
- return res;
5953
- };
5954
- TinyColor2.prototype.splitcomplement = function() {
5955
- var hsl = this.toHsl();
5956
- var h = hsl.h;
5957
- return [
5958
- this,
5959
- new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
5960
- new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
5961
- ];
5962
- };
5963
- TinyColor2.prototype.onBackground = function(background) {
5964
- var fg = this.toRgb();
5965
- var bg = new TinyColor2(background).toRgb();
5966
- var alpha = fg.a + bg.a * (1 - fg.a);
5967
- return new TinyColor2({
5968
- r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
5969
- g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
5970
- b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
5971
- a: alpha
5972
- });
5973
- };
5974
- TinyColor2.prototype.triad = function() {
5975
- return this.polyad(3);
5976
- };
5977
- TinyColor2.prototype.tetrad = function() {
5978
- return this.polyad(4);
5979
- };
5980
- TinyColor2.prototype.polyad = function(n) {
5981
- var hsl = this.toHsl();
5982
- var h = hsl.h;
5983
- var result = [this];
5984
- var increment = 360 / n;
5985
- for (var i = 1; i < n; i++) {
5986
- result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
5987
- }
5988
- return result;
5989
- };
5990
- TinyColor2.prototype.equals = function(color) {
5991
- return this.toRgbString() === new TinyColor2(color).toRgbString();
5992
- };
5993
- return TinyColor2;
5994
- })()
5995
- );
5996
- function darken(color, amount = 20) {
5997
- return color.mix("#141414", amount).toString();
5998
- }
5999
- function useButtonCustomStyle(props) {
6000
- const _disabled = useFormDisabled();
6001
- const ns = useNamespace("button");
6002
- return computed(() => {
6003
- let styles = {};
6004
- let buttonColor = props.color;
6005
- if (buttonColor) {
6006
- const match = buttonColor.match(/var\((.*?)\)/);
6007
- if (match) {
6008
- buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
6009
- }
6010
- const color = new TinyColor(buttonColor);
6011
- const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
6012
- if (props.plain) {
6013
- styles = ns.cssVarBlock({
6014
- "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
6015
- "text-color": buttonColor,
6016
- "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
6017
- "hover-text-color": `var(${ns.cssVarName("color-white")})`,
6018
- "hover-bg-color": buttonColor,
6019
- "hover-border-color": buttonColor,
6020
- "active-bg-color": activeBgColor,
6021
- "active-text-color": `var(${ns.cssVarName("color-white")})`,
6022
- "active-border-color": activeBgColor
6023
- });
6024
- if (_disabled.value) {
6025
- styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
6026
- styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
6027
- styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
6028
- }
6029
- } else {
6030
- const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
6031
- const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
6032
- styles = ns.cssVarBlock({
6033
- "bg-color": buttonColor,
6034
- "text-color": textColor,
6035
- "border-color": buttonColor,
6036
- "hover-bg-color": hoverBgColor,
6037
- "hover-text-color": textColor,
6038
- "hover-border-color": hoverBgColor,
6039
- "active-bg-color": activeBgColor,
6040
- "active-border-color": activeBgColor
6041
- });
6042
- if (_disabled.value) {
6043
- const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
6044
- styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
6045
- styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
6046
- styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
6047
- }
6048
- }
6049
- }
6050
- return styles;
6051
- });
6052
- }
6053
- const __default__$4 = defineComponent({
6054
- name: "ElButton"
6055
- });
6056
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
6057
- ...__default__$4,
6058
- props: buttonProps,
6059
- emits: buttonEmits,
6060
- setup(__props, { expose, emit }) {
6061
- const props = __props;
6062
- const buttonStyle = useButtonCustomStyle(props);
6063
- const ns = useNamespace("button");
6064
- const {
6065
- _ref,
6066
- _size,
6067
- _type,
6068
- _disabled,
6069
- _props,
6070
- _plain,
6071
- _round,
6072
- shouldAddSpace,
6073
- handleClick
6074
- } = useButton(props, emit);
6075
- const buttonKls = computed(() => [
6076
- ns.b(),
6077
- ns.m(_type.value),
6078
- ns.m(_size.value),
6079
- ns.is("disabled", _disabled.value),
6080
- ns.is("loading", props.loading),
6081
- ns.is("plain", _plain.value),
6082
- ns.is("round", _round.value),
6083
- ns.is("circle", props.circle),
6084
- ns.is("text", props.text),
6085
- ns.is("link", props.link),
6086
- ns.is("has-bg", props.bg)
6087
- ]);
6088
- expose({
6089
- ref: _ref,
6090
- size: _size,
6091
- type: _type,
6092
- disabled: _disabled,
6093
- shouldAddSpace
6094
- });
6095
- return (_ctx, _cache) => {
6096
- return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
6097
- ref_key: "_ref",
6098
- ref: _ref
6099
- }, unref(_props), {
6100
- class: unref(buttonKls),
6101
- style: unref(buttonStyle),
6102
- onClick: unref(handleClick)
6103
- }), {
6104
- default: withCtx(() => [
6105
- _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
6106
- _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
6107
- key: 1,
6108
- class: normalizeClass(unref(ns).is("loading"))
6109
- }, {
6110
- default: withCtx(() => [
6111
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
6112
- ]),
6113
- _: 1
6114
- }, 8, ["class"]))
6115
- ], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
6116
- default: withCtx(() => [
6117
- _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
6118
- ]),
6119
- _: 3
6120
- })) : createCommentVNode("v-if", true),
6121
- _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
6122
- key: 2,
6123
- class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
6124
- }, [
6125
- renderSlot(_ctx.$slots, "default")
6126
- ], 2)) : createCommentVNode("v-if", true)
6127
- ]),
6128
- _: 3
6129
- }, 16, ["class", "style", "onClick"]);
6130
- };
6131
- }
6132
- });
6133
- var Button = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "button.vue"]]);
6134
- const buttonGroupProps = {
6135
- size: buttonProps.size,
6136
- type: buttonProps.type
6137
- };
6138
- const __default__$3 = defineComponent({
6139
- name: "ElButtonGroup"
6140
- });
6141
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
6142
- ...__default__$3,
6143
- props: buttonGroupProps,
6144
- setup(__props) {
6145
- const props = __props;
6146
- provide(buttonGroupContextKey, reactive({
6147
- size: toRef(props, "size"),
6148
- type: toRef(props, "type")
6149
- }));
6150
- const ns = useNamespace("button");
6151
- return (_ctx, _cache) => {
6152
- return openBlock(), createElementBlock("div", {
6153
- class: normalizeClass(unref(ns).b("group"))
6154
- }, [
6155
- renderSlot(_ctx.$slots, "default")
6156
- ], 2);
6157
- };
6158
- }
6159
- });
6160
- var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "button-group.vue"]]);
6161
- const ElButton = withInstall(Button, {
6162
- ButtonGroup
6163
- });
6164
- withNoopInstall(ButtonGroup);
6165
- const checkboxProps = {
6166
- modelValue: {
6167
- type: [Number, String, Boolean],
6168
- default: void 0
6169
- },
6170
- label: {
6171
- type: [String, Boolean, Number, Object],
6172
- default: void 0
6173
- },
6174
- value: {
6175
- type: [String, Boolean, Number, Object],
6176
- default: void 0
6177
- },
6178
- indeterminate: Boolean,
6179
- disabled: Boolean,
6180
- checked: Boolean,
6181
- name: {
6182
- type: String,
6183
- default: void 0
6184
- },
6185
- trueValue: {
6186
- type: [String, Number],
6187
- default: void 0
6188
- },
6189
- falseValue: {
6190
- type: [String, Number],
6191
- default: void 0
6192
- },
6193
- trueLabel: {
6194
- type: [String, Number],
6195
- default: void 0
6196
- },
6197
- falseLabel: {
6198
- type: [String, Number],
6199
- default: void 0
6200
- },
6201
- id: {
6202
- type: String,
6203
- default: void 0
6204
- },
6205
- border: Boolean,
6206
- size: useSizeProp,
6207
- tabindex: [String, Number],
6208
- validateEvent: {
6209
- type: Boolean,
6210
- default: true
6211
- },
6212
- ...useAriaProps(["ariaControls"])
6213
- };
6214
- const checkboxEmits = {
6215
- [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
6216
- change: (val) => isString(val) || isNumber(val) || isBoolean(val)
6217
- };
6218
- const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
6219
- const useCheckboxDisabled = ({
6220
- model,
6221
- isChecked
6222
- }) => {
6223
- const checkboxGroup = inject(checkboxGroupContextKey, void 0);
6224
- const isLimitDisabled = computed(() => {
6225
- var _a2, _b;
6226
- const max = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a2.value;
6227
- const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
6228
- return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
6229
- });
6230
- const isDisabled = useFormDisabled(computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
6231
- return {
6232
- isDisabled,
6233
- isLimitDisabled
6234
- };
6235
- };
6236
- const useCheckboxEvent = (props, {
6237
- model,
6238
- isLimitExceeded,
6239
- hasOwnLabel,
6240
- isDisabled,
6241
- isLabeledByFormItem
6242
- }) => {
6243
- const checkboxGroup = inject(checkboxGroupContextKey, void 0);
6244
- const { formItem } = useFormItem();
6245
- const { emit } = getCurrentInstance();
6246
- function getLabeledValue(value) {
6247
- var _a2, _b, _c, _d;
6248
- return [true, props.trueValue, props.trueLabel].includes(value) ? (_b = (_a2 = props.trueValue) != null ? _a2 : props.trueLabel) != null ? _b : true : (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false;
6249
- }
6250
- function emitChangeEvent(checked, e) {
6251
- emit(CHANGE_EVENT, getLabeledValue(checked), e);
6252
- }
6253
- function handleChange(e) {
6254
- if (isLimitExceeded.value)
6255
- return;
6256
- const target = e.target;
6257
- emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
6258
- }
6259
- async function onClickRoot(e) {
6260
- if (isLimitExceeded.value)
6261
- return;
6262
- if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
6263
- const eventTargets = e.composedPath();
6264
- const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
6265
- if (!hasLabel) {
6266
- model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
6267
- await nextTick();
6268
- emitChangeEvent(model.value, e);
6269
- }
6270
- }
6271
- }
6272
- const validateEvent = computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
6273
- watch(() => props.modelValue, () => {
6274
- if (validateEvent.value) {
6275
- formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
6276
- }
6277
- });
6278
- return {
6279
- handleChange,
6280
- onClickRoot
6281
- };
6282
- };
6283
- const useCheckboxModel = (props) => {
6284
- const selfModel = ref(false);
6285
- const { emit } = getCurrentInstance();
6286
- const checkboxGroup = inject(checkboxGroupContextKey, void 0);
6287
- const isGroup = computed(() => isUndefined(checkboxGroup) === false);
6288
- const isLimitExceeded = ref(false);
6289
- const model = computed({
6290
- get() {
6291
- var _a2, _b;
6292
- return isGroup.value ? (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a2.value : (_b = props.modelValue) != null ? _b : selfModel.value;
6293
- },
6294
- set(val) {
6295
- var _a2, _b;
6296
- if (isGroup.value && isArray$1(val)) {
6297
- isLimitExceeded.value = ((_a2 = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a2.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value) && val.length > model.value.length;
6298
- isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
6299
- } else {
6300
- emit(UPDATE_MODEL_EVENT, val);
6301
- selfModel.value = val;
6302
- }
6303
- }
6304
- });
6305
- return {
6306
- model,
6307
- isGroup,
6308
- isLimitExceeded
6309
- };
6310
- };
6311
- const useCheckboxStatus = (props, slots, { model }) => {
6312
- const checkboxGroup = inject(checkboxGroupContextKey, void 0);
6313
- const isFocused = ref(false);
6314
- const actualValue = computed(() => {
6315
- if (!isPropAbsent(props.value)) {
6316
- return props.value;
6317
- }
6318
- return props.label;
6319
- });
6320
- const isChecked = computed(() => {
6321
- const value = model.value;
6322
- if (isBoolean(value)) {
6323
- return value;
6324
- } else if (isArray$1(value)) {
6325
- if (isObject$1(actualValue.value)) {
6326
- return value.map(toRaw).some((o) => isEqual(o, actualValue.value));
6327
- } else {
6328
- return value.map(toRaw).includes(actualValue.value);
6329
- }
6330
- } else if (value !== null && value !== void 0) {
6331
- return value === props.trueValue || value === props.trueLabel;
6332
- } else {
6333
- return !!value;
6334
- }
6335
- });
6336
- const checkboxButtonSize = useFormSize(computed(() => {
6337
- var _a2;
6338
- return (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a2.value;
6339
- }), {
6340
- prop: true
6341
- });
6342
- const checkboxSize = useFormSize(computed(() => {
6343
- var _a2;
6344
- return (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a2.value;
6345
- }));
6346
- const hasOwnLabel = computed(() => {
6347
- return !!slots.default || !isPropAbsent(actualValue.value);
6348
- });
6349
- return {
6350
- checkboxButtonSize,
6351
- isChecked,
6352
- isFocused,
6353
- checkboxSize,
6354
- hasOwnLabel,
6355
- actualValue
6356
- };
6357
- };
6358
- const useCheckbox = (props, slots) => {
6359
- const { formItem: elFormItem } = useFormItem();
6360
- const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
6361
- const {
6362
- isFocused,
6363
- isChecked,
6364
- checkboxButtonSize,
6365
- checkboxSize,
6366
- hasOwnLabel,
6367
- actualValue
6368
- } = useCheckboxStatus(props, slots, { model });
6369
- const { isDisabled } = useCheckboxDisabled({ model, isChecked });
6370
- const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
6371
- formItemContext: elFormItem,
6372
- disableIdGeneration: hasOwnLabel,
6373
- disableIdManagement: isGroup
6374
- });
6375
- const { handleChange, onClickRoot } = useCheckboxEvent(props, {
6376
- model,
6377
- isLimitExceeded,
6378
- hasOwnLabel,
6379
- isDisabled,
6380
- isLabeledByFormItem
6381
- });
6382
- const setStoreValue = () => {
6383
- function addToStore() {
6384
- var _a2, _b;
6385
- if (isArray$1(model.value) && !model.value.includes(actualValue.value)) {
6386
- model.value.push(actualValue.value);
6387
- } else {
6388
- model.value = (_b = (_a2 = props.trueValue) != null ? _a2 : props.trueLabel) != null ? _b : true;
6389
- }
6390
- }
6391
- props.checked && addToStore();
6392
- };
6393
- setStoreValue();
6394
- useDeprecated({
6395
- from: "label act as value",
6396
- replacement: "value",
6397
- version: "3.0.0",
6398
- scope: "el-checkbox",
6399
- ref: "https://element-plus.org/en-US/component/checkbox.html"
6400
- }, computed(() => isGroup.value && isPropAbsent(props.value)));
6401
- useDeprecated({
6402
- from: "true-label",
6403
- replacement: "true-value",
6404
- version: "3.0.0",
6405
- scope: "el-checkbox",
6406
- ref: "https://element-plus.org/en-US/component/checkbox.html"
6407
- }, computed(() => !!props.trueLabel));
6408
- useDeprecated({
6409
- from: "false-label",
6410
- replacement: "false-value",
6411
- version: "3.0.0",
6412
- scope: "el-checkbox",
6413
- ref: "https://element-plus.org/en-US/component/checkbox.html"
6414
- }, computed(() => !!props.falseLabel));
6415
- return {
6416
- inputId,
6417
- isLabeledByFormItem,
6418
- isChecked,
6419
- isDisabled,
6420
- isFocused,
6421
- checkboxButtonSize,
6422
- checkboxSize,
6423
- hasOwnLabel,
6424
- model,
6425
- actualValue,
6426
- handleChange,
6427
- onClickRoot
6428
- };
6429
- };
6430
- const __default__$2 = defineComponent({
6431
- name: "ElCheckbox"
6432
- });
6433
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
6434
- ...__default__$2,
6435
- props: checkboxProps,
6436
- emits: checkboxEmits,
6437
- setup(__props) {
6438
- const props = __props;
6439
- const slots = useSlots();
6440
- const {
6441
- inputId,
6442
- isLabeledByFormItem,
6443
- isChecked,
6444
- isDisabled,
6445
- isFocused,
6446
- checkboxSize,
6447
- hasOwnLabel,
6448
- model,
6449
- actualValue,
6450
- handleChange,
6451
- onClickRoot
6452
- } = useCheckbox(props, slots);
6453
- const ns = useNamespace("checkbox");
6454
- const compKls = computed(() => {
6455
- return [
6456
- ns.b(),
6457
- ns.m(checkboxSize.value),
6458
- ns.is("disabled", isDisabled.value),
6459
- ns.is("bordered", props.border),
6460
- ns.is("checked", isChecked.value)
6461
- ];
6462
- });
6463
- const spanKls = computed(() => {
6464
- return [
6465
- ns.e("input"),
6466
- ns.is("disabled", isDisabled.value),
6467
- ns.is("checked", isChecked.value),
6468
- ns.is("indeterminate", props.indeterminate),
6469
- ns.is("focus", isFocused.value)
6470
- ];
6471
- });
6472
- return (_ctx, _cache) => {
6473
- return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
6474
- class: normalizeClass(unref(compKls)),
6475
- "aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
6476
- onClick: unref(onClickRoot)
6477
- }, {
6478
- default: withCtx(() => {
6479
- var _a2, _b, _c, _d;
6480
- return [
6481
- createElementVNode("span", {
6482
- class: normalizeClass(unref(spanKls))
6483
- }, [
6484
- _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
6485
- key: 0,
6486
- id: unref(inputId),
6487
- "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
6488
- class: normalizeClass(unref(ns).e("original")),
6489
- type: "checkbox",
6490
- indeterminate: _ctx.indeterminate,
6491
- name: _ctx.name,
6492
- tabindex: _ctx.tabindex,
6493
- disabled: unref(isDisabled),
6494
- "true-value": (_b = (_a2 = _ctx.trueValue) != null ? _a2 : _ctx.trueLabel) != null ? _b : true,
6495
- "false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
6496
- onChange: unref(handleChange),
6497
- onFocus: ($event) => isFocused.value = true,
6498
- onBlur: ($event) => isFocused.value = false,
6499
- onClick: withModifiers(() => {
6500
- }, ["stop"])
6501
- }, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
6502
- [vModelCheckbox, unref(model)]
6503
- ]) : withDirectives((openBlock(), createElementBlock("input", {
6504
- key: 1,
6505
- id: unref(inputId),
6506
- "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
6507
- class: normalizeClass(unref(ns).e("original")),
6508
- type: "checkbox",
6509
- indeterminate: _ctx.indeterminate,
6510
- disabled: unref(isDisabled),
6511
- value: unref(actualValue),
6512
- name: _ctx.name,
6513
- tabindex: _ctx.tabindex,
6514
- onChange: unref(handleChange),
6515
- onFocus: ($event) => isFocused.value = true,
6516
- onBlur: ($event) => isFocused.value = false,
6517
- onClick: withModifiers(() => {
6518
- }, ["stop"])
6519
- }, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "disabled", "value", "name", "tabindex", "onChange", "onFocus", "onBlur", "onClick"])), [
6520
- [vModelCheckbox, unref(model)]
6521
- ]),
6522
- createElementVNode("span", {
6523
- class: normalizeClass(unref(ns).e("inner"))
6524
- }, null, 2)
6525
- ], 2),
6526
- unref(hasOwnLabel) ? (openBlock(), createElementBlock("span", {
6527
- key: 0,
6528
- class: normalizeClass(unref(ns).e("label"))
6529
- }, [
6530
- renderSlot(_ctx.$slots, "default"),
6531
- !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
6532
- createTextVNode(toDisplayString(_ctx.label), 1)
6533
- ], 64)) : createCommentVNode("v-if", true)
6534
- ], 2)) : createCommentVNode("v-if", true)
6535
- ];
6536
- }),
6537
- _: 3
6538
- }, 8, ["class", "aria-controls", "onClick"]);
6539
- };
3450
+ const z = (-vector.z * 0.5 + 0.5) * this.renderer.domElement.clientHeight;
3451
+ return new THREE.Vector2(x, z);
6540
3452
  }
6541
- });
6542
- var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "checkbox.vue"]]);
6543
- const __default__$1 = defineComponent({
6544
- name: "ElCheckboxButton"
6545
- });
6546
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
6547
- ...__default__$1,
6548
- props: checkboxProps,
6549
- emits: checkboxEmits,
6550
- setup(__props) {
6551
- const props = __props;
6552
- const slots = useSlots();
6553
- const {
6554
- isFocused,
6555
- isChecked,
6556
- isDisabled,
6557
- checkboxButtonSize,
6558
- model,
6559
- actualValue,
6560
- handleChange
6561
- } = useCheckbox(props, slots);
6562
- const checkboxGroup = inject(checkboxGroupContextKey, void 0);
6563
- const ns = useNamespace("checkbox");
6564
- const activeStyle = computed(() => {
6565
- var _a2, _b, _c, _d;
6566
- const fillValue = (_b = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a2.value) != null ? _b : "";
6567
- return {
6568
- backgroundColor: fillValue,
6569
- borderColor: fillValue,
6570
- color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
6571
- boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
6572
- };
3453
+ cameraPositionRecord = [];
3454
+ /**
3455
+ * 相机
3456
+ * @param position
3457
+ * @param lookAt
3458
+ * @param onEnd
3459
+ */
3460
+ cameraTo(position, lookAt, onEnd) {
3461
+ this.cameraPositionRecord.push([
3462
+ this.camera.position.clone(),
3463
+ this.camera.quaternion.clone()
3464
+ ]);
3465
+ const tween = new TWEEN.Tween(this.camera.position);
3466
+ tween.to(position, 600);
3467
+ tween.start();
3468
+ tween.onUpdate(() => {
3469
+ this.camera.lookAt(lookAt);
6573
3470
  });
6574
- const labelKls = computed(() => {
6575
- return [
6576
- ns.b("button"),
6577
- ns.bm("button", checkboxButtonSize.value),
6578
- ns.is("disabled", isDisabled.value),
6579
- ns.is("checked", isChecked.value),
6580
- ns.is("focus", isFocused.value)
6581
- ];
3471
+ tween.onComplete(() => {
3472
+ const i = this.tweenTaskList.indexOf(tween);
3473
+ this.tweenTaskList.splice(i, 1);
3474
+ onEnd && onEnd();
6582
3475
  });
6583
- return (_ctx, _cache) => {
6584
- var _a2, _b, _c, _d;
6585
- return openBlock(), createElementBlock("label", {
6586
- class: normalizeClass(unref(labelKls))
6587
- }, [
6588
- _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
6589
- key: 0,
6590
- "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
6591
- class: normalizeClass(unref(ns).be("button", "original")),
6592
- type: "checkbox",
6593
- name: _ctx.name,
6594
- tabindex: _ctx.tabindex,
6595
- disabled: unref(isDisabled),
6596
- "true-value": (_b = (_a2 = _ctx.trueValue) != null ? _a2 : _ctx.trueLabel) != null ? _b : true,
6597
- "false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
6598
- onChange: unref(handleChange),
6599
- onFocus: ($event) => isFocused.value = true,
6600
- onBlur: ($event) => isFocused.value = false,
6601
- onClick: withModifiers(() => {
6602
- }, ["stop"])
6603
- }, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
6604
- [vModelCheckbox, unref(model)]
6605
- ]) : withDirectives((openBlock(), createElementBlock("input", {
6606
- key: 1,
6607
- "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
6608
- class: normalizeClass(unref(ns).be("button", "original")),
6609
- type: "checkbox",
6610
- name: _ctx.name,
6611
- tabindex: _ctx.tabindex,
6612
- disabled: unref(isDisabled),
6613
- value: unref(actualValue),
6614
- onChange: unref(handleChange),
6615
- onFocus: ($event) => isFocused.value = true,
6616
- onBlur: ($event) => isFocused.value = false,
6617
- onClick: withModifiers(() => {
6618
- }, ["stop"])
6619
- }, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "value", "onChange", "onFocus", "onBlur", "onClick"])), [
6620
- [vModelCheckbox, unref(model)]
6621
- ]),
6622
- _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
6623
- key: 2,
6624
- class: normalizeClass(unref(ns).be("button", "inner")),
6625
- style: normalizeStyle(unref(isChecked) ? unref(activeStyle) : void 0)
6626
- }, [
6627
- renderSlot(_ctx.$slots, "default", {}, () => [
6628
- createTextVNode(toDisplayString(_ctx.label), 1)
6629
- ])
6630
- ], 6)) : createCommentVNode("v-if", true)
6631
- ], 2);
6632
- };
3476
+ this.tweenTaskList.push(tween);
6633
3477
  }
6634
- });
6635
- var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "checkbox-button.vue"]]);
6636
- const checkboxGroupProps = buildProps({
6637
- modelValue: {
6638
- type: definePropType(Array),
6639
- default: () => []
6640
- },
6641
- disabled: Boolean,
6642
- min: Number,
6643
- max: Number,
6644
- size: useSizeProp,
6645
- fill: String,
6646
- textColor: String,
6647
- tag: {
6648
- type: String,
6649
- default: "div"
6650
- },
6651
- validateEvent: {
6652
- type: Boolean,
6653
- default: true
6654
- },
6655
- ...useAriaProps(["ariaLabel"])
6656
- });
6657
- const checkboxGroupEmits = {
6658
- [UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
6659
- change: (val) => isArray$1(val)
6660
- };
6661
- const __default__ = defineComponent({
6662
- name: "ElCheckboxGroup"
6663
- });
6664
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
6665
- ...__default__,
6666
- props: checkboxGroupProps,
6667
- emits: checkboxGroupEmits,
6668
- setup(__props, { emit }) {
6669
- const props = __props;
6670
- const ns = useNamespace("checkbox");
6671
- const { formItem } = useFormItem();
6672
- const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
6673
- formItemContext: formItem
6674
- });
6675
- const changeEvent = async (value) => {
6676
- emit(UPDATE_MODEL_EVENT, value);
6677
- await nextTick();
6678
- emit(CHANGE_EVENT, value);
6679
- };
6680
- const modelValue = computed({
6681
- get() {
6682
- return props.modelValue;
6683
- },
6684
- set(val) {
6685
- changeEvent(val);
6686
- }
6687
- });
6688
- provide(checkboxGroupContextKey, {
6689
- ...pick(toRefs(props), [
6690
- "size",
6691
- "min",
6692
- "max",
6693
- "disabled",
6694
- "validateEvent",
6695
- "fill",
6696
- "textColor"
6697
- ]),
6698
- modelValue,
6699
- changeEvent
6700
- });
6701
- watch(() => props.modelValue, (newVal, oldValue) => {
6702
- if (props.validateEvent && !isEqual(newVal, oldValue)) {
6703
- formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
6704
- }
3478
+ cameraBack() {
3479
+ if (this.cameraPositionRecord.length) {
3480
+ const [pos, quat] = this.cameraPositionRecord.pop();
3481
+ this.camera.position.copy(pos);
3482
+ this.camera.quaternion.copy(quat);
3483
+ }
3484
+ }
3485
+ /**
3486
+ * 创建点
3487
+ * @param pos
3488
+ */
3489
+ createPointMesh(pos, size = 0.02, parameters, parent = this.container) {
3490
+ const box = new THREE.Mesh(
3491
+ new THREE.SphereGeometry(size),
3492
+ new THREE.MeshBasicMaterial(parameters)
3493
+ );
3494
+ if (pos instanceof Point) box.position.set(pos.x, pos.y, 0);
3495
+ else if (pos instanceof THREE.Vector3) box.position.copy(pos);
3496
+ parent.add(box);
3497
+ return box;
3498
+ }
3499
+ /**
3500
+ * 创建文本
3501
+ * @param text
3502
+ * @param pos
3503
+ * @param style
3504
+ */
3505
+ createText(text, pos, style, parent = this.container) {
3506
+ const div = document.createElement("div");
3507
+ div.innerHTML = text;
3508
+ div.style.pointerEvents = "none";
3509
+ Object.assign(div.style, { fontSize: "10px", color: "#ffffff", ...style });
3510
+ const css2DObject = new Renderer.CSS2DObject(div);
3511
+ if (pos instanceof Point) css2DObject.position.set(pos.x, pos.y, 0);
3512
+ else if (pos instanceof THREE.Vector3) css2DObject.position.copy(pos);
3513
+ parent.add(css2DObject);
3514
+ return css2DObject;
3515
+ }
3516
+ /**
3517
+ * 创建几何缓冲区
3518
+ * @param map
3519
+ * @param count
3520
+ */
3521
+ createLineSegments(map, count, parameters, parent = this.container) {
3522
+ const geometry = new THREE.BufferGeometry();
3523
+ Object.keys(map).forEach((key) => {
3524
+ const value = map[key];
3525
+ geometry.setAttribute(key, new THREE.BufferAttribute(new Float32Array(value), value.length / count));
6705
3526
  });
6706
- return (_ctx, _cache) => {
6707
- var _a2;
6708
- return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
6709
- id: unref(groupId),
6710
- class: normalizeClass(unref(ns).b("group")),
6711
- role: "group",
6712
- "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
6713
- "aria-labelledby": unref(isLabeledByFormItem) ? (_a2 = unref(formItem)) == null ? void 0 : _a2.labelId : void 0
6714
- }, {
6715
- default: withCtx(() => [
6716
- renderSlot(_ctx.$slots, "default")
6717
- ]),
6718
- _: 3
6719
- }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
6720
- };
3527
+ const lineSegmentList = new THREE.LineSegments(geometry, new THREE.LineBasicMaterial({ ...parameters }));
3528
+ parent.add(lineSegmentList);
3529
+ return lineSegmentList;
6721
3530
  }
6722
- });
6723
- var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "checkbox-group.vue"]]);
6724
- const ElCheckbox = withInstall(Checkbox, {
6725
- CheckboxButton,
6726
- CheckboxGroup
6727
- });
6728
- withNoopInstall(CheckboxButton);
6729
- withNoopInstall(CheckboxGroup);
3531
+ destroy() {
3532
+ if (this.resizeObserver) {
3533
+ this.renderer.dispose();
3534
+ this.resizeObserver.disconnect();
3535
+ this.resizeObserver = void 0;
3536
+ }
3537
+ }
3538
+ }
3539
+ function drawLinePathToPng(points, width, height, color = "#fff", lineWidth = 2) {
3540
+ const can = document.createElement("canvas"), ctx = can.getContext("2d");
3541
+ can.width = width;
3542
+ can.height = height;
3543
+ ctx?.clearRect(0, 0, width, height);
3544
+ ctx?.save();
3545
+ ctx.strokeStyle = color;
3546
+ ctx.lineWidth = lineWidth;
3547
+ ctx?.beginPath();
3548
+ points.forEach((p, i) => {
3549
+ if (i === 0) ctx?.moveTo(p[0], p[1]);
3550
+ else ctx?.lineTo(p[0], p[1]);
3551
+ });
3552
+ ctx?.stroke();
3553
+ ctx?.restore();
3554
+ return can.toDataURL("image/png", 1);
3555
+ }
6730
3556
  const _hoisted_1$1 = { class: "bg-white rounded-lg p-[10px] w-[200px] text-[14px]" };
6731
3557
  const _hoisted_2$1 = { class: "flex" };
6732
- const _hoisted_3 = { class: "flee-1 text-[14px] leading-[1.4em]" };
6733
- const _hoisted_4 = { class: "mt-[10px] ml-[1.4em]" };
3558
+ const _hoisted_3$1 = { class: "flee-1 text-[14px] leading-[1.4em]" };
3559
+ const _hoisted_4$1 = { class: "mt-[10px] ml-[1.4em]" };
6734
3560
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
6735
3561
  __name: "Card",
6736
3562
  props: {
@@ -6745,9 +3571,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
6745
3571
  _cache[1] || (_cache[1] = createElementVNode("div", { class: "size-[1.4em] flex justify-center items-center" }, [
6746
3572
  createElementVNode("div", { class: "size-[6px] bg-[var(--el-color-primary)] rounded-[50px]" })
6747
3573
  ], -1)),
6748
- createElementVNode("p", _hoisted_3, toDisplayString(_ctx.message), 1)
3574
+ createElementVNode("p", _hoisted_3$1, toDisplayString(_ctx.message), 1)
6749
3575
  ]),
6750
- createElementVNode("div", _hoisted_4, [
3576
+ createElementVNode("div", _hoisted_4$1, [
6751
3577
  createVNode(unref(ElButton), {
6752
3578
  onClick: _cache[0] || (_cache[0] = () => emits("look")),
6753
3579
  type: "primary",
@@ -6764,46 +3590,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
6764
3590
  };
6765
3591
  }
6766
3592
  });
6767
- class Lines extends THREE.LineSegments {
6768
- geometry = new THREE.BufferGeometry();
6769
- points = [];
6770
- pointsObject3D;
6771
- constructor(points = [], color = 16777215) {
6772
- super();
6773
- this.geometry = this.geometry;
6774
- this.addPoint(...points);
6775
- this.frustumCulled = false;
6776
- this.pointsObject3D = new THREE.Points(this.geometry, new THREE.PointsMaterial({
6777
- sizeAttenuation: false,
6778
- size: 10
6779
- }));
6780
- this.material = new THREE.LineBasicMaterial({ color });
6781
- }
6782
- addPoint(...points) {
6783
- this.points.push(...points);
6784
- this.updateGeometry();
6785
- }
6786
- setPoint(...points) {
6787
- this.points.length = 0;
6788
- this.addPoint(...points);
6789
- }
6790
- _timer = null;
6791
- updateGeometry() {
6792
- if (this._timer) clearTimeout(this._timer);
6793
- this._timer = setTimeout(() => {
6794
- const array = this.points.flatMap((p, i) => {
6795
- if (i === 0) return [];
6796
- else {
6797
- const p0 = this.points[i - 1];
6798
- return [p0.x, p0.y, p0.z, p.x, p.y, p.z];
6799
- }
6800
- });
6801
- const position = new THREE.BufferAttribute(new Float32Array(array), 3);
6802
- this.geometry.setAttribute("position", position);
6803
- this._timer = null;
6804
- }, 100);
6805
- }
6806
- }
6807
3593
  const DES_POINT_DEFAULT_COLOR = "radial-gradient(circle at center, rgba(0,0,0, 1), transparent, rgba(0,0,0, 1))", DES_POINT_LINE_COLOR = "#409eff", DES_POINT_ACTIVE_COLOR = `radial-gradient(circle at center, ${DES_POINT_LINE_COLOR}, transparent, ${DES_POINT_LINE_COLOR})`;
6808
3594
  class DetailsPointRender extends Component {
6809
3595
  static name = "DetailsPointRender";
@@ -7008,14 +3794,25 @@ class DomContainer extends Component {
7008
3794
  domElement = document.createElement("div");
7009
3795
  canvas = document.createElement("canvas");
7010
3796
  html2DRenderer = document.createElement("div");
3797
+ html3DRenderer = document.createElement("div");
7011
3798
  constructor() {
7012
3799
  super();
7013
3800
  this.domElement.appendChild(this.canvas);
3801
+ this.domElement.appendChild(this.html3DRenderer);
7014
3802
  this.domElement.appendChild(this.html2DRenderer);
7015
3803
  Object.assign(this.domElement.style, {
7016
3804
  width: "100%",
7017
3805
  height: "100%",
7018
- position: "relative"
3806
+ position: "relative",
3807
+ userSelect: "none"
3808
+ });
3809
+ Object.assign(this.html3DRenderer.style, {
3810
+ position: "absolute",
3811
+ left: 0,
3812
+ top: 0,
3813
+ zIndex: 9,
3814
+ width: "100%",
3815
+ height: "100%"
7019
3816
  });
7020
3817
  Object.assign(this.html2DRenderer.style, {
7021
3818
  position: "absolute",
@@ -7063,19 +3860,6 @@ class OriginalLineRender extends Component {
7063
3860
  const array = lineAnalysis.appendLineSegmentList.flatMap((line) => line.points.flatMap((p) => [p.x, p.y, dxf.originalZAverage]));
7064
3861
  this.appendLineMode.geometry = new THREE.BufferGeometry().setAttribute("position", new THREE.BufferAttribute(new Float32Array(array), 3, true));
7065
3862
  this.appendLineMode.material = new THREE.LineBasicMaterial({ color: 16711935 });
7066
- const list = [];
7067
- lineAnalysis.pointVirtualGrid.map.forEach((set, k) => {
7068
- const { x, y } = lineAnalysis.pointVirtualGrid.decodeGridId(k), xSize = (x - 1) * lineAnalysis.pointVirtualGrid.gridSize, ySize = (y - 1) * lineAnalysis.pointVirtualGrid.gridSize;
7069
- const box2 = new Box2(
7070
- xSize,
7071
- xSize + lineAnalysis.pointVirtualGrid.gridSize,
7072
- ySize,
7073
- ySize + lineAnalysis.pointVirtualGrid.gridSize
7074
- );
7075
- list.push(...box2.getPaths3D(dxf.originalZAverage));
7076
- this.Renderer?.createText(`${k}(${set.size})`, box2.center, {}, this.pointGroup);
7077
- });
7078
- this.Renderer?.createLineSegments({ position: list }, list.length / 3, { color: 16776960 }, this.pointGroup);
7079
3863
  });
7080
3864
  variable?.addEventListener("originalLineVisible", (e) => {
7081
3865
  this.originalLineMode.visible = e.value;
@@ -7168,23 +3952,75 @@ class ModelDataRender extends Component {
7168
3952
  }
7169
3953
  class DomEventRegister extends Component {
7170
3954
  static name = "DomEventRegister";
3955
+ cancelDefaultBehaviorList = [];
3956
+ pointer = new Vector2();
7171
3957
  /**
7172
3958
  *
7173
3959
  * @param parent
7174
3960
  */
7175
3961
  onAddFromParent(parent) {
7176
- const renderer = parent.findComponentByType(Renderer);
3962
+ const domContainer = parent.findComponentByType(DomContainer);
7177
3963
  const variable = parent.findComponentByType(Variable);
7178
- const domElement = renderer.html2DRenderer?.domElement;
3964
+ const domElement = domContainer.domElement;
7179
3965
  domElement.tabIndex = 1;
7180
3966
  domElement.addEventListener("keyup", (e) => {
7181
3967
  const key = e.key.toLocaleLowerCase();
7182
3968
  variable.set("currentKeyUp", key);
3969
+ for (let i = 0; i < this.cancelDefaultBehaviorList.length; i++) {
3970
+ const element = this.cancelDefaultBehaviorList[i];
3971
+ if (element(e)) e.preventDefault();
3972
+ }
3973
+ });
3974
+ domElement.addEventListener("keydown", (e) => {
3975
+ const key = e.key.toLocaleLowerCase();
3976
+ variable.set("currentKeyDown", key);
3977
+ for (let i = 0; i < this.cancelDefaultBehaviorList.length; i++) {
3978
+ const element = this.cancelDefaultBehaviorList[i];
3979
+ if (element(e)) e.preventDefault();
3980
+ }
3981
+ });
3982
+ domElement.addEventListener("mousedown", (e) => {
3983
+ variable.set("currentMouseDown", "mouse_" + e.button);
3984
+ });
3985
+ domElement.addEventListener("mouseup", (e) => {
3986
+ variable.set("currentMouseUp", "mouse_" + e.button);
7183
3987
  });
7184
3988
  domElement.addEventListener("wheel", (e) => {
7185
3989
  variable.set("currentWheel", e.wheelDelta);
7186
3990
  });
3991
+ domElement.addEventListener("focus", () => {
3992
+ variable.set("focus", true);
3993
+ });
3994
+ domElement.addEventListener("blur", () => {
3995
+ variable.set("focus", false);
3996
+ });
7187
3997
  this.dragMoveHelper(domElement, (_0, x, y) => variable.set("pointerMove", { x, y }), { x: 0, y: 0 });
3998
+ domElement.addEventListener("mousemove", (e) => {
3999
+ this.pointer.set(e.offsetX, e.offsetY);
4000
+ this.dispatchEvent({
4001
+ type: "mousemove",
4002
+ x: e.offsetX,
4003
+ y: e.offsetY,
4004
+ moveX: e.movementX,
4005
+ moveY: e.movementY
4006
+ });
4007
+ });
4008
+ domElement.addEventListener("mousedown", (e) => {
4009
+ this.pointer.set(e.offsetX, e.offsetY);
4010
+ this.dispatchEvent({
4011
+ type: "mousedown",
4012
+ x: e.offsetX,
4013
+ y: e.offsetY
4014
+ });
4015
+ });
4016
+ }
4017
+ /**
4018
+ *
4019
+ * @param callBack
4020
+ */
4021
+ addCancelDefaultBehavior(callBack) {
4022
+ this.cancelDefaultBehaviorList.push(callBack);
4023
+ return this;
7188
4024
  }
7189
4025
  /**
7190
4026
  *
@@ -7204,70 +4040,156 @@ class DomEventRegister extends Component {
7204
4040
  const end = () => {
7205
4041
  document.removeEventListener("mousemove", move);
7206
4042
  document.removeEventListener("mouseup", end);
7207
- el.style.cursor = "default";
7208
4043
  };
7209
4044
  document.addEventListener("mousemove", move);
7210
4045
  document.addEventListener("mouseup", end);
7211
- el.style.cursor = "grabbing";
7212
4046
  });
7213
4047
  callBack({ ...offset }, 0, 0);
7214
4048
  }
7215
4049
  }
4050
+ class EventInput extends Component {
4051
+ static name = "EventInput";
4052
+ keyList = /* @__PURE__ */ new Set();
4053
+ mouseList = /* @__PURE__ */ new Set();
4054
+ keyCombinationMap = /* @__PURE__ */ new Map();
4055
+ currentKeyCombinationMap = /* @__PURE__ */ new Map();
4056
+ get codeCount() {
4057
+ return this.keyList.size + this.mouseList.size;
4058
+ }
4059
+ /**
4060
+ *
4061
+ * @param parent
4062
+ */
4063
+ onAddFromParent(parent) {
4064
+ const variable = parent.findComponentByType(Variable);
4065
+ variable.addEventListener("currentMouseDown", (e) => {
4066
+ if (this.mouseList.has(e.value)) return;
4067
+ this.mouseList.add(e.value);
4068
+ this.dispatchEvent({ type: "codeChange", code: e.value, mode: "down" });
4069
+ });
4070
+ variable.addEventListener("currentMouseUp", (e) => {
4071
+ this.mouseList.delete(e.value);
4072
+ this.dispatchEvent({ type: "codeChange", code: e.value, mode: "up" });
4073
+ });
4074
+ variable.addEventListener("currentKeyDown", (e) => {
4075
+ if (this.keyList.has(e.value)) return;
4076
+ this.keyList.add(e.value);
4077
+ this.dispatchEvent({ type: "codeChange", code: e.value, mode: "down" });
4078
+ });
4079
+ variable.addEventListener("currentKeyUp", (e) => {
4080
+ this.keyList.delete(e.value);
4081
+ this.dispatchEvent({ type: "codeChange", code: e.value, mode: "up" });
4082
+ });
4083
+ variable.addEventListener("focus", () => {
4084
+ this.keyList.clear();
4085
+ this.mouseList.clear();
4086
+ });
4087
+ this.addEventListener("codeChange", this._computedkeyCombination.bind(this));
4088
+ }
4089
+ /** 添加取消浏览器默认行为规则
4090
+ * @param callBack
4091
+ */
4092
+ addCancelDefaultBehavior(callBack) {
4093
+ const domEventRegister = this.parent?.findComponentByType(DomEventRegister);
4094
+ domEventRegister.addCancelDefaultBehavior(() => {
4095
+ return callBack(this);
4096
+ });
4097
+ }
4098
+ /**
4099
+ * 计算组合按键
4100
+ */
4101
+ _computedkeyCombination() {
4102
+ this.currentKeyCombinationMap.clear();
4103
+ this.keyCombinationMap.forEach(
4104
+ ({ keys, count }, name) => this.isOnlyKeyDowns(keys) && this.currentKeyCombinationMap.set(name, count)
4105
+ );
4106
+ }
4107
+ /**
4108
+ * 添加组合按键
4109
+ * @param name
4110
+ * @param keys
4111
+ * @param count
4112
+ */
4113
+ addKeyCombination(name, keys, count = 1) {
4114
+ this.keyCombinationMap.set(name, { keys, count });
4115
+ }
4116
+ /**
4117
+ * 移除组合按键
4118
+ * @param name
4119
+ */
4120
+ removeKeyCombination(name) {
4121
+ this.keyCombinationMap.delete(name);
4122
+ }
4123
+ /**
4124
+ * 是否按下按键
4125
+ * @param key
4126
+ * @returns
4127
+ */
4128
+ isKeyDown(key) {
4129
+ return this.keyList.has(key) || this.mouseList.has(key);
4130
+ }
4131
+ /**
4132
+ * 是否按下按键组
4133
+ * @param keys
4134
+ * @returns
4135
+ */
4136
+ isKeyDowns(keys) {
4137
+ return keys.every((v) => this.isKeyDown(v));
4138
+ }
4139
+ /**
4140
+ * 是否按下按键组中部分
4141
+ * @param keys
4142
+ * @returns
4143
+ */
4144
+ isSomeKeyDowns(keys) {
4145
+ return keys.some((v) => this.isKeyDown(v));
4146
+ }
4147
+ /**
4148
+ * 是否按下按键组中所有,并且只按下按键组中的按键
4149
+ * @param keys
4150
+ * @returns
4151
+ */
4152
+ isOnlyKeyDowns(keys) {
4153
+ if (keys.length !== this.codeCount) return false;
4154
+ const keyList = keys.filter((v) => this.isKeyDown(v));
4155
+ return keyList.length === keys.length;
4156
+ }
4157
+ /**
4158
+ *
4159
+ * @param keys
4160
+ * @returns
4161
+ */
4162
+ isOnlyKeyDown(key) {
4163
+ return this.codeCount === 1 && this.isKeyDown(key);
4164
+ }
4165
+ /**
4166
+ *
4167
+ * @param name
4168
+ */
4169
+ isKeyCombination(name) {
4170
+ if (this.currentKeyCombinationMap.has(name)) {
4171
+ const count = this.currentKeyCombinationMap.get(name);
4172
+ if (count === 0) this.currentKeyCombinationMap.delete(name);
4173
+ else this.currentKeyCombinationMap.set(name, count - 1);
4174
+ return true;
4175
+ }
4176
+ return false;
4177
+ }
4178
+ }
7216
4179
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7217
4180
  __proto__: null,
7218
4181
  DetailsPointRender,
7219
4182
  DomContainer,
7220
4183
  DomEventRegister,
4184
+ EventInput,
7221
4185
  ModelDataRender,
7222
4186
  OriginalLineRender,
7223
4187
  Renderer
7224
4188
  }, Symbol.toStringTag, { value: "Module" }));
7225
- function selectLocalFileFun() {
7226
- return new Promise((resolve) => {
7227
- const input = document.createElement("input");
7228
- input.type = "file";
7229
- input.accept = "application/json";
7230
- input.click();
7231
- input.onchange = () => {
7232
- if (input.files?.length) resolve(input.files[0]);
7233
- else resolve(null);
7234
- };
7235
- });
7236
- }
7237
- const SelectLocalFile = Object.assign(selectLocalFileFun, {
7238
- arrayBuffer() {
7239
- return new Promise(async (resolve) => {
7240
- const file = await selectLocalFileFun();
7241
- if (file instanceof File) {
7242
- const fileReader = new FileReader();
7243
- fileReader.onload = () => {
7244
- resolve(fileReader.result);
7245
- };
7246
- fileReader.readAsArrayBuffer(file);
7247
- } else resolve(null);
7248
- });
7249
- },
7250
- text() {
7251
- return new Promise(async (resolve) => {
7252
- const file = await selectLocalFileFun();
7253
- if (file instanceof File) {
7254
- const fileReader = new FileReader();
7255
- fileReader.onload = () => {
7256
- resolve(fileReader.result);
7257
- };
7258
- fileReader.readAsText(file, "utf-8");
7259
- } else resolve(null);
7260
- });
7261
- },
7262
- async json() {
7263
- const text = await this.text();
7264
- if (text) return JSON.parse(text);
7265
- }
7266
- });
7267
- function Editor(dxfSystem) {
7268
- }
7269
- const _hoisted_1 = { class: "w-full flex justify-between absolute left-0 top-0 p-[10px] z-[1000] gap-[5px]" };
7270
- const _hoisted_2 = { class: "text-[14px] bg-[rgba(255,255,255,1)] rounded-[6px] p-[0px_10px]" };
4189
+ const _hoisted_1 = { class: "pointer-events-none w-full flex justify-between absolute left-0 top-0 p-[10px] z-[1000] gap-[5px] select-none" };
4190
+ const _hoisted_2 = { class: "pointer-events-auto" };
4191
+ const _hoisted_3 = { class: "pointer-events-auto" };
4192
+ const _hoisted_4 = { class: "text-[14px] bg-[rgba(255,255,255,1)] rounded-[6px] p-[0px_10px]" };
7271
4193
  const _sfc_main = /* @__PURE__ */ defineComponent({
7272
4194
  __name: "Dxf",
7273
4195
  props: {
@@ -7277,7 +4199,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
7277
4199
  setup(__props) {
7278
4200
  THREE.Object3D.DEFAULT_UP = new THREE.Vector3(0, 0, 1);
7279
4201
  const props = __props;
7280
- const elRef = ref(), originalLineVisible = ref(true), dxfVisible = ref(true), whiteModelVisible = ref(true), isLook = ref(false), dxfSystem = new DxfSystem().usePlugin(ModelDataPlugin).usePlugin(RenderPlugin).usePlugin(Editor), desPoint = dxfSystem.findComponentByType(DetailsPoint), domContainer = dxfSystem.findComponentByType(DomContainer), whiteModel = dxfSystem.findComponentByType(WhiteModel);
4202
+ const elRef = ref(), originalLineVisible = ref(true), dxfVisible = ref(true), whiteModelVisible = ref(true), isLook = ref(false), dxfSystem = new DxfSystem().usePlugin(ModelDataPlugin).usePlugin(RenderPlugin), desPoint = dxfSystem.findComponentByType(DetailsPoint), domContainer = dxfSystem.findComponentByType(DomContainer), whiteModel = dxfSystem.findComponentByType(WhiteModel);
7281
4203
  watch(() => props.lines, () => props.lines && setLines(props.lines));
7282
4204
  watch(() => props.detailsPoint, () => props.detailsPoint && desPoint?.set(props.detailsPoint));
7283
4205
  function setLines(lines) {
@@ -7339,7 +4261,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
7339
4261
  style: { "height": "100%", "width": "100%", "overflow": "hidden", "position": "relative" }
7340
4262
  }, [
7341
4263
  createElementVNode("div", _hoisted_1, [
7342
- createElementVNode("div", null, [
4264
+ createElementVNode("div", _hoisted_2, [
7343
4265
  createVNode(unref(ElButton), {
7344
4266
  size: "small",
7345
4267
  type: "primary",
@@ -7383,15 +4305,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
7383
4305
  ])),
7384
4306
  _: 1,
7385
4307
  __: [9]
4308
+ }),
4309
+ createVNode(unref(ElButton), {
4310
+ size: "small",
4311
+ type: "success",
4312
+ onClick: selectDetailsPointFile
4313
+ }, {
4314
+ default: withCtx(() => _cache[10] || (_cache[10] = [
4315
+ createTextVNode(" 编辑模式 ", -1)
4316
+ ])),
4317
+ _: 1,
4318
+ __: [10]
7386
4319
  })
7387
4320
  ]),
7388
4321
  isLook.value ? (openBlock(), createElementBlock("div", {
7389
4322
  key: 0,
7390
4323
  onClick: _cache[2] || (_cache[2] = ($event) => unref(dxfSystem).Variable.set("isLook", false)),
7391
- class: "text-[#fff] h-fit text-[14px] rounded-[10px] bg-black p-[5px_20px] select-none cursor-pointer"
4324
+ class: "pointer-events-auto text-[#fff] h-fit text-[14px] rounded-[10px] bg-black p-[5px_20px] select-none cursor-pointer"
7392
4325
  }, " 点击这或按 ESC 取消 ")) : createCommentVNode("", true),
7393
- createElementVNode("div", null, [
7394
- createElementVNode("div", _hoisted_2, [
4326
+ createElementVNode("div", _hoisted_3, [
4327
+ createElementVNode("div", _hoisted_4, [
7395
4328
  createVNode(unref(ElCheckbox), {
7396
4329
  modelValue: originalLineVisible.value,
7397
4330
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => originalLineVisible.value = $event),
@@ -7408,33 +4341,47 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
7408
4341
  label: "墙体(E)"
7409
4342
  }, null, 8, ["modelValue"])
7410
4343
  ]),
7411
- _cache[10] || (_cache[10] = createStaticVNode('<div class="mt-[5px] text-[#c9c9c9] text-[10px]"><p class="text-right">详情点射线辅助线快捷键:R</p><p class="text-right">墙壁合并追加线快捷键:A</p><p class="text-right">线段序号快捷键:T</p><p class="text-right">线段端点标示快捷键:P</p><p class="text-right">线段长度(单位米)快捷键:L</p></div>', 1))
4344
+ _cache[11] || (_cache[11] = createStaticVNode('<div class="mt-[5px] text-[#c9c9c9] text-[10px]"><p class="text-right">详情点射线辅助线快捷键:R</p><p class="text-right">墙壁合并追加线快捷键:A</p><p class="text-right">线段序号快捷键:T</p><p class="text-right">线段端点标示快捷键:P</p><p class="text-right">线段长度(单位米)快捷键:L</p></div>', 1))
7412
4345
  ])
7413
4346
  ])
7414
4347
  ], 512);
7415
4348
  };
7416
4349
  }
7417
4350
  });
7418
- function RenderPlugin(dxfSystem) {
4351
+ function RenderPlugin_(dxfSystem, option = {}) {
4352
+ const {
4353
+ originalLine = true,
4354
+ modelData = true,
4355
+ detailsPoint = true,
4356
+ camera = new THREE.PerspectiveCamera(45, 1, 0.01, 1e3)
4357
+ } = option;
7419
4358
  const domContainer = new DomContainer();
7420
4359
  dxfSystem.addComponent(domContainer);
7421
4360
  dxfSystem.addComponent(new Renderer({
7422
4361
  canvas: domContainer.canvas,
4362
+ camera,
7423
4363
  htmlRenderer: {
7424
- "2d": domContainer.html2DRenderer
4364
+ "2d": domContainer.html2DRenderer,
4365
+ "3d": domContainer.html3DRenderer
7425
4366
  },
7426
4367
  resizeObserver: domContainer.domElement,
7427
4368
  orbitControls: {
7428
- domElement: domContainer.html2DRenderer,
4369
+ domElement: domContainer.domElement,
7429
4370
  enableDamping: true,
7430
4371
  dampingFactor: 0.15
7431
4372
  }
7432
4373
  }));
7433
- dxfSystem.addComponent(new OriginalLineRender());
7434
- dxfSystem.addComponent(new ModelDataRender());
7435
- dxfSystem.addComponent(new DetailsPointRender());
4374
+ originalLine && dxfSystem.addComponent(new OriginalLineRender());
4375
+ modelData && dxfSystem.addComponent(new ModelDataRender());
4376
+ detailsPoint && dxfSystem.addComponent(new DetailsPointRender());
7436
4377
  dxfSystem.addComponent(new DomEventRegister());
4378
+ dxfSystem.addComponent(new EventInput());
7437
4379
  }
4380
+ const RenderPlugin = Object.assign(RenderPlugin_, {
4381
+ create(option = {}) {
4382
+ return (dxfSystem) => RenderPlugin_(dxfSystem, option);
4383
+ }
4384
+ });
7438
4385
  export {
7439
4386
  _sfc_main as Dxf3DView,
7440
4387
  RenderPlugin,