var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
import { getCurrentScope, onScopeDispose, unref, getCurrentInstance, onMounted, nextTick, ref, readonly, watch, openBlock, createElementBlock, createElementVNode, warn, computed as computed$1, watchEffect, onBeforeUnmount, inject, isRef, shallowRef, onBeforeMount, provide, defineComponent, renderSlot, mergeProps, toRef, onUnmounted, useAttrs as useAttrs$1, useSlots, withDirectives, createCommentVNode, Fragment, normalizeClass, createBlock, withCtx, resolveDynamicComponent, withModifiers, createVNode, toDisplayString, normalizeStyle, vShow, Transition, reactive, onUpdated, cloneVNode, Text as Text$1, Comment as Comment$1, Teleport, onDeactivated, vModelRadio, createTextVNode, toRefs, toHandlers, withKeys, renderList, h, createSlots, toRaw as toRaw$1, triggerRef, resolveComponent, resolveDirective, vModelText, defineCustomElement } from "vue";
const CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
class Util {
static uuid(prefix = "D") {
let uuid = [];
uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
uuid[14] = "4";
let r2;
for (let i2 = 0; i2 < 36; i2++) {
if (!uuid[i2]) {
r2 = 0 | Math.random() * 16;
uuid[i2] = CHARS[i2 == 19 ? r2 & 3 | 8 : r2];
}
}
return prefix + "-" + uuid.join("");
}
static merge(dest, ...sources) {
let i2, j, len, src;
for (j = 0, len = sources.length; j < len; j++) {
src = sources[j];
for (i2 in src) {
dest[i2] = src[i2];
}
}
return dest;
}
static trim(str) {
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
}
static splitWords(str) {
return this.trim(str).split(/\s+/);
}
static setOptions(obj, options2) {
if (!obj.hasOwnProperty("options")) {
obj.options = obj.options ? create(obj.options) : {};
}
for (var i2 in options2) {
obj.options[i2] = options2[i2];
}
return obj.options;
}
static checkPosition(position2) {
return position2 && position2.hasOwnProperty("_lng") && position2.hasOwnProperty("_lat") && position2.hasOwnProperty("_alt");
}
static checkPositions(positions) {
return positions && (typeof positions === "string" || Array.isArray(positions));
}
static checkViewer(viewer2) {
return viewer2 && viewer2.delegate && viewer2.canvas;
}
}
class DomUtil {
static get(id) {
return typeof id === "string" ? document.getElementById(id) : id;
}
static getStyle(el, style) {
var value = el.style[style] || el.currentStyle && el.currentStyle[style];
if ((!value || value === "auto") && document.defaultView) {
var css = document.defaultView.getComputedStyle(el, null);
value = css ? css[style] : null;
}
return value === "auto" ? null : value;
}
static create(tagName, className, container) {
var el = document.createElement(tagName);
el.className = className || "";
if (container) {
container.appendChild(el);
}
return el;
}
static remove(el) {
var parent = el.parentNode;
if (parent) {
parent.removeChild(el);
}
}
static empty(el) {
while (el.firstChild) {
el.removeChild(el.firstChild);
}
}
hasClass(el, name) {
if (el.classList !== void 0) {
return el.classList.contains(name);
}
var className = getClass(el);
return className.length > 0 && new RegExp("(^|\\s)" + name + "(\\s|$)").test(className);
}
static addClass(el, name) {
if (el.classList !== void 0) {
let classes = Util.splitWords(name);
for (let i2 = 0, len = classes.length; i2 < len; i2++) {
el.classList.add(classes[i2]);
}
} else if (!this.hasClass(el, name)) {
let className = this.getClass(el);
this.setClass(el, (className ? className + " " : "") + name);
}
}
static removeClass(el, name) {
if (el.classList !== void 0) {
el.classList.remove(name);
} else {
this.setClass(
el,
Util.trim(
(" " + this.getClass(el) + " ").replace(" " + name + " ", " ")
)
);
}
}
static setClass(el, name) {
if (el.className.baseVal === void 0) {
el.className = name;
} else {
el.className.baseVal = name;
}
}
static getClass(el) {
if (el.correspondingElement) {
el = el.correspondingElement;
}
return el.className.baseVal === void 0 ? el.className : el.className.baseVal;
}
static createSvg(width2, height2, path, container) {
let svg = document.createElementNS("http://www.w3.org/2000/svg", "svg:svg");
svg.setAttribute("class", "svg-path");
svg.setAttribute("width", width2);
svg.setAttribute("height", height2);
svg.setAttribute("viewBox", `0 0 ${width2} ${height2}`);
let pathEl = document.createElementNS("http://www.w3.org/2000/svg", "path");
pathEl.setAttribute("d", path);
svg.appendChild(pathEl);
if (container) {
container.appendChild(svg);
}
return svg;
}
}
var StatusBar$1 = "";
class StatusBar {
constructor(viewer2) {
if (!viewer2)
throw new Error("viewer is required!");
this._viewer = viewer2;
this._show = false;
this._handler;
this._posX;
this._posY;
this._posZ;
this._cameraHeight;
this._pitch;
this._heading;
this._scale;
this.initListener();
}
get params() {
return {
posX: this._posX,
posY: this._posY,
posZ: this._posZ,
cameraHeight: this._cameraHeight,
pitch: this._pitch,
heading: this._heading,
scale: this._scale
};
}
get statusDom() {
let innerHtml = `
\u6BD4\u4F8B\u5C3A\uFF1A
${this._scale}
\u7A7A\u95F4\u4FE1\u606F
\u5237\u5E27\u7387\uFF1A|
`;
return innerHtml;
}
get show() {
return this._show;
}
set show(bool) {
bool ? this.createStatusBar() : this.removeStatusBar();
this._show = bool;
}
initListener() {
const $this = this;
const scene = this._viewer.scene;
this._scaleListener = function() {
let width2 = scene.canvas.clientWidth;
let height2 = scene.canvas.clientHeight;
let left = scene.camera.getPickRay(
new Cesium.Cartesian2(width2 / 2 | 0, height2 - 1)
);
let right = scene.camera.getPickRay(
new Cesium.Cartesian2(1 + width2 / 2 | 0, height2 - 1)
);
let globe = scene.globe;
let leftPosition = globe.pick(left, scene);
let rightPosition = globe.pick(right, scene);
if (leftPosition && rightPosition) {
let geodesic = new Cesium.EllipsoidGeodesic();
let leftCartographic = globe.ellipsoid.cartesianToCartographic(leftPosition);
let rightCartographic = globe.ellipsoid.cartesianToCartographic(rightPosition);
geodesic.setEndPoints(leftCartographic, rightCartographic);
let distance2 = geodesic.surfaceDistance;
let curScaleNum = $this.closest(distance2 / 10);
if (curScaleNum < 1) {
$this._scale = curScaleNum * 1e3 + "m";
} else {
$this._scale = curScaleNum + "km";
}
}
document.getElementsByClassName("scale-border")[0].innerText = $this._scale;
if (document.getElementsByClassName("cesium-performanceDisplay-ms").length > 0) {
document.getElementById("status_ms").innerText = document.getElementsByClassName("cesium-performanceDisplay-ms")[0].innerText;
}
if (document.getElementsByClassName("cesium-performanceDisplay-fps").length > 0) {
document.getElementById("status_fps").innerText = document.getElementsByClassName("cesium-performanceDisplay-fps")[0].innerText;
}
};
}
createStatusBar() {
const _delegate = this._viewer;
this.initHandler(_delegate);
this.initScale(_delegate, true);
this._domContainer = DomUtil.create(
"div",
"lk-status-bar",
document.getElementById(this._viewer._container.id)
);
this._domContainer.innerHTML = this.statusDom;
}
removeStatusBar() {
this.initScale(this._viewer, false);
if (this._handler) {
this._handler.destroy();
}
if (this._domContainer) {
DomUtil.remove(this._domContainer);
}
}
initHandler(viewer2) {
const $this = this;
this._handler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
const mouseOverHandler = function(movement) {
let loc2 = $this._getScreenClickPositionAndHeight(movement.endPosition);
if (!Cesium.defined(loc2))
return;
if (!loc2.lng)
return;
$this._posX = loc2.lng.toFixed(8);
$this._posY = loc2.lat.toFixed(8);
$this._posZ = loc2.height.toFixed(2);
document.getElementById("status_spaceInfo").innerHTML = `
\u7ECF\u5EA6\uFF1A${$this._posX}
\u7EAC\u5EA6\uFF1A${$this._posY}
\u9AD8\u5EA6\uFF1A${$this._posZ}
`;
};
this._handler.setInputAction(
mouseOverHandler,
Cesium.ScreenSpaceEventType.MOUSE_MOVE
);
}
initScale(viewer2, bool) {
const scene = viewer2.scene;
bool ? scene.postRender.addEventListener(this._scaleListener) : scene.postRender.removeEventListener(this._scaleListener);
}
closest(num) {
const scaleList = [
1e-3,
2e-3,
3e-3,
5e-3,
0.01,
0.015,
0.02,
0.025,
0.03,
0.035,
0.04,
0.045,
0.05,
0.06,
0.07,
0.08,
0.09,
0.1,
0.12,
0.15,
0.2,
0.25,
0.3,
0.5,
1,
2,
3,
5,
10,
15,
20,
25,
30,
35,
40,
45,
50,
60,
70,
80,
90,
100,
120,
150,
200,
250,
300,
500,
1e3,
2e3,
5e3,
1e4,
1e5,
5e5,
1e6
];
let ret = scaleList[0];
let distance2 = Math.abs(ret - num);
for (let i2 = 1; i2 < scaleList.length; i2++) {
let newDistance = Math.abs(scaleList[i2] - num);
if (newDistance < distance2) {
distance2 = newDistance;
ret = scaleList[i2];
}
}
return ret;
}
_getScreenClickPositionAndHeight(screenPoint) {
var lng = void 0, lat = void 0, height2 = void 0;
var ray = this._viewer.scene.camera.getPickRay(screenPoint);
var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
if (position2) {
var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
cartographic = Cesium.Cartographic.fromCartesian(position2);
var feature2 = this._viewer.scene.pick(screenPoint);
if (feature2 === void 0 && Cesium.defined(cartographic)) {
lng = this._arcToDegree(cartographic.longitude);
lat = this._arcToDegree(cartographic.latitude);
height2 = cartographic.height;
} else {
var cartesian = this._viewer.scene.pickPosition(screenPoint);
if (Cesium.defined(cartesian)) {
var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
if (Cesium.defined(cartographic)) {
lng = this._arcToDegree(cartographic.longitude);
lat = this._arcToDegree(cartographic.latitude);
height2 = cartographic.height;
}
}
}
}
return {
lng,
lat,
height: height2
};
}
_arcToDegree(arc) {
return arc / Math.PI * 180;
}
}
var base = "";
class jtMap3d {
constructor(options2) {
if (!Cesium.defined(options2) || !Cesium.defined(options2.container)) {
throw new Cesium.DeveloperError("options.container is required.");
}
Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIxNzM5YjQ3MC03YmMxLTRmMjAtOTk4Yi0yNDMyMDZlOTQzYTYiLCJpZCI6NTU5MjAsImlhdCI6MTYyNDI0NTM5NX0.diydVWFzw5C5rQlHaFYkdDJoSorcdex81KpWcntyICo";
this._viewer = this._initMap(options2);
this._imageryLayers = this._viewer.imageryLayers;
this._primitives = this._viewer.scene.primitives;
this._entities = this._viewer.entities;
this._dataSources = this._viewer.dataSources;
this._defaultSkyBox = this._viewer.scene.skyBox;
this.statusBar = new StatusBar(this._viewer);
console.log(Cesium.buildModuleUrl.getCesiumBaseUrl());
}
_initMap(options2) {
let viewer2 = new Cesium.Viewer(options2.container, {
animation: true,
timeline: true,
shadows: false,
shouldAnimate: true,
baseLayerPicker: false,
navigationHelpButton: false,
homeButton: false,
fullscreenButton: false,
sceneModePicker: false,
scene3DOnly: true,
infoBox: false,
clampToGround: true,
geocoder: false,
selectionIndicator: false,
contextOptions: {
webgl: {
alpha: true,
depth: true,
stencil: true,
antialias: true,
premultipliedAlpha: true,
preserveDrawingBuffer: true,
failIfMajorPerformanceCaveat: true
}
}
});
viewer2._cesiumWidget._creditContainer.style.display = "none";
viewer2.scene.globe.show = true;
viewer2.scene.globe.depthTestAgainstTerrain = true;
viewer2.scene.globe.enableLighting = false;
viewer2.scene.requestRenderMode = false;
viewer2.scene.debugShowFramesPerSecond = true;
viewer2.scene.skyAtmosphere.show = false;
viewer2.scene.skyBox.show = true;
viewer2.scene.sun.show = true;
viewer2.scene.moon.show = false;
viewer2.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
viewer2.animation.viewModel.dateFormatter = localeDateTimeFormatter;
viewer2.animation.viewModel.timeFormatter = localeTimeFormatter;
viewer2.timeline.makeLabel = localeDateTimeFormatter;
function localeDateTimeFormatter(datetime, viewModel, ignoredate) {
var julianDT = new Cesium.JulianDate();
Cesium.JulianDate.addHours(datetime, 8, julianDT);
var gregorianDT = Cesium.JulianDate.toGregorianDate(julianDT);
var objDT;
if (ignoredate) {
objDT = "";
} else {
objDT = new Date(gregorianDT.year, gregorianDT.month - 1, gregorianDT.day);
objDT = gregorianDT.year + "-" + objDT.toLocaleString("zh-cn", {
month: "short"
}).split("\u6708").join("-") + gregorianDT.day + " ";
if (viewModel || gregorianDT.hour + gregorianDT.minute === 0) {
return objDT;
}
}
let hour, minute, second;
if (gregorianDT.hour < 10) {
hour = `0${gregorianDT.hour}`;
} else {
hour = gregorianDT.hour;
}
if (gregorianDT.minute < 10) {
minute = `0${gregorianDT.minute}`;
} else {
minute = gregorianDT.minute;
}
if (gregorianDT.second < 10) {
second = `0${gregorianDT.second}`;
} else {
second = gregorianDT.second;
}
return objDT + hour + ":" + minute + ":" + second;
}
function localeTimeFormatter(time, viewModel) {
return localeDateTimeFormatter(time, viewModel, true);
}
return viewer2;
}
_setView(options2) {
if (!Cesium.defined(options2.longitude) && !Cesium.defined(options2.latitude)) {
throw new Cesium.DeveloperError("longitude and latitude are required.");
}
Cesium.Check.typeOf.number("longitude", options2.longitude);
Cesium.Check.typeOf.number("latitude", options2.latitude);
this._viewer.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(
options2.longitude,
options2.latitude,
options2.height
),
orientation: {
heading: Cesium.Math.toRadians(Cesium.defaultValue(options2.heading, 0)),
pitch: Cesium.Math.toRadians(Cesium.defaultValue(options2.pitch, -90)),
roll: options2.roll
}
});
}
_getChinaPostion() {
return Cesium.Cartesian3.fromDegrees(116.435314, 40.960521, 1e7);
}
}
Object.assign(jtMap3d.prototype, {
flytoChina() {
this._viewer.camera.flyTo({
destination: this._getChinaPostion(),
duration: 3
});
},
setViewChina: function() {
this._setView({
longitude: 103.84,
latitude: 31.15,
height: 24e6,
heading: 0,
pitch: -90,
roll: 0
});
},
fullMap: function(options2) {
return new Promise((resolve2, reject2) => {
let _self = this;
this._entities.removeById("fullMapRectangle");
options2.isRemove = Cesium.defaultValue(options2.isRemove, true);
options2.duration = Cesium.defaultValue(options2.duration, 3);
options2.heading = Cesium.defaultValue(options2.heading, 0);
options2.pitch = Cesium.defaultValue(options2.pitch, -90);
options2.range = Cesium.defaultValue(options2.range, 0);
var rectangle = Cesium.Rectangle.fromDegrees(
options2.west,
options2.south,
options2.east,
options2.north
);
var fullMapEntity = this._entities.add({
id: "fullMapRectangle",
name: "fullMapRectangle",
rectangle: {
coordinates: rectangle,
material: Cesium.Color.GREEN.withAlpha(0),
height: 10,
outline: false
}
});
var flyPromise = this._viewer.flyTo(fullMapEntity, {
duration: options2.duration,
offset: {
heading: Cesium.Math.toRadians(options2.heading),
pitch: Cesium.Math.toRadians(options2.pitch),
range: options2.range
}
});
flyPromise.then(function(flyPromise2) {
if (flyPromise2) {
if (options2.isRemove) {
fullMapEntity && (_self._entities.remove(fullMapEntity), fullMapEntity = null);
}
resolve2(true);
}
}).catch(function(error) {
console.log(error);
});
});
},
setMapNorth() {
let viewer2 = this._viewer;
let pitch = Cesium.Math.toDegrees(viewer2.camera.pitch).toFixed(0);
var center2 = viewer2.camera.pickEllipsoid(new Cesium.Cartesian2(viewer2.canvas.clientWidth / 2, viewer2.canvas.clientHeight / 2));
var curPosition = Cesium.Ellipsoid.WGS84.cartesianToCartographic(center2);
let centerX = curPosition.longitude * 180 / Math.PI;
let centerY = curPosition.latitude * 180 / Math.PI;
let cameraPointX = viewer2.camera.positionCartographic.longitude * 180 / Math.PI;
let cameraPointY = viewer2.camera.positionCartographic.latitude * 180 / Math.PI;
let cameraPointZ = viewer2.camera.positionCartographic.height.toFixed(0);
var satrt = Cesium.Cartographic.fromDegrees(cameraPointX, cameraPointY, cameraPointZ);
var end = Cesium.Cartographic.fromDegrees(centerX, centerY, 0);
var geodesic = new Cesium.EllipsoidGeodesic();
geodesic.setEndPoints(satrt, end);
var distance2 = geodesic.surfaceDistance;
let range3 = Math.sqrt(Math.pow(distance2, 2) + Math.pow(cameraPointZ - 0, 2));
if (this.centerEntity) {
viewer2.entities.remove(this.centerEntity);
}
this.centerEntity = viewer2.entities.add({
position: Cesium.Cartesian3.fromDegrees(centerX, centerY, 0),
point: {
color: Cesium.Color.RED,
pixelSize: 1
}
});
let offset = new Cesium.HeadingPitchRange(Cesium.Math.toRadians(0), Cesium.Math.toRadians(pitch), range3);
viewer2.zoomTo(this.centerEntity, offset);
},
setMapSpinByPoint(points2, options2) {
let viewer2 = this._viewer;
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
options2 = options2 || {};
options2.speed = Cesium.defaultValue(options2.speed, 30);
var position2 = points2;
if (points2 instanceof Cesium.Cartesian3) {
position2 = points2;
} else {
position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
}
var entity = viewer2.entities.add(
new Cesium.Entity({
point: new Cesium.PointGraphics({
color: new Cesium.Color(1, 1, 0),
pixelSize: 6,
outlineColor: new Cesium.Color(0, 1, 1)
}),
position: position2
})
);
var angle = 360 / options2.speed;
var initialHeading = viewer2.camera.heading;
var pitch = viewer2.camera.pitch;
if (options2.pitch) {
pitch = Cesium.Math.toRadians(options2.pitch);
}
var distance2 = viewer2.camera.positionCartographic.height;
if (options2.height) {
distance2 = options2.height;
}
var startTime = Cesium.JulianDate.fromDate(new Date());
viewer2.clock.startTime = startTime.clone();
viewer2.clock.currentTime = startTime.clone();
viewer2.clock.clockRange = Cesium.ClockRange.CLAMPED;
viewer2.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK;
var Exection = function TimeExecution() {
var delTime = Cesium.JulianDate.secondsDifference(viewer2.clock.currentTime, viewer2.clock.startTime);
var heading = Cesium.Math.toRadians(delTime * angle) + initialHeading;
viewer2.scene.camera.setView({
destination: position2,
orientation: {
heading,
pitch
}
});
viewer2.scene.camera.moveBackward(distance2);
if (Cesium.JulianDate.compare(viewer2.clock.currentTime, viewer2.clock.stopTime) >= 0) {
viewer2.clock.onTick.removeEventListener(Exection);
}
var handler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
handler.setInputAction(function(click) {
viewer2.clock.onTick.removeEventListener(Exection);
viewer2.entities.remove(entity);
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
};
viewer2.clock.onTick.addEventListener(Exection);
}
});
const BD_FACTOR = 3.141592653589793 * 3e3 / 180;
const PI = 3.141592653589793;
const RADIUS = 6378245;
const EE = 0.006693421622965943;
class CoordTransform {
static BD09ToGCJ02(lng, lat) {
let x = +lng - 65e-4;
let y = +lat - 6e-3;
let z = Math.sqrt(x * x + y * y) - 2e-5 * Math.sin(y * BD_FACTOR);
let theta = Math.atan2(y, x) - 3e-6 * Math.cos(x * BD_FACTOR);
let gg_lng = z * Math.cos(theta);
let gg_lat = z * Math.sin(theta);
return [gg_lng, gg_lat];
}
static GCJ02ToBD09(lng, lat) {
lat = +lat;
lng = +lng;
let z = Math.sqrt(lng * lng + lat * lat) + 2e-5 * Math.sin(lat * BD_FACTOR);
let theta = Math.atan2(lat, lng) + 3e-6 * Math.cos(lng * BD_FACTOR);
let bd_lng = z * Math.cos(theta) + 65e-4;
let bd_lat = z * Math.sin(theta) + 6e-3;
return [bd_lng, bd_lat];
}
static WGS84ToGCJ02(lng, lat) {
lat = +lat;
lng = +lng;
if (this.out_of_china(lng, lat)) {
return [lng, lat];
} else {
let d2 = this.delta(lng, lat);
return [lng + d2[0], lat + d2[1]];
}
}
static GCJ02ToWGS84(lng, lat) {
lat = +lat;
lng = +lng;
if (this.out_of_china(lng, lat)) {
return [lng, lat];
} else {
let d2 = this.delta(lng, lat);
let mgLng = lng + d2[0];
let mgLat = lat + d2[1];
return [lng * 2 - mgLng, lat * 2 - mgLat];
}
}
static delta(lng, lat) {
let dLng = this.transformLng(lng - 105, lat - 35);
let dLat = this.transformLat(lng - 105, lat - 35);
const radLat = lat / 180 * PI;
let magic = Math.sin(radLat);
magic = 1 - EE * magic * magic;
const sqrtMagic = Math.sqrt(magic);
dLng = dLng * 180 / (RADIUS / sqrtMagic * Math.cos(radLat) * PI);
dLat = dLat * 180 / (RADIUS * (1 - EE) / (magic * sqrtMagic) * PI);
return [dLng, dLat];
}
static transformLng(lng, lat) {
lat = +lat;
lng = +lng;
let ret = 300 + lng + 2 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
ret += (20 * Math.sin(6 * lng * PI) + 20 * Math.sin(2 * lng * PI)) * 2 / 3;
ret += (20 * Math.sin(lng * PI) + 40 * Math.sin(lng / 3 * PI)) * 2 / 3;
ret += (150 * Math.sin(lng / 12 * PI) + 300 * Math.sin(lng / 30 * PI)) * 2 / 3;
return ret;
}
static transformLat(lng, lat) {
lat = +lat;
lng = +lng;
let ret = -100 + 2 * lng + 3 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
ret += (20 * Math.sin(6 * lng * PI) + 20 * Math.sin(2 * lng * PI)) * 2 / 3;
ret += (20 * Math.sin(lat * PI) + 40 * Math.sin(lat / 3 * PI)) * 2 / 3;
ret += (160 * Math.sin(lat / 12 * PI) + 320 * Math.sin(lat * PI / 30)) * 2 / 3;
return ret;
}
static out_of_china(lng, lat) {
lat = +lat;
lng = +lng;
return !(lng > 73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55);
}
static getCatesian3FromPX(viewer2, px) {
let picks = viewer2.scene.drillPick(px);
let cartesian = null;
let isOn3dtiles = false, isOnTerrain = false;
for (let i2 in picks) {
let pick = picks[i2];
if (pick && pick.primitive instanceof Cesium.Cesium3DTileFeature || pick && pick.primitive instanceof Cesium.Cesium3DTileset || pick && pick.primitive instanceof Cesium.Model) {
isOn3dtiles = true;
}
if (isOn3dtiles) {
viewer2.scene.pick(px);
cartesian = viewer2.scene.pickPosition(px);
if (cartesian) {
let cartographic = Cesium.Cartographic.fromCartesian(cartesian);
if (cartographic.height < 0)
cartographic.height = 0;
let lon = Cesium.Math.toDegrees(cartographic.longitude), lat = Cesium.Math.toDegrees(cartographic.latitude), height2 = cartographic.height;
cartesian = this.transformWGS84ToCartesian({
lng: lon,
lat,
alt: height2
});
}
}
}
let boolTerrain = viewer2.terrainProvider instanceof Cesium.EllipsoidTerrainProvider;
if (!isOn3dtiles && !boolTerrain) {
let ray = viewer2.scene.camera.getPickRay(px);
if (!ray)
return null;
cartesian = viewer2.scene.globe.pick(ray, viewer2.scene);
isOnTerrain = true;
}
if (!isOn3dtiles && !isOnTerrain && boolTerrain) {
cartesian = viewer2.scene.camera.pickEllipsoid(
px,
viewer2.scene.globe.ellipsoid
);
}
if (cartesian) {
let position2 = this.transformCartesianToWGS84(cartesian);
if (position2.alt < 0) {
cartesian = this.transformWGS84ToCartesian(position2, 0.1);
}
return cartesian;
}
return false;
}
static transformWGS84ToCartesian(position2, alt) {
return position2 ? Cesium.Cartesian3.fromDegrees(
position2.lng || position2.lon,
position2.lat,
position2.alt = alt || position2.alt,
Cesium.Ellipsoid.WGS84
) : Cesium.Cartesian3.ZERO;
}
static transformCartesianToWGS84(cartesian) {
let ellipsoid = Cesium.Ellipsoid.WGS84;
let cartographic = ellipsoid.cartesianToCartographic(cartesian);
return {
lng: Cesium.Math.toDegrees(cartographic.longitude),
lat: Cesium.Math.toDegrees(cartographic.latitude),
alt: cartographic.height
};
}
static Cartesian3ListToWGS84(cartesianList) {
let ellipsoid = Cesium.Ellipsoid.WGS84;
let result = [];
for (let index2 = 0; index2 < cartesianList.length; index2++) {
const cartesian = cartesianList[index2];
let cartographic = ellipsoid.cartesianToCartographic(cartesian);
result.push({
lng: Cesium.Math.toDegrees(cartographic.longitude),
lat: Cesium.Math.toDegrees(cartographic.latitude),
alt: cartographic.height
});
}
return result;
}
static Degrees2DMS(value) {
let degrees = Math.floor(value);
let rem = (value - degrees) * 60;
let minutes = Math.floor(rem);
let _second = (rem - minutes) * 60;
let seconds = Math.round(_second);
var _radians = Cesium.Math.toRadians(value);
var _degrees = Cesium.Math.toDegrees(value);
console.log(_radians);
console.log(_degrees);
let DMS = {
degrees,
minutes,
seconds
};
return DMS;
}
static DMS2Degrees(DMS) {
let _double = parseFloat(DMS.degrees) + parseFloat(DMS.minutes) / 60 + parseFloat(DMS.seconds) / 3600;
return parseFloat(_double).toFixed(6);
}
static _cartesian3ToGeo(position2) {
let g = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
return {
longitude: Cesium.Math.toDegrees(g.longitude),
latitude: Cesium.Math.toDegrees(g.latitude),
height: g.height
};
}
static _arcToDegree(arc) {
return arc / Math.PI * 180;
}
static _getScreenClickPositionAndHeight(viewer2, screenPoint) {
this._viewer = viewer2;
var lng = void 0, lat = void 0, height2 = void 0;
var ray = this._viewer.scene.camera.getPickRay(screenPoint);
var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
var feature2 = this._viewer.scene.pick(screenPoint);
if (feature2 == void 0) {
lng = this._arcToDegree(cartographic.longitude);
lat = this._arcToDegree(cartographic.latitude);
height2 = cartographic.height;
} else {
var cartesian = this._viewer.scene.pickPosition(screenPoint);
if (Cesium.defined(cartesian)) {
var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
lng = this._arcToDegree(cartographic.longitude);
lat = this._arcToDegree(cartographic.latitude);
height2 = cartographic.height;
}
}
return {
lng,
lat,
height: height2
};
}
static _transfromFromScreenPoint(viewer2, screenPosition) {
let location = this._getScreenClickPositionAndHeight(viewer2, screenPosition);
var cartesian = Cesium.Cartesian3.fromDegrees(location.lng, location.lat, location.height);
return {
gLocation: location,
sLocation: cartesian
};
}
}
class PolylineDirectionMaterialProperty {
constructor(options2) {
this.defaultColor = new Cesium.Color(255 / 255, 0, 0, 0);
options2 = options2 || {};
options2.isImageAlpha = Cesium.defaultValue(options2.isImageAlpha, true);
options2.imgUrl = Cesium.defaultValue(options2.imgUrl, "jt3dSDK/imgs/polylinematerial/spriteline1.png");
options2.duration = Cesium.defaultValue(options2.duration, 3e3);
options2.count = Cesium.defaultValue(options2.count, 1);
options2.direction = Cesium.defaultValue(options2.direction, "horizontal");
options2.order = Cesium.defaultValue(options2.order, "-");
if (options2.isImageAlpha) {
options2.color = this.defaultColor;
} else {
if (options2.color instanceof Array) {
options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
} else if (typeof options2.color === "string") {
options2.color = new Cesium.Color.fromCssColorString(options2.color);
} else {
options2.color = this.defaultColor;
}
}
this._definitionChanged = new Cesium.Event();
this._color = void 0;
this._image = void 0;
this.color = options2.color;
this.image = options2.imgUrl;
this._isImageAlpha = options2.isImageAlpha;
this._duration = options2.duration;
this._count = options2.count;
this._direction = options2.direction;
this._order = options2.order;
this._time = performance.now();
this.addMaterial();
}
addMaterial() {
Cesium.Material.PolylineTrailType = "PolylineTrail";
Cesium.Material.Polylineimage = "images/colors.png";
if (this._direction === "vertical") {
if (this._isImageAlpha) {
Cesium.Material.PolylineTrailSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = repeat * materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.t " + this._order + " time), st.s));\n material.alpha = colorImage.a;\n material.diffuse = colorImage.rgb* 1.5 ;\n return material;\n }";
} else {
Cesium.Material.PolylineTrailSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = repeat * materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.t " + this._order + " time), st.s));\n material.alpha = colorImage.a * color.a;\n material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);\n return material;\n }";
}
} else if (this._direction === "horizontal") {
if (this._isImageAlpha) {
Cesium.Material.PolylineTrailSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = repeat * materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.s " + this._order + " time), st.t));\n material.alpha = colorImage.a;\n material.diffuse = colorImage.rgb * 1.5 ;\n return material;\n }";
} else {
Cesium.Material.PolylineTrailSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = repeat * materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.s " + this._order + " time), st.t));\n material.alpha = colorImage.a * color.a;\n material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);\n return material;\n }";
}
}
Cesium.Material._materialCache.addMaterial(Cesium.Material.PolylineTrailType, {
fabric: {
type: Cesium.Material.PolylineTrailType,
uniforms: {
color: new Cesium.Color(1, 0, 0, 0.5),
image: Cesium.Material.Polylineimage,
time: 0,
repeat: new Cesium.Cartesian2(5, 1),
order: "-"
},
source: Cesium.Material.PolylineTrailSource
},
translucent: function(material) {
return true;
}
});
}
}
PolylineDirectionMaterialProperty.prototype.getType = function(time) {
return "PolylineTrail";
};
PolylineDirectionMaterialProperty.prototype.getValue = function(time, result) {
if (!Cesium.defined(result)) {
result = {};
}
result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, this.defaultColor, result.color);
result.image = Cesium.Property.getValueOrUndefined(this._image, time);
result.time = (performance.now() - this._time) % this._duration / this._duration;
result.repeat = new Cesium.Cartesian2(this._count, 1);
result.order = this._order;
return result;
};
PolylineDirectionMaterialProperty.prototype.equals = function(other) {
return this === other || other instanceof PolylineDirectionMaterialProperty && Cesium.Property.equals(this._color, other._color);
};
Object.defineProperties(PolylineDirectionMaterialProperty.prototype, {
isConstant: {
get: function() {
return false;
}
},
definitionChanged: {
get: function() {
return this._definitionChanged;
}
},
color: Cesium.createPropertyDescriptor("color"),
image: Cesium.createPropertyDescriptor("image")
});
class WallMaterialProperty$1 {
constructor(viewer2, options2) {
this._viewer = viewer2;
options2 = options2 || {};
this._definitionChanged = new Cesium.Event();
this._color = void 0;
this.color = options2.color || Cesium.Color.BLUE;
this.duration = options2.duration || 1e3;
this.count = options2.duration || 1;
this.direction = options2.duration || "vertical";
this.order = options2.duration || "-";
this.trailImage = Cesium.defaultValue(options2.trailImage, "jt3dSDK/imgs/wallmaterial/wl.png");
this._time = new Date().getTime();
this._materialTypeName = "WallMaterial" + this._guid();
this._param = {
color: this.color._value.toCssColorString(),
image: this.trailImage,
duration: this.duration,
count: this.count,
direction: this.direction,
order: this.order
};
Cesium.Material._materialCache.addMaterial(this._materialTypeName, {
fabric: {
type: this._materialTypeName,
uniforms: {
time: -20,
color: new Cesium.Color(1, 0, 0, 0.5),
image: options2.trailImage
},
source: this._getDirectionWallShader(options2.param)
},
translucent: function(material) {
return true;
}
});
}
_guid() {
function S4() {
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
}
return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
}
getType(time) {
return this._materialTypeName;
}
getValue(time, result) {
if (!Cesium.defined(result)) {
result = {};
}
result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.BLUE, result.color);
result.image = this.trailImage;
if (this.duration) {
result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
}
this._viewer.scene.requestRender();
return result;
}
equals(other) {
return this === other || other instanceof WallMaterialProperty$1 && Cesium.Property.equals(this._color, other._color) && other._param.order === this._param.order && other._param.count === this._param.count && other._param.direction === this._param.direction && other.duration === this.duration;
}
_getDirectionWallShader(options2) {
let op = Cesium.defaultValue(options2, {});
let count = op.count !== void 0 && typeof op.count === "number" && op.count > 0 ? op.count : 1;
let direction = op.direction === "horizontal" ? "horizontal" : "vertical";
let order = op.order === "+" ? "+" : "-";
this._param.count = count;
this._param.direction = direction;
this._param.order = order;
let materail = "";
materail += "czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n";
if (direction === "vertical") {
materail += " vec4 colorImage = texture2D(image,vec2(st.s,fract(float(" + count + ")*st.t " + order + " time)));\n";
} else if (direction === "horizontal") {
materail += " vec4 colorImage = texture2D(image, vec2(fract(float(" + count + ")*st.s " + order + " time), st.t));\n";
}
materail += " vec4 fragColor;\n fragColor.rgb = color.rgb / 1.0;\n fragColor = czm_gammaCorrect(fragColor);\n material.alpha = colorImage.a * color.a;\n material.diffuse = color.rgb;\n material.emission = fragColor.rgb;\n return material;\n}";
return materail;
}
}
Object.defineProperties(WallMaterialProperty$1.prototype, {
isConstant: {
get: function() {
return false;
}
},
definitionChanged: {
get: function() {
return this._definitionChanged;
}
},
color: Cesium.createPropertyDescriptor("color")
});
class LoadMapData {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
}
_addImageryProvider(id, provider) {
window[id] = this._viewer.imageryLayers.addImageryProvider(provider);
}
_removeImageryProvider(serviceId) {
this._viewer.imageryLayers.remove(window[serviceId]);
window[serviceId] = null;
}
_addTerrainProvider(provider) {
this._viewer.terrainProvider = provider;
}
_setEllipsoidTerrain() {
this._viewer.terrainProvider = new Cesium.EllipsoidTerrainProvider({});
}
_addScenePrimitives(scenePrimitives) {
this._viewer.scene.primitives.add(scenePrimitives);
}
_removeScenePrimitives(serviceId) {
this._viewer.scene.primitives.remove(window[serviceId]);
window[serviceId] = null;
}
_guid() {
function S4() {
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
}
return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
}
_transformProjection(provider) {
let webMercatorTilingScheme = provider.tilingScheme;
let projection = webMercatorTilingScheme._projection;
projection.x_project = projection.project;
projection.project = function(cartographic) {
let point2;
return point2 = CoordTransform.WGS84ToGCJ02(
Cesium.Math.toDegrees(cartographic.longitude),
Cesium.Math.toDegrees(cartographic.latitude)
), projection.x_project(
new Cesium.Cartographic(
Cesium.Math.toRadians(point2[0]),
Cesium.Math.toRadians(point2[1])
)
);
};
projection.x_unproject = projection.unproject;
projection.unproject = function(cartesian) {
let point2, cartographic = projection.x_unproject(cartesian);
return point2 = CoordTransform.GCJ02ToWGS84(
Cesium.Math.toDegrees(cartographic.longitude),
Cesium.Math.toDegrees(cartographic.latitude)
), new Cesium.Cartographic(
Cesium.Math.toRadians(point2[0]),
Cesium.Math.toRadians(point2[1])
);
};
return provider;
}
}
Object.assign(LoadMapData.prototype, {
addTerrain(options2) {
if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
throw new Cesium.DeveloperError("options.url is required.");
}
let _ConstructorOptions = {
url: options2.url
};
if (options2.requestVertexNormals) {
_ConstructorOptions.requestVertexNormals = options2.requestVertexNormals;
} else {
_ConstructorOptions.requestVertexNormals = false;
}
if (options2.requestWaterMask) {
_ConstructorOptions.requestWaterMask = options2.requestWaterMask;
} else {
_ConstructorOptions.requestWaterMask = false;
}
var terrainProvider = new Cesium.CesiumTerrainProvider(_ConstructorOptions);
this._addTerrainProvider(terrainProvider);
this.setTerrainExaggeration(options2);
},
addMapboxLayer(options2, callSuccess) {
if (!Cesium.defined(options2) || !Cesium.defined(options2.styleId)) {
throw new Cesium.DeveloperError("options.styleId is required.");
}
if (!Cesium.defined(options2.accessToken)) {
throw new Cesium.DeveloperError("options.accessToken is required.");
}
options2.id = options2.id || this._guid();
var imageryProvider = new Cesium.MapboxStyleImageryProvider({
url: options2.url,
username: options2.username,
styleId: options2.styleId,
accessToken: options2.accessToken,
scaleFactor: options2.scaleFactor
});
this._addImageryProvider(options2.id, imageryProvider);
this.setLayersStyle({
serviceId: options2.id,
alpha: options2.alpha
});
if (callSuccess)
callSuccess(options2.id);
},
addUrlTemplateImagery: function(options2, callSuccess) {
if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
throw new Cesium.DeveloperError("options.url is required.");
}
options2.id = options2.id || this._guid();
options2.CRS = options2.CRS || "";
let _ConstructorOptions = {
url: options2.url
};
if (options2.minimumLevel) {
_ConstructorOptions.minimumLevel = options2.minimumLevel;
}
if (options2.maximumLevel) {
_ConstructorOptions.maximumLevel = options2.maximumLevel;
} else {
_ConstructorOptions.maximumLevel = 18;
}
var imageryProvider = new Cesium.UrlTemplateImageryProvider(_ConstructorOptions);
if (options2.CRS.toUpperCase() === "WGS84") {
imageryProvider.readyPromise.then(() => {
this._transformProjection(imageryProvider);
});
}
this._addImageryProvider(options2.id, imageryProvider);
this.setLayersStyle({
serviceId: options2.id,
alpha: options2.alpha
});
if (callSuccess)
callSuccess(options2.id);
},
addTileMapServiceImagery: function(options2, callSuccess) {
if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
throw new Cesium.DeveloperError("options.url is required.");
}
options2.id = options2.id || this._guid();
let _ConstructorOptions = {
url: options2.url
};
if (options2.minimumLevel) {
_ConstructorOptions.minimumLevel = options2.minimumLevel;
}
if (options2.maximumLevel) {
_ConstructorOptions.maximumLevel = options2.maximumLevel;
} else {
_ConstructorOptions.maximumLevel = 18;
}
var imageryProvider = new Cesium.TileMapServiceImageryProvider(_ConstructorOptions);
this._addImageryProvider(options2.id, imageryProvider);
this.setLayersStyle({
serviceId: options2.id,
alpha: options2.alpha
});
if (callSuccess)
callSuccess(options2.id);
},
addWebMapTileService: function(options2, callSuccess) {
if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
throw new Cesium.DeveloperError("options.url is required.");
}
if (!Cesium.defined(options2.layers)) {
throw new Cesium.DeveloperError("options.layers is required.");
}
if (!Cesium.defined(options2.style)) {
throw new Cesium.DeveloperError("options.style is required.");
}
if (!Cesium.defined(options2.tileMatrixSetID)) {
throw new Cesium.DeveloperError("options.tileMatrixSetID is required.");
}
options2.id = options2.id || this._guid();
let _ConstructorOptions = {
url: options2.url,
layer: options2.layers,
style: options2.style,
tileMatrixSetID: options2.tileMatrixSetID,
format: Cesium.defaultValue(options2.format, "image/png")
};
if (options2.tileMatrixLabels) {
_ConstructorOptions.tileMatrixLabels = options2.tileMatrixLabels;
}
if (options2.minimumLevel) {
_ConstructorOptions.minimumLevel = options2.minimumLevel;
}
if (options2.maximumLevel) {
_ConstructorOptions.maximumLevel = options2.maximumLevel;
} else {
_ConstructorOptions.maximumLevel = 18;
}
let imageryProvider = new Cesium.WebMapTileServiceImageryProvider(_ConstructorOptions);
this._addImageryProvider(options2.id, imageryProvider);
this.setLayersStyle({
serviceId: options2.id,
alpha: options2.alpha
});
if (callSuccess)
callSuccess(options2.id);
},
addWebMapService: function(options2, callSuccess) {
if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
throw new Cesium.DeveloperError("options.url is required.");
}
if (!Cesium.defined(options2.layers)) {
throw new Cesium.DeveloperError("options.layers is required.");
}
options2.id = options2.id || this._guid();
let _ConstructorOptions = {
url: options2.url,
layers: options2.layers
};
if (options2.parameters) {
_ConstructorOptions.parameters = options2.parameters;
} else {
_ConstructorOptions.parameters = {
service: "WMS",
transparent: true,
request: "GetMap",
format: "image/png"
};
}
if (options2.minimumLevel) {
_ConstructorOptions.minimumLevel = options2.minimumLevel;
}
if (options2.maximumLevel) {
_ConstructorOptions.maximumLevel = options2.maximumLevel;
} else {
_ConstructorOptions.maximumLevel = 18;
}
let imageryProvider = new Cesium.WebMapServiceImageryProvider(_ConstructorOptions);
this._addImageryProvider(options2.id, imageryProvider);
this.setLayersStyle({
serviceId: options2.id,
alpha: options2.alpha
});
if (callSuccess)
callSuccess(options2.id);
},
addArcGisMapServer: function(options2, callSuccess) {
if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
throw new Cesium.DeveloperError("options.url is required.");
}
options2.id = options2.id || this._guid();
let _ConstructorOptions = {
url: options2.url
};
if (options2.layers) {
_ConstructorOptions.layers = options2.layers;
}
let imageryProvider = new Cesium.ArcGisMapServerImageryProvider(_ConstructorOptions);
this._addImageryProvider(options2.id, imageryProvider);
this.setLayersStyle({
serviceId: options2.id,
alpha: options2.alpha
});
if (callSuccess)
callSuccess(options2.id);
},
addCesium3DTileset: function(options2, callSuccess) {
let _self = this;
if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
throw new Cesium.DeveloperError("options.url is required.");
}
options2.id = options2.id || this._guid();
let _ConstructorOptions = {
url: options2.url,
skipLevelOfDetail: true
};
let tileSetModel = new Cesium.Cesium3DTileset(_ConstructorOptions);
tileSetModel.readyPromise.then((tileset) => {
console.log("\u52A0\u8F7D\u5B8C\u6210");
window[options2.id] = tileset;
_self._addScenePrimitives(tileset);
_self.set3DTilePosition({
serviceId: options2.id,
height: options2.height
});
_self.set3DTileStyle({
serviceId: options2.id,
alpha: options2.alpha
});
if (callSuccess)
callSuccess(options2.id);
}).catch(function(error) {
console.log(error);
});
},
addCesium3DTilesetBm: function(options2, callSuccess) {
let _self = this;
if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
throw new Cesium.DeveloperError("options.url is required.");
}
options2.id = options2.id || this._guid();
let _ConstructorOptions = {
url: options2.url,
skipLevelOfDetail: true
};
let tileSetModel = new Cesium.Cesium3DTileset(_ConstructorOptions);
tileSetModel.readyPromise.then((tileset) => {
console.log("\u52A0\u8F7D\u5B8C\u6210");
window[options2.id] = tileset;
_self._addScenePrimitives(tileset);
_self.set3DTileBMStyle({
serviceId: options2.id,
color: options2.color
});
if (callSuccess)
callSuccess(options2.id);
}).catch(function(error) {
console.log(error);
});
},
addPolygonImageMaterial: function(options2, callSuccess) {
if (!Cesium.defined(options2.points)) {
throw new Cesium.DeveloperError("options.points is required.");
}
if (options2.points.length < 3) {
reject("\u9762\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C113\u4E2A");
}
let positions = [];
if (options2.points instanceof Cesium.Cartesian3) {
positions = options2.points;
} else {
positions = options2.points.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
}
options2.id = options2.id || this._guid();
options2.alpha = options2.alpha || 1;
this.classificationType = Cesium.ClassificationType.BOTH;
if (options2.classificationType === "Terrain") {
this.classificationType = Cesium.ClassificationType.TERRAIN;
} else if (options2.classificationType === "3DTiles") {
this.classificationType = Cesium.ClassificationType.CESIUM_3D_TILE;
}
if (options2.url) {
if (!Cesium.Entity.supportsMaterialsforEntitiesOnTerrain(this._viewer.scene)) {
window.alert("Terrain Entity materials are not supported on this platform");
}
this.material = new Cesium.ImageMaterialProperty({
image: options2.url,
repeat: Cesium.Cartesian2(1, 1),
transparent: true,
color: Cesium.Color.WHITE.withAlpha(options2.alpha)
});
} else {
this.material = Cesium.Color.RED.withAlpha(options2.alpha);
}
window[options2.id] = this._viewer.entities.add({
id: options2.id,
polygon: {
hierarchy: positions,
material: this.material,
classificationType: this.classificationType
}
});
if (callSuccess)
callSuccess(options2.id);
},
addEntitiesGltf: function(options2, callSuccess) {
let viewer2 = this._viewer;
if (!Cesium.defined(options2.points)) {
resolve("options.points is required.");
throw new Cesium.DeveloperError("options.points is required.");
}
if (!Cesium.defined(options2.url)) {
resolve("options.url is required.");
throw new Cesium.DeveloperError("options.url is required.");
}
options2.id = options2.id || this._guid();
options2.heading = Cesium.defaultValue(options2.heading, 0);
options2.pitch = Cesium.defaultValue(options2.pitch, 0);
options2.roll = Cesium.defaultValue(options2.roll, 0);
options2.alpha = Cesium.defaultValue(options2.alpha, 1);
let position2 = void 0;
if (options2.points instanceof Cesium.Cartesian3) {
position2 = options2.points;
} else {
position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
}
var heading = Cesium.Math.toRadians(options2.heading);
var pitch = options2.pitch;
var roll = options2.roll;
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
var modelGltf = viewer2.entities.add({
id: options2.id,
position: position2,
orientation: Cesium.Transforms.headingPitchRollQuaternion(position2, hpr),
model: {
uri: options2.url,
incrementallyLoadTextures: true,
colorBlendMode: Cesium.ColorBlendMode["HIGHLIGHT"],
colorBlendAmount: 0.1,
color: Cesium.Color.WHITE.withAlpha(options2.alpha),
imageBasedLightingFactor: new Cesium.Cartesian2(12, 13),
runAnimations: true,
show: true,
debugWireframe: false,
debugShowBoundingVolume: false
}
});
if (options2.minimumPixelSize) {
modelGltf.model.minimumPixelSize = options2.minimumPixelSize;
}
if (options2.maximumScale) {
modelGltf.model.maximumScale = options2.maximumScale;
}
if (options2.silhouetteColor) {
modelGltf.model.silhouetteColor = new Cesium.Color(options2.silhouetteColor[0] / 255, options2.silhouetteColor[1] / 255, options2.silhouetteColor[2] / 255, options2.silhouetteColor[3]);
}
window[options2.id] = modelGltf;
if (callSuccess)
callSuccess(options2.id);
},
addScenePrimitivesGltf(options2, callSuccess) {
let viewer2 = this._viewer;
if (!Cesium.defined(options2.points)) {
resolve("options.points is required.");
throw new Cesium.DeveloperError("options.points is required.");
}
if (!Cesium.defined(options2.url)) {
resolve("options.url is required.");
throw new Cesium.DeveloperError("options.url is required.");
}
options2.id = options2.id || this._guid();
options2.scale = Cesium.defaultValue(options2.scale, 1);
let position2 = void 0;
if (options2.points instanceof Cesium.Cartesian3) {
position2 = options2.points;
} else {
position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
}
const modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position2);
let model = viewer2.scene.primitives.add(
Cesium.Model.fromGltf({
show: true,
url: options2.url,
modelMatrix,
lightColor: new Cesium.Cartesian3(10, 10, 10),
scale: options2.scale,
debugWireframe: false,
debugShowBoundingVolume: false
})
);
model.readyPromise.then(function() {
var rotationX = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(0)));
Cesium.Matrix4.multiply(model.modelMatrix, rotationX, model.modelMatrix);
});
window[options2.id] = model;
if (callSuccess)
callSuccess(options2.id);
},
addPolylineByGeoJson(options2, callSuccess) {
let _self = this;
this._viewer;
if (!Cesium.defined(options2.url)) {
resolve("options.url is required.");
throw new Cesium.DeveloperError("options.url is required.");
}
options2.id = options2.id || this._guid();
options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
options2.width = Cesium.defaultValue(options2.width, 3);
options2.minHeigh = Cesium.defaultValue(options2.minHeigh, 0);
options2.maxHeigh = Cesium.defaultValue(options2.maxHeigh, 2e8);
let promise = Cesium.GeoJsonDataSource.load(options2.url, {
clampToGround: options2.clampToGround
});
promise.then((dataSource) => {
_self._viewer.dataSources.add(dataSource);
dataSource.name = options2.id;
let entities2 = dataSource.entities.values;
let material = new PolylineDirectionMaterialProperty(options2);
for (var i2 = 0; i2 < entities2.length; i2++) {
var entity = entities2[i2];
entity.polyline.material = material;
entity.polyline.width = options2.width;
if (options2.clampToGround) {
entity.polyline.clampToGround = true;
}
}
if (callSuccess)
callSuccess(options2.id);
});
},
addBillboardByGeoJson(options2, callSuccess) {
let viewer2 = this._viewer;
if (!Cesium.defined(options2.url)) {
resolve("options.url is required.");
throw new Cesium.DeveloperError("options.url is required.");
}
options2.id = options2.id || this._guid();
let billboard = options2.billboard || {};
billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
billboard.scale = Cesium.defaultValue(billboard.scale, 1);
billboard.pixelOffset = Cesium.defaultValue(billboard.pixelOffset, 0);
const dataSource = new Cesium.GeoJsonDataSource(options2.id);
dataSource.load(options2.url, {
clampToGround: true
}).then(function(data) {
viewer2.dataSources.add(data);
const entities2 = data.entities.values;
entities2.forEach((entity) => {
entity.billboard = {
image: billboard.imgUrl,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
scale: billboard.scale,
pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
disableDepthTestDistance: Number.POSITIVE_INFINITY
};
if (billboard.scaleByDistance) {
billboard.scaleByDistance.near = Cesium.defaultValue(billboard.scaleByDistance.near, 0);
billboard.scaleByDistance.nearValue = Cesium.defaultValue(billboard.scaleByDistance.nearValue, 0);
billboard.scaleByDistance.far = Cesium.defaultValue(billboard.scaleByDistance.far, 1);
billboard.scaleByDistance.farValue = Cesium.defaultValue(billboard.scaleByDistance.farValue, 0);
entity.billboard.scaleByDistance = new Cesium.NearFarScalar(billboard.scaleByDistance.near, billboard.scaleByDistance.nearValue, billboard.scaleByDistance.far, billboard.scaleByDistance.farValue);
}
if (options2.label) {
let label = options2.label || {};
label.text = Cesium.defaultValue(label.text, "");
label.textField = Cesium.defaultValue(label.textField, "");
label.font = Cesium.defaultValue(label.font, "24px Helvetica");
if (label.fillColor instanceof Array) {
label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
} else if (typeof options2.color === "string") {
label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
} else {
label.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
}
if (label.outlineColor instanceof Array) {
label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
} else if (label.outlineColor instanceof String) {
label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
} else {
label.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
label.showBackground = Cesium.defaultValue(label.showBackground, false);
if (label.backgroundColor instanceof Array) {
label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
} else if (label.backgroundColor instanceof String) {
label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
} else {
label.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
label.pixelOffset = Cesium.defaultValue(label.pixelOffset, 0);
label.scale = Cesium.defaultValue(label.scale, 1);
label.near = Cesium.defaultValue(label.near, 150);
label.nearValue = Cesium.defaultValue(label.nearValue, 1);
label.far = Cesium.defaultValue(label.far, 2400);
label.farValue = Cesium.defaultValue(label.farValue, 0);
let labelText = label.text;
if (entity.properties[label.textField]) {
labelText = entity.properties[label.textField]._value;
}
if (labelText === "") {
labelText = (i + 1).toString();
}
entity.label = {
text: labelText.toString(),
font: label.font,
fillColor: label.fillColor,
outlineColor: label.outlineColor,
outlineWidth: label.outlineWidth,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
showBackground: label.showBackground,
backgroundColor: label.backgroundColor,
backgroundPadding: new Cesium.Cartesian2(6, 6),
disableDepthTestDistance: Number.POSITIVE_INFINITY,
pixelOffset: new Cesium.Cartesian2(0, label.pixelOffset),
scale: label.scale
};
if (label.scaleByDistance) {
label.scaleByDistance.near = Cesium.defaultValue(label.scaleByDistance.near, 0);
label.scaleByDistance.nearValue = Cesium.defaultValue(label.scaleByDistance.nearValue, 0);
label.scaleByDistance.far = Cesium.defaultValue(label.scaleByDistance.far, 1);
label.scaleByDistance.farValue = Cesium.defaultValue(label.scaleByDistance.farValue, 0);
entity.label.scaleByDistance = new Cesium.NearFarScalar(label.scaleByDistance.near, label.scaleByDistance.nearValue, label.scaleByDistance.far, label.scaleByDistance.farValue);
}
}
});
if (callSuccess)
callSuccess(options2.id);
});
},
addBillboardByJson(options2, callSuccess) {
let viewer2 = this._viewer;
if (!Cesium.defined(options2.url)) {
resolve("options.url is required.");
throw new Cesium.DeveloperError("options.url is required.");
}
options2.id = options2.id || this._guid();
let billboard = options2.billboard || {};
billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
billboard.scale = Cesium.defaultValue(billboard.scale, 1);
billboard.pixelOffset = Cesium.defaultValue(billboard.pixelOffset, 0);
fetch(options2.url).then((res) => {
return res.json();
}).then((res) => {
for (var i2 = 0; i2 < res.features.length; i2++) {
let coordinates = res.features[i2].geometry.coordinates;
let position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
let Point = new Cesium.CustomDataSource(options2.id);
viewer2.dataSources.add(Point);
let entity = new Cesium.Entity({
name: "add billboard",
position: position2,
billboard: {
image: billboard.imgUrl,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
scale: billboard.scale,
pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
disableDepthTestDistance: Number.POSITIVE_INFINITY
}
});
if (billboard.scaleByDistance) {
billboard.scaleByDistance.near = Cesium.defaultValue(billboard.scaleByDistance.near, 0);
billboard.scaleByDistance.nearValue = Cesium.defaultValue(billboard.scaleByDistance.nearValue, 0);
billboard.scaleByDistance.far = Cesium.defaultValue(billboard.scaleByDistance.far, 1);
billboard.scaleByDistance.farValue = Cesium.defaultValue(billboard.scaleByDistance.farValue, 0);
entity.billboard.scaleByDistance = new Cesium.NearFarScalar(billboard.scaleByDistance.near, billboard.scaleByDistance.nearValue, billboard.scaleByDistance.far, billboard.scaleByDistance.farValue);
}
if (options2.label) {
let label = options2.label || {};
label.text = Cesium.defaultValue(label.text, "");
label.textField = Cesium.defaultValue(label.textField, "");
label.font = Cesium.defaultValue(label.font, "24px Helvetica");
if (label.fillColor instanceof Array) {
label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
} else if (typeof options2.color === "string") {
label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
} else {
label.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
}
if (label.outlineColor instanceof Array) {
label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
} else if (label.outlineColor instanceof String) {
label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
} else {
label.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
label.showBackground = Cesium.defaultValue(label.showBackground, false);
if (label.backgroundColor instanceof Array) {
label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
} else if (label.backgroundColor instanceof String) {
label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
} else {
label.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
label.pixelOffset = Cesium.defaultValue(label.pixelOffset, 0);
label.scale = Cesium.defaultValue(label.scale, 1);
label.near = Cesium.defaultValue(label.near, 150);
label.nearValue = Cesium.defaultValue(label.nearValue, 1);
label.far = Cesium.defaultValue(label.far, 2400);
label.farValue = Cesium.defaultValue(label.farValue, 0);
let labelText = label.text;
if (res.features[i2].properties[label.textField]) {
labelText = res.features[i2].properties[label.textField];
}
if (labelText === "") {
labelText = (i2 + 1).toString();
}
entity.label = {
text: labelText.toString(),
font: label.font,
fillColor: label.fillColor,
outlineColor: label.outlineColor,
outlineWidth: label.outlineWidth,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
showBackground: label.showBackground,
backgroundColor: label.backgroundColor,
backgroundPadding: new Cesium.Cartesian2(6, 6),
disableDepthTestDistance: Number.POSITIVE_INFINITY,
pixelOffset: new Cesium.Cartesian2(0, label.pixelOffset),
scale: label.scale
};
if (label.scaleByDistance) {
label.scaleByDistance.near = Cesium.defaultValue(label.scaleByDistance.near, 0);
label.scaleByDistance.nearValue = Cesium.defaultValue(label.scaleByDistance.nearValue, 0);
label.scaleByDistance.far = Cesium.defaultValue(label.scaleByDistance.far, 1);
label.scaleByDistance.farValue = Cesium.defaultValue(label.scaleByDistance.farValue, 0);
entity.label.scaleByDistance = new Cesium.NearFarScalar(label.scaleByDistance.near, label.scaleByDistance.nearValue, label.scaleByDistance.far, label.scaleByDistance.farValue);
}
}
Point.entities.add(entity);
}
if (callSuccess)
callSuccess(options2.id);
});
},
addWallByJson(options2, callSuccess) {
let viewer2 = this._viewer;
if (!Cesium.defined(options2.url)) {
resolve("options.url is required.");
throw new Cesium.DeveloperError("options.url is required.");
}
options2 = options2 || {};
options2.id = options2.id || setSessionid();
options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
options2.minimunHeights = options2.minimunHeights !== void 0 && typeof options2.minimunHeights === "number" ? options2.minimunHeights : 0;
options2.maximumHeights = options2.maximumHeights !== void 0 && typeof options2.maximumHeights === "number" ? options2.maximumHeights : 1e3;
if (options2.color) {
if (options2.color instanceof Array) {
options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
} else if (typeof options2.color === "string") {
options2.color = new Cesium.Color.fromCssColorString(options2.color);
} else {
options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
options2.trailImage = Cesium.defaultValue(options2.trailImage, "jt3dSDK/imgs/wallmaterial/wl.png");
options2.duration = Cesium.defaultValue(options2.duration, 3e3);
options2.count = Cesium.defaultValue(options2.count, 1);
options2.direction = Cesium.defaultValue(options2.direction, "vertical");
options2.order = Cesium.defaultValue(options2.order, "-");
fetch(options2.url).then((res) => {
return res.json();
}).then((res) => {
for (var i2 = 0; i2 < res.features.length; i2++) {
let coordinates = res.features[i2].geometry.coordinates;
let positions = coordinates.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
let wall = new Cesium.CustomDataSource(options2.id);
viewer2.dataSources.add(wall);
let entity = new Cesium.Entity({
name: "\u7ACB\u4F53\u5899\u6548\u679C",
wall: {
positions,
maximumHeights: new Array(positions.length).fill(options2.maximumHeights),
minimunHeights: new Array(positions.length).fill(options2.minimunHeights),
material: new WallMaterialProperty$1(viewer2, {
trailImage: options2.trailImage,
color: options2.color,
duration: options2.duration,
param: {
count: options2.count,
direction: options2.direction,
order: options2.order
}
})
}
});
wall.entities.add(entity);
}
if (callSuccess)
callSuccess(options2.id);
});
}
});
Object.assign(LoadMapData.prototype, {
set3DTileStyle(options2) {
if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
throw new Cesium.DeveloperError("options.serviceId is required.");
}
if (Cesium.defined(options2.alpha)) {
Cesium.Check.typeOf.number("alpha", options2.alpha);
}
options2.alpha = Cesium.defaultValue(options2.alpha, 1);
let tileset = window[options2.serviceId];
tileset.style = new Cesium.Cesium3DTileStyle({
color: "color('rgba(255,255,255," + options2.alpha + ")')"
});
},
set3DTileBMStyle: function(options2) {
if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
throw new Cesium.DeveloperError("options.serviceId is required.");
}
options2.color = options2.color ? "vec4(" + options2.color[0] + "/255, " + options2.color[1] + "/255, " + options2.color[2] + "/255, " + options2.color[3] + ")" : "vec4(0.0, 0.58, 0.86, 1.0)";
let tileset = window[options2.serviceId];
tileset.readyPromise.then((tileset2) => {
tileset2.boundingSphere.radius;
if (tileset2.boundingSphere.radius > 1e4) {
tileset2.boundingSphere.radius / 10;
}
tileset2.style = new Cesium.Cesium3DTileStyle({
color: options2.color
});
tileset2.tileVisible.addEventListener((tile) => {
let content = tile.content;
let featuresLength = content.featuresLength;
for (let i2 = 0; i2 < featuresLength; i2 += 2) {
const feature2 = content.getFeature(i2);
const model = feature2.content._model;
if (model && model._sourcePrograms && model._rendererResources) {
Object.keys(model._sourcePrograms).forEach((key) => {
const program = model._sourcePrograms[key];
const fragmentShader = model._rendererResources.sourceShaders[program.fragmentShader];
let vPosition = "";
if (fragmentShader.indexOf(" v_positionEC;") !== -1) {
vPosition = "v_positionEC";
} else if (fragmentShader.indexOf(" v_pos;") !== -1) {
vPosition = "v_pos";
}
const color2 = `vec4(${feature2.color.toString()})`;
model._rendererResources.sourceShaders[program.fragmentShader] = `
varying vec3 ${vPosition};
void main(void){
vec4 v_helsing_position = czm_inverseModelView * vec4(${vPosition},1);
float _baseHeight = -30.0;
float vtxf_height = v_helsing_position.z - _baseHeight;
float stc_pl = fract(czm_frameNumber / 120.0) * 3.14159265 * 2.0;
float stc_sd = vtxf_height / 30.0 + sin(stc_pl) * 0.1;
gl_FragColor = ${color2};
gl_FragColor *= vec4(stc_sd, stc_sd, stc_sd, 1.0);
/* \u626B\u63CF\u7EBF */
float glowRange = 80.0;
float stc_a13 = fract(czm_frameNumber / 460.0);
float stc_h = clamp(v_helsing_position.z / glowRange, 0.0, 1.0);
stc_a13 = abs(stc_a13 - 0.5) * 1.0;
float stc_diff = step(0.003, abs(stc_h - stc_a13));
gl_FragColor.rgb += gl_FragColor.rgb * (1.0 - stc_diff);
}
`;
});
model._shouldRegenerateShaders = true;
}
}
});
});
this._viewer.scene.requestRender();
},
set3DTilePosition: function(options2) {
if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
throw new Cesium.DeveloperError("options.serviceId is required.");
}
options2.height = Cesium.defaultValue(options2.height, 0);
let boundingSphere = window[options2.serviceId].boundingSphere;
let cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
let left = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, options2.height);
let right = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0);
let translation = Cesium.Cartesian3.subtract(left, right, new Cesium.Cartesian3());
window[options2.serviceId].modelMatrix = Cesium.Matrix4.fromTranslation(translation);
this._viewer.scene.requestRender();
},
setLayersStyle(options2) {
if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
throw new Cesium.DeveloperError("options.serviceId is required.");
}
let layer = window[options2.serviceId];
if (Cesium.defined(options2.alpha)) {
Cesium.Check.typeOf.number("alpha", options2.alpha);
}
options2.alpha = Cesium.defaultValue(options2.alpha, 1);
layer.alpha = options2.alpha;
if (Cesium.defined(options2.brightness)) {
Cesium.Check.typeOf.number("brightness", options2.brightness);
}
options2.brightness = Cesium.defaultValue(options2.brightness, 1);
layer.brightness = options2.brightness;
if (Cesium.defined(options2.contrast)) {
Cesium.Check.typeOf.number("contrast", options2.contrast);
}
options2.contrast = Cesium.defaultValue(options2.contrast, 1);
layer.contrast = options2.contrast;
if (Cesium.defined(options2.gamma)) {
Cesium.Check.typeOf.number("gamma", options2.gamma);
}
options2.gamma = Cesium.defaultValue(options2.gamma, 1);
layer.gamma = options2.gamma;
if (Cesium.defined(options2.hue)) {
Cesium.Check.typeOf.number("hue", options2.hue);
}
options2.hue = Cesium.defaultValue(options2.hue, 0);
layer.hue = options2.hue;
if (Cesium.defined(options2.saturation)) {
Cesium.Check.typeOf.number("saturation", options2.saturation);
}
options2.saturation = Cesium.defaultValue(options2.saturation, 1);
layer.saturation = options2.saturation;
},
setPolygonImageMaterial(options2) {
if (Cesium.defined(options2.alpha)) {
Cesium.Check.typeOf.number("alpha", options2.alpha);
}
options2.alpha = Cesium.defaultValue(options2.alpha, 1);
let entity = window[options2.serviceId];
entity.polygon.material.color._value.alpha = options2.alpha;
},
setModelStyle(options2) {
if (Cesium.defined(options2.alpha)) {
Cesium.Check.typeOf.number("alpha", options2.alpha);
}
options2.alpha = Cesium.defaultValue(options2.alpha, 1);
let entity = window[options2.serviceId];
if (entity.model) {
entity.model.color._value.alpha = options2.alpha;
} else {
entity.color._value.alpha = options2.alpha;
}
},
setTerrainExaggeration(options2) {
if (Cesium.defined(options2.terrainExaggeration)) {
Cesium.Check.typeOf.number("terrainExaggeration", options2.terrainExaggeration);
}
options2.terrainExaggeration = Cesium.defaultValue(options2.terrainExaggeration, 1);
this._viewer.scene.globe.terrainExaggeration = options2.terrainExaggeration;
}
});
Object.assign(LoadMapData.prototype, {
removeImageryProvider(options2) {
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
throw new Cesium.DeveloperError("options.serviceId is required.");
}
this._removeImageryProvider(options2.serviceId);
resolve2(true);
});
},
removeTerrain() {
return new Promise((resolve2, reject2) => {
this._setEllipsoidTerrain();
resolve2(true);
});
},
removeScenePrimitives(options2) {
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
throw new Cesium.DeveloperError("options.serviceId is required.");
}
this._removeScenePrimitives(options2.serviceId);
resolve2(true);
});
},
removeEntity(options2) {
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
throw new Cesium.DeveloperError("options.serviceId is required.");
}
this._viewer.entities.remove(window[options2.serviceId]);
window[options2.serviceId] = null;
resolve2(true);
});
},
removeDataSources(options2) {
let viewer2 = this._viewer;
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
throw new Cesium.DeveloperError("options.serviceId is required.");
}
let list = viewer2.dataSources.getByName(options2.serviceId);
list.forEach((res, index2) => {
viewer2.dataSources.remove(res);
if (index2 === list.length - 1) {
resolve2(true);
}
});
});
}
});
Date.prototype.Format = function(fmt) {
var o = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
"S": this.getMilliseconds()
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
return fmt;
};
class CrImageServerLayer {
constructor({
viewer: viewer2,
url,
opacity = 0.75,
show = true
} = {}) {
this._viewer = viewer2;
this._url = url;
this._opacity = opacity;
this._renderName = this._guid();
let dataSource = new Cesium.CustomDataSource(this._renderName);
this._viewer.dataSources.add(dataSource);
this._entities = dataSource.entities;
this._renderEntities = /* @__PURE__ */ new Map();
this._isUpdateTile = show;
this._isDebug = false;
this._init();
}
_init() {
let _self = this;
this._provider = new Cesium.ArcGisMapServerImageryProvider({
url: _self._url
});
this._provider.readyPromise.then(function(result) {
_self._rectangle = _self._provider.rectangle;
if (_self._isDebug)
_self._printDebug();
_self._viewer.scene.postRender.addEventListener(() => {
if (_self._isUpdateTile) {
_self._isUpdateTile = false;
_self._renderTiles();
}
});
});
}
_guid() {
function S4() {
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
}
return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
}
_printDebug() {
this._provider.tilingScheme;
let tiling84 = new Cesium.GeographicTilingScheme();
this._drawDebugRectangle(this._rectangle, Cesium.Color.GREEN);
tiling84.tileXYToRectangle(1696, 312, 10);
}
_drawDebugRectangle(rectangle, color2) {
let positions = this._calculateRectangleOutlineCoordinates(rectangle);
let rectEntity = new Cesium.Entity({
name: this._renderName,
polyline: {
positions,
material: color2,
width: 10,
clampToGround: true
}
});
this._entities.add(rectEntity);
}
_console(...rest) {
if (this._isDebug)
console.log("===" + new Date().Format("yyyy-MM-dd HH:mm:ss") + ">>>", rest);
}
_renderTiles() {
let _self = this;
let tilesToRender = this._viewer.scene.globe._surface._tilesToRender;
if (tilesToRender === void 0 || tilesToRender.length === 0) {
this._isUpdateTile = true;
return;
} else {
new Promise((resolve2, reject2) => {
tilesToRender.sort(function(obj1, obj2) {
let level1 = parseInt(obj1.level);
let level2 = parseInt(obj2.level);
return level1 - level2;
});
resolve2(tilesToRender);
}).then((tiles) => {
_self._asyncProjectionTiles(tiles);
});
}
}
_createKey(x, y, level) {
let key = `${this._renderName}_${x}_${y}_${level}`;
return key;
}
_asyncProjectionTiles(tiles) {
let renderTiles = [];
for (let tile of tiles) {
let proTiles = this._projectionTile(tile);
for (let proTile of proTiles) {
let key = this._createKey(proTile.x, proTile.y, proTile.level);
let subTile = renderTiles.find((obj) => {
return obj.x === proTile.x && obj.y === proTile.y;
});
if (subTile === void 0) {
let isExists = false;
for (let eTile of renderTiles) {
if (Cesium.Rectangle.intersection(eTile.rectangle, proTile.rectangle)) {
eTile.childTiles.push(key);
isExists = true;
break;
}
}
if (!isExists) {
renderTiles.push({
key,
x: proTile.x,
y: proTile.y,
level: proTile.level,
rectangle: proTile.rectangle,
childTiles: []
});
}
}
}
}
let i2 = renderTiles.length;
let appendTiles = [];
while (i2--) {
let findTile = renderTiles[i2];
if (findTile.childTiles.length >= 1) {
let tiles2 = this._createFourTiles(findTile);
for (let tile of tiles2) {
appendTiles.push(tile);
}
renderTiles.splice(i2, 1);
}
}
for (let appendTile of appendTiles) {
renderTiles.push(appendTile);
}
renderTiles.sort(function(obj1, obj2) {
let level1 = parseInt(obj1.level);
let level2 = parseInt(obj2.level);
return level1 - level2;
});
this._renderTilesToViewer(renderTiles);
}
_createTileByRectangleAndLevel(rectangle, level) {
let center2 = Cesium.Rectangle.center(rectangle);
let nLevel = parseInt(level) + 1;
let query = this._provider.tilingScheme.positionToTileXY(center2, nLevel);
if (query === void 0)
return void 0;
return {
key: this._createKey(query.x, query.y, nLevel),
x: query.x,
y: query.y,
level: nLevel,
rectangle,
childTiles: []
};
}
_createFourTiles(tile) {
let rects = [];
let results = [];
let rectangle = tile.rectangle;
rects.push(Cesium.Rectangle.subsection(rectangle, 0, 0, 0.5, 0.5));
rects.push(Cesium.Rectangle.subsection(rectangle, 0.5, 0, 1, 0.5));
rects.push(Cesium.Rectangle.subsection(rectangle, 0, 0.5, 0.5, 1));
rects.push(Cesium.Rectangle.subsection(rectangle, 0.5, 0.5, 1, 1));
for (let rect of rects) {
if (Cesium.Rectangle.intersection(rect, this._rectangle)) {
let newTile = this._createTileByRectangleAndLevel(rect, tile.level);
if (newTile !== void 0)
results.push(newTile);
}
}
return results;
}
_renderTilesToViewer(tiles) {
let _self = this;
let deleteKeys = [];
for (let [key, tile] of this._renderEntities) {
let findTile = tiles.find((obj) => {
return obj.key === key;
});
if (findTile === void 0) {
deleteKeys.push(key);
}
}
for (let key of deleteKeys) {
this._renderEntities.delete(key);
this._entities.removeById(key);
}
for (let tile of tiles) {
if (!this._renderEntities.has(tile.key)) {
let entity = this._renderSimpleTileToViewer(tile);
this._renderEntities.set(tile.key, entity);
let workBlob = new Blob([`(${downloadWorker.toString()})()`]);
let worker = new Worker(URL.createObjectURL(workBlob));
worker.postMessage({
key: tile.key,
url: this._url,
x: tile.x,
y: tile.y,
level: tile.level
});
worker.onmessage = function(event2) {
_self._console(`render x:${event2.data.x} y:${event2.data.y} level:${event2.data.level}`);
let renderEntity = _self._entities.getById(event2.data.key);
if (renderEntity !== void 0) {
event2.data.key;
const canvas = _self._createCanvas(event2.data, event2.data.image, _self._isDebug);
renderEntity.rectangle.material = canvas;
}
worker.terminate();
};
}
}
this._isUpdateTile = true;
}
_renderSimpleTileToViewer(tile) {
const canvas = this._createCanvas(tile, void 0, this._isDebug);
let bjPositions = this._calculateRectangleOutlineCoordinates(tile.rectangle);
let tileEntity = new Cesium.Entity({
name: this._renderName,
id: tile.key,
rectangle: {
coordinates: tile.rectangle,
material: canvas
},
polyline: {
positions: bjPositions,
material: Cesium.Color.YELLOW.withAlpha(this._isDebug ? 1 : 0),
width: 1,
clampToGround: true
}
});
return this._entities.add(tileEntity);
}
_createCanvas(tile, image, islabel) {
let provider = this._provider;
const canvas = document.createElement("canvas");
canvas.width = provider.tileWidth;
canvas.height = provider.tileHeight;
const context = canvas.getContext("2d");
if (image !== void 0) {
context.globalAlpha = this._opacity;
context.drawImage(event.data.image, 0, 0, canvas.width, canvas.height);
}
if (islabel !== void 0 && islabel === true) {
context.globalAlpha = 1;
context.font = "20px Arial";
context.textAlign = "center";
context.fillStyle = "rgba(255,255,0)";
context.strokeStyle = "rgba(255,255,255,1)";
context.lineWidth = 2;
context.strokeText(`L: ${tile.level}`, 126, 86);
context.fillText(`L: ${tile.level}`, 126, 86);
context.strokeText(`X: ${tile.x}`, 126, 136);
context.fillText(`X: ${tile.x}`, 126, 136);
context.strokeText(`Y: ${tile.y}`, 126, 186);
context.fillText(`Y: ${tile.y}`, 126, 186);
}
return canvas;
}
_projectionTile(tile) {
let rectangle = tile._rectangle;
let imageryLevel = parseInt(tile.level);
let mercatorTilingScheme = this._provider.tilingScheme;
let res = [];
let interRectangle = Cesium.Rectangle.intersection(rectangle, this._rectangle);
if (interRectangle === void 0)
return res;
let northwestTileCoordinates = mercatorTilingScheme.positionToTileXY(
Cesium.Rectangle.northwest(rectangle),
imageryLevel
);
let southeastTileCoordinates = mercatorTilingScheme.positionToTileXY(
Cesium.Rectangle.southeast(rectangle),
imageryLevel
);
if (northwestTileCoordinates !== void 0 && southeastTileCoordinates !== void 0) {
for (let i2 = northwestTileCoordinates.x; i2 <= southeastTileCoordinates.x; i2++) {
for (let j = northwestTileCoordinates.y; j <= southeastTileCoordinates.y; j++) {
let _webRectangle = mercatorTilingScheme.tileXYToRectangle(i2, j, imageryLevel);
if (Cesium.Rectangle.intersection(_webRectangle, this._rectangle)) {
res.push({
x: i2,
y: j,
level: imageryLevel,
rectangle: _webRectangle
});
}
}
}
} else if (northwestTileCoordinates !== void 0) {
let _webRectangle = mercatorTilingScheme.tileXYToRectangle(
northwestTileCoordinates.x,
northwestTileCoordinates.y,
imageryLevel
);
if (Cesium.Rectangle.intersection(_webRectangle, this._rectangle)) {
res.push({
x: northwestTileCoordinates.x,
y: northwestTileCoordinates.y,
level: imageryLevel,
rectangle: _webRectangle
});
}
} else if (southeastTileCoordinates !== void 0) {
let _webRectangle = mercatorTilingScheme.tileXYToRectangle(
southeastTileCoordinates.x,
southeastTileCoordinates.y,
imageryLevel
);
if (Cesium.Rectangle.intersection(_webRectangle, this._rectangle)) {
res.push({
x: southeastTileCoordinates.x,
y: southeastTileCoordinates.y,
level: imageryLevel,
rectangle: _webRectangle
});
}
}
return res;
}
_calculateRectangleOutlineCoordinates(rectangle) {
let south_east = Cesium.Rectangle.southeast(rectangle);
let se2 = Cesium.Cartographic.toCartesian(south_east);
let south_west = Cesium.Rectangle.southwest(rectangle);
let sw = Cesium.Cartographic.toCartesian(south_west);
let north_east = Cesium.Rectangle.northeast(rectangle);
let ne2 = Cesium.Cartographic.toCartesian(north_east);
let north_west = Cesium.Rectangle.northwest(rectangle);
let nw = Cesium.Cartographic.toCartesian(north_west);
return [sw, se2, ne2, nw, sw];
}
_removeEntityByName(entityName) {
var entities2 = this._entities;
if (!entities2 || !entities2.values)
return;
var delEntitys = [];
for (var i2 = 0; i2 < entities2.values.length; i2++) {
if (entities2.values[i2].name == entityName) {
delEntitys.push(entities2.values[i2]);
}
}
for (var i2 = 0; i2 < delEntitys.length; i2++) {
entities2.remove(delEntitys[i2]);
}
}
}
Object.assign(CrImageServerLayer.prototype, {
hide: function() {
this._console("\u9690\u85CF");
this._isUpdateTile = false;
this._removeEntityByName(this._renderName);
this._renderEntities.clear();
},
show: function() {
this._console("\u663E\u793A");
this._isUpdateTile = true;
},
setOpacity: function(opacity) {
if (opacity === void 0 || typeof opacity !== "number")
return;
if (opacity >= 1)
this._opacity = 1;
if (opacity <= 0)
this._opacity = 0;
this._opacity = parseFloat(opacity);
}
});
function downloadWorker() {
onmessage = function(event2) {
let data = event2.data;
let url = data.url + "/tile/" + data.level + "/" + data.y + "/" + data.x;
let xhr = new XMLHttpRequest();
xhr.open("get", url, true);
xhr.responseType = "blob";
xhr.onload = function() {
if (this.status === 200) {
var blob = this.response;
var bmpPromise = createImageBitmap(blob, {
imageOrientation: "none",
premultiplyAlpha: "none",
colorSpaceConversion: "default"
});
bmpPromise.then(function(image) {
let outObj = {
key: data.key,
x: data.x,
y: data.y,
level: data.level,
image
};
postMessage(outObj);
});
} else {
console.log("===>>>", url + " Not found");
}
};
xhr.send();
};
}
class LocateUtil {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
this._locationEntity = null;
}
}
Object.assign(LocateUtil.prototype, {
flyToPoint: function(options2) {
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(options2) || !Cesium.defined(options2.longitude) || !Cesium.defined(options2.latitude)) {
throw new Cesium.DeveloperError("options.longitude and options.latitude are required.");
}
options2.height = Cesium.defaultValue(options2.height, 0);
options2.heading = Cesium.defaultValue(options2.heading, 0);
options2.pitch = Cesium.defaultValue(options2.pitch, -90);
options2.range = Cesium.defaultValue(options2.range, 0);
options2.duration = Cesium.defaultValue(options2.duration, 3);
var boundingSphere = new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(options2.longitude, options2.latitude, options2.height), 0);
this._viewer.camera.flyToBoundingSphere(boundingSphere, {
duration: options2.duration,
complete: function() {
resolve2(true);
},
offset: {
heading: Cesium.Math.toRadians(options2.heading),
pitch: Cesium.Math.toRadians(options2.pitch),
range: options2.range
}
});
});
},
flyToEntityByPoints: function(points2, type2, options2) {
return new Promise((resolve2, reject2) => {
let _self = this;
options2 = options2 || {};
if (points2 === void 0 || points2.length === void 0) {
reject2("\u8F93\u5165\u7684\u5750\u6807\u96C6\u5408\u5F02\u5E38\uFF01");
return;
}
let pointsArray = points2.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
if (_self._locationEntity) {
_self._viewer.entities.remove(_self._locationEntity);
}
switch (type2) {
case "point":
_self._locationEntity = _self._viewer.entities.add({
position: pointsArray[0],
point: {
pixelSize: 1
}
});
break;
case "polyline":
if (pointsArray.length < 2) {
reject2("\u7EBF\u5BF9\u8C61\u5B9A\u4F4D\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
} else {
_self._locationEntity = _self._viewer.entities.add({
polyline: {
positions: pointsArray,
clampToGround: true,
material: new Cesium.Color(255, 0, 0, 0.5),
width: 1
}
});
}
break;
case "polygon":
if (pointsArray.length < 3) {
reject2("\u9762\u5BF9\u8C61\u5B9A\u4F4D\uFF0C\u70B9\u6570\u81F3\u5C113\u4E2A");
} else {
_self._locationEntity = _self._viewer.entities.add({
polygon: {
hierarchy: {
positions: pointsArray
},
material: new Cesium.Color(255, 0, 0, 0.5),
outline: true
}
});
}
break;
default:
reject2("\u5750\u6807\u5F02\u5E38\uFF01");
break;
}
options2.duration = Cesium.defaultValue(options2.duration, 3);
options2.heading = Cesium.defaultValue(options2.heading, 0);
options2.pitch = Cesium.defaultValue(options2.pitch, -90);
options2.range = Cesium.defaultValue(options2.range, 0);
let flyPromise = _self._viewer.flyTo(_self._locationEntity, {
duration: options2.duration,
offset: {
heading: Cesium.Math.toRadians(options2.heading),
pitch: Cesium.Math.toRadians(options2.pitch),
range: options2.range
}
});
flyPromise.then(function(flag) {
if (flag) {
resolve2(_self._locationEntity);
}
});
});
},
flyToEntity: function(entity, options2) {
return new Promise((resolve2, reject2) => {
let _self = this;
options2 = options2 || {};
if (_self._locationEntity) {
_self._viewer.entities.remove(_self._locationEntity);
}
_self._locationEntity = entity;
options2.duration = Cesium.defaultValue(options2.duration, 3);
options2.heading = Cesium.defaultValue(options2.heading, 0);
options2.pitch = Cesium.defaultValue(options2.pitch, -90);
options2.range = Cesium.defaultValue(options2.range, 0);
let flyPromise = _self._viewer.flyTo(_self._locationEntity, {
duration: options2.duration,
offset: {
heading: Cesium.Math.toRadians(options2.heading),
pitch: Cesium.Math.toRadians(options2.pitch),
range: options2.range
}
});
flyPromise.then(function(flag) {
if (flag) {
resolve2(_self._locationEntity);
}
});
});
},
zoomToTilesets(tileset, options2) {
return new Promise((resolve2, reject2) => {
let _self = this;
if (!Cesium.defined(tileset)) {
throw new Cesium.DeveloperError("tileset is required.");
}
options2 = options2 || {};
options2.heading = Cesium.defaultValue(options2.heading, 120);
options2.pitch = Cesium.defaultValue(options2.pitch, -10);
options2.range = Cesium.defaultValue(options2.range, 450);
options2.duration = Cesium.defaultValue(options2.duration, 3);
let boundingSphere = tileset.boundingSphere;
_self._viewer.camera.flyToBoundingSphere(boundingSphere, {
duration: options2.duration,
complete: function() {
resolve2(true);
},
offset: {
heading: Cesium.Math.toRadians(options2.heading),
pitch: Cesium.Math.toRadians(options2.pitch),
range: options2.range
}
});
});
},
flyToTileset(tileset, options2) {
return new Promise((resolve2, reject2) => {
let _self = this;
if (!Cesium.defined(tileset)) {
throw new Cesium.DeveloperError("tileset is required.");
}
options2 = options2 || {};
options2.heading = Cesium.defaultValue(options2.heading, 120);
options2.pitch = Cesium.defaultValue(options2.pitch, -10);
options2.range = Cesium.defaultValue(options2.range, 450);
options2.duration = Cesium.defaultValue(options2.duration, 3);
let flyPromise = _self._viewer.flyTo(tileset, {
duration: options2.duration,
offset: {
heading: Cesium.Math.toRadians(options2.heading),
pitch: Cesium.Math.toRadians(options2.pitch),
range: options2.range
}
});
flyPromise.then(function(flag) {
if (flag) {
resolve2(true);
}
});
});
}
});
const CreateRemindertip = function(arr, position2, show) {
let tooltip2 = document.getElementById("toolTip");
let style, _x, _y, _color;
if (arr && typeof arr === "object") {
style = arr;
}
if (style && style.origin) {
style.origin === "center" && (_x = 15, _y = -12);
style.origin === "top" && (_x = 15, _y = -44);
style.origin === "bottom" && (_x = 15, _y = 20);
} else {
_x = 15, _y = 20;
}
if (style && style.color) {
style.color === "white" && (_color = "background: rgba(255, 255, 255, 0.8);color: black;");
style.color === "black" && (_color = "background: rgba(0, 0, 0, 0.65);color: white;");
style.color === "yellow" && (_color = "color: black;background-color: #ffcc33;border: 1px solid white;");
} else {
_color = "background: rgba(0, 0, 0, 0.65);color: white;";
}
if (!tooltip2) {
const viewerDom = document.getElementsByClassName("cesium-viewer")[0];
let elementbottom = document.createElement("div");
viewerDom.append(elementbottom);
let html = '
';
viewerDom.insertAdjacentHTML("beforeend", html);
tooltip2 = document.getElementById("toolTip");
}
if (show) {
tooltip2.innerHTML = arr;
tooltip2.style.left = position2.x + _x + "px";
tooltip2.style.top = position2.y + _y + "px";
tooltip2.style.display = "block";
} else {
tooltip2.style.display = "none";
}
return {
tooltip: tooltip2,
style,
showAt: function(position3, text) {
this.tooltip.innerHTML = text;
if (this.style && this.style.origin) {
this.style.origin === "center" && (_x = 15, _y = -this.tooltip.offsetHeight / 2);
this.style.origin === "top" && (_x = 15, _y = -this.tooltip.offsetHeight - 20);
this.style.origin === "bottom" && (_x = 15, _y = 20);
} else {
_x = 15, _y = -this.tooltip.offsetHeight / 2;
}
this.tooltip.style.left = position3.x + _x + "px";
this.tooltip.style.top = position3.y + _y + "px";
this.tooltip.style.display = "block";
},
show: function(show2) {
if (show2) {
this.tooltip.style.display = "block";
} else {
this.tooltip.style.display = "none";
}
}
};
};
class SightLine {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
this._resultObject = {
viewPoint: void 0,
targetPoints: [],
targetPoint: void 0,
objectExclude: [],
entities: []
};
}
_distance(point1, point2) {
let point1cartographic = Cesium.Cartographic.fromCartesian(point1);
let point2cartographic = Cesium.Cartographic.fromCartesian(point2);
let geodesic = new Cesium.EllipsoidGeodesic();
geodesic.setEndPoints(point1cartographic, point2cartographic);
let s = geodesic.surfaceDistance;
s = Math.sqrt(
Math.pow(s, 2) + Math.pow(point2cartographic.height - point1cartographic.height, 2)
);
return s;
}
_checkAppOrWeb() {
if (window.navigator.userAgent.match(
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
)) {
return SightLine.RuntimeEnvironment.App;
} else {
return SightLine.RuntimeEnvironment.Web;
}
}
_isRuntimeApp() {
if (this._checkAppOrWeb() === SightLine.RuntimeEnvironment.App) {
return true;
}
return false;
}
_isRuntimeWeb() {
if (this._checkAppOrWeb() === SightLine.RuntimeEnvironment.Web) {
return true;
}
return false;
}
_createOperationMainDom() {
let buttonDiv = document.createElement("div");
buttonDiv.id = "drawButtonDiv";
buttonDiv.style.width = "80px";
buttonDiv.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
buttonDiv.style.borderRadius = "5px";
buttonDiv.style.display = "flex";
buttonDiv.style.flexDirection = "column";
buttonDiv.style.padding = "8px";
buttonDiv.style.justifyContent = "center";
buttonDiv.style.position = "absolute";
buttonDiv.style.bottom = "150px";
buttonDiv.style.right = "10px";
let btnCompletion = document.createElement("button");
btnCompletion.id = "btnDrawComplete";
btnCompletion.style.height = "30px";
btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
btnCompletion.style.color = "rgb(255, 255, 255)";
btnCompletion.style.border = "0px solid red";
btnCompletion.style.borderRadius = "5px";
btnCompletion.innerHTML = "\u5B8C\u6210";
btnCompletion.style.fontSize = "13px";
btnCompletion.style.cursor = "pointer";
buttonDiv.appendChild(btnCompletion);
document.body.appendChild(buttonDiv);
}
_showTooltipMessage(message) {
let msgMainDom = document.getElementById("messageMainDom");
if (msgMainDom !== null && msgMainDom !== void 0) {
document.body.removeChild(msgMainDom);
}
msgMainDom = document.createElement("div");
msgMainDom.style.width = "30%";
msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
msgMainDom.style.height = "45px";
msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
msgMainDom.style.borderRadius = "8px";
msgMainDom.style.display = "flex";
msgMainDom.style.alignItems = "center";
msgMainDom.style.paddingLeft = "10px";
msgMainDom.style.color = "rgb(91, 188, 48)";
msgMainDom.style.fontSize = "14px";
msgMainDom.style.fontWeight = "600";
msgMainDom.style.position = "absolute";
msgMainDom.style.left = "35%";
msgMainDom.style.transition = "transform 1s";
msgMainDom.style.transform = "translateY(-90px)";
msgMainDom.style.top = "0px";
msgMainDom.style.zIndex = 1e3;
document.body.appendChild(msgMainDom);
let strHtml = "";
strHtml += "✓
";
strHtml += "" + message + "
";
msgMainDom.innerHTML = strHtml;
msgMainDom.addEventListener("transitionend", function() {
setTimeout(function() {
document.body.removeChild(msgMainDom);
}, 1e3);
}, false);
setTimeout(function() {
msgMainDom.style.transform = "translateY(50px)";
}, 100);
}
}
Object.assign(SightLine.prototype, {
startSightLine() {
let _self = this;
_self.clearAll();
let toolTip = "\u5DE6\u952E\u5355\u51FB\u521B\u5EFA\u89C6\u89D2\u8D77\u70B9";
if (this._isRuntimeApp()) {
toolTip = "\u5355\u51FB\u521B\u5EFA\u89C6\u89D2\u8D77\u70B9";
_self._showTooltipMessage(toolTip);
}
_self.handler = new Cesium.ScreenSpaceEventHandler(_self._viewer.canvas);
_self.handler.setInputAction((event2) => {
let loc2 = CoordTransform._transfromFromScreenPoint(_self._viewer, event2.position);
toolTip = "\u5DE6\u952E\u521B\u5EFA\u89C6\u89D2\u7EC8\u70B9\uFF0C\u53F3\u952E\u7ED3\u675F\u901A\u89C6\u5206\u6790";
if (this._isRuntimeApp()) {
toolTip = "\u518D\u6B21\u5355\u51FB\u521B\u5EFA\u89C6\u89D2\u7EC8\u70B9";
_self._showTooltipMessage(toolTip);
}
if (!Cesium.defined(loc2.sLocation))
return;
let cartesian = loc2.sLocation;
if (!_self._resultObject.viewPoint) {
_self._resultObject.viewPoint = cartesian;
let pointEntity = _self._viewer.entities.add({
position: cartesian,
point: {
color: Cesium.Color.YELLOW,
pixelSize: 5
},
label: {
text: "\u89C2\u5BDF\u4F4D\u7F6E",
font: "12px sans-serif",
fillColor: new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1),
outlineColor: new Cesium.Color(0, 154 / 255, 94 / 255, 1),
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
outlineWidth: 1,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
pixelOffset: new Cesium.Cartesian2(0, -28),
showBackground: true,
backgroundColor: new Cesium.Color(0, 0, 0, 0.6),
disableDepthTestDistance: Number.POSITIVE_INFINITY
}
});
_self._resultObject.objectExclude.push(pointEntity);
_self._resultObject.entities.push(pointEntity);
} else {
_self._resultObject.targetPoint = cartesian;
let pointEntity = _self._viewer.entities.add({
position: cartesian,
point: {
color: Cesium.Color.YELLOW,
pixelSize: 5
},
label: {
text: "\u76EE\u6807\u4F4D\u7F6E",
font: "12px sans-serif",
fillColor: new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1),
outlineColor: new Cesium.Color(0, 154 / 255, 94 / 255, 1),
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
outlineWidth: 1,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
pixelOffset: new Cesium.Cartesian2(0, -28),
showBackground: true,
backgroundColor: new Cesium.Color(0, 0, 0, 0.6),
disableDepthTestDistance: Number.POSITIVE_INFINITY
}
});
_self._resultObject.objectExclude.push(pointEntity);
_self._resultObject.entities.push(pointEntity);
let direction = Cesium.Cartesian3.normalize(
Cesium.Cartesian3.subtract(
_self._resultObject.targetPoint,
_self._resultObject.viewPoint,
new Cesium.Cartesian3()
),
new Cesium.Cartesian3()
);
let ray = new Cesium.Ray(_self._resultObject.viewPoint, direction);
let result = _self._viewer.scene.pickFromRay(ray, _self._resultObject.objectExclude);
if (result) {
let dis0 = _self._distance(
_self._resultObject.viewPoint,
_self._resultObject.targetPoint
);
let dis1 = _self._distance(
_self._resultObject.viewPoint,
result.position
);
let dis2 = _self._distance(
result.position,
_self._resultObject.targetPoint
);
console.log(dis0, dis1, dis2);
if (dis0 > dis1) {
let _poly0 = _self._viewer.entities.add({
polyline: {
positions: [_self._resultObject.viewPoint, result.position],
material: Cesium.Color.GREEN,
width: 3
}
});
_self._resultObject.entities.push(_poly0);
let _poly1 = _self._viewer.entities.add({
polyline: {
positions: [result.position, _self._resultObject.targetPoint],
material: Cesium.Color.RED,
width: 3
}
});
_self._resultObject.entities.push(_poly1);
_self._resultObject.targetPoints.push({
targetPoint: cartesian,
visual: false,
distance: [dis0, dis1, dis2]
});
} else {
let _poly2 = _self._viewer.entities.add({
polyline: {
positions: [
_self._resultObject.viewPoint,
_self._resultObject.targetPoint
],
material: Cesium.Color.GREEN,
width: 3
}
});
_self._resultObject.entities.push(_poly2);
_self._resultObject.targetPoints.push({
targetPoint: cartesian,
visual: true,
distance: [dis0, dis1, dis2]
});
}
}
}
if (_self._resultObject.objectExclude.length === 2) {
if (this._isRuntimeApp()) {
_self._createOperationMainDom();
document.getElementById("btnDrawComplete").onclick = () => {
CreateRemindertip(toolTip, event2.endPosition, false);
_self.handler.destroy();
let buttonDiv = document.getElementById("drawButtonDiv");
if (buttonDiv) {
document.body.removeChild(buttonDiv);
}
};
}
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
_self.handler.setInputAction(function(move) {
if (_self._isRuntimeApp())
return;
CreateRemindertip(toolTip, move.endPosition, true);
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
_self.handler.setInputAction((event2) => {
CreateRemindertip(toolTip, event2.endPosition, false);
_self.handler.destroy();
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
},
clearAll() {
this._resultObject.entities.forEach((element) => {
this._viewer.entities.remove(element);
});
this._resultObject = {
viewPoint: void 0,
targetPoints: [],
targetPoint: void 0,
objectExclude: [],
entities: []
};
if (this.handler) {
this.handler.destroy();
}
let buttonDiv = document.getElementById("drawButtonDiv");
if (buttonDiv) {
document.body.removeChild(buttonDiv);
}
}
});
SightLine.RuntimeEnvironment = Object.freeze({
App: "app",
Web: "web"
});
/*!
* author: [object Object]
* @sakitam-gis/kriging v0.1.0
* build-time: 2019-7-6 20:41
* LICENSE: MIT
* (c) 2019-2019 https://github.com/sakitam-gis/kriging.js
*/
function max(source) {
return Math.max.apply(null, source);
}
function min(source) {
return Math.min.apply(null, source);
}
function rep(source, n) {
var array = [];
for (var i2 = 0; i2 < n; i2++) {
array.push(source);
}
return array;
}
function pip(source, x, y) {
var i2 = 0;
var j = source.length - 1;
var c = false;
var length = source.length;
for (; i2 < length; j = i2++) {
if (source[i2][1] > y !== source[j][1] > y && x < (source[j][0] - source[i2][0]) * (y - source[i2][1]) / (source[j][1] - source[i2][1]) + source[i2][0]) {
c = !c;
}
}
return c;
}
function matrixDiag(c, n) {
var i2 = 0;
var Z2 = rep(0, n * n);
for (; i2 < n; i2++) {
Z2[i2 * n + i2] = c;
}
return Z2;
}
function matrixTranspose(X2, n, m) {
var i2 = 0;
var j;
var Z2 = Array(m * n);
for (; i2 < n; i2++) {
j = 0;
for (; j < m; j++) {
Z2[j * n + i2] = X2[i2 * m + j];
}
}
return Z2;
}
function matrixAdd(X2, Y, n, m) {
var i2 = 0;
var j;
var Z2 = Array(n * m);
for (; i2 < n; i2++) {
j = 0;
for (; j < m; j++) {
Z2[i2 * m + j] = X2[i2 * m + j] + Y[i2 * m + j];
}
}
return Z2;
}
function matrixMultiply(X2, Y, n, m, p) {
var i2 = 0;
var j;
var k;
var Z2 = Array(n * p);
for (; i2 < n; i2++) {
j = 0;
for (; j < p; j++) {
Z2[i2 * p + j] = 0;
k = 0;
for (; k < m; k++) {
Z2[i2 * p + j] += X2[i2 * m + k] * Y[k * p + j];
}
}
}
return Z2;
}
function matrixChol(X2, n) {
var i2;
var j;
var k;
var p = Array(n);
for (i2 = 0; i2 < n; i2++)
p[i2] = X2[i2 * n + i2];
for (i2 = 0; i2 < n; i2++) {
for (j = 0; j < i2; j++)
p[i2] -= X2[i2 * n + j] * X2[i2 * n + j];
if (p[i2] <= 0)
return false;
p[i2] = Math.sqrt(p[i2]);
for (j = i2 + 1; j < n; j++) {
for (k = 0; k < i2; k++)
X2[j * n + i2] -= X2[j * n + k] * X2[i2 * n + k];
X2[j * n + i2] /= p[i2];
}
}
for (i2 = 0; i2 < n; i2++)
X2[i2 * n + i2] = p[i2];
return true;
}
function matrixChol2inv(X2, n) {
var i2;
var j;
var k;
var sum;
for (i2 = 0; i2 < n; i2++) {
X2[i2 * n + i2] = 1 / X2[i2 * n + i2];
for (j = i2 + 1; j < n; j++) {
sum = 0;
for (k = i2; k < j; k++)
sum -= X2[j * n + k] * X2[k * n + i2];
X2[j * n + i2] = sum / X2[j * n + j];
}
}
for (i2 = 0; i2 < n; i2++)
for (j = i2 + 1; j < n; j++)
X2[i2 * n + j] = 0;
for (i2 = 0; i2 < n; i2++) {
X2[i2 * n + i2] *= X2[i2 * n + i2];
for (k = i2 + 1; k < n; k++)
X2[i2 * n + i2] += X2[k * n + i2] * X2[k * n + i2];
for (j = i2 + 1; j < n; j++)
for (k = j; k < n; k++)
X2[i2 * n + j] += X2[k * n + i2] * X2[k * n + j];
}
for (i2 = 0; i2 < n; i2++)
for (j = 0; j < i2; j++)
X2[i2 * n + j] = X2[j * n + i2];
}
function matrixSolve(X2, n) {
var m = n;
var b = Array(n * n);
var indxc = Array(n);
var indxr = Array(n);
var ipiv = Array(n);
var i2;
var icol = 0;
var irow = 0;
var j;
var k;
var l;
var ll;
var big;
var dum;
var pivinv;
var temp;
for (i2 = 0; i2 < n; i2++) {
for (j = 0; j < n; j++) {
if (i2 === j)
b[i2 * n + j] = 1;
else
b[i2 * n + j] = 0;
}
}
for (j = 0; j < n; j++)
ipiv[j] = 0;
for (i2 = 0; i2 < n; i2++) {
big = 0;
for (j = 0; j < n; j++) {
if (ipiv[j] !== 1) {
for (k = 0; k < n; k++) {
if (ipiv[k] === 0) {
if (Math.abs(X2[j * n + k]) >= big) {
big = Math.abs(X2[j * n + k]);
irow = j;
icol = k;
}
}
}
}
}
++ipiv[icol];
if (irow !== icol) {
for (l = 0; l < n; l++) {
temp = X2[irow * n + l];
X2[irow * n + l] = X2[icol * n + l];
X2[icol * n + l] = temp;
}
for (l = 0; l < m; l++) {
temp = b[irow * n + l];
b[irow * n + l] = b[icol * n + l];
b[icol * n + l] = temp;
}
}
indxr[i2] = irow;
indxc[i2] = icol;
if (X2[icol * n + icol] === 0)
return false;
pivinv = 1 / X2[icol * n + icol];
X2[icol * n + icol] = 1;
for (l = 0; l < n; l++)
X2[icol * n + l] *= pivinv;
for (l = 0; l < m; l++)
b[icol * n + l] *= pivinv;
for (ll = 0; ll < n; ll++) {
if (ll !== icol) {
dum = X2[ll * n + icol];
X2[ll * n + icol] = 0;
for (l = 0; l < n; l++)
X2[ll * n + l] -= X2[icol * n + l] * dum;
for (l = 0; l < m; l++)
b[ll * n + l] -= b[icol * n + l] * dum;
}
}
}
for (l = n - 1; l >= 0; l--) {
if (indxr[l] !== indxc[l]) {
for (k = 0; k < n; k++) {
temp = X2[k * n + indxr[l]];
X2[k * n + indxr[l]] = X2[k * n + indxc[l]];
X2[k * n + indxc[l]] = temp;
}
}
}
return true;
}
function variogramGaussian(h2, nugget, range3, sill, A) {
return nugget + (sill - nugget) / range3 * (1 - Math.exp(-(1 / A) * Math.pow(h2 / range3, 2)));
}
function variogramExponential(h2, nugget, range3, sill, A) {
return nugget + (sill - nugget) / range3 * (1 - Math.exp(-(1 / A) * (h2 / range3)));
}
function variogramSpherical(h2, nugget, range3, sill) {
if (h2 > range3)
return nugget + (sill - nugget) / range3;
return nugget + (sill - nugget) / range3 * (1.5 * (h2 / range3) - 0.5 * Math.pow(h2 / range3, 3));
}
function train(t2, x, y, model, sigma2, alpha) {
var variogram = {
t: t2,
x,
y,
nugget: 0,
range: 0,
sill: 0,
A: 1 / 3,
n: 0,
model: variogramExponential,
K: [],
M: []
};
switch (model) {
case "gaussian":
variogram.model = variogramGaussian;
break;
case "exponential":
variogram.model = variogramExponential;
break;
case "spherical":
variogram.model = variogramSpherical;
break;
default:
variogram.model = variogramExponential;
}
var i2;
var j;
var k;
var l;
var n = t2.length;
var distance2 = Array((n * n - n) / 2);
for (i2 = 0, k = 0; i2 < n; i2++) {
for (j = 0; j < i2; j++, k++) {
distance2[k] = Array(2);
distance2[k][0] = Math.pow(Math.pow(x[i2] - x[j], 2) + Math.pow(y[i2] - y[j], 2), 0.5);
distance2[k][1] = Math.abs(t2[i2] - t2[j]);
}
}
distance2.sort(function(a, b) {
return a[0] - b[0];
});
variogram.range = distance2[(n * n - n) / 2 - 1][0];
var lags = (n * n - n) / 2 > 30 ? 30 : (n * n - n) / 2;
var tolerance = variogram.range / lags;
var lag = rep(0, lags);
var semi = rep(0, lags);
if (lags < 30) {
for (l = 0; l < lags; l++) {
lag[l] = distance2[l][0];
semi[l] = distance2[l][1];
}
} else {
for (i2 = 0, j = 0, k = 0, l = 0; i2 < lags && j < (n * n - n) / 2; i2++, k = 0) {
while (distance2[j][0] <= (i2 + 1) * tolerance) {
lag[l] += distance2[j][0];
semi[l] += distance2[j][1];
j++;
k++;
if (j >= (n * n - n) / 2)
break;
}
if (k > 0) {
lag[l] /= k;
semi[l] /= k;
l++;
}
}
if (l < 2)
return variogram;
}
n = l;
variogram.range = lag[n - 1] - lag[0];
var X2 = rep(1, 2 * n);
var Y = Array(n);
var A = variogram.A;
for (i2 = 0; i2 < n; i2++) {
switch (model) {
case "gaussian":
X2[i2 * 2 + 1] = 1 - Math.exp(-(1 / A) * Math.pow(lag[i2] / variogram.range, 2));
break;
case "exponential":
X2[i2 * 2 + 1] = 1 - Math.exp(-(1 / A) * lag[i2] / variogram.range);
break;
case "spherical":
X2[i2 * 2 + 1] = 1.5 * (lag[i2] / variogram.range) - 0.5 * Math.pow(lag[i2] / variogram.range, 3);
break;
}
Y[i2] = semi[i2];
}
var Xt2 = matrixTranspose(X2, n, 2);
var Z2 = matrixMultiply(Xt2, X2, 2, n, 2);
Z2 = matrixAdd(Z2, matrixDiag(1 / alpha, 2), 2, 2);
var cloneZ = Z2.slice(0);
if (matrixChol(Z2, 2)) {
matrixChol2inv(Z2, 2);
} else {
matrixSolve(cloneZ, 2);
Z2 = cloneZ;
}
var W2 = matrixMultiply(matrixMultiply(Z2, Xt2, 2, 2, n), Y, 2, n, 1);
variogram.nugget = W2[0];
variogram.sill = W2[1] * variogram.range + variogram.nugget;
variogram.n = x.length;
n = x.length;
var K2 = Array(n * n);
for (i2 = 0; i2 < n; i2++) {
for (j = 0; j < i2; j++) {
K2[i2 * n + j] = variogram.model(Math.pow(Math.pow(x[i2] - x[j], 2) + Math.pow(y[i2] - y[j], 2), 0.5), variogram.nugget, variogram.range, variogram.sill, variogram.A);
K2[j * n + i2] = K2[i2 * n + j];
}
K2[i2 * n + i2] = variogram.model(0, variogram.nugget, variogram.range, variogram.sill, variogram.A);
}
var C2 = matrixAdd(K2, matrixDiag(sigma2, n), n, n);
var cloneC = C2.slice(0);
if (matrixChol(C2, n)) {
matrixChol2inv(C2, n);
} else {
matrixSolve(cloneC, n);
C2 = cloneC;
}
var K1 = C2.slice(0);
var M = matrixMultiply(C2, t2, n, n, 1);
variogram.K = K1;
variogram.M = M;
return variogram;
}
function predict(x, y, variogram) {
var i2;
var k = Array(variogram.n);
for (i2 = 0; i2 < variogram.n; i2++) {
k[i2] = variogram.model(Math.pow(Math.pow(x - variogram.x[i2], 2) + Math.pow(y - variogram.y[i2], 2), 0.5), variogram.nugget, variogram.range, variogram.sill, variogram.A);
}
return matrixMultiply(k, variogram.M, 1, variogram.n, 1)[0];
}
function variance(x, y, variogram) {
var i2;
var k = Array(variogram.n);
for (i2 = 0; i2 < variogram.n; i2++) {
k[i2] = variogram.model(Math.pow(Math.pow(x - variogram.x[i2], 2) + Math.pow(y - variogram.y[i2], 2), 0.5), variogram.nugget, variogram.range, variogram.sill, variogram.A);
}
var val = matrixMultiply(matrixMultiply(k, variogram.K, 1, variogram.n, variogram.n), k, 1, variogram.n, 1)[0];
return variogram.model(0, variogram.nugget, variogram.range, variogram.sill, variogram.A) + val;
}
function grid(polygons2, variogram, width2) {
var i2;
var j;
var k;
var n = polygons2.length;
if (n === 0)
return;
var xlim = [polygons2[0][0][0], polygons2[0][0][0]];
var ylim = [polygons2[0][0][1], polygons2[0][0][1]];
for (i2 = 0; i2 < n; i2++) {
for (j = 0; j < polygons2[i2].length; j++) {
if (polygons2[i2][j][0] < xlim[0])
xlim[0] = polygons2[i2][j][0];
if (polygons2[i2][j][0] > xlim[1])
xlim[1] = polygons2[i2][j][0];
if (polygons2[i2][j][1] < ylim[0])
ylim[0] = polygons2[i2][j][1];
if (polygons2[i2][j][1] > ylim[1])
ylim[1] = polygons2[i2][j][1];
}
}
var xtarget;
var ytarget;
var a = Array(2);
var b = Array(2);
var lxlim = Array(2);
var lylim = Array(2);
var x = Math.ceil((xlim[1] - xlim[0]) / width2);
var y = Math.ceil((ylim[1] - ylim[0]) / width2);
var A = Array(x + 1);
for (i2 = 0; i2 <= x; i2++)
A[i2] = Array(y + 1);
for (i2 = 0; i2 < n; i2++) {
lxlim[0] = polygons2[i2][0][0];
lxlim[1] = lxlim[0];
lylim[0] = polygons2[i2][0][1];
lylim[1] = lylim[0];
for (j = 1; j < polygons2[i2].length; j++) {
if (polygons2[i2][j][0] < lxlim[0])
lxlim[0] = polygons2[i2][j][0];
if (polygons2[i2][j][0] > lxlim[1])
lxlim[1] = polygons2[i2][j][0];
if (polygons2[i2][j][1] < lylim[0])
lylim[0] = polygons2[i2][j][1];
if (polygons2[i2][j][1] > lylim[1])
lylim[1] = polygons2[i2][j][1];
}
a[0] = Math.floor((lxlim[0] - (lxlim[0] - xlim[0]) % width2 - xlim[0]) / width2);
a[1] = Math.ceil((lxlim[1] - (lxlim[1] - xlim[1]) % width2 - xlim[0]) / width2);
b[0] = Math.floor((lylim[0] - (lylim[0] - ylim[0]) % width2 - ylim[0]) / width2);
b[1] = Math.ceil((lylim[1] - (lylim[1] - ylim[1]) % width2 - ylim[0]) / width2);
for (j = a[0]; j <= a[1]; j++) {
for (k = b[0]; k <= b[1]; k++) {
xtarget = xlim[0] + j * width2;
ytarget = ylim[0] + k * width2;
if (pip(polygons2[i2], xtarget, ytarget)) {
A[j][k] = predict(xtarget, ytarget, variogram);
}
}
}
}
return {
xlim,
ylim,
width: width2,
data: A,
zlim: [min(variogram.t), max(variogram.t)]
};
}
function plot(canvas, grid2, xlim, ylim, colors) {
var ctx = canvas.getContext("2d");
var data = grid2.data, zlim = grid2.zlim, width2 = grid2.width;
if (ctx) {
ctx.clearRect(0, 0, canvas.width, canvas.height);
var range3 = [xlim[1] - xlim[0], ylim[1] - ylim[0], zlim[1] - zlim[0]];
var i2 = void 0;
var j = void 0;
var x = void 0;
var y = void 0;
var z = void 0;
var n = data.length;
var m = data[0].length;
var wx = Math.ceil(width2 * canvas.width / (xlim[1] - xlim[0]));
var wy = Math.ceil(width2 * canvas.height / (ylim[1] - ylim[0]));
for (i2 = 0; i2 < n; i2++) {
for (j = 0; j < m; j++) {
if (data[i2][j] === void 0)
continue;
x = canvas.width * (i2 * width2 + grid2.xlim[0] - xlim[0]) / range3[0];
y = canvas.height * (1 - (j * width2 + grid2.ylim[0] - ylim[0]) / range3[1]);
z = (data[i2][j] - zlim[0]) / range3[2];
if (z < 0)
z = 0;
if (z > 1)
z = 1;
ctx.fillStyle = colors[Math.floor((colors.length - 1) * z)];
ctx.fillRect(Math.round(x - wx / 2), Math.round(y - wy / 2), wx, wy);
}
}
}
}
var index = {
train,
predict,
variance,
grid,
plot,
max,
min,
pip,
rep,
matrixDiag,
matrixTranspose,
matrixAdd,
matrixMultiply,
matrixChol,
matrixChol2inv,
matrixSolve,
variogramGaussian,
variogramExponential,
variogramSpherical
};
var earthRadius = 63710088e-1;
var factors = {
centimeters: earthRadius * 100,
centimetres: earthRadius * 100,
degrees: earthRadius / 111325,
feet: earthRadius * 3.28084,
inches: earthRadius * 39.37,
kilometers: earthRadius / 1e3,
kilometres: earthRadius / 1e3,
meters: earthRadius,
metres: earthRadius,
miles: earthRadius / 1609.344,
millimeters: earthRadius * 1e3,
millimetres: earthRadius * 1e3,
nauticalmiles: earthRadius / 1852,
radians: 1,
yards: earthRadius * 1.0936
};
var unitsFactors = {
centimeters: 100,
centimetres: 100,
degrees: 1 / 111325,
feet: 3.28084,
inches: 39.37,
kilometers: 1 / 1e3,
kilometres: 1 / 1e3,
meters: 1,
metres: 1,
miles: 1 / 1609.344,
millimeters: 1e3,
millimetres: 1e3,
nauticalmiles: 1 / 1852,
radians: 1 / earthRadius,
yards: 1.0936133
};
var areaFactors = {
acres: 247105e-9,
centimeters: 1e4,
centimetres: 1e4,
feet: 10.763910417,
hectares: 1e-4,
inches: 1550.003100006,
kilometers: 1e-6,
kilometres: 1e-6,
meters: 1,
metres: 1,
miles: 386e-9,
millimeters: 1e6,
millimetres: 1e6,
yards: 1.195990046
};
function feature(geom, properties, options2) {
if (options2 === void 0) {
options2 = {};
}
var feat = { type: "Feature" };
if (options2.id === 0 || options2.id) {
feat.id = options2.id;
}
if (options2.bbox) {
feat.bbox = options2.bbox;
}
feat.properties = properties || {};
feat.geometry = geom;
return feat;
}
function geometry(type2, coordinates, _options) {
switch (type2) {
case "Point":
return point(coordinates).geometry;
case "LineString":
return lineString(coordinates).geometry;
case "Polygon":
return polygon(coordinates).geometry;
case "MultiPoint":
return multiPoint(coordinates).geometry;
case "MultiLineString":
return multiLineString(coordinates).geometry;
case "MultiPolygon":
return multiPolygon(coordinates).geometry;
default:
throw new Error(type2 + " is invalid");
}
}
function point(coordinates, properties, options2) {
if (options2 === void 0) {
options2 = {};
}
if (!coordinates) {
throw new Error("coordinates is required");
}
if (!Array.isArray(coordinates)) {
throw new Error("coordinates must be an Array");
}
if (coordinates.length < 2) {
throw new Error("coordinates must be at least 2 numbers long");
}
if (!isNumber$1(coordinates[0]) || !isNumber$1(coordinates[1])) {
throw new Error("coordinates must contain numbers");
}
var geom = {
type: "Point",
coordinates
};
return feature(geom, properties, options2);
}
function points(coordinates, properties, options2) {
if (options2 === void 0) {
options2 = {};
}
return featureCollection$1(coordinates.map(function(coords) {
return point(coords, properties);
}), options2);
}
function polygon(coordinates, properties, options2) {
if (options2 === void 0) {
options2 = {};
}
for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
var ring = coordinates_1[_i];
if (ring.length < 4) {
throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
}
for (var j = 0; j < ring[ring.length - 1].length; j++) {
if (ring[ring.length - 1][j] !== ring[0][j]) {
throw new Error("First and last Position are not equivalent.");
}
}
}
var geom = {
type: "Polygon",
coordinates
};
return feature(geom, properties, options2);
}
function polygons(coordinates, properties, options2) {
if (options2 === void 0) {
options2 = {};
}
return featureCollection$1(coordinates.map(function(coords) {
return polygon(coords, properties);
}), options2);
}
function lineString(coordinates, properties, options2) {
if (options2 === void 0) {
options2 = {};
}
if (coordinates.length < 2) {
throw new Error("coordinates must be an array of two or more positions");
}
var geom = {
type: "LineString",
coordinates
};
return feature(geom, properties, options2);
}
function lineStrings(coordinates, properties, options2) {
if (options2 === void 0) {
options2 = {};
}
return featureCollection$1(coordinates.map(function(coords) {
return lineString(coords, properties);
}), options2);
}
function featureCollection$1(features, options2) {
if (options2 === void 0) {
options2 = {};
}
var fc = { type: "FeatureCollection" };
if (options2.id) {
fc.id = options2.id;
}
if (options2.bbox) {
fc.bbox = options2.bbox;
}
fc.features = features;
return fc;
}
function multiLineString(coordinates, properties, options2) {
if (options2 === void 0) {
options2 = {};
}
var geom = {
type: "MultiLineString",
coordinates
};
return feature(geom, properties, options2);
}
function multiPoint(coordinates, properties, options2) {
if (options2 === void 0) {
options2 = {};
}
var geom = {
type: "MultiPoint",
coordinates
};
return feature(geom, properties, options2);
}
function multiPolygon(coordinates, properties, options2) {
if (options2 === void 0) {
options2 = {};
}
var geom = {
type: "MultiPolygon",
coordinates
};
return feature(geom, properties, options2);
}
function geometryCollection(geometries, properties, options2) {
if (options2 === void 0) {
options2 = {};
}
var geom = {
type: "GeometryCollection",
geometries
};
return feature(geom, properties, options2);
}
function round(num, precision) {
if (precision === void 0) {
precision = 0;
}
if (precision && !(precision >= 0)) {
throw new Error("precision must be a positive number");
}
var multiplier = Math.pow(10, precision || 0);
return Math.round(num * multiplier) / multiplier;
}
function radiansToLength(radians, units) {
if (units === void 0) {
units = "kilometers";
}
var factor = factors[units];
if (!factor) {
throw new Error(units + " units is invalid");
}
return radians * factor;
}
function lengthToRadians(distance2, units) {
if (units === void 0) {
units = "kilometers";
}
var factor = factors[units];
if (!factor) {
throw new Error(units + " units is invalid");
}
return distance2 / factor;
}
function lengthToDegrees(distance2, units) {
return radiansToDegrees(lengthToRadians(distance2, units));
}
function bearingToAzimuth(bearing2) {
var angle = bearing2 % 360;
if (angle < 0) {
angle += 360;
}
return angle;
}
function radiansToDegrees(radians) {
var degrees = radians % (2 * Math.PI);
return degrees * 180 / Math.PI;
}
function degreesToRadians(degrees) {
var radians = degrees % 360;
return radians * Math.PI / 180;
}
function convertLength(length, originalUnit, finalUnit) {
if (originalUnit === void 0) {
originalUnit = "kilometers";
}
if (finalUnit === void 0) {
finalUnit = "kilometers";
}
if (!(length >= 0)) {
throw new Error("length must be a positive number");
}
return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);
}
function convertArea(area, originalUnit, finalUnit) {
if (originalUnit === void 0) {
originalUnit = "meters";
}
if (finalUnit === void 0) {
finalUnit = "kilometers";
}
if (!(area >= 0)) {
throw new Error("area must be a positive number");
}
var startFactor = areaFactors[originalUnit];
if (!startFactor) {
throw new Error("invalid original units");
}
var finalFactor = areaFactors[finalUnit];
if (!finalFactor) {
throw new Error("invalid final units");
}
return area / startFactor * finalFactor;
}
function isNumber$1(num) {
return !isNaN(num) && num !== null && !Array.isArray(num);
}
function isObject$6(input) {
return !!input && input.constructor === Object;
}
function validateBBox(bbox2) {
if (!bbox2) {
throw new Error("bbox is required");
}
if (!Array.isArray(bbox2)) {
throw new Error("bbox must be an Array");
}
if (bbox2.length !== 4 && bbox2.length !== 6) {
throw new Error("bbox must be an Array of 4 or 6 numbers");
}
bbox2.forEach(function(num) {
if (!isNumber$1(num)) {
throw new Error("bbox must only contain numbers");
}
});
}
function validateId(id) {
if (!id) {
throw new Error("id is required");
}
if (["string", "number"].indexOf(typeof id) === -1) {
throw new Error("id must be a number or a string");
}
}
var es$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
earthRadius,
factors,
unitsFactors,
areaFactors,
feature,
geometry,
point,
points,
polygon,
polygons,
lineString,
lineStrings,
featureCollection: featureCollection$1,
multiLineString,
multiPoint,
multiPolygon,
geometryCollection,
round,
radiansToLength,
lengthToRadians,
lengthToDegrees,
bearingToAzimuth,
radiansToDegrees,
degreesToRadians,
convertLength,
convertArea,
isNumber: isNumber$1,
isObject: isObject$6,
validateBBox,
validateId
}, Symbol.toStringTag, { value: "Module" }));
function coordEach(geojson, callback2, excludeWrapCoord) {
if (geojson === null)
return;
var j, k, l, geometry2, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type2 = geojson.type, isFeatureCollection = type2 === "FeatureCollection", isFeature = type2 === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
var multiFeatureIndex = 0;
var geometryIndex = 0;
geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
if (geometry2 === null)
continue;
coords = geometry2.coordinates;
var geomType = geometry2.type;
wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
switch (geomType) {
case null:
break;
case "Point":
if (callback2(
coords,
coordIndex,
featureIndex,
multiFeatureIndex,
geometryIndex
) === false)
return false;
coordIndex++;
multiFeatureIndex++;
break;
case "LineString":
case "MultiPoint":
for (j = 0; j < coords.length; j++) {
if (callback2(
coords[j],
coordIndex,
featureIndex,
multiFeatureIndex,
geometryIndex
) === false)
return false;
coordIndex++;
if (geomType === "MultiPoint")
multiFeatureIndex++;
}
if (geomType === "LineString")
multiFeatureIndex++;
break;
case "Polygon":
case "MultiLineString":
for (j = 0; j < coords.length; j++) {
for (k = 0; k < coords[j].length - wrapShrink; k++) {
if (callback2(
coords[j][k],
coordIndex,
featureIndex,
multiFeatureIndex,
geometryIndex
) === false)
return false;
coordIndex++;
}
if (geomType === "MultiLineString")
multiFeatureIndex++;
if (geomType === "Polygon")
geometryIndex++;
}
if (geomType === "Polygon")
multiFeatureIndex++;
break;
case "MultiPolygon":
for (j = 0; j < coords.length; j++) {
geometryIndex = 0;
for (k = 0; k < coords[j].length; k++) {
for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
if (callback2(
coords[j][k][l],
coordIndex,
featureIndex,
multiFeatureIndex,
geometryIndex
) === false)
return false;
coordIndex++;
}
geometryIndex++;
}
multiFeatureIndex++;
}
break;
case "GeometryCollection":
for (j = 0; j < geometry2.geometries.length; j++)
if (coordEach(geometry2.geometries[j], callback2, excludeWrapCoord) === false)
return false;
break;
default:
throw new Error("Unknown Geometry Type");
}
}
}
}
function coordReduce(geojson, callback2, initialValue, excludeWrapCoord) {
var previousValue = initialValue;
coordEach(
geojson,
function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
if (coordIndex === 0 && initialValue === void 0)
previousValue = currentCoord;
else
previousValue = callback2(
previousValue,
currentCoord,
coordIndex,
featureIndex,
multiFeatureIndex,
geometryIndex
);
},
excludeWrapCoord
);
return previousValue;
}
function propEach(geojson, callback2) {
var i2;
switch (geojson.type) {
case "FeatureCollection":
for (i2 = 0; i2 < geojson.features.length; i2++) {
if (callback2(geojson.features[i2].properties, i2) === false)
break;
}
break;
case "Feature":
callback2(geojson.properties, 0);
break;
}
}
function propReduce(geojson, callback2, initialValue) {
var previousValue = initialValue;
propEach(geojson, function(currentProperties, featureIndex) {
if (featureIndex === 0 && initialValue === void 0)
previousValue = currentProperties;
else
previousValue = callback2(previousValue, currentProperties, featureIndex);
});
return previousValue;
}
function featureEach$1(geojson, callback2) {
if (geojson.type === "Feature") {
callback2(geojson, 0);
} else if (geojson.type === "FeatureCollection") {
for (var i2 = 0; i2 < geojson.features.length; i2++) {
if (callback2(geojson.features[i2], i2) === false)
break;
}
}
}
function featureReduce(geojson, callback2, initialValue) {
var previousValue = initialValue;
featureEach$1(geojson, function(currentFeature, featureIndex) {
if (featureIndex === 0 && initialValue === void 0)
previousValue = currentFeature;
else
previousValue = callback2(previousValue, currentFeature, featureIndex);
});
return previousValue;
}
function coordAll(geojson) {
var coords = [];
coordEach(geojson, function(coord) {
coords.push(coord);
});
return coords;
}
function geomEach(geojson, callback2) {
var i2, j, g, geometry2, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
for (i2 = 0; i2 < stop; i2++) {
geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
featureId = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
for (g = 0; g < stopG; g++) {
geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g] : geometryMaybeCollection;
if (geometry2 === null) {
if (callback2(
null,
featureIndex,
featureProperties,
featureBBox,
featureId
) === false)
return false;
continue;
}
switch (geometry2.type) {
case "Point":
case "LineString":
case "MultiPoint":
case "Polygon":
case "MultiLineString":
case "MultiPolygon": {
if (callback2(
geometry2,
featureIndex,
featureProperties,
featureBBox,
featureId
) === false)
return false;
break;
}
case "GeometryCollection": {
for (j = 0; j < geometry2.geometries.length; j++) {
if (callback2(
geometry2.geometries[j],
featureIndex,
featureProperties,
featureBBox,
featureId
) === false)
return false;
}
break;
}
default:
throw new Error("Unknown Geometry Type");
}
}
featureIndex++;
}
}
function geomReduce(geojson, callback2, initialValue) {
var previousValue = initialValue;
geomEach(
geojson,
function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {
if (featureIndex === 0 && initialValue === void 0)
previousValue = currentGeometry;
else
previousValue = callback2(
previousValue,
currentGeometry,
featureIndex,
featureProperties,
featureBBox,
featureId
);
}
);
return previousValue;
}
function flattenEach(geojson, callback2) {
geomEach(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
var type2 = geometry2 === null ? null : geometry2.type;
switch (type2) {
case null:
case "Point":
case "LineString":
case "Polygon":
if (callback2(
feature(geometry2, properties, { bbox: bbox2, id }),
featureIndex,
0
) === false)
return false;
return;
}
var geomType;
switch (type2) {
case "MultiPoint":
geomType = "Point";
break;
case "MultiLineString":
geomType = "LineString";
break;
case "MultiPolygon":
geomType = "Polygon";
break;
}
for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
var coordinate = geometry2.coordinates[multiFeatureIndex];
var geom = {
type: geomType,
coordinates: coordinate
};
if (callback2(feature(geom, properties), featureIndex, multiFeatureIndex) === false)
return false;
}
});
}
function flattenReduce(geojson, callback2, initialValue) {
var previousValue = initialValue;
flattenEach(
geojson,
function(currentFeature, featureIndex, multiFeatureIndex) {
if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
previousValue = currentFeature;
else
previousValue = callback2(
previousValue,
currentFeature,
featureIndex,
multiFeatureIndex
);
}
);
return previousValue;
}
function segmentEach(geojson, callback2) {
flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
var segmentIndex = 0;
if (!feature2.geometry)
return;
var type2 = feature2.geometry.type;
if (type2 === "Point" || type2 === "MultiPoint")
return;
var previousCoords;
var previousFeatureIndex = 0;
var previousMultiIndex = 0;
var prevGeomIndex = 0;
if (coordEach(
feature2,
function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
previousCoords = currentCoord;
previousFeatureIndex = featureIndex;
previousMultiIndex = multiPartIndexCoord;
prevGeomIndex = geometryIndex;
segmentIndex = 0;
return;
}
var currentSegment = lineString(
[previousCoords, currentCoord],
feature2.properties
);
if (callback2(
currentSegment,
featureIndex,
multiFeatureIndex,
geometryIndex,
segmentIndex
) === false)
return false;
segmentIndex++;
previousCoords = currentCoord;
}
) === false)
return false;
});
}
function segmentReduce(geojson, callback2, initialValue) {
var previousValue = initialValue;
var started = false;
segmentEach(
geojson,
function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
if (started === false && initialValue === void 0)
previousValue = currentSegment;
else
previousValue = callback2(
previousValue,
currentSegment,
featureIndex,
multiFeatureIndex,
geometryIndex,
segmentIndex
);
started = true;
}
);
return previousValue;
}
function lineEach(geojson, callback2) {
if (!geojson)
throw new Error("geojson is required");
flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
if (feature2.geometry === null)
return;
var type2 = feature2.geometry.type;
var coords = feature2.geometry.coordinates;
switch (type2) {
case "LineString":
if (callback2(feature2, featureIndex, multiFeatureIndex, 0, 0) === false)
return false;
break;
case "Polygon":
for (var geometryIndex = 0; geometryIndex < coords.length; geometryIndex++) {
if (callback2(
lineString(coords[geometryIndex], feature2.properties),
featureIndex,
multiFeatureIndex,
geometryIndex
) === false)
return false;
}
break;
}
});
}
function lineReduce(geojson, callback2, initialValue) {
var previousValue = initialValue;
lineEach(
geojson,
function(currentLine, featureIndex, multiFeatureIndex, geometryIndex) {
if (featureIndex === 0 && initialValue === void 0)
previousValue = currentLine;
else
previousValue = callback2(
previousValue,
currentLine,
featureIndex,
multiFeatureIndex,
geometryIndex
);
}
);
return previousValue;
}
function findSegment(geojson, options2) {
options2 = options2 || {};
if (!isObject$6(options2))
throw new Error("options is invalid");
var featureIndex = options2.featureIndex || 0;
var multiFeatureIndex = options2.multiFeatureIndex || 0;
var geometryIndex = options2.geometryIndex || 0;
var segmentIndex = options2.segmentIndex || 0;
var properties = options2.properties;
var geometry2;
switch (geojson.type) {
case "FeatureCollection":
if (featureIndex < 0)
featureIndex = geojson.features.length + featureIndex;
properties = properties || geojson.features[featureIndex].properties;
geometry2 = geojson.features[featureIndex].geometry;
break;
case "Feature":
properties = properties || geojson.properties;
geometry2 = geojson.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
geometry2 = geojson;
break;
default:
throw new Error("geojson is invalid");
}
if (geometry2 === null)
return null;
var coords = geometry2.coordinates;
switch (geometry2.type) {
case "Point":
case "MultiPoint":
return null;
case "LineString":
if (segmentIndex < 0)
segmentIndex = coords.length + segmentIndex - 1;
return lineString(
[coords[segmentIndex], coords[segmentIndex + 1]],
properties,
options2
);
case "Polygon":
if (geometryIndex < 0)
geometryIndex = coords.length + geometryIndex;
if (segmentIndex < 0)
segmentIndex = coords[geometryIndex].length + segmentIndex - 1;
return lineString(
[
coords[geometryIndex][segmentIndex],
coords[geometryIndex][segmentIndex + 1]
],
properties,
options2
);
case "MultiLineString":
if (multiFeatureIndex < 0)
multiFeatureIndex = coords.length + multiFeatureIndex;
if (segmentIndex < 0)
segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1;
return lineString(
[
coords[multiFeatureIndex][segmentIndex],
coords[multiFeatureIndex][segmentIndex + 1]
],
properties,
options2
);
case "MultiPolygon":
if (multiFeatureIndex < 0)
multiFeatureIndex = coords.length + multiFeatureIndex;
if (geometryIndex < 0)
geometryIndex = coords[multiFeatureIndex].length + geometryIndex;
if (segmentIndex < 0)
segmentIndex = coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1;
return lineString(
[
coords[multiFeatureIndex][geometryIndex][segmentIndex],
coords[multiFeatureIndex][geometryIndex][segmentIndex + 1]
],
properties,
options2
);
}
throw new Error("geojson is invalid");
}
function findPoint(geojson, options2) {
options2 = options2 || {};
if (!isObject$6(options2))
throw new Error("options is invalid");
var featureIndex = options2.featureIndex || 0;
var multiFeatureIndex = options2.multiFeatureIndex || 0;
var geometryIndex = options2.geometryIndex || 0;
var coordIndex = options2.coordIndex || 0;
var properties = options2.properties;
var geometry2;
switch (geojson.type) {
case "FeatureCollection":
if (featureIndex < 0)
featureIndex = geojson.features.length + featureIndex;
properties = properties || geojson.features[featureIndex].properties;
geometry2 = geojson.features[featureIndex].geometry;
break;
case "Feature":
properties = properties || geojson.properties;
geometry2 = geojson.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
geometry2 = geojson;
break;
default:
throw new Error("geojson is invalid");
}
if (geometry2 === null)
return null;
var coords = geometry2.coordinates;
switch (geometry2.type) {
case "Point":
return point(coords, properties, options2);
case "MultiPoint":
if (multiFeatureIndex < 0)
multiFeatureIndex = coords.length + multiFeatureIndex;
return point(coords[multiFeatureIndex], properties, options2);
case "LineString":
if (coordIndex < 0)
coordIndex = coords.length + coordIndex;
return point(coords[coordIndex], properties, options2);
case "Polygon":
if (geometryIndex < 0)
geometryIndex = coords.length + geometryIndex;
if (coordIndex < 0)
coordIndex = coords[geometryIndex].length + coordIndex;
return point(coords[geometryIndex][coordIndex], properties, options2);
case "MultiLineString":
if (multiFeatureIndex < 0)
multiFeatureIndex = coords.length + multiFeatureIndex;
if (coordIndex < 0)
coordIndex = coords[multiFeatureIndex].length + coordIndex;
return point(coords[multiFeatureIndex][coordIndex], properties, options2);
case "MultiPolygon":
if (multiFeatureIndex < 0)
multiFeatureIndex = coords.length + multiFeatureIndex;
if (geometryIndex < 0)
geometryIndex = coords[multiFeatureIndex].length + geometryIndex;
if (coordIndex < 0)
coordIndex = coords[multiFeatureIndex][geometryIndex].length - coordIndex;
return point(
coords[multiFeatureIndex][geometryIndex][coordIndex],
properties,
options2
);
}
throw new Error("geojson is invalid");
}
var es$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
coordAll,
coordEach,
coordReduce,
featureEach: featureEach$1,
featureReduce,
findPoint,
findSegment,
flattenEach,
flattenReduce,
geomEach,
geomReduce,
lineEach,
lineReduce,
propEach,
propReduce,
segmentEach,
segmentReduce
}, Symbol.toStringTag, { value: "Module" }));
function bbox$1(geojson) {
var result = [Infinity, Infinity, -Infinity, -Infinity];
coordEach(geojson, function(coord) {
if (result[0] > coord[0]) {
result[0] = coord[0];
}
if (result[1] > coord[1]) {
result[1] = coord[1];
}
if (result[2] < coord[0]) {
result[2] = coord[0];
}
if (result[3] < coord[1]) {
result[3] = coord[1];
}
});
return result;
}
bbox$1["default"] = bbox$1;
var es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
"default": bbox$1
}, Symbol.toStringTag, { value: "Module" }));
function getCoord(coord) {
if (!coord) {
throw new Error("coord is required");
}
if (!Array.isArray(coord)) {
if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
return coord.geometry.coordinates;
}
if (coord.type === "Point") {
return coord.coordinates;
}
}
if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
return coord;
}
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
function getCoords(coords) {
if (Array.isArray(coords)) {
return coords;
}
if (coords.type === "Feature") {
if (coords.geometry !== null) {
return coords.geometry.coordinates;
}
} else {
if (coords.coordinates) {
return coords.coordinates;
}
}
throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
}
function getGeom(geojson) {
if (geojson.type === "Feature") {
return geojson.geometry;
}
return geojson;
}
function getType(geojson, _name) {
if (geojson.type === "FeatureCollection") {
return "FeatureCollection";
}
if (geojson.type === "GeometryCollection") {
return "GeometryCollection";
}
if (geojson.type === "Feature" && geojson.geometry !== null) {
return geojson.geometry.type;
}
return geojson.type;
}
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
function getDefaultExportFromCjs(x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
}
function getAugmentedNamespace(n) {
if (n.__esModule)
return n;
var a = Object.defineProperty({}, "__esModule", { value: true });
Object.keys(n).forEach(function(k) {
var d2 = Object.getOwnPropertyDescriptor(n, k);
Object.defineProperty(a, k, d2.get ? d2 : {
enumerable: true,
get: function() {
return n[k];
}
});
});
return a;
}
var concaveman$2 = { exports: {} };
var rbush_min$1 = { exports: {} };
(function(module2, exports2) {
!function(t2, i2) {
module2.exports = i2();
}(commonjsGlobal, function() {
function t2(t3, r3, e2, a2, h3) {
!function t4(n2, r4, e3, a3, h4) {
for (; a3 > e3; ) {
if (a3 - e3 > 600) {
var o2 = a3 - e3 + 1, s2 = r4 - e3 + 1, l2 = Math.log(o2), f2 = 0.5 * Math.exp(2 * l2 / 3), u2 = 0.5 * Math.sqrt(l2 * f2 * (o2 - f2) / o2) * (s2 - o2 / 2 < 0 ? -1 : 1), m2 = Math.max(e3, Math.floor(r4 - s2 * f2 / o2 + u2)), c2 = Math.min(a3, Math.floor(r4 + (o2 - s2) * f2 / o2 + u2));
t4(n2, r4, m2, c2, h4);
}
var p2 = n2[r4], d3 = e3, x = a3;
for (i2(n2, e3, r4), h4(n2[a3], p2) > 0 && i2(n2, e3, a3); d3 < x; ) {
for (i2(n2, d3, x), d3++, x--; h4(n2[d3], p2) < 0; )
d3++;
for (; h4(n2[x], p2) > 0; )
x--;
}
0 === h4(n2[e3], p2) ? i2(n2, e3, x) : i2(n2, ++x, a3), x <= r4 && (e3 = x + 1), r4 <= x && (a3 = x - 1);
}
}(t3, r3, e2 || 0, a2 || t3.length - 1, h3 || n);
}
function i2(t3, i3, n2) {
var r3 = t3[i3];
t3[i3] = t3[n2], t3[n2] = r3;
}
function n(t3, i3) {
return t3 < i3 ? -1 : t3 > i3 ? 1 : 0;
}
var r2 = function(t3) {
void 0 === t3 && (t3 = 9), this._maxEntries = Math.max(4, t3), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
};
function e(t3, i3, n2) {
if (!n2)
return i3.indexOf(t3);
for (var r3 = 0; r3 < i3.length; r3++)
if (n2(t3, i3[r3]))
return r3;
return -1;
}
function a(t3, i3) {
h2(t3, 0, t3.children.length, i3, t3);
}
function h2(t3, i3, n2, r3, e2) {
e2 || (e2 = p(null)), e2.minX = 1 / 0, e2.minY = 1 / 0, e2.maxX = -1 / 0, e2.maxY = -1 / 0;
for (var a2 = i3; a2 < n2; a2++) {
var h3 = t3.children[a2];
o(e2, t3.leaf ? r3(h3) : h3);
}
return e2;
}
function o(t3, i3) {
return t3.minX = Math.min(t3.minX, i3.minX), t3.minY = Math.min(t3.minY, i3.minY), t3.maxX = Math.max(t3.maxX, i3.maxX), t3.maxY = Math.max(t3.maxY, i3.maxY), t3;
}
function s(t3, i3) {
return t3.minX - i3.minX;
}
function l(t3, i3) {
return t3.minY - i3.minY;
}
function f(t3) {
return (t3.maxX - t3.minX) * (t3.maxY - t3.minY);
}
function u(t3) {
return t3.maxX - t3.minX + (t3.maxY - t3.minY);
}
function m(t3, i3) {
return t3.minX <= i3.minX && t3.minY <= i3.minY && i3.maxX <= t3.maxX && i3.maxY <= t3.maxY;
}
function c(t3, i3) {
return i3.minX <= t3.maxX && i3.minY <= t3.maxY && i3.maxX >= t3.minX && i3.maxY >= t3.minY;
}
function p(t3) {
return { children: t3, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
}
function d2(i3, n2, r3, e2, a2) {
for (var h3 = [n2, r3]; h3.length; )
if (!((r3 = h3.pop()) - (n2 = h3.pop()) <= e2)) {
var o2 = n2 + Math.ceil((r3 - n2) / e2 / 2) * e2;
t2(i3, o2, n2, r3, a2), h3.push(n2, o2, o2, r3);
}
}
return r2.prototype.all = function() {
return this._all(this.data, []);
}, r2.prototype.search = function(t3) {
var i3 = this.data, n2 = [];
if (!c(t3, i3))
return n2;
for (var r3 = this.toBBox, e2 = []; i3; ) {
for (var a2 = 0; a2 < i3.children.length; a2++) {
var h3 = i3.children[a2], o2 = i3.leaf ? r3(h3) : h3;
c(t3, o2) && (i3.leaf ? n2.push(h3) : m(t3, o2) ? this._all(h3, n2) : e2.push(h3));
}
i3 = e2.pop();
}
return n2;
}, r2.prototype.collides = function(t3) {
var i3 = this.data;
if (!c(t3, i3))
return false;
for (var n2 = []; i3; ) {
for (var r3 = 0; r3 < i3.children.length; r3++) {
var e2 = i3.children[r3], a2 = i3.leaf ? this.toBBox(e2) : e2;
if (c(t3, a2)) {
if (i3.leaf || m(t3, a2))
return true;
n2.push(e2);
}
}
i3 = n2.pop();
}
return false;
}, r2.prototype.load = function(t3) {
if (!t3 || !t3.length)
return this;
if (t3.length < this._minEntries) {
for (var i3 = 0; i3 < t3.length; i3++)
this.insert(t3[i3]);
return this;
}
var n2 = this._build(t3.slice(), 0, t3.length - 1, 0);
if (this.data.children.length)
if (this.data.height === n2.height)
this._splitRoot(this.data, n2);
else {
if (this.data.height < n2.height) {
var r3 = this.data;
this.data = n2, n2 = r3;
}
this._insert(n2, this.data.height - n2.height - 1, true);
}
else
this.data = n2;
return this;
}, r2.prototype.insert = function(t3) {
return t3 && this._insert(t3, this.data.height - 1), this;
}, r2.prototype.clear = function() {
return this.data = p([]), this;
}, r2.prototype.remove = function(t3, i3) {
if (!t3)
return this;
for (var n2, r3, a2, h3 = this.data, o2 = this.toBBox(t3), s2 = [], l2 = []; h3 || s2.length; ) {
if (h3 || (h3 = s2.pop(), r3 = s2[s2.length - 1], n2 = l2.pop(), a2 = true), h3.leaf) {
var f2 = e(t3, h3.children, i3);
if (-1 !== f2)
return h3.children.splice(f2, 1), s2.push(h3), this._condense(s2), this;
}
a2 || h3.leaf || !m(h3, o2) ? r3 ? (n2++, h3 = r3.children[n2], a2 = false) : h3 = null : (s2.push(h3), l2.push(n2), n2 = 0, r3 = h3, h3 = h3.children[0]);
}
return this;
}, r2.prototype.toBBox = function(t3) {
return t3;
}, r2.prototype.compareMinX = function(t3, i3) {
return t3.minX - i3.minX;
}, r2.prototype.compareMinY = function(t3, i3) {
return t3.minY - i3.minY;
}, r2.prototype.toJSON = function() {
return this.data;
}, r2.prototype.fromJSON = function(t3) {
return this.data = t3, this;
}, r2.prototype._all = function(t3, i3) {
for (var n2 = []; t3; )
t3.leaf ? i3.push.apply(i3, t3.children) : n2.push.apply(n2, t3.children), t3 = n2.pop();
return i3;
}, r2.prototype._build = function(t3, i3, n2, r3) {
var e2, h3 = n2 - i3 + 1, o2 = this._maxEntries;
if (h3 <= o2)
return a(e2 = p(t3.slice(i3, n2 + 1)), this.toBBox), e2;
r3 || (r3 = Math.ceil(Math.log(h3) / Math.log(o2)), o2 = Math.ceil(h3 / Math.pow(o2, r3 - 1))), (e2 = p([])).leaf = false, e2.height = r3;
var s2 = Math.ceil(h3 / o2), l2 = s2 * Math.ceil(Math.sqrt(o2));
d2(t3, i3, n2, l2, this.compareMinX);
for (var f2 = i3; f2 <= n2; f2 += l2) {
var u2 = Math.min(f2 + l2 - 1, n2);
d2(t3, f2, u2, s2, this.compareMinY);
for (var m2 = f2; m2 <= u2; m2 += s2) {
var c2 = Math.min(m2 + s2 - 1, u2);
e2.children.push(this._build(t3, m2, c2, r3 - 1));
}
}
return a(e2, this.toBBox), e2;
}, r2.prototype._chooseSubtree = function(t3, i3, n2, r3) {
for (; r3.push(i3), !i3.leaf && r3.length - 1 !== n2; ) {
for (var e2 = 1 / 0, a2 = 1 / 0, h3 = void 0, o2 = 0; o2 < i3.children.length; o2++) {
var s2 = i3.children[o2], l2 = f(s2), u2 = (m2 = t3, c2 = s2, (Math.max(c2.maxX, m2.maxX) - Math.min(c2.minX, m2.minX)) * (Math.max(c2.maxY, m2.maxY) - Math.min(c2.minY, m2.minY)) - l2);
u2 < a2 ? (a2 = u2, e2 = l2 < e2 ? l2 : e2, h3 = s2) : u2 === a2 && l2 < e2 && (e2 = l2, h3 = s2);
}
i3 = h3 || i3.children[0];
}
var m2, c2;
return i3;
}, r2.prototype._insert = function(t3, i3, n2) {
var r3 = n2 ? t3 : this.toBBox(t3), e2 = [], a2 = this._chooseSubtree(r3, this.data, i3, e2);
for (a2.children.push(t3), o(a2, r3); i3 >= 0 && e2[i3].children.length > this._maxEntries; )
this._split(e2, i3), i3--;
this._adjustParentBBoxes(r3, e2, i3);
}, r2.prototype._split = function(t3, i3) {
var n2 = t3[i3], r3 = n2.children.length, e2 = this._minEntries;
this._chooseSplitAxis(n2, e2, r3);
var h3 = this._chooseSplitIndex(n2, e2, r3), o2 = p(n2.children.splice(h3, n2.children.length - h3));
o2.height = n2.height, o2.leaf = n2.leaf, a(n2, this.toBBox), a(o2, this.toBBox), i3 ? t3[i3 - 1].children.push(o2) : this._splitRoot(n2, o2);
}, r2.prototype._splitRoot = function(t3, i3) {
this.data = p([t3, i3]), this.data.height = t3.height + 1, this.data.leaf = false, a(this.data, this.toBBox);
}, r2.prototype._chooseSplitIndex = function(t3, i3, n2) {
for (var r3, e2, a2, o2, s2, l2, u2, m2 = 1 / 0, c2 = 1 / 0, p2 = i3; p2 <= n2 - i3; p2++) {
var d3 = h2(t3, 0, p2, this.toBBox), x = h2(t3, p2, n2, this.toBBox), v = (e2 = d3, a2 = x, o2 = void 0, s2 = void 0, l2 = void 0, u2 = void 0, o2 = Math.max(e2.minX, a2.minX), s2 = Math.max(e2.minY, a2.minY), l2 = Math.min(e2.maxX, a2.maxX), u2 = Math.min(e2.maxY, a2.maxY), Math.max(0, l2 - o2) * Math.max(0, u2 - s2)), M = f(d3) + f(x);
v < m2 ? (m2 = v, r3 = p2, c2 = M < c2 ? M : c2) : v === m2 && M < c2 && (c2 = M, r3 = p2);
}
return r3 || n2 - i3;
}, r2.prototype._chooseSplitAxis = function(t3, i3, n2) {
var r3 = t3.leaf ? this.compareMinX : s, e2 = t3.leaf ? this.compareMinY : l;
this._allDistMargin(t3, i3, n2, r3) < this._allDistMargin(t3, i3, n2, e2) && t3.children.sort(r3);
}, r2.prototype._allDistMargin = function(t3, i3, n2, r3) {
t3.children.sort(r3);
for (var e2 = this.toBBox, a2 = h2(t3, 0, i3, e2), s2 = h2(t3, n2 - i3, n2, e2), l2 = u(a2) + u(s2), f2 = i3; f2 < n2 - i3; f2++) {
var m2 = t3.children[f2];
o(a2, t3.leaf ? e2(m2) : m2), l2 += u(a2);
}
for (var c2 = n2 - i3 - 1; c2 >= i3; c2--) {
var p2 = t3.children[c2];
o(s2, t3.leaf ? e2(p2) : p2), l2 += u(s2);
}
return l2;
}, r2.prototype._adjustParentBBoxes = function(t3, i3, n2) {
for (var r3 = n2; r3 >= 0; r3--)
o(i3[r3], t3);
}, r2.prototype._condense = function(t3) {
for (var i3 = t3.length - 1, n2 = void 0; i3 >= 0; i3--)
0 === t3[i3].children.length ? i3 > 0 ? (n2 = t3[i3 - 1].children).splice(n2.indexOf(t3[i3]), 1) : this.clear() : a(t3[i3], this.toBBox);
}, r2;
});
})(rbush_min$1);
class TinyQueue {
constructor(data = [], compare = defaultCompare) {
this.data = data;
this.length = this.data.length;
this.compare = compare;
if (this.length > 0) {
for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--)
this._down(i2);
}
}
push(item) {
this.data.push(item);
this.length++;
this._up(this.length - 1);
}
pop() {
if (this.length === 0)
return void 0;
const top = this.data[0];
const bottom = this.data.pop();
this.length--;
if (this.length > 0) {
this.data[0] = bottom;
this._down(0);
}
return top;
}
peek() {
return this.data[0];
}
_up(pos) {
const { data, compare } = this;
const item = data[pos];
while (pos > 0) {
const parent = pos - 1 >> 1;
const current = data[parent];
if (compare(item, current) >= 0)
break;
data[pos] = current;
pos = parent;
}
data[pos] = item;
}
_down(pos) {
const { data, compare } = this;
const halfLength = this.length >> 1;
const item = data[pos];
while (pos < halfLength) {
let left = (pos << 1) + 1;
let best = data[left];
const right = left + 1;
if (right < this.length && compare(data[right], best) < 0) {
left = right;
best = data[right];
}
if (compare(best, item) >= 0)
break;
data[pos] = best;
pos = left;
}
data[pos] = item;
}
}
function defaultCompare(a, b) {
return a < b ? -1 : a > b ? 1 : 0;
}
var tinyqueue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
"default": TinyQueue
}, Symbol.toStringTag, { value: "Module" }));
var require$$1$2 = /* @__PURE__ */ getAugmentedNamespace(tinyqueue);
var pointInPolygon$1 = { exports: {} };
var flat = function pointInPolygonFlat(point2, vs, start2, end) {
var x = point2[0], y = point2[1];
var inside2 = false;
if (start2 === void 0)
start2 = 0;
if (end === void 0)
end = vs.length;
var len = (end - start2) / 2;
for (var i2 = 0, j = len - 1; i2 < len; j = i2++) {
var xi = vs[start2 + i2 * 2 + 0], yi = vs[start2 + i2 * 2 + 1];
var xj = vs[start2 + j * 2 + 0], yj = vs[start2 + j * 2 + 1];
var intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
if (intersect)
inside2 = !inside2;
}
return inside2;
};
var nested = function pointInPolygonNested(point2, vs, start2, end) {
var x = point2[0], y = point2[1];
var inside2 = false;
if (start2 === void 0)
start2 = 0;
if (end === void 0)
end = vs.length;
var len = end - start2;
for (var i2 = 0, j = len - 1; i2 < len; j = i2++) {
var xi = vs[i2 + start2][0], yi = vs[i2 + start2][1];
var xj = vs[j + start2][0], yj = vs[j + start2][1];
var intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
if (intersect)
inside2 = !inside2;
}
return inside2;
};
var pointInPolygonFlat2 = flat;
var pointInPolygonNested2 = nested;
pointInPolygon$1.exports = function pointInPolygon(point2, vs, start2, end) {
if (vs.length > 0 && Array.isArray(vs[0])) {
return pointInPolygonNested2(point2, vs, start2, end);
} else {
return pointInPolygonFlat2(point2, vs, start2, end);
}
};
pointInPolygon$1.exports.nested = pointInPolygonNested2;
pointInPolygon$1.exports.flat = pointInPolygonFlat2;
var orient2d_min = { exports: {} };
(function(module2, exports2) {
!function(t2, e) {
e(exports2);
}(commonjsGlobal, function(t2) {
const e = 134217729, n = 33306690738754706e-32;
function r2(t3, e2, n2, r3, o2) {
let f2, i3, u2, c2, s2 = e2[0], a2 = r3[0], d3 = 0, l2 = 0;
a2 > s2 == a2 > -s2 ? (f2 = s2, s2 = e2[++d3]) : (f2 = a2, a2 = r3[++l2]);
let p = 0;
if (d3 < t3 && l2 < n2)
for (a2 > s2 == a2 > -s2 ? (u2 = f2 - ((i3 = s2 + f2) - s2), s2 = e2[++d3]) : (u2 = f2 - ((i3 = a2 + f2) - a2), a2 = r3[++l2]), f2 = i3, 0 !== u2 && (o2[p++] = u2); d3 < t3 && l2 < n2; )
a2 > s2 == a2 > -s2 ? (u2 = f2 - ((i3 = f2 + s2) - (c2 = i3 - f2)) + (s2 - c2), s2 = e2[++d3]) : (u2 = f2 - ((i3 = f2 + a2) - (c2 = i3 - f2)) + (a2 - c2), a2 = r3[++l2]), f2 = i3, 0 !== u2 && (o2[p++] = u2);
for (; d3 < t3; )
u2 = f2 - ((i3 = f2 + s2) - (c2 = i3 - f2)) + (s2 - c2), s2 = e2[++d3], f2 = i3, 0 !== u2 && (o2[p++] = u2);
for (; l2 < n2; )
u2 = f2 - ((i3 = f2 + a2) - (c2 = i3 - f2)) + (a2 - c2), a2 = r3[++l2], f2 = i3, 0 !== u2 && (o2[p++] = u2);
return 0 === f2 && 0 !== p || (o2[p++] = f2), p;
}
function o(t3) {
return new Float64Array(t3);
}
const f = 33306690738754716e-32, i2 = 22204460492503146e-32, u = 11093356479670487e-47, c = o(4), s = o(8), a = o(12), d2 = o(16), l = o(4);
t2.orient2d = function(t3, o2, p, b, y, h2) {
const M = (o2 - h2) * (p - y), x = (t3 - y) * (b - h2), j = M - x;
if (0 === M || 0 === x || M > 0 != x > 0)
return j;
const m = Math.abs(M + x);
return Math.abs(j) >= f * m ? j : -function(t4, o3, f2, p2, b2, y2, h3) {
let M2, x2, j2, m2, _, v, w, A, F, O, P2, g, k, q2, z, B2, C2, D;
const E2 = t4 - b2, G2 = f2 - b2, H2 = o3 - y2, I2 = p2 - y2;
_ = (z = (A = E2 - (w = (v = e * E2) - (v - E2))) * (O = I2 - (F = (v = e * I2) - (v - I2))) - ((q2 = E2 * I2) - w * F - A * F - w * O)) - (P2 = z - (C2 = (A = H2 - (w = (v = e * H2) - (v - H2))) * (O = G2 - (F = (v = e * G2) - (v - G2))) - ((B2 = H2 * G2) - w * F - A * F - w * O))), c[0] = z - (P2 + _) + (_ - C2), _ = (k = q2 - ((g = q2 + P2) - (_ = g - q2)) + (P2 - _)) - (P2 = k - B2), c[1] = k - (P2 + _) + (_ - B2), _ = (D = g + P2) - g, c[2] = g - (D - _) + (P2 - _), c[3] = D;
let J2 = function(t5, e2) {
let n2 = e2[0];
for (let r3 = 1; r3 < t5; r3++)
n2 += e2[r3];
return n2;
}(4, c), K2 = i2 * h3;
if (J2 >= K2 || -J2 >= K2)
return J2;
if (M2 = t4 - (E2 + (_ = t4 - E2)) + (_ - b2), j2 = f2 - (G2 + (_ = f2 - G2)) + (_ - b2), x2 = o3 - (H2 + (_ = o3 - H2)) + (_ - y2), m2 = p2 - (I2 + (_ = p2 - I2)) + (_ - y2), 0 === M2 && 0 === x2 && 0 === j2 && 0 === m2)
return J2;
if (K2 = u * h3 + n * Math.abs(J2), (J2 += E2 * m2 + I2 * M2 - (H2 * j2 + G2 * x2)) >= K2 || -J2 >= K2)
return J2;
_ = (z = (A = M2 - (w = (v = e * M2) - (v - M2))) * (O = I2 - (F = (v = e * I2) - (v - I2))) - ((q2 = M2 * I2) - w * F - A * F - w * O)) - (P2 = z - (C2 = (A = x2 - (w = (v = e * x2) - (v - x2))) * (O = G2 - (F = (v = e * G2) - (v - G2))) - ((B2 = x2 * G2) - w * F - A * F - w * O))), l[0] = z - (P2 + _) + (_ - C2), _ = (k = q2 - ((g = q2 + P2) - (_ = g - q2)) + (P2 - _)) - (P2 = k - B2), l[1] = k - (P2 + _) + (_ - B2), _ = (D = g + P2) - g, l[2] = g - (D - _) + (P2 - _), l[3] = D;
const L = r2(4, c, 4, l, s);
_ = (z = (A = E2 - (w = (v = e * E2) - (v - E2))) * (O = m2 - (F = (v = e * m2) - (v - m2))) - ((q2 = E2 * m2) - w * F - A * F - w * O)) - (P2 = z - (C2 = (A = H2 - (w = (v = e * H2) - (v - H2))) * (O = j2 - (F = (v = e * j2) - (v - j2))) - ((B2 = H2 * j2) - w * F - A * F - w * O))), l[0] = z - (P2 + _) + (_ - C2), _ = (k = q2 - ((g = q2 + P2) - (_ = g - q2)) + (P2 - _)) - (P2 = k - B2), l[1] = k - (P2 + _) + (_ - B2), _ = (D = g + P2) - g, l[2] = g - (D - _) + (P2 - _), l[3] = D;
const N2 = r2(L, s, 4, l, a);
_ = (z = (A = M2 - (w = (v = e * M2) - (v - M2))) * (O = m2 - (F = (v = e * m2) - (v - m2))) - ((q2 = M2 * m2) - w * F - A * F - w * O)) - (P2 = z - (C2 = (A = x2 - (w = (v = e * x2) - (v - x2))) * (O = j2 - (F = (v = e * j2) - (v - j2))) - ((B2 = x2 * j2) - w * F - A * F - w * O))), l[0] = z - (P2 + _) + (_ - C2), _ = (k = q2 - ((g = q2 + P2) - (_ = g - q2)) + (P2 - _)) - (P2 = k - B2), l[1] = k - (P2 + _) + (_ - B2), _ = (D = g + P2) - g, l[2] = g - (D - _) + (P2 - _), l[3] = D;
const Q2 = r2(N2, a, 4, l, d2);
return d2[Q2 - 1];
}(t3, o2, p, b, y, h2, m);
}, t2.orient2dfast = function(t3, e2, n2, r3, o2, f2) {
return (e2 - f2) * (n2 - o2) - (t3 - o2) * (r3 - f2);
}, Object.defineProperty(t2, "__esModule", { value: true });
});
})(orient2d_min, orient2d_min.exports);
var RBush = rbush_min$1.exports;
var Queue = require$$1$2;
var pointInPolygon2 = pointInPolygon$1.exports;
var orient = orient2d_min.exports.orient2d;
if (Queue.default) {
Queue = Queue.default;
}
concaveman$2.exports = concaveman;
concaveman$2.exports.default = concaveman;
function concaveman(points2, concavity, lengthThreshold) {
concavity = Math.max(0, concavity === void 0 ? 2 : concavity);
lengthThreshold = lengthThreshold || 0;
var hull = fastConvexHull(points2);
var tree = new RBush(16);
tree.toBBox = function(a2) {
return {
minX: a2[0],
minY: a2[1],
maxX: a2[0],
maxY: a2[1]
};
};
tree.compareMinX = function(a2, b2) {
return a2[0] - b2[0];
};
tree.compareMinY = function(a2, b2) {
return a2[1] - b2[1];
};
tree.load(points2);
var queue = [];
for (var i2 = 0, last; i2 < hull.length; i2++) {
var p = hull[i2];
tree.remove(p);
last = insertNode(p, last);
queue.push(last);
}
var segTree = new RBush(16);
for (i2 = 0; i2 < queue.length; i2++)
segTree.insert(updateBBox(queue[i2]));
var sqConcavity = concavity * concavity;
var sqLenThreshold = lengthThreshold * lengthThreshold;
while (queue.length) {
var node = queue.shift();
var a = node.p;
var b = node.next.p;
var sqLen = getSqDist(a, b);
if (sqLen < sqLenThreshold)
continue;
var maxSqLen = sqLen / sqConcavity;
p = findCandidate(tree, node.prev.p, a, b, node.next.next.p, maxSqLen, segTree);
if (p && Math.min(getSqDist(p, a), getSqDist(p, b)) <= maxSqLen) {
queue.push(node);
queue.push(insertNode(p, node));
tree.remove(p);
segTree.remove(node);
segTree.insert(updateBBox(node));
segTree.insert(updateBBox(node.next));
}
}
node = last;
var concave = [];
do {
concave.push(node.p);
node = node.next;
} while (node !== last);
concave.push(node.p);
return concave;
}
function findCandidate(tree, a, b, c, d2, maxDist, segTree) {
var queue = new Queue([], compareDist);
var node = tree.data;
while (node) {
for (var i2 = 0; i2 < node.children.length; i2++) {
var child = node.children[i2];
var dist = node.leaf ? sqSegDist(child, b, c) : sqSegBoxDist(b, c, child);
if (dist > maxDist)
continue;
queue.push({
node: child,
dist
});
}
while (queue.length && !queue.peek().node.children) {
var item = queue.pop();
var p = item.node;
var d0 = sqSegDist(p, a, b);
var d1 = sqSegDist(p, c, d2);
if (item.dist < d0 && item.dist < d1 && noIntersections(b, p, segTree) && noIntersections(c, p, segTree))
return p;
}
node = queue.pop();
if (node)
node = node.node;
}
return null;
}
function compareDist(a, b) {
return a.dist - b.dist;
}
function sqSegBoxDist(a, b, bbox2) {
if (inside(a, bbox2) || inside(b, bbox2))
return 0;
var d1 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.minX, bbox2.minY, bbox2.maxX, bbox2.minY);
if (d1 === 0)
return 0;
var d2 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.minX, bbox2.minY, bbox2.minX, bbox2.maxY);
if (d2 === 0)
return 0;
var d3 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.maxX, bbox2.minY, bbox2.maxX, bbox2.maxY);
if (d3 === 0)
return 0;
var d4 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.minX, bbox2.maxY, bbox2.maxX, bbox2.maxY);
if (d4 === 0)
return 0;
return Math.min(d1, d2, d3, d4);
}
function inside(a, bbox2) {
return a[0] >= bbox2.minX && a[0] <= bbox2.maxX && a[1] >= bbox2.minY && a[1] <= bbox2.maxY;
}
function noIntersections(a, b, segTree) {
var minX = Math.min(a[0], b[0]);
var minY = Math.min(a[1], b[1]);
var maxX = Math.max(a[0], b[0]);
var maxY = Math.max(a[1], b[1]);
var edges = segTree.search({ minX, minY, maxX, maxY });
for (var i2 = 0; i2 < edges.length; i2++) {
if (intersects$1(edges[i2].p, edges[i2].next.p, a, b))
return false;
}
return true;
}
function cross(p1, p2, p3) {
return orient(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
}
function intersects$1(p1, q1, p2, q2) {
return p1 !== q2 && q1 !== p2 && cross(p1, q1, p2) > 0 !== cross(p1, q1, q2) > 0 && cross(p2, q2, p1) > 0 !== cross(p2, q2, q1) > 0;
}
function updateBBox(node) {
var p1 = node.p;
var p2 = node.next.p;
node.minX = Math.min(p1[0], p2[0]);
node.minY = Math.min(p1[1], p2[1]);
node.maxX = Math.max(p1[0], p2[0]);
node.maxY = Math.max(p1[1], p2[1]);
return node;
}
function fastConvexHull(points2) {
var left = points2[0];
var top = points2[0];
var right = points2[0];
var bottom = points2[0];
for (var i2 = 0; i2 < points2.length; i2++) {
var p = points2[i2];
if (p[0] < left[0])
left = p;
if (p[0] > right[0])
right = p;
if (p[1] < top[1])
top = p;
if (p[1] > bottom[1])
bottom = p;
}
var cull = [left, top, right, bottom];
var filtered = cull.slice();
for (i2 = 0; i2 < points2.length; i2++) {
if (!pointInPolygon2(points2[i2], cull))
filtered.push(points2[i2]);
}
return convexHull(filtered);
}
function insertNode(p, prev) {
var node = {
p,
prev: null,
next: null,
minX: 0,
minY: 0,
maxX: 0,
maxY: 0
};
if (!prev) {
node.prev = node;
node.next = node;
} else {
node.next = prev.next;
node.prev = prev;
prev.next.prev = node;
prev.next = node;
}
return node;
}
function getSqDist(p1, p2) {
var dx = p1[0] - p2[0], dy = p1[1] - p2[1];
return dx * dx + dy * dy;
}
function sqSegDist(p, p1, p2) {
var x = p1[0], y = p1[1], dx = p2[0] - x, dy = p2[1] - y;
if (dx !== 0 || dy !== 0) {
var t2 = ((p[0] - x) * dx + (p[1] - y) * dy) / (dx * dx + dy * dy);
if (t2 > 1) {
x = p2[0];
y = p2[1];
} else if (t2 > 0) {
x += dx * t2;
y += dy * t2;
}
}
dx = p[0] - x;
dy = p[1] - y;
return dx * dx + dy * dy;
}
function sqSegSegDist(x0, y0, x1, y1, x2, y2, x3, y3) {
var ux = x1 - x0;
var uy = y1 - y0;
var vx = x3 - x2;
var vy = y3 - y2;
var wx = x0 - x2;
var wy = y0 - y2;
var a = ux * ux + uy * uy;
var b = ux * vx + uy * vy;
var c = vx * vx + vy * vy;
var d2 = ux * wx + uy * wy;
var e = vx * wx + vy * wy;
var D = a * c - b * b;
var sc, sN, tc, tN;
var sD = D;
var tD = D;
if (D === 0) {
sN = 0;
sD = 1;
tN = e;
tD = c;
} else {
sN = b * e - c * d2;
tN = a * e - b * d2;
if (sN < 0) {
sN = 0;
tN = e;
tD = c;
} else if (sN > sD) {
sN = sD;
tN = e + b;
tD = c;
}
}
if (tN < 0) {
tN = 0;
if (-d2 < 0)
sN = 0;
else if (-d2 > a)
sN = sD;
else {
sN = -d2;
sD = a;
}
} else if (tN > tD) {
tN = tD;
if (-d2 + b < 0)
sN = 0;
else if (-d2 + b > a)
sN = sD;
else {
sN = -d2 + b;
sD = a;
}
}
sc = sN === 0 ? 0 : sN / sD;
tc = tN === 0 ? 0 : tN / tD;
var cx = (1 - sc) * x0 + sc * x1;
var cy = (1 - sc) * y0 + sc * y1;
var cx2 = (1 - tc) * x2 + tc * x3;
var cy2 = (1 - tc) * y2 + tc * y3;
var dx = cx2 - cx;
var dy = cy2 - cy;
return dx * dx + dy * dy;
}
function compareByX(a, b) {
return a[0] === b[0] ? a[1] - b[1] : a[0] - b[0];
}
function convexHull(points2) {
points2.sort(compareByX);
var lower = [];
for (var i2 = 0; i2 < points2.length; i2++) {
while (lower.length >= 2 && cross(lower[lower.length - 2], lower[lower.length - 1], points2[i2]) <= 0) {
lower.pop();
}
lower.push(points2[i2]);
}
var upper = [];
for (var ii = points2.length - 1; ii >= 0; ii--) {
while (upper.length >= 2 && cross(upper[upper.length - 2], upper[upper.length - 1], points2[ii]) <= 0) {
upper.pop();
}
upper.push(points2[ii]);
}
upper.pop();
lower.pop();
return lower.concat(upper);
}
var concaveman$1 = concaveman$2.exports;
function convex(geojson, options2) {
if (options2 === void 0) {
options2 = {};
}
options2.concavity = options2.concavity || Infinity;
var points2 = [];
coordEach(geojson, function(coord) {
points2.push([coord[0], coord[1]]);
});
if (!points2.length) {
return null;
}
var convexHull2 = concaveman$1(points2, options2.concavity);
if (convexHull2.length > 3) {
return polygon([convexHull2]);
}
return null;
}
function booleanPointInPolygon(point2, polygon2, options2) {
if (options2 === void 0) {
options2 = {};
}
if (!point2) {
throw new Error("point is required");
}
if (!polygon2) {
throw new Error("polygon is required");
}
var pt2 = getCoord(point2);
var geom = getGeom(polygon2);
var type2 = geom.type;
var bbox2 = polygon2.bbox;
var polys = geom.coordinates;
if (bbox2 && inBBox(pt2, bbox2) === false) {
return false;
}
if (type2 === "Polygon") {
polys = [polys];
}
var insidePoly = false;
for (var i2 = 0; i2 < polys.length && !insidePoly; i2++) {
if (inRing(pt2, polys[i2][0], options2.ignoreBoundary)) {
var inHole = false;
var k = 1;
while (k < polys[i2].length && !inHole) {
if (inRing(pt2, polys[i2][k], !options2.ignoreBoundary)) {
inHole = true;
}
k++;
}
if (!inHole) {
insidePoly = true;
}
}
}
return insidePoly;
}
function inRing(pt2, ring, ignoreBoundary) {
var isInside = false;
if (ring[0][0] === ring[ring.length - 1][0] && ring[0][1] === ring[ring.length - 1][1]) {
ring = ring.slice(0, ring.length - 1);
}
for (var i2 = 0, j = ring.length - 1; i2 < ring.length; j = i2++) {
var xi = ring[i2][0];
var yi = ring[i2][1];
var xj = ring[j][0];
var yj = ring[j][1];
var onBoundary = pt2[1] * (xi - xj) + yi * (xj - pt2[0]) + yj * (pt2[0] - xi) === 0 && (xi - pt2[0]) * (xj - pt2[0]) <= 0 && (yi - pt2[1]) * (yj - pt2[1]) <= 0;
if (onBoundary) {
return !ignoreBoundary;
}
var intersect = yi > pt2[1] !== yj > pt2[1] && pt2[0] < (xj - xi) * (pt2[1] - yi) / (yj - yi) + xi;
if (intersect) {
isInside = !isInside;
}
}
return isInside;
}
function inBBox(pt2, bbox2) {
return bbox2[0] <= pt2[0] && bbox2[1] <= pt2[1] && bbox2[2] >= pt2[0] && bbox2[3] >= pt2[1];
}
function distance(from3, to, options2) {
if (options2 === void 0) {
options2 = {};
}
var coordinates1 = getCoord(from3);
var coordinates2 = getCoord(to);
var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
var lat1 = degreesToRadians(coordinates1[1]);
var lat2 = degreesToRadians(coordinates2[1]);
var a = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
return radiansToLength(2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)), options2.units);
}
function bboxPolygon(bbox2, options2) {
if (options2 === void 0) {
options2 = {};
}
var west = Number(bbox2[0]);
var south = Number(bbox2[1]);
var east = Number(bbox2[2]);
var north = Number(bbox2[3]);
if (bbox2.length === 6) {
throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");
}
var lowLeft = [west, south];
var topLeft = [west, north];
var topRight = [east, north];
var lowRight = [east, south];
return polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options2.properties, { bbox: bbox2, id: options2.id });
}
function destination(origin, distance2, bearing2, options2) {
if (options2 === void 0) {
options2 = {};
}
var coordinates1 = getCoord(origin);
var longitude1 = degreesToRadians(coordinates1[0]);
var latitude1 = degreesToRadians(coordinates1[1]);
var bearingRad = degreesToRadians(bearing2);
var radians = lengthToRadians(distance2, options2.units);
var latitude2 = Math.asin(Math.sin(latitude1) * Math.cos(radians) + Math.cos(latitude1) * Math.sin(radians) * Math.cos(bearingRad));
var longitude2 = longitude1 + Math.atan2(Math.sin(bearingRad) * Math.sin(radians) * Math.cos(latitude1), Math.cos(radians) - Math.sin(latitude1) * Math.sin(latitude2));
var lng = radiansToDegrees(longitude2);
var lat = radiansToDegrees(latitude2);
return point([lng, lat], options2.properties);
}
function bearing(start2, end, options2) {
if (options2 === void 0) {
options2 = {};
}
if (options2.final === true) {
return calculateFinalBearing(start2, end);
}
var coordinates1 = getCoord(start2);
var coordinates2 = getCoord(end);
var lon1 = degreesToRadians(coordinates1[0]);
var lon2 = degreesToRadians(coordinates2[0]);
var lat1 = degreesToRadians(coordinates1[1]);
var lat2 = degreesToRadians(coordinates2[1]);
var a = Math.sin(lon2 - lon1) * Math.cos(lat2);
var b = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1);
return radiansToDegrees(Math.atan2(a, b));
}
function calculateFinalBearing(start2, end) {
var bear = bearing(end, start2);
bear = (bear + 180) % 360;
return bear;
}
function midpoint(point1, point2) {
var dist = distance(point1, point2);
var heading = bearing(point1, point2);
var midpoint2 = destination(point1, dist / 2, heading);
return midpoint2;
}
function center(geojson, options2) {
if (options2 === void 0) {
options2 = {};
}
var ext = bbox$1(geojson);
var x = (ext[0] + ext[2]) / 2;
var y = (ext[1] + ext[3]) / 2;
return point([x, y], options2.properties, options2);
}
function centroid(geojson, options2) {
if (options2 === void 0) {
options2 = {};
}
var xSum = 0;
var ySum = 0;
var len = 0;
coordEach(geojson, function(coord) {
xSum += coord[0];
ySum += coord[1];
len++;
}, true);
return point([xSum / len, ySum / len], options2.properties);
}
function centerOfMass(geojson, options2) {
if (options2 === void 0) {
options2 = {};
}
switch (getType(geojson)) {
case "Point":
return point(getCoord(geojson), options2.properties);
case "Polygon":
var coords = [];
coordEach(geojson, function(coord) {
coords.push(coord);
});
var centre = centroid(geojson, { properties: options2.properties });
var translation = centre.geometry.coordinates;
var sx = 0;
var sy = 0;
var sArea = 0;
var i2, pi, pj, xi, xj, yi, yj, a;
var neutralizedPoints = coords.map(function(point2) {
return [point2[0] - translation[0], point2[1] - translation[1]];
});
for (i2 = 0; i2 < coords.length - 1; i2++) {
pi = neutralizedPoints[i2];
xi = pi[0];
yi = pi[1];
pj = neutralizedPoints[i2 + 1];
xj = pj[0];
yj = pj[1];
a = xi * yj - xj * yi;
sArea += a;
sx += (xi + xj) * a;
sy += (yi + yj) * a;
}
if (sArea === 0) {
return centre;
} else {
var area = sArea * 0.5;
var areaFactor = 1 / (6 * area);
return point([translation[0] + areaFactor * sx, translation[1] + areaFactor * sy], options2.properties);
}
default:
var hull = convex(geojson);
if (hull)
return centerOfMass(hull, { properties: options2.properties });
else
return centroid(geojson, { properties: options2.properties });
}
}
function lineSegment(geojson) {
if (!geojson) {
throw new Error("geojson is required");
}
var results = [];
flattenEach(geojson, function(feature2) {
lineSegmentFeature(feature2, results);
});
return featureCollection$1(results);
}
function lineSegmentFeature(geojson, results) {
var coords = [];
var geometry2 = geojson.geometry;
if (geometry2 !== null) {
switch (geometry2.type) {
case "Polygon":
coords = getCoords(geometry2);
break;
case "LineString":
coords = [getCoords(geometry2)];
}
coords.forEach(function(coord) {
var segments = createSegments(coord, geojson.properties);
segments.forEach(function(segment) {
segment.id = results.length;
results.push(segment);
});
});
}
}
function createSegments(coords, properties) {
var segments = [];
coords.reduce(function(previousCoords, currentCoords) {
var segment = lineString([previousCoords, currentCoords], properties);
segment.bbox = bbox(previousCoords, currentCoords);
segments.push(segment);
return currentCoords;
});
return segments;
}
function bbox(coords1, coords2) {
var x1 = coords1[0];
var y1 = coords1[1];
var x2 = coords2[0];
var y2 = coords2[1];
var west = x1 < x2 ? x1 : x2;
var south = y1 < y2 ? y1 : y2;
var east = x1 > x2 ? x1 : x2;
var north = y1 > y2 ? y1 : y2;
return [west, south, east, north];
}
var geojsonRbush$1 = { exports: {} };
var rbush_min = { exports: {} };
(function(module2, exports2) {
!function(t2, i2) {
module2.exports = i2();
}(commonjsGlobal, function() {
function t2(t3, r3, e2, a2, h3) {
!function t4(n2, r4, e3, a3, h4) {
for (; a3 > e3; ) {
if (a3 - e3 > 600) {
var o2 = a3 - e3 + 1, s2 = r4 - e3 + 1, l2 = Math.log(o2), f2 = 0.5 * Math.exp(2 * l2 / 3), u2 = 0.5 * Math.sqrt(l2 * f2 * (o2 - f2) / o2) * (s2 - o2 / 2 < 0 ? -1 : 1), m2 = Math.max(e3, Math.floor(r4 - s2 * f2 / o2 + u2)), c2 = Math.min(a3, Math.floor(r4 + (o2 - s2) * f2 / o2 + u2));
t4(n2, r4, m2, c2, h4);
}
var p2 = n2[r4], d3 = e3, x = a3;
for (i2(n2, e3, r4), h4(n2[a3], p2) > 0 && i2(n2, e3, a3); d3 < x; ) {
for (i2(n2, d3, x), d3++, x--; h4(n2[d3], p2) < 0; )
d3++;
for (; h4(n2[x], p2) > 0; )
x--;
}
0 === h4(n2[e3], p2) ? i2(n2, e3, x) : i2(n2, ++x, a3), x <= r4 && (e3 = x + 1), r4 <= x && (a3 = x - 1);
}
}(t3, r3, e2 || 0, a2 || t3.length - 1, h3 || n);
}
function i2(t3, i3, n2) {
var r3 = t3[i3];
t3[i3] = t3[n2], t3[n2] = r3;
}
function n(t3, i3) {
return t3 < i3 ? -1 : t3 > i3 ? 1 : 0;
}
var r2 = function(t3) {
void 0 === t3 && (t3 = 9), this._maxEntries = Math.max(4, t3), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
};
function e(t3, i3, n2) {
if (!n2)
return i3.indexOf(t3);
for (var r3 = 0; r3 < i3.length; r3++)
if (n2(t3, i3[r3]))
return r3;
return -1;
}
function a(t3, i3) {
h2(t3, 0, t3.children.length, i3, t3);
}
function h2(t3, i3, n2, r3, e2) {
e2 || (e2 = p(null)), e2.minX = 1 / 0, e2.minY = 1 / 0, e2.maxX = -1 / 0, e2.maxY = -1 / 0;
for (var a2 = i3; a2 < n2; a2++) {
var h3 = t3.children[a2];
o(e2, t3.leaf ? r3(h3) : h3);
}
return e2;
}
function o(t3, i3) {
return t3.minX = Math.min(t3.minX, i3.minX), t3.minY = Math.min(t3.minY, i3.minY), t3.maxX = Math.max(t3.maxX, i3.maxX), t3.maxY = Math.max(t3.maxY, i3.maxY), t3;
}
function s(t3, i3) {
return t3.minX - i3.minX;
}
function l(t3, i3) {
return t3.minY - i3.minY;
}
function f(t3) {
return (t3.maxX - t3.minX) * (t3.maxY - t3.minY);
}
function u(t3) {
return t3.maxX - t3.minX + (t3.maxY - t3.minY);
}
function m(t3, i3) {
return t3.minX <= i3.minX && t3.minY <= i3.minY && i3.maxX <= t3.maxX && i3.maxY <= t3.maxY;
}
function c(t3, i3) {
return i3.minX <= t3.maxX && i3.minY <= t3.maxY && i3.maxX >= t3.minX && i3.maxY >= t3.minY;
}
function p(t3) {
return { children: t3, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
}
function d2(i3, n2, r3, e2, a2) {
for (var h3 = [n2, r3]; h3.length; )
if (!((r3 = h3.pop()) - (n2 = h3.pop()) <= e2)) {
var o2 = n2 + Math.ceil((r3 - n2) / e2 / 2) * e2;
t2(i3, o2, n2, r3, a2), h3.push(n2, o2, o2, r3);
}
}
return r2.prototype.all = function() {
return this._all(this.data, []);
}, r2.prototype.search = function(t3) {
var i3 = this.data, n2 = [];
if (!c(t3, i3))
return n2;
for (var r3 = this.toBBox, e2 = []; i3; ) {
for (var a2 = 0; a2 < i3.children.length; a2++) {
var h3 = i3.children[a2], o2 = i3.leaf ? r3(h3) : h3;
c(t3, o2) && (i3.leaf ? n2.push(h3) : m(t3, o2) ? this._all(h3, n2) : e2.push(h3));
}
i3 = e2.pop();
}
return n2;
}, r2.prototype.collides = function(t3) {
var i3 = this.data;
if (!c(t3, i3))
return false;
for (var n2 = []; i3; ) {
for (var r3 = 0; r3 < i3.children.length; r3++) {
var e2 = i3.children[r3], a2 = i3.leaf ? this.toBBox(e2) : e2;
if (c(t3, a2)) {
if (i3.leaf || m(t3, a2))
return true;
n2.push(e2);
}
}
i3 = n2.pop();
}
return false;
}, r2.prototype.load = function(t3) {
if (!t3 || !t3.length)
return this;
if (t3.length < this._minEntries) {
for (var i3 = 0; i3 < t3.length; i3++)
this.insert(t3[i3]);
return this;
}
var n2 = this._build(t3.slice(), 0, t3.length - 1, 0);
if (this.data.children.length)
if (this.data.height === n2.height)
this._splitRoot(this.data, n2);
else {
if (this.data.height < n2.height) {
var r3 = this.data;
this.data = n2, n2 = r3;
}
this._insert(n2, this.data.height - n2.height - 1, true);
}
else
this.data = n2;
return this;
}, r2.prototype.insert = function(t3) {
return t3 && this._insert(t3, this.data.height - 1), this;
}, r2.prototype.clear = function() {
return this.data = p([]), this;
}, r2.prototype.remove = function(t3, i3) {
if (!t3)
return this;
for (var n2, r3, a2, h3 = this.data, o2 = this.toBBox(t3), s2 = [], l2 = []; h3 || s2.length; ) {
if (h3 || (h3 = s2.pop(), r3 = s2[s2.length - 1], n2 = l2.pop(), a2 = true), h3.leaf) {
var f2 = e(t3, h3.children, i3);
if (-1 !== f2)
return h3.children.splice(f2, 1), s2.push(h3), this._condense(s2), this;
}
a2 || h3.leaf || !m(h3, o2) ? r3 ? (n2++, h3 = r3.children[n2], a2 = false) : h3 = null : (s2.push(h3), l2.push(n2), n2 = 0, r3 = h3, h3 = h3.children[0]);
}
return this;
}, r2.prototype.toBBox = function(t3) {
return t3;
}, r2.prototype.compareMinX = function(t3, i3) {
return t3.minX - i3.minX;
}, r2.prototype.compareMinY = function(t3, i3) {
return t3.minY - i3.minY;
}, r2.prototype.toJSON = function() {
return this.data;
}, r2.prototype.fromJSON = function(t3) {
return this.data = t3, this;
}, r2.prototype._all = function(t3, i3) {
for (var n2 = []; t3; )
t3.leaf ? i3.push.apply(i3, t3.children) : n2.push.apply(n2, t3.children), t3 = n2.pop();
return i3;
}, r2.prototype._build = function(t3, i3, n2, r3) {
var e2, h3 = n2 - i3 + 1, o2 = this._maxEntries;
if (h3 <= o2)
return a(e2 = p(t3.slice(i3, n2 + 1)), this.toBBox), e2;
r3 || (r3 = Math.ceil(Math.log(h3) / Math.log(o2)), o2 = Math.ceil(h3 / Math.pow(o2, r3 - 1))), (e2 = p([])).leaf = false, e2.height = r3;
var s2 = Math.ceil(h3 / o2), l2 = s2 * Math.ceil(Math.sqrt(o2));
d2(t3, i3, n2, l2, this.compareMinX);
for (var f2 = i3; f2 <= n2; f2 += l2) {
var u2 = Math.min(f2 + l2 - 1, n2);
d2(t3, f2, u2, s2, this.compareMinY);
for (var m2 = f2; m2 <= u2; m2 += s2) {
var c2 = Math.min(m2 + s2 - 1, u2);
e2.children.push(this._build(t3, m2, c2, r3 - 1));
}
}
return a(e2, this.toBBox), e2;
}, r2.prototype._chooseSubtree = function(t3, i3, n2, r3) {
for (; r3.push(i3), !i3.leaf && r3.length - 1 !== n2; ) {
for (var e2 = 1 / 0, a2 = 1 / 0, h3 = void 0, o2 = 0; o2 < i3.children.length; o2++) {
var s2 = i3.children[o2], l2 = f(s2), u2 = (m2 = t3, c2 = s2, (Math.max(c2.maxX, m2.maxX) - Math.min(c2.minX, m2.minX)) * (Math.max(c2.maxY, m2.maxY) - Math.min(c2.minY, m2.minY)) - l2);
u2 < a2 ? (a2 = u2, e2 = l2 < e2 ? l2 : e2, h3 = s2) : u2 === a2 && l2 < e2 && (e2 = l2, h3 = s2);
}
i3 = h3 || i3.children[0];
}
var m2, c2;
return i3;
}, r2.prototype._insert = function(t3, i3, n2) {
var r3 = n2 ? t3 : this.toBBox(t3), e2 = [], a2 = this._chooseSubtree(r3, this.data, i3, e2);
for (a2.children.push(t3), o(a2, r3); i3 >= 0 && e2[i3].children.length > this._maxEntries; )
this._split(e2, i3), i3--;
this._adjustParentBBoxes(r3, e2, i3);
}, r2.prototype._split = function(t3, i3) {
var n2 = t3[i3], r3 = n2.children.length, e2 = this._minEntries;
this._chooseSplitAxis(n2, e2, r3);
var h3 = this._chooseSplitIndex(n2, e2, r3), o2 = p(n2.children.splice(h3, n2.children.length - h3));
o2.height = n2.height, o2.leaf = n2.leaf, a(n2, this.toBBox), a(o2, this.toBBox), i3 ? t3[i3 - 1].children.push(o2) : this._splitRoot(n2, o2);
}, r2.prototype._splitRoot = function(t3, i3) {
this.data = p([t3, i3]), this.data.height = t3.height + 1, this.data.leaf = false, a(this.data, this.toBBox);
}, r2.prototype._chooseSplitIndex = function(t3, i3, n2) {
for (var r3, e2, a2, o2, s2, l2, u2, m2 = 1 / 0, c2 = 1 / 0, p2 = i3; p2 <= n2 - i3; p2++) {
var d3 = h2(t3, 0, p2, this.toBBox), x = h2(t3, p2, n2, this.toBBox), v = (e2 = d3, a2 = x, o2 = void 0, s2 = void 0, l2 = void 0, u2 = void 0, o2 = Math.max(e2.minX, a2.minX), s2 = Math.max(e2.minY, a2.minY), l2 = Math.min(e2.maxX, a2.maxX), u2 = Math.min(e2.maxY, a2.maxY), Math.max(0, l2 - o2) * Math.max(0, u2 - s2)), M = f(d3) + f(x);
v < m2 ? (m2 = v, r3 = p2, c2 = M < c2 ? M : c2) : v === m2 && M < c2 && (c2 = M, r3 = p2);
}
return r3 || n2 - i3;
}, r2.prototype._chooseSplitAxis = function(t3, i3, n2) {
var r3 = t3.leaf ? this.compareMinX : s, e2 = t3.leaf ? this.compareMinY : l;
this._allDistMargin(t3, i3, n2, r3) < this._allDistMargin(t3, i3, n2, e2) && t3.children.sort(r3);
}, r2.prototype._allDistMargin = function(t3, i3, n2, r3) {
t3.children.sort(r3);
for (var e2 = this.toBBox, a2 = h2(t3, 0, i3, e2), s2 = h2(t3, n2 - i3, n2, e2), l2 = u(a2) + u(s2), f2 = i3; f2 < n2 - i3; f2++) {
var m2 = t3.children[f2];
o(a2, t3.leaf ? e2(m2) : m2), l2 += u(a2);
}
for (var c2 = n2 - i3 - 1; c2 >= i3; c2--) {
var p2 = t3.children[c2];
o(s2, t3.leaf ? e2(p2) : p2), l2 += u(s2);
}
return l2;
}, r2.prototype._adjustParentBBoxes = function(t3, i3, n2) {
for (var r3 = n2; r3 >= 0; r3--)
o(i3[r3], t3);
}, r2.prototype._condense = function(t3) {
for (var i3 = t3.length - 1, n2 = void 0; i3 >= 0; i3--)
0 === t3[i3].children.length ? i3 > 0 ? (n2 = t3[i3 - 1].children).splice(n2.indexOf(t3[i3]), 1) : this.clear() : a(t3[i3], this.toBBox);
}, r2;
});
})(rbush_min);
var require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(es$2);
var require$$2 = /* @__PURE__ */ getAugmentedNamespace(es$1);
var require$$3 = /* @__PURE__ */ getAugmentedNamespace(es);
var rbush = rbush_min.exports;
var helpers = require$$1$1;
var meta = require$$2;
var turfBBox = require$$3.default;
var featureEach = meta.featureEach;
meta.coordEach;
helpers.polygon;
var featureCollection = helpers.featureCollection;
function geojsonRbush(maxEntries) {
var tree = new rbush(maxEntries);
tree.insert = function(feature2) {
if (feature2.type !== "Feature")
throw new Error("invalid feature");
feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
return rbush.prototype.insert.call(this, feature2);
};
tree.load = function(features) {
var load = [];
if (Array.isArray(features)) {
features.forEach(function(feature2) {
if (feature2.type !== "Feature")
throw new Error("invalid features");
feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
load.push(feature2);
});
} else {
featureEach(features, function(feature2) {
if (feature2.type !== "Feature")
throw new Error("invalid features");
feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
load.push(feature2);
});
}
return rbush.prototype.load.call(this, load);
};
tree.remove = function(feature2, equals) {
if (feature2.type !== "Feature")
throw new Error("invalid feature");
feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
return rbush.prototype.remove.call(this, feature2, equals);
};
tree.clear = function() {
return rbush.prototype.clear.call(this);
};
tree.search = function(geojson) {
var features = rbush.prototype.search.call(this, this.toBBox(geojson));
return featureCollection(features);
};
tree.collides = function(geojson) {
return rbush.prototype.collides.call(this, this.toBBox(geojson));
};
tree.all = function() {
var features = rbush.prototype.all.call(this);
return featureCollection(features);
};
tree.toJSON = function() {
return rbush.prototype.toJSON.call(this);
};
tree.fromJSON = function(json) {
return rbush.prototype.fromJSON.call(this, json);
};
tree.toBBox = function(geojson) {
var bbox2;
if (geojson.bbox)
bbox2 = geojson.bbox;
else if (Array.isArray(geojson) && geojson.length === 4)
bbox2 = geojson;
else if (Array.isArray(geojson) && geojson.length === 6)
bbox2 = [geojson[0], geojson[1], geojson[3], geojson[4]];
else if (geojson.type === "Feature")
bbox2 = turfBBox(geojson);
else if (geojson.type === "FeatureCollection")
bbox2 = turfBBox(geojson);
else
throw new Error("invalid geojson");
return {
minX: bbox2[0],
minY: bbox2[1],
maxX: bbox2[2],
maxY: bbox2[3]
};
};
return tree;
}
geojsonRbush$1.exports = geojsonRbush;
geojsonRbush$1.exports.default = geojsonRbush;
var rbush$1 = geojsonRbush$1.exports;
function lineIntersect(line1, line2) {
var unique = {};
var results = [];
if (line1.type === "LineString") {
line1 = feature(line1);
}
if (line2.type === "LineString") {
line2 = feature(line2);
}
if (line1.type === "Feature" && line2.type === "Feature" && line1.geometry !== null && line2.geometry !== null && line1.geometry.type === "LineString" && line2.geometry.type === "LineString" && line1.geometry.coordinates.length === 2 && line2.geometry.coordinates.length === 2) {
var intersect = intersects(line1, line2);
if (intersect) {
results.push(intersect);
}
return featureCollection$1(results);
}
var tree = rbush$1();
tree.load(lineSegment(line2));
featureEach$1(lineSegment(line1), function(segment) {
featureEach$1(tree.search(segment), function(match) {
var intersect2 = intersects(segment, match);
if (intersect2) {
var key = getCoords(intersect2).join(",");
if (!unique[key]) {
unique[key] = true;
results.push(intersect2);
}
}
});
});
return featureCollection$1(results);
}
function intersects(line1, line2) {
var coords1 = getCoords(line1);
var coords2 = getCoords(line2);
if (coords1.length !== 2) {
throw new Error(" line1 must only contain 2 coordinates");
}
if (coords2.length !== 2) {
throw new Error(" line2 must only contain 2 coordinates");
}
var x1 = coords1[0][0];
var y1 = coords1[0][1];
var x2 = coords1[1][0];
var y2 = coords1[1][1];
var x3 = coords2[0][0];
var y3 = coords2[0][1];
var x4 = coords2[1][0];
var y4 = coords2[1][1];
var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
var numeA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
var numeB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
if (denom === 0) {
if (numeA === 0 && numeB === 0) {
return null;
}
return null;
}
var uA = numeA / denom;
var uB = numeB / denom;
if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
var x = x1 + uA * (x2 - x1);
var y = y1 + uA * (y2 - y1);
return point([x, y]);
}
return null;
}
function booleanPointOnLine(pt2, line, options2) {
if (options2 === void 0) {
options2 = {};
}
var ptCoords = getCoord(pt2);
var lineCoords = getCoords(line);
for (var i2 = 0; i2 < lineCoords.length - 1; i2++) {
var ignoreBoundary = false;
if (options2.ignoreEndVertices) {
if (i2 === 0) {
ignoreBoundary = "start";
}
if (i2 === lineCoords.length - 2) {
ignoreBoundary = "end";
}
if (i2 === 0 && i2 + 1 === lineCoords.length - 1) {
ignoreBoundary = "both";
}
}
if (isPointOnLineSegment$1(lineCoords[i2], lineCoords[i2 + 1], ptCoords, ignoreBoundary, typeof options2.epsilon === "undefined" ? null : options2.epsilon)) {
return true;
}
}
return false;
}
function isPointOnLineSegment$1(lineSegmentStart, lineSegmentEnd, pt2, excludeBoundary, epsilon) {
var x = pt2[0];
var y = pt2[1];
var x1 = lineSegmentStart[0];
var y1 = lineSegmentStart[1];
var x2 = lineSegmentEnd[0];
var y2 = lineSegmentEnd[1];
var dxc = pt2[0] - x1;
var dyc = pt2[1] - y1;
var dxl = x2 - x1;
var dyl = y2 - y1;
var cross2 = dxc * dyl - dyc * dxl;
if (epsilon !== null) {
if (Math.abs(cross2) > epsilon) {
return false;
}
} else if (cross2 !== 0) {
return false;
}
if (!excludeBoundary) {
if (Math.abs(dxl) >= Math.abs(dyl)) {
return dxl > 0 ? x1 <= x && x <= x2 : x2 <= x && x <= x1;
}
return dyl > 0 ? y1 <= y && y <= y2 : y2 <= y && y <= y1;
} else if (excludeBoundary === "start") {
if (Math.abs(dxl) >= Math.abs(dyl)) {
return dxl > 0 ? x1 < x && x <= x2 : x2 <= x && x < x1;
}
return dyl > 0 ? y1 < y && y <= y2 : y2 <= y && y < y1;
} else if (excludeBoundary === "end") {
if (Math.abs(dxl) >= Math.abs(dyl)) {
return dxl > 0 ? x1 <= x && x < x2 : x2 < x && x <= x1;
}
return dyl > 0 ? y1 <= y && y < y2 : y2 < y && y <= y1;
} else if (excludeBoundary === "both") {
if (Math.abs(dxl) >= Math.abs(dyl)) {
return dxl > 0 ? x1 < x && x < x2 : x2 < x && x < x1;
}
return dyl > 0 ? y1 < y && y < y2 : y2 < y && y < y1;
}
return false;
}
function booleanWithin(feature1, feature2) {
var geom1 = getGeom(feature1);
var geom2 = getGeom(feature2);
var type1 = geom1.type;
var type2 = geom2.type;
switch (type1) {
case "Point":
switch (type2) {
case "MultiPoint":
return isPointInMultiPoint(geom1, geom2);
case "LineString":
return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });
case "Polygon":
case "MultiPolygon":
return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });
default:
throw new Error("feature2 " + type2 + " geometry not supported");
}
case "MultiPoint":
switch (type2) {
case "MultiPoint":
return isMultiPointInMultiPoint(geom1, geom2);
case "LineString":
return isMultiPointOnLine(geom1, geom2);
case "Polygon":
case "MultiPolygon":
return isMultiPointInPoly(geom1, geom2);
default:
throw new Error("feature2 " + type2 + " geometry not supported");
}
case "LineString":
switch (type2) {
case "LineString":
return isLineOnLine$1(geom1, geom2);
case "Polygon":
case "MultiPolygon":
return isLineInPoly$1(geom1, geom2);
default:
throw new Error("feature2 " + type2 + " geometry not supported");
}
case "Polygon":
switch (type2) {
case "Polygon":
case "MultiPolygon":
return isPolyInPoly$1(geom1, geom2);
default:
throw new Error("feature2 " + type2 + " geometry not supported");
}
default:
throw new Error("feature1 " + type1 + " geometry not supported");
}
}
function isPointInMultiPoint(point2, multiPoint2) {
var i2;
var output = false;
for (i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {
if (compareCoords$1(multiPoint2.coordinates[i2], point2.coordinates)) {
output = true;
break;
}
}
return output;
}
function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
for (var i2 = 0; i2 < multiPoint1.coordinates.length; i2++) {
var anyMatch = false;
for (var i22 = 0; i22 < multiPoint2.coordinates.length; i22++) {
if (compareCoords$1(multiPoint1.coordinates[i2], multiPoint2.coordinates[i22])) {
anyMatch = true;
}
}
if (!anyMatch) {
return false;
}
}
return true;
}
function isMultiPointOnLine(multiPoint2, lineString2) {
var foundInsidePoint = false;
for (var i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {
if (!booleanPointOnLine(multiPoint2.coordinates[i2], lineString2)) {
return false;
}
if (!foundInsidePoint) {
foundInsidePoint = booleanPointOnLine(multiPoint2.coordinates[i2], lineString2, { ignoreEndVertices: true });
}
}
return foundInsidePoint;
}
function isMultiPointInPoly(multiPoint2, polygon2) {
var output = true;
var isInside = false;
for (var i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {
isInside = booleanPointInPolygon(multiPoint2.coordinates[1], polygon2);
if (!isInside) {
output = false;
break;
}
{
isInside = booleanPointInPolygon(multiPoint2.coordinates[1], polygon2, {
ignoreBoundary: true
});
}
}
return output && isInside;
}
function isLineOnLine$1(lineString1, lineString2) {
for (var i2 = 0; i2 < lineString1.coordinates.length; i2++) {
if (!booleanPointOnLine(lineString1.coordinates[i2], lineString2)) {
return false;
}
}
return true;
}
function isLineInPoly$1(linestring, polygon2) {
var polyBbox = bbox$1(polygon2);
var lineBbox = bbox$1(linestring);
if (!doBBoxOverlap(polyBbox, lineBbox)) {
return false;
}
var foundInsidePoint = false;
for (var i2 = 0; i2 < linestring.coordinates.length - 1; i2++) {
if (!booleanPointInPolygon(linestring.coordinates[i2], polygon2)) {
return false;
}
if (!foundInsidePoint) {
foundInsidePoint = booleanPointInPolygon(linestring.coordinates[i2], polygon2, { ignoreBoundary: true });
}
if (!foundInsidePoint) {
var midpoint2 = getMidpoint(linestring.coordinates[i2], linestring.coordinates[i2 + 1]);
foundInsidePoint = booleanPointInPolygon(midpoint2, polygon2, {
ignoreBoundary: true
});
}
}
return foundInsidePoint;
}
function isPolyInPoly$1(geometry1, geometry2) {
var poly1Bbox = bbox$1(geometry1);
var poly2Bbox = bbox$1(geometry2);
if (!doBBoxOverlap(poly2Bbox, poly1Bbox)) {
return false;
}
for (var i2 = 0; i2 < geometry1.coordinates[0].length; i2++) {
if (!booleanPointInPolygon(geometry1.coordinates[0][i2], geometry2)) {
return false;
}
}
return true;
}
function doBBoxOverlap(bbox1, bbox2) {
if (bbox1[0] > bbox2[0])
return false;
if (bbox1[2] < bbox2[2])
return false;
if (bbox1[1] > bbox2[1])
return false;
if (bbox1[3] < bbox2[3])
return false;
return true;
}
function compareCoords$1(pair1, pair2) {
return pair1[0] === pair2[0] && pair1[1] === pair2[1];
}
function getMidpoint(pair1, pair2) {
return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
}
function pointGrid(bbox2, cellSide, options2) {
if (options2 === void 0) {
options2 = {};
}
if (options2.mask && !options2.units)
options2.units = "kilometers";
var results = [];
var west = bbox2[0];
var south = bbox2[1];
var east = bbox2[2];
var north = bbox2[3];
var xFraction = cellSide / distance([west, south], [east, south], options2);
var cellWidth = xFraction * (east - west);
var yFraction = cellSide / distance([west, south], [west, north], options2);
var cellHeight = yFraction * (north - south);
var bboxWidth = east - west;
var bboxHeight = north - south;
var columns = Math.floor(bboxWidth / cellWidth);
var rows = Math.floor(bboxHeight / cellHeight);
var deltaX = (bboxWidth - columns * cellWidth) / 2;
var deltaY = (bboxHeight - rows * cellHeight) / 2;
var currentX = west + deltaX;
while (currentX <= east) {
var currentY = south + deltaY;
while (currentY <= north) {
var cellPt = point([currentX, currentY], options2.properties);
if (options2.mask) {
if (booleanWithin(cellPt, options2.mask))
results.push(cellPt);
} else {
results.push(cellPt);
}
currentY += cellHeight;
}
currentX += cellWidth;
}
return featureCollection$1(results);
}
function polygonToLine(poly, options2) {
if (options2 === void 0) {
options2 = {};
}
var geom = getGeom(poly);
if (!options2.properties && poly.type === "Feature") {
options2.properties = poly.properties;
}
switch (geom.type) {
case "Polygon":
return polygonToLine$1(geom, options2);
case "MultiPolygon":
return multiPolygonToLine(geom, options2);
default:
throw new Error("invalid poly");
}
}
function polygonToLine$1(poly, options2) {
if (options2 === void 0) {
options2 = {};
}
var geom = getGeom(poly);
var coords = geom.coordinates;
var properties = options2.properties ? options2.properties : poly.type === "Feature" ? poly.properties : {};
return coordsToLine(coords, properties);
}
function multiPolygonToLine(multiPoly, options2) {
if (options2 === void 0) {
options2 = {};
}
var geom = getGeom(multiPoly);
var coords = geom.coordinates;
var properties = options2.properties ? options2.properties : multiPoly.type === "Feature" ? multiPoly.properties : {};
var lines = [];
coords.forEach(function(coord) {
lines.push(coordsToLine(coord, properties));
});
return featureCollection$1(lines);
}
function coordsToLine(coords, properties) {
if (coords.length > 1) {
return multiLineString(coords, properties);
}
return lineString(coords[0], properties);
}
function booleanClockwise(line) {
var ring = getCoords(line);
var sum = 0;
var i2 = 1;
var prev;
var cur;
while (i2 < ring.length) {
prev = cur || ring[0];
cur = ring[i2];
sum += (cur[0] - prev[0]) * (cur[1] + prev[1]);
i2++;
}
return sum > 0;
}
function booleanDisjoint(feature1, feature2) {
var bool = true;
flattenEach(feature1, function(flatten1) {
flattenEach(feature2, function(flatten22) {
if (bool === false) {
return false;
}
bool = disjoint(flatten1.geometry, flatten22.geometry);
});
});
return bool;
}
function disjoint(geom1, geom2) {
switch (geom1.type) {
case "Point":
switch (geom2.type) {
case "Point":
return !compareCoords(geom1.coordinates, geom2.coordinates);
case "LineString":
return !isPointOnLine(geom2, geom1);
case "Polygon":
return !booleanPointInPolygon(geom1, geom2);
}
break;
case "LineString":
switch (geom2.type) {
case "Point":
return !isPointOnLine(geom1, geom2);
case "LineString":
return !isLineOnLine(geom1, geom2);
case "Polygon":
return !isLineInPoly(geom2, geom1);
}
break;
case "Polygon":
switch (geom2.type) {
case "Point":
return !booleanPointInPolygon(geom2, geom1);
case "LineString":
return !isLineInPoly(geom1, geom2);
case "Polygon":
return !isPolyInPoly(geom2, geom1);
}
}
return false;
}
function isPointOnLine(lineString2, pt2) {
for (var i2 = 0; i2 < lineString2.coordinates.length - 1; i2++) {
if (isPointOnLineSegment(lineString2.coordinates[i2], lineString2.coordinates[i2 + 1], pt2.coordinates)) {
return true;
}
}
return false;
}
function isLineOnLine(lineString1, lineString2) {
var doLinesIntersect = lineIntersect(lineString1, lineString2);
if (doLinesIntersect.features.length > 0) {
return true;
}
return false;
}
function isLineInPoly(polygon2, lineString2) {
for (var _i = 0, _a2 = lineString2.coordinates; _i < _a2.length; _i++) {
var coord = _a2[_i];
if (booleanPointInPolygon(coord, polygon2)) {
return true;
}
}
var doLinesIntersect = lineIntersect(lineString2, polygonToLine(polygon2));
if (doLinesIntersect.features.length > 0) {
return true;
}
return false;
}
function isPolyInPoly(feature1, feature2) {
for (var _i = 0, _a2 = feature1.coordinates[0]; _i < _a2.length; _i++) {
var coord1 = _a2[_i];
if (booleanPointInPolygon(coord1, feature2)) {
return true;
}
}
for (var _b = 0, _c = feature2.coordinates[0]; _b < _c.length; _b++) {
var coord2 = _c[_b];
if (booleanPointInPolygon(coord2, feature1)) {
return true;
}
}
var doLinesIntersect = lineIntersect(polygonToLine(feature1), polygonToLine(feature2));
if (doLinesIntersect.features.length > 0) {
return true;
}
return false;
}
function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt2) {
var dxc = pt2[0] - lineSegmentStart[0];
var dyc = pt2[1] - lineSegmentStart[1];
var dxl = lineSegmentEnd[0] - lineSegmentStart[0];
var dyl = lineSegmentEnd[1] - lineSegmentStart[1];
var cross2 = dxc * dyl - dyc * dxl;
if (cross2 !== 0) {
return false;
}
if (Math.abs(dxl) >= Math.abs(dyl)) {
if (dxl > 0) {
return lineSegmentStart[0] <= pt2[0] && pt2[0] <= lineSegmentEnd[0];
} else {
return lineSegmentEnd[0] <= pt2[0] && pt2[0] <= lineSegmentStart[0];
}
} else if (dyl > 0) {
return lineSegmentStart[1] <= pt2[1] && pt2[1] <= lineSegmentEnd[1];
} else {
return lineSegmentEnd[1] <= pt2[1] && pt2[1] <= lineSegmentStart[1];
}
}
function compareCoords(pair1, pair2) {
return pair1[0] === pair2[0] && pair1[1] === pair2[1];
}
function booleanIntersects(feature1, feature2) {
var bool = false;
flattenEach(feature1, function(flatten1) {
flattenEach(feature2, function(flatten22) {
if (bool === true) {
return true;
}
bool = !booleanDisjoint(flatten1.geometry, flatten22.geometry);
});
});
return bool;
}
function rectangleGrid(bbox2, cellWidth, cellHeight, options2) {
if (options2 === void 0) {
options2 = {};
}
var results = [];
var west = bbox2[0];
var south = bbox2[1];
var east = bbox2[2];
var north = bbox2[3];
var xFraction = cellWidth / distance([west, south], [east, south], options2);
var cellWidthDeg = xFraction * (east - west);
var yFraction = cellHeight / distance([west, south], [west, north], options2);
var cellHeightDeg = yFraction * (north - south);
var bboxWidth = east - west;
var bboxHeight = north - south;
var columns = Math.floor(bboxWidth / cellWidthDeg);
var rows = Math.floor(bboxHeight / cellHeightDeg);
var deltaX = (bboxWidth - columns * cellWidthDeg) / 2;
var deltaY = (bboxHeight - rows * cellHeightDeg) / 2;
var currentX = west + deltaX;
for (var column = 0; column < columns; column++) {
var currentY = south + deltaY;
for (var row = 0; row < rows; row++) {
var cellPoly = polygon([
[
[currentX, currentY],
[currentX, currentY + cellHeightDeg],
[currentX + cellWidthDeg, currentY + cellHeightDeg],
[currentX + cellWidthDeg, currentY],
[currentX, currentY]
]
], options2.properties);
if (options2.mask) {
if (booleanIntersects(options2.mask, cellPoly)) {
results.push(cellPoly);
}
} else {
results.push(cellPoly);
}
currentY += cellHeightDeg;
}
currentX += cellWidthDeg;
}
return featureCollection$1(results);
}
function squareGrid(bbox2, cellSide, options2) {
if (options2 === void 0) {
options2 = {};
}
return rectangleGrid(bbox2, cellSide, cellSide, options2);
}
class ViewShed {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this.viewer = viewer2;
this.handler = void 0;
this.lightCamera;
this.pyramid;
this.frustumPrimitive;
this.viewershedPolygon;
}
initHandler() {
if (this.handler) {
this.handler.destroy();
this.handler = void 0;
}
let canvas = document.getElementById("canvasMap");
if (canvas == null) {
canvas = document.createElement("canvas");
canvas.id = "canvasMap";
canvas.style.display = "none";
canvas.style.top = "0px";
canvas.style.position = "absolute";
document.body.append(canvas);
}
this.canvasEle = canvas;
}
ReturnDistance(pos0, pos1) {
let point1cartographic = Cesium.Cartographic.fromCartesian(pos0);
let point2cartographic = Cesium.Cartographic.fromCartesian(pos1);
let geodesic = new Cesium.EllipsoidGeodesic();
geodesic.setEndPoints(point1cartographic, point2cartographic);
let s = geodesic.surfaceDistance;
return s;
}
getHeight(x, y, objectsToExclude) {
let endCartographic = Cesium.Cartographic.fromDegrees(x, y);
let endHeight = this.viewer.scene.sampleHeight(
endCartographic,
objectsToExclude
);
return endHeight;
}
cartesian3ToDegree(Cartesian32) {
let _ellipsoid = this.viewer.scene.globe.ellipsoid;
let _cartographic = _ellipsoid.cartesianToCartographic(Cartesian32);
let _lat = Cesium.Math.toDegrees(_cartographic.latitude);
let _lng = Cesium.Math.toDegrees(_cartographic.longitude);
let _alt = _cartographic.height;
return [_lng, _lat, _alt];
}
getAngle(lng1, lat1, lng2, lat2) {
let dRotateAngle = Math.atan2(Math.abs(lng1 - lng2), Math.abs(lat1 - lat2));
if (lng2 >= lng1) {
dRotateAngle = lat2 < lat1 ? Math.PI - dRotateAngle : dRotateAngle;
} else {
dRotateAngle = lat2 >= lat1 ? 2 * Math.PI - dRotateAngle : Math.PI + dRotateAngle;
}
dRotateAngle = dRotateAngle * 180 / Math.PI;
return dRotateAngle;
}
getPitch(pointA, pointB) {
let transfrom = Cesium.Transforms.eastNorthUpToFixedFrame(pointA);
const vector = Cesium.Cartesian3.subtract(
pointB,
pointA,
new Cesium.Cartesian3()
);
let direction = Cesium.Matrix4.multiplyByPointAsVector(
Cesium.Matrix4.inverse(transfrom, transfrom),
vector,
vector
);
Cesium.Cartesian3.normalize(direction, direction);
return Cesium.Math.PI_OVER_TWO - Cesium.Math.acosClamped(direction.z);
}
updateViewShed() {
this.clear();
this.setLightCamera();
this.addVisualPyramid();
this.createFrustum();
}
clear() {
if (this.pyramid) {
this.viewer.entities.removeById(this.pyramid.id);
this.pyramid = void 0;
}
if (this.frustumPrimitive) {
this.viewer.scene.primitives.remove(this.frustumPrimitive);
this.frustumPrimitive = void 0;
}
if (this.debugModelMatrixPrimitive) {
this.viewer.scene.primitives.remove(this.debugModelMatrixPrimitive);
this.debugModelMatrixPrimitive = void 0;
}
}
addVisualPyramid() {
let options2 = this.ViewShedOptions;
let position2 = options2.viewPosition;
let visualRange = Number(options2.visualRange);
let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(position2);
this.debugModelMatrixPrimitive = this.viewer.scene.primitives.add(
new Cesium.DebugModelMatrixPrimitive({
modelMatrix: transform3,
length: 5
})
);
const halfClock = options2.horizontalViewAngle / 2;
const halfCone = options2.verticalViewAngle / 2;
const pitch = Cesium.Math.toDegrees(options2.pitch);
const ellipsoid = new Cesium.EllipsoidGraphics({
radii: new Cesium.Cartesian3(visualRange, visualRange, visualRange),
minimumClock: Cesium.Math.toRadians(90 - options2.direction - halfClock),
maximumClock: Cesium.Math.toRadians(90 - options2.direction + halfClock),
minimumCone: Cesium.Math.toRadians(90 - pitch - halfCone),
maximumCone: Cesium.Math.toRadians(90 - pitch + halfCone),
fill: false,
outline: true,
subdivisions: 256,
stackPartitions: 64,
slicePartitions: 64,
outlineColor: Cesium.Color.YELLOWGREEN.withAlpha(0.5)
});
const pyramidEntity = new Cesium.Entity({
position: position2,
ellipsoid
});
this.pyramid = this.viewer.entities.add(pyramidEntity);
}
setLightCamera() {
if (!this.lightCamera) {
this.lightCamera = new Cesium.Camera(this.viewer.scene);
}
let options2 = this.ViewShedOptions;
let visualRange = Number(options2.visualRange);
this.lightCamera.position = options2.viewPosition;
this.lightCamera.frustum.near = 0.1;
this.lightCamera.frustum.far = visualRange;
const hr = Cesium.Math.toRadians(options2.horizontalViewAngle);
const vr = Cesium.Math.toRadians(options2.verticalViewAngle);
this.lightCamera.frustum.aspectRatio = visualRange * Math.tan(hr / 2) * 2 / (visualRange * Math.tan(vr / 2) * 2);
this.lightCamera.frustum.fov = hr > vr ? hr : vr;
this.lightCamera.setView({
destination: options2.viewPosition,
orientation: {
heading: Cesium.Math.toRadians(options2.direction || 0),
pitch: options2.pitch || 0,
roll: 0
}
});
}
createFrustum() {
const scratchRight = new Cesium.Cartesian3();
const scratchRotation = new Cesium.Matrix3();
const scratchOrientation = new Cesium.Quaternion();
const direction = this.lightCamera.directionWC;
const up = this.lightCamera.upWC;
let right = this.lightCamera.rightWC;
right = Cesium.Cartesian3.negate(right, scratchRight);
let rotation = scratchRotation;
Cesium.Matrix3.setColumn(rotation, 0, right, rotation);
Cesium.Matrix3.setColumn(rotation, 1, up, rotation);
Cesium.Matrix3.setColumn(rotation, 2, direction, rotation);
let orientation = Cesium.Quaternion.fromRotationMatrix(
rotation,
scratchOrientation
);
let instanceOutline = new Cesium.GeometryInstance({
geometry: new Cesium.FrustumOutlineGeometry({
frustum: this.lightCamera.frustum,
origin: this.ViewShedOptions.viewPosition,
orientation
}),
id: "\u89C6\u690E\u4F53\u8F6E\u5ED3\u7EBF" + Math.random().toString(36).substr(2),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(
new Cesium.Color(0, 1, 0, 1)
),
show: new Cesium.ShowGeometryInstanceAttribute(true)
}
});
this.frustumPrimitive = this.viewer.scene.primitives.add(
new Cesium.Primitive({
geometryInstances: instanceOutline,
appearance: new Cesium.PerInstanceColorAppearance({
flat: true,
translucent: false,
closed: true
})
})
);
}
addViewershedPolygon(positionArr) {
let polygon2 = new Cesium.PolygonGeometry({
polygonHierarchy: new Cesium.PolygonHierarchy(
Cesium.Cartesian3.fromDegreesArray(positionArr)
),
height: 0,
extrudedHeight: 0,
vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,
stRotation: 0,
ellipsoid: Cesium.Ellipsoid.WGS84,
granularity: Cesium.Math.RADIANS_PER_DEGREE,
perPositionHeight: false,
closeTop: true,
closeBottom: true,
arcType: Cesium.ArcType.GEODESIC
});
let polygonInstance = new Cesium.GeometryInstance({
geometry: polygon2,
name: "ViewershedPolygon",
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(
Cesium.Color.BLUE.withAlpha(0.6)
),
show: new Cesium.ShowGeometryInstanceAttribute(true)
}
});
this.viewershedPolygon = this.viewer.scene.primitives.add(
new Cesium.GroundPrimitive({
geometryInstances: polygonInstance,
appearance: new Cesium.EllipsoidSurfaceAppearance({
aboveGround: true,
material: new Cesium.Material({
fabric: {
type: "Image",
uniforms: {
image: this.returnImgae()
}
}
})
})
})
);
}
drawViewershed(precision) {
const pos = this.cartesian3ToDegree(this.ViewShedOptions.viewPosition);
const radius = this.ViewShedOptions.visualRange;
const direction = this.ViewShedOptions.direction;
let boundary = this.computeBoundaryOptions(pos, radius, direction);
const bbox2 = boundary.bbox;
let mask = polygon([boundary.boundaryPoints]);
const dis = this.ViewShedOptions.visualRange / (precision * 1e3);
let gridPoints = pointGrid(bbox2, dis, {
mask
});
console.log(this.ViewShedOptions.visualRange, precision, dis);
let pointsResult = this.createTargetPoints(gridPoints, dis, pos);
let variogram = index.train(
pointsResult.values,
pointsResult.lngs,
pointsResult.lats,
"exponential",
0,
100
);
let grid2 = index.grid([boundary.boundaryPoints], variogram, dis / 1e3);
const colors = [
"#ff000080",
"#ff000080",
"#ff000080",
"#ff000080",
"#ff000080",
"#ff000080",
"#00ff0080",
"#00ff0080",
"#00ff0080",
"#00ff0080",
"#00ff0080",
"#00ff0080"
];
this.canvasEle.width = 3840;
this.canvasEle.height = 2160;
index.plot(
this.canvasEle,
grid2,
[bbox2[0], bbox2[2]],
[bbox2[1], bbox2[3]],
colors
);
this.addViewershedPolygon(boundary.positionArr);
}
computeBoundaryOptions(pos, radius, angle) {
let Ea = 6378137;
let Eb = 6356725;
const lng = pos[0], lat = pos[1];
const bbox2 = [lng, lat, lng, lat];
let positionArr = [];
let boundaryPoints = [];
positionArr.push(lng, lat);
boundaryPoints.push([lng, lat]);
let start2 = angle + 45 > 360 ? angle - 45 - 360 : angle - 45;
let end = start2 + 90;
for (let i2 = start2; i2 <= end; i2++) {
let dx = radius * Math.sin(i2 * Math.PI / 180);
let dy = radius * Math.cos(i2 * Math.PI / 180);
let ec = Eb + (Ea - Eb) * (90 - lat) / 90;
let ed = ec * Math.cos(lat * Math.PI / 180);
let BJD = lng + dx / ed * 180 / Math.PI;
let BWD = lat + dy / ec * 180 / Math.PI;
positionArr.push(BJD, BWD);
boundaryPoints.push([BJD, BWD]);
this.refreshBBox(bbox2, BJD, BWD);
}
boundaryPoints.push([lng, lat]);
return {
positionArr,
boundaryPoints,
bbox: bbox2
};
}
refreshBBox(result, x, y) {
result[0] = x < result[0] ? x : result[0];
result[1] = y < result[1] ? y : result[1];
result[2] = x > result[2] ? x : result[2];
result[3] = y > result[3] ? y : result[3];
}
createTargetPoints(gridPoints, step, sourcePos) {
let positionArr = [];
let objectsToExclude = [
this.frustumPrimitive,
this.pyramid,
this.debugModelMatrixPrimitive
];
let values3 = [], lngs = [], lats = [];
let height2 = this.getHeight(sourcePos[0], sourcePos[1], objectsToExclude);
positionArr.push({
x: sourcePos[0],
y: sourcePos[1],
z: height2
});
let viewPoint = this.ViewShedOptions.viewPosition;
for (let index2 = 0; index2 < gridPoints.features.length; index2++) {
const feature2 = gridPoints.features[index2];
const coords = feature2.geometry.coordinates;
const x = coords[0], y = coords[1];
let h2 = this.getHeight(x, y, objectsToExclude);
let endPoint = Cesium.Cartesian3.fromDegrees(x, y, h2);
let direction = Cesium.Cartesian3.normalize(
Cesium.Cartesian3.subtract(
endPoint,
viewPoint,
new Cesium.Cartesian3()
),
new Cesium.Cartesian3()
);
let ray = new Cesium.Ray(viewPoint, direction);
let result = this.viewer.scene.pickFromRay(ray, objectsToExclude);
if (result) {
let buffer = this.ReturnDistance(endPoint, result.position);
if (buffer > step) {
values3.push(0);
} else {
values3.push(1);
}
lngs.push(x);
lats.push(y);
}
}
return {
values: values3,
lngs,
lats
};
}
returnImgae() {
return this.canvasEle.toDataURL("image/png");
}
}
Object.assign(ViewShed.prototype, {
createViewshed: function(precision) {
let _self = this;
let scene = _self.viewer.scene;
_self.initHandler();
_self.clearAll();
let count = 0;
let toolTip = "\u5DE6\u952E\u70B9\u51FB\u521B\u5EFA\u8D77\u70B9";
_self.handler = new Cesium.ScreenSpaceEventHandler(_self.viewer.canvas);
_self.handler.setInputAction((event2) => {
count++;
if (count === 1) {
toolTip = "\u5DE6\u952E\u70B9\u51FB\u521B\u5EFA\u7EC8\u70B9";
let earthPosition = scene.pickPosition(event2.position);
let pos = _self.cartesian3ToDegree(earthPosition);
_self.handler.setInputAction(function(move) {
CreateRemindertip(toolTip, move.endPosition, true);
let newPosition = scene.pickPosition(move.endPosition);
if (Cesium.defined(newPosition)) {
let pos1 = _self.cartesian3ToDegree(newPosition);
let distance2 = Cesium.Cartesian3.distance(newPosition, earthPosition);
let angle = _self.getAngle(pos[0], pos[1], pos1[0], pos1[1]);
let pitch = _self.getPitch(earthPosition, newPosition);
_self.ViewShedOptions = {
viewPosition: earthPosition,
endPosition: newPosition,
direction: angle,
pitch,
horizontalViewAngle: 90,
verticalViewAngle: 60,
visibleAreaColor: Cesium.Color.GREEN,
invisibleAreaColor: Cesium.Color.RED,
visualRange: distance2
};
_self.updateViewShed();
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
}
if (count === 2) {
_self.initHandler();
_self.drawViewershed(precision);
CreateRemindertip(toolTip, event2.endPosition, false);
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
_self.handler.setInputAction(function(move) {
CreateRemindertip(toolTip, move.endPosition, true);
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
},
clearAll: function() {
this.clear();
if (this.viewershedPolygon) {
this.viewer.scene.primitives.remove(this.viewershedPolygon);
this.viewershedPolygon = void 0;
}
}
});
class SunshineShadow {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
this._stopTime = null;
}
}
Object.assign(SunshineShadow.prototype, {
startSunShine(options2) {
options2 = options2 || {};
if (!Cesium.defined(options2.startTime)) {
options2.startTime = new Date().getTime();
}
if (!Cesium.defined(options2.stopTime)) {
options2.stopTime = new Date().getTime() + 1e3;
}
if (!Cesium.defined(options2.speed)) {
options2.speed = 1600;
}
if (this._stopTime) {
this._viewer.clock.shouldAnimate = true;
this._viewer.clock.currentTime = this._stopTime;
} else {
this._viewer.scene.globe.enableLighting = true;
this._viewer.shadows = true;
this._viewer.clock.startTime = Cesium.JulianDate.fromDate(new Date(options2.startTime));
this._viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(options2.startTime));
this._viewer.clock.stopTime = Cesium.JulianDate.fromDate(new Date(options2.stopTime));
console.log(this._viewer.clock.currentTime);
this._viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
this._viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER;
this._viewer.clock.multiplier = options2.speed;
this._viewer.clock.canAnimate = true;
this._viewer.clock.shouldAnimate = true;
}
},
stopSunShine() {
this._stopTime = this._viewer.clock.currentTime;
console.log(this._viewer.clock.currentTime);
this._viewer.clock.shouldAnimate = false;
},
removeSunShine() {
if (this._stopTime) {
this._viewer.clock.shouldAnimate = true;
this._viewer.clock.currentTime = this._stopTime;
console.log(this._viewer.clock.currentTime);
}
this._viewer.scene.globe.enableLighting = false;
this._viewer.shadows = false;
this._stopTime = null;
}
});
Object.assign(SunshineShadow.prototype, {
start(options2) {
if (document.getElementsByClassName("cesium-viewer-animationContainer").length > 0) {
document.getElementsByClassName("cesium-viewer-animationContainer")[0].style.display = "block";
}
if (document.getElementsByClassName("cesium-viewer-timelineContainer").length > 0) {
document.getElementsByClassName("cesium-viewer-timelineContainer")[0].style.display = "block";
}
this._viewer.shadows = true;
options2 = options2 || {};
if (!Cesium.defined(options2.startTime)) {
options2.startTime = new Date(new Date().toLocaleDateString()).getTime();
console.log("\u5F53\u5929\u51CC\u66680\u70B9", new Date(new Date().toLocaleDateString()));
}
if (!Cesium.defined(options2.stopTime)) {
options2.stopTime = new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1e3 - 1;
console.log("\u5F53\u592923\u70B959\u520659\u79D2", new Date(new Date(new Date().toLocaleDateString()).getTime() + 4 * 60 * 60 * 1e3));
}
if (!Cesium.defined(options2.speed)) {
options2.speed = 1600;
}
let start2 = Cesium.JulianDate.fromDate(new Date(options2.startTime));
let stop = Cesium.JulianDate.fromDate(new Date(options2.stopTime));
viewer.timeline.zoomTo(start2, stop);
let clock2 = viewer.clock;
clock2.shouldAnimate = false;
clock2.startTime = start2;
clock2.stopTime = stop;
clock2.currentTime = start2;
clock2.clockRange = Cesium.ClockRange.UNBOUNDED;
clock2.multiplier = options2.speed;
},
remove() {
if (document.getElementsByClassName("cesium-viewer-animationContainer").length > 0) {
document.getElementsByClassName("cesium-viewer-animationContainer")[0].style.display = "none";
}
if (document.getElementsByClassName("cesium-viewer-timelineContainer").length > 0) {
document.getElementsByClassName("cesium-viewer-timelineContainer")[0].style.display = "none";
}
this._viewer.shadows = false;
this._viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(new Date().getTime()));
this._viewer.clock.shouldAnimate = false;
}
});
class Profile {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
this._profileEntities = [];
}
_interPoints(positions, objectsToExclude) {
let positionsCartographic = [];
let terrainSamplePositions = [];
for (let index2 = 0; index2 < positions.length; index2++) {
const element = positions[index2];
let ellipsoid = this._viewer.scene.globe.ellipsoid;
let cartographic = ellipsoid.cartesianToCartographic(element);
positionsCartographic.push(cartographic);
}
for (let i2 = 0; i2 < positionsCartographic.length; i2++) {
const m_Cartographic0 = positionsCartographic[i2];
const m_Cartographic1 = positionsCartographic[i2 + 1];
if (m_Cartographic1) {
let a = Math.abs(m_Cartographic0.longitude - m_Cartographic1.longitude) * 1e7;
let b = Math.abs(m_Cartographic0.latitude - m_Cartographic1.latitude) * 1e7;
if (a > b)
b = a;
let length = parseInt(b / 2);
if (length > 1e3)
length = 1e3;
if (length < 2)
length = 2;
for (let j = 0; j < length; j++) {
terrainSamplePositions.push(
new Cesium.Cartographic(
Cesium.Math.lerp(
m_Cartographic0.longitude,
m_Cartographic1.longitude,
j / (length - 1)
),
Cesium.Math.lerp(
m_Cartographic0.latitude,
m_Cartographic1.latitude,
j / (length - 1)
)
)
);
}
terrainSamplePositions.pop();
} else {
terrainSamplePositions.push(m_Cartographic0);
}
}
let positions_Inter = [];
let distance2 = 0;
for (let n = 0; n < terrainSamplePositions.length; n++) {
let curCartographic = terrainSamplePositions[n];
let height2 = this._viewer.scene.sampleHeight(curCartographic, objectsToExclude);
const lon = curCartographic.longitude / Math.PI * 180;
const lat = curCartographic.latitude / Math.PI * 180;
let point2 = Cesium.Cartesian3.fromDegrees(lon, lat, height2);
let preCartographic = terrainSamplePositions[n - 1];
if (preCartographic) {
const lon1 = preCartographic.longitude / Math.PI * 180;
const lat1 = preCartographic.latitude / Math.PI * 180;
let point1 = Cesium.Cartesian3.fromDegrees(lon1, lat1, height2);
let curDis = Cesium.Cartesian3.distance(point1, point2);
distance2 += curDis;
}
positions_Inter.push({
position: {
lon,
lat,
height: height2
},
distance: distance2
});
}
return positions_Inter;
}
}
Object.assign(Profile.prototype, {
startProfileAnalysis(points2, entity) {
return new Promise((resolve2, reject2) => {
let _self = this;
let positions = points2.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
_self.removeProfileAnalysis();
entity.clampToGround = true;
console.log(positions);
let pointsList = _self._interPoints(positions, [entity]);
console.log(pointsList);
resolve2(pointsList);
});
},
removeProfileAnalysis() {
let _self = this;
if (_self._profileEntities && _self._profileEntities.length > 0) {
_self._profileEntities.forEach((element) => {
_self._viewer.entities.remove(element);
});
}
_self._profileEntities = [];
}
});
class CutFill {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
this.delEntitys = [];
this.maxHeigh = -1e6;
}
_VolumeAnalysis(options2) {
let _self = this;
let cutArea = 0, cutVolume = 0, fillArea = 0, fillVolume = 0;
const indices = options2.geom.indices;
const positions = options2.geom.attributes.position.values;
for (let index2 = 0; index2 < indices.length; index2 += 3) {
const pos0 = _self._returnPosition(positions, indices[index2]);
const pos1 = _self._returnPosition(positions, indices[index2 + 1]);
const pos2 = _self._returnPosition(positions, indices[index2 + 2]);
let _entities = _self._viewer.entities.add({
name: "\u4E09\u89D2\u9762",
polygon: {
hierarchy: [pos0.heightPos, pos1.heightPos, pos2.heightPos],
perPositionHeight: true,
material: Cesium.Color.fromRandom(),
extrudedHeight: options2.height,
outline: true,
outlineColor: Cesium.Color.BLACK
}
});
_self.delEntitys.push(_entities);
const area = _self._computeArea4Triangle(
pos0.noHeightPos,
pos1.noHeightPos,
pos2.noHeightPos
);
const height2 = (pos0.height + pos1.height + pos2.height) / 3;
if (height2 < options2.height) {
fillArea += area;
const volume = area * (options2.height - height2);
fillVolume += volume;
} else {
cutArea += area;
const volume = area * (height2 - options2.height);
cutVolume += volume;
}
}
let allArea = cutArea + fillArea;
allArea = allArea.toFixed(2);
cutArea = cutArea.toFixed(2);
cutVolume = cutVolume.toFixed(2);
fillArea = fillArea.toFixed(2);
fillVolume = fillVolume.toFixed(2);
let result = {
allArea,
cutArea,
cutVolume,
fillArea,
fillVolume
};
return result;
}
_computeArea4Triangle(pos1, pos2, pos3) {
let a = Cesium.Cartesian3.distance(pos1, pos2);
let b = Cesium.Cartesian3.distance(pos2, pos3);
let c = Cesium.Cartesian3.distance(pos3, pos1);
let S = (a + b + c) / 2;
return Math.sqrt(S * (S - a) * (S - b) * (S - c));
}
_returnPosition(positions, index2) {
let cartesian = new Cesium.Cartesian3(
positions[index2 * 3],
positions[index2 * 3 + 1],
positions[index2 * 3 + 2]
);
let cartographic = Cesium.Cartographic.fromCartesian(cartesian);
let height2 = this._viewer.scene.sampleHeightSupported ? this._viewer.scene.sampleHeight(cartographic) : this._viewer.scene.globe.getHeight(cartographic);
if (height2 > this.maxHeigh) {
this.maxHeigh = height2;
}
return {
heightPos: Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, height2),
noHeightPos: Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0),
height: height2
};
}
}
Object.assign(CutFill.prototype, {
createPolygonGeo(points2, options2) {
return new Promise((resolve2, reject2) => {
let _self = this;
options2 = options2 || {};
options2.precision = Cesium.defaultValue(options2.precision, 256);
options2.height = Cesium.defaultValue(options2.height, 10);
_self.remove();
let positions = [];
for (let i2 = 0; i2 < points2.length; i2++) {
if (points2[i2] instanceof Cesium.Cartesian3) {
positions.push(points2[i2]);
} else {
positions.push(Cesium.Cartesian3.fromDegrees(points2[i2][0], points2[i2][1], points2[i2][1] || 0));
}
}
let granularity = Math.PI / Math.pow(2, 11);
granularity = granularity / options2.precision;
let polygonGeometry = new Cesium.PolygonGeometry.fromPositions({
positions,
vertexFormat: Cesium.PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,
granularity
});
options2.geom = new Cesium.PolygonGeometry.createGeometry(polygonGeometry);
let result = _self._VolumeAnalysis(options2);
_self._viewer.scene.globe.baseColor = new Cesium.Color(1, 1, 1, 0.9);
_self._viewer.scene.screenSpaceCameraController.enableCollisionDetection = false;
_self._viewer.scene.globe.translucency.enabled = true;
resolve2(result);
});
},
remove() {
for (var i2 = 0; i2 < this.delEntitys.length; i2++) {
this._viewer.entities.remove(this.delEntitys[i2]);
}
this._viewer.scene.screenSpaceCameraController.enableCollisionDetection = true;
this._viewer.scene.globe.translucency.enabled = false;
}
});
class HeightLimit {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
this.targetY = 0;
}
_setPolygon(options2) {
let _self = this;
_self.HiePolygon = _self._viewer.entities.add({
polygon: {
hierarchy: new Cesium.PolygonHierarchy(_self.data),
material: _self._handleColor("#FFF8DC", options2.alpha),
height: new Cesium.CallbackProperty(_self._createPolygonUpdateFunction(), false),
perPositionHeight: false,
outline: true,
outlineColor: _self._handleColor("red", options2.alpha),
outlineWidth: 1
}
});
}
_createPolygonUpdateFunction() {
let _self = this;
return function() {
return _self.targetY;
};
}
_handleColor(color2, alpha) {
return Cesium.Color.fromCssColorString(color2).withAlpha(alpha || 1);
}
_getMinHeight(points2) {
let height2 = 0;
points2.map((point2) => {
let _height = point2[2] || 0;
height2 = _height;
if (_height < height2) {
height2 = _height;
}
});
return height2;
}
}
Object.assign(HeightLimit.prototype, {
addPrimitive(points2, options2) {
this.removePrimitive();
options2 = options2 || {};
options2.height = Cesium.defaultValue(options2.height, 50);
options2.baseHeight = Cesium.defaultValue(options2.baseHeight, 50);
options2.color = Cesium.defaultValue(options2.color, "red");
options2.alpha = Cesium.defaultValue(options2.alpha, 0.6);
let positions = points2.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
let _self = this;
_self.data = positions;
_self.baseHeight = options2.baseHeight;
_self.targetY = options2.baseHeight + options2.height;
let polygonInstance = new Cesium.GeometryInstance({
geometry: new Cesium.PolygonGeometry({
polygonHierarchy: new Cesium.PolygonHierarchy(_self.data),
height: _self.baseHeight,
extrudedHeight: _self.baseHeight + 3e3
}),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(
Cesium.Color.fromCssColorString(options2.color).withAlpha(options2.alpha)
),
show: new Cesium.ShowGeometryInstanceAttribute(true)
}
});
_self.limitHeightPrimitive = _self._viewer.scene.primitives.add(
new Cesium.ClassificationPrimitive({
geometryInstances: polygonInstance,
releaseGeometryInstances: false,
classificationType: Cesium.ClassificationType.CESIUM_3D_TILE
})
);
_self._setPolygon(options2);
},
removePrimitive() {
if (this.HiePolygon) {
this._viewer.entities.remove(this.HiePolygon);
}
if (this.limitHeightPrimitive) {
this._viewer.scene.primitives.remove(this.limitHeightPrimitive);
}
},
changeHeight(height2) {
if (!this.limitHeightPrimitive)
return;
this.targetY = this.baseHeight + height2;
let cartographic = Cesium.Cartographic.fromCartesian(this.limitHeightPrimitive._primitive._boundingSpheres[0].center);
let surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, this.baseHeight);
let offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, this.baseHeight + height2);
let translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
this.limitHeightPrimitive._primitive.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
}
});
class Cutting {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
this._camera = this._viewer.camera;
this._scene = this._viewer.scene;
this.targetY = 0;
this._mouseHandler();
}
_mouseHandler() {
let _self = this;
let viewer2 = _self._viewer;
let scene = _self._scene;
let selectedPlane;
let downHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
downHandler.setInputAction(function(movement) {
let pickedObject = scene.pick(movement.position);
if (Cesium.defined(pickedObject) && Cesium.defined(pickedObject.id) && Cesium.defined(pickedObject.id.plane)) {
selectedPlane = pickedObject.id.plane;
selectedPlane.material = Cesium.Color.RED.withAlpha(0.05);
selectedPlane.outlineColor = Cesium.Color.RED;
scene.screenSpaceCameraController.enableInputs = false;
}
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
let upHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
upHandler.setInputAction(function() {
if (Cesium.defined(selectedPlane)) {
selectedPlane.material = Cesium.Color.RED.withAlpha(0.1);
selectedPlane.outlineColor = Cesium.Color.RED;
selectedPlane = void 0;
}
scene.screenSpaceCameraController.enableInputs = true;
}, Cesium.ScreenSpaceEventType.LEFT_UP);
let moveHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
moveHandler.setInputAction(function(movement) {
if (Cesium.defined(selectedPlane)) {
let deltaY = movement.startPosition.y - movement.endPosition.y;
_self.targetY += deltaY;
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
}
_createPlaneUpdateFunction(plane) {
let _self = this;
return function() {
plane.distance = _self.targetY;
return plane;
};
}
_createPlane(p1, p2, inverseTransform) {
let _self = this;
let p1C3 = _self._getOriginCoordinateSystemPoint(p1, inverseTransform);
let p2C3 = _self._getOriginCoordinateSystemPoint(p2, inverseTransform);
let up = new Cesium.Cartesian3(0, 0, 10);
let right = Cesium.Cartesian3.subtract(p2C3, p1C3, new Cesium.Cartesian3());
let normal = Cesium.Cartesian3.cross(right, up, new Cesium.Cartesian3());
normal = Cesium.Cartesian3.normalize(normal, normal);
let planeTmp = Cesium.Plane.fromPointNormal(p1C3, normal);
return Cesium.ClippingPlane.fromPlane(planeTmp);
}
_getOriginCoordinateSystemPoint(point2, inverseTransform) {
let val = Cesium.Cartesian3.fromDegrees(point2[0], point2[1]);
return Cesium.Matrix4.multiplyByPoint(
inverseTransform,
val,
new Cesium.Cartesian3(0, 0, 0)
);
}
_getInverseTransform(tileSet) {
let transform3;
const tmp = tileSet.root.transform;
if (tmp && tmp.equals(Cesium.Matrix4.IDENTITY) || !tmp) {
transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(tileSet.boundingSphere.center);
} else {
transform3 = Cesium.Matrix4.fromArray(tileSet.root.transform);
}
return Cesium.Matrix4.inverseTransformation(transform3, new Cesium.Matrix4());
}
_isDirRes(polygon2, isClockwise) {
var lineStringList = [];
polygon2.forEach((p) => {
lineStringList.push([p.lng, p.lat]);
});
var clockwiseRing = lineString(lineStringList);
let isR = booleanClockwise(clockwiseRing);
var points2 = [];
if (isClockwise) {
if (!isR) {
points2 = polygon2;
} else {
var count = 0;
for (var ii = polygon2.length - 1; ii >= 0; ii--) {
points2[count] = polygon2[ii];
count++;
}
}
} else {
if (isR) {
points2 = polygon2;
} else {
var count = 0;
for (var ii = polygon2.length - 1; ii >= 0; ii--) {
points2[count] = polygon2[ii];
count++;
}
}
}
return points2;
}
}
Object.assign(Cutting.prototype, {
activate(tileset) {
let _self = this;
let viewer2 = _self._viewer;
let inverseTransform = _self._getInverseTransform(tileset);
const clippingPlanes1 = [];
clippingPlanes1.push(_self._createPlane([121.55814450142213, 37.39658788787028], [121.65814450142213, 37.49658788787028], inverseTransform));
let clippingPlanes = new Cesium.ClippingPlaneCollection({
planes: [
new Cesium.ClippingPlane(
new Cesium.Cartesian3(0, 1, 0),
-10
)
],
edgeWidth: 1
});
_self.tileset = tileset;
tileset.clippingPlanes = clippingPlanes;
tileset.debugShowBoundingVolume = false;
return tileset.readyPromise.then(function() {
let boundingSphere = tileset.boundingSphere;
let radius = boundingSphere.radius;
viewer2.zoomTo(
tileset,
new Cesium.HeadingPitchRange(0.5, -0.2, radius / 5)
);
if (!Cesium.Matrix4.equals(
tileset.root.transform,
Cesium.Matrix4.IDENTITY
)) {
const transformCenter = Cesium.Matrix4.getTranslation(tileset.root.transform, new Cesium.Cartesian3());
const transformCartographic = Cesium.Cartographic.fromCartesian(transformCenter);
const boundingSphereCartographic = Cesium.Cartographic.fromCartesian(tileset.boundingSphere.center);
const height2 = boundingSphereCartographic.height - transformCartographic.height;
clippingPlanes.modelMatrix = Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0, 0, height2));
}
for (let i2 = 0; i2 < clippingPlanes.length; ++i2) {
const plane = clippingPlanes.get(i2);
viewer2.entities.add({
position: boundingSphere.center,
plane: {
dimensions: new Cesium.Cartesian2(
radius / 10,
radius / 10
),
material: Cesium.Color.WHITE.withAlpha(0.1),
plane: new Cesium.CallbackProperty(
_self._createPlaneUpdateFunction(plane),
false
),
outline: true,
outlineColor: Cesium.Color.WHITE
}
});
}
return tileset;
});
},
addTiles(my3dtiles, pointsArray) {
let _self = this;
let viewer2 = _self._viewer;
let tileset = my3dtiles;
_self.polygon = pointsArray;
_self.tileset = tileset;
return tileset.readyPromise.then(function() {
let inverseTransform = _self._getInverseTransform(tileset);
_self.polygon = _self._isDirRes(_self.polygon, false);
const clippingPlanes1 = [];
for (let i2 = 0; i2 < _self.polygon.length; i2++) {
if (i2 === _self.polygon.length - 1) {
clippingPlanes1.push(_self._createPlane(_self.polygon[i2], _self.polygon[0], inverseTransform));
} else {
clippingPlanes1.push(_self._createPlane(_self.polygon[i2], _self.polygon[i2 + 1], inverseTransform));
}
}
let clippingPlanes = new Cesium.ClippingPlaneCollection({
planes: clippingPlanes1,
edgeWidth: 1,
edgeColor: Cesium.Color.RED,
unionClippingRegions: false
});
_self.clippingPlanes = clippingPlanes;
tileset.clippingPlanes = clippingPlanes;
tileset.debugShowBoundingVolume = false;
let boundingSphere = tileset.boundingSphere;
let radius = boundingSphere.radius;
for (let i2 = 0; i2 < clippingPlanes.length; ++i2) {
let plane = clippingPlanes.get(i2);
viewer2.entities.add({
position: boundingSphere.center,
plane: {
dimensions: new Cesium.Cartesian2(
radius / 10,
radius / 10
),
material: Cesium.Color.RED.withAlpha(0.1),
plane: new Cesium.CallbackProperty(
_self._createPlaneUpdateFunction(plane),
false
),
outline: true,
outlineColor: Cesium.Color.RED
}
});
}
return tileset;
});
},
addTiles2(my3dtiles, pointsArray) {
let _self = this;
_self._viewer;
let tileset = my3dtiles;
_self.polygon = pointsArray;
_self.tileset = tileset;
Cesium.Matrix4.fromArray(
[
1,
5551115123125783e-31,
5898416033378595e-24,
0,
-6106226635438361e-31,
1,
-11355608731111744e-24,
0,
-5898416061134171e-24,
11355608731111744e-24,
0.9999999999999999,
0,
9.912469893228263,
-19.08345020748675,
-14.613607150502503,
1
]
);
let transform3 = Cesium.Matrix4.fromArray(
[
-0.8874246461620654,
-0.46095281470464317,
0,
0,
0.2602796082288922,
-0.5010893346724129,
0.8253266045740758,
0,
-0.3804366214290463,
0.7324151700322881,
0.5646556435405804,
0,
-2429070591483741e-9,
467643767731705e-8,
3581165448379543e-9,
1
]
);
let inverseTransform = Cesium.Matrix4.inverseTransformation(transform3, new Cesium.Matrix4());
let clippingPlanes1 = [];
for (let i2 = 0; i2 < _self.polygon.length - 1; i2++) {
let plane = _self.createPlane(_self.polygon[i2], _self.polygon[i2 + 1], inverseTransform);
clippingPlanes1.push(plane);
}
let clippingPlanes = new Cesium.ClippingPlaneCollection({
planes: clippingPlanes1,
edgeWidth: 1,
edgeColor: Cesium.Color.RED,
unionClippingRegions: false
});
_self.clippingPlanes = clippingPlanes;
return tileset.readyPromise.then(function() {
tileset.clippingPlanes = clippingPlanes;
tileset.debugShowBoundingVolume = false;
let boundingSphere = tileset.boundingSphere;
boundingSphere.radius;
return tileset;
});
},
toggleClipping() {
let _self = this;
_self.tileset = null;
}
});
class GeologyClipPlan {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
this._camera = this._viewer.camera;
this._scene = this._viewer.scene;
this.tileset = void 0;
this.targetY = 0;
this.planeEntities = [];
this._mouseHandler();
}
_mouseHandler() {
let _self = this;
let viewer2 = _self._viewer;
let scene = _self._scene;
let selectedPlane;
let downHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
downHandler.setInputAction(function(movement) {
let pickedObject = scene.pick(movement.position);
if (Cesium.defined(pickedObject) && Cesium.defined(pickedObject.id) && Cesium.defined(pickedObject.id.plane)) {
selectedPlane = pickedObject.id.plane;
selectedPlane.material = Cesium.Color.RED.withAlpha(0.05);
selectedPlane.outlineColor = Cesium.Color.RED;
scene.screenSpaceCameraController.enableInputs = false;
}
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
let upHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
upHandler.setInputAction(function() {
if (Cesium.defined(selectedPlane)) {
selectedPlane.material = Cesium.Color.RED.withAlpha(0.1);
selectedPlane.outlineColor = Cesium.Color.RED;
selectedPlane = void 0;
}
scene.screenSpaceCameraController.enableInputs = true;
}, Cesium.ScreenSpaceEventType.LEFT_UP);
let moveHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
moveHandler.setInputAction(function(movement) {
if (Cesium.defined(selectedPlane)) {
let deltaY = movement.startPosition.y - movement.endPosition.y;
_self.targetY += deltaY;
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
}
_createPlaneUpdateFunction(plane) {
let _self = this;
return function() {
plane.distance = _self.targetY;
return plane;
};
}
}
Object.assign(GeologyClipPlan.prototype, {
activate(tileset, options2) {
let _self = this;
let viewer2 = _self._viewer;
let distance2 = 1e5;
let clippingPlanes = new Cesium.ClippingPlaneCollection({
planes: [
new Cesium.ClippingPlane(
new Cesium.Cartesian3(0, 0, -1),
distance2
)
],
edgeWidth: 1
});
_self.tileset = tileset;
tileset.clippingPlanes = clippingPlanes;
tileset.debugShowBoundingVolume = false;
return tileset.readyPromise.then(function() {
let boundingSphere = tileset.boundingSphere;
let radius = boundingSphere.radius;
if (!Cesium.Matrix4.equals(
tileset.root.transform,
Cesium.Matrix4.IDENTITY
)) {
const transformCenter = Cesium.Matrix4.getTranslation(
tileset.root.transform,
new Cesium.Cartesian3()
);
const transformCartographic = Cesium.Cartographic.fromCartesian(
transformCenter
);
const boundingSphereCartographic = Cesium.Cartographic.fromCartesian(
tileset.boundingSphere.center
);
const height2 = boundingSphereCartographic.height - transformCartographic.height;
clippingPlanes.modelMatrix = Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0, 0, height2));
}
viewer2.zoomTo(
tileset,
new Cesium.HeadingPitchRange(0.5, -0.2, radius / 10)
);
let cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
let lng = Cesium.Math.toDegrees(cartographic.longitude);
let lat = Cesium.Math.toDegrees(cartographic.latitude);
cartographic.height;
var Cartesian33 = Cesium.Cartesian3.fromDegrees(lng, lat, 105);
for (let i2 = 0; i2 < clippingPlanes.length; ++i2) {
let plane = clippingPlanes.get(i2);
let planeEntity = viewer2.entities.add({
position: Cartesian33,
plane: {
dimensions: new Cesium.Cartesian2(
radius / 10,
radius / 20
),
material: Cesium.Color.RED.withAlpha(0.1),
plane: new Cesium.CallbackProperty(
_self._createPlaneUpdateFunction(plane),
false
),
outline: true,
outlineColor: Cesium.Color.RED
}
});
_self.planeEntities.push(planeEntity);
}
return tileset;
});
},
toggleClipping() {
let _self = this;
for (let i2 = 0; i2 < _self.planeEntities.length; i2++) {
_self._viewer.entities.remove(_self.planeEntities[i2]);
}
_self.planeEntities = [];
_self.targetY = 0;
let boundingSphere = _self.tileset.boundingSphere;
_self._camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(Cesium.Math.toRadians(120), Cesium.Math.toRadians(-10), boundingSphere.radius * 2.5));
_self._camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
},
reset() {
this.planeEntities = [];
this.targetY = 0;
}
});
let SpatialAnalysis = {
SightLine,
ViewShed,
SunshineShadow,
Profile,
CutFill,
HeightLimit,
Cutting,
GeologyClipPlan
};
class TerrainExcavation {
constructor(viewer2) {
if (!viewer2)
throw new Error("no viewer object!");
this.viewer = viewer2;
}
prepareWell(activePoints) {
let pointLength = activePoints.length;
let heightDiff = this.excavateMinHeight - this.height;
let no_height_top = [], bottom_pos = [], lerp_pos = [];
for (let l = 0; l < pointLength; l++) {
let u = l == pointLength - 1 ? 0 : l + 1;
let point0 = [
Cesium.Cartographic.fromCartesian(activePoints[l]).longitude,
Cesium.Cartographic.fromCartesian(activePoints[l]).latitude
];
let point1 = [
Cesium.Cartographic.fromCartesian(activePoints[u]).longitude,
Cesium.Cartographic.fromCartesian(activePoints[u]).latitude
];
if (0 == l) {
lerp_pos.push(new Cesium.Cartographic(point0[0], point0[1]));
bottom_pos.push(
Cesium.Cartesian3.fromRadians(point0[0], point0[1], heightDiff)
);
no_height_top.push(
Cesium.Cartesian3.fromRadians(point0[0], point0[1], 0)
);
}
for (let p = 1; p <= this.splitNum; p++) {
let m = Cesium.Math.lerp(point0[0], point1[0], p / this.splitNum);
let g = Cesium.Math.lerp(point0[1], point1[1], p / this.splitNum);
l == pointLength - 1 && p == this.splitNum || (lerp_pos.push(new Cesium.Cartographic(m, g)), bottom_pos.push(Cesium.Cartesian3.fromRadians(m, g, heightDiff)), no_height_top.push(Cesium.Cartesian3.fromRadians(m, g, 0)));
}
}
this.wellData = {
lerp_pos,
bottom_pos,
no_height_top
};
}
createWell(wallData) {
let $this = this;
if (this.viewer.terrainProvider._layers) {
this.createBottomSurface(wallData.bottom_pos);
let positions = Cesium.sampleTerrainMostDetailed(
this.viewer.terrainProvider,
wallData.lerp_pos
);
positions.then(function(pos) {
let positionList = [];
for (let index2 = 0; index2 < pos.length; index2++) {
const element = pos[index2];
let curPos = Cesium.Cartesian3.fromRadians(
element.longitude,
element.latitude,
element.height
);
positionList.push(curPos);
}
$this.createWellWall(wallData.bottom_pos, positionList);
});
} else {
this.createBottomSurface(wallData.bottom_pos);
this.createWellWall(wallData.bottom_pos, wallData.no_height_top);
}
}
ellipsoidToDegree(pos) {
let cartesian3 = new Cesium.Cartesian3(pos.x, pos.y, pos.z);
let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian3);
return {
longitude: Cesium.Math.toDegrees(cartographic.longitude),
latitude: Cesium.Math.toDegrees(cartographic.latitude),
altitude: cartographic.height
};
}
createBottomSurface(points2) {
if (points2.length) {
let minHeight = this.getMinHeight(points2);
let positions = [];
for (let i2 = 0; i2 < points2.length; i2++) {
let curPoint = this.ellipsoidToDegree(points2[i2]);
positions.push(curPoint.longitude, curPoint.latitude, minHeight);
}
let polygon2 = new Cesium.PolygonGeometry({
polygonHierarchy: new Cesium.PolygonHierarchy(
Cesium.Cartesian3.fromDegreesArrayHeights(positions)
),
perPositionHeight: true
});
let material = new Cesium.Material({
fabric: {
type: "Image",
uniforms: {
image: this.bottomImg
}
}
});
let appearance = new Cesium.MaterialAppearance({
translucent: false,
flat: true,
material
});
this.bottomSurface = new Cesium.Primitive({
geometryInstances: new Cesium.GeometryInstance({
geometry: Cesium.PolygonGeometry.createGeometry(polygon2)
}),
appearance,
asynchronous: false
});
this.viewer.scene.primitives.add(this.bottomSurface);
}
}
createWellWall(bottomPos, positionList) {
let minHeight = this.getMinHeight(bottomPos);
let maxHeights = [], minHeights = [];
for (let i2 = 0; i2 < positionList.length; i2++) {
maxHeights.push(this.ellipsoidToDegree(positionList[i2]).altitude);
minHeights.push(minHeight);
}
let wall = new Cesium.WallGeometry({
positions: positionList,
maximumHeights: maxHeights,
minimumHeights: minHeights
});
let geometry2 = Cesium.WallGeometry.createGeometry(wall);
let material = new Cesium.Material({
fabric: {
type: "Image",
uniforms: {
image: this.wallImg
}
}
});
let appearance = new Cesium.MaterialAppearance({
translucent: false,
flat: true,
material
});
this.wellWall = new Cesium.Primitive({
geometryInstances: new Cesium.GeometryInstance({
geometry: geometry2,
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(
Cesium.Color.GREY
)
},
id: "PitWall"
}),
appearance,
asynchronous: false
});
this.viewer.scene.primitives.add(this.wellWall);
}
getMinHeight(points2) {
let minHeight = 5e6;
let minPoint = null;
for (let i2 = 0; i2 < points2.length; i2++) {
let height2 = points2[i2]["z"];
if (height2 < minHeight) {
minHeight = height2;
minPoint = this.ellipsoidToDegree(points2[i2]);
}
}
return minPoint.altitude;
}
switchExcavate(show) {
if (show) {
this.viewer.scene.globe.material = null;
this.wellWall.show = true;
this.bottomSurface.show = true;
} else {
this.viewer.scene.globe.material = null;
this.wellWall.show = false;
this.bottomSurface.show = false;
}
}
updateExcavateDepth(height2) {
this.viewer.scene.primitives.remove(this.bottomSurface);
this.viewer.scene.primitives.remove(this.wellWall);
console.log(this.wellData, this.excavateMinHeight);
let lerp_pos = this.wellData.lerp_pos;
let posList = [];
for (let n = 0; n < lerp_pos.length; n++) {
posList.push(
Cesium.Cartesian3.fromRadians(
lerp_pos[n].longitude,
lerp_pos[n].latitude,
this.excavateMinHeight - height2
)
);
}
this.wellData.bottom_pos = posList;
this.createWell(this.wellData);
}
}
Object.defineProperties(TerrainExcavation.prototype, {
show: {
get: function() {
return this._show;
},
set: function(e) {
this._show = e;
this.switchExcavate(e);
}
},
height: {
get: function() {
return this._height;
},
set: function(e) {
this._height = e;
this.updateExcavateDepth(e);
}
}
});
Object.assign(TerrainExcavation.prototype, {
add(activePoints, options2) {
options2 = options2 || {};
this._height = options2.excavateDepth || 10;
this.bottomImg = options2.bottomImg || "jt3dSDK/imgs/polygon/ground.png";
this.wallImg = options2.wallImg || "jt3dSDK/imgs/polygon/ground.png";
this.splitNum = Cesium.defaultValue(options2.splitNum, 50);
activePoints = activePoints.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
let viewer2 = this.viewer;
this.clear();
let clippingPlanesList = [];
let car3Difference = Cesium.Cartesian3.subtract(
activePoints[0],
activePoints[1],
new Cesium.Cartesian3()
);
let boolDiff = car3Difference.x > 0;
this.excavateMinHeight = 999999999;
for (let index2 = 0; index2 < activePoints.length; ++index2) {
let s = (index2 + 1) % activePoints.length;
let curMidPoint = Cesium.Cartesian3.midpoint(
activePoints[index2],
activePoints[s],
new Cesium.Cartesian3()
);
let cartographic = Cesium.Cartographic.fromCartesian(activePoints[index2]);
let curHeight = viewer2.scene.globe.getHeight(cartographic) || cartographic.height;
console.log(curHeight);
if (curHeight < this.excavateMinHeight) {
this.excavateMinHeight = curHeight;
}
let curMidPointNormal = Cesium.Cartesian3.normalize(
curMidPoint,
new Cesium.Cartesian3()
);
let curMidPointDifference = boolDiff ? Cesium.Cartesian3.subtract(
activePoints[index2],
curMidPoint,
new Cesium.Cartesian3()
) : Cesium.Cartesian3.subtract(
activePoints[s],
curMidPoint,
new Cesium.Cartesian3()
);
curMidPointDifference = Cesium.Cartesian3.normalize(
curMidPointDifference,
curMidPointDifference
);
let curMidPointCross = Cesium.Cartesian3.cross(
curMidPointDifference,
curMidPointNormal,
new Cesium.Cartesian3()
);
curMidPointCross = Cesium.Cartesian3.normalize(
curMidPointCross,
curMidPointCross
);
let plane = new Cesium.Plane(curMidPointCross, 0);
let distance2 = Cesium.Plane.getPointDistance(plane, curMidPoint);
clippingPlanesList.push(
new Cesium.ClippingPlane(curMidPointCross, distance2)
);
}
this.viewer.scene.globe.clippingPlanes = new Cesium.ClippingPlaneCollection({
planes: clippingPlanesList,
edgeWidth: 1,
edgeColor: Cesium.Color.WHITE,
enabled: true
});
this.prepareWell(activePoints);
this.createWell(this.wellData);
},
clear() {
if (this.viewer.scene.globe.clippingPlanes) {
this.viewer.scene.globe.clippingPlanes.removeAll();
this.viewer.scene.primitives.remove(this.bottomSurface);
this.viewer.scene.primitives.remove(this.wellWall);
this.viewer.scene.render();
}
}
});
var tooltip = "";
function setSessionid$1(num) {
let len = num || 32;
let chars = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678";
let maxPos = chars.length;
let pwd = "";
for (let i2 = 0; i2 < len; i2++) {
pwd += chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
}
function guid() {
function S4() {
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
}
return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
}
function getGuid(removeMinus) {
let d2 = new Date().getTime();
let uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
const r2 = (d2 + Math.random() * 16) % 16 | 0;
d2 = Math.floor(d2 / 16);
return (c === "x" ? r2 : r2 & 3 | 8).toString(16);
});
if (removeMinus) {
uuid = uuid.replace(/-/g, "");
}
return uuid;
}
function getHeigthByLngLat(viewer2, options2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
if (!Cesium.defined(options2.longitude) && !Cesium.defined(options2.latitude)) {
throw new Cesium.DeveloperError("longitude and latitude are required.");
}
options2.level = Cesium.defaultValue(options2.level, 11);
let positions = Cesium.Cartographic.fromDegrees(options2.longitude, options2.latitude);
let terrainProvider = viewer2.terrainProvider;
return new Promise((resolve2, reject2) => {
new Cesium.sampleTerrain(terrainProvider, options2.level, [positions]).then(function(updatedPositions) {
if (updatedPositions) {
resolve2(updatedPositions[0].height);
}
});
});
}
function getHeigthByPoints(viewer2, options2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
if (!Cesium.defined(options2)) {
throw new Cesium.DeveloperError("options is required.");
}
options2.level = Cesium.defaultValue(options2.level, 11);
let positions = [];
let points2 = options2.points;
for (let i2 = 0; i2 < points2.length; i2++) {
let pointX = points2[i2][0];
let pointY = points2[i2][1];
positions.push(
Cesium.Cartographic.fromDegrees(pointX, pointY)
);
}
let terrainProvider = viewer2.terrainProvider;
return new Promise((resolve2, reject2) => {
new Cesium.sampleTerrain(terrainProvider, options2.level, positions).then(function(updatedPositions) {
if (updatedPositions) {
resolve2(updatedPositions);
}
});
});
}
function getHeigthByPointsMostDetailed(viewer2, points2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
let positions = [];
for (let i2 = 0; i2 < points2.length; i2++) {
let pointX = points2[i2][0];
let pointY = points2[i2][1];
positions.push(Cesium.Cartographic.fromDegrees(pointX, pointY));
}
let terrainProvider = viewer2.terrainProvider;
return new Promise((resolve2, reject2) => {
let promise = new Cesium.sampleTerrainMostDetailed(terrainProvider, positions);
promise.then(function(updatedPositions) {
resolve2(updatedPositions);
});
});
}
function getHeigthByPointMostDetailed(viewer2, points2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
let positions = Cesium.Cartographic.fromDegrees(points2[0], points2[1]);
let terrainProvider = viewer2.terrainProvider;
return new Promise((resolve2, reject2) => {
let promise = new Cesium.sampleTerrainMostDetailed(terrainProvider, positions);
promise.then(function(updatedPositions) {
resolve2(updatedPositions);
});
});
}
function createTooltip(frameDiv) {
var tooltip2 = function(frameDiv2) {
var div = document.createElement("DIV");
div.className = "twipsy right";
var arrow = document.createElement("DIV");
arrow.className = "twipsy-arrow";
div.appendChild(arrow);
var title = document.createElement("DIV");
title.className = "twipsy-inner";
div.appendChild(title);
this._div = div;
this._title = title;
frameDiv2.appendChild(div);
};
tooltip2.prototype.setVisible = function(visible) {
this._div.style.display = visible ? "block" : "none";
};
tooltip2.prototype.showAt = function(position2, message) {
if (position2 && message) {
this.setVisible(true);
this._title.innerHTML = message;
this._div.style.left = position2.x + 10 + "px";
this._div.style.top = position2.y - this._div.clientHeight / 2 + "px";
}
};
return new tooltip2(frameDiv);
}
var common = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
setSessionid: setSessionid$1,
guid,
getGuid,
getHeigthByLngLat,
getHeigthByPoints,
getHeigthByPointsMostDetailed,
getHeigthByPointMostDetailed,
createTooltip
}, Symbol.toStringTag, { value: "Module" }));
class SlopeAspect {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
this.result = [];
this.handler = void 0;
this.toolTip = "";
}
_openTip() {
let _self = this;
this.handler = new Cesium.ScreenSpaceEventHandler(_self._viewer.canvas);
this.handler.setInputAction(function(movement) {
let endPos = movement.endPosition;
var pick = _self._viewer.scene.pick(endPos);
if (pick && pick.id && pick.id.type === "SlopeAspect") {
_self.toolTip = pick.id.value.toFixed(2);
CreateRemindertip(_self.toolTip, endPos, true);
} else {
_self.toolTip = "";
CreateRemindertip(_self.toolTip, endPos, false);
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
}
_createEllipse(gridSquare) {
let _self = this;
let boxResults = [];
for (let index2 = 0; index2 < gridSquare.features.length; index2++) {
const feature2 = gridSquare.features[index2];
const coordinates = feature2.geometry.coordinates[0];
const centerdegree = [
(coordinates[0][0] + coordinates[2][0]) / 2,
(coordinates[0][1] + coordinates[2][1]) / 2
];
let centerCartographic = Cesium.Cartographic.fromDegrees(
centerdegree[0],
centerdegree[1]
);
boxResults.push(centerCartographic);
for (let i2 = 0; i2 < coordinates.length; i2++) {
const coord = coordinates[i2];
let cartographic = Cesium.Cartographic.fromDegrees(coord[0], coord[1]);
boxResults.push(cartographic);
const coord1 = coordinates[i2 + 1];
if (coord1) {
let newCoord = [(coord[0] + coord1[0]) / 2, (coord[1] + coord1[1]) / 2];
let newCartographic = Cesium.Cartographic.fromDegrees(newCoord[0], newCoord[1]);
boxResults.push(newCartographic);
}
}
}
Cesium.sampleTerrainMostDetailed(
_self._viewer.scene.terrainProvider,
boxResults
).then((updatePositions) => {
let arrr = [];
let ellipseResults = updatePositions.reduce(function(pre, item, index2, updatePositions2) {
var begin = index2 * 10;
var end = begin + 10;
var res = updatePositions2.slice(begin, end);
if (res.length != 0) {
arrr[index2] = res;
}
return arrr;
}, []);
_self._calculateSlope(ellipseResults);
_self._openTip();
});
}
_createPolygonInsrance(points2, color2) {
let positions = [];
for (let index2 = 1; index2 < points2.length - 1; index2++) {
const element = points2[index2];
positions.push(Cesium.Cartographic.toCartesian(element));
}
let polygon2 = new Cesium.PolygonGeometry({
polygonHierarchy: new Cesium.PolygonHierarchy(positions)
});
let polygonInstance = new Cesium.GeometryInstance({
geometry: polygon2,
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(
Cesium.Color.fromCssColorString(color2)
),
show: new Cesium.ShowGeometryInstanceAttribute(true)
}
});
return polygonInstance;
}
_createArrowInstance(targetPoint, center2, diagonalPoint, heightDifference, curSlope) {
let cartographic_0 = new Cesium.Cartographic(
(targetPoint.longitude + center2.longitude) / 2,
(targetPoint.latitude + center2.latitude) / 2,
(targetPoint.height + center2.height) / 2
);
let cartographic_1 = new Cesium.Cartographic(
(diagonalPoint.longitude + center2.longitude) / 2,
(diagonalPoint.latitude + center2.latitude) / 2,
(diagonalPoint.height + center2.height) / 2
);
let positions1 = heightDifference > 0 ? [
Cesium.Cartographic.toCartesian(cartographic_0),
Cesium.Cartographic.toCartesian(cartographic_1)
] : [
Cesium.Cartographic.toCartesian(cartographic_1),
Cesium.Cartographic.toCartesian(cartographic_0)
];
const instance = new Cesium.GeometryInstance({
id: {
type: "SlopeAspect",
value: curSlope
},
geometry: new Cesium.GroundPolylineGeometry({
positions: positions1,
width: this.arrowWidth
}),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(
Cesium.Color.BLUE.withAlpha(0.6)
),
show: new Cesium.ShowGeometryInstanceAttribute(true)
}
});
return instance;
}
_calculateSlope(ellipseResults) {
let _self = this;
let instances = [];
let polygonInstance = [];
for (let index2 = 0; index2 < ellipseResults.length; index2++) {
const ellipse = ellipseResults[index2];
const center2 = ellipse[0];
let heightDifference = 0;
let maxIndex = 0;
for (let i2 = 1; i2 < ellipse.length - 1; i2++) {
const point2 = ellipse[i2];
let curHD = point2.height - center2.height;
if (Math.abs(curHD) > heightDifference) {
heightDifference = curHD;
maxIndex = i2;
}
}
let pos0 = new Cesium.Cartographic(center2.longitude, center2.latitude, 0);
let pos1 = new Cesium.Cartographic(
ellipse[maxIndex].longitude,
ellipse[maxIndex].latitude,
0
);
let distance2 = Cesium.Cartesian3.distance(
Cesium.Cartographic.toCartesian(pos0),
Cesium.Cartographic.toCartesian(pos1)
);
let curSlope = Math.abs(heightDifference / distance2);
let curColor = _self._calculateSlopeColor(curSlope, 0.4);
const curPolygonInstance = _self._createPolygonInsrance(ellipse, curColor);
polygonInstance.push(curPolygonInstance);
let diagonalPoint = maxIndex > 4 ? ellipse[maxIndex - 4] : ellipse[maxIndex + 4];
let targetPoint = ellipse[maxIndex];
const arrowInstance = _self._createArrowInstance(targetPoint, center2, diagonalPoint, heightDifference, curSlope);
instances.push(arrowInstance);
}
const mapPrimitive = _self._viewer.scene.primitives.add(
new Cesium.GroundPrimitive({
geometryInstances: polygonInstance,
appearance: new Cesium.PerInstanceColorAppearance({
translucent: true,
closed: false
})
})
);
const arrowPrimitive = _self._viewer.scene.primitives.add(
new Cesium.GroundPolylinePrimitive({
geometryInstances: instances,
appearance: new Cesium.PolylineMaterialAppearance({
material: new Cesium.Material({
fabric: {
type: "PolylineArrow",
uniforms: {
color: new Cesium.Color(1, 1, 0, 0.8)
}
}
})
})
})
);
_self.result.push(arrowPrimitive, mapPrimitive);
}
_calculateSlopeColor(value, alpha) {
if (value < 0.00872686779075879) {
return "rgba(85,182,43," + alpha + ")";
} else if (value < 0.03492076949174773) {
return "rgba(135,211,43," + alpha + ")";
} else if (value < 0.08748866352592401) {
return "rgba(204,244,44," + alpha + ")";
} else if (value < 0.2679491924311227) {
return "rgba(245,233,44," + alpha + ")";
} else if (value < 0.7002075382097097) {
return "rgba(255,138,43," + alpha + ")";
} else if (value < 1.4281480067421144) {
return "rgba(255,84,43," + alpha + ")";
} else {
return "rgba(255,32,43," + alpha + ")";
}
}
}
Object.assign(SlopeAspect.prototype, {
createNew4Distance(points2, polygon$1, options2) {
let _self = this;
options2 = options2 || {};
options2.distance = options2.distance || 0.1;
let width2 = options2.distance * 200 > 35 ? 35 : options2.distance * 200;
_self.arrowWidth = width2 < 15 ? 15 : width2;
let positions = points2.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
_self.clearAll();
let degrees = CoordTransform.Cartesian3ListToWGS84(positions);
let boundary = [];
let minX = 1e4, minY = 1e4, maxX = -1e4, maxY = -1e3;
for (let index2 = 0; index2 < degrees.length; index2++) {
const element = degrees[index2];
const x = element.lng;
const y = element.lat;
boundary.push([x, y]);
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
}
boundary.push(boundary[0]);
let bbox2 = [minX, minY, maxX, maxY];
polygon([boundary]);
let gridSquare = squareGrid(bbox2, options2.distance, {});
_self._createEllipse(gridSquare);
},
createNew4Num(points2, polygon$1, options2) {
let _self = this;
options2 = options2 || {};
options2.num = Cesium.defaultValue(options2.num, 10);
let positions = points2.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
_self.clearAll();
let degrees = CoordTransform.Cartesian3ListToWGS84(positions);
let boundary = [];
let minX = 1e4, minY = 1e4, maxX = -1e4, maxY = -1e3;
for (let index2 = 0; index2 < degrees.length; index2++) {
const element = degrees[index2];
const x = element.lng;
const y = element.lat;
boundary.push([x, y]);
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
}
boundary.push(boundary[0]);
let bbox2 = [minX, minY, maxX, maxY];
let a = maxX - minX;
let b = maxY - minY;
b = b > a ? b : a;
const step = b / options2.num;
let width2 = step * 2e3 > 35 ? 35 : step * 2e3;
_self.arrowWidth = width2 < 15 ? 15 : width2;
polygon([boundary]);
let gridSquare = squareGrid(bbox2, step, {
units: "degrees"
});
_self._createEllipse(gridSquare);
},
clearAll() {
this.result.forEach((element) => {
this._viewer.scene.primitives.remove(element);
});
this.result = [];
if (this.handler) {
this.handler.destroy();
this.handler = void 0;
}
}
});
let TerrainAnalysis = {
TerrainExcavation,
SlopeAspect
};
class Weather {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
}
_initRain() {
this.rainStage = new Cesium.PostProcessStage({
name: "jt_rain",
fragmentShader: this._rain(),
uniforms: {
tiltAngle: () => {
return this.tiltAngle;
},
rainSize: () => {
return this.rainSize;
},
rainSpeed: () => {
return this.rainSpeed;
}
}
});
this._viewer.scene.postProcessStages.add(this.rainStage);
}
_initSnow() {
this.snowStage = new Cesium.PostProcessStage({
name: "jt_snow",
fragmentShader: this._snow(),
uniforms: {
snowSize: () => {
return this.snowSize;
},
snowSpeed: () => {
return this.snowSpeed;
}
}
});
this._viewer.scene.postProcessStages.add(this.snowStage);
}
_initFog() {
this.fogStage = new Cesium.PostProcessStage({
name: "jt_fog",
fragmentShader: this._fog(),
uniforms: {
visibility: () => {
return this.visibility;
},
fogColor: () => {
return this.color;
}
}
});
this._viewer.scene.postProcessStages.add(this.fogStage);
}
_rain() {
return "uniform sampler2D colorTexture;\n varying vec2 v_textureCoordinates;\n uniform float tiltAngle;\n uniform float rainSize;\n uniform float rainSpeed;\n float hash(float x) {\n return fract(sin(x * 133.3) * 13.13);\n }\n void main(void) {\n float time = czm_frameNumber / rainSpeed;\n vec2 resolution = czm_viewport.zw;\n vec2 uv = (gl_FragCoord.xy * 2. - resolution.xy) / min(resolution.x, resolution.y);\n vec3 c = vec3(.6, .7, .8);\n float a = tiltAngle;\n float si = sin(a), co = cos(a);\n uv *= mat2(co, -si, si, co);\n uv *= length(uv + vec2(0, 4.9)) * rainSize + 1.;\n float v = 1. - sin(hash(floor(uv.x * 100.)) * 2.);\n float b = clamp(abs(sin(20. * time * v + uv.y * (5. / (2. + v)))) - .95, 0., 1.) * 20.;\n c *= v * b;\n gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), vec4(c, 1), .5);\n }\n ";
}
_snow() {
return "uniform sampler2D colorTexture;\n varying vec2 v_textureCoordinates;\n uniform float snowSpeed;\n uniform float snowSize;\n float snow(vec2 uv,float scale)\n {\n float time=czm_frameNumber/snowSpeed;\n float w=smoothstep(1.,0.,-uv.y*(scale/10.));if(w<.1)return 0.;\n uv+=time/scale;uv.y+=time*2./scale;uv.x+=sin(uv.y+time*.5)/scale;\n uv*=scale;vec2 s=floor(uv),f=fract(uv),p;float k=3.,d;\n p=.5+.35*sin(11.*fract(sin((s+p+scale)*mat2(7,3,6,5))*5.))-f;d=length(p);k=min(d,k);\n k=smoothstep(0.,k,sin(f.x+f.y)*snowSize);\n return k*w;\n }\n void main(void){\n vec2 resolution=czm_viewport.zw;\n vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\n vec3 finalColor=vec3(0);\n //float c=smoothstep(1.,0.3,clamp(uv.y*.3+.8,0.,.75));\n float c=0.;\n c+=snow(uv,30.)*.0;\n c+=snow(uv,20.)*.0;\n c+=snow(uv,15.)*.0;\n c+=snow(uv,10.);\n c+=snow(uv,8.);\n c+=snow(uv,6.);\n c+=snow(uv,5.);\n finalColor=(vec3(c));\n gl_FragColor=mix(texture2D(colorTexture,v_textureCoordinates),vec4(finalColor,1),.5);\n }\n ";
}
_fog() {
return "uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n uniform float visibility;\n uniform vec4 fogColor;\n varying vec2 v_textureCoordinates; \n void main(void) \n { \n vec4 origcolor = texture2D(colorTexture, v_textureCoordinates); \n float depth = czm_readDepth(depthTexture, v_textureCoordinates); \n vec4 depthcolor = texture2D(depthTexture, v_textureCoordinates); \n float f = visibility * (depthcolor.r - 0.3) / 0.2; \n if (f < 0.0) f = 0.0; \n else if (f > 1.0) f = 1.0; \n gl_FragColor = mix(origcolor, fogColor, f); \n }\n";
}
_removeSnow() {
if (!this._viewer || !this.snowStage)
return;
this._viewer.scene.postProcessStages.remove(this.snowStage);
delete this.snowSize;
delete this.snowSpeed;
}
_removeRain() {
if (!this._viewer || !this.rainStage)
return;
this._viewer.scene.postProcessStages.remove(this.rainStage);
delete this.tiltAngle;
delete this.rainSize;
delete this.rainSpeed;
}
_removeFog() {
if (!this._viewer || !this.fogStage)
return;
this._viewer.scene.postProcessStages.remove(this.fogStage);
delete this.visibility;
delete this.color;
}
}
Object.assign(Weather.prototype, {
addRainEffect(options2) {
options2 = options2 || {};
this.tiltAngle = Cesium.defaultValue(options2.tiltAngle, -0.6);
this.rainSize = Cesium.defaultValue(options2.rainSize, 0.3);
this.rainSpeed = Cesium.defaultValue(options2.rainSpeed, 60);
this._initRain();
},
addSnowEffect(options2) {
options2 = options2 || {};
this.snowSize = Cesium.defaultValue(options2.snowSize, 0.02);
this.snowSpeed = Cesium.defaultValue(options2.snowSpeed, 60);
this._initSnow();
},
addFogEffect(options2) {
options2 = options2 || {};
this.visibility = Cesium.defaultValue(options2.visibility, 0.1);
this.color = Cesium.defaultValue(options2.color, new Cesium.Color(0.8, 0.8, 0.8, 0.5));
this._show = Cesium.defaultValue(options2.show, true);
this._initFog();
},
removeEffect() {
if (this.snowStage) {
this._removeSnow();
}
if (this.rainStage) {
this._removeRain();
}
if (this.fogStage) {
this._removeFog();
}
}
});
const BoxGeometry = Cesium.BoxGeometry;
const Cartesian3 = Cesium.Cartesian3;
const defaultValue = Cesium.defaultValue;
const defined = Cesium.defined;
const destroyObject = Cesium.destroyObject;
const DeveloperError$1 = Cesium.DeveloperError;
const GeometryPipeline = Cesium.GeometryPipeline;
const Matrix3 = Cesium.Matrix3;
const Matrix4 = Cesium.Matrix4;
const Transforms = Cesium.Transforms;
const VertexFormat = Cesium.VertexFormat;
const BufferUsage = Cesium.BufferUsage;
const CubeMap = Cesium.CubeMap;
const DrawCommand = Cesium.DrawCommand;
const loadCubeMap = Cesium.loadCubeMap;
const RenderState = Cesium.RenderState;
const VertexArray = Cesium.VertexArray;
const BlendingState = Cesium.BlendingState;
const SceneMode = Cesium.SceneMode;
const ShaderProgram = Cesium.ShaderProgram;
const ShaderSource = Cesium.ShaderSource;
const SkyBoxFS = "uniform samplerCube u_cubeMap;\n varying vec3 v_texCoord;\n void main()\n {\n vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));\n gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n }\n ";
const SkyBoxVS = "attribute vec3 position;\n varying vec3 v_texCoord;\n uniform mat3 u_rotateMatrix;\n void main()\n {\n vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n gl_Position = czm_projection * vec4(p, 1.0);\n v_texCoord = position.xyz;\n }\n ";
if (!Cesium.defined(Cesium.Matrix4.getRotation)) {
Cesium.Matrix4.getRotation = Cesium.Matrix4.getMatrix3;
}
class SkyBoxOnGround {
constructor(options2) {
this.sources = options2.sources;
this._sources = void 0;
this.show = defaultValue(options2.show, true);
this._command = new DrawCommand({
modelMatrix: Matrix4.clone(Matrix4.IDENTITY),
owner: this
});
this._cubeMap = void 0;
this._attributeLocations = void 0;
this._useHdr = void 0;
}
}
const skyboxMatrix3 = new Matrix3();
SkyBoxOnGround.prototype.update = function(frameState, useHdr) {
const that = this;
if (!this.show) {
return void 0;
}
if (frameState.mode !== SceneMode.SCENE3D && frameState.mode !== SceneMode.MORPHING) {
return void 0;
}
if (!frameState.passes.render) {
return void 0;
}
const context = frameState.context;
if (this._sources !== this.sources) {
this._sources = this.sources;
const sources = this.sources;
if (!defined(sources.positiveX) || !defined(sources.negativeX) || !defined(sources.positiveY) || !defined(sources.negativeY) || !defined(sources.positiveZ) || !defined(sources.negativeZ)) {
throw new DeveloperError$1(
"this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."
);
}
if (typeof sources.positiveX !== typeof sources.negativeX || typeof sources.positiveX !== typeof sources.positiveY || typeof sources.positiveX !== typeof sources.negativeY || typeof sources.positiveX !== typeof sources.positiveZ || typeof sources.positiveX !== typeof sources.negativeZ) {
throw new DeveloperError$1(
"this.sources properties must all be the same type."
);
}
if (typeof sources.positiveX === "string") {
loadCubeMap(context, this._sources).then(function(cubeMap) {
that._cubeMap = that._cubeMap && that._cubeMap.destroy();
that._cubeMap = cubeMap;
});
} else {
this._cubeMap = this._cubeMap && this._cubeMap.destroy();
this._cubeMap = new CubeMap({
context,
source: sources
});
}
}
const command = this._command;
command.modelMatrix = Transforms.eastNorthUpToFixedFrame(
frameState.camera._positionWC
);
if (!defined(command.vertexArray)) {
command.uniformMap = {
u_cubeMap: function() {
return that._cubeMap;
},
u_rotateMatrix: function() {
return Matrix4.getRotation(command.modelMatrix, skyboxMatrix3);
}
};
const geometry2 = BoxGeometry.createGeometry(
BoxGeometry.fromDimensions({
dimensions: new Cartesian3(2, 2, 2),
vertexFormat: VertexFormat.POSITION_ONLY
})
);
const attributeLocations = this._attributeLocations = GeometryPipeline.createAttributeLocations(
geometry2
);
command.vertexArray = VertexArray.fromGeometry({
context,
geometry: geometry2,
attributeLocations,
bufferUsage: BufferUsage._DRAW
});
command.renderState = RenderState.fromCache({
blending: BlendingState.ALPHA_BLEND
});
}
if (!defined(command.shaderProgram) || this._useHdr !== useHdr) {
const fs = new ShaderSource({
defines: [useHdr ? "HDR" : ""],
sources: [SkyBoxFS]
});
command.shaderProgram = ShaderProgram.fromCache({
context,
vertexShaderSource: SkyBoxVS,
fragmentShaderSource: fs,
attributeLocations: this._attributeLocations
});
this._useHdr = useHdr;
}
if (!defined(this._cubeMap)) {
return void 0;
}
return command;
};
SkyBoxOnGround.prototype.isDestroyed = function() {
return false;
};
SkyBoxOnGround.prototype.destroy = function() {
const command = this._command;
command.vertexArray = command.vertexArray && command.vertexArray.destroy();
command.shaderProgram = command.shaderProgram && command.shaderProgram.destroy();
this._cubeMap = this._cubeMap && this._cubeMap.destroy();
return destroyObject(this);
};
class SkyBox {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
this._farSkyBox = viewer2.scene.skyBox;
}
}
Object.assign(SkyBox.prototype, {
setGroundSkyBox(options2) {
options2 = options2 || {};
options2.height = options2.height || 2e5;
options2.type = options2.type || "\u84DD\u5929";
if (!options2.sources) {
switch (options2.type) {
case "\u665A\u971E":
options2.sources = {
positiveX: "jt3dSDK/imgs/skybox/01/px.png",
negativeX: "jt3dSDK/imgs/skybox/01/nx.png",
positiveY: "jt3dSDK/imgs/skybox/01/py.png",
negativeY: "jt3dSDK/imgs/skybox/01/ny.png",
positiveZ: "jt3dSDK/imgs/skybox/01/pz.png",
negativeZ: "jt3dSDK/imgs/skybox/01/nz.png"
};
break;
case "\u9634\u5929":
options2.sources = {
positiveX: "jt3dSDK/imgs/skybox/02/px.jpg",
negativeX: "jt3dSDK/imgs/skybox/02/nx.jpg",
positiveY: "jt3dSDK/imgs/skybox/02/py.jpg",
negativeY: "jt3dSDK/imgs/skybox/02/ny.jpg",
positiveZ: "jt3dSDK/imgs/skybox/02/pz.jpg",
negativeZ: "jt3dSDK/imgs/skybox/02/nz.jpg"
};
break;
case "\u84DD\u5929":
options2.sources = {
positiveX: "jt3dSDK/imgs/skybox/03/px.jpg",
negativeX: "jt3dSDK/imgs/skybox/03/nx.jpg",
positiveY: "jt3dSDK/imgs/skybox/03/py.jpg",
negativeY: "jt3dSDK/imgs/skybox/03/ny.jpg",
positiveZ: "jt3dSDK/imgs/skybox/03/pz.jpg",
negativeZ: "jt3dSDK/imgs/skybox/03/nz.jpg"
};
break;
case "\u7D2B\u8272\u661F\u7A7A":
options2.sources = {
positiveX: "jt3dSDK/imgs/skybox/04/px.jpg",
negativeX: "jt3dSDK/imgs/skybox/04/nx.jpg",
positiveY: "jt3dSDK/imgs/skybox/04/py.jpg",
negativeY: "jt3dSDK/imgs/skybox/04/ny.jpg",
positiveZ: "jt3dSDK/imgs/skybox/04/pz.jpg",
negativeZ: "jt3dSDK/imgs/skybox/04/nz.jpg"
};
break;
case "\u84DD\u8272\u661F\u7A7A":
options2.sources = {
positiveX: "jt3dSDK/imgs/skybox/05/px.jpg",
negativeX: "jt3dSDK/imgs/skybox/05/nx.jpg",
positiveY: "jt3dSDK/imgs/skybox/05/py.jpg",
negativeY: "jt3dSDK/imgs/skybox/05/ny.jpg",
positiveZ: "jt3dSDK/imgs/skybox/05/pz.jpg",
negativeZ: "jt3dSDK/imgs/skybox/05/nz.jpg"
};
break;
}
} else if (!Cesium.defined(options2.sources.positiveX) || !Cesium.defined(options2.sources.negativeX) || !Cesium.defined(options2.sources.positiveY) || !Cesium.defined(options2.sources.negativeY) || !Cesium.defined(options2.sources.positiveZ) || !Cesium.defined(options2.sources.negativeZ)) {
throw new Cesium.DeveloperError(
"options.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."
);
}
let _self = this;
let groundSkyBox = new SkyBoxOnGround({
sources: options2.sources,
show: true
});
_self._viewer.scene.postRender.addEventListener(() => {
var e = _self._viewer.camera.position;
if (Cesium.Cartographic.fromCartesian(e).height < options2.height) {
_self._viewer.scene.skyBox = groundSkyBox;
} else {
_self._viewer.scene.skyBox = _self._defaultSkyBox;
}
});
}
});
class ParticleSystem {
constructor(viewer2) {
if (!viewer2)
throw new DeveloperError("no viewer object!");
this.viewer = viewer2;
}
}
Object.assign(ParticleSystem.prototype, {
createParticleFire: function(coordinates) {
this.viewer.clock.shouldAnimate = true;
var position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
var entity = this.viewer.entities.add({
position: position2
});
function computeModelMatrix(entity2, time) {
var position3 = Cesium.Property.getValueOrUndefined(entity2.position);
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position3);
return modelMatrix;
}
var viewModel = {
startScale: 3,
endScale: 1.5,
minimumParticleLife: 1.5,
maximumParticleLife: 1.8,
minimumSpeed: 7,
maximumSpeed: 9,
particleSize: 2,
emissionRate: 200
};
var primitive = this.viewer.scene.primitives.add(
new Cesium.ParticleSystem({
image: "jt3dSDK/imgs/particlesystem/fire.png",
imageSize: new Cesium.Cartesian2(viewModel.particleSize, viewModel.particleSize),
startColor: new Cesium.Color(1, 1, 1, 1),
endColor: new Cesium.Color(0.5, 0, 0, 0),
startScale: viewModel.startScale,
endScale: viewModel.endScale,
minimumParticleLife: viewModel.minimumParticleLife,
maximumParticleLife: viewModel.maximumParticleLife,
minimumSpeed: viewModel.minimumSpeed,
maximumSpeed: viewModel.maximumSpeed,
emissionRate: viewModel.emissionRate,
lifetime: 16,
loop: true,
sizeInMeters: true,
emitter: new Cesium.ConeEmitter(Cesium.Math.toRadians(45)),
modelMatrix: computeModelMatrix(entity, Cesium.JulianDate.now())
})
);
entity.remove = function() {
viewer.entities.remove(entity);
viewer.scene.primitives.remove(primitive);
};
return entity;
},
createParticleWater: function(coordinates) {
let viewer2 = this.viewer;
this.viewer.clock.shouldAnimate = true;
var position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
var entity = this.viewer.entities.add({
position: position2
});
function computeModelMatrix(entity2, time) {
return entity2.computeModelMatrix(time, new Cesium.Matrix4());
}
function computeEmitterModelMatrix() {
let hpr = Cesium.HeadingPitchRoll.fromDegrees(viewModel.heading, viewModel.pitch, viewModel.roll);
let trs = new Cesium.TranslationRotationScale();
trs.translation = Cesium.Cartesian3.fromElements(0, 0, 1);
trs.rotation = Cesium.Quaternion.fromHeadingPitchRoll(hpr);
let Matrix42 = Cesium.Matrix4.fromTranslationRotationScale(trs);
return Matrix42;
}
function updateCallback(p, dt2) {
var gravityScratch = new Cesium.Cartesian3();
var position3 = p.position;
Cesium.Cartesian3.normalize(position3, gravityScratch);
Cesium.Cartesian3.multiplyByScalar(gravityScratch, viewModel.gravity * dt2, gravityScratch);
p.velocity = Cesium.Cartesian3.add(p.velocity, gravityScratch, p.velocity);
}
function update(scene, time) {
waterParticleSystem.modelMatrix = computeModelMatrix(entity, time);
waterParticleSystem.emitterModelMatrix = computeEmitterModelMatrix();
}
viewer2.scene.preUpdate.addEventListener(update);
var viewModel = {
startScale: 1,
endScale: 7,
minimumParticleLife: 6,
maximumParticleLife: 7,
minimumSpeed: 9,
maximumSpeed: 9.5,
particleSize: 1,
emissionRate: 60,
gravity: -4,
heading: 110,
pitch: 30,
roll: 0
};
var waterParticleSystem = new Cesium.ParticleSystem({
image: "jt3dSDK/imgs/particlesystem/water.png",
imageSize: new Cesium.Cartesian2(viewModel.particleSize, viewModel.particleSize),
startColor: new Cesium.Color(1, 1, 1, 0.6),
endColor: new Cesium.Color(0.8, 0.86, 1, 0.4),
startScale: viewModel.startScale,
endScale: viewModel.endScale,
minimumParticleLife: viewModel.minimumParticleLife,
maximumParticleLife: viewModel.maximumParticleLife,
minimumSpeed: viewModel.minimumSpeed,
maximumSpeed: viewModel.maximumSpeed,
emissionRate: viewModel.emissionRate,
sizeInMeters: true,
emitter: new Cesium.CircleEmitter(0.2),
modelMatrix: computeModelMatrix(entity),
emitterModelMatrix: computeEmitterModelMatrix(),
updateCallback
});
viewer2.scene.primitives.add(waterParticleSystem);
entity.remove = function() {
viewer2.entities.remove(entity);
viewer2.scene.primitives.remove(waterParticleSystem);
};
return entity;
}
});
let SceneEffects = {
Weather,
SkyBox,
ParticleSystem
};
class ImageLayerSplit {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
}
}
Object.assign(ImageLayerSplit.prototype, {
initSplit() {
let _self = this;
this.viewer = this._viewer;
let sliderDiv = document.getElementById("image_slider");
if (sliderDiv == null) {
sliderDiv = document.createElement("div");
sliderDiv.id = "image_slider";
sliderDiv.style.position = "absolute";
sliderDiv.style.left = "50%";
sliderDiv.style.top = "0px";
sliderDiv.style.backgroundColor = "#d3d3d3";
sliderDiv.style.width = "5px";
sliderDiv.style.height = "100%";
sliderDiv.style.zIndex = "9999";
sliderDiv.onmouseover = function() {
this.style.cursor = "ew-resize";
};
document.body.appendChild(sliderDiv);
}
this.slider = sliderDiv;
viewer.scene.splitPosition = this.slider.offsetLeft / this.slider.parentElement.offsetWidth;
if (this.handler) {
this.handler.destroy();
this.handler = null;
}
this.handler = new Cesium.ScreenSpaceEventHandler(this.slider);
var moveActive = false;
function move(movement) {
if (!moveActive) {
return;
}
var relativeOffset = movement.endPosition.x;
var splitPosition = (_self.slider.offsetLeft + relativeOffset) / _self.slider.parentElement.offsetWidth;
_self.slider.style.left = `${100 * splitPosition}%`;
viewer.scene.splitPosition = splitPosition;
}
this.handler.setInputAction(function() {
moveActive = true;
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
this.handler.setInputAction(function() {
moveActive = true;
}, Cesium.ScreenSpaceEventType.PINCH_START);
this.handler.setInputAction(move, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
this.handler.setInputAction(move, Cesium.ScreenSpaceEventType.PINCH_MOVE);
this.handler.setInputAction(function() {
moveActive = false;
}, Cesium.ScreenSpaceEventType.LEFT_UP);
this.handler.setInputAction(function() {
moveActive = false;
}, Cesium.ScreenSpaceEventType.PINCH_END);
},
addSplitLayer(earthAtLeft, earthAtRight) {
if (this.earthAtLeft) {
this._viewer.imageryLayers.remove(this.earthAtLeft);
}
if (this.earthAtRight) {
this._viewer.imageryLayers.remove(this.earthAtRight);
}
this.earthAtLeft = earthAtLeft;
this.earthAtRight = earthAtRight;
this.earthAtLeft.splitDirection = Cesium.SplitDirection.LEFT;
this.earthAtRight.splitDirection = Cesium.SplitDirection.RIGHT;
},
removeSplitLayer() {
document.body.removeChild(this.slider);
if (this.earthAtLeft) {
this._viewer.imageryLayers.remove(this.earthAtLeft);
}
if (this.earthAtRight) {
this._viewer.imageryLayers.remove(this.earthAtRight);
}
}
});
class ViewerSplitScreen {
constructor() {
}
}
Object.assign(ViewerSplitScreen.prototype, {
initHandler(viewer1, viewer2) {
var _self = this;
if (_self.handler1 && _self.handler1.getInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE)) {
return;
}
_self.handler1 = new Cesium.ScreenSpaceEventHandler(viewer1.scene.canvas);
_self.handler2 = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
_self.handler1.setInputAction(function(movement) {
var _camerca = viewer1.camera;
viewer2.camera.setView({
destination: _camerca.position,
orientation: {
direction: _camerca._direction,
up: _camerca.up,
heading: _camerca.heading,
pitch: _camerca.pitch,
roll: _camerca.roll
}
});
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
_self.handler1.setInputAction(function(movement) {
var _camerca = viewer1.camera;
viewer2.camera.setView({
destination: _camerca.position,
orientation: {
direction: _camerca._direction,
up: _camerca.up,
heading: _camerca.heading,
pitch: _camerca.pitch,
roll: _camerca.roll
}
});
}, Cesium.ScreenSpaceEventType.WHEEL);
_self.handler2.setInputAction(function(movement) {
var _camerca = viewer2.camera;
viewer1.camera.setView({
destination: _camerca.position,
orientation: {
direction: _camerca._direction,
up: _camerca.up,
heading: _camerca.heading,
pitch: _camerca.pitch,
roll: _camerca.roll
}
});
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
_self.handler2.setInputAction(function(movement) {
var _camerca = viewer2.camera;
viewer1.camera.setView({
destination: _camerca.position,
orientation: {
direction: _camerca._direction,
up: _camerca.up,
heading: _camerca.heading,
pitch: _camerca.pitch,
roll: _camerca.roll
}
});
}, Cesium.ScreenSpaceEventType.WHEEL);
},
clearHandler() {
var _self = this;
if (_self.handler1) {
_self.handler1.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
_self.handler1.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL);
}
if (_self.handler2) {
_self.handler2.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
_self.handler2.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL);
}
}
});
let SceneControl = {
ImageLayerSplit,
ViewerSplitScreen
};
class TrackRoam {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
this._draw3DObj = null;
}
_startFly(pathsData, options2) {
var _self = this;
options2 = options2 || {};
options2.time = Cesium.defaultValue(options2.time, 360);
options2.isPathShow = Cesium.defaultValue(options2.isPathShow, true);
options2.height = Cesium.defaultValue(options2.height, 5);
options2.role = Cesium.defaultValue(options2.role, 1);
this.url = options2.modelUrl;
this.time = options2.time;
this.isPathShow = options2.isPathShow;
this.height = options2.height;
this.role = options2.role;
_self.clearFlyPaths();
_self._viewer.camera.setView({
destination: pathsData.position,
orientation: pathsData.orientation
});
setTimeout(function() {
executeFly3D();
}, 200);
function executeFly3D() {
if (pathsData && pathsData.geometry) {
var positionA = pathsData.geometry.coordinates;
let positions = positionA.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2.lng, point2.lat, point2.height);
});
let distance2 = [];
for (let i2 = 0; i2 < positions.length - 1; i2++) {
let dis = Cesium.Cartesian3.distance(positions[i2], positions[i2 + 1]);
distance2.push(dis);
}
let times = [Cesium.JulianDate.fromDate(new Date())];
times.push(Cesium.JulianDate.addSeconds(times[0], _self.time, new Cesium.JulianDate()));
for (let i2 = 1; i2 < positions.length - 1; i2++) {
let s = Cesium.JulianDate.addSeconds(times[i2], _self.time * (distance2[i2] / distance2[0]), new Cesium.JulianDate());
times.push(s);
}
let oriSamples = new Cesium.SampledProperty(Cesium.Cartesian3);
oriSamples.addSamples(times, positions);
let startTime = times[0];
let stopTime = times[times.length - 1];
_self._viewer.clock.startTime = startTime.clone();
_self._viewer.clock.stopTime = stopTime.clone();
_self._viewer.clock.currentTime = startTime.clone();
_self._viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
_self._viewer.clock.multiplier = 10;
let timeOfResolution = 6;
let samplesNum = Math.floor(
Cesium.JulianDate.secondsDifference(stopTime, startTime) / timeOfResolution
);
let sampledPositions = [];
let sampledTimes = [];
for (let i2 = 0; i2 < samplesNum + 1; i2++) {
let sampleTime = Cesium.JulianDate.addSeconds(
startTime,
i2 * timeOfResolution,
new Cesium.JulianDate()
);
let tmpPos = oriSamples.getValue(sampleTime);
sampledPositions.push(Cesium.Cartographic.fromCartesian(tmpPos));
sampledTimes.push(sampleTime);
}
Cesium.sampleTerrainMostDetailed(
_self._viewer.terrainProvider,
sampledPositions
).then(() => {
let carPositionProperty = new Cesium.SampledPositionProperty();
for (let i2 = 0; i2 < sampledPositions.length; i2++) {
sampledPositions[i2].height = sampledPositions[i2].height + _self.height;
}
for (let i2 = 0; i2 < samplesNum + 1; i2++) {
carPositionProperty.addSample(
sampledTimes[i2],
Cesium.Ellipsoid.WGS84.cartographicToCartesian(sampledPositions[i2])
);
}
var position2 = carPositionProperty;
_self.entityFly = _self._viewer.entities.add({
availability: new Cesium.TimeIntervalCollection([
new Cesium.TimeInterval({
start: startTime,
stop: stopTime
})
]),
position: position2,
orientation: new Cesium.VelocityOrientationProperty(position2),
point: {
color: Cesium.Color.RED,
outlineColor: Cesium.Color.WHITE,
outlineWidth: 2,
pixelSize: 10
},
path: {
show: _self.isPathShow,
resolution: 1,
material: new Cesium.PolylineGlowMaterialProperty({
glowPower: 0.1,
color: Cesium.Color.YELLOW
}),
width: 10
}
});
if (_self.role == 0)
;
else if (_self.role == 1) {
_self._viewer.trackedEntity = _self.entityFly;
} else if (_self.role == 2) {
_self._viewer.trackedEntity = _self.entityFly;
let exection = function TimeExecution() {
if (_self._viewer.clock.shouldAnimate === true) {
let center2 = _self.entity.position.getValue(
_self._viewer.clock.currentTime
);
let orientation = _self.entity.orientation.getValue(
_self._viewer.clock.currentTime
);
let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(center2);
transform3 = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromQuaternion(orientation), center2);
_self._viewer.camera.lookAtTransform(transform3, new Cesium.Cartesian3(-50, 0, 250));
}
};
_self._viewer.clock.onTick.addEventListener(exection);
} else if (_self.role == 3) {
_self._viewer.trackedEntity = _self.entityFly;
let exection = function TimeExecution() {
if (_self._viewer.clock.shouldAnimate === true) {
let center2 = _self.entity.position.getValue(
_self._viewer.clock.currentTime
);
_self._viewer.camera.lookAt(center2, new Cesium.Cartesian3(0, 0, 1e3));
}
};
_self._viewer.clock.onTick.addEventListener(exection);
}
});
} else {
return;
}
}
}
}
Object.assign(TrackRoam.prototype, {
drawFlyPaths(coordinates, options2) {
return new Promise((resolve2, reject2) => {
let _self = this;
_self.clearFlyPaths();
let position2 = _self._viewer.camera.position;
let heading = _self._viewer.camera.heading;
let pitch = _self._viewer.camera.pitch;
let roll = _self._viewer.camera.roll;
var pathsData = {
"orientation": {
"heading": heading,
"pitch": pitch,
"roll": roll
},
"position": position2,
"clampToGround": true,
"geometry": {
"type": "LineString",
"coordinates": coordinates
}
};
_self._draw3DObj = pathsData;
resolve2(true);
});
},
clearFlyPaths() {
this._draw3DObj = null;
this._viewer.trackedEntity = void 0;
this._viewer.entities.remove(this.entityFly);
},
startFly(options2, callError) {
if (this._draw3DObj) {
this._startFly(this._draw3DObj, options2);
} else {
if (callError)
callError("\u6F2B\u6E38\u8DEF\u7EBF\u4E0D\u5B58\u5728");
}
},
pauseFly() {
var clockViewModel = this._viewer.clockViewModel;
if (clockViewModel.shouldAnimate) {
clockViewModel.shouldAnimate = false;
} else if (this._viewer.clockViewModel.canAnimate) {
clockViewModel.shouldAnimate = true;
}
},
forwardFly() {
var clockViewModel = this._viewer.clockViewModel;
var multiplier = clockViewModel.multiplier;
if (multiplier < 0) {
clockViewModel.multiplier = -multiplier;
}
clockViewModel.shouldAnimate = true;
},
backwardsFly() {
var clockViewModel = this._viewer.clockViewModel;
var multiplier = clockViewModel.multiplier;
if (multiplier > 0) {
clockViewModel.multiplier = -multiplier;
}
clockViewModel.shouldAnimate = true;
},
outFly() {
var start2 = Cesium.JulianDate.fromDate(new Date());
this._viewer.clock.startTime = start2.clone();
var stop = Cesium.JulianDate.addSeconds(start2, 3e8, new Cesium.JulianDate());
this._viewer.clock.stopTime = stop.clone();
this.clearFlyPaths();
}
});
class Roaming {
constructor(viewer2, positions, options2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
if (!positions)
throw new Cesium.DeveloperError("no positions Array!");
this.viewer = viewer2;
this.entity = void 0;
options2 = options2 || {};
options2.time = Cesium.defaultValue(options2.time, 360);
options2.speed = Cesium.defaultValue(options2.speed, 10);
options2.isPathShow = Cesium.defaultValue(options2.isPathShow, true);
options2.height = Cesium.defaultValue(options2.height, 5);
options2.role = Cesium.defaultValue(options2.role, 1);
options2.followedX = Cesium.defaultValue(options2.followedX, 50);
options2.followedZ = Cesium.defaultValue(options2.followedZ, 10);
this.time = options2.time;
this.speed = options2.speed;
this.isPathShow = options2.isPathShow;
this.height = options2.height;
this.role = options2.role;
this.followedX = options2.followedX;
this.followedZ = options2.followedZ;
this.model = options2.model;
this.billboard = options2.billboard;
this.point = options2.point;
this.label = options2.label;
this.property = this.ComputeRoamingLineProperty(positions, this.time);
}
ComputeRoamingLineProperty(Lines, time) {
let positions = [];
if (Lines[0] instanceof Cesium.Cartesian3) {
positions = Lines;
} else {
positions = Lines.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
}
let distance2 = [];
for (let i2 = 0; i2 < positions.length - 1; i2++) {
let dis = Cesium.Cartesian3.distance(positions[i2], positions[i2 + 1]);
distance2.push(dis);
}
let times = [Cesium.JulianDate.fromDate(new Date())];
times.push(Cesium.JulianDate.addSeconds(times[0], time, new Cesium.JulianDate()));
for (let i2 = 1; i2 < positions.length - 1; i2++) {
let s = Cesium.JulianDate.addSeconds(times[i2], time * (distance2[i2] / distance2[0]), new Cesium.JulianDate());
times.push(s);
}
let oriSamples = new Cesium.SampledProperty(Cesium.Cartesian3);
oriSamples.addSamples(times, positions);
let startTime = times[0];
let stopTime = times[times.length - 1];
this.viewer.clock.startTime = startTime.clone();
this.viewer.clock.stopTime = stopTime.clone();
this.viewer.clock.currentTime = startTime.clone();
this.viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
this.viewer.clock.multiplier = this.speed;
let timeOfResolution = 6;
let samplesNum = Math.floor(
Cesium.JulianDate.secondsDifference(stopTime, startTime) / timeOfResolution
);
let sampledPositions = [];
let sampledTimes = [];
for (let i2 = 0; i2 < samplesNum + 1; i2++) {
let sampleTime = Cesium.JulianDate.addSeconds(
startTime,
i2 * timeOfResolution,
new Cesium.JulianDate()
);
let tmpPos = oriSamples.getValue(sampleTime);
sampledPositions.push(Cesium.Cartographic.fromCartesian(tmpPos));
sampledTimes.push(sampleTime);
}
Cesium.sampleTerrainMostDetailed(
this.viewer.terrainProvider,
sampledPositions
).then((updatedPositions) => {
let carPositionProperty = new Cesium.SampledPositionProperty();
for (let i2 = 0; i2 < sampledPositions.length; i2++) {
sampledPositions[i2].height = sampledPositions[i2].height + this.height;
}
for (let i2 = 0; i2 < samplesNum + 1; i2++) {
carPositionProperty.addSample(
sampledTimes[i2],
Cesium.Ellipsoid.WGS84.cartographicToCartesian(sampledPositions[i2])
);
}
var position2 = carPositionProperty;
this.InitRoaming(position2, startTime, stopTime, this.isPathShow);
});
}
InitRoaming(position2, start2, stop, isPathShow) {
this.entity = this.viewer.entities.add({
availability: new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({
start: start2,
stop
})]),
position: position2,
orientation: new Cesium.VelocityOrientationProperty(position2),
path: {
resolution: 1,
material: new Cesium.PolylineGlowMaterialProperty({
glowPower: 0.1,
color: Cesium.Color.YELLOW
}),
width: 10,
show: isPathShow
}
});
if (this.model) {
let model = this.model;
this.entity.model = {
uri: model.url,
minimumPixelSize: 64,
maximumSize: 128,
maximumScale: 200,
show: true,
silhouetteColor: Cesium.Color.WHITE,
debugWireframe: false,
debugShowBoundingVolume: false,
scale: 20,
runAnimations: true
};
} else if (this.billboard) {
let billboard = this.billboard;
billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
this.entity.billboard = {
image: billboard.imgUrl,
show: true,
width: 30,
scale: 1,
height: 30,
pixelOffset: new Cesium.Cartesian2(0, -14)
};
} else {
let point2 = {};
if (this.point) {
point2 = this.point;
}
point2.pixelSize = Cesium.defaultValue(point2.pixelSize, 10);
if (point2.color) {
if (point2.color instanceof Array) {
point2.color = new Cesium.Color(point2.color[0] / 255, point2.color[1] / 255, point2.color[2] / 255, point2.color[3]);
} else if (typeof point2.color === "string") {
point2.color = new Cesium.Color.fromCssColorString(point2.color);
} else {
point2.color = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
if (point2.outlineColor) {
if (point2.outlineColor instanceof Array) {
point2.outlineColor = new Cesium.Color(point2.outlineColor[0] / 255, point2.outlineColor[1] / 255, point2.outlineColor[2] / 255, point2.outlineColor[3]);
} else if (typeof point2.outlineColor === "string") {
point2.outlineColor = new Cesium.Color.fromCssColorString(point2.outlineColor);
} else {
point2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
point2.outlineWidth = Cesium.defaultValue(point2.outlineWidth, 2);
this.entity.point = point2;
}
if (this.label) {
let label = this.label;
label.text = Cesium.defaultValue(label.text, "");
label.font = Cesium.defaultValue(label.font, "24px Helvetica");
if (label.fillColor) {
if (label.fillColor instanceof Array) {
label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
} else if (typeof label.fillColor === "string") {
label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
} else {
label.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
if (label.outlineColor) {
if (label.outlineColor instanceof Array) {
label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
} else if (typeof label.outlineColor === "string") {
label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
} else {
label.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
label.showBackground = Cesium.defaultValue(label.showBackground, false);
if (label.backgroundColor) {
if (label.backgroundColor instanceof Array) {
label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
} else if (typeof label.backgroundColor === "string") {
label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
} else {
label.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
label.pixelOffset = Cesium.defaultValue(label.pixelOffset, 0);
label.scale = Cesium.defaultValue(label.scale, 1);
label.near = Cesium.defaultValue(label.near, 150);
label.nearValue = Cesium.defaultValue(label.nearValue, 1);
label.far = Cesium.defaultValue(label.far, 2400);
label.farValue = Cesium.defaultValue(label.farValue, 0);
this.entity.label = {
text: label.text,
font: label.font,
fillColor: label.fillColor,
outlineColor: label.outlineColor,
outlineWidth: label.outlineWidth,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
showBackground: label.showBackground,
backgroundColor: label.backgroundColor,
backgroundPadding: new Cesium.Cartesian2(6, 6),
disableDepthTestDistance: Number.POSITIVE_INFINITY,
pixelOffset: new Cesium.Cartesian2(0, label.pixelOffset),
scale: label.scale
};
}
this.entity.position.setInterpolationOptions({
interpolationDegree: 5,
interpolationAlgorithm: Cesium.LagrangePolynomialApproximation
});
this.initRole(this.role);
}
initRole(role) {
let _self = this;
if (role == 0) {
this.viewer.trackedEntity = void 0;
let len = _self.viewer.clock.onTick.numberOfListeners;
for (let i2 = 0; i2 < len; i2++) {
_self.viewer.clock.onTick.removeEventListener(_self.viewer.clock.onTick._listeners[i2]);
}
} else if (role == 1) {
this.viewer.trackedEntity = this.entity;
let len = _self.viewer.clock.onTick.numberOfListeners;
for (let i2 = 0; i2 < len; i2++) {
_self.viewer.clock.onTick.removeEventListener(_self.viewer.clock.onTick._listeners[i2]);
}
} else if (role == 2) {
this.viewer.trackedEntity = this.entity;
let exection = function TimeExecution() {
if (_self.viewer.clock.shouldAnimate === true) {
let center2 = _self.entity.position.getValue(
_self.viewer.clock.currentTime
);
let orientation = _self.entity.orientation.getValue(
_self.viewer.clock.currentTime
);
let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(center2);
transform3 = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromQuaternion(orientation), center2);
var transformX = _self.followedX || 50;
var transformZ = _self.followedZ || 10;
_self.viewer.camera.lookAtTransform(transform3, new Cesium.Cartesian3(transformX, 0, transformZ));
}
};
this.viewer.clock.onTick.addEventListener(exection);
} else if (role == 3) {
this.viewer.trackedEntity = this.entity;
let exection = function TimeExecution() {
if (_self.viewer.clock.shouldAnimate === true) {
let center2 = _self.entity.position.getValue(
_self.viewer.clock.currentTime
);
_self.viewer.camera.lookAt(center2, new Cesium.Cartesian3(0, 0, 1e3));
}
};
this.viewer.clock.onTick.addEventListener(exection);
}
}
PauseOrContinue(state) {
this.viewer.clock.shouldAnimate = state;
}
forwardFly() {
var multiplier = this.viewer.clock.multiplier;
if (multiplier < 0) {
this.viewer.clock.multiplier = -multiplier;
}
this.viewer.clock.shouldAnimate = true;
}
backwardsFly() {
var multiplier = this.viewer.clock.multiplier;
if (multiplier > 0) {
this.viewer.clock.multiplier = -multiplier;
}
this.viewer.clock.shouldAnimate = true;
}
ChangeRoamingSpeed(value) {
this.viewer.clock.multiplier = value;
}
EndRoaming() {
if (this.entity !== void 0) {
this.viewer.entities.remove(this.entity);
}
this.viewer.trackedEntity = void 0;
this.viewer.clock.shouldAnimate = false;
let len = this.viewer.clock.onTick.numberOfListeners;
for (let i2 = 0; i2 < len; i2++) {
this.viewer.clock.onTick.removeEventListener(this.viewer.clock.onTick._listeners[i2]);
}
}
}
class PointObject {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
}
}
Object.assign(PointObject.prototype, {
addLabel(points2, options2) {
return new Promise((resolve2, reject2) => {
let _self = this;
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
let position2;
if (points2 instanceof Cesium.Cartesian3) {
position2 = points2;
} else {
position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
}
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
let label = options2.label || {};
label.text = Cesium.defaultValue(label.text, "\u91D1\u7530CIM\u4E09\u7EF4\u57FA\u7840\u5E73\u53F0");
label.font = Cesium.defaultValue(label.font, "24px Helvetica");
if (label.fillColor instanceof Array) {
label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
} else if (typeof label.fillColor === "string") {
label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
} else {
label.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
if (label.outlineColor instanceof Array) {
label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
} else if (typeof label.outlineColor === "string") {
label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
} else {
label.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
}
label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
label.showBackground = Cesium.defaultValue(label.showBackground, false);
if (label.backgroundColor instanceof Array) {
label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
} else if (typeof label.backgroundColor === "string") {
label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
} else {
label.backgroundColor = new Cesium.Color.fromCssColorString("#FFF");
}
if (label.backgroundPadding) {
label.backgroundPadding = new Cesium.Cartesian2(label.backgroundPadding, label.backgroundPadding);
}
let entity = new Cesium.Entity({
id: options2.id,
position: position2,
label: {
text: label.text,
font: label.font,
fillColor: label.fillColor,
outlineColor: label.outlineColor,
outlineWidth: label.outlineWidth,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
showBackground: label.showBackground,
backgroundColor: label.backgroundColor,
backgroundPadding: label.backgroundPadding,
disableDepthTestDistance: Number.POSITIVE_INFINITY,
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
}
});
if (label.pixelOffset) {
label.pixelOffset.x = Cesium.defaultValue(label.pixelOffset.x, 0);
label.pixelOffset.y = Cesium.defaultValue(label.pixelOffset.y, 0);
entity.label.pixelOffset = new Cesium.Cartesian2(label.pixelOffset.x, label.pixelOffset.y);
}
if (label.scaleByDistance) {
label.scaleByDistance.near = Cesium.defaultValue(label.scaleByDistance.near, 0);
label.scaleByDistance.nearValue = Cesium.defaultValue(label.scaleByDistance.nearValue, 0);
label.scaleByDistance.far = Cesium.defaultValue(label.scaleByDistance.far, 1);
label.scaleByDistance.farValue = Cesium.defaultValue(label.scaleByDistance.farValue, 0);
entity.label.scaleByDistance = new Cesium.NearFarScalar(label.scaleByDistance.near, label.scaleByDistance.nearValue, label.scaleByDistance.far, label.scaleByDistance.farValue);
}
_self._viewer.entities.add(entity);
resolve2(entity);
});
},
addPoint(points2, options2) {
return new Promise((resolve2, reject2) => {
let _self = this;
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
let position2;
if (points2 instanceof Cesium.Cartesian3) {
position2 = points2;
} else {
position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
}
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
let point2 = options2.point || {};
point2.pixelSize = Cesium.defaultValue(point2.pixelSize, 10);
if (point2.color instanceof Array) {
point2.color = new Cesium.Color(point2.color[0] / 255, point2.color[1] / 255, point2.color[2] / 255, point2.color[3]);
} else if (typeof point2.color === "string") {
point2.color = new Cesium.Color.fromCssColorString(point2.color);
} else {
point2.color = new Cesium.Color.fromCssColorString("#FFF");
}
if (point2.outlineColor instanceof Array) {
point2.outlineColor = new Cesium.Color(point2.outlineColor[0] / 255, point2.outlineColor[1] / 255, point2.outlineColor[2] / 255, point2.outlineColor[3]);
} else if (typeof point2.outlineColor === "string") {
point2.outlineColor = new Cesium.Color.fromCssColorString(point2.outlineColor);
} else {
point2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
}
point2.outlineWidth = Cesium.defaultValue(point2.outlineWidth, 1);
let entity = new Cesium.Entity({
id: options2.id,
position: position2,
point: {
pixelSize: point2.pixelSize,
color: point2.color,
outlineColor: point2.outlineColor,
outlineWidth: point2.outlineWidth,
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
disableDepthTestDistance: Number.POSITIVE_INFINITY
}
});
if (options2.label) {
let label = options2.label || {};
label.text = Cesium.defaultValue(label.text, "");
label.font = Cesium.defaultValue(label.font, "24px Helvetica");
if (label.fillColor instanceof Array) {
label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
} else if (typeof label.fillColor === "string") {
label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
} else {
label.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
if (label.outlineColor instanceof Array) {
label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
} else if (typeof label.outlineColor === "string") {
label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
} else {
label.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
}
label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
label.showBackground = Cesium.defaultValue(label.showBackground, false);
if (label.backgroundColor instanceof Array) {
label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
} else if (typeof label.backgroundColor === "string") {
label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
} else {
label.backgroundColor = new Cesium.Color.fromCssColorString("#FFF");
}
if (label.backgroundPadding) {
label.backgroundPadding = new Cesium.Cartesian2(label.backgroundPadding, label.backgroundPadding);
}
entity.label = {
text: label.text,
font: label.font,
fillColor: label.fillColor,
outlineColor: label.outlineColor,
outlineWidth: label.outlineWidth,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
showBackground: label.showBackground,
backgroundColor: label.backgroundColor,
backgroundPadding: new Cesium.Cartesian2(6, 6),
disableDepthTestDistance: Number.POSITIVE_INFINITY
};
if (label.scaleByDistance) {
label.scaleByDistance.near = Cesium.defaultValue(label.scaleByDistance.near, 0);
label.scaleByDistance.nearValue = Cesium.defaultValue(label.scaleByDistance.nearValue, 0);
label.scaleByDistance.far = Cesium.defaultValue(label.scaleByDistance.far, 1);
label.scaleByDistance.farValue = Cesium.defaultValue(label.scaleByDistance.farValue, 0);
entity.label.scaleByDistance = new Cesium.NearFarScalar(label.scaleByDistance.near, label.scaleByDistance.nearValue, label.scaleByDistance.far, label.scaleByDistance.farValue);
}
}
_self._viewer.entities.add(entity);
resolve2(entity);
});
},
addBillboard(points2, options2) {
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
let position2;
if (points2 instanceof Cesium.Cartesian3) {
position2 = points2;
} else {
position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
}
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
let billboard = options2.billboard || {};
billboard.image = billboard.imgUrl || "jt3dSDK/imgs/point/point3.png";
billboard.scale = Cesium.defaultValue(billboard.scale, 1);
billboard.pixelOffset = Cesium.defaultValue(billboard.pixelOffset, 0);
let entity = new Cesium.Entity({
id: options2.id,
name: "add billboard",
position: position2,
billboard: {
image: billboard.image,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
scale: billboard.scale,
pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
disableDepthTestDistance: Number.POSITIVE_INFINITY
}
});
if (billboard.scaleByDistance) {
billboard.scaleByDistance.near = Cesium.defaultValue(billboard.scaleByDistance.near, 0);
billboard.scaleByDistance.nearValue = Cesium.defaultValue(billboard.scaleByDistance.nearValue, 0);
billboard.scaleByDistance.far = Cesium.defaultValue(billboard.scaleByDistance.far, 1);
billboard.scaleByDistance.farValue = Cesium.defaultValue(billboard.scaleByDistance.farValue, 0);
entity.billboard.scaleByDistance = new Cesium.NearFarScalar(billboard.scaleByDistance.near, billboard.scaleByDistance.nearValue, billboard.scaleByDistance.far, billboard.scaleByDistance.farValue);
}
if (options2.label) {
let label = options2.label || {};
label.text = Cesium.defaultValue(label.text, "");
label.font = Cesium.defaultValue(label.font, "24px Helvetica");
if (label.fillColor instanceof Array) {
label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
} else if (typeof label.fillColor === "string") {
label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
} else {
label.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
}
if (label.outlineColor instanceof Array) {
label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
} else if (typeof label.outlineColor === "string") {
label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
} else {
label.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
label.showBackground = Cesium.defaultValue(label.showBackground, false);
if (label.backgroundColor instanceof Array) {
label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
} else if (typeof label.backgroundColor === "string") {
label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
} else {
label.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
if (label.backgroundPadding) {
label.backgroundPadding = new Cesium.Cartesian2(label.backgroundPadding, label.backgroundPadding);
}
entity.label = {
text: label.text,
font: label.font,
fillColor: label.fillColor,
outlineColor: label.outlineColor,
outlineWidth: label.outlineWidth,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
showBackground: label.showBackground,
backgroundColor: label.backgroundColor,
backgroundPadding: label.backgroundPadding,
disableDepthTestDistance: Number.POSITIVE_INFINITY
};
if (label.pixelOffset) {
label.pixelOffset.x = Cesium.defaultValue(label.pixelOffset.x, 0);
label.pixelOffset.y = Cesium.defaultValue(label.pixelOffset.y, 0);
entity.label.pixelOffset = new Cesium.Cartesian2(label.pixelOffset.x, label.pixelOffset.y);
}
if (label.scaleByDistance) {
label.scaleByDistance.near = Cesium.defaultValue(label.scaleByDistance.near, 0);
label.scaleByDistance.nearValue = Cesium.defaultValue(label.scaleByDistance.nearValue, 0);
label.scaleByDistance.far = Cesium.defaultValue(label.scaleByDistance.far, 1);
label.scaleByDistance.farValue = Cesium.defaultValue(label.scaleByDistance.farValue, 0);
entity.label.scaleByDistance = new Cesium.NearFarScalar(label.scaleByDistance.near, label.scaleByDistance.nearValue, label.scaleByDistance.far, label.scaleByDistance.farValue);
}
}
this._viewer.entities.add(entity);
resolve2(entity);
});
},
addModel: function(points2, options2) {
let _self = this;
this._viewer;
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
let position2;
if (points2 instanceof Cesium.Cartesian3) {
position2 = points2;
} else {
position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
}
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
let model = options2.model || {};
model.alpha = Cesium.defaultValue(model.alpha, 1);
model.heading = Cesium.defaultValue(model.heading, 0);
model.pitch = Cesium.defaultValue(model.pitch, 0);
model.roll = Cesium.defaultValue(model.roll, 0);
var heading = Cesium.Math.toRadians(model.heading);
var pitch = model.pitch;
var roll = model.roll;
new Cesium.HeadingPitchRoll(heading, pitch, roll);
let entity = new Cesium.Entity({
id: options2.id,
position: position2,
model: {
uri: model.url,
incrementallyLoadTextures: true,
colorBlendMode: Cesium.ColorBlendMode["HIGHLIGHT"],
colorBlendAmount: 0.1,
color: Cesium.Color.WHITE.withAlpha(model.alpha),
imageBasedLightingFactor: new Cesium.Cartesian2(12, 13),
runAnimations: true,
show: true,
debugWireframe: false,
debugShowBoundingVolume: false,
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
disableDepthTestDistance: Number.POSITIVE_INFINITY
}
});
if (model.minimumPixelSize) {
entity.model.minimumPixelSize = model.minimumPixelSize;
}
if (model.maximumScale) {
entity.model.maximumScale = model.maximumScale;
}
if (model.silhouetteColor) {
if (model.silhouetteColor instanceof Array) {
entity.model.silhouetteColor = new Cesium.Color(model.silhouetteColor[0] / 255, model.silhouetteColor[1] / 255, model.silhouetteColor[2] / 255, model.silhouetteColor[3]);
} else if (typeof model.silhouetteColor === "string") {
entity.model.silhouetteColor = new Cesium.Color.fromCssColorString(model.silhouetteColor);
}
}
model.silhouetteSize = Cesium.defaultValue(model.silhouetteSize, 1);
_self._viewer.entities.add(entity);
resolve2(entity);
});
},
generatePoint(points2, options2) {
return new Promise((resolve2, reject2) => {
let _self = this;
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
let point2 = options2.point || {};
point2.pixelSize = Cesium.defaultValue(point2.pixelSize, 10);
if (point2.color instanceof Array) {
point2.color = new Cesium.Color(point2.color[0] / 255, point2.color[1] / 255, point2.color[2] / 255, point2.color[3]);
} else if (typeof point2.color === "string") {
point2.color = new Cesium.Color.fromCssColorString(point2.color);
} else {
point2.color = new Cesium.Color.fromCssColorString("#FFF");
}
if (point2.outlineColor instanceof Array) {
point2.outlineColor = new Cesium.Color(point2.outlineColor[0] / 255, point2.outlineColor[1] / 255, point2.outlineColor[2] / 255, point2.outlineColor[3]);
} else if (typeof point2.outlineColor === "string") {
point2.outlineColor = new Cesium.Color.fromCssColorString(point2.outlineColor);
} else {
point2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
}
point2.outlineWidth = Cesium.defaultValue(point2.outlineWidth, 1);
let terrainAltitude = getHeigthByPointsMostDetailed(_self._viewer, [points2]);
terrainAltitude.then(function(updatedPositions) {
let position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], updatedPositions[0].height);
let entity = new Cesium.Entity({
id: options2.id,
position: position2,
point: {
pixelSize: point2.pixelSize,
color: point2.color,
outlineColor: point2.outlineColor,
outlineWidth: point2.outlineWidth,
heightReference: Cesium.HeightReference.NONE,
disableDepthTestDistance: updatedPositions[0].height
}
});
if (options2.label) {
let label = options2.label || {};
label.text = Cesium.defaultValue(label.text, "");
label.font = Cesium.defaultValue(label.font, "24px Helvetica");
if (label.fillColor instanceof Array) {
label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
} else if (typeof label.fillColor === "string") {
label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
} else {
label.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
if (label.outlineColor instanceof Array) {
label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
} else if (typeof label.outlineColor === "string") {
label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
} else {
label.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
}
label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
label.showBackground = Cesium.defaultValue(label.showBackground, false);
if (label.backgroundColor instanceof Array) {
label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
} else if (typeof label.backgroundColor === "string") {
label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
} else {
label.backgroundColor = new Cesium.Color.fromCssColorString("#FFF");
}
label.pixelOffset = Cesium.defaultValue(label.pixelOffset, 0);
label.scale = Cesium.defaultValue(label.scale, 1);
entity.label = {
text: label.text,
font: label.font,
fillColor: label.fillColor,
outlineColor: label.outlineColor,
outlineWidth: label.outlineWidth,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
showBackground: label.showBackground,
backgroundColor: label.backgroundColor,
backgroundPadding: new Cesium.Cartesian2(6, 6),
disableDepthTestDistance: Number.POSITIVE_INFINITY,
pixelOffset: new Cesium.Cartesian2(0, label.pixelOffset),
scale: label.scale
};
}
_self._viewer.entities.add(entity);
resolve2(entity);
});
});
},
addBillboardByGeoJson: function(geoJsonUrl, options2) {
return new Promise((resolve2, reject2) => {
let viewer2 = this._viewer;
if (!Cesium.defined(geoJsonUrl)) {
throw new Cesium.DeveloperError("geoJsonUrl is required.");
}
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
let billboard = options2.billboard || {};
billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
billboard.scale = Cesium.defaultValue(billboard.scale, 1);
billboard.pixelOffset = Cesium.defaultValue(billboard.pixelOffset, 0);
let label = options2.label || {};
label.text = Cesium.defaultValue(label.text, "");
label.textField = Cesium.defaultValue(label.textField, "");
label.font = Cesium.defaultValue(label.font, "24px Helvetica");
if (label.fillColor instanceof Array) {
label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
} else if (typeof label.fillColor === "string") {
label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
} else {
label.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
}
if (label.outlineColor instanceof Array) {
label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
} else if (typeof label.outlineColor === "string") {
label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
} else {
label.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
label.showBackground = Cesium.defaultValue(label.showBackground, false);
if (label.backgroundColor instanceof Array) {
label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
} else if (typeof label.backgroundColor === "string") {
label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
} else {
label.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
label.pixelOffset = Cesium.defaultValue(label.pixelOffset, 0);
label.scale = Cesium.defaultValue(label.scale, 1);
const dataSource = new Cesium.GeoJsonDataSource(options2.id);
dataSource.load(geoJsonUrl, {
clampToGround: true
}).then(function(data) {
viewer2.dataSources.add(data);
const entities2 = data.entities.values;
entities2.forEach((entity) => {
entity.billboard = {
image: billboard.imgUrl,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
scale: billboard.scale,
pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
disableDepthTestDistance: Number.POSITIVE_INFINITY
};
let labelText = label.text;
if (entity.properties[label.textField]) {
labelText = entity.properties[label.textField]._value;
}
if (labelText === "") {
labelText = (i + 1).toString();
}
entity.label = {
text: labelText.toString(),
font: label.font,
fillColor: label.fillColor,
outlineColor: label.outlineColor,
outlineWidth: label.outlineWidth,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
showBackground: label.showBackground,
backgroundColor: label.backgroundColor,
backgroundPadding: new Cesium.Cartesian2(6, 6),
disableDepthTestDistance: Number.POSITIVE_INFINITY,
pixelOffset: new Cesium.Cartesian2(0, label.pixelOffset),
scale: label.scale
};
if (label.scaleByDistance) {
label.scaleByDistance.near = Cesium.defaultValue(label.scaleByDistance.near, 0);
label.scaleByDistance.nearValue = Cesium.defaultValue(label.scaleByDistance.nearValue, 0);
label.scaleByDistance.far = Cesium.defaultValue(label.scaleByDistance.far, 1);
label.scaleByDistance.farValue = Cesium.defaultValue(label.scaleByDistance.farValue, 0);
entity.label.scaleByDistance = new Cesium.NearFarScalar(label.scaleByDistance.near, label.scaleByDistance.nearValue, label.scaleByDistance.far, label.scaleByDistance.farValue);
}
});
});
});
},
addGltf: function(options2) {
let viewer2 = this._viewer;
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(options2.points)) {
resolve2("options.points is required.");
throw new Cesium.DeveloperError("options.points is required.");
}
if (!Cesium.defined(options2.url)) {
resolve2("options.url is required.");
throw new Cesium.DeveloperError("options.url is required.");
}
options2.id = options2.id || setSessionid$1();
options2.heading = Cesium.defaultValue(options2.heading, 0);
options2.pitch = Cesium.defaultValue(options2.pitch, 0);
options2.roll = Cesium.defaultValue(options2.roll, 0);
options2.alpha = Cesium.defaultValue(options2.alpha, 1);
let position2 = void 0;
if (options2.points instanceof Cesium.Cartesian3) {
position2 = options2.points;
} else {
position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
}
var heading = Cesium.Math.toRadians(options2.heading);
var pitch = options2.pitch;
var roll = options2.roll;
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
var modelGltf = viewer2.entities.add({
id: options2.id,
position: position2,
orientation: Cesium.Transforms.headingPitchRollQuaternion(position2, hpr),
model: {
uri: options2.url,
incrementallyLoadTextures: true,
colorBlendMode: Cesium.ColorBlendMode["HIGHLIGHT"],
colorBlendAmount: 0.1,
color: Cesium.Color.WHITE.withAlpha(options2.alpha),
imageBasedLightingFactor: new Cesium.Cartesian2(12, 13),
runAnimations: true,
show: true,
debugWireframe: false,
debugShowBoundingVolume: false
}
});
if (options2.minimumPixelSize) {
modelGltf.model.minimumPixelSize = options2.minimumPixelSize;
}
if (options2.maximumScale) {
modelGltf.model.maximumScale = options2.maximumScale;
}
if (options2.silhouetteColor) {
if (options2.silhouetteColor instanceof Array) {
options2.silhouetteColor = new Cesium.Color(options2.silhouetteColor[0] / 255, options2.silhouetteColor[1] / 255, options2.silhouetteColor[2] / 255, options2.silhouetteColor[3]);
} else if (typeof options2.silhouetteColor === "string") {
options2.silhouetteColor = new Cesium.Color.fromCssColorString(options2.silhouetteColor);
} else {
options2.silhouetteColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
window[options2.id] = modelGltf;
resolve2(options2.id);
});
},
addModelFromGltf(points2, options2) {
let viewer2 = this._viewer;
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(options2.points)) {
resolve2("options.points is required.");
throw new Cesium.DeveloperError("options.points is required.");
}
if (!Cesium.defined(options2.url)) {
resolve2("options.url is required.");
throw new Cesium.DeveloperError("options.url is required.");
}
options2.id = options2.id || setSessionid$1();
options2.scale = Cesium.defaultValue(options2.scale, 1);
let position2 = void 0;
if (options2.points instanceof Cesium.Cartesian3) {
position2 = options2.points;
} else {
position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
}
const modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position2);
let model = viewer2.scene.primitives.add(
Cesium.Model.fromGltf({
show: true,
url: options2.url,
modelMatrix,
lightColor: new Cesium.Cartesian3(10, 10, 10),
debugWireframe: false,
debugShowBoundingVolume: false
})
);
model.readyPromise.then(function() {
var rotationX = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(0)));
Cesium.Matrix4.multiply(model.modelMatrix, rotationX, model.modelMatrix);
});
window[options2.id] = model;
resolve2(options2.id);
});
}
});
class PolylineObject {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
}
}
Object.assign(PolylineObject.prototype, {
drawPolylineByGeoJson: function(geoJsonUrl, options2) {
return new Promise((resolve2, reject2) => {
let viewer2 = this._viewer;
if (!Cesium.defined(geoJsonUrl)) {
throw new Cesium.DeveloperError("geoJsonUrl is required.");
}
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
options2.width = Cesium.defaultValue(options2.width, 3);
options2.minHeigh = Cesium.defaultValue(options2.minHeigh, 0);
options2.maxHeigh = Cesium.defaultValue(options2.maxHeigh, 2e8);
let promise = Cesium.GeoJsonDataSource.load(geoJsonUrl, {
clampToGround: options2.clampToGround
});
promise.then((dataSource) => {
viewer2.dataSources.add(dataSource);
dataSource.name = options2.id;
let entities2 = dataSource.entities.values;
let distanceDisplayCondition = new Cesium.DistanceDisplayCondition(options2.minHeigh, options2.maxHeigh);
let material = new PolylineDirectionMaterialProperty(options2);
for (var i2 = 0; i2 < entities2.length; i2++) {
var entity = entities2[i2];
entity.polyline.distanceDisplayCondition = distanceDisplayCondition;
entity.polyline.material = material;
entity.polyline.width = options2.width;
if (options2.clampToGround) {
entity.polyline.clampToGround = true;
}
}
resolve2(entities2);
});
});
},
PolylineLinkPulseMaterialProperty: function(points2, options2) {
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
if (points2.length < 2) {
reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
}
let positions = points2.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
options2.width = options2.width || 5;
let material = new PolylineDirectionMaterialProperty(options2);
let entity = this._viewer.entities.add({
id: options2.id,
name: "Pulse line",
polyline: {
positions,
width: options2.width,
material,
clampToGround: true
}
});
resolve2(entity);
});
},
PolylineArrowMaterialProperty: function(points2, options2) {
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
if (points2.length < 2) {
reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
}
let positions = points2.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
options2.width = options2.width || 5;
let material = new PolylineDirectionMaterialProperty(options2);
let entity = this._viewer.entities.add({
id: options2.id,
name: "Pulse line",
polyline: {
positions,
width: options2.width,
material,
clampToGround: true
}
});
resolve2(entity);
});
},
drawGlowingLine(points2, options2) {
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
if (points2.length < 2) {
reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
}
let positions = points2.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
if (options2.color) {
if (options2.color instanceof Array) {
options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
} else if (typeof options2.color === "string") {
options2.color = new Cesium.Color.fromCssColorString(options2.color);
} else {
options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
options2.width = options2.width || 5;
options2.glowPower = options2.glowPower || 0.25;
options2.taperPower = options2.taperPower || 1;
let entity = this._viewer.entities.add({
id: options2.id,
name: "Glowing blue line on the surface",
polyline: {
clampToGround: true,
positions,
width: options2.width,
followSurface: true,
material: new Cesium.PolylineGlowMaterialProperty({
color: options2.color,
glowPower: options2.glowPower,
taperPower: options2.taperPower
})
}
});
resolve2(entity);
});
},
drawSpecifyColorLine(points2, options2) {
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(points2)) {
reject2("points is required.");
}
if (points2.length < 2) {
reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
}
let positions = points2.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
if (options2.color) {
if (options2.color instanceof Array) {
options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
} else if (typeof options2.color === "string") {
options2.color = new Cesium.Color.fromCssColorString(options2.color);
} else {
options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
options2.width = options2.width || 5;
let entity = this._viewer.entities.add({
id: options2.id,
name: "Red line on the surface",
polyline: {
clampToGround: true,
positions,
width: options2.width,
material: options2.color
}
});
resolve2(entity);
});
},
drawSpecifyColorAndOutlineColorLine(points2, options2) {
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
if (points2.length < 2) {
reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
}
let positions = points2.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
if (options2.color) {
if (options2.color instanceof Array) {
options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
} else if (typeof options2.color === "string") {
options2.color = new Cesium.Color.fromCssColorString(options2.color);
} else {
options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
options2.width = options2.width || 5;
if (options2.outlineColor) {
if (options2.outlineColor instanceof Array) {
options2.outlineColor = new Cesium.Color(options2.outlineColor[0] / 255, options2.outlineColor[1] / 255, options2.outlineColor[2] / 255, options2.outlineColor[3]);
} else if (typeof options2.outlineColor === "string") {
options2.outlineColor = new Cesium.Color.fromCssColorString(options2.outlineColor);
} else {
options2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 1);
let entity = this._viewer.entities.add({
id: options2.id,
name: "Orange line with black outline at height and following the surface",
polyline: {
clampToGround: true,
positions,
width: options2.width,
material: new Cesium.PolylineOutlineMaterialProperty({
color: options2.color,
outlineWidth: options2.outlineWidth,
outlineColor: options2.outlineColor
})
}
});
resolve2(entity);
});
},
drawSpecifyColorArrowStaticStateLine(points2, options2) {
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
if (points2.length < 2) {
reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
}
let positions = points2.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
if (options2.color) {
if (options2.color instanceof Array) {
options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
} else if (typeof options2.color === "string") {
options2.color = new Cesium.Color.fromCssColorString(options2.color);
} else {
options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
options2.width = options2.width || 5;
let entity = this._viewer.entities.add({
id: options2.id,
name: "Purple straight arrow at height",
polyline: {
clampToGround: true,
positions,
width: options2.width,
followSurface: false,
material: new Cesium.PolylineArrowMaterialProperty(options2.color)
}
});
resolve2(entity);
});
},
drawDashedLine(points2, options2) {
return new Promise((resolve2, reject2) => {
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
if (points2.length < 2) {
reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
}
let positions = points2.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
if (options2.color) {
if (options2.color instanceof Array) {
options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
} else if (typeof options2.color === "string") {
options2.color = new Cesium.Color.fromCssColorString(options2.color);
} else {
options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
options2.width = options2.width || 5;
if (options2.gapColor) {
if (options2.gapColor instanceof Array) {
options2.gapColor = new Cesium.Color(options2.gapColor[0] / 255, options2.gapColor[1] / 255, options2.gapColor[2] / 255, options2.gapColor[3]);
} else if (typeof options2.gapColor === "string") {
options2.gapColor = new Cesium.Color.fromCssColorString(options2.gapColor);
} else {
options2.gapColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
options2.dashLength = options2.dashLength || 16;
options2.dashPattern = options2.dashPattern || 255;
let entity = this._viewer.entities.add({
id: options2.id,
name: "CYAN dashed line",
polyline: {
clampToGround: true,
positions,
width: options2.width,
material: new Cesium.PolylineDashMaterialProperty({
color: options2.color,
gapColor: options2.gapColor,
dashLength: options2.dashLength,
dashPattern: options2.dashPattern
})
}
});
resolve2(entity);
});
}
});
class PolygonObject {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
this._drawEntities = [];
this._polygonEntity = null;
}
}
Object.assign(PolygonObject.prototype, {
drawPolygonByGeoJson(geoJsonUrl, options2) {
return new Promise((resolve2, reject2) => {
let _self = this;
if (!Cesium.defined(geoJsonUrl)) {
throw new Cesium.DeveloperError("geoJsonUrl is required.");
}
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
options2.color = Cesium.defaultValue(options2.color, "#FF0000");
options2.outlineColor = Cesium.defaultValue(options2.outlineColor, "#FFFF00");
options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 1);
options2.extrudedHeight = Cesium.defaultValue(options2.extrudedHeight, 0);
let promise = Cesium.GeoJsonDataSource.load(geoJsonUrl, {
clampToGround: true,
stroke: Cesium.Color.WHITE,
strokeWidth: 3,
fill: Cesium.Color.RED.withAlpha(0.5)
});
promise.then((dataSource) => {
_self._viewer.dataSources.add(dataSource);
dataSource.name = options2.id;
let entities2 = dataSource.entities.values;
for (let index2 = 0; index2 < entities2.length; index2++) {
let entity = entities2[index2];
entity.polygon.material = new Cesium.Color.fromCssColorString(color).withAlpha(0.1);
entity.polygon.extrudedHeight = options2.extrudedHeight;
entity.polygon.fill = false;
entity.polygon.outline = false;
entity.polygon.outlineWidth = options2.outlineWidth;
entity.polygon.outlineColor = options2.outlineColor;
entity.polyline = {
positions: entity.polygon.hierarchy._value.positions,
width: entity.polygon.outlineWidth,
material: new Cesium.Color.fromCssColorString(color).withAlpha(0.1)
};
if (options2.clampToGround) {
entity.polyline.clampToGround = true;
}
}
resolve2(entities2);
});
});
},
generatePolygonByPoints(points2, options2) {
return new Promise((resolve2, reject2) => {
let _self = this;
if (!Cesium.defined(points2)) {
throw new Cesium.DeveloperError("points is required.");
}
if (points2.length < 3) {
reject2("\u9762\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C113\u4E2A");
}
let positions = points2.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
options2.fill = options2.fill || true;
if (options2.color) {
options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
} else {
options2.color = new Cesium.Color.fromCssColorString("#ff0000");
}
options2.outline = options2.outline || false;
if (options2.outlineColor) {
options2.outlineColor = new Cesium.Color(options2.outlineColor[0] / 255, options2.outlineColor[1] / 255, options2.outlineColor[2] / 255, options2.outlineColor[3]);
} else {
options2.outlineColor = new Cesium.Color.fromCssColorString("#000");
}
options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 1);
let entity = new Cesium.Entity({
id: options2.id,
name: "Generate surfaces based on coordinate points",
polygon: {
hierarchy: positions,
material: options2.color,
fill: options2.fill,
outline: options2.outline,
outlineWidth: options2.outlineWidth,
outlineColor: options2.outlineColor
}
});
if (options2.outline) {
entity.polyline = {
positions: entity.polygon.hierarchy._value.positions,
width: options2.outlineWidth,
material: options2.outlineColor,
clampToGround: true
};
}
_self._viewer.entities.add(entity);
resolve2(entity);
});
}
});
function DynamicWallMaterialProperty(options2) {
this._definitionChanged = new Cesium.Event();
this._color = void 0;
this._colorSubscription = void 0;
this.color = options2.color || Color.BLUE;
this.duration = options2.duration || 1e3;
this.trailImage = options2.trailImage;
this._time = new Date().getTime();
}
function _getDirectionWallShader(options2) {
if (options2 && options2.get) {
var materail = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;";
if (options2.direction == "vertical") {
materail += "vec4 colorImage = texture2D(image, vec2(fract(st.s), fract(float(" + options2.count + ")*st.t" + options2.order + " time)));\n ";
} else {
materail += "vec4 colorImage = texture2D(image, vec2(fract(float(" + options2.count + ")*st.s " + options2.order + " time), fract(st.t)));\n ";
}
materail += "vec4 fragColor;\n fragColor.rgb = (colorImage.rgb+color.rgb) / 1.0;\n fragColor = czm_gammaCorrect(fragColor);\n material.diffuse = colorImage.rgb;\n material.alpha = colorImage.a;\n material.emission = fragColor.rgb;\n return material;\n }";
return materail;
}
}
Object.defineProperties(DynamicWallMaterialProperty.prototype, {
isConstant: {
get: function() {
return false;
}
},
definitionChanged: {
get: function() {
return this._definitionChanged;
}
},
color: Cesium.createPropertyDescriptor("color")
});
var MaterialType = "wallType" + parseInt(Math.random() * 1e3);
DynamicWallMaterialProperty.prototype.getType = function(time) {
return MaterialType;
};
DynamicWallMaterialProperty.prototype.getValue = function(time, result) {
if (!Cesium.defined(result)) {
result = {};
}
result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.WHITE, result.color);
result.image = this.trailImage;
if (this.duration) {
result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
}
viewer.scene.requestRender();
return result;
};
DynamicWallMaterialProperty.prototype.equals = function(other) {
return this === other || other instanceof DynamicWallMaterialProperty && Cesium.Property.equals(this._color, other._color);
};
Cesium.Material._materialCache.addMaterial(MaterialType, {
fabric: {
type: MaterialType,
uniforms: {
color: new Cesium.Color(1, 0, 0, 0.5),
image: Cesium.Material.DefaultImageId,
time: -20
},
source: _getDirectionWallShader({
get: true,
count: 3,
direction: "vertical",
order: "-"
})
},
translucent: function(material) {
return true;
}
});
Cesium.DynamicWallMaterialProperty = DynamicWallMaterialProperty;
class WallDiffuseMaterialProperty {
constructor(options2) {
this._definitionChanged = new Cesium.Event();
this._color = void 0;
this.color = options2.color;
}
get isConstant() {
return false;
}
get definitionChanged() {
return this._definitionChanged;
}
getType(time) {
return Cesium.Material.WallDiffuseMaterialType;
}
getValue(time, result) {
if (!Cesium.defined(result)) {
result = {};
}
result.color = Cesium.Property.getValueOrDefault(this._color, time, Cesium.Color.RED, result.color);
return result;
}
equals(other) {
return this === other || other instanceof WallDiffuseMaterialProperty && Cesium.Property.equals(this._color, other._color);
}
}
Object.defineProperties(WallDiffuseMaterialProperty.prototype, {
color: Cesium.createPropertyDescriptor("color")
});
Cesium.WallDiffuseMaterialProperty = WallDiffuseMaterialProperty;
Cesium.Material.WallDiffuseMaterialProperty = "WallDiffuseMaterialProperty";
Cesium.Material.WallDiffuseMaterialType = "WallDiffuseMaterialType";
Cesium.Material.WallDiffuseMaterialSource = `
uniform vec4 color;
czm_material czm_getMaterial(czm_materialInput materialInput){
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
material.diffuse = color.rgb * 2.0;
material.alpha = color.a * (1.0 - fract(st.t)) * 0.8;
return material;
}
`;
Cesium.Material._materialCache.addMaterial(Cesium.Material.WallDiffuseMaterialType, {
fabric: {
type: Cesium.Material.WallDiffuseMaterialType,
uniforms: {
color: new Cesium.Color(1, 0, 0, 1)
},
source: Cesium.Material.WallDiffuseMaterialSource
},
translucent: function(material) {
return true;
}
});
class WallObject {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
}
}
Object.assign(WallObject.prototype, {
drawWallByGeoJson: function(geoJsonUrl, options2) {
return new Promise((resolve2, reject2) => {
let viewer2 = this._viewer;
if (!Cesium.defined(geoJsonUrl)) {
throw new Cesium.DeveloperError("geoJsonUrl is required.");
}
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
options2.minimunHeights = options2.minimunHeights !== void 0 && typeof options2.minimunHeights === "number" ? options2.minimunHeights : 0;
options2.maximumHeights = options2.maximumHeights !== void 0 && typeof options2.maximumHeights === "number" ? options2.maximumHeights : 1e3;
if (options2.color) {
if (options2.color instanceof Array) {
options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
} else if (typeof options2.color === "string") {
options2.color = new Cesium.Color.fromCssColorString(options2.color);
} else {
options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
options2.trailImage = Cesium.defaultValue(options2.trailImage, "jt3dSDK/imgs/wallmaterial/wl.png");
options2.duration = Cesium.defaultValue(options2.duration, 3e3);
options2.count = Cesium.defaultValue(options2.count, 1);
options2.direction = Cesium.defaultValue(options2.direction, "vertical");
options2.order = Cesium.defaultValue(options2.order, "-");
fetch(geoJsonUrl).then((res) => {
return res.json();
}).then((res) => {
for (var i2 = 0; i2 < res.features.length; i2++) {
let coordinates = res.features[i2].geometry.coordinates;
let positions = coordinates.map((point2) => {
return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
});
let wall = new Cesium.CustomDataSource(options2.id);
viewer2.dataSources.add(wall);
let entity = new Cesium.Entity({
name: "\u7ACB\u4F53\u5899\u6548\u679C",
wall: {
positions,
maximumHeights: new Array(positions.length).fill(options2.maximumHeights),
minimunHeights: new Array(positions.length).fill(options2.minimunHeights),
material: new WallMaterialProperty$1(viewer2, {
trailImage: options2.trailImage,
color: options2.color,
duration: options2.duration,
param: {
count: options2.count,
direction: options2.direction,
order: options2.order
}
})
}
});
wall.entities.add(entity);
}
resolve2(options2.id);
});
});
}
});
class CircleMaterialProperty$1 {
constructor(options2) {
this._viewer = options2.viewer;
this._definitionChanged = new Cesium.Event();
this._color = void 0;
this.color = options2.color || Cesium.Color.BLUE;
this.count = options2.count || 1;
this.duration = options2.duration || 1e3;
this._time = new Date().getTime();
this._materialTypeName = "jtCircleMaterial";
this._param = {
color: this.color._value.toCssColorString(),
duration: this.duration,
count: this.count
};
Cesium.Material._materialCache.addMaterial(this._materialTypeName, {
fabric: {
type: this._materialTypeName,
uniforms: {
time: 0,
color: new Cesium.Color(1, 0, 0, 0.5),
count: 1
},
source: this._getCircleMaterial()
},
translucent: function(material) {
return true;
}
});
}
_getCircleMaterial() {
let circleMaterial = "czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = 1.5 * color.rgb;\n vec2 st = materialInput.st;\n vec3 str = materialInput.str;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(time);\n if (abs(str.z) > 0.001)\n {\n //\u7740\u8272\u5668\u6E32\u67D3\u505C\u6B62\uFF0C\u4E0D\u5728\u7ED8\u5236\u5185\u5BB9 \n discard;\n }\n if (dis > 0.5)\n {\n //\u8D85\u51FA\u534A\u5F84\u8303\u56F4\u65F6\uFF0C\u7740\u8272\u5668\u6E32\u67D3\u505C\u6B62 \n discard;\n } else {\n //\u628A\u534A\u5F84\u5206\u6210count\u4EFD\uFF0C\u6BCF\u4E24\u4EFD\u4E4B\u95F4\u7684\u95F4\u9694\u8DDD\u79BB \n float perDis = 0.5 / count;\n float disNum;\n float bl = 0.0;\n //\u5FAA\u73AF\uFF0C\u6700\u591A999\u4E2A\u73AF \n for (int i = 0; i <= 999; i++)\n {\n //\u5224\u65AD\u662F\u5426\u5C5E\u4E8E\u6570\u91CF\u5185\u7684\u73AF \n if (float(i) <= count)\n {\n disNum = perDis * float(i) - dis + per / count;\n if (disNum > 0.0)\n {\n if (disNum < perDis)\n {\n bl = 1.0 - disNum / perDis;\n } else if (disNum - perDis < perDis) {\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = color.a * pow(bl, 3.0);\n }\n }\n }\n }\n return material;\n}\n";
return circleMaterial;
}
}
Object.assign(CircleMaterialProperty$1.prototype, {
getType: function(time) {
return this._materialTypeName;
},
getValue: function(time, result) {
if (!Cesium.defined(result)) {
result = {};
}
result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.BLUE, result.color);
result.count = this.count;
if (this.duration) {
result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
}
this._viewer.scene.requestRender();
return result;
},
equals: function(other) {
return this === other || other instanceof CircleMaterialProperty$1 && Cesium.Property.equals(this._color, other._color);
}
});
Object.defineProperties(CircleMaterialProperty$1.prototype, {
isConstant: {
get: function() {
return false;
}
},
definitionChanged: {
get: function() {
return this._definitionChanged;
}
},
color: Cesium.createPropertyDescriptor("color")
});
class CircleRippleMaterialProperty {
constructor(options2) {
this._definitionChanged = new Cesium.Event();
this._color = void 0;
this._speed = void 0;
this.color = options2.color;
this.speed = options2.speed;
this.count = options2.count;
this.gradient = options2.gradient;
}
get isConstant() {
return false;
}
get definitionChanged() {
return this._definitionChanged;
}
getType(time) {
return Cesium.Material.CircleRippleMaterialType;
}
getValue(time, result) {
if (!Cesium.defined(result)) {
result = {};
}
result.color = Cesium.Property.getValueOrDefault(this._color, time, Cesium.Color.RED, result.color);
result.speed = Cesium.Property.getValueOrDefault(this._speed, time, 10, result.speed);
result.count = this.count;
result.gradient = this.gradient;
return result;
}
equals(other) {
return this === other || other instanceof CircleRippleMaterialProperty && Cesium.Property.equals(this._color, other._color) && Cesium.Property.equals(this._speed, other._speed) && Cesium.Property.equals(this.count, other.count) && Cesium.Property.equals(this.gradient, other.gradient);
}
}
Object.defineProperties(CircleRippleMaterialProperty.prototype, {
color: Cesium.createPropertyDescriptor("color"),
speed: Cesium.createPropertyDescriptor("speed"),
count: Cesium.createPropertyDescriptor("count"),
gradient: Cesium.createPropertyDescriptor("gradient")
});
Cesium.CircleRippleMaterialProperty = CircleRippleMaterialProperty;
Cesium.Material.CircleRippleMaterialProperty = "CircleRippleMaterialProperty";
Cesium.Material.CircleRippleMaterialType = "CircleRippleMaterialType";
Cesium.Material.CircleRippleMaterialSource = `
uniform vec4 color;
uniform float speed;
uniform float count;
uniform float gradient;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
material.diffuse = 1.5 * color.rgb;
vec2 st = materialInput.st;
float dis = distance(st, vec2(0.5, 0.5));
float per = fract(czm_frameNumber * speed / 1000.0);
if(count == 1.0){
if(dis > per * 0.5){
discard;
}else {
material.alpha = color.a * dis / per / 2.0;
}
} else {
vec3 str = materialInput.str;
if(abs(str.z) > 0.001){
discard;
}
if(dis > 0.5){
discard;
} else {
float perDis = 0.5 / count;
float disNum;
float bl = 0.0;
for(int i = 0; i <= 999; i++){
if(float(i) <= count){
disNum = perDis * float(i) - dis + per / count;
if(disNum > 0.0){
if(disNum < perDis){
bl = 1.0 - disNum / perDis;
}
else if(disNum - perDis < perDis){
bl = 1.0 - abs(1.0 - disNum / perDis);
}
material.alpha = pow(bl,(1.0 + 10.0 * (1.0 - gradient)));
}
}
}
}
}
return material;
}
`;
Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleRippleMaterialType, {
fabric: {
type: Cesium.Material.CircleRippleMaterialType,
uniforms: {
color: new Cesium.Color(1, 0, 0, 1),
speed: 3,
count: 4,
gradient: 0.2
},
source: Cesium.Material.CircleRippleMaterialSource
},
translucent: function(material) {
return true;
}
});
class CircleObject {
constructor(viewer2) {
if (!viewer2)
throw new Cesium.DeveloperError("no viewer object!");
this._viewer = viewer2;
}
}
Object.assign(CircleObject.prototype, {
drawCircle: function(centerPoint, radius, options2) {
return new Promise((resolve2, reject2) => {
let viewer2 = this._viewer;
if (!Cesium.defined(centerPoint)) {
throw new Cesium.DeveloperError("centerPoint is required.");
}
if (!Cesium.defined(radius)) {
throw new Cesium.DeveloperError("radius is required.");
}
let position2;
if (centerPoint instanceof Cesium.Cartesian3) {
position2 = centerPoint;
} else {
position2 = Cesium.Cartesian3.fromDegrees(centerPoint[0], centerPoint[1], centerPoint[2] || 0);
}
if (typeof radius === "number" && radius > 0) {
radius = radius;
} else {
radius = 100;
}
options2 = options2 || {};
options2.id = options2.id || setSessionid$1();
options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
options2.CircleType = Cesium.defaultValue(options2.CircleType, "ColorCircle");
options2.duration = Cesium.defaultValue(options2.duration, 3e3);
options2.count = Cesium.defaultValue(options2.count, 1);
if (options2.color) {
if (options2.color instanceof Array) {
options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
} else if (typeof options2.color === "string") {
options2.color = new Cesium.Color.fromCssColorString(options2.color);
} else {
options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
if (options2.outlineColor) {
if (options2.outlineColor instanceof Array) {
options2.outlineColor = new Cesium.Color(options2.outlineColor[0] / 255, options2.outlineColor[1] / 255, options2.outlineColor[2] / 255, options2.outlineColor[3]);
} else if (typeof options2.outlineColor === "string") {
options2.outlineColor = new Cesium.Color.fromCssColorString(options2.outlineColor);
} else {
options2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
}
}
options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 0);
let polygonMaterial = options2.color;
options2.outlineColor;
if (options2.CircleType === "DynamicCircle") {
polygonMaterial = new Cesium.CircleRippleMaterialProperty({
color: options2.color,
speed: options2.duration / 1e3,
count: options2.count,
gradient: 0.2
});
}
let entity = new Cesium.Entity({
id: options2.id,
position: position2,
ellipse: {
semiMinorAxis: radius,
semiMajorAxis: radius,
material: polygonMaterial,
outline: true,
outlineColor: options2.outlineColor,
outlineWidth: options2.outlineWidth
}
});
let flyEntity = viewer2.entities.add(entity);
resolve2(entity, flyEntity);
});
}
});
Cesium.Primitive.prototype.setUseGeometry = function(geometry2) {
this._useGeometry = geometry2;
};
Cesium.Primitive.prototype.getUseGeometry = function() {
return this._useGeometry;
};
class SketchViewModel {
constructor(viewer2, options2) {
this._viewer = viewer2;
this._init(options2);
}
_init(options2) {
this._viewer.scene.globe.depthTestAgainstTerrain = true;
this._viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
this._entities = this._viewer.entities;
this._pointEntitys = [];
this._sketchPointImage = void 0;
this._iconNormal = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcEAYAAAAinQPXAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAB2FJREFUWMO9mHtQlNcZxn/nW65GxHtEqTEajUxVoLYRSIyipHG4qG0lajtxVIRFubgqXuOI28ZE7FAvCLKLSNKxg/FSIzdvqNE62kaRitqpYMxovBGigo4I4n6nfwjsCrsLrtjnn53vnPe87/Oc9/2+854VdBhCd6ZP6dMHlAXO/lOngrzMLz/8EEQ0ASNGANNY2aOHxYIdfHr3LuBCwPnzQIKcf/AgiJ8pQV99BfmvR4+orHxZVsLxpZFT0qd07gyP7zqrej3IInF47lwQkTLV3d1xv3KXWPT4MYhLzMzIgHpn10+Sk+Gw74w+jx79HwSGnzUYhg4FED4FBcBq/jtokOOC2oSb0FZUgHpKVoeHQ9GtGM/y8lcgMLxf5juDBwNDlOWnTgGvUdWz5wsQ7c179fUWzz9y0tX1BdZPILeqCpTtil9QEOT9c876K1faWqS07XeMzJFuboCXkpaX1w5hqxl14QJIKYRWCzLV5OXtDQXbon3c3c2/TeMoYvncucAgPrl40Y7fA0zv1QtMydKwb58FL7toRwbDYo3/0utB3OD8qlX2hIkLqalwO0b9+fLlUHJOG9vQ0P4EjfyFIdPZGfqsURampIBIlxsWLLBtL/NltF4PhUIrVq92QGDIeEOmpye4pYju164Bq6n29LTiopy8tDTIL48pSExsDq/Oj9is/eAD4CRbli1DMEFUBAYCewnUaJD8jr2lpQjpJ7M2bBBi0+L47Tt2mP2G5xhNaWnAHrLj461tKF1rasA0rW5b//6w/0rigQcPWhrZKVFXP8TkybaFyb3kXbkCbiO6fpyU1Dwq58vNG3U6BJvEiYMHEcwQW8aNA3pT7O4OaPmTiwuCnlwcNQrEDRGYmytloilj5vr1Zv+mNXVhSUnmOFYEVnt6gtM9t+8mTbKlwo5AoWdySIjteWUcIwwG2LX7o6lPnkiZULTlj/7+wEThm5oKbCBeCOANUisqkNRxLCEBSSzrYmOB3jw6c8Yi3kL5K51OyvkZGXUTJz7LSH09CIPwMBpt85CHhMf48Q4IJFPofHzsbMAAJfjIEQtXC9TZWi0wkEuKAmjEyspKpNN2pyVBQULZaIjbvXmzUDb6xF0zGJCqv+no6NGAK5fLyiz8JssVcXEWgQLUsZZxWmGbrLTN057Agfh7eNiefhpRb7h922LgOzFp2DDzxnJXrsvLE0rqOW3sTz+12h4lLfRZhuQybuXmWmQkgPzhwy0o1jlV37ljh+e3/L1LF0cEXqX04UPb0075rlovLwtBHuqZ5845T5Z37UqbEAPkzOfsUvlHXZ35saFnQ4++fe04eIfftv64tEfgdvkXeweprFIvBQaaebJH+f3x4xbPvsRPnixlQlHGtDFjWq2Wuqj0yz4+QKk4FxNjMVXD2998Y0FRKEsCAuzwzBKv2eZpR6DspxQcPWpnvrNYoNNBZOTOnRoN0ilJMzYjA3ibsKoqoIxezs6gLJbpxcVSTbyePurwYSkT76VPKSgAWQslJcAmenTrBszgP7W1wBlRmZICY2SydHIC8ZCvdTo7Ak+ri44dcySDNDTs2mVufluhThoGD4bHp6or4uOb3zWJnoqwMGAVLnfuACHscHJCiFRmhISA0BMcFob52PDC/8EDkLfkR5GRQmycN8/t8mXw8O73WVwctnvdJ3SqrQXNSJeY3bttaWhHJxMxzDh97VqQAwheutR2IC6pm/z8oOBm7LcVFVJNKNo0oUsXhBKmGR0VBfI0vkFBINzExxoNEKP+ePYsktefFmVnC2Vjvm5SZSVEpGUNefNNUH8ti8rKQCziaOfOVuL2563PP4eCjJhxK1a8hMCJJ7NTPDxAXWIaefEi0J2r/ftbMfyryDhxAkZ2u1EaHAx6oReq2rb/JiTLZKkoUHLf2//YMWCGnPf++1YM7zHw+nVQ1mlKhg2DvPeiltr+GLaj2W524Kd6zZ4NhGOQ0ophI6GSkr4Gq61VGyjx7vdZQoIdYY1xVZ06RKttS1gTHLkPLjVmGo3AJZToaCsGjSWrPFBKfH3bvta0uyR3ySlGIxS4a7trte1l244MtoRpT93XSUk0l0oruFDbqROYUtQ9X3xhLr2WaBpX4+WnOTl2hHkw9eZN0Li5dLP6Dehogc1dexslK/7MynffhbNDvZXnWq9GNJWyiKC69TlphvobtWbOHNgnZonq6hdl+xL/yTQhbKUxeOtWEP9melSUFYMWJSv/IAtNprZLUu4Rf9u6FQpdo49bfRXaBQcy2BL1p+XURYtAZrLwhx+sGDSWrDpc3ZeVBbJMPt22zY6wRj/1oep08zXMUXRABpsQFmqcHhICYiLlhw4BBWiFA/5FOXmhoc8u0Pv3vyyrDshgEwqLYnKLi4FO5OfkvPh66UdudnZHCXsFAptQ96XMW7jQTsm2xAF23roFlD6NXLy4o9m8AoHFR7SxNTWgjGOsVovtxqBxXAzEbc4cKCycN+/+/Y7n88oRvjarcNYsCDtprP/+ewjvZ1xz9SpERBp3zpz5qqP/D5zQE33tptaiAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA0LTA5VDE2OjQyOjI5KzA4OjAwjRBbGwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wNC0wOVQxNjo0MjoyOSswODowMPxN46cAAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uXzJhcHo1b3VpcnV4L2Rpbmd3ZWkuc3ZncY9vkgAAAABJRU5ErkJggg==";
this._iconBlue = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkEyMUE1MDg3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkEyMUE1MDc3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/grmkAAAhxSURBVHjazFoLUFVFGN49597LBdFUEpEQI0IpyxIfqU1ZkY/pNZg1RZlWY2lW4yMncxq18oHZ0+lhOaWZUo0zPjIr8W1NiubI+AxBIkRQQsQE7us8tv3P7qGL7gXOPRdzZ3bmcnf3+7/v/Lv/+f/lYkIIMpur2yBktQVO5yM7LRybIvsOFKFGCeHyQz/dFO2Ousflcg6UJSlVlqVEjHEMjNMH5tE0vVLT9ZJAQNnn9fm3d+9z3xEYioR9bNcjW9Z8Gtv35l7PUAFjnU5HLytrFUU9TgV9XXD4+PJhoyfV2/GIFO4TGD8my1lVuGXSHYNuPdyhfbv5VkVAgzWwFjAACzAvp0fwoV++uz6lxzXLolzOW1AEmz+gHCwtq3i2z52Pn2jtlgvXI1LpgQ0jeqYm74y0CGiACdjUxkir3KxMlsoKNj6WmNAlV5Kk9qiNGmBTG6vAlhV+rd1aUuGeNSNSeiSuolGo2X1cdDogbThQ79h21CMfP6NKtR4dw/edYiTSK8GhZ/aO0R7KiFV7dnPpzeFQXkppWeWY9MGj8+ifektbqzVC8KbVH6UNHdJvOw2nHUIB7vrDI89df861p0SRsUSjuiSzB4qxyYzx0TVEdBUNTnVqs7I6B4beEKOFwqThuu7X/IJ7hj/yYlGoM9NqIakpSVH7t67c3C4muq8IyKcQ9EpuddSK3xqcSHJR7g7WsSkCm8+YiSEgRuU9gMbd3k5578kufrcTC8U0eLwF/e99anhJ6Sm/HSHSid/Xv5CclJAjAjlXr+GHP6x07z9JZCSDCBfzBJapBomJabJfdKqFCiGa4RkQgrQA6p+MtbVTEn2dY2XhUz956szM6wdkLRFtsVZFrReeeaRTQte46aIxT4DgrA9ABJKRw42QTLsjimqATgUZwpxNO/0OGz3KmMvWuBFgABZgimwBB+ASbtSSp0zIHutyOuNEg9NW/e06UE49YRBi5LFB2NxaMoQg5iGJfza+Y+MwlwlmogALMIXpD+UAXIBTOEKi4rt0zg51sFft8TjN7YQbnzrbVpeeD8Q+w3fYFCQba9ha5kHABGyRTcrlCeBkVQjO/Wxeb3rA00WDb62rcbHzAARML0hBAloK+lyQ4TEHx2B4BragUS69vl06/6aLnk6LQuQ+vdMyRQMHT/ql/D9VGfEQi00PGFDYwqsP8/AsMQyJbTvABhuiFb3TU+8Otb1CCXFd1SF2gGhg/f56Bw4+B9iCJ0J5Bv93fgAbbIimd7yq/UDgZklITLQ7RTSwp9grs7MgBYXYMEQ0OTtBWBR7d5FX+NQ5J0tCHG63K0GYglSpkrklGkXY1GGKMbdo8d+qkBfn5LB0RpwOeDlc2mo9NNYHbyOMIuCRptvNsCGqXxgnS2dEoslhxMrgSDXOSbL0HlFVzSv6vlMMJigorWGpnJ2ymzRdTrENGxY4NSeE+PwBYQ3ds6tDN1IewvvFRMLQwTBMPB2lxTuEaTvnRKwI0S/U1ZeLBganRWtGwteYAOoR8EgQFsUe3DNamNpzTroVIWp1TW2xaCCrf6xKzDScaP89SRKGGBLkCSMjVo1aZRS1IZrOOalWhCgHjxTvEw3ckhylD7rOobF6ghZJphhk1TO80DK8Yab1KgJssCHMKhgnxYqQQM7i5bv9AaVONDh7VFzAqCWMekLhRZIFzzQWWLzIMjAY3qwsii2+YakDTsDNkkdoRVZbXHLyN9EglKdjh8QoUBSBcaIDEYU91cbtRi7yUFCF2OgBha9lBRZg3nWjuPQFLsDJqkfAtfWfr1jzDSHiR/zuk/GBjO5YQyqtQDU/5WYKCjo/Oicd/JmPw1xYA2sBA7AAM8RFBAEuwMnqYTei3Q95vx47U1VzTJj3uDBZNzXRl9EdUTE+SshnECJcFPOWwraNxj0GYo3OyLM1PgQYgAWYIlvAAbgAp3AKK6XyTPXZ56bOm0f3p/BFFEdr7LwZSd5xQ9wKUukUo/u4h8SdecCHzPmwdtOMJF9ciHodbE+cvmA+cAm1rVoSAsD1m3fmH127cfvSUJOiXRh98nS8/8dpXb0DknWNKB5qzsOIKlwYdIULpWMwB+ZunNrVC2tDeQIa2P552+4jfFsROxd0sbRfm5/31dyMPumZLQWkwsqA9EOTCzqCzdTGvKB7MCNWTU9s/oIOWsHh41tvGz5uNv34Fxdi64IOvNaxQ/t2aXvzVixKTUnqezkSRBqhCm4bMW7GhboGuJw7H+qQW7nEBoALFPCvOx8cP+toYUl+W4v4o6h0L9iiNkvBdnNXplYvsSEtOFddc75owLCxc6jLd7aVCMDulzlmDtgCm6FSEju38RAxztJUumTkoy+9faqyqjDSIgDzgezJi6gN+P9Is1HKjpBGz9T+U1cy+ulXZ9XU/lMRKRGABZjUEyeseCJcIY1i6BY4NmHagjlen/+CXREUow6wADMcEeEKQTxxq96wadfvCz9cvpBuBSVcEbCWYuQAFmCGSgrbSojx0qW9KmfxV5u/zP1+MTEqI6vlCNFhLWAAFsdEl1sIvIAgdTn98muL1mzZtXe1VYCtv+xbDWsBg2OR/0OIKaaB9ooHsqcsoXt8h4Uwu+P+xyfD/zwqOIatHw7YFQJvVthSUICVDxs9Kae0rOJwS2vKyk8fgbmwhq/V7fKwLYSLgWLoPLz9s59//c3mwjKMPTZ+5hswl6ceWiQ4REQIF2OE5QOHCo9NfCVndoPHW3vxHPgOxmAOzOVr0BUlhIuB0Hn2+5937p/77hcLgsMyfF7wwbKFMAZz+Fx0RQoJDsvvL8ndYYZlM8y+8/HKbXbDbKgW8ftd+qQJLQcglFZCaE3qFn81wogEh1mYE/F74bb64RnFAm/DDwy6mPdrkJLzKGfLpsj+vwIMACSZzfDJFmOPAAAAAElFTkSuQmCC";
this._iconGreen = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjI1NDIwOUU3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjI1NDIwOUQ3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgEE4igAAAgKSURBVHjazFoJbFRVFP3L/OlMoQXKImAFm0JbFtFKShEQI6UsggmkGKghIKTIIgZUohIDKEuLaFTQiIKyKKghqSyyF0pZbcHQsJVpoRkKbYFAW+iU2f78/313+qY+hvc78+dPkZfcMJ377rn3/Pve/fe9gVUUhfENY5eBjNbhvlnI6Bmh+KT5NzBhGigg9sb5vX3NpohhRqMwgOe4eJ7nurIsGwl69MDskiRXS7Jc7naLpx1OV/4z/V67CKpw+Gf1ZiQv9/vWyc8lTkMEpgiCIVGLrSh6ShGhX4ovlG5Mz5jToCcjXKhPIGvyOOG2JW/OywNfuBAd1WqFVhIwwAZsAQOwAPNxZoQ9f+yPHnHdn94QYRSeZ8I4XG7xnLWianq/oZOuBrvkQs0IZz27a2RCfLeCcJOAAZiAjXyM0hqblslcRfHuiV07d9zKcVwU00IDsJGPLeBLS3zBLi3O8nfuyLjuXbegKtTsOrY4Ldz22u2GPFue4bL7MlfrqWXh+xhDjNLL2EtOj0r3jI8Z70kyJcnN4aC4RGtF9eSklzIOoD/lQEsrGCLs/m3f9nxlUP98VE6j1QDz6/P5xZWLI06KJ3lGwIWdB2tfZEgkJB4oVwwzWBgsLY1d6hoWPUxSw0Tl2na8sHjYiAnvlKntmaD3SHxcrDG1f9/1aiScspOZYZ1hGm4dHnmSRyRglk+i/ITQwVywAVvAoA3kMyolufc6iEHv0uKuntkxu1ts5xyacY2nhh1TNsZcpBTxjBl2K4AQ2eD8MiITWXFDmULiYJhUNlXak7DH0d7QnvrUr1feWtgjZdxa2hILKiOzp01o1/mp9gtoOrtsZ0eXjjYXMYhEa/RFKyxmLCaCmBF/NhF633xkCxiABZg0XxADxBJq1eLnz8ycYhSE9jTl3Iq5EWeYM/wjwUPQvj1CEwHP8SMFWIBJbX9QDBALzrNmIhGdOsZkqm3sTfWbhKbgTcSSMhBLiiYcMc9I2CMswARsmk8Uy5s4r5qIsFt/WN6nVaQ5iaZcVLkoQjEpjbD++4IM+hFUQniCDMYBTMCm+USxJP6+bkVfFWRVIny/Pj3TaIpiezF3SjzFN619AaNwRLABSwzhnSOWGxLABh80sz5J8a+qLS81IsY20a1TaIrc2lzhoX3A+2Ui6FcxkRn+4f3j9UEZbdtEDcCUgycSaTbF0RQnGk7wTY79S2xIbSvGIDCPNxynPnUckyYiBpPJ2JmmKBVLuSYCXIA9EWxWWAIPYZeJZdS4cEwGTXtEMBhMNEWthHonVieB5gix2Aft/NIYk6Y9wqHmMGzH4HANHBOn6T3i8UgO2vcxfIzibTdI0Tv88Lw+NMTUHBHF6XJTz9CJQqLs7ZdkLHoIkbbyf71YgpBAbdtxTIoWInK9reEGTTGk9RCpqfGTCDJ6skE2kxL2QRk4JlkLEc+dmrorNEVGTIbo7VxFgowUQlYU4oxCnFMAe0LMBJFmgmPyaCEinrt45TRNkRyZLA8SBkleMj5CMvGclCBJMIQdJgAC2OCDZoZjErUQcees3njK5RZtNOWy2GUu1sk2nidcOAiPX2aUAHvC/1yCBDDh1Khyw2KDmLBF8Bkpt1bWXSm/fpKmhOPp9OjpIhyKGCcWHxkPpQj4b2oPQcJnj7AAMy06jbo/IBaISWtGwF3Dj5tzf1PIIyQx1nRf40phUiTmQWMQTaTI/ePx2wPEPvAF7xWEAViAqXIRoUAsEJPWze6tdn8dOF5y63ZNCbXv4SKVvYl7HSkKItPQGMwjpFx+4he8V5AtYAAWYNJ8QQwQC0bQfLASq2/duTvjveXL0fqkvog6GDooR3sdtWdFZomsjW18Xj5SdhXBwYOADdgW9CpwAJbK3nDMWpC9AmJRW1aBiABww8GCwkt/7s5fpzbJzJmZ9XHrnYfiDtkHSgMlph59CSXC9y8phA7m5sXl2cFWLRMwwPe+w6cuYvqKngs6uFp4tvDApmUv9ktKC1RZSxwl3I66HYaD9QcNFtHC+RpAaDuShCR5RPQIz7h24zy9zb3lQFjFF0oPpY6Yuhh9vIaJ6Lqgg6y1jY5q1bPowOZV8XGxyY+jQUQVqjh15NSP6m0P4HLuntom13KJDQD1CPDa0NezFl2ylBe2NInLZdYi8IV8WvGCDJi9YC+JoXDW3qm5V5aSPmUJSnlBS5EA7P5pk5eAL/Cp1pLouY2HinEXtdLlo96Y+3ll9W1LuEkA5tjMeauQD/h9pNkqpYdIU2bq7tvKM976cFFN3f2qcJEALMBEmbiqJROhEmkig5ZAycz3s5c4nK56vSQQhg2wADMUEqESYXCTcWfX/qNnVn6zcSVaCmKoJMAWYeQAFmCqNYUtRYTBTcftnNWbDv68dedqVMZlrQBgA7aAAVgYk3ncRBTcNd189+NVuXlHi7ZpBTh07PQ2sAUMjKX8H0R8ZKB7qhqbOX8tWuNHNJTZI2MmzYPfPKowhq5rDL1E4M0q4w7qRnrGnBxrRdWFQDYVN25ehLlgg21lvXHoJoLJwInjHrz9M9/+5LPmyjLoJmYt/BTm4tZDCkcMYSGCyXjL8tnzlpJZH+QsfmB31PnPge9AB3NgLrZhnigimAyUzrs79xX8s+zLn7LJsgyfs7/esBJ0MAfPZZ5IImRZ/mrt1iO+suwrs1989+thvWVWbYT9fhc9aQUdB6CUVkNpje3SqQPDMgpZZmFO2O+FW+o/niEsyDb8qt7Rd78GLTmucrp80vz/K8AAYAEv1AHM/GwAAAAASUVORK5CYII=";
this._iconViolet = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzFDREU3Mjk3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzFDREU3Mjg3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppb+WxIAAAhcSURBVHjazFoLcFTVGb6vvdnNY0lEEJOIxhCSKTEFKSC1osIgjqIyA62mZfAxWJU+tC3TVh2lHSGhtNOKOqK0ii+0QwcfFB+IAsKIITpJhUBDHhMiSSBCTMgm2d377PnungubnXOT3L0b6rlzmM2e83/n+87/n/+ecxbeNE3OLvLFV3Fui3KiivNSkhmTNb7EpagQQvzxg++VBvxpc2XZN1MUhEJRFHJ5nk9HO5mwAV03OnTDaFYUtTocie66pOymOjSlYnzeq0d2bn02c9oVxXcTAct8PqnYja2qakeJoFdqDx3dNH/xij4vHhGSnYHlSxf5Out3rrjmqqmHglkZa9yKQIENbIEBLGCeT4/wB/f+c1LBpXkvpsm+73IpLFFF/bKltf2esjl3NI005JL1iNBSs23B5MKJe1ItAgWYwCZj3OiWm5vOQmvt9ttzJ4zbLAhCFjdKBdhkjNcwlht+Iw0tof6zrQsKLs19jWShIeM40hASure3S727O0WloV/QehTeSo/ZsilPzjCC11+k5yzM0/yTs4yhcAgvtaW1Y2nJ7MU7yJ/GcKE1EiH8B1ueLrr2+9N3kXQadAIM7f1abK84LEcOnBFFXuREMpk8TyrHx4jhMQ1OJ5x0U+f8s8boeY9MUbLmjNedMEm6Du2rqp17w5KfNTitmRGvkcKCfHnW9NK/O4kwIjp37JdfpDUv+jSgVw+IASHAofpRef/gSttQ0Rc2sAUGq5Axs2ZM+85GcPAaWkLT528/MDF/QiXLWPtG4Rt/tM+v1vSLMi9zPl4iniCVeASeEPjB82QQj8Az8IjOaZxqapxiKpzvygy9aMs1EekCmTnrX7WdfHjSjEUbWCE2Io88cPeSnAkXjV3J9ERY5xuX7PNrNQOin0/j0kiVUQUI8llVSnjs79FHpjawBQawgMkaCxzAJdmsJT50X/ky2ecby5yllTWy+p9+MY2PkYonb60RUuER1udBoixBMgcsYDK3P4QDuIBTMkLSxo+7oNxpYfe80eaLhZPMSSSkUAU8vPWvFVr2QrdimD7xfWw7nzUZMgdMYLPGJFx+DE5uhfCbn1s9JSM9UMJqbF9TJ5O5tNZEooh48o4Lk66fwWJIJZjAZtkQLsVvbFxTapm7ECKWTSmax2oYONgjRKp7RSluYbsRwRITS9cxQcDGGCybKSWF1zuFl5MQeUwwcwaroXtbmyTRWLdFkJekKxGDwo3nz4nB+iEVY7D6Z4/JmgluroSkB/wFrIa+z7rE2DyeWwfJiEhcO2fXD3n69p9mzjrl5EqI5PfLE5hv0qZ+gach4TacRhJmwFaaB5i8KCfJ1RrxSZKfuW3oUflE8l49kvg3xmCeX2KcXK0RMut8yo7BqSqUk+DqPaJpepjpqmyfaSbs30wPx24WFsZww2koIWYkqjDP0PKkDAO7WOuheyevBRgGxQS2XJjO3LZTTqYbIUZvqO84qyFz9lidyohtzenjRYT92LiZsy9kbocpJ8ONEO1UV3cjqyHn1nxNw+6V1tgsJicmdkaJCbDxgJ1zW77G6k85aW6EqF/WNVYzc3lZtuGfGdQ1sgXHVtwW4zbM4sPJ3tYDE9gYg2VDOaluhCiV6zftjypqiNWY92iponKKdZ7QaHUjJl6EbQ8sYOY+Uqo43LCEwAncXHmkuaWtu7H5q09ZjTieZv/kEhWHIpXURDHx6ydxLcT3OSdCsQ5YwAxeyz76ggs4ufUIXNv3/MtbXzfjj5BxZeK6aYpvaoYetUhECRnVqhoNNyvkTIP5WbNOh7H+sAUGsIDpcBFhggs4uV3sVrb79459R052dh1hGgZEs+hfP4hIU9P1iEUmapFSDGWQqPjnLHlDoQKiHGyBASxgssYCB3ABp2QOVmrHyVOn7/3V6tUkPpkvImlsmln83nXh4NJcNWKGuYgRIxcTpcQIx1fynd2OvrCBbfG710WA5bA2wvevrFgDLk5hNZwQAPd9uKfq8Jvbd210BPCL3GVPfS9a+PbVYWF6QA8bEBSrYYgzI1a1Ptvfk4q+l791dRi2Tp5Awdjvf7y/joaV6eWCLpPUy6p2vPTElWUl84bLSOH6XqHn3Xapd9fXotLUJ+jdmrUBFHMkU56UaQTnkkRxc54WKAkaw2HVHjr60awb7nycfDxGhXi6oIPXsoNZGUUHdry8rrAgf9r52CCSDFU7a8Gdv+sN9eNyrsdpkbu5xAZALwE8NueW5Y8drm+uGm0R/21oOYCxyJgtGHuoK1O3l9jYFnxzqqunYcb8ZauIy/eMlghgT5+3dBXGwphOWxIvt/HIGKfJVrr5xh/+/E9tHZ31qRYBzIXlD64jY+D3kSGzlBchZz3TfSbUvPiu3z7W1X2mPVUigAVM4okmN55IVshZMSQEjtz364pV4Ui016sIghECFjCTEZGsEI5u3E5t++CTz9c+uWktCQU1WRGwJRiVwAKm06ZwtIRYL11SOyvXv/ThC5vfWW/iaOf2PEJsYAsMYFFM7nwLwQsIW5cTv/j9uq07PzmwxS3AR3urt8AWGBTL/H8IscX04zp4YflDG0iM73aRZnfffMeD+M2jnWJ4Ovx7FYI3K0IKB7Dj8xevqGxpbT80nE3r8RN16Asbamt45eFZCBWDw1AP3v7lP330j0OlZbTdvvzhP6Av3XroqeCQEiFUjJWWaw7WH7n/N5WP9w+EuxP74Du0oQ/6UhvuWyWEikHqPP3O+3u+eOIv/6iIT8v4XPG3F9eiDX1oX+5bKSQ+Lf91w+bddlq20+yfn3n1Y69p1qmk/H6XzLRJjgNIpR1IrfkXj7+Q4zkzPs2iT8rvhUfrP54RLHgbv82Ps+/XsCWnWc7TmKzx/yfAAHo1CtU9myPWAAAAAElFTkSuQmCC";
this._sketchEntityName = "sketchEntity";
this._sketchTempPoints = [];
this._sketchPoints = [];
this._sketchOutputPoints = [];
this._sketchTempPolyline = void 0;
this._sketchPolyline = void 0;
this._sketchTempPolygon = void 0;
this._sketchPolygon = void 0;
this._sketchTempAltituePolyline = void 0;
this._sketchAltitudePolyline = void 0;
this._sketchAltitudeInitHeight = 0;
this._sketchTempSpatialPolyline = void 0;
this._sketchSpatialPolyline = void 0;
this._sketchTempCircle = void 0;
this._sketchCircle = void 0;
this._sketchTempRectangle = void 0;
this._sketchRectangle = void 0;
this._sketchTempTriangleAltitudePolyline = void 0;
this._sketchTriangleAltituePolyline = void 0;
this._sketchTempSpatialTriangle = void 0;
this._sketchSpatialTriangle = void 0;
this._lineLabel = void 0;
this._polygonLabel = void 0;
options2 = options2 || {};
if (options2.isDrawPoint) {
this._isDrawPoint = options2.isDrawPoint;
} else {
this._isDrawPoint = false;
}
if (options2.isRetainDrawPoint) {
this._isRetainDrawPoint = options2.isRetainDrawPoint;
} else {
this._isRetainDrawPoint = false;
}
this._param = {
moveLineWidth: 2,
lineWidth: 2,
moveAltitudeLineWidth: 2,
altitudeLineWidth: 2,
spatialLineWidth: 2,
moveEllipseColor: [0, 255, 0, 0.5],
moveEllipseOutline: true,
moveEllipseOutlineColor: [255, 0, 0, 0.5],
moveEllipseOutlineWidth: 1,
spatialLineWidth: 2,
ellipseColor: [0, 0, 255, 0.5],
ellipseOutline: true,
ellipseOutlineColor: [255, 0, 0, 0.5],
ellipseOutlineWidth: 1
};
this._setMoveLineStyle(void 0);
this._setLineStyle(void 0);
this._setMovePolygonStyle(void 0);
this._setPolygonStyle(void 0);
this._setMoveAltitudeLineStyle(void 0);
this._setAltitudeLineStyle(void 0);
this._setMoveEllipseStyle(void 0);
this._setEllipseStyle(void 0);
this._setSpatialLineStyle(void 0);
if (options2 && options2.iconType) {
switch (options2.iconType) {
case SketchViewModel.SketchIconType.Normal:
this._sketchPointImage = this._iconNormal;
break;
case SketchViewModel.SketchIconType.Blue:
this._sketchPointImage = this._iconBlue;
break;
case SketchViewModel.SketchIconType.Green:
this._sketchPointImage = this._iconGreen;
break;
case SketchViewModel.SketchIconType.Violet:
this._sketchPointImage = this._iconViolet;
break;
default:
this._sketchPointImage = this._iconNormal;
break;
}
} else {
this._sketchPointImage = this._iconNormal;
}
}
_arcToDegree(arc) {
return arc / Math.PI * 180;
}
_toColor(red, green, blue, alpha) {
let normalColor = new Cesium.Color(0, 0, 0, 1);
if (typeof red != "number")
return normalColor;
if (typeof green != "number")
return normalColor;
if (typeof blue != "number")
return normalColor;
if (typeof alpha != "number")
return normalColor;
if (red < 0 || red > 255 || green < 0 || green > 255 || blue < 0 || blue > 255 || alpha < 0 || alpha > 1)
return normalColor;
return new Cesium.Color(red / 255, green / 255, blue / 255, alpha);
}
_toColorFromArray(array) {
if (!array || array.length === void 0 || array.length === 0)
return new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1);
let r2 = 255, g = 255, b = 255, a = 1;
if (array.length === 1) {
r2 = parseInt(array[0]);
} else if (array.length === 2) {
r2 = parseInt(array[0]);
g = parseInt(array[1]);
} else if (array.length === 3) {
r2 = parseInt(array[0]);
g = parseInt(array[1]);
b = parseInt(array[2]);
} else if (array.length >= 4) {
r2 = parseInt(array[0]);
g = parseInt(array[1]);
b = parseInt(array[2]);
a = parseFloat(array[3]);
}
return new Cesium.Color(r2 / 255, g / 255, b / 255, a);
}
_updateScene() {
this._viewer.scene.requestRender();
}
_getScreenClickPosition(screenPosition) {
let resCartesian = void 0;
let ray = this._viewer.scene.camera.getPickRay(screenPosition);
let position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
if (Cesium.defined(position2)) {
resCartesian = {
x: position2.x,
y: position2.y,
z: position2.z
};
}
return resCartesian;
}
_getScreenClickPositionAndHeight(screenPoint) {
var lng = void 0, lat = void 0, height2 = void 0;
var ray = this._viewer.scene.camera.getPickRay(screenPoint);
var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
var feature2 = this._viewer.scene.pick(screenPoint);
if (feature2 == void 0) {
lng = this._arcToDegree(cartographic.longitude);
lat = this._arcToDegree(cartographic.latitude);
height2 = cartographic.height;
} else {
var cartesian = this._viewer.scene.pickPosition(screenPoint);
if (Cesium.defined(cartesian)) {
var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
lng = this._arcToDegree(cartographic.longitude);
lat = this._arcToDegree(cartographic.latitude);
height2 = cartographic.height;
}
}
return {
lng,
lat,
height: height2
};
}
_transfromFromScreenPoint(screenPosition) {
let location = this._getScreenClickPositionAndHeight(screenPosition);
var cartesian = Cesium.Cartesian3.fromDegrees(location.lng, location.lat, location.height);
return {
gLocation: location,
sLocation: cartesian
};
}
_removeEntityByName(entityName) {
var entities2 = this._entities;
if (!entities2 || !entities2.values)
return;
var delEntitys = [];
for (var i2 = 0; i2 < entities2.values.length; i2++) {
if (entities2.values[i2].name == entityName) {
delEntitys.push(entities2.values[i2]);
}
}
for (var i2 = 0; i2 < delEntitys.length; i2++) {
entities2.remove(delEntitys[i2]);
}
this._updateScene();
}
_removeEntityByObject(objEntity) {
if (!Cesium.defined(objEntity))
return;
this._entities.remove(objEntity);
}
_createPoint(coord, label) {
let _self = this;
let entity = new Cesium.Entity({
name: _self._sketchEntityName + "_Point",
position: coord,
billboard: {
image: _self._sketchPointImage,
horizontalOrigin: Cesium.HorizontalOrigin.center,
verticalOrigin: Cesium.VerticalOrigin.bottom,
scale: 0.5,
pixelOffset: new Cesium.Cartesian2(0, -11),
disableDepthTestDistance: Number.POSITIVE_INFINITY
}
});
if (label) {
entity.label = {
text: label,
font: "12px sans-serif",
fillColor: this._toColor(255, 255, 255, 1),
outlineColor: this._toColor(0, 154, 94, 1),
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
outlineWidth: 1,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
pixelOffset: new Cesium.Cartesian2(0, -28),
showBackground: true,
backgroundColor: this._toColor(0, 0, 0, 0.6),
disableDepthTestDistance: Number.POSITIVE_INFINITY
};
}
this._entities.add(entity);
this._pointEntitys.push(entity);
this._updateScene();
}
_removePointEntitys() {
this._removeEntityByName(this._sketchEntityName + "_Point");
this._pointEntitys = [];
}
_createTempPolyline() {
let _self = this;
if (!Cesium.defined(this._sketchTempPolyline)) {
this._sketchTempPolyline = new Cesium.Entity({
name: _self._sketchEntityName,
polyline: {
show: true,
positions: new Cesium.CallbackProperty(function() {
return _self._sketchTempPoints;
}, false),
material: _self._tempLineMaterial,
width: _self._param.moveLineWidth,
clampToGround: true
}
});
this._entities.add(this._sketchTempPolyline);
this._updateScene();
}
}
_createPolyline() {
let _self = this;
if (!Cesium.defined(this._sketchPolyline)) {
this._sketchPolyline = new Cesium.Entity({
name: _self._sketchEntityName,
polyline: {
show: true,
positions: _self._sketchPoints,
material: _self._lineMaterial,
width: _self._param.lineWidth,
clampToGround: true
}
});
this._entities.add(this._sketchPolyline);
this._updateScene();
}
}
_createTempSpatialPolyline() {
let _self = this;
if (!Cesium.defined(this._sketchTempSpatialPolyline)) {
this._sketchTempSpatialPolyline = new Cesium.Entity({
name: _self._sketchEntityName,
polyline: {
show: true,
positions: new Cesium.CallbackProperty(function() {
return _self._sketchTempPoints;
}, false),
material: _self._tempLineMaterial,
width: _self._param.moveLineWidth,
clampToGround: false
}
});
this._entities.add(this._sketchTempSpatialPolyline);
this._updateScene();
}
}
_createSpatialPolyline() {
let _self = this;
if (!Cesium.defined(this._sketchSpatialPolyline)) {
this._sketchSpatialPolyline = new Cesium.Entity({
name: _self._sketchEntityName,
polyline: {
show: true,
positions: _self._sketchPoints,
material: _self._spatialLineMaterial,
width: _self._param.spatialLineWidth,
clampToGround: false
}
});
this._entities.add(this._sketchSpatialPolyline);
this._updateScene();
}
}
_createTempPolygon() {
let _self = this;
if (!Cesium.defined(this._sketchTempPolygon)) {
this._sketchTempPolygon = new Cesium.Entity({
name: _self._sketchEntityName,
polygon: {
show: true,
hierarchy: new Cesium.CallbackProperty(function() {
return {
positions: _self._sketchTempPoints
};
}, false),
material: _self._tempPolygonMaterial,
classificationType: Cesium.ClassificationType.BOTH
}
});
this._entities.add(this._sketchTempPolygon);
this._updateScene();
}
}
_createPolygon() {
let _self = this;
if (!Cesium.defined(this._sketchPolygon)) {
this._sketchPoints.push(this._sketchPoints[0]);
this._sketchPolygon = new Cesium.Entity({
name: _self._sketchEntityName,
polygon: {
show: true,
hierarchy: {
positions: _self._sketchPoints
},
material: _self._polygonMaterial,
classificationType: Cesium.ClassificationType.BOTH
},
polyline: {
show: true,
positions: _self._sketchPoints,
material: _self._lineMaterial,
width: _self._param.lineWidth,
clampToGround: true
}
});
this._entities.add(this._sketchPolygon);
this._updateScene();
}
}
_createPolygonBody(options2) {
let _self = this;
let appendHeight = parseFloat(100);
if (options2 && options2.height && typeof options2.height === "number")
appendHeight = parseFloat(options2.height);
let wallColor = [255, 255, 0, 1];
let polygonColor = [0, 0, 255, 0.65];
if (options2 && options2.color && this._checkColorAndAlpha(options2.color))
polygonColor = this._checkColorAndAlpha(options2.color);
if (!Cesium.defined(this._sketchPolygon)) {
let shaderSource = "czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec3 str = materialInput.str;\n material.diffuse = color.rgb;\n material.alpha = color.a;\n return material;\n}";
let wallMaterial = new Cesium.Material({
fabric: {
type: "wallMaterial",
uniforms: {
color: _self._toColorFromArray(wallColor),
speed: 100
},
source: shaderSource
}
});
new Cesium.MaterialAppearance({
material: wallMaterial
});
let polygonAppearance = new Cesium.MaterialAppearance({
material: new Cesium.Material({
fabric: {
type: "Color",
uniforms: {
color: _self._toColorFromArray(polygonColor)
}
}
})
});
let wallMinimumHeights = [];
let wallMaximumHeights = [];
for (let i2 = 0; i2 < _self._sketchOutputPoints.length; i2++) {
let height3 = parseFloat(_self._sketchOutputPoints[i2].height);
wallMinimumHeights.push(height3);
wallMaximumHeights.push(height3 + appendHeight);
}
let height2 = parseFloat(_self._sketchOutputPoints[0].height);
wallMinimumHeights.push(height2);
wallMaximumHeights.push(height2 + appendHeight);
let tempPoints = [];
for (let i2 = 0; i2 < _self._sketchPoints.length; i2++) {
tempPoints.push(_self._sketchPoints[i2]);
}
tempPoints.push(_self._sketchPoints[0]);
new Cesium.WallGeometry({
positions: tempPoints,
maximumHeights: wallMaximumHeights,
minimumHeights: wallMinimumHeights
});
let polygonGeometry = new Cesium.PolygonGeometry({
polygonHierarchy: new Cesium.PolygonHierarchy(tempPoints),
perPositionHeight: true,
extrudedHeight: Math.max.apply(null, wallMaximumHeights)
});
let polygonPrimitive = new Cesium.Primitive({
geometryInstances: new Cesium.GeometryInstance({
geometry: polygonGeometry
}),
appearance: polygonAppearance,
releaseGeometryInstances: false
});
polygonPrimitive.setUseGeometry({
cPoints: _self._sketchPoints,
gPoints: _self._sketchOutputPoints,
height: appendHeight,
color: polygonColor
});
this._viewer.scene.primitives.add(polygonPrimitive);
}
}
_callUpdaeEllipseCenterPosition() {
let _self = this;
return function() {
let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
_self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
return _self._sketchEllipseCenterPosition;
};
}
_callUpdateAltitudePolylinePositions() {
let _self = this;
return function() {
_self._sketchAltitudePolylinePostions = [];
_self._sketchAltitudePolylinePostions.push(_self._sketchTempPoints[0]);
let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
let point_temp = Cesium.Cartesian3.fromDegrees(
Cesium.Math.toDegrees(
point1cartographic.longitude
),
Cesium.Math.toDegrees(point1cartographic.latitude),
point2cartographic.height
);
_self._sketchAltitudePolylinePostions.push(point_temp);
return _self._sketchAltitudePolylinePostions;
};
}
_callUpdateEllipseMinorAxis() {
let _self = this;
return function() {
let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
let geodesic = new Cesium.EllipsoidGeodesic();
geodesic.setEndPoints(point1cartographic, point2cartographic);
_self._sketchEllipseRadius = geodesic.surfaceDistance;
if (_self._sketchEllipseRadius <= 0)
_self._sketchEllipseRadius = 1;
return _self._sketchEllipseRadius;
};
}
_callUpdateEllipseHeight() {
let _self = this;
return function() {
let cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
let cartographic1 = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
let height_temp = cartographic1.height - cartographic.height;
_self._sketchEllipseHeight = height_temp + _self._sketchAltitudeInitHeight;
return _self._sketchEllipseHeight;
};
}
_createTempAltitudePolyline() {
let _self = this;
if (!Cesium.defined(this._sketchTempAltituePolyline)) {
this._sketchTempAltituePolyline = new Cesium.Entity({
name: _self._sketchEntityName,
position: new Cesium.CallbackProperty(
_self._callUpdaeEllipseCenterPosition(),
false
),
polyline: {
show: true,
positions: new Cesium.CallbackProperty(
_self._callUpdateAltitudePolylinePositions(),
false
),
material: _self._tempAlititudeLineMaterial,
width: _self._param.moveAltitudeLineWidth,
clampToGround: false
},
ellipse: {
show: true,
semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
height: new Cesium.CallbackProperty(_self._callUpdateEllipseHeight(), false),
material: _self._toColorFromArray(_self._param.moveEllipseColor),
outline: _self._param.moveEllipseOutline,
outlineWidth: _self._param.moveEllipseOutlineWidth,
outlineColor: _self._toColorFromArray(_self._param.moveEllipseOutlineColor)
}
});
_self._entities.add(_self._sketchTempAltituePolyline);
}
}
_createAltitudePolyline() {
let _self = this;
if (!Cesium.defined(this._sketchAltitudePolyline)) {
this._sketchAltitudePolyline = new Cesium.Entity({
name: _self._sketchEntityName,
position: _self._sketchEllipseCenterPosition,
polyline: {
show: true,
positions: _self._sketchAltitudePolylinePostions,
material: _self._altitudeLineMaterial,
width: _self._param.altitudeLineWidth,
clampToGround: false
},
ellipse: {
show: true,
semiMinorAxis: _self._sketchEllipseRadius,
semiMajorAxis: _self._sketchEllipseRadius,
height: _self._sketchEllipseHeight,
material: _self._toColorFromArray(_self._param.ellipseColor),
outline: _self._param.ellipseOutline,
outlineWidth: _self._param.ellipseOutlineWidth,
outlineColor: _self._toColorFromArray(_self._param.ellipseOutlineColor)
}
});
_self._entities.add(_self._sketchAltitudePolyline);
}
}
_callEllipseOutlineCoordinate() {
let _self = this;
return function() {
let positionCenter = _self._sketchEllipseCenterPosition;
let positionRotate = _self._sketchTempPoints[1];
_self._ellipseOutlineCoordinates = [];
for (let angle = 5; angle < 360; ) {
let newPosition = _self._rotatedPointByAngle(positionRotate, positionCenter, angle);
_self._ellipseOutlineCoordinates.push(newPosition);
angle = angle + 5;
}
_self._ellipseOutlineCoordinates.push(_self._ellipseOutlineCoordinates[0]);
return _self._ellipseOutlineCoordinates;
};
}
_createTempCircle(centerPosition) {
let _self = this;
if (!Cesium.defined(this._sketchTempCircle)) {
_self._sketchEllipseCenterPosition = centerPosition.clone();
this._sketchTempCircle = new Cesium.Entity({
name: _self._sketchEntityName,
position: centerPosition,
polyline: {
show: true,
positions: new Cesium.CallbackProperty(_self._callEllipseOutlineCoordinate(), false),
material: _self._tempLineMaterial,
width: _self._param.moveLineWidth,
clampToGround: true
},
ellipse: {
show: true,
semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
material: _self._tempPolygonMaterial,
classificationType: Cesium.ClassificationType.BOTH
}
});
_self._entities.add(_self._sketchTempCircle);
}
}
_rotatedPointByAngle(position_A, position_B, angle) {
var localToWorld_Matrix = Cesium.Transforms.eastNorthUpToFixedFrame(position_B);
var worldToLocal_Matrix = Cesium.Matrix4.inverse(localToWorld_Matrix, new Cesium.Matrix4());
Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_B, new Cesium.Cartesian3());
var localPosition_A = Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_A, new Cesium.Cartesian3());
var new_x = localPosition_A.x * Math.cos(Cesium.Math.toRadians(angle)) + localPosition_A.y * Math.sin(Cesium.Math.toRadians(angle));
var new_y = localPosition_A.y * Math.cos(Cesium.Math.toRadians(angle)) - localPosition_A.x * Math.sin(Cesium.Math.toRadians(angle));
var new_z = localPosition_A.z;
return Cesium.Matrix4.multiplyByPoint(
localToWorld_Matrix,
new Cesium.Cartesian3(new_x, new_y, new_z),
new Cesium.Cartesian3()
);
}
_createCircle() {
let _self = this;
if (!Cesium.defined(this._sketchCircle)) {
this._sketchCircle = new Cesium.Entity({
name: _self._sketchEntityName,
position: _self._sketchEllipseCenterPosition,
polyline: {
show: true,
positions: _self._ellipseOutlineCoordinates,
material: _self._lineMaterial,
width: _self._param.lineWidth,
clampToGround: true
},
ellipse: {
show: true,
semiMinorAxis: _self._sketchEllipseRadius,
semiMajorAxis: _self._sketchEllipseRadius,
material: _self._polygonMaterial,
classificationType: Cesium.ClassificationType.BOTH
}
});
_self._entities.add(_self._sketchCircle);
}
}
_callUpdateRectangleCoordinates() {
let _self = this;
return function() {
let lng0 = parseFloat(_self._sketchTempPoints[0].lng);
let lat0 = parseFloat(_self._sketchTempPoints[0].lat);
let lng1 = parseFloat(_self._sketchTempPoints[1].lng);
let lat1 = parseFloat(_self._sketchTempPoints[1].lat);
_self._rectangleCoordinates = [0, 0, 1, 1];
if (lng0 < lng1) {
_self._rectangleCoordinates[0] = lng0;
_self._rectangleCoordinates[2] = lng1;
} else {
_self._rectangleCoordinates[0] = lng1;
_self._rectangleCoordinates[2] = lng0;
}
if (lat0 < lat1) {
_self._rectangleCoordinates[1] = lat0;
_self._rectangleCoordinates[3] = lat1;
} else {
_self._rectangleCoordinates[1] = lat1;
_self._rectangleCoordinates[3] = lat0;
}
let rectangle = Cesium.Rectangle.fromDegrees(
_self._rectangleCoordinates[0],
_self._rectangleCoordinates[1],
_self._rectangleCoordinates[2],
_self._rectangleCoordinates[3]
);
let res = _self._calculateRectangleOutlineCoordinates(rectangle);
_self._rectangleOutlineCoordinates = res.cPoints;
_self._sketchOutputPoints = res.gPoints;
return rectangle;
};
}
_calculateRectangleOutlineCoordinates(rectangle) {
let south_east = Cesium.Rectangle.southeast(rectangle);
let se2 = Cesium.Cartographic.toCartesian(south_east);
let south_west = Cesium.Rectangle.southwest(rectangle);
let sw = Cesium.Cartographic.toCartesian(south_west);
let north_east = Cesium.Rectangle.northeast(rectangle);
let ne2 = Cesium.Cartographic.toCartesian(north_east);
let north_west = Cesium.Rectangle.northwest(rectangle);
let nw = Cesium.Cartographic.toCartesian(north_west);
let gPoints = [];
gPoints.push({
lng: Cesium.Math.toDegrees(south_west.longitude),
lat: Cesium.Math.toDegrees(south_west.latitude),
height: south_west.height
});
gPoints.push({
lng: Cesium.Math.toDegrees(south_east.longitude),
lat: Cesium.Math.toDegrees(south_east.latitude),
height: south_east.height
});
gPoints.push({
lng: Cesium.Math.toDegrees(north_east.longitude),
lat: Cesium.Math.toDegrees(north_east.latitude),
height: north_east.height
});
gPoints.push({
lng: Cesium.Math.toDegrees(north_west.longitude),
lat: Cesium.Math.toDegrees(north_west.latitude),
height: north_west.height
});
gPoints.push({
lng: Cesium.Math.toDegrees(south_west.longitude),
lat: Cesium.Math.toDegrees(south_west.latitude),
height: south_west.height
});
return {
cPoints: [sw, se2, ne2, nw, sw],
gPoints
};
}
_callUpdateRectangleOutlineCoordinates() {
let _self = this;
return function() {
return _self._rectangleOutlineCoordinates;
};
}
_createTempRectangle() {
let _self = this;
if (!Cesium.defined(this._sketchTempRectangle)) {
this._sketchTempRectangle = new Cesium.Entity({
name: _self._sketchEntityName,
polyline: {
show: true,
positions: new Cesium.CallbackProperty(_self._callUpdateRectangleOutlineCoordinates(), false),
material: _self._tempLineMaterial,
width: _self._param.moveLineWidth,
clampToGround: true
},
rectangle: {
show: true,
coordinates: new Cesium.CallbackProperty(_self._callUpdateRectangleCoordinates(), false),
material: _self._tempPolygonMaterial,
classificationType: Cesium.ClassificationType.BOTH
}
});
_self._entities.add(_self._sketchTempRectangle);
}
}
_createRectangle() {
let _self = this;
if (!Cesium.defined(this._sketchRectangle)) {
this._sketchRectangle = new Cesium.Entity({
name: _self._sketchEntityName,
polyline: {
show: true,
positions: _self._rectangleOutlineCoordinates,
material: _self._lineMaterial,
width: _self._param.lineWidth,
clampToGround: true
},
rectangle: {
show: true,
coordinates: Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]),
material: _self._polygonMaterial,
classificationType: Cesium.ClassificationType.BOTH
}
});
_self._entities.add(_self._sketchRectangle);
}
}
_callUpdaeTriangleEllipseCenterPosition() {
let _self = this;
return function() {
let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
_self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
return _self._sketchEllipseCenterPosition;
};
}
_callUpdateTriangleAltitudePolylinePositions() {
let _self = this;
return function() {
_self._sketchAltitudePolylinePostions = [];
_self._sketchAltitudePolylinePostions.push(_self._sketchTempPoints[1]);
let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
let point_temp = Cesium.Cartesian3.fromDegrees(
Cesium.Math.toDegrees(
point1cartographic.longitude
),
Cesium.Math.toDegrees(point1cartographic.latitude),
point2cartographic.height
);
_self._sketchAltitudePolylinePostions.push(point_temp);
return _self._sketchAltitudePolylinePostions;
};
}
_callUpdateTriangleEllipseMinorAxis() {
let _self = this;
return function() {
let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
let geodesic = new Cesium.EllipsoidGeodesic();
geodesic.setEndPoints(point1cartographic, point2cartographic);
_self._sketchEllipseRadius = geodesic.surfaceDistance;
if (_self._sketchEllipseRadius <= 0)
_self._sketchEllipseRadius = 1;
return _self._sketchEllipseRadius;
};
}
_callUpdateTriangleEllipseHeight() {
let _self = this;
return function() {
let cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
let cartographic1 = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
let height_temp = cartographic1.height - cartographic.height;
_self._sketchEllipseHeight = height_temp + _self._sketchAltitudeInitHeight;
return _self._sketchEllipseHeight;
};
}
_callUpdateTriangleSpatialPolylinePositions() {
let _self = this;
return function() {
_self._sketchTriangleSpatialPolylinePositions = [];
_self._sketchTriangleSpatialPolylinePositions.push(_self._sketchTempPoints[0]);
_self._sketchTriangleSpatialPolylinePositions.push(_self._sketchEllipseCenterPosition);
return _self._sketchTriangleSpatialPolylinePositions;
};
}
_createTriangleSpatialPolyline() {
let _self = this;
this._sketchSpatialPolyline = new Cesium.Entity({
name: _self._sketchEntityName,
polyline: {
show: true,
positions: _self._sketchTriangleSpatialPolylinePositions,
material: _self._spatialLineMaterial,
width: _self._param.spatialLineWidth,
clampToGround: false
}
});
this._entities.add(this._sketchSpatialPolyline);
}
_createTempTriangleAltitudePolylineAndSpatialPolyline() {
let _self = this;
if (!Cesium.defined(this._sketchTempTriangleAltitudePolyline) && !Cesium.defined(this._sketchTempSpatialPolyline)) {
this._sketchTempTriangleAltitudePolyline = new Cesium.Entity({
name: _self._sketchEntityName,
position: new Cesium.CallbackProperty(
_self._callUpdaeTriangleEllipseCenterPosition(),
false
),
polyline: {
show: true,
positions: new Cesium.CallbackProperty(
_self._callUpdateTriangleAltitudePolylinePositions(),
false
),
material: _self._tempAlititudeLineMaterial,
width: _self._param.moveAltitudeLineWidth,
clampToGround: false
},
ellipse: {
show: true,
semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateTriangleEllipseMinorAxis(), false),
semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateTriangleEllipseMinorAxis(), false),
height: new Cesium.CallbackProperty(_self._callUpdateTriangleEllipseHeight(), false),
material: _self._toColorFromArray(_self._param.moveEllipseColor),
outline: _self._param.moveEllipseOutline,
outlineWidth: _self._param.moveEllipseOutlineWidth,
outlineColor: _self._toColorFromArray(_self._param.moveEllipseOutlineColor)
}
});
_self._entities.add(_self._sketchTempTriangleAltitudePolyline);
_self._sketchTempSpatialPolyline = new Cesium.Entity({
name: _self._sketchEntityName,
polyline: {
show: true,
positions: new Cesium.CallbackProperty(_self._callUpdateTriangleSpatialPolylinePositions(), false),
material: _self._tempLineMaterial,
width: _self._param.moveLineWidth,
clampToGround: false
}
});
_self._entities.add(_self._sketchTempSpatialPolyline);
}
}
_createTempSpatialTriangle() {
let _self = this;
if (!Cesium.defined(this._sketchTempSpatialTriangle)) {
this._sketchTempSpatialTriangle = new Cesium.Entity({
name: _self._sketchEntityName,
polyline: {
show: true,
positions: new Cesium.CallbackProperty(function() {
_self._sketchSpatialTrianglePositions = [];
_self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
_self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[1].clone());
let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
let point_temp = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
_self._sketchSpatialTrianglePositions.push(point_temp);
_self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
return _self._sketchSpatialTrianglePositions;
}, false),
material: _self._tempLineMaterial,
width: _self._param.moveLineWidth,
clampToGround: false
}
});
this._entities.add(this._sketchTempSpatialTriangle);
this._updateScene();
}
}
_createSpatialTriangle() {
let _self = this;
if (!Cesium.defined(this._sketchSpatialTriangle)) {
this._sketchSpatialTriangle = new Cesium.Entity({
name: _self._sketchEntityName,
polyline: {
show: true,
positions: _self._sketchSpatialTrianglePositions,
material: _self._lineMaterial,
width: _self._param.lineWidth,
clampToGround: false
}
});
this._entities.add(this._sketchSpatialTriangle);
this._updateScene();
}
}
_setMoveLineStyle(options2) {
let _self = this;
let color2 = [255, 255, 255, 1];
let lineWidth = 3;
let isOutline = false;
let power = 0.2;
let outlineColor = [255, 0, 0, 1];
let outlineWidth = 1;
if (options2 && options2.color && options2.color.length === 4)
color2 = options2.color;
if (options2 && options2.outline && typeof options2.outline === "boolean")
isOutline = options2.outline;
if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
outlineColor = options2.outlineColor;
if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
outlineWidth = options2.outlineWidth;
if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
lineWidth = options2.lineWidth;
if (options2 && options2.power)
power = options2.power;
if (isOutline) {
this._tempLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
color: _self._toColorFromArray(color2),
outlineColor: _self._toColorFromArray(outlineColor),
outlineWidth
});
} else {
if (power === void 0) {
this._tempLineMaterial = new Cesium.PolylineDashMaterialProperty({
color: _self._toColorFromArray(color2)
});
} else {
this._tempLineMaterial = new Cesium.PolylineGlowMaterialProperty({
color: _self._toColorFromArray(color2),
glowPower: power
});
}
}
this._param.moveLineWidth = lineWidth;
}
_setLineStyle(options2) {
let _self = this;
let color2 = [255, 255, 255, 1];
let lineWidth = 2;
let outlineColor = [0, 255, 0, 0.6];
let outlineWidth = 1;
if (options2 && options2.color && options2.color.length === 4)
color2 = options2.color;
if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
outlineColor = options2.outlineColor;
if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
outlineWidth = options2.outlineWidth;
if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
lineWidth = options2.lineWidth;
this._lineMaterial = new Cesium.PolylineOutlineMaterialProperty({
color: _self._toColorFromArray(color2),
outlineColor: _self._toColorFromArray(outlineColor),
outlineWidth
});
this._param.lineWidth = lineWidth;
}
_setSpatialLineStyle(options2) {
let _self = this;
let color2 = [255, 255, 0, 1];
let lineWidth = 2;
let outlineColor = [255, 255, 255, 1];
let outlineWidth = 1;
if (options2 && options2.color && options2.color.length === 4)
color2 = options2.color;
if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
outlineColor = options2.outlineColor;
if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
outlineWidth = options2.outlineWidth;
if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
lineWidth = options2.lineWidth;
this._spatialLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
color: _self._toColorFromArray(color2),
outlineColor: _self._toColorFromArray(outlineColor),
outlineWidth
});
this._param.spatialLineWidth = lineWidth;
}
_setMovePolygonStyle(options2) {
let polygonColor = [255, 0, 0, 0.3];
if (options2 && options2.color && options2.color.length === 4)
polygonColor = options2.color;
this._tempPolygonMaterial = new Cesium.ColorMaterialProperty(this._toColorFromArray(polygonColor));
}
_setPolygonStyle(options2) {
let polygonColor = [0, 0, 255, 0.3];
if (options2 && options2.color && options2.color.length === 4)
polygonColor = options2.color;
this._polygonMaterial = new Cesium.ColorMaterialProperty(this._toColorFromArray(polygonColor));
}
_setMoveAltitudeLineStyle(options2) {
let _self = this;
let color2 = [255, 255, 255, 1];
let lineWidth = 2;
let isOutline = true;
let outlineColor = [255, 255, 0, 1];
let outlineWidth = 1;
if (options2 && options2.color && options2.color.length === 4)
color2 = options2.color;
if (options2 && options2.outline && typeof options2.outline === "boolean")
isOutline = options2.outline;
if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
outlineColor = options2.outlineColor;
if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
outlineWidth = options2.outlineWidth;
if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
lineWidth = options2.lineWidth;
if (isOutline) {
this._tempAlititudeLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
color: _self._toColorFromArray(color2),
outlineColor: _self._toColorFromArray(outlineColor),
outlineWidth
});
} else {
this._tempAlititudeLineMaterial = new Cesium.PolylineDashMaterialProperty({
color: _self._toColorFromArray(color2)
});
}
this._param.moveAltitudeLineWidth = lineWidth;
}
_setAltitudeLineStyle(options2) {
let _self = this;
let color2 = [255, 255, 255, 1];
let lineWidth = 2;
let outlineColor = [0, 0, 255, 1];
let outlineWidth = 1;
if (options2 && options2.color && options2.color.length === 4)
color2 = options2.color;
if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
outlineColor = options2.outlineColor;
if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
outlineWidth = options2.outlineWidth;
if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
lineWidth = options2.lineWidth;
this._altitudeLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
color: _self._toColorFromArray(color2),
outlineColor: _self._toColorFromArray(outlineColor),
outlineWidth
});
this._param.altitudeLineWidth = lineWidth;
}
_setMoveEllipseStyle(options2) {
if (options2 && options2.color && options2.color.length === 4)
this._param.moveEllipseColor = options2.color;
if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
this._param.moveEllipseOutlineWidth = options2.outlineWidth;
if (options2 && options2.outline && typeof options2.outline === "boolean")
this._param.moveEllipseOutline = options2.outline;
if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
this._param.moveEllipseOutlineColor = options2.outlineColor;
}
_setEllipseStyle(options2) {
if (options2 && options2.color && options2.color.length === 4)
this._param.ellipseColor = options2.color;
if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
this._param.ellipseOutlineWidth = options2.outlineWidth;
if (options2 && options2.outline && typeof options2.outline === "boolean")
this._param.ellipseOutline = options2.outline;
if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
this._param.ellipseOutlineColor = options2.outlineColor;
}
_clear(isAll) {
if (isAll != void 0 && isAll === true) {
this._removeEntityByName(this._sketchEntityName);
this._removePointEntitys();
}
this._sketchTempPoints = [];
this._sketchPoints = [];
this._sketchOutputPoints = [];
this._sketchTempPolyline = void 0;
this._sketchPolyline = void 0;
this._sketchTempPolygon = void 0;
this._sketchPolygon = void 0;
this._sketchTempAltituePolyline = void 0;
this._sketchAltitudePolyline = void 0;
this._sketchTempSpatialPolyline = void 0;
this._sketchSpatialPolyline = void 0;
this._sketchTempCircle = void 0;
this._sketchCircle = void 0;
this._sketchTempRectangle = void 0;
this._sketchRectangle = void 0;
this._sketchTempTriangleAltitudePolyline = void 0;
this._sketchTriangleAltituePolyline = void 0;
this._sketchTempSpatialTriangle = void 0;
this._sketchSpatialTriangle = void 0;
}
_checkAppOrWeb() {
if (window.navigator.userAgent.match(
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
)) {
return SketchViewModel.RuntimeEnvironment.App;
} else {
return SketchViewModel.RuntimeEnvironment.Web;
}
}
_isRuntimeApp() {
if (this._checkAppOrWeb() === SketchViewModel.RuntimeEnvironment.App) {
return true;
}
return false;
}
}
Object.assign(SketchViewModel.prototype, {
setMoveLineStyle: function(options2) {
this._setMoveLineStyle(options2);
},
setLineStyle: function(options2) {
this._setLineStyle(options2);
},
setSpatialLineStyle: function() {
this._setSpatialLineStyle(options);
},
setMovePolygonStyle: function(options2) {
this._setMovePolygonStyle(options2);
},
setPolygonStyle: function(options2) {
this._setPolygonStyle(options2);
},
setMoveAltitudeLineStyle: function(options2) {
this._setMoveAltitudeLineStyle(options2);
},
setAltitudeLineStyle: function(options2) {
this._setAltitudeLineStyle(options2);
},
setMoveEllipseStyle: function(options2) {
this._setMoveEllipseStyle(options2);
},
setEllipseStyle: function(options2) {
this._setEllipseStyle(options2);
},
setLabel: function(options2) {
if (!options2) {
options2 = {
lineLabel: void 0,
polygonLabel: void 0
};
}
if (options2.lineLabel)
this._lineLabel = options2.lineLabel;
if (options2.polygonLabel)
this._lineLabel = options2.polygonLabel;
}
});
Object.assign(SketchViewModel.prototype, {
_registerLeftClickEvent: function(handler, callChange) {
let _self = this;
if (!handler)
return;
handler.setInputAction(function(event2) {
_self._lock = true;
if (_self._timer != null)
clearTimeout(_self._timer);
_self._timer = setTimeout(function() {
if (callChange)
callChange(event2);
_self._lock = false;
}, 200);
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
},
_registerLeftDoubleClickEvent: function(handler, callChange) {
let _self = this;
if (!handler)
return;
handler.setInputAction(function(event2) {
if (_self._timer != null)
clearTimeout(_self._timer);
_self._lock = false;
if (callChange)
callChange(event2);
}, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
},
_registerMouseMoveEvent: function(handler, callChange) {
let _self = this;
if (!handler)
return;
handler.setInputAction(function(event2) {
if (_self._lock === void 0 || _self._lock === false) {
if (callChange)
callChange(event2);
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
},
_registerRightClickEvent: function(handler, callChange) {
if (!handler)
return;
handler.setInputAction(function(event2) {
if (callChange)
callChange(event2);
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
},
_clearEvent: function(handler) {
if (!handler)
return;
handler.destroy();
handler = null;
}
});
Object.assign(SketchViewModel.prototype, {
_sketchDrawPoint(handler, options2) {
let _self = this;
this._registerLeftClickEvent(handler, function(event2) {
let loc2 = _self._transfromFromScreenPoint(event2.position);
if (!Cesium.defined(loc2.sLocation))
return;
if (_self._isDrawPoint) {
_self._createPoint(loc2.sLocation, _self._lineLabel);
}
_self._clearEvent(handler);
if (options2.onComplete)
options2.onComplete(loc2.sLocation, loc2.gLocation);
});
},
_sketchDrawMultiplePoint(handler, options2) {
let _self = this;
this._registerLeftClickEvent(handler, function(event2) {
let loc2 = _self._transfromFromScreenPoint(event2.position);
if (!Cesium.defined(loc2.sLocation))
return;
if (_self._isDrawPoint) {
_self._createPoint(loc2.sLocation, _self._lineLabel);
}
_self._sketchPoints.push(loc2.sLocation);
_self._sketchOutputPoints.push(loc2.gLocation);
if (options2.onAdded)
options2.onAdded(loc2.sLocation, loc2.gLocation);
});
this._registerRightClickEvent(handler, function(event2) {
if (_self._sketchPoints.length > 0) {
_self._sketchPoints.pop();
_self._sketchOutputPoints.pop();
if (options2.onUndo)
options2.onUndo();
}
});
this._registerLeftDoubleClickEvent(handler, function(event2) {
_self._clearEvent();
if (options2.onComplete)
options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
});
},
_sketchDrawPolyline(handler, options2) {
let _self = this;
this._registerLeftClickEvent(handler, function(event2) {
let loc2 = _self._transfromFromScreenPoint(event2.position);
if (!Cesium.defined(loc2.sLocation))
return;
if (_self._isDrawPoint) {
_self._createPoint(loc2.sLocation, _self._lineLabel);
}
if (_self._sketchTempPoints.length === 0) {
_self._createTempPolyline();
_self._sketchTempPoints.push(loc2.sLocation.clone());
}
_self._sketchTempPoints.push(loc2.sLocation);
_self._sketchPoints.push(loc2.sLocation.clone());
_self._sketchOutputPoints.push(loc2.gLocation);
if (options2.onAdded)
options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
});
this._registerMouseMoveEvent(handler, function(event2) {
if (_self._isRuntimeApp())
return;
let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
if (!Cesium.defined(loc2.sLocation))
return;
if (Cesium.defined(_self._sketchTempPolyline)) {
_self._sketchTempPoints.pop();
_self._sketchTempPoints.push(loc2.sLocation);
if (options2.onMoving)
options2.onMoving(loc2.sLocation);
}
});
this._registerRightClickEvent(handler, function(event2) {
if (_self._sketchTempPoints.length > 2) {
_self._sketchPoints.pop();
_self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
if (_self._isDrawPoint) {
let lastPointEntity = _self._pointEntitys[_self._pointEntitys.length - 1];
_self._entities.remove(lastPointEntity);
_self._pointEntitys.pop();
}
if (options2.onUndo)
options2.onUndo();
}
});
this._registerLeftDoubleClickEvent(handler, function(event2) {
if (_self._isRuntimeApp())
return;
if (_self._sketchPoints.length < 2) {
if (options2.onError)
options2.onError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
return;
}
_self._removeEntityByObject(_self._sketchTempPolyline);
_self._createPolyline();
if (!_self._isRetainDrawPoint)
_self._removePointEntitys();
_self._clearEvent(handler);
if (options2.onComplete)
options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
});
},
_sketchDrawSpatialPolyline(handler, options2) {
let _self = this;
this._registerLeftClickEvent(handler, function(event2) {
let loc2 = _self._transfromFromScreenPoint(event2.position);
if (!Cesium.defined(loc2.sLocation))
return;
if (_self._isDrawPoint) {
_self._createPoint(loc2.sLocation, _self._lineLabel);
}
if (_self._sketchTempPoints.length === 0) {
_self._createTempSpatialPolyline();
_self._sketchTempPoints.push(loc2.sLocation.clone());
}
_self._sketchTempPoints.push(loc2.sLocation);
_self._sketchPoints.push(loc2.sLocation.clone());
_self._sketchOutputPoints.push(loc2.gLocation);
if (options2.onAdded)
options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
});
this._registerMouseMoveEvent(handler, function(event2) {
if (_self._isRuntimeApp())
return;
let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
if (!Cesium.defined(loc2.sLocation))
return;
if (Cesium.defined(_self._sketchTempSpatialPolyline)) {
_self._sketchTempPoints.pop();
_self._sketchTempPoints.push(loc2.sLocation);
if (options2.onMoving)
options2.onMoving(loc2.sLocation);
}
});
this._registerLeftDoubleClickEvent(handler, function(event2) {
if (_self._isRuntimeApp())
return;
if (_self._sketchPoints.length < 2) {
if (options2.onError)
options2.onError("\u7ED8\u5236\u70B9\u5C11\u4E8E2\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
return;
}
_self._removeEntityByObject(_self._sketchTempSpatialPolyline);
_self._createSpatialPolyline();
_self._removePointEntitys();
_self._clearEvent(handler);
if (options2.onComplete)
options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
});
this._registerRightClickEvent(handler, function(event2) {
if (_self._sketchTempPoints.length > 2) {
_self._sketchPoints.pop();
_self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
if (options2.onUndo)
options2.onUndo();
}
});
},
_sketchDrawPolygon(handler, options2) {
let _self = this;
this._registerLeftClickEvent(handler, function(event2) {
let loc2 = _self._transfromFromScreenPoint(event2.position);
if (!Cesium.defined(loc2.sLocation))
return;
if (_self._isDrawPoint) {
_self._createPoint(loc2.sLocation, _self._lineLabel);
}
if (_self._sketchTempPoints.length === 0) {
_self._createTempPolygon();
_self._createTempPolyline();
_self._sketchTempPoints.push(loc2.sLocation.clone());
}
_self._sketchTempPoints.push(loc2.sLocation);
_self._sketchPoints.push(loc2.sLocation.clone());
_self._sketchOutputPoints.push(loc2.gLocation);
if (options2.onAdded)
options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
});
this._registerMouseMoveEvent(handler, function(event2) {
if (_self._isRuntimeApp())
return;
let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
if (!Cesium.defined(loc2.sLocation))
return;
if (Cesium.defined(_self._sketchTempPolygon)) {
_self._sketchTempPoints.pop();
_self._sketchTempPoints.push(loc2.sLocation);
if (options2.onMoving)
options2.onMoving(loc2.sLocation);
}
});
this._registerRightClickEvent(handler, function(event2) {
if (_self._sketchTempPoints.length > 2) {
_self._sketchPoints.pop();
_self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
if (_self._isDrawPoint) {
let lastPointEntity = _self._pointEntitys[_self._pointEntitys.length - 1];
_self._entities.remove(lastPointEntity);
_self._pointEntitys.pop();
}
if (options2.onUndo)
options2.onUndo();
}
});
this._registerLeftDoubleClickEvent(handler, function(event2) {
if (_self._isRuntimeApp())
return;
if (_self._sketchPoints.length < 3) {
if (options2.onError)
options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
return;
}
_self._removeEntityByObject(_self._sketchTempPolygon);
_self._removeEntityByObject(_self._sketchTempPolyline);
_self._createPolygon();
if (!_self._isRetainDrawPoint)
_self._removePointEntitys();
_self._clearEvent(handler);
if (options2.onComplete)
options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
});
},
_sketchDrawCircle: function(handler, options2) {
let _self = this;
this._registerLeftClickEvent(handler, function(event2) {
let loc2 = _self._transfromFromScreenPoint(event2.position);
if (!Cesium.defined(loc2.sLocation))
return;
if (_self._sketchTempPoints.length === 0) {
if (_self._isDrawPoint) {
_self._createPoint(loc2.sLocation, "\u8D77\u70B9");
}
_self._sketchTempPoints.push(loc2.sLocation.clone());
_self._sketchTempPoints.push(loc2.sLocation);
_self._sketchPoints.push(loc2.sLocation.clone());
_self._sketchOutputPoints.push(loc2.gLocation);
_self._createTempCircle(loc2.sLocation);
if (options2.onAdded)
options2.onAdded(loc2.sLocation);
} else {
if (_self._isRuntimeApp()) {
_self._sketchTempPoints.pop();
_self._sketchTempPoints.push(loc2.sLocation);
let positionCenter = _self._sketchEllipseCenterPosition;
let positionRotate = _self._sketchTempPoints[1];
_self._ellipseOutlineCoordinates = [];
for (let angle = 5; angle < 360; ) {
let newPosition = _self._rotatedPointByAngle(positionRotate, positionCenter, angle);
_self._ellipseOutlineCoordinates.push(newPosition);
angle = angle + 5;
}
_self._ellipseOutlineCoordinates.push(_self._ellipseOutlineCoordinates[0]);
let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
let geodesic = new Cesium.EllipsoidGeodesic();
geodesic.setEndPoints(point1cartographic, point2cartographic);
_self._sketchEllipseRadius = geodesic.surfaceDistance;
if (_self._sketchEllipseRadius <= 0)
_self._sketchEllipseRadius = 1;
}
_self._removePointEntitys();
_self._removeEntityByObject(_self._sketchTempCircle);
_self._createCircle();
_self._clearEvent(handler);
if (options2.onComplete)
options2.onComplete(_self._sketchOutputPoints[0], _self._sketchEllipseRadius);
}
});
this._registerMouseMoveEvent(handler, function(event2) {
if (_self._isRuntimeApp())
return;
if (!Cesium.defined(_self._sketchTempCircle))
return;
var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
if (cartesian == void 0)
return;
_self._sketchTempPoints.pop();
_self._sketchTempPoints.push(cartesian);
});
},
_sketchDrawHeightPolyline: function(handler, options2) {
let _self = this;
this._registerLeftClickEvent(handler, function(event2) {
let loc2 = _self._transfromFromScreenPoint(event2.position);
if (!Cesium.defined(loc2.sLocation))
return;
if (_self._sketchTempPoints.length === 0) {
if (_self._isDrawPoint) {
_self._createPoint(loc2.sLocation, "\u8D77\u70B9");
}
_self._sketchAltitudeInitHeight = loc2.gLocation.height;
_self._sketchTempPoints.push(loc2.sLocation.clone());
_self._sketchTempPoints.push(loc2.sLocation);
_self._sketchPoints.push(loc2.sLocation.clone());
if (options2.onAdded)
options2.onAdded(loc2.sLocation);
} else {
if (_self._isRuntimeApp()) {
_self._sketchTempPoints.pop();
_self._sketchTempPoints.push(loc2.sLocation);
let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
_self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
_self._sketchAltitudePolylinePostions = [];
_self._sketchAltitudePolylinePostions.push(_self._sketchTempPoints[0]);
let point_temp = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
_self._sketchAltitudePolylinePostions.push(point_temp);
let geodesic = new Cesium.EllipsoidGeodesic();
geodesic.setEndPoints(point1cartographic, point2cartographic);
_self._sketchEllipseRadius = geodesic.surfaceDistance;
if (_self._sketchEllipseRadius <= 0)
_self._sketchEllipseRadius = 1;
let height_temp = point2cartographic.height - point1cartographic.height;
_self._sketchEllipseHeight = height_temp + _self._sketchAltitudeInitHeight;
}
_self._removePointEntitys();
_self._removeEntityByObject(_self._sketchTempAltituePolyline);
_self._createAltitudePolyline();
_self._clearEvent(handler);
if (options2.onComplete) {
options2.onComplete(_self._sketchAltitudePolylinePostions, _self._sketchEllipseCenterPosition);
}
}
});
this._registerMouseMoveEvent(handler, function(event2) {
if (_self._isRuntimeApp())
return;
if (_self._sketchTempPoints == void 0 || _self._sketchTempPoints.length == 0)
return;
var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
if (cartesian == void 0)
return;
if (_self._sketchTempPoints.length >= 2) {
if (!Cesium.defined(_self._sketchTempAltituePolyline)) {
_self._createTempAltitudePolyline();
} else {
_self._sketchTempPoints.pop();
_self._sketchTempPoints.push(cartesian);
}
if (options2.onMoving) {
options2.onMoving(_self._sketchAltitudePolylinePostions, _self._sketchEllipseCenterPosition);
}
}
});
},
_sketchDrawRectangle: function(handler, options2) {
let _self = this;
this._registerLeftClickEvent(handler, function(event2) {
let loc2 = _self._transfromFromScreenPoint(event2.position);
if (!Cesium.defined(loc2.sLocation))
return;
if (_self._sketchTempPoints.length === 0) {
if (_self._isDrawPoint) {
_self._createPoint(loc2.sLocation, "\u8D77\u70B9");
}
_self._sketchTempPoints.push(loc2.gLocation);
_self._sketchTempPoints.push(loc2.gLocation);
_self._sketchPoints.push(loc2.gLocation);
_self._createTempRectangle();
if (options2.onAdded)
options2.onAdded(loc2.sLocation);
} else {
if (_self._isRuntimeApp()) {
_self._sketchTempPoints.pop();
_self._sketchTempPoints.push(loc2.gLocation);
let lng0 = parseFloat(_self._sketchTempPoints[0].lng);
let lat0 = parseFloat(_self._sketchTempPoints[0].lat);
let lng1 = parseFloat(_self._sketchTempPoints[1].lng);
let lat1 = parseFloat(_self._sketchTempPoints[1].lat);
_self._rectangleCoordinates = [0, 0, 1, 1];
if (lng0 < lng1) {
_self._rectangleCoordinates[0] = lng0;
_self._rectangleCoordinates[2] = lng1;
} else {
_self._rectangleCoordinates[0] = lng1;
_self._rectangleCoordinates[2] = lng0;
}
if (lat0 < lat1) {
_self._rectangleCoordinates[1] = lat0;
_self._rectangleCoordinates[3] = lat1;
} else {
_self._rectangleCoordinates[1] = lat1;
_self._rectangleCoordinates[3] = lat0;
}
let rectangle = Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]);
let res = _self._calculateRectangleOutlineCoordinates(rectangle);
_self._rectangleOutlineCoordinates = res.cPoints;
_self._sketchOutputPoints = res.gPoints;
}
_self._removePointEntitys();
_self._removeEntityByObject(_self._sketchTempRectangle);
_self._createRectangle();
handler.destroy();
handler = null;
if (options2.onComplete)
options2.onComplete(_self._sketchOutputPoints);
}
});
this._registerMouseMoveEvent(handler, function(event2) {
if (_self._isRuntimeApp())
return;
if (!Cesium.defined(_self._sketchTempRectangle))
return;
let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
if (!Cesium.defined(loc2.sLocation))
return;
_self._sketchTempPoints.pop();
_self._sketchTempPoints.push(loc2.gLocation);
});
},
_sketchDrawTriangle: function(handler, options2) {
let _self = this;
handler.setInputAction(function(event2) {
if (Cesium.defined(_self._sketchTempAltituePolyline))
return;
let loc2 = _self._transfromFromScreenPoint(event2.position);
if (!Cesium.defined(loc2.sLocation))
return;
if (_self._sketchPoints.length == 0) {
_self._createPoint(loc2.sLocation, "\u8D77\u70B9");
_self._sketchTempPoints.push(loc2.sLocation.clone());
_self._sketchTempPoints.push(loc2.sLocation);
_self._sketchPoints.push(loc2.sLocation);
_self._createTempPolyline();
} else if (_self._sketchPoints.length === 1) {
_self._createPoint(loc2.sLocation, "\u9AD8\u5EA6\u8D77\u70B9");
_self._entities.remove(_self._sketchTempPolyline);
_self._sketchPoints.push(loc2.sLocation);
_self._createPolyline();
_self._sketchTempPoints.push(loc2.sLocation.clone());
_self._sketchPoints.push(loc2.sLocation);
_self._sketchAltitudeInitHeight = loc2.gLocation.height;
_self._createTempTriangleAltitudePolylineAndSpatialPolyline();
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
handler.setInputAction(function(event2) {
if (_self._sketchPoints === void 0 || _self._sketchPoints.length === 0)
return;
var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
if (cartesian == void 0)
return;
_self._sketchTempPoints.pop();
_self._sketchTempPoints.push(cartesian);
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
handler.setInputAction(function(event2) {
if (_self._sketchPoints.length < 2) {
if (options2.onError)
options2.onError("\u7ED8\u5236\u56FE\u5F62\u4E0D\u5B8C\u6574\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
return;
}
_self._removePointEntitys();
_self._removeEntityByObject(_self._sketchTempTriangleAltitudePolyline);
_self._removeEntityByObject(_self._sketchTempSpatialPolyline);
_self._createAltitudePolyline();
_self._createTriangleSpatialPolyline();
handler.destroy();
handler = null;
options2.onComplete(
_self._sketchPoints,
_self._sketchTriangleSpatialPolylinePositions,
_self._sketchAltitudePolylinePostions,
_self._sketchEllipseCenterPosition
);
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
},
_sketchDrawPolygonBody(handler, options2) {
let _self = this;
this._registerLeftClickEvent(handler, function(event2) {
let loc2 = _self._transfromFromScreenPoint(event2.position);
if (!Cesium.defined(loc2.sLocation))
return;
if (_self._isDrawPoint) {
_self._createPoint(loc2.sLocation, _self._lineLabel);
}
if (_self._sketchTempPoints.length === 0) {
_self._createTempPolygon();
_self._createTempPolyline();
_self._sketchTempPoints.push(loc2.sLocation.clone());
}
_self._sketchTempPoints.push(loc2.sLocation);
_self._sketchPoints.push(loc2.sLocation.clone());
_self._sketchOutputPoints.push(loc2.gLocation);
if (options2.onAdded)
options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
});
this._registerMouseMoveEvent(handler, function(event2) {
if (_self._isRuntimeApp())
return;
let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
if (!Cesium.defined(loc2.sLocation))
return;
if (Cesium.defined(_self._sketchTempPolygon)) {
_self._sketchTempPoints.pop();
_self._sketchTempPoints.push(loc2.sLocation);
if (options2.onMoving)
options2.onMoving(loc2.sLocation);
}
});
this._registerRightClickEvent(handler, function(event2) {
if (_self._sketchTempPoints.length > 2) {
_self._sketchPoints.pop();
_self._sketchOutputPoints.pop();
_self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
if (options2.onUndo)
options2.onUndo(_self._sketchPoints);
}
});
this._registerLeftDoubleClickEvent(handler, function(event2) {
if (_self._isRuntimeApp())
return;
if (_self._sketchPoints.length < 3) {
if (options2.onError)
options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
return;
}
_self._removeEntityByObject(_self._sketchTempPolygon);
_self._removeEntityByObject(_self._sketchTempPolyline);
_self._createPolygonBody({
height: 30,
color: [255, 255, 0, 0.9]
});
_self._removePointEntitys();
_self._clearEvent(handler);
if (options2.onComplete)
options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
});
},
_sketchDrawTriangleA: function(handler, options2) {
let _self = this;
this._registerLeftClickEvent(handler, function(event2) {
if (Cesium.defined(_self._sketchTempAltituePolyline))
return;
let loc2 = _self._transfromFromScreenPoint(event2.position);
if (!Cesium.defined(loc2.sLocation))
return;
if (_self._sketchPoints.length == 0) {
if (_self._isDrawPoint) {
_self._createPoint(loc2.sLocation, "\u8D77\u70B9");
}
_self._sketchTempPoints.push(loc2.sLocation.clone());
_self._sketchTempPoints.push(loc2.sLocation);
_self._sketchPoints.push(loc2.sLocation);
_self._createTempSpatialTriangle();
if (options2.onAdded)
options2.onAdded(loc2.sLocation);
} else if (_self._sketchPoints.length > 0) {
if (_self._isRuntimeApp()) {
_self._sketchTempPoints.pop();
_self._sketchTempPoints.push(loc2.sLocation);
_self._sketchSpatialTrianglePositions = [];
_self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
_self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[1].clone());
let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
let point_temp = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
_self._sketchSpatialTrianglePositions.push(point_temp);
_self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
}
_self._removePointEntitys();
_self._removeEntityByObject(_self._sketchTempSpatialTriangle);
_self._createSpatialTriangle();
_self._clearEvent(handler);
if (options2.onComplete)
options2.onComplete(_self._sketchSpatialTrianglePositions);
}
});
this._registerMouseMoveEvent(handler, function(event2) {
if (_self._isRuntimeApp())
return;
if (_self._sketchPoints === void 0 || _self._sketchPoints.length === 0)
return;
var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
if (cartesian == void 0)
return;
_self._sketchTempPoints.pop();
_self._sketchTempPoints.push(cartesian);
if (options2.onMoving)
options2.onMoving(cartesian);
});
},
sketchTools: function(toolsType, options2) {
let _self = this;
this._clear();
_self._sketchEventHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
switch (toolsType) {
case SketchViewModel.SketchType.Point:
_self._sketchDrawPoint(_self._sketchEventHandler, options2);
break;
case SketchViewModel.SketchType.Line:
_self._sketchDrawPolyline(_self._sketchEventHandler, options2);
break;
case SketchViewModel.SketchType.Polygon:
_self._sketchDrawPolygon(_self._sketchEventHandler, options2);
break;
case SketchViewModel.SketchType.Height:
_self._sketchDrawHeightPolyline(_self._sketchEventHandler, options2);
break;
case SketchViewModel.SketchType.Spatial:
_self._sketchDrawSpatialPolyline(_self._sketchEventHandler, options2);
break;
case SketchViewModel.SketchType.Circle:
_self._sketchDrawCircle(_self._sketchEventHandler, options2);
break;
case SketchViewModel.SketchType.Rectangle:
_self._sketchDrawRectangle(_self._sketchEventHandler, options2);
break;
case SketchViewModel.SketchType.Triangle:
_self._sketchDrawTriangleA(_self._sketchEventHandler, options2);
break;
case SketchViewModel.SketchType.PolygonBody:
_self._sketchDrawPolygonBody(_self._sketchEventHandler, options2);
break;
case SketchViewModel.SketchType.MultiplePoint:
_self._sketchDrawMultiplePoint(_self._sketchEventHandler, options2);
break;
}
},
sketchDrawFeacture: function(points2, type2, options2) {
let _self = this;
if (points2 === void 0 || points2.length === void 0 || points2.length < 2) {
if (options2 && options2.onError)
options2.onError("\u8F93\u5165\u7684\u5750\u6807\u96C6\u5408\u5F02\u5E38\uFF01");
return;
}
this._sketchPoints = [];
for (let i2 = 0; i2 < points2.length; ) {
this._sketchPoints.push(Cesium.Cartesian3.fromDegrees(points2[i2], points2[i2 + 1], points2[i2 + 2]));
i2 = i2 + 3;
}
switch (type2) {
case SketchViewModel.SketchType.DrawPoint:
_self._createPoint(_self._sketchPoints[0], _self._lineLabel);
if (options2 && options2.onComplete)
options2.onComplete(_self._pointEntitys);
break;
case SketchViewModel.SketchType.DrawMultiplePoint:
for (let i2 = 0; i2 < _self._sketchPoints.length; i2++) {
_self._createPoint(_self._sketchPoints[i2], _self._lineLabel);
}
if (options2 && options2.onComplete)
options2.onComplete(_self._pointEntitys);
break;
case SketchViewModel.SketchType.DrawPolyline:
if (_self._sketchPoints.length < 2) {
if (options2 && options2.onError)
options2.onError("\u70B9\u6570\u5C11\u4E8E2\u4E2A\uFF0C\u65E0\u6CD5\u7ED8\u5236\uFF01");
} else {
_self._createPolyline();
if (options2 && options2.onComplete)
options2.onComplete(_self._sketchPolyline);
}
break;
case SketchViewModel.SketchType.DrawPolygon:
if (_self._sketchPoints.length < 3) {
if (options2 && options2.onError)
options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u65E0\u6CD5\u7ED8\u5236\uFF01");
} else {
_self._createPolygon();
if (options2 && options2.onComplete)
options2.onComplete(_self._sketchPolygon);
}
break;
default:
if (options2 && options2.onError)
options2.onError("\u7ED8\u5236\u7C7B\u578B\u5F02\u5E38\uFF01");
break;
}
},
sketchClear: function() {
this._clear(true);
this._clearEvent(this._sketchEventHandler);
},
sketchInit: function() {
this._clear(false);
}
});
Object.assign(SketchViewModel.prototype, {
_checkColor: function(color2) {
if (color2 === void 0 || color2 === null)
return false;
if (typeof color2 != "number")
return false;
let intColor = parseInt(color2);
if (intColor < 0 || intColor > 255)
return false;
return true;
},
_checkAlpha: function(alpha) {
if (alpha === void 0 || alpha === null)
return false;
if (typeof alpha != "number")
return false;
let floatAlpha = parseFloat(alpha);
if (floatAlpha < 0 || floatAlpha > 1)
return false;
return true;
},
_checkColorAndAlpha: function(colorAndAlpah) {
let setColor = void 0;
if (!colorAndAlpah || colorAndAlpah.length === void 0 || colorAndAlpah.length === 0)
return void 0;
if (colorAndAlpah.length === 1 && this._checkColor(colorAndAlpah[0])) {
setColor = [colorAndAlpah[0], 0, 0, 1];
} else if (colorAndAlpah.length === 2 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
colorAndAlpah[1]
)) {
setColor = [colorAndAlpah[0], colorAndAlpah[1], 0, 1];
} else if (colorAndAlpah.length === 3 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
colorAndAlpah[1]
) && this._checkColor(colorAndAlpah[2])) {
setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], 1];
} else if (colorAndAlpah.length === 4 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
colorAndAlpah[1]
) && this._checkColor(colorAndAlpah[2]) && this._checkAlpha(
colorAndAlpah[3]
)) {
setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], colorAndAlpah[3]];
}
return setColor;
},
sketchEditPickPolygonBody: function(options2) {
let _self = this;
let primitive = _self._sketchPickPolygonBody;
if (primitive === void 0) {
if (options2.onComplete)
options2.onComplete("\u672A\u62FE\u53D6\u5BF9\u8C61\u6216\u62FE\u53D6\u7684\u5BF9\u8C61\u4E0D\u7B26\u5408\u8981\u6C42\uFF01");
return;
}
let color2 = primitive._useGeometry.color;
let height2 = primitive._useGeometry.height;
this._sketchPoints = primitive._useGeometry.cPoints;
this._sketchOutputPoints = primitive._useGeometry.gPoints;
if (options2 && options2.height && typeof options2.height === "number")
height2 = parseInt(options2.height);
if (options2 && options2.color && this._checkColorAndAlpha(options2.color))
color2 = this._checkColorAndAlpha(options2.color);
this._viewer.scene.primitives.remove(primitive);
this._createPolygonBody({
color: color2,
height: height2
});
if (options2.onComplete)
options2.onComplete(void 0);
},
sketchRemovePickPolygonBody: function(onComplete) {
let _self = this;
let primitive = _self._sketchPickPolygonBody;
if (primitive === void 0) {
if (onComplete)
onComplete("\u672A\u62FE\u53D6\u5BF9\u8C61\u6216\u62FE\u53D6\u7684\u5BF9\u8C61\u4E0D\u7B26\u5408\u8981\u6C42\uFF01");
return;
}
this._viewer.scene.primitives.remove(primitive);
if (onComplete)
onComplete(void 0);
},
sketchPick: function(onComplete) {
let _self = this;
let handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
handler.setInputAction(function(event2) {
let pickObj = _self._viewer.scene.pick(event2.position);
if (pickObj && pickObj.primitive && pickObj.primitive._useGeometry != void 0) {
_self._sketchPickPolygonBody = pickObj.primitive;
if (onComplete)
onComplete({
color: pickObj.primitive._useGeometry.color,
height: pickObj.primitive._useGeometry.height
});
} else {
_self._sketchPickPolygonBody = void 0;
if (onComplete)
onComplete(void 0);
}
handler.destroy();
handler = null;
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
}
});
SketchViewModel.SketchType = Object.freeze({
Point: "point",
MultiplePoint: "multiplePoint",
Line: "line",
Polygon: "polygon",
Height: "height",
Spatial: "spatial",
Circle: "circle",
Rectangle: "rectangle",
Triangle: "triangle",
PolygonBody: "polygonBody",
DrawPoint: "drawPoint",
DrawMultiplePoint: "drawMultiplePoint",
DrawPolyline: "drawPolyline",
DrawPolygon: "drawPolygon"
});
SketchViewModel.SketchIconType = Object.freeze({
Normal: "normal",
Blue: "blue",
Green: "green",
Violet: "violter"
});
SketchViewModel.RuntimeEnvironment = Object.freeze({
App: "app",
Web: "web"
});
class CommonTools {
constructor(viewer2, options2) {
this._viewer = viewer2;
options2 = options2 || {};
if (options2.isDrawPoint) {
this._isDrawPoint = options2.isDrawPoint;
} else {
this._isDrawPoint = false;
}
if (options2.isRetainDrawPoint) {
this._isRetainDrawPoint = options2.isRetainDrawPoint;
} else {
this._isRetainDrawPoint = false;
}
if (options2.isClear) {
this._isClear = options2.isClear;
} else {
this._isClear = false;
}
this._sketchViewModel = new SketchViewModel(viewer2, {
iconType: SketchViewModel.SketchIconType.Blue,
isDrawPoint: this._isDrawPoint,
isRetainDrawPoint: this._isRetainDrawPoint
});
let buttonDiv = document.getElementById("drawButtonDiv");
if (buttonDiv) {
document.body.removeChild(buttonDiv);
}
this._init();
}
_init() {
this._measureEntityName = "MeasureEntity";
this._entities = this._viewer.entities;
this._measurePointImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcEAYAAAAinQPXAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAB2FJREFUWMO9mHtQlNcZxn/nW65GxHtEqTEajUxVoLYRSIyipHG4qG0lajtxVIRFubgqXuOI28ZE7FAvCLKLSNKxg/FSIzdvqNE62kaRitqpYMxovBGigo4I4n6nfwjsCrsLrtjnn53vnPe87/Oc9/2+854VdBhCd6ZP6dMHlAXO/lOngrzMLz/8EEQ0ASNGANNY2aOHxYIdfHr3LuBCwPnzQIKcf/AgiJ8pQV99BfmvR4+orHxZVsLxpZFT0qd07gyP7zqrej3IInF47lwQkTLV3d1xv3KXWPT4MYhLzMzIgHpn10+Sk+Gw74w+jx79HwSGnzUYhg4FED4FBcBq/jtokOOC2oSb0FZUgHpKVoeHQ9GtGM/y8lcgMLxf5juDBwNDlOWnTgGvUdWz5wsQ7c179fUWzz9y0tX1BdZPILeqCpTtil9QEOT9c876K1faWqS07XeMzJFuboCXkpaX1w5hqxl14QJIKYRWCzLV5OXtDQXbon3c3c2/TeMoYvncucAgPrl40Y7fA0zv1QtMydKwb58FL7toRwbDYo3/0utB3OD8qlX2hIkLqalwO0b9+fLlUHJOG9vQ0P4EjfyFIdPZGfqsURampIBIlxsWLLBtL/NltF4PhUIrVq92QGDIeEOmpye4pYju164Bq6n29LTiopy8tDTIL48pSExsDq/Oj9is/eAD4CRbli1DMEFUBAYCewnUaJD8jr2lpQjpJ7M2bBBi0+L47Tt2mP2G5xhNaWnAHrLj461tKF1rasA0rW5b//6w/0rigQcPWhrZKVFXP8TkybaFyb3kXbkCbiO6fpyU1Dwq58vNG3U6BJvEiYMHEcwQW8aNA3pT7O4OaPmTiwuCnlwcNQrEDRGYmytloilj5vr1Zv+mNXVhSUnmOFYEVnt6gtM9t+8mTbKlwo5AoWdySIjteWUcIwwG2LX7o6lPnkiZULTlj/7+wEThm5oKbCBeCOANUisqkNRxLCEBSSzrYmOB3jw6c8Yi3kL5K51OyvkZGXUTJz7LSH09CIPwMBpt85CHhMf48Q4IJFPofHzsbMAAJfjIEQtXC9TZWi0wkEuKAmjEyspKpNN2pyVBQULZaIjbvXmzUDb6xF0zGJCqv+no6NGAK5fLyiz8JssVcXEWgQLUsZZxWmGbrLTN057Agfh7eNiefhpRb7h922LgOzFp2DDzxnJXrsvLE0rqOW3sTz+12h4lLfRZhuQybuXmWmQkgPzhwy0o1jlV37ljh+e3/L1LF0cEXqX04UPb0075rlovLwtBHuqZ5845T5Z37UqbEAPkzOfsUvlHXZ35saFnQ4++fe04eIfftv64tEfgdvkXeweprFIvBQaaebJH+f3x4xbPvsRPnixlQlHGtDFjWq2Wuqj0yz4+QKk4FxNjMVXD2998Y0FRKEsCAuzwzBKv2eZpR6DspxQcPWpnvrNYoNNBZOTOnRoN0ilJMzYjA3ibsKoqoIxezs6gLJbpxcVSTbyePurwYSkT76VPKSgAWQslJcAmenTrBszgP7W1wBlRmZICY2SydHIC8ZCvdTo7Ak+ri44dcySDNDTs2mVufluhThoGD4bHp6or4uOb3zWJnoqwMGAVLnfuACHscHJCiFRmhISA0BMcFob52PDC/8EDkLfkR5GRQmycN8/t8mXw8O73WVwctnvdJ3SqrQXNSJeY3bttaWhHJxMxzDh97VqQAwheutR2IC6pm/z8oOBm7LcVFVJNKNo0oUsXhBKmGR0VBfI0vkFBINzExxoNEKP+ePYsktefFmVnC2Vjvm5SZSVEpGUNefNNUH8ti8rKQCziaOfOVuL2563PP4eCjJhxK1a8hMCJJ7NTPDxAXWIaefEi0J2r/ftbMfyryDhxAkZ2u1EaHAx6oReq2rb/JiTLZKkoUHLf2//YMWCGnPf++1YM7zHw+nVQ1mlKhg2DvPeiltr+GLaj2W524Kd6zZ4NhGOQ0ophI6GSkr4Gq61VGyjx7vdZQoIdYY1xVZ06RKttS1gTHLkPLjVmGo3AJZToaCsGjSWrPFBKfH3bvta0uyR3ySlGIxS4a7trte1l244MtoRpT93XSUk0l0oruFDbqROYUtQ9X3xhLr2WaBpX4+WnOTl2hHkw9eZN0Li5dLP6Dehogc1dexslK/7MynffhbNDvZXnWq9GNJWyiKC69TlphvobtWbOHNgnZonq6hdl+xL/yTQhbKUxeOtWEP9melSUFYMWJSv/IAtNprZLUu4Rf9u6FQpdo49bfRXaBQcy2BL1p+XURYtAZrLwhx+sGDSWrDpc3ZeVBbJMPt22zY6wRj/1oep08zXMUXRABpsQFmqcHhICYiLlhw4BBWiFA/5FOXmhoc8u0Pv3vyyrDshgEwqLYnKLi4FO5OfkvPh66UdudnZHCXsFAptQ96XMW7jQTsm2xAF23roFlD6NXLy4o9m8AoHFR7SxNTWgjGOsVovtxqBxXAzEbc4cKCycN+/+/Y7n88oRvjarcNYsCDtprP/+ewjvZ1xz9SpERBp3zpz5qqP/D5zQE33tptaiAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA0LTA5VDE2OjQyOjI5KzA4OjAwjRBbGwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wNC0wOVQxNjo0MjoyOSswODowMPxN46cAAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uXzJhcHo1b3VpcnV4L2Rpbmd3ZWkuc3ZncY9vkgAAAABJRU5ErkJggg==";
this._iconBlue = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkEyMUE1MDg3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkEyMUE1MDc3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/grmkAAAhxSURBVHjazFoLUFVFGN49597LBdFUEpEQI0IpyxIfqU1ZkY/pNZg1RZlWY2lW4yMncxq18oHZ0+lhOaWZUo0zPjIr8W1NiubI+AxBIkRQQsQE7us8tv3P7qGL7gXOPRdzZ3bmcnf3+7/v/Lv/+f/lYkIIMpur2yBktQVO5yM7LRybIvsOFKFGCeHyQz/dFO2Ousflcg6UJSlVlqVEjHEMjNMH5tE0vVLT9ZJAQNnn9fm3d+9z3xEYioR9bNcjW9Z8Gtv35l7PUAFjnU5HLytrFUU9TgV9XXD4+PJhoyfV2/GIFO4TGD8my1lVuGXSHYNuPdyhfbv5VkVAgzWwFjAACzAvp0fwoV++uz6lxzXLolzOW1AEmz+gHCwtq3i2z52Pn2jtlgvXI1LpgQ0jeqYm74y0CGiACdjUxkir3KxMlsoKNj6WmNAlV5Kk9qiNGmBTG6vAlhV+rd1aUuGeNSNSeiSuolGo2X1cdDogbThQ79h21CMfP6NKtR4dw/edYiTSK8GhZ/aO0R7KiFV7dnPpzeFQXkppWeWY9MGj8+ifektbqzVC8KbVH6UNHdJvOw2nHUIB7vrDI89df861p0SRsUSjuiSzB4qxyYzx0TVEdBUNTnVqs7I6B4beEKOFwqThuu7X/IJ7hj/yYlGoM9NqIakpSVH7t67c3C4muq8IyKcQ9EpuddSK3xqcSHJR7g7WsSkCm8+YiSEgRuU9gMbd3k5578kufrcTC8U0eLwF/e99anhJ6Sm/HSHSid/Xv5CclJAjAjlXr+GHP6x07z9JZCSDCBfzBJapBomJabJfdKqFCiGa4RkQgrQA6p+MtbVTEn2dY2XhUz956szM6wdkLRFtsVZFrReeeaRTQte46aIxT4DgrA9ABJKRw42QTLsjimqATgUZwpxNO/0OGz3KmMvWuBFgABZgimwBB+ASbtSSp0zIHutyOuNEg9NW/e06UE49YRBi5LFB2NxaMoQg5iGJfza+Y+MwlwlmogALMIXpD+UAXIBTOEKi4rt0zg51sFft8TjN7YQbnzrbVpeeD8Q+w3fYFCQba9ha5kHABGyRTcrlCeBkVQjO/Wxeb3rA00WDb62rcbHzAARML0hBAloK+lyQ4TEHx2B4BragUS69vl06/6aLnk6LQuQ+vdMyRQMHT/ql/D9VGfEQi00PGFDYwqsP8/AsMQyJbTvABhuiFb3TU+8Otb1CCXFd1SF2gGhg/f56Bw4+B9iCJ0J5Bv93fgAbbIimd7yq/UDgZklITLQ7RTSwp9grs7MgBYXYMEQ0OTtBWBR7d5FX+NQ5J0tCHG63K0GYglSpkrklGkXY1GGKMbdo8d+qkBfn5LB0RpwOeDlc2mo9NNYHbyOMIuCRptvNsCGqXxgnS2dEoslhxMrgSDXOSbL0HlFVzSv6vlMMJigorWGpnJ2ymzRdTrENGxY4NSeE+PwBYQ3ds6tDN1IewvvFRMLQwTBMPB2lxTuEaTvnRKwI0S/U1ZeLBganRWtGwteYAOoR8EgQFsUe3DNamNpzTroVIWp1TW2xaCCrf6xKzDScaP89SRKGGBLkCSMjVo1aZRS1IZrOOalWhCgHjxTvEw3ckhylD7rOobF6ghZJphhk1TO80DK8Yab1KgJssCHMKhgnxYqQQM7i5bv9AaVONDh7VFzAqCWMekLhRZIFzzQWWLzIMjAY3qwsii2+YakDTsDNkkdoRVZbXHLyN9EglKdjh8QoUBSBcaIDEYU91cbtRi7yUFCF2OgBha9lBRZg3nWjuPQFLsDJqkfAtfWfr1jzDSHiR/zuk/GBjO5YQyqtQDU/5WYKCjo/Oicd/JmPw1xYA2sBA7AAM8RFBAEuwMnqYTei3Q95vx47U1VzTJj3uDBZNzXRl9EdUTE+SshnECJcFPOWwraNxj0GYo3OyLM1PgQYgAWYIlvAAbgAp3AKK6XyTPXZ56bOm0f3p/BFFEdr7LwZSd5xQ9wKUukUo/u4h8SdecCHzPmwdtOMJF9ciHodbE+cvmA+cAm1rVoSAsD1m3fmH127cfvSUJOiXRh98nS8/8dpXb0DknWNKB5qzsOIKlwYdIULpWMwB+ZunNrVC2tDeQIa2P552+4jfFsROxd0sbRfm5/31dyMPumZLQWkwsqA9EOTCzqCzdTGvKB7MCNWTU9s/oIOWsHh41tvGz5uNv34Fxdi64IOvNaxQ/t2aXvzVixKTUnqezkSRBqhCm4bMW7GhboGuJw7H+qQW7nEBoALFPCvOx8cP+toYUl+W4v4o6h0L9iiNkvBdnNXplYvsSEtOFddc75owLCxc6jLd7aVCMDulzlmDtgCm6FSEju38RAxztJUumTkoy+9faqyqjDSIgDzgezJi6gN+P9Is1HKjpBGz9T+U1cy+ulXZ9XU/lMRKRGABZjUEyeseCJcIY1i6BY4NmHagjlen/+CXREUow6wADMcEeEKQTxxq96wadfvCz9cvpBuBSVcEbCWYuQAFmCGSgrbSojx0qW9KmfxV5u/zP1+MTEqI6vlCNFhLWAAFsdEl1sIvIAgdTn98muL1mzZtXe1VYCtv+xbDWsBg2OR/0OIKaaB9ooHsqcsoXt8h4Uwu+P+xyfD/zwqOIatHw7YFQJvVthSUICVDxs9Kae0rOJwS2vKyk8fgbmwhq/V7fKwLYSLgWLoPLz9s59//c3mwjKMPTZ+5hswl6ceWiQ4REQIF2OE5QOHCo9NfCVndoPHW3vxHPgOxmAOzOVr0BUlhIuB0Hn2+5937p/77hcLgsMyfF7wwbKFMAZz+Fx0RQoJDsvvL8ndYYZlM8y+8/HKbXbDbKgW8ftd+qQJLQcglFZCaE3qFn81wogEh1mYE/F74bb64RnFAm/DDwy6mPdrkJLzKGfLpsj+vwIMACSZzfDJFmOPAAAAAElFTkSuQmCC";
this._iconGreen = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjI1NDIwOUU3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjI1NDIwOUQ3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgEE4igAAAgKSURBVHjazFoJbFRVFP3L/OlMoQXKImAFm0JbFtFKShEQI6UsggmkGKghIKTIIgZUohIDKEuLaFTQiIKyKKghqSyyF0pZbcHQsJVpoRkKbYFAW+iU2f78/313+qY+hvc78+dPkZfcMJ377rn3/Pve/fe9gVUUhfENY5eBjNbhvlnI6Bmh+KT5NzBhGigg9sb5vX3NpohhRqMwgOe4eJ7nurIsGwl69MDskiRXS7Jc7naLpx1OV/4z/V67CKpw+Gf1ZiQv9/vWyc8lTkMEpgiCIVGLrSh6ShGhX4ovlG5Mz5jToCcjXKhPIGvyOOG2JW/OywNfuBAd1WqFVhIwwAZsAQOwAPNxZoQ9f+yPHnHdn94QYRSeZ8I4XG7xnLWianq/oZOuBrvkQs0IZz27a2RCfLeCcJOAAZiAjXyM0hqblslcRfHuiV07d9zKcVwU00IDsJGPLeBLS3zBLi3O8nfuyLjuXbegKtTsOrY4Ldz22u2GPFue4bL7MlfrqWXh+xhDjNLL2EtOj0r3jI8Z70kyJcnN4aC4RGtF9eSklzIOoD/lQEsrGCLs/m3f9nxlUP98VE6j1QDz6/P5xZWLI06KJ3lGwIWdB2tfZEgkJB4oVwwzWBgsLY1d6hoWPUxSw0Tl2na8sHjYiAnvlKntmaD3SHxcrDG1f9/1aiScspOZYZ1hGm4dHnmSRyRglk+i/ITQwVywAVvAoA3kMyolufc6iEHv0uKuntkxu1ts5xyacY2nhh1TNsZcpBTxjBl2K4AQ2eD8MiITWXFDmULiYJhUNlXak7DH0d7QnvrUr1feWtgjZdxa2hILKiOzp01o1/mp9gtoOrtsZ0eXjjYXMYhEa/RFKyxmLCaCmBF/NhF633xkCxiABZg0XxADxBJq1eLnz8ycYhSE9jTl3Iq5EWeYM/wjwUPQvj1CEwHP8SMFWIBJbX9QDBALzrNmIhGdOsZkqm3sTfWbhKbgTcSSMhBLiiYcMc9I2CMswARsmk8Uy5s4r5qIsFt/WN6nVaQ5iaZcVLkoQjEpjbD++4IM+hFUQniCDMYBTMCm+USxJP6+bkVfFWRVIny/Pj3TaIpiezF3SjzFN619AaNwRLABSwzhnSOWGxLABh80sz5J8a+qLS81IsY20a1TaIrc2lzhoX3A+2Ui6FcxkRn+4f3j9UEZbdtEDcCUgycSaTbF0RQnGk7wTY79S2xIbSvGIDCPNxynPnUckyYiBpPJ2JmmKBVLuSYCXIA9EWxWWAIPYZeJZdS4cEwGTXtEMBhMNEWthHonVieB5gix2Aft/NIYk6Y9wqHmMGzH4HANHBOn6T3i8UgO2vcxfIzibTdI0Tv88Lw+NMTUHBHF6XJTz9CJQqLs7ZdkLHoIkbbyf71YgpBAbdtxTIoWInK9reEGTTGk9RCpqfGTCDJ6skE2kxL2QRk4JlkLEc+dmrorNEVGTIbo7VxFgowUQlYU4oxCnFMAe0LMBJFmgmPyaCEinrt45TRNkRyZLA8SBkleMj5CMvGclCBJMIQdJgAC2OCDZoZjErUQcees3njK5RZtNOWy2GUu1sk2nidcOAiPX2aUAHvC/1yCBDDh1Khyw2KDmLBF8Bkpt1bWXSm/fpKmhOPp9OjpIhyKGCcWHxkPpQj4b2oPQcJnj7AAMy06jbo/IBaISWtGwF3Dj5tzf1PIIyQx1nRf40phUiTmQWMQTaTI/ePx2wPEPvAF7xWEAViAqXIRoUAsEJPWze6tdn8dOF5y63ZNCbXv4SKVvYl7HSkKItPQGMwjpFx+4he8V5AtYAAWYNJ8QQwQC0bQfLASq2/duTvjveXL0fqkvog6GDooR3sdtWdFZomsjW18Xj5SdhXBwYOADdgW9CpwAJbK3nDMWpC9AmJRW1aBiABww8GCwkt/7s5fpzbJzJmZ9XHrnYfiDtkHSgMlph59CSXC9y8phA7m5sXl2cFWLRMwwPe+w6cuYvqKngs6uFp4tvDApmUv9ktKC1RZSxwl3I66HYaD9QcNFtHC+RpAaDuShCR5RPQIz7h24zy9zb3lQFjFF0oPpY6Yuhh9vIaJ6Lqgg6y1jY5q1bPowOZV8XGxyY+jQUQVqjh15NSP6m0P4HLuntom13KJDQD1CPDa0NezFl2ylBe2NInLZdYi8IV8WvGCDJi9YC+JoXDW3qm5V5aSPmUJSnlBS5EA7P5pk5eAL/Cp1pLouY2HinEXtdLlo96Y+3ll9W1LuEkA5tjMeauQD/h9pNkqpYdIU2bq7tvKM976cFFN3f2qcJEALMBEmbiqJROhEmkig5ZAycz3s5c4nK56vSQQhg2wADMUEqESYXCTcWfX/qNnVn6zcSVaCmKoJMAWYeQAFmCqNYUtRYTBTcftnNWbDv68dedqVMZlrQBgA7aAAVgYk3ncRBTcNd189+NVuXlHi7ZpBTh07PQ2sAUMjKX8H0R8ZKB7qhqbOX8tWuNHNJTZI2MmzYPfPKowhq5rDL1E4M0q4w7qRnrGnBxrRdWFQDYVN25ehLlgg21lvXHoJoLJwInjHrz9M9/+5LPmyjLoJmYt/BTm4tZDCkcMYSGCyXjL8tnzlpJZH+QsfmB31PnPge9AB3NgLrZhnigimAyUzrs79xX8s+zLn7LJsgyfs7/esBJ0MAfPZZ5IImRZ/mrt1iO+suwrs1989+thvWVWbYT9fhc9aQUdB6CUVkNpje3SqQPDMgpZZmFO2O+FW+o/niEsyDb8qt7Rd78GLTmucrp80vz/K8AAYAEv1AHM/GwAAAAASUVORK5CYII=";
this._iconViolet = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzFDREU3Mjk3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzFDREU3Mjg3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppb+WxIAAAhcSURBVHjazFoLcFTVGb6vvdnNY0lEEJOIxhCSKTEFKSC1osIgjqIyA62mZfAxWJU+tC3TVh2lHSGhtNOKOqK0ii+0QwcfFB+IAsKIITpJhUBDHhMiSSBCTMgm2d377PnungubnXOT3L0b6rlzmM2e83/n+87/n/+ecxbeNE3OLvLFV3Fui3KiivNSkhmTNb7EpagQQvzxg++VBvxpc2XZN1MUhEJRFHJ5nk9HO5mwAV03OnTDaFYUtTocie66pOymOjSlYnzeq0d2bn02c9oVxXcTAct8PqnYja2qakeJoFdqDx3dNH/xij4vHhGSnYHlSxf5Out3rrjmqqmHglkZa9yKQIENbIEBLGCeT4/wB/f+c1LBpXkvpsm+73IpLFFF/bKltf2esjl3NI005JL1iNBSs23B5MKJe1ItAgWYwCZj3OiWm5vOQmvt9ttzJ4zbLAhCFjdKBdhkjNcwlht+Iw0tof6zrQsKLs19jWShIeM40hASure3S727O0WloV/QehTeSo/ZsilPzjCC11+k5yzM0/yTs4yhcAgvtaW1Y2nJ7MU7yJ/GcKE1EiH8B1ueLrr2+9N3kXQadAIM7f1abK84LEcOnBFFXuREMpk8TyrHx4jhMQ1OJ5x0U+f8s8boeY9MUbLmjNedMEm6Du2rqp17w5KfNTitmRGvkcKCfHnW9NK/O4kwIjp37JdfpDUv+jSgVw+IASHAofpRef/gSttQ0Rc2sAUGq5Axs2ZM+85GcPAaWkLT528/MDF/QiXLWPtG4Rt/tM+v1vSLMi9zPl4iniCVeASeEPjB82QQj8Az8IjOaZxqapxiKpzvygy9aMs1EekCmTnrX7WdfHjSjEUbWCE2Io88cPeSnAkXjV3J9ERY5xuX7PNrNQOin0/j0kiVUQUI8llVSnjs79FHpjawBQawgMkaCxzAJdmsJT50X/ky2ecby5yllTWy+p9+MY2PkYonb60RUuER1udBoixBMgcsYDK3P4QDuIBTMkLSxo+7oNxpYfe80eaLhZPMSSSkUAU8vPWvFVr2QrdimD7xfWw7nzUZMgdMYLPGJFx+DE5uhfCbn1s9JSM9UMJqbF9TJ5O5tNZEooh48o4Lk66fwWJIJZjAZtkQLsVvbFxTapm7ECKWTSmax2oYONgjRKp7RSluYbsRwRITS9cxQcDGGCybKSWF1zuFl5MQeUwwcwaroXtbmyTRWLdFkJekKxGDwo3nz4nB+iEVY7D6Z4/JmgluroSkB/wFrIa+z7rE2DyeWwfJiEhcO2fXD3n69p9mzjrl5EqI5PfLE5hv0qZ+gach4TacRhJmwFaaB5i8KCfJ1RrxSZKfuW3oUflE8l49kvg3xmCeX2KcXK0RMut8yo7BqSqUk+DqPaJpepjpqmyfaSbs30wPx24WFsZww2koIWYkqjDP0PKkDAO7WOuheyevBRgGxQS2XJjO3LZTTqYbIUZvqO84qyFz9lidyohtzenjRYT92LiZsy9kbocpJ8ONEO1UV3cjqyHn1nxNw+6V1tgsJicmdkaJCbDxgJ1zW77G6k85aW6EqF/WNVYzc3lZtuGfGdQ1sgXHVtwW4zbM4sPJ3tYDE9gYg2VDOaluhCiV6zftjypqiNWY92iponKKdZ7QaHUjJl6EbQ8sYOY+Uqo43LCEwAncXHmkuaWtu7H5q09ZjTieZv/kEhWHIpXURDHx6ydxLcT3OSdCsQ5YwAxeyz76ggs4ufUIXNv3/MtbXzfjj5BxZeK6aYpvaoYetUhECRnVqhoNNyvkTIP5WbNOh7H+sAUGsIDpcBFhggs4uV3sVrb79459R052dh1hGgZEs+hfP4hIU9P1iEUmapFSDGWQqPjnLHlDoQKiHGyBASxgssYCB3ABp2QOVmrHyVOn7/3V6tUkPpkvImlsmln83nXh4NJcNWKGuYgRIxcTpcQIx1fynd2OvrCBbfG710WA5bA2wvevrFgDLk5hNZwQAPd9uKfq8Jvbd210BPCL3GVPfS9a+PbVYWF6QA8bEBSrYYgzI1a1Ptvfk4q+l791dRi2Tp5Awdjvf7y/joaV6eWCLpPUy6p2vPTElWUl84bLSOH6XqHn3Xapd9fXotLUJ+jdmrUBFHMkU56UaQTnkkRxc54WKAkaw2HVHjr60awb7nycfDxGhXi6oIPXsoNZGUUHdry8rrAgf9r52CCSDFU7a8Gdv+sN9eNyrsdpkbu5xAZALwE8NueW5Y8drm+uGm0R/21oOYCxyJgtGHuoK1O3l9jYFnxzqqunYcb8ZauIy/eMlghgT5+3dBXGwphOWxIvt/HIGKfJVrr5xh/+/E9tHZ31qRYBzIXlD64jY+D3kSGzlBchZz3TfSbUvPiu3z7W1X2mPVUigAVM4okmN55IVshZMSQEjtz364pV4Ui016sIghECFjCTEZGsEI5u3E5t++CTz9c+uWktCQU1WRGwJRiVwAKm06ZwtIRYL11SOyvXv/ThC5vfWW/iaOf2PEJsYAsMYFFM7nwLwQsIW5cTv/j9uq07PzmwxS3AR3urt8AWGBTL/H8IscX04zp4YflDG0iM73aRZnfffMeD+M2jnWJ4Ovx7FYI3K0IKB7Dj8xevqGxpbT80nE3r8RN16Asbamt45eFZCBWDw1AP3v7lP330j0OlZbTdvvzhP6Av3XroqeCQEiFUjJWWaw7WH7n/N5WP9w+EuxP74Du0oQ/6UhvuWyWEikHqPP3O+3u+eOIv/6iIT8v4XPG3F9eiDX1oX+5bKSQ+Lf91w+bddlq20+yfn3n1Y69p1qmk/H6XzLRJjgNIpR1IrfkXj7+Q4zkzPs2iT8rvhUfrP54RLHgbv82Ps+/XsCWnWc7TmKzx/yfAAHo1CtU9myPWAAAAAElFTkSuQmCC";
this._measureTempPoints = [];
}
_updateScene() {
this._viewer.scene.requestRender();
}
_removeEntityByName(entityName) {
let entities2 = this._entities;
if (!entities2 || !entities2.values)
return;
let delEntitys = [];
for (let i2 = 0; i2 < entities2.values.length; i2++) {
if (entities2.values[i2].name == entityName) {
delEntitys.push(entities2.values[i2]);
}
}
for (let i2 = 0; i2 < delEntitys.length; i2++) {
entities2.remove(delEntitys[i2]);
}
this._updateScene();
}
_clear(isAll) {
if (isAll != void 0 && isAll === true) {
this._removeEntityByName(this._measureEntityName);
if (this._sketchViewModel != void 0) {
this._sketchViewModel.sketchClear();
}
}
this._measureTempPoints = [];
this._altitudeDynamicLabel = void 0;
this._tooltipRemove();
let buttonDiv = document.getElementById("drawButtonDiv");
if (buttonDiv) {
document.body.removeChild(buttonDiv);
}
}
_toColor(red, green, blue, alpha) {
return new Cesium.Color(red / 255, green / 255, blue / 255, alpha);
}
_cartesianToGeography(cartesian) {
let ellipsoid = Cesium.Ellipsoid.WGS84;
let cartographic = ellipsoid.cartesianToCartographic(cartesian);
let latitude = Cesium.Math.toDegrees(cartographic.latitude);
let longitude = Cesium.Math.toDegrees(cartographic.longitude);
let altitude = cartographic.height;
return {
lon: longitude,
lat: latitude,
hei: altitude
};
}
_createPoint(coord, label) {
let _self = this;
let entity = new Cesium.Entity({
name: _self._measureEntityName,
position: coord,
billboard: {
image: _self._iconBlue,
horizontalOrigin: Cesium.HorizontalOrigin.center,
verticalOrigin: Cesium.VerticalOrigin.bottom,
scale: 0.5,
pixelOffset: new Cesium.Cartesian2(0, -11),
disableDepthTestDistance: Number.POSITIVE_INFINITY
}
});
if (label) {
entity.label = {
text: label,
font: "30px SimHei",
scale: 0.5,
fillColor: this._toColor(255, 255, 255, 1),
outlineColor: this._toColor(14, 30, 79, 1),
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
outlineWidth: 2,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
showBackground: true,
backgroundColor: _self._toColor(0, 0, 0, 0.6),
disableDepthTestDistance: Number.POSITIVE_INFINITY,
pixelOffset: new Cesium.Cartesian2(0, -28)
};
}
this._entities.add(entity);
this._updateScene();
return entity;
}
_createLabel(coord, label) {
let _self = this;
let entity = new Cesium.Entity({
name: _self._measureEntityName,
position: coord,
label: {
text: label,
font: "30px SimHei",
scale: 0.5,
fillColor: this._toColor(255, 255, 255, 1),
outlineColor: this._toColor(14, 30, 79, 1),
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
outlineWidth: 2,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
showBackground: true,
backgroundColor: _self._toColor(0, 0, 0, 0.6),
disableDepthTestDistance: Number.POSITIVE_INFINITY,
pixelOffset: new Cesium.Cartesian2(0, -14)
}
});
this._entities.add(entity);
this._updateScene();
}
_createAltitudeDynamicLabel() {
let _self = this;
this._altitudeDynamicLabel = new Cesium.Entity({
name: _self._measureEntityName,
position: new Cesium.CallbackProperty(function() {
return _self._altitudeLabelPosition;
}, false),
label: {
text: new Cesium.CallbackProperty(function() {
return _self._altitudeLabelText;
}, false),
font: "12px sans-serif",
fillColor: this._toColor(255, 255, 255, 1),
outlineColor: this._toColor(0, 154, 94, 1),
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
outlineWidth: 1,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
pixelOffset: new Cesium.Cartesian2(0, -28),
showBackground: true,
backgroundColor: this._toColor(0, 0, 0, 0.6),
disableDepthTestDistance: Number.POSITIVE_INFINITY
}
});
this._entities.add(this._altitudeDynamicLabel);
this._updateScene();
}
_measureDistance(positions) {
let distance2 = 0;
for (let i2 = 0; i2 < positions.length - 1; i2++) {
let point1cartographic = Cesium.Cartographic.fromCartesian(positions[i2]);
let point2cartographic = Cesium.Cartographic.fromCartesian(positions[i2 + 1]);
let geodesic = new Cesium.EllipsoidGeodesic();
geodesic.setEndPoints(point1cartographic, point2cartographic);
let s = geodesic.surfaceDistance;
s = Math.sqrt(Math.pow(s, 2) + Math.pow(
point2cartographic.height - point1cartographic.height,
2
));
distance2 = distance2 + s;
}
if (distance2 < 1e3)
return distance2.toFixed(2) + "\u7C73";
else
return (distance2 / 1e3).toFixed(2) + "\u516C\u91CC";
}
_measureSpaceDistance(positions) {
let distance2 = 0;
for (let i2 = 0; i2 < positions.length - 1; i2++) {
let point1 = positions[i2];
let point2 = positions[i2 + 1];
let sx = Math.abs(point1.x - point2.x);
let sy = Math.abs(point1.y - point2.y);
let sz = Math.abs(point1.z - point2.z);
let s = Math.sqrt(Math.pow(sx, 2) + Math.pow(sy, 2) + Math.pow(sz, 2));
distance2 = distance2 + s;
}
if (distance2 < 1e3)
return distance2.toFixed(2) + "\u7C73";
else
return (distance2 / 1e3).toFixed(2) + "\u516C\u91CC";
}
_measureAreaBearing(from3, to) {
let radiansPerDegree = Math.PI / 180;
let degreesPerRadian = 180 / Math.PI;
let lat1 = from3.lat * radiansPerDegree;
let lon1 = from3.lon * radiansPerDegree;
let lat2 = to.lat * radiansPerDegree;
let lon2 = to.lon * radiansPerDegree;
let angle = -Math.atan2(Math.sin(lon1 - lon2) * Math.cos(lat2), Math.cos(lat1) * Math.sin(
lat2
) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon1 - lon2));
if (angle < 0) {
angle += Math.PI * 2;
}
angle = angle * degreesPerRadian;
return angle;
}
_calculateAreaAngle(p1, p2, p3) {
let bearing21 = this._measureAreaBearing(p2, p1);
let bearing23 = this._measureAreaBearing(p2, p3);
let angle = bearing21 - bearing23;
if (angle < 0) {
angle += 360;
}
return angle;
}
_calculateDistance(point1, point2) {
let point1cartographic = Cesium.Cartographic.fromCartesian(point1);
let point2cartographic = Cesium.Cartographic.fromCartesian(point2);
let geodesic = new Cesium.EllipsoidGeodesic();
geodesic.setEndPoints(point1cartographic, point2cartographic);
let s = geodesic.surfaceDistance;
s = Math.sqrt(Math.pow(s, 2) + Math.pow(point2cartographic.height - point1cartographic.height, 2));
return s;
}
_measureArea(points2, cartesianPoints) {
let self2 = this;
let res = 0;
for (let i2 = 0; i2 < points2.length - 2; i2++) {
let j = (i2 + 1) % points2.length;
let k = (i2 + 2) % points2.length;
let totalAngle = self2._calculateAreaAngle(points2[i2], points2[j], points2[k]);
let dis_temp1 = self2._calculateDistance(cartesianPoints[i2], cartesianPoints[j]);
let dis_temp2 = self2._calculateDistance(cartesianPoints[j], cartesianPoints[k]);
res += dis_temp1 * dis_temp2 * Math.abs(Math.sin(totalAngle));
}
return res;
}
_calculatePolylineAltitudeHeight(points2) {
if (points2 === void 0 || points2.length < 2)
return -1;
let cartographic = Cesium.Cartographic.fromCartesian(points2[0]);
let cartographic1 = Cesium.Cartographic.fromCartesian(points2[1]);
let height_temp = cartographic1.height - cartographic.height;
return Math.abs(height_temp).toFixed(2) + "\u7C73";
}
_setMousePointerStyle() {
document.querySelector("body").style.cursor = "crosshair";
}
_initMousePointerStyle() {
document.querySelector("body").style.cursor = "default";
}
_checkAppOrWeb() {
if (window.navigator.userAgent.match(
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
)) {
return CommonTools.RuntimeEnvironment.App;
} else {
return CommonTools.RuntimeEnvironment.Web;
}
}
_isRuntimeApp() {
if (this._checkAppOrWeb() === CommonTools.RuntimeEnvironment.App) {
return true;
}
return false;
}
_isRuntimeWeb() {
if (this._checkAppOrWeb() === CommonTools.RuntimeEnvironment.Web) {
return true;
}
return false;
}
_createOperationMainDom() {
let buttonDiv = document.createElement("div");
buttonDiv.id = "drawButtonDiv";
buttonDiv.style.width = "80px";
buttonDiv.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
buttonDiv.style.borderRadius = "5px";
buttonDiv.style.display = "flex";
buttonDiv.style.flexDirection = "column";
buttonDiv.style.padding = "8px";
buttonDiv.style.justifyContent = "center";
buttonDiv.style.position = "absolute";
buttonDiv.style.bottom = "150px";
buttonDiv.style.right = "10px";
let btnUndo = document.createElement("button");
btnUndo.id = "btnDrawBackout";
btnUndo.style.height = "30px";
btnUndo.style.marginBottom = "8px";
btnUndo.style.backgroundColor = "rgba(52, 137, 255, 1.0)";
btnUndo.style.color = "rgb(255, 255, 255)";
btnUndo.style.border = "0px solid red";
btnUndo.style.borderRadius = "5px";
btnUndo.innerHTML = "\u56DE\u9000";
btnUndo.style.fontSize = "13px";
btnUndo.style.cursor = "pointer";
buttonDiv.appendChild(btnUndo);
let btnCompletion = document.createElement("button");
btnCompletion.id = "btnDrawComplete";
btnCompletion.style.height = "30px";
btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
btnCompletion.style.color = "rgb(255, 255, 255)";
btnCompletion.style.border = "0px solid red";
btnCompletion.style.borderRadius = "5px";
btnCompletion.innerHTML = "\u5B8C\u6210";
btnCompletion.style.fontSize = "13px";
btnCompletion.style.cursor = "pointer";
buttonDiv.appendChild(btnCompletion);
document.body.appendChild(buttonDiv);
}
_showTooltipMessage(message) {
let msgMainDom = document.getElementById("messageMainDom");
if (msgMainDom !== null && msgMainDom !== void 0) {
document.body.removeChild(msgMainDom);
}
msgMainDom = document.createElement("div");
msgMainDom.style.width = "30%";
msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
msgMainDom.style.height = "45px";
msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
msgMainDom.style.borderRadius = "8px";
msgMainDom.style.display = "flex";
msgMainDom.style.alignItems = "center";
msgMainDom.style.paddingLeft = "10px";
msgMainDom.style.color = "rgb(91, 188, 48)";
msgMainDom.style.fontSize = "14px";
msgMainDom.style.fontWeight = "600";
msgMainDom.style.position = "absolute";
msgMainDom.style.left = "35%";
msgMainDom.style.transition = "transform 1s";
msgMainDom.style.transform = "translateY(-90px)";
msgMainDom.style.top = "0px";
msgMainDom.style.zIndex = 1e3;
document.body.appendChild(msgMainDom);
let strHtml = "";
strHtml += "✓
";
strHtml += "" + message + "
";
msgMainDom.innerHTML = strHtml;
msgMainDom.addEventListener("transitionend", function() {
setTimeout(function() {
document.body.removeChild(msgMainDom);
}, 1e3);
}, false);
setTimeout(function() {
msgMainDom.style.transform = "translateY(50px)";
}, 100);
}
}
Object.assign(CommonTools.prototype, {
_tooltipInit: function(text) {
this._tooltipId = "tooltipJt";
let tooltipObj = document.getElementById(this._tooltipId);
if (tooltipObj === null) {
tooltipObj = document.createElement("div");
tooltipObj.id = this._tooltipId;
document.body.appendChild(tooltipObj);
let divStyle = "";
divStyle += "top: 30px;";
divStyle += "left: 30px;";
divStyle += "position: absolute;";
divStyle += "display: flex;";
divStyle += "align-items: center;";
divStyle += "width: 12x0px;";
divStyle += "height: auto;";
divStyle += "background-color: rgba(0, 0, 0, 0.65);";
divStyle += "border-radius: 5px;";
divStyle += "color: rgb(255, 255, 255);";
divStyle += "font-size: 12px;";
divStyle += "font-family: 'Alimama_ShuHeiTi_Bold';";
divStyle += "padding: 8px;";
divStyle += "border:solid 1px rgb(255,0,0);";
tooltipObj.setAttribute("style", divStyle);
}
if (text != void 0)
tooltipObj.innerHTML = text;
document.onmousemove = function(event2) {
tooltipObj.style.left = event2.clientX + 10 + "px";
tooltipObj.style.top = event2.clientY - tooltipObj.offsetHeight / 2 + "px";
};
},
_tooltipRemove: function() {
let tooltipObj = document.getElementById(this._tooltipId);
if (tooltipObj != null) {
document.body.removeChild(tooltipObj);
}
},
_tooltipSetText: function(text) {
let tooltipObj = document.getElementById(this._tooltipId);
if (tooltipObj != null) {
tooltipObj.innerHTML = text;
}
}
});
Object.assign(CommonTools.prototype, {
clear: function() {
this._clear(true);
this._initMousePointerStyle();
}
});
Object.assign(CommonTools.prototype, {
measureLength: function(callError) {
let _self = this;
this._tempEntitys = [];
this._clear(this._isClear);
this._setMousePointerStyle();
if (this._isRuntimeApp()) {
this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
} else {
this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
}
if (this._isRuntimeWeb()) {
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
onAdded: function(cPoints, gPoints) {
if (cPoints.length === 1) {
_self._createPoint(cPoints[0], "\u8D77\u70B9");
} else {
let distince = _self._measureDistance(cPoints);
let tempPoints = [cPoints[cPoints.length - 2], cPoints[cPoints.length - 1]];
distince += " +" + _self._measureDistance(tempPoints);
_self._tempEntitys.push(_self._createPoint(
cPoints[cPoints.length - 1],
distince
));
}
},
onUndo: function() {
_self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
_self._tempEntitys.pop();
},
onMoving: function(cPoint, scPoint) {
_self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000
\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
},
onError: function(error) {
if (callError)
callError(error);
},
onComplete: function(cPoints, gPoints) {
_self._initMousePointerStyle();
_self._tooltipRemove();
}
});
} else {
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
onAdded: function(cPoints, gPoints) {
if (cPoints.length === 1) {
_self._tooltipRemove();
_self._createPoint(cPoints[0], "\u8D77\u70B9");
let buttonDiv = document.getElementById("drawButtonDiv");
if (buttonDiv == null) {
_self._createOperationMainDom();
document.getElementById("btnDrawBackout").onclick = () => {
if (_self._sketchViewModel._sketchTempPoints.length > 2) {
_self._sketchViewModel._sketchPoints.pop();
_self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
if (_self._sketchViewModel._isDrawPoint) {
let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
_self._sketchViewModel._entities.remove(lastPointEntity);
_self._sketchViewModel._pointEntitys.pop();
}
_self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
_self._tempEntitys.pop();
}
};
document.getElementById("btnDrawComplete").onclick = () => {
if (_self._sketchViewModel._sketchPoints.length < 2) {
if (callError)
callError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
return;
}
_self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
_self._sketchViewModel._createPolyline();
if (!_self._sketchViewModel._isRetainDrawPoint)
_self._sketchViewModel._removePointEntitys();
_self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
_self._initMousePointerStyle();
_self._tooltipRemove();
let buttonDiv2 = document.getElementById("drawButtonDiv");
if (buttonDiv2) {
document.body.removeChild(buttonDiv2);
}
};
}
} else {
let distince = _self._measureDistance(cPoints);
let tempPoints = [cPoints[cPoints.length - 2], cPoints[cPoints.length - 1]];
distince += " +" + _self._measureDistance(tempPoints);
_self._tempEntitys.push(_self._createPoint(cPoints[cPoints.length - 1], distince));
}
}
});
}
},
measureSpatialLength: function(callError) {
let _self = this;
this._clear(this._isClear);
this._setMousePointerStyle();
if (this._isRuntimeApp()) {
this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
} else {
this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
}
this._tempEntitys = [];
if (this._isRuntimeWeb()) {
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Spatial, {
onAdded: function(cPoints, gPoints) {
if (cPoints.length === 1) {
_self._createPoint(cPoints[0], "\u8D77\u70B9");
} else {
let distince = _self._measureSpaceDistance(cPoints);
_self._tempEntitys.push(_self._createPoint(
cPoints[cPoints.length - 1],
distince
));
}
},
onUndo: function() {
_self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
_self._tempEntitys.pop();
},
onMoving: function(cPoint, scPoint) {
_self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000
\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
},
onError: function(error) {
if (callError)
callError(error);
},
onComplete: function(cPoints, gPoints) {
_self._initMousePointerStyle();
_self._tooltipRemove();
}
});
} else {
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Spatial, {
onAdded: function(cPoints, gPoints) {
if (cPoints.length === 1) {
_self._tooltipRemove();
_self._createPoint(cPoints[0], "\u8D77\u70B9");
let buttonDiv = document.getElementById("drawButtonDiv");
if (buttonDiv == null) {
_self._createOperationMainDom();
document.getElementById("btnDrawBackout").onclick = () => {
if (_self._sketchViewModel._sketchTempPoints.length > 2) {
_self._sketchViewModel._sketchPoints.pop();
_self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
_self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
_self._tempEntitys.pop();
}
};
document.getElementById("btnDrawComplete").onclick = () => {
if (_self._sketchViewModel._sketchPoints.length < 2) {
if (callError)
callError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
return;
}
_self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempSpatialPolyline);
_self._sketchViewModel._createSpatialPolyline();
_self._sketchViewModel._removePointEntitys();
_self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
_self._initMousePointerStyle();
_self._tooltipRemove();
let buttonDiv2 = document.getElementById("drawButtonDiv");
if (buttonDiv2) {
document.body.removeChild(buttonDiv2);
}
};
}
} else {
let distince = _self._measureSpaceDistance(cPoints);
_self._tempEntitys.push(_self._createPoint(cPoints[cPoints.length - 1], distince));
}
}
});
}
},
measureArea: function(callError) {
let _self = this;
this._clear(this._isClear);
this._setMousePointerStyle();
if (this._isRuntimeApp()) {
this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
} else {
this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
}
var _areaLabel = "";
if (this._isRuntimeWeb()) {
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
onAdded: function(cPoints, gPoints) {
_self._measureTempPoints.push(_self._cartesianToGeography(cPoints[cPoints.length - 1]));
if (cPoints.length === 1) {
_areaLabel = "\u8D77\u70B9";
_self._createPoint(cPoints[0], new Cesium.CallbackProperty(function() {
var lable = _areaLabel;
return lable;
}, false));
} else if (cPoints.length >= 3) {
let area = _self._measureArea(_self._measureTempPoints, cPoints);
if (area > 1e5) {
_areaLabel = (area / 1e5).toFixed(2) + "km\xB2";
} else {
_areaLabel = area.toFixed(2) + "m\xB2";
}
}
},
onUndo: function() {
_self._measureTempPoints.pop();
if (_self._measureTempPoints.length === 1)
_self._areaLabel = "\u8D77\u70B9";
},
onMoving: function(cPoint, scPoint) {
_self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000
\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
},
onError: function(error) {
if (callError)
callError(error);
},
onComplete: function(cPoints, gPoints) {
_self._initMousePointerStyle();
_self._tooltipRemove();
}
});
} else {
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
onAdded: function(cPoints, gPoints) {
_self._measureTempPoints.push(_self._cartesianToGeography(cPoints[cPoints.length - 1]));
if (cPoints.length === 1) {
_self._tooltipRemove();
_areaLabel = "\u8D77\u70B9";
_self._createPoint(cPoints[0], new Cesium.CallbackProperty(function() {
var lable = _areaLabel;
return lable;
}, false));
let buttonDiv = document.getElementById("drawButtonDiv");
if (buttonDiv == null) {
_self._createOperationMainDom();
document.getElementById("btnDrawBackout").onclick = () => {
if (_self._sketchViewModel._sketchTempPoints.length > 2) {
_self._sketchViewModel._sketchPoints.pop();
_self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
if (_self._sketchViewModel._isDrawPoint) {
let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
_self._entities.remove(lastPointEntity);
_self._sketchViewModel._pointEntitys.pop();
}
_self._measureTempPoints.pop();
if (_self._measureTempPoints.length === 1)
_self._areaLabel = "\u8D77\u70B9";
}
};
document.getElementById("btnDrawComplete").onclick = () => {
if (_self._sketchViewModel._sketchPoints.length < 3) {
if (callError)
callError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
return;
}
_self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolygon);
_self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
_self._sketchViewModel._createPolygon();
if (!_self._sketchViewModel._isRetainDrawPoint)
_self._sketchViewModel._removePointEntitys();
_self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
_self._initMousePointerStyle();
_self._tooltipRemove();
let buttonDiv2 = document.getElementById("drawButtonDiv");
if (buttonDiv2) {
document.body.removeChild(buttonDiv2);
}
};
}
} else if (cPoints.length >= 3) {
let area = _self._measureArea(_self._measureTempPoints, cPoints);
if (area > 1e5) {
_areaLabel = (area / 1e5).toFixed(2) + "km\xB2";
} else {
_areaLabel = area.toFixed(2) + "m\xB2";
}
}
}
});
}
},
measureHeight: function(callError) {
let _self = this;
this._clear(this._isClear);
this._setMousePointerStyle();
if (this._isRuntimeApp()) {
this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
} else {
this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
}
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Height, {
onAdded: function(cPoint) {
if (_self._isRuntimeApp()) {
_self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u6D4B\u91CF");
} else {
_self._tooltipSetText("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u6D4B\u91CF");
}
},
onMoving: function(cPoints, centerPoint) {
let height2 = _self._calculatePolylineAltitudeHeight(cPoints);
_self._altitudeLabelPosition = centerPoint;
_self._altitudeLabelText = height2;
if (_self._altitudeDynamicLabel === void 0) {
_self._createAltitudeDynamicLabel();
}
},
onError: function(error) {
if (callError)
callError(error);
},
onComplete: function(cPoints, centerPoint) {
let height2 = _self._calculatePolylineAltitudeHeight(cPoints);
_self._entities.remove(_self._altitudeDynamicLabel);
_self._createLabel(centerPoint, height2);
_self._initMousePointerStyle();
_self._tooltipRemove();
}
});
},
measureTriangle: function(callError) {
let _self = this;
this._clear(this._isClear);
this._setMousePointerStyle();
if (this._isRuntimeApp()) {
this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
} else {
this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
}
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Triangle, {
onAdded: function(cPoint) {
if (_self._isRuntimeApp()) {
_self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u6D4B\u91CF");
} else {
_self._tooltipSetText("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u6D4B\u91CF");
}
},
onMoving: function(cPoint) {
_self._tooltipSetText("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u6D4B\u91CF");
},
onError: function(error) {
if (callError)
callError(error);
},
onComplete: function(positions) {
_self._initMousePointerStyle();
_self._tooltipRemove();
let sPoints = [positions[0], positions[1]];
let sDistince = _self._measureSpaceDistance(sPoints);
let hPoints = [positions[1], positions[2]];
let hDistince = _self._measureSpaceDistance(hPoints);
let hePoints = [positions[2], positions[0]];
let height2 = _self._calculatePolylineAltitudeHeight(hePoints);
_self._createLabel(positions[0], "\u659C\u8DDD:" + sDistince);
_self._createLabel(positions[1], "\u5E73\u8DDD:" + hDistince);
_self._createLabel(positions[2], "\u9AD8\u5EA6:" + height2);
}
});
}
});
Object.assign(CommonTools.prototype, {
queryByPoint: function(callComplete) {
let _self = this;
this._setMousePointerStyle();
this._clear(this._isClear);
if (this._isRuntimeApp()) {
this._showTooltipMessage("\u70B9\u51FB\u4F4D\u7F6E\u8FDB\u884C\u67E5\u8BE2");
} else {
this._tooltipInit("\u5355\u51FB\u4F4D\u7F6E\u8FDB\u884C\u67E5\u8BE2");
}
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Point, {
onComplete: function(cPoint, gPoint) {
_self._initMousePointerStyle();
_self._tooltipRemove();
_self._createPoint(cPoint);
let coordinates = gPoint.lng + "," + gPoint.lat;
if (callComplete)
callComplete(coordinates);
}
});
},
queryByMultiplePoint: function(callComplete) {
let _self = this;
this._setMousePointerStyle();
this._clear(this._isClear);
this._tooltipInit("\u70B9\u51FB\u4F4D\u7F6E\u7ED8\u5236
\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
this._tempEntitys = [];
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.MultiplePoint, {
onAdded: function(cPoint, gPoint) {
let res = gPoint.lng.toFixed(6) + "," + gPoint.lat.toFixed(6);
_self._tempEntitys.push(_self._createPoint(cPoint, res));
},
onUndo: function() {
_self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
_self._tempEntitys.pop();
},
onComplete: function(cPoints, gPoints) {
_self._initMousePointerStyle();
_self._tooltipRemove();
let res = [];
for (let i2 = 0; i2 < gPoints.length; i2++) {
res.push(gPoints[i2].lng);
res.push(gPoints[i2].lat);
}
if (callComplete)
callComplete(res);
}
});
},
queryByLine: function(callComplete, callError) {
let _self = this;
this._clear(this._isClear);
this._setMousePointerStyle();
if (this._isRuntimeApp()) {
this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
} else {
this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
}
if (this._isRuntimeWeb()) {
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
onAdded: function(cPoints, gPoints) {
},
onMoving: function(cPoint, scPoint) {
_self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000
\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236\u5F00\u59CB\u67E5\u8BE2");
},
onError: function(error) {
if (callError)
callError(error);
},
onComplete: function(cPoints, gPoints) {
_self._initMousePointerStyle();
_self._tooltipRemove();
let coordinates = void 0;
for (let i2 = 0; i2 < gPoints.length; i2++) {
let point2 = gPoints[i2];
if (coordinates === void 0)
coordinates = point2.lng + "," + point2.lat;
else
coordinates += "," + point2.lng + "," + point2.lat;
}
if (callComplete)
callComplete(coordinates);
}
});
} else {
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
onAdded: function(cPoints, gPoints) {
if (cPoints.length === 1) {
_self._tooltipRemove();
let buttonDiv = document.getElementById("drawButtonDiv");
if (buttonDiv == null) {
_self._createOperationMainDom();
document.getElementById("btnDrawBackout").onclick = () => {
if (_self._sketchViewModel._sketchTempPoints.length > 2) {
_self._sketchViewModel._sketchPoints.pop();
_self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
if (_self._sketchViewModel._isDrawPoint) {
let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
_self._sketchViewModel._entities.remove(lastPointEntity);
_self._sketchViewModel._pointEntitys.pop();
}
}
};
document.getElementById("btnDrawComplete").onclick = () => {
if (_self._sketchViewModel._sketchPoints.length < 2) {
if (callError)
callError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
return;
}
_self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
_self._sketchViewModel._createPolyline();
if (!_self._sketchViewModel._isRetainDrawPoint)
_self._sketchViewModel._removePointEntitys();
_self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
_self._initMousePointerStyle();
_self._tooltipRemove();
let coordinates = void 0;
for (let i2 = 0; i2 < gPoints.length; i2++) {
let point2 = gPoints[i2];
if (coordinates === void 0)
coordinates = point2.lng + "," + point2.lat;
else
coordinates += "," + point2.lng + "," + point2.lat;
}
let buttonDiv2 = document.getElementById("drawButtonDiv");
if (buttonDiv2) {
document.body.removeChild(buttonDiv2);
}
if (callComplete)
callComplete(coordinates);
};
}
}
}
});
}
},
queryByPolygon: function(callComplete, callError) {
let _self = this;
this._clear(this._isClear);
this._setMousePointerStyle();
if (this._isRuntimeApp()) {
this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u533A\u57DF");
} else {
this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u533A\u57DF");
}
if (this._isRuntimeWeb()) {
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
onMoving: function(cPoint, scPoint) {
_self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000
\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236\u5F00\u59CB\u67E5\u8BE2");
},
onError: function(error) {
if (callError)
callError(error);
},
onComplete: function(cPoints, gPoints) {
_self._initMousePointerStyle();
_self._tooltipRemove();
let coordinates = void 0;
for (let i2 = 0; i2 < gPoints.length; i2++) {
let point2 = gPoints[i2];
if (coordinates === void 0)
coordinates = point2.lng + "," + point2.lat;
else
coordinates += "," + point2.lng + "," + point2.lat;
}
coordinates += "," + gPoints[0].lng + "," + gPoints[0].lat;
if (callComplete)
callComplete(coordinates);
}
});
} else {
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
onAdded: function(cPoints, gPoints) {
if (cPoints.length === 1) {
_self._tooltipRemove();
let buttonDiv = document.getElementById("drawButtonDiv");
if (buttonDiv == null) {
_self._createOperationMainDom();
document.getElementById("btnDrawBackout").onclick = () => {
if (_self._sketchViewModel._sketchTempPoints.length > 2) {
_self._sketchViewModel._sketchPoints.pop();
_self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
if (_self._sketchViewModel._isDrawPoint) {
let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
_self._entities.remove(lastPointEntity);
_self._sketchViewModel._pointEntitys.pop();
}
}
};
document.getElementById("btnDrawComplete").onclick = () => {
if (_self._sketchViewModel._sketchPoints.length < 3) {
if (callError)
callError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
return;
}
_self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolygon);
_self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
_self._sketchViewModel._createPolygon();
if (!_self._sketchViewModel._isRetainDrawPoint)
_self._sketchViewModel._removePointEntitys();
_self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
_self._initMousePointerStyle();
_self._tooltipRemove();
let coordinates = void 0;
for (let i2 = 0; i2 < gPoints.length; i2++) {
let point2 = gPoints[i2];
if (coordinates === void 0)
coordinates = point2.lng + "," + point2.lat;
else
coordinates += "," + point2.lng + "," + point2.lat;
}
coordinates += "," + gPoints[0].lng + "," + gPoints[0].lat;
let buttonDiv2 = document.getElementById("drawButtonDiv");
if (buttonDiv2) {
document.body.removeChild(buttonDiv2);
}
if (callComplete)
callComplete(coordinates);
};
}
}
}
});
}
},
queryByCircle: function(callComplete) {
let _self = this;
this._clear(this._isClear);
this._setMousePointerStyle();
if (this._isRuntimeApp()) {
this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u5706");
} else {
this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u5706");
}
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Circle, {
onAdded: function(center2) {
if (_self._isRuntimeApp()) {
_self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u7ED8\u5236");
} else {
_self._tooltipInit("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236");
}
},
onComplete: function(center2, radius) {
_self._initMousePointerStyle();
_self._tooltipRemove();
if (callComplete)
callComplete(center2.lng + "," + center2.lat, radius);
}
});
},
queryByRectangle: function(callComplete) {
let _self = this;
this._clear(this._isClear);
this._setMousePointerStyle();
if (this._isRuntimeApp()) {
this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u77E9\u5F62");
} else {
this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u77E9\u5F62");
}
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Rectangle, {
onAdded: function(center2) {
if (_self._isRuntimeApp()) {
_self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u7ED8\u5236");
} else {
_self._tooltipInit("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236");
}
},
onComplete: function(gPoints) {
_self._initMousePointerStyle();
_self._tooltipRemove();
let coordinates = void 0;
for (let i2 = 0; i2 < gPoints.length; i2++) {
let point2 = gPoints[i2];
if (coordinates === void 0)
coordinates = point2.lng + "," + point2.lat;
else
coordinates += "," + point2.lng + "," + point2.lat;
}
if (callComplete)
callComplete(coordinates);
}
});
}
});
Object.assign(CommonTools.prototype, {
drawPolygonBody: function(callComplete) {
let _self = this;
this._clear(this._isClear);
this._setMousePointerStyle();
this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
this._sketchViewModel.sketchTools(SketchViewModel.SketchType.PolygonBody, {
onAdded: function(cPoints, gPoints) {
if (cPoints.length === 0) {
_self._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
} else if (cPoints.length < 3) {
_self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000");
} else {
_self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000
\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
}
},
onUndo: function(cPoints) {
if (cPoints.length === 0) {
_self._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
} else if (cPoints.length < 3) {
_self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000");
} else {
_self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000
\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
}
},
onComplete: function(cPoints, gPoints) {
_self._initMousePointerStyle();
_self._tooltipRemove();
if (callComplete)
callComplete();
}
});
},
drawPointFeacture: function(points2, options2) {
this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawPoint, options2);
},
drawMultiplePointFeacture: function(points2, options2) {
this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawMultiplePoint, options2);
},
drawPolylineFeacture: function(points2, options2) {
this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawPolyline, options2);
},
drawPolygonFeacture: function(points2, options2) {
this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawPolygon, options2);
}
});
Object.assign(CommonTools.prototype, {
tooltipInit: function(text) {
this._tooltipInit(text);
},
tooltipRemove: function() {
this._tooltipRemove();
},
tooltipSetText: function(text) {
this._tooltipSetText(text);
}
});
Object.assign(CommonTools.prototype, {
pickPolygonBody: function(callComplete) {
this._sketchViewModel.sketchPick(function(options2) {
if (options2 === void 0) {
if (callComplete)
callComplete(void 0);
} else {
if (callComplete)
callComplete({
color: options2.color,
height: options2.height
});
}
});
},
setPolygonBody: function(options2) {
this._sketchViewModel.sketchEditPickPolygonBody({
color: options2.color,
height: options2.height,
onComplete: options2.onComplete
});
},
removePolygonBody: function(onComplete) {
this._sketchViewModel.sketchRemovePickPolygonBody(onComplete);
}
});
CommonTools.RuntimeEnvironment = Object.freeze({
App: "app",
Web: "web"
});
const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
const handleEvent = (event2) => {
const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event2);
if (checkForDefaultPrevented === false || !shouldPrevent) {
return oursHandler == null ? void 0 : oursHandler(event2);
}
};
return handleEvent;
};
var _a;
const isClient = typeof window !== "undefined";
const isString$1 = (val) => typeof val === "string";
const noop$3 = () => {
};
const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function resolveUnref(r2) {
return typeof r2 === "function" ? r2() : unref(r2);
}
function identity(arg) {
return arg;
}
function tryOnScopeDispose(fn2) {
if (getCurrentScope()) {
onScopeDispose(fn2);
return true;
}
return false;
}
function tryOnMounted(fn2, sync = true) {
if (getCurrentInstance())
onMounted(fn2);
else if (sync)
fn2();
else
nextTick(fn2);
}
function useTimeoutFn(cb, interval, options2 = {}) {
const {
immediate = true
} = options2;
const isPending = ref(false);
let timer = null;
function clear() {
if (timer) {
clearTimeout(timer);
timer = null;
}
}
function stop() {
isPending.value = false;
clear();
}
function start2(...args) {
clear();
isPending.value = true;
timer = setTimeout(() => {
isPending.value = false;
timer = null;
cb(...args);
}, resolveUnref(interval));
}
if (immediate) {
isPending.value = true;
if (isClient)
start2();
}
tryOnScopeDispose(stop);
return {
isPending: readonly(isPending),
start: start2,
stop
};
}
function unrefElement(elRef) {
var _a2;
const plain = resolveUnref(elRef);
return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
}
const defaultWindow = isClient ? window : void 0;
function useEventListener(...args) {
let target;
let events;
let listeners;
let options2;
if (isString$1(args[0]) || Array.isArray(args[0])) {
[events, listeners, options2] = args;
target = defaultWindow;
} else {
[target, events, listeners, options2] = args;
}
if (!target)
return noop$3;
if (!Array.isArray(events))
events = [events];
if (!Array.isArray(listeners))
listeners = [listeners];
const cleanups = [];
const cleanup = () => {
cleanups.forEach((fn2) => fn2());
cleanups.length = 0;
};
const register = (el, event2, listener, options22) => {
el.addEventListener(event2, listener, options22);
return () => el.removeEventListener(event2, listener, options22);
};
const stopWatch = watch(() => [unrefElement(target), resolveUnref(options2)], ([el, options22]) => {
cleanup();
if (!el)
return;
cleanups.push(...events.flatMap((event2) => {
return listeners.map((listener) => register(el, event2, listener, options22));
}));
}, { immediate: true, flush: "post" });
const stop = () => {
stopWatch();
cleanup();
};
tryOnScopeDispose(stop);
return stop;
}
let _iOSWorkaround = false;
function onClickOutside(target, handler, options2 = {}) {
const { window: window2 = defaultWindow, ignore = [], capture = true, detectIframe = false } = options2;
if (!window2)
return;
if (isIOS && !_iOSWorkaround) {
_iOSWorkaround = true;
Array.from(window2.document.body.children).forEach((el) => el.addEventListener("click", noop$3));
}
let shouldListen = true;
const shouldIgnore = (event2) => {
return ignore.some((target2) => {
if (typeof target2 === "string") {
return Array.from(window2.document.querySelectorAll(target2)).some((el) => el === event2.target || event2.composedPath().includes(el));
} else {
const el = unrefElement(target2);
return el && (event2.target === el || event2.composedPath().includes(el));
}
});
};
const listener = (event2) => {
const el = unrefElement(target);
if (!el || el === event2.target || event2.composedPath().includes(el))
return;
if (event2.detail === 0)
shouldListen = !shouldIgnore(event2);
if (!shouldListen) {
shouldListen = true;
return;
}
handler(event2);
};
const cleanup = [
useEventListener(window2, "click", listener, { passive: true, capture }),
useEventListener(window2, "pointerdown", (e) => {
const el = unrefElement(target);
if (el)
shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
}, { passive: true }),
detectIframe && useEventListener(window2, "blur", (event2) => {
var _a2;
const el = unrefElement(target);
if (((_a2 = window2.document.activeElement) == null ? void 0 : _a2.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window2.document.activeElement)))
handler(event2);
})
].filter(Boolean);
const stop = () => cleanup.forEach((fn2) => fn2());
return stop;
}
function useSupported(callback2, sync = false) {
const isSupported = ref();
const update = () => isSupported.value = Boolean(callback2());
update();
tryOnMounted(update, sync);
return isSupported;
}
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
const globalKey = "__vueuse_ssr_handlers__";
_global[globalKey] = _global[globalKey] || {};
_global[globalKey];
var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
var __hasOwnProp$g = Object.prototype.hasOwnProperty;
var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
var __objRest$2 = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols$g)
for (var prop of __getOwnPropSymbols$g(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
target[prop] = source[prop];
}
return target;
};
function useResizeObserver(target, callback2, options2 = {}) {
const _a2 = options2, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
let observer;
const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
const cleanup = () => {
if (observer) {
observer.disconnect();
observer = void 0;
}
};
const stopWatch = watch(() => unrefElement(target), (el) => {
cleanup();
if (isSupported.value && window2 && el) {
observer = new ResizeObserver(callback2);
observer.observe(el, observerOptions);
}
}, { immediate: true, flush: "post" });
const stop = () => {
cleanup();
stopWatch();
};
tryOnScopeDispose(stop);
return {
isSupported,
stop
};
}
var SwipeDirection;
(function(SwipeDirection2) {
SwipeDirection2["UP"] = "UP";
SwipeDirection2["RIGHT"] = "RIGHT";
SwipeDirection2["DOWN"] = "DOWN";
SwipeDirection2["LEFT"] = "LEFT";
SwipeDirection2["NONE"] = "NONE";
})(SwipeDirection || (SwipeDirection = {}));
var __defProp2 = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp2(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp2(a, prop, b[prop]);
}
return a;
};
const _TransitionPresets = {
easeInSine: [0.12, 0, 0.39, 0],
easeOutSine: [0.61, 1, 0.88, 1],
easeInOutSine: [0.37, 0, 0.63, 1],
easeInQuad: [0.11, 0, 0.5, 0],
easeOutQuad: [0.5, 1, 0.89, 1],
easeInOutQuad: [0.45, 0, 0.55, 1],
easeInCubic: [0.32, 0, 0.67, 0],
easeOutCubic: [0.33, 1, 0.68, 1],
easeInOutCubic: [0.65, 0, 0.35, 1],
easeInQuart: [0.5, 0, 0.75, 0],
easeOutQuart: [0.25, 1, 0.5, 1],
easeInOutQuart: [0.76, 0, 0.24, 1],
easeInQuint: [0.64, 0, 0.78, 0],
easeOutQuint: [0.22, 1, 0.36, 1],
easeInOutQuint: [0.83, 0, 0.17, 1],
easeInExpo: [0.7, 0, 0.84, 0],
easeOutExpo: [0.16, 1, 0.3, 1],
easeInOutExpo: [0.87, 0, 0.13, 1],
easeInCirc: [0.55, 0, 1, 0.45],
easeOutCirc: [0, 0.55, 0.45, 1],
easeInOutCirc: [0.85, 0, 0.15, 1],
easeInBack: [0.36, 0, 0.66, -0.56],
easeOutBack: [0.34, 1.56, 0.64, 1],
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
};
__spreadValues({
linear: identity
}, _TransitionPresets);
const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
const getClientXY = (event2) => {
let clientX;
let clientY;
if (event2.type === "touchend") {
clientY = event2.changedTouches[0].clientY;
clientX = event2.changedTouches[0].clientX;
} else if (event2.type.startsWith("touch")) {
clientY = event2.touches[0].clientY;
clientX = event2.touches[0].clientX;
} else {
clientY = event2.clientY;
clientX = event2.clientX;
}
return {
clientX,
clientY
};
};
const NOOP = () => {
};
const hasOwnProperty$9 = Object.prototype.hasOwnProperty;
const hasOwn = (val, key) => hasOwnProperty$9.call(val, key);
const isArray$2 = Array.isArray;
const isFunction$3 = (val) => typeof val === "function";
const isString = (val) => typeof val === "string";
const isObject$5 = (val) => val !== null && typeof val === "object";
const isPromise$2 = (val) => {
return isObject$5(val) && isFunction$3(val.then) && isFunction$3(val.catch);
};
const objectToString$1 = Object.prototype.toString;
const toTypeString = (value) => objectToString$1.call(value);
const toRawType = (value) => {
return toTypeString(value).slice(8, -1);
};
const cacheStringFunction = (fn2) => {
const cache = /* @__PURE__ */ Object.create(null);
return (str) => {
const hit = cache[str];
return hit || (cache[str] = fn2(str));
};
};
const camelizeRE = /-(\w)/g;
const camelize = cacheStringFunction((str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
});
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
var freeGlobal$1 = freeGlobal;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal$1 || freeSelf || Function("return this")();
var root$1 = root;
var Symbol$1 = root$1.Symbol;
var Symbol$2 = Symbol$1;
var objectProto$b = Object.prototype;
var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
var nativeObjectToString$1 = objectProto$b.toString;
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
function getRawTag(value) {
var isOwn = hasOwnProperty$8.call(value, symToStringTag$1), tag = value[symToStringTag$1];
try {
value[symToStringTag$1] = void 0;
var unmasked = true;
} catch (e) {
}
var result = nativeObjectToString$1.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag$1] = tag;
} else {
delete value[symToStringTag$1];
}
}
return result;
}
var objectProto$a = Object.prototype;
var nativeObjectToString = objectProto$a.toString;
function objectToString(value) {
return nativeObjectToString.call(value);
}
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
function baseGetTag(value) {
if (value == null) {
return value === void 0 ? undefinedTag : nullTag;
}
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
}
function isObjectLike(value) {
return value != null && typeof value == "object";
}
var symbolTag$1 = "[object Symbol]";
function isSymbol(value) {
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$1;
}
function arrayMap(array, iteratee) {
var index2 = -1, length = array == null ? 0 : array.length, result = Array(length);
while (++index2 < length) {
result[index2] = iteratee(array[index2], index2, array);
}
return result;
}
var isArray = Array.isArray;
var isArray$1 = isArray;
var INFINITY$1 = 1 / 0;
var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$1 ? symbolProto$1.toString : void 0;
function baseToString(value) {
if (typeof value == "string") {
return value;
}
if (isArray$1(value)) {
return arrayMap(value, baseToString) + "";
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : "";
}
var result = value + "";
return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
}
var reWhitespace = /\s/;
function trimmedEndIndex(string) {
var index2 = string.length;
while (index2-- && reWhitespace.test(string.charAt(index2))) {
}
return index2;
}
var reTrimStart = /^\s+/;
function baseTrim(string) {
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
}
function isObject$4(value) {
var type2 = typeof value;
return value != null && (type2 == "object" || type2 == "function");
}
var NAN = 0 / 0;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsOctal = /^0o[0-7]+$/i;
var freeParseInt = parseInt;
function toNumber(value) {
if (typeof value == "number") {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject$4(value)) {
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
value = isObject$4(other) ? other + "" : other;
}
if (typeof value != "string") {
return value === 0 ? value : +value;
}
value = baseTrim(value);
var isBinary = reIsBinary.test(value);
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
}
var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
function isFunction$2(value) {
if (!isObject$4(value)) {
return false;
}
var tag = baseGetTag(value);
return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
}
var coreJsData = root$1["__core-js_shared__"];
var coreJsData$1 = coreJsData;
var maskSrcKey = function() {
var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
return uid ? "Symbol(src)_1." + uid : "";
}();
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
}
var funcProto$1 = Function.prototype;
var funcToString$1 = funcProto$1.toString;
function toSource(func) {
if (func != null) {
try {
return funcToString$1.call(func);
} catch (e) {
}
try {
return func + "";
} catch (e) {
}
}
return "";
}
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var funcProto = Function.prototype, objectProto$9 = Object.prototype;
var funcToString = funcProto.toString;
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
var reIsNative = RegExp(
"^" + funcToString.call(hasOwnProperty$7).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function baseIsNative(value) {
if (!isObject$4(value) || isMasked(value)) {
return false;
}
var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
function getValue(object, key) {
return object == null ? void 0 : object[key];
}
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : void 0;
}
var WeakMap$1 = getNative(root$1, "WeakMap");
var WeakMap$2 = WeakMap$1;
var MAX_SAFE_INTEGER$1 = 9007199254740991;
var reIsUint = /^(?:0|[1-9]\d*)$/;
function isIndex(value, length) {
var type2 = typeof value;
length = length == null ? MAX_SAFE_INTEGER$1 : length;
return !!length && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
}
function eq(value, other) {
return value === other || value !== value && other !== other;
}
var MAX_SAFE_INTEGER = 9007199254740991;
function isLength(value) {
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction$2(value);
}
var objectProto$8 = Object.prototype;
function isPrototype(value) {
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$8;
return value === proto;
}
function baseTimes(n, iteratee) {
var index2 = -1, result = Array(n);
while (++index2 < n) {
result[index2] = iteratee(index2);
}
return result;
}
var argsTag$2 = "[object Arguments]";
function baseIsArguments(value) {
return isObjectLike(value) && baseGetTag(value) == argsTag$2;
}
var objectProto$7 = Object.prototype;
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
var isArguments = baseIsArguments(function() {
return arguments;
}()) ? baseIsArguments : function(value) {
return isObjectLike(value) && hasOwnProperty$6.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
};
var isArguments$1 = isArguments;
function stubFalse() {
return false;
}
var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
var Buffer$1 = moduleExports$1 ? root$1.Buffer : void 0;
var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
var isBuffer = nativeIsBuffer || stubFalse;
var isBuffer$1 = isBuffer;
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]";
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]";
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
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;
function baseIsTypedArray(value) {
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
}
function baseUnary(func) {
return function(value) {
return func(value);
};
}
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
var moduleExports = freeModule && freeModule.exports === freeExports;
var freeProcess = moduleExports && freeGlobal$1.process;
var nodeUtil = function() {
try {
var types = freeModule && freeModule.require && freeModule.require("util").types;
if (types) {
return types;
}
return freeProcess && freeProcess.binding && freeProcess.binding("util");
} catch (e) {
}
}();
var nodeUtil$1 = nodeUtil;
var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
var isTypedArray$2 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
var isTypedArray$3 = isTypedArray$2;
var objectProto$6 = Object.prototype;
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
function arrayLikeKeys(value, inherited) {
var isArr = isArray$1(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$3(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
for (var key in value) {
if ((inherited || hasOwnProperty$5.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
function overArg(func, transform3) {
return function(arg) {
return func(transform3(arg));
};
}
var nativeKeys = overArg(Object.keys, Object);
var nativeKeys$1 = nativeKeys;
var objectProto$5 = Object.prototype;
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys$1(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty$4.call(object, key) && key != "constructor") {
result.push(key);
}
}
return result;
}
function keys$2(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
function isKey(value, object) {
if (isArray$1(value)) {
return false;
}
var type2 = typeof value;
if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
}
var nativeCreate = getNative(Object, "create");
var nativeCreate$1 = nativeCreate;
function hashClear() {
this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
this.size = 0;
}
function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
}
var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
var objectProto$4 = Object.prototype;
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
function hashGet(key) {
var data = this.__data__;
if (nativeCreate$1) {
var result = data[key];
return result === HASH_UNDEFINED$2 ? void 0 : result;
}
return hasOwnProperty$3.call(data, key) ? data[key] : void 0;
}
var objectProto$3 = Object.prototype;
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
function hashHas(key) {
var data = this.__data__;
return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$2.call(data, key);
}
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value;
return this;
}
function Hash(entries) {
var index2 = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index2 < length) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
Hash.prototype.clear = hashClear;
Hash.prototype["delete"] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
var arrayProto = Array.prototype;
var splice = arrayProto.splice;
function listCacheDelete(key) {
var data = this.__data__, index2 = assocIndexOf(data, key);
if (index2 < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index2 == lastIndex) {
data.pop();
} else {
splice.call(data, index2, 1);
}
--this.size;
return true;
}
function listCacheGet(key) {
var data = this.__data__, index2 = assocIndexOf(data, key);
return index2 < 0 ? void 0 : data[index2][1];
}
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
function listCacheSet(key, value) {
var data = this.__data__, index2 = assocIndexOf(data, key);
if (index2 < 0) {
++this.size;
data.push([key, value]);
} else {
data[index2][1] = value;
}
return this;
}
function ListCache(entries) {
var index2 = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index2 < length) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
ListCache.prototype.clear = listCacheClear;
ListCache.prototype["delete"] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
var Map$2 = getNative(root$1, "Map");
var Map$3 = Map$2;
function mapCacheClear() {
this.size = 0;
this.__data__ = {
"hash": new Hash(),
"map": new (Map$3 || ListCache)(),
"string": new Hash()
};
}
function isKeyable(value) {
var type2 = typeof value;
return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
}
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
function mapCacheDelete(key) {
var result = getMapData(this, key)["delete"](key);
this.size -= result ? 1 : 0;
return result;
}
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
function mapCacheSet(key, value) {
var data = getMapData(this, key), size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}
function MapCache(entries) {
var index2 = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index2 < length) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype["delete"] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
var FUNC_ERROR_TEXT$1 = "Expected a function";
function memoize(func, resolver) {
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
throw new TypeError(FUNC_ERROR_TEXT$1);
}
var memoized = function() {
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result) || cache;
return result;
};
memoized.cache = new (memoize.Cache || MapCache)();
return memoized;
}
memoize.Cache = MapCache;
var MAX_MEMOIZE_SIZE = 500;
function memoizeCapped(func) {
var result = memoize(func, function(key) {
if (cache.size === MAX_MEMOIZE_SIZE) {
cache.clear();
}
return key;
});
var cache = result.cache;
return result;
}
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reEscapeChar = /\\(\\)?/g;
var stringToPath = memoizeCapped(function(string) {
var result = [];
if (string.charCodeAt(0) === 46) {
result.push("");
}
string.replace(rePropName, function(match, number, quote, subString) {
result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
});
return result;
});
var stringToPath$1 = stringToPath;
function toString$3(value) {
return value == null ? "" : baseToString(value);
}
function castPath(value, object) {
if (isArray$1(value)) {
return value;
}
return isKey(value, object) ? [value] : stringToPath$1(toString$3(value));
}
var INFINITY = 1 / 0;
function toKey(value) {
if (typeof value == "string" || isSymbol(value)) {
return value;
}
var result = value + "";
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
}
function baseGet(object, path) {
path = castPath(path, object);
var index2 = 0, length = path.length;
while (object != null && index2 < length) {
object = object[toKey(path[index2++])];
}
return index2 && index2 == length ? object : void 0;
}
function get$2(object, path, defaultValue2) {
var result = object == null ? void 0 : baseGet(object, path);
return result === void 0 ? defaultValue2 : result;
}
function arrayPush(array, values3) {
var index2 = -1, length = values3.length, offset = array.length;
while (++index2 < length) {
array[offset + index2] = values3[index2];
}
return array;
}
function castArray() {
if (!arguments.length) {
return [];
}
var value = arguments[0];
return isArray$1(value) ? value : [value];
}
function stackClear() {
this.__data__ = new ListCache();
this.size = 0;
}
function stackDelete(key) {
var data = this.__data__, result = data["delete"](key);
this.size = data.size;
return result;
}
function stackGet(key) {
return this.__data__.get(key);
}
function stackHas(key) {
return this.__data__.has(key);
}
var LARGE_ARRAY_SIZE = 200;
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof ListCache) {
var pairs = data.__data__;
if (!Map$3 || pairs.length < LARGE_ARRAY_SIZE - 1) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}
Stack.prototype.clear = stackClear;
Stack.prototype["delete"] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
function arrayFilter(array, predicate) {
var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
while (++index2 < length) {
var value = array[index2];
if (predicate(value, index2, array)) {
result[resIndex++] = value;
}
}
return result;
}
function stubArray() {
return [];
}
var objectProto$2 = Object.prototype;
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
var nativeGetSymbols = Object.getOwnPropertySymbols;
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
if (object == null) {
return [];
}
object = Object(object);
return arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable.call(object, symbol);
});
};
var getSymbols$1 = getSymbols;
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
}
function getAllKeys(object) {
return baseGetAllKeys(object, keys$2, getSymbols$1);
}
var DataView$1 = getNative(root$1, "DataView");
var DataView$2 = DataView$1;
var Promise$1 = getNative(root$1, "Promise");
var Promise$2 = Promise$1;
var Set$2 = getNative(root$1, "Set");
var Set$3 = Set$2;
var mapTag$1 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
var dataViewTag$1 = "[object DataView]";
var dataViewCtorString = toSource(DataView$2), mapCtorString = toSource(Map$3), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$3), weakMapCtorString = toSource(WeakMap$2);
var getTag = baseGetTag;
if (DataView$2 && getTag(new DataView$2(new ArrayBuffer(1))) != dataViewTag$1 || Map$3 && getTag(new Map$3()) != mapTag$1 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$3 && getTag(new Set$3()) != setTag$1 || WeakMap$2 && getTag(new WeakMap$2()) != weakMapTag) {
getTag = function(value) {
var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
if (ctorString) {
switch (ctorString) {
case dataViewCtorString:
return dataViewTag$1;
case mapCtorString:
return mapTag$1;
case promiseCtorString:
return promiseTag;
case setCtorString:
return setTag$1;
case weakMapCtorString:
return weakMapTag;
}
}
return result;
};
}
var getTag$1 = getTag;
var Uint8Array$1 = root$1.Uint8Array;
var Uint8Array$2 = Uint8Array$1;
var HASH_UNDEFINED = "__lodash_hash_undefined__";
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
function setCacheHas(value) {
return this.__data__.has(value);
}
function SetCache(values3) {
var index2 = -1, length = values3 == null ? 0 : values3.length;
this.__data__ = new MapCache();
while (++index2 < length) {
this.add(values3[index2]);
}
}
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
function arraySome(array, predicate) {
var index2 = -1, length = array == null ? 0 : array.length;
while (++index2 < length) {
if (predicate(array[index2], index2, array)) {
return true;
}
}
return false;
}
function cacheHas(cache, key) {
return cache.has(key);
}
var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array.length, othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
var arrStacked = stack.get(array);
var othStacked = stack.get(other);
if (arrStacked && othStacked) {
return arrStacked == other && othStacked == array;
}
var index2 = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
stack.set(array, other);
stack.set(other, array);
while (++index2 < arrLength) {
var arrValue = array[index2], othValue = other[index2];
if (customizer) {
var compared = isPartial ? customizer(othValue, arrValue, index2, other, array, stack) : customizer(arrValue, othValue, index2, array, other, stack);
}
if (compared !== void 0) {
if (compared) {
continue;
}
result = false;
break;
}
if (seen) {
if (!arraySome(other, function(othValue2, othIndex) {
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result = false;
break;
}
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
result = false;
break;
}
}
stack["delete"](array);
stack["delete"](other);
return result;
}
function mapToArray(map) {
var index2 = -1, result = Array(map.size);
map.forEach(function(value, key) {
result[++index2] = [key, value];
});
return result;
}
function setToArray(set4) {
var index2 = -1, result = Array(set4.size);
set4.forEach(function(value) {
result[++index2] = value;
});
return result;
}
var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
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]";
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag:
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$2(object), new Uint8Array$2(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
return object == other + "";
case mapTag:
var convert = mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG;
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
stack["delete"](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
var COMPARE_PARTIAL_FLAG$1 = 1;
var objectProto$1 = Object.prototype;
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index2 = objLength;
while (index2--) {
var key = objProps[index2];
if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
return false;
}
}
var objStacked = stack.get(object);
var othStacked = stack.get(other);
if (objStacked && othStacked) {
return objStacked == other && othStacked == object;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index2 < objLength) {
key = objProps[index2];
var objValue = object[key], othValue = other[key];
if (customizer) {
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
}
if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
result = false;
break;
}
skipCtor || (skipCtor = key == "constructor");
}
if (result && !skipCtor) {
var objCtor = object.constructor, othCtor = other.constructor;
if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
result = false;
}
}
stack["delete"](object);
stack["delete"](other);
return result;
}
var COMPARE_PARTIAL_FLAG = 1;
var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray$1(object), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
if (isSameTag && isBuffer$1(object)) {
if (!isBuffer$1(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack());
return objIsArr || isTypedArray$3(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack());
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack());
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}
var now = function() {
return root$1.Date.now();
};
var now$1 = now;
var FUNC_ERROR_TEXT = "Expected a function";
var nativeMax = Math.max, nativeMin = Math.min;
function debounce$2(func, wait, options2) {
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
wait = toNumber(wait) || 0;
if (isObject$4(options2)) {
leading = !!options2.leading;
maxing = "maxWait" in options2;
maxWait = maxing ? nativeMax(toNumber(options2.maxWait) || 0, wait) : maxWait;
trailing = "trailing" in options2 ? !!options2.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs, thisArg = lastThis;
lastArgs = lastThis = void 0;
lastInvokeTime = time;
result = func.apply(thisArg, args);
return result;
}
function leadingEdge(time) {
lastInvokeTime = time;
timerId = setTimeout(timerExpired, wait);
return leading ? invokeFunc(time) : result;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
}
function timerExpired() {
var time = now$1();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
timerId = setTimeout(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = void 0;
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = void 0;
return result;
}
function cancel() {
if (timerId !== void 0) {
clearTimeout(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = void 0;
}
function flush() {
return timerId === void 0 ? result : trailingEdge(now$1());
}
function debounced() {
var time = now$1(), isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === void 0) {
return leadingEdge(lastCallTime);
}
if (maxing) {
clearTimeout(timerId);
timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === void 0) {
timerId = setTimeout(timerExpired, wait);
}
return result;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
}
function fromPairs(pairs) {
var index2 = -1, length = pairs == null ? 0 : pairs.length, result = {};
while (++index2 < length) {
var pair = pairs[index2];
result[pair[0]] = pair[1];
}
return result;
}
function isEqual(value, other) {
return baseIsEqual(value, other);
}
function isNil(value) {
return value == null;
}
function isUndefined$1(value) {
return value === void 0;
}
const isUndefined = (val) => val === void 0;
const isBoolean = (val) => typeof val === "boolean";
const isNumber = (val) => typeof val === "number";
const isElement = (e) => {
if (typeof Element === "undefined")
return false;
return e instanceof Element;
};
const isStringNumber = (val) => {
if (!isString(val)) {
return false;
}
return !Number.isNaN(Number(val));
};
const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
const keysOf = (arr) => Object.keys(arr);
class ElementPlusError extends Error {
constructor(m) {
super(m);
this.name = "ElementPlusError";
}
}
function throwError(scope, m) {
throw new ElementPlusError(`[${scope}] ${m}`);
}
function debugWarn(scope, message) {
}
const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
const hasClass$2 = (el, cls) => {
if (!el || !cls)
return false;
if (cls.includes(" "))
throw new Error("className should not contain space.");
return el.classList.contains(cls);
};
const addClass$2 = (el, cls) => {
if (!el || !cls.trim())
return;
el.classList.add(...classNameToArray(cls));
};
const removeClass$2 = (el, cls) => {
if (!el || !cls.trim())
return;
el.classList.remove(...classNameToArray(cls));
};
const getStyle = (element, styleName) => {
var _a2;
if (!isClient || !element || !styleName)
return "";
let key = camelize(styleName);
if (key === "float")
key = "cssFloat";
try {
const style = element.style[key];
if (style)
return style;
const computed2 = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(element, "");
return computed2 ? computed2[key] : "";
} catch (e) {
return element.style[key];
}
};
function addUnit(value, defaultUnit = "px") {
if (!value)
return "";
if (isNumber(value) || isStringNumber(value)) {
return `${value}${defaultUnit}`;
} else if (isString(value)) {
return value;
}
}
let scrollBarWidth;
const getScrollBarWidth = (namespace) => {
var _a2;
if (!isClient)
return 0;
if (scrollBarWidth !== void 0)
return scrollBarWidth;
const outer = document.createElement("div");
outer.className = `${namespace}-scrollbar__wrap`;
outer.style.visibility = "hidden";
outer.style.width = "100px";
outer.style.position = "absolute";
outer.style.top = "-9999px";
document.body.appendChild(outer);
const widthNoScroll = outer.offsetWidth;
outer.style.overflow = "scroll";
const inner = document.createElement("div");
inner.style.width = "100%";
outer.appendChild(inner);
const widthWithScroll = inner.offsetWidth;
(_a2 = outer.parentNode) == null ? void 0 : _a2.removeChild(outer);
scrollBarWidth = widthNoScroll - widthWithScroll;
return scrollBarWidth;
};
function scrollIntoView(container, selected) {
if (!isClient)
return;
if (!selected) {
container.scrollTop = 0;
return;
}
const offsetParents = [];
let pointer = selected.offsetParent;
while (pointer !== null && container !== pointer && container.contains(pointer)) {
offsetParents.push(pointer);
pointer = pointer.offsetParent;
}
const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
const bottom = top + selected.offsetHeight;
const viewRectTop = container.scrollTop;
const viewRectBottom = viewRectTop + container.clientHeight;
if (top < viewRectTop) {
container.scrollTop = top;
} else if (bottom > viewRectBottom) {
container.scrollTop = bottom - container.clientHeight;
}
}
/*! Element Plus Icons Vue v2.1.0 */
var export_helper_default = (sfc, props) => {
let target = sfc.__vccOpts || sfc;
for (let [key, val] of props)
target[key] = val;
return target;
};
var arrow_down_vue_vue_type_script_lang_default = {
name: "ArrowDown"
};
var _hoisted_16$2 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_26$2 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
},
null,
-1
), _hoisted_36$2 = [
_hoisted_26$2
];
function _sfc_render6(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_16$2, _hoisted_36$2);
}
var arrow_down_default = /* @__PURE__ */ export_helper_default(arrow_down_vue_vue_type_script_lang_default, [["render", _sfc_render6], ["__file", "arrow-down.vue"]]);
var arrow_right_vue_vue_type_script_lang_default = {
name: "ArrowRight"
};
var _hoisted_110 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_210 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
},
null,
-1
), _hoisted_310 = [
_hoisted_210
];
function _sfc_render10(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_110, _hoisted_310);
}
var arrow_right_default = /* @__PURE__ */ export_helper_default(arrow_right_vue_vue_type_script_lang_default, [["render", _sfc_render10], ["__file", "arrow-right.vue"]]);
var arrow_up_vue_vue_type_script_lang_default = {
name: "ArrowUp"
};
var _hoisted_112 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_212 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0z"
},
null,
-1
), _hoisted_312 = [
_hoisted_212
];
function _sfc_render12(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_112, _hoisted_312);
}
var arrow_up_default = /* @__PURE__ */ export_helper_default(arrow_up_vue_vue_type_script_lang_default, [["render", _sfc_render12], ["__file", "arrow-up.vue"]]);
var circle_check_vue_vue_type_script_lang_default = {
name: "CircleCheck"
};
var _hoisted_149 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_249 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
},
null,
-1
), _hoisted_348 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
},
null,
-1
), _hoisted_415 = [
_hoisted_249,
_hoisted_348
];
function _sfc_render49(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_149, _hoisted_415);
}
var circle_check_default = /* @__PURE__ */ export_helper_default(circle_check_vue_vue_type_script_lang_default, [["render", _sfc_render49], ["__file", "circle-check.vue"]]);
var circle_close_vue_vue_type_script_lang_default = {
name: "CircleClose"
};
var _hoisted_151 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_251 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"
},
null,
-1
), _hoisted_350 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
},
null,
-1
), _hoisted_416 = [
_hoisted_251,
_hoisted_350
];
function _sfc_render51(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_151, _hoisted_416);
}
var circle_close_default = /* @__PURE__ */ export_helper_default(circle_close_vue_vue_type_script_lang_default, [["render", _sfc_render51], ["__file", "circle-close.vue"]]);
var close_vue_vue_type_script_lang_default = {
name: "Close"
};
var _hoisted_156 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_256 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
},
null,
-1
), _hoisted_355 = [
_hoisted_256
];
function _sfc_render56(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_156, _hoisted_355);
}
var close_default = /* @__PURE__ */ export_helper_default(close_vue_vue_type_script_lang_default, [["render", _sfc_render56], ["__file", "close.vue"]]);
var delete_vue_vue_type_script_lang_default = {
name: "Delete"
};
var _hoisted_180 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_280 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"
},
null,
-1
), _hoisted_379 = [
_hoisted_280
];
function _sfc_render80(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_180, _hoisted_379);
}
var delete_default = /* @__PURE__ */ export_helper_default(delete_vue_vue_type_script_lang_default, [["render", _sfc_render80], ["__file", "delete.vue"]]);
var edit_vue_vue_type_script_lang_default = {
name: "Edit"
};
var _hoisted_194 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_294 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640V512z"
},
null,
-1
), _hoisted_393 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"
},
null,
-1
), _hoisted_431 = [
_hoisted_294,
_hoisted_393
];
function _sfc_render94(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_194, _hoisted_431);
}
var edit_default = /* @__PURE__ */ export_helper_default(edit_vue_vue_type_script_lang_default, [["render", _sfc_render94], ["__file", "edit.vue"]]);
var hide_vue_vue_type_script_lang_default = {
name: "Hide"
};
var _hoisted_1133 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_2133 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2L371.2 588.8ZM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"
},
null,
-1
), _hoisted_3132 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"
},
null,
-1
), _hoisted_438 = [
_hoisted_2133,
_hoisted_3132
];
function _sfc_render133(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_1133, _hoisted_438);
}
var hide_default = /* @__PURE__ */ export_helper_default(hide_vue_vue_type_script_lang_default, [["render", _sfc_render133], ["__file", "hide.vue"]]);
var loading_vue_vue_type_script_lang_default = {
name: "Loading"
};
var _hoisted_1150 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_2150 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.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.248zm452.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.248zM828.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 0zm-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 0z"
},
null,
-1
), _hoisted_3149 = [
_hoisted_2150
];
function _sfc_render150(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_1150, _hoisted_3149);
}
var loading_default = /* @__PURE__ */ export_helper_default(loading_vue_vue_type_script_lang_default, [["render", _sfc_render150], ["__file", "loading.vue"]]);
var minus_vue_vue_type_script_lang_default = {
name: "Minus"
};
var _hoisted_1169 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_2169 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
},
null,
-1
), _hoisted_3168 = [
_hoisted_2169
];
function _sfc_render169(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_1169, _hoisted_3168);
}
var minus_default = /* @__PURE__ */ export_helper_default(minus_vue_vue_type_script_lang_default, [["render", _sfc_render169], ["__file", "minus.vue"]]);
var plus_vue_vue_type_script_lang_default = {
name: "Plus"
};
var _hoisted_1201 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_2201 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z"
},
null,
-1
), _hoisted_3200 = [
_hoisted_2201
];
function _sfc_render201(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_1201, _hoisted_3200);
}
var plus_default = /* @__PURE__ */ export_helper_default(plus_vue_vue_type_script_lang_default, [["render", _sfc_render201], ["__file", "plus.vue"]]);
var setting_vue_vue_type_script_lang_default = {
name: "Setting"
};
var _hoisted_1231 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_2231 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357.12 357.12 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a351.616 351.616 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357.12 357.12 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296l112.32 24.256c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294.113 294.113 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293.12 293.12 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294.113 294.113 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288.282 288.282 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293.12 293.12 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a287.616 287.616 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384zm0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256z"
},
null,
-1
), _hoisted_3230 = [
_hoisted_2231
];
function _sfc_render231(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_1231, _hoisted_3230);
}
var setting_default = /* @__PURE__ */ export_helper_default(setting_vue_vue_type_script_lang_default, [["render", _sfc_render231], ["__file", "setting.vue"]]);
var view_vue_vue_type_script_lang_default = {
name: "View"
};
var _hoisted_1283 = {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, _hoisted_2283 = /* @__PURE__ */ createElementVNode(
"path",
{
fill: "currentColor",
d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
},
null,
-1
), _hoisted_3282 = [
_hoisted_2283
];
function _sfc_render283(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", _hoisted_1283, _hoisted_3282);
}
var view_default = /* @__PURE__ */ export_helper_default(view_vue_vue_type_script_lang_default, [["render", _sfc_render283], ["__file", "view.vue"]]);
const epPropKey = "__epPropKey";
const definePropType = (val) => val;
const isEpProp = (val) => isObject$5(val) && !!val[epPropKey];
const buildProp = (prop, key) => {
if (!isObject$5(prop) || isEpProp(prop))
return prop;
const { values: values3, required, default: defaultValue2, type: type2, validator } = prop;
const _validator = values3 || validator ? (val) => {
let valid = false;
let allowedValues = [];
if (values3) {
allowedValues = Array.from(values3);
if (hasOwn(prop, "default")) {
allowedValues.push(defaultValue2);
}
valid || (valid = allowedValues.includes(val));
}
if (validator)
valid || (valid = validator(val));
if (!valid && allowedValues.length > 0) {
const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
}
return valid;
} : void 0;
const epProp = {
type: type2,
required: !!required,
validator: _validator,
[epPropKey]: true
};
if (hasOwn(prop, "default"))
epProp.default = defaultValue2;
return epProp;
};
const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
key,
buildProp(option, key)
]));
const iconPropType = definePropType([
String,
Object,
Function
]);
const CloseComponents = {
Close: close_default
};
const ValidateComponentsMap = {
validating: loading_default,
success: circle_check_default,
error: circle_close_default
};
const withInstall = (main, extra) => {
main.install = (app) => {
for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
app.component(comp.name, comp);
}
};
if (extra) {
for (const [key, comp] of Object.entries(extra)) {
main[key] = comp;
}
}
return main;
};
const withNoopInstall = (component) => {
component.install = NOOP;
return component;
};
const composeRefs = (...refs) => {
return (el) => {
refs.forEach((ref2) => {
if (isFunction$3(ref2)) {
ref2(el);
} else {
ref2.value = el;
}
});
};
};
const EVENT_CODE = {
tab: "Tab",
enter: "Enter",
space: "Space",
left: "ArrowLeft",
up: "ArrowUp",
right: "ArrowRight",
down: "ArrowDown",
esc: "Escape",
delete: "Delete",
backspace: "Backspace",
numpadEnter: "NumpadEnter",
pageUp: "PageUp",
pageDown: "PageDown",
home: "Home",
end: "End"
};
const UPDATE_MODEL_EVENT = "update:modelValue";
const CHANGE_EVENT = "change";
const INPUT_EVENT = "input";
const componentSizes = ["", "default", "small", "large"];
const componentSizeMap = {
large: 40,
default: 32,
small: 24
};
const getComponentSize = (size) => {
return componentSizeMap[size || "default"];
};
const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
return PatchFlags2;
})(PatchFlags || {});
const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
const generateId = () => Math.floor(Math.random() * 1e4);
const mutable = (val) => val;
const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
const LISTENER_PREFIX = /^on[A-Z]/;
const useAttrs = (params = {}) => {
const { excludeListeners = false, excludeKeys } = params;
const allExcludeKeys = computed$1(() => {
return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
});
const instance = getCurrentInstance();
if (!instance) {
return computed$1(() => ({}));
}
return computed$1(() => {
var _a2;
return fromPairs(Object.entries((_a2 = instance.proxy) == null ? void 0 : _a2.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
});
};
const useDeprecated = ({ from: from3, replacement, scope, version: version2, ref: ref2, type: type2 = "API" }, condition) => {
watch(() => unref(condition), (val) => {
}, {
immediate: true
});
};
const useDraggable = (targetRef, dragRef, draggable2) => {
let transform3 = {
offsetX: 0,
offsetY: 0
};
const onMousedown = (e) => {
const downX = e.clientX;
const downY = e.clientY;
const { offsetX, offsetY } = transform3;
const targetRect = targetRef.value.getBoundingClientRect();
const targetLeft = targetRect.left;
const targetTop = targetRect.top;
const targetWidth = targetRect.width;
const targetHeight = targetRect.height;
const clientWidth = document.documentElement.clientWidth;
const clientHeight = document.documentElement.clientHeight;
const minLeft = -targetLeft + offsetX;
const minTop = -targetTop + offsetY;
const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
const maxTop = clientHeight - targetTop - targetHeight + offsetY;
const onMousemove = (e2) => {
const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
transform3 = {
offsetX: moveX,
offsetY: moveY
};
targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
};
const onMouseup = () => {
document.removeEventListener("mousemove", onMousemove);
document.removeEventListener("mouseup", onMouseup);
};
document.addEventListener("mousemove", onMousemove);
document.addEventListener("mouseup", onMouseup);
};
const onDraggable = () => {
if (dragRef.value && targetRef.value) {
dragRef.value.addEventListener("mousedown", onMousedown);
}
};
const offDraggable = () => {
if (dragRef.value && targetRef.value) {
dragRef.value.removeEventListener("mousedown", onMousedown);
}
};
onMounted(() => {
watchEffect(() => {
if (draggable2.value) {
onDraggable();
} else {
offDraggable();
}
});
});
onBeforeUnmount(() => {
offDraggable();
});
};
const useFocus = (el) => {
return {
focus: () => {
var _a2, _b;
(_b = (_a2 = el.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
}
};
};
var English = {
name: "en",
el: {
colorpicker: {
confirm: "OK",
clear: "Clear",
defaultLabel: "color picker",
description: "current color is {color}. press enter to select a new color."
},
datepicker: {
now: "Now",
today: "Today",
cancel: "Cancel",
clear: "Clear",
confirm: "OK",
dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
monthTablePrompt: "Use the arrow keys and enter to select the month",
yearTablePrompt: "Use the arrow keys and enter to select the year",
selectedDate: "Selected date",
selectDate: "Select date",
selectTime: "Select time",
startDate: "Start Date",
startTime: "Start Time",
endDate: "End Date",
endTime: "End Time",
prevYear: "Previous Year",
nextYear: "Next Year",
prevMonth: "Previous Month",
nextMonth: "Next Month",
year: "",
month1: "January",
month2: "February",
month3: "March",
month4: "April",
month5: "May",
month6: "June",
month7: "July",
month8: "August",
month9: "September",
month10: "October",
month11: "November",
month12: "December",
week: "week",
weeks: {
sun: "Sun",
mon: "Mon",
tue: "Tue",
wed: "Wed",
thu: "Thu",
fri: "Fri",
sat: "Sat"
},
weeksFull: {
sun: "Sunday",
mon: "Monday",
tue: "Tuesday",
wed: "Wednesday",
thu: "Thursday",
fri: "Friday",
sat: "Saturday"
},
months: {
jan: "Jan",
feb: "Feb",
mar: "Mar",
apr: "Apr",
may: "May",
jun: "Jun",
jul: "Jul",
aug: "Aug",
sep: "Sep",
oct: "Oct",
nov: "Nov",
dec: "Dec"
}
},
inputNumber: {
decrease: "decrease number",
increase: "increase number"
},
select: {
loading: "Loading",
noMatch: "No matching data",
noData: "No data",
placeholder: "Select"
},
dropdown: {
toggleDropdown: "Toggle Dropdown"
},
cascader: {
noMatch: "No matching data",
loading: "Loading",
placeholder: "Select",
noData: "No data"
},
pagination: {
goto: "Go to",
pagesize: "/page",
total: "Total {total}",
pageClassifier: "",
page: "Page",
prev: "Go to previous page",
next: "Go to next page",
currentPage: "page {pager}",
prevPages: "Previous {pager} pages",
nextPages: "Next {pager} pages",
deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
},
dialog: {
close: "Close this dialog"
},
drawer: {
close: "Close this dialog"
},
messagebox: {
title: "Message",
confirm: "OK",
cancel: "Cancel",
error: "Illegal input",
close: "Close this dialog"
},
upload: {
deleteTip: "press delete to remove",
delete: "Delete",
preview: "Preview",
continue: "Continue"
},
slider: {
defaultLabel: "slider between {min} and {max}",
defaultRangeStartLabel: "pick start value",
defaultRangeEndLabel: "pick end value"
},
table: {
emptyText: "No Data",
confirmFilter: "Confirm",
resetFilter: "Reset",
clearFilter: "All",
sumText: "Sum"
},
tree: {
emptyText: "No Data"
},
transfer: {
noMatch: "No matching data",
noData: "No data",
titles: ["List 1", "List 2"],
filterPlaceholder: "Enter keyword",
noCheckedFormat: "{total} items",
hasCheckedFormat: "{checked}/{total} checked"
},
image: {
error: "FAILED"
},
pageHeader: {
title: "Back"
},
popconfirm: {
confirmButtonText: "Yes",
cancelButtonText: "No"
}
}
};
const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
const translate = (path, option, locale) => get$2(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
var _a2;
return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
});
const buildLocaleContext = (locale) => {
const lang = computed$1(() => unref(locale).name);
const localeRef = isRef(locale) ? locale : ref(locale);
return {
lang,
locale: localeRef,
t: buildTranslator(locale)
};
};
const localeContextKey = Symbol("localeContextKey");
const useLocale = (localeOverrides) => {
const locale = localeOverrides || inject(localeContextKey, ref());
return buildLocaleContext(computed$1(() => locale.value || English));
};
let activeEffectScope;
function recordEffectScope(effect, scope = activeEffectScope) {
if (scope && scope.active) {
scope.effects.push(effect);
}
}
const createDep = (effects) => {
const dep = new Set(effects);
dep.w = 0;
dep.n = 0;
return dep;
};
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
const initDepMarkers = ({ deps }) => {
if (deps.length) {
for (let i2 = 0; i2 < deps.length; i2++) {
deps[i2].w |= trackOpBit;
}
}
};
const finalizeDepMarkers = (effect) => {
const { deps } = effect;
if (deps.length) {
let ptr = 0;
for (let i2 = 0; i2 < deps.length; i2++) {
const dep = deps[i2];
if (wasTracked(dep) && !newTracked(dep)) {
dep.delete(effect);
} else {
deps[ptr++] = dep;
}
dep.w &= ~trackOpBit;
dep.n &= ~trackOpBit;
}
deps.length = ptr;
}
};
let effectTrackDepth = 0;
let trackOpBit = 1;
const maxMarkerBits = 30;
let activeEffect;
class ReactiveEffect {
constructor(fn2, scheduler = null, scope) {
this.fn = fn2;
this.scheduler = scheduler;
this.active = true;
this.deps = [];
this.parent = void 0;
recordEffectScope(this, scope);
}
run() {
if (!this.active) {
return this.fn();
}
let parent = activeEffect;
let lastShouldTrack = shouldTrack;
while (parent) {
if (parent === this) {
return;
}
parent = parent.parent;
}
try {
this.parent = activeEffect;
activeEffect = this;
shouldTrack = true;
trackOpBit = 1 << ++effectTrackDepth;
if (effectTrackDepth <= maxMarkerBits) {
initDepMarkers(this);
} else {
cleanupEffect(this);
}
return this.fn();
} finally {
if (effectTrackDepth <= maxMarkerBits) {
finalizeDepMarkers(this);
}
trackOpBit = 1 << --effectTrackDepth;
activeEffect = this.parent;
shouldTrack = lastShouldTrack;
this.parent = void 0;
if (this.deferStop) {
this.stop();
}
}
}
stop() {
if (activeEffect === this) {
this.deferStop = true;
} else if (this.active) {
cleanupEffect(this);
if (this.onStop) {
this.onStop();
}
this.active = false;
}
}
}
function cleanupEffect(effect2) {
const { deps } = effect2;
if (deps.length) {
for (let i2 = 0; i2 < deps.length; i2++) {
deps[i2].delete(effect2);
}
deps.length = 0;
}
}
let shouldTrack = true;
function trackEffects(dep, debuggerEventExtraInfo) {
let shouldTrack2 = false;
if (effectTrackDepth <= maxMarkerBits) {
if (!newTracked(dep)) {
dep.n |= trackOpBit;
shouldTrack2 = !wasTracked(dep);
}
} else {
shouldTrack2 = !dep.has(activeEffect);
}
if (shouldTrack2) {
dep.add(activeEffect);
activeEffect.deps.push(dep);
}
}
function triggerEffects(dep, debuggerEventExtraInfo) {
const effects = isArray$2(dep) ? dep : [...dep];
for (const effect2 of effects) {
if (effect2.computed) {
triggerEffect(effect2);
}
}
for (const effect2 of effects) {
if (!effect2.computed) {
triggerEffect(effect2);
}
}
}
function triggerEffect(effect2, debuggerEventExtraInfo) {
if (effect2 !== activeEffect || effect2.allowRecurse) {
if (effect2.scheduler) {
effect2.scheduler();
} else {
effect2.run();
}
}
}
function toRaw(observed) {
const raw = observed && observed["__v_raw"];
return raw ? toRaw(raw) : observed;
}
function trackRefValue(ref2) {
if (shouldTrack && activeEffect) {
ref2 = toRaw(ref2);
{
trackEffects(ref2.dep || (ref2.dep = createDep()));
}
}
}
function triggerRefValue(ref2, newVal) {
ref2 = toRaw(ref2);
const dep = ref2.dep;
if (dep) {
{
triggerEffects(dep);
}
}
}
class ComputedRefImpl {
constructor(getter, _setter, isReadonly, isSSR) {
this._setter = _setter;
this.dep = void 0;
this.__v_isRef = true;
this["__v_isReadonly"] = false;
this._dirty = true;
this.effect = new ReactiveEffect(getter, () => {
if (!this._dirty) {
this._dirty = true;
triggerRefValue(this);
}
});
this.effect.computed = this;
this.effect.active = this._cacheable = !isSSR;
this["__v_isReadonly"] = isReadonly;
}
get value() {
const self2 = toRaw(this);
trackRefValue(self2);
if (self2._dirty || !self2._cacheable) {
self2._dirty = false;
self2._value = self2.effect.run();
}
return self2._value;
}
set value(newValue) {
this._setter(newValue);
}
}
function computed(getterOrOptions, debugOptions, isSSR = false) {
let getter;
let setter;
const onlyGetter = isFunction$3(getterOrOptions);
if (onlyGetter) {
getter = getterOrOptions;
setter = NOOP;
} else {
getter = getterOrOptions.get;
setter = getterOrOptions.set;
}
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
return cRef;
}
const defaultNamespace = "el";
const statePrefix = "is-";
const _bem = (namespace, block, blockSuffix, element, modifier) => {
let cls = `${namespace}-${block}`;
if (blockSuffix) {
cls += `-${blockSuffix}`;
}
if (element) {
cls += `__${element}`;
}
if (modifier) {
cls += `--${modifier}`;
}
return cls;
};
const namespaceContextKey = Symbol("namespaceContextKey");
const useGetDerivedNamespace = (namespaceOverrides) => {
const derivedNamespace = namespaceOverrides || inject(namespaceContextKey, ref(defaultNamespace));
const namespace = computed$1(() => {
return unref(derivedNamespace) || defaultNamespace;
});
return namespace;
};
const useNamespace = (block, namespaceOverrides) => {
const namespace = useGetDerivedNamespace(namespaceOverrides);
const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
const be2 = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
const is = (name, ...args) => {
const state = args.length >= 1 ? args[0] : true;
return name && state ? `${statePrefix}${name}` : "";
};
const cssVar = (object) => {
const styles = {};
for (const key in object) {
if (object[key]) {
styles[`--${namespace.value}-${key}`] = object[key];
}
}
return styles;
};
const cssVarBlock = (object) => {
const styles = {};
for (const key in object) {
if (object[key]) {
styles[`--${namespace.value}-${block}-${key}`] = object[key];
}
}
return styles;
};
const cssVarName = (name) => `--${namespace.value}-${name}`;
const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
return {
namespace,
b,
e,
m,
be: be2,
em,
bm,
bem,
is,
cssVar,
cssVarName,
cssVarBlock,
cssVarBlockName
};
};
const useLockscreen = (trigger2, options2 = {}) => {
if (!isRef(trigger2)) {
throwError("[useLockscreen]", "You need to pass a ref param to this function");
}
const ns = options2.ns || useNamespace("popup");
const hiddenCls = computed(() => ns.bm("parent", "hidden"));
if (!isClient || hasClass$2(document.body, hiddenCls.value)) {
return;
}
let scrollBarWidth2 = 0;
let withoutHiddenClass = false;
let bodyWidth = "0";
const cleanup = () => {
setTimeout(() => {
removeClass$2(document == null ? void 0 : document.body, hiddenCls.value);
if (withoutHiddenClass && document) {
document.body.style.width = bodyWidth;
}
}, 200);
};
watch(trigger2, (val) => {
if (!val) {
cleanup();
return;
}
withoutHiddenClass = !hasClass$2(document.body, hiddenCls.value);
if (withoutHiddenClass) {
bodyWidth = document.body.style.width;
}
scrollBarWidth2 = getScrollBarWidth(ns.namespace.value);
const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
const bodyOverflowY = getStyle(document.body, "overflowY");
if (scrollBarWidth2 > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
document.body.style.width = `calc(100% - ${scrollBarWidth2}px)`;
}
addClass$2(document.body, hiddenCls.value);
});
onScopeDispose(() => cleanup());
};
const _prop = buildProp({
type: definePropType(Boolean),
default: null
});
const _event = buildProp({
type: definePropType(Function)
});
const createModelToggleComposable = (name) => {
const updateEventKey = `update:${name}`;
const updateEventKeyRaw = `onUpdate:${name}`;
const useModelToggleEmits2 = [updateEventKey];
const useModelToggleProps2 = {
[name]: _prop,
[updateEventKeyRaw]: _event
};
const useModelToggle2 = ({
indicator,
toggleReason,
shouldHideWhenRouteChanges,
shouldProceed,
onShow,
onHide
}) => {
const instance = getCurrentInstance();
const { emit } = instance;
const props = instance.props;
const hasUpdateHandler = computed$1(() => isFunction$3(props[updateEventKeyRaw]));
const isModelBindingAbsent = computed$1(() => props[name] === null);
const doShow = (event2) => {
if (indicator.value === true) {
return;
}
indicator.value = true;
if (toggleReason) {
toggleReason.value = event2;
}
if (isFunction$3(onShow)) {
onShow(event2);
}
};
const doHide = (event2) => {
if (indicator.value === false) {
return;
}
indicator.value = false;
if (toggleReason) {
toggleReason.value = event2;
}
if (isFunction$3(onHide)) {
onHide(event2);
}
};
const show = (event2) => {
if (props.disabled === true || isFunction$3(shouldProceed) && !shouldProceed())
return;
const shouldEmit = hasUpdateHandler.value && isClient;
if (shouldEmit) {
emit(updateEventKey, true);
}
if (isModelBindingAbsent.value || !shouldEmit) {
doShow(event2);
}
};
const hide = (event2) => {
if (props.disabled === true || !isClient)
return;
const shouldEmit = hasUpdateHandler.value && isClient;
if (shouldEmit) {
emit(updateEventKey, false);
}
if (isModelBindingAbsent.value || !shouldEmit) {
doHide(event2);
}
};
const onChange = (val) => {
if (!isBoolean(val))
return;
if (props.disabled && val) {
if (hasUpdateHandler.value) {
emit(updateEventKey, false);
}
} else if (indicator.value !== val) {
if (val) {
doShow();
} else {
doHide();
}
}
};
const toggle = () => {
if (indicator.value) {
hide();
} else {
show();
}
};
watch(() => props[name], onChange);
if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
watch(() => ({
...instance.proxy.$route
}), () => {
if (shouldHideWhenRouteChanges.value && indicator.value) {
hide();
}
});
}
onMounted(() => {
onChange(props[name]);
});
return {
hide,
show,
toggle,
hasUpdateHandler
};
};
return {
useModelToggle: useModelToggle2,
useModelToggleProps: useModelToggleProps2,
useModelToggleEmits: useModelToggleEmits2
};
};
const useProp = (name) => {
const vm = getCurrentInstance();
return computed$1(() => {
var _a2, _b;
return (_b = (_a2 = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a2.$props) == null ? void 0 : _b[name];
});
};
var E = "top", R = "bottom", W = "right", P = "left", me = "auto", G = [E, R, W, P], U = "start", J = "end", Xe = "clippingParents", je = "viewport", K = "popper", Ye = "reference", De = G.reduce(function(t2, e) {
return t2.concat([e + "-" + U, e + "-" + J]);
}, []), Ee = [].concat(G, [me]).reduce(function(t2, e) {
return t2.concat([e, e + "-" + U, e + "-" + J]);
}, []), Ge = "beforeRead", Je = "read", Ke = "afterRead", Qe = "beforeMain", Ze = "main", et = "afterMain", tt = "beforeWrite", nt = "write", rt = "afterWrite", ot = [Ge, Je, Ke, Qe, Ze, et, tt, nt, rt];
function C(t2) {
return t2 ? (t2.nodeName || "").toLowerCase() : null;
}
function H(t2) {
if (t2 == null)
return window;
if (t2.toString() !== "[object Window]") {
var e = t2.ownerDocument;
return e && e.defaultView || window;
}
return t2;
}
function Q(t2) {
var e = H(t2).Element;
return t2 instanceof e || t2 instanceof Element;
}
function B(t2) {
var e = H(t2).HTMLElement;
return t2 instanceof e || t2 instanceof HTMLElement;
}
function Pe(t2) {
if (typeof ShadowRoot == "undefined")
return false;
var e = H(t2).ShadowRoot;
return t2 instanceof e || t2 instanceof ShadowRoot;
}
function Mt(t2) {
var e = t2.state;
Object.keys(e.elements).forEach(function(n) {
var r2 = e.styles[n] || {}, o = e.attributes[n] || {}, i2 = e.elements[n];
!B(i2) || !C(i2) || (Object.assign(i2.style, r2), Object.keys(o).forEach(function(a) {
var s = o[a];
s === false ? i2.removeAttribute(a) : i2.setAttribute(a, s === true ? "" : s);
}));
});
}
function Rt(t2) {
var e = t2.state, n = { popper: { position: e.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} };
return Object.assign(e.elements.popper.style, n.popper), e.styles = n, e.elements.arrow && Object.assign(e.elements.arrow.style, n.arrow), function() {
Object.keys(e.elements).forEach(function(r2) {
var o = e.elements[r2], i2 = e.attributes[r2] || {}, a = Object.keys(e.styles.hasOwnProperty(r2) ? e.styles[r2] : n[r2]), s = a.reduce(function(f, c) {
return f[c] = "", f;
}, {});
!B(o) || !C(o) || (Object.assign(o.style, s), Object.keys(i2).forEach(function(f) {
o.removeAttribute(f);
}));
});
};
}
var Ae = { name: "applyStyles", enabled: true, phase: "write", fn: Mt, effect: Rt, requires: ["computeStyles"] };
function q(t2) {
return t2.split("-")[0];
}
var X = Math.max, ve = Math.min, Z = Math.round;
function ee(t2, e) {
e === void 0 && (e = false);
var n = t2.getBoundingClientRect(), r2 = 1, o = 1;
if (B(t2) && e) {
var i2 = t2.offsetHeight, a = t2.offsetWidth;
a > 0 && (r2 = Z(n.width) / a || 1), i2 > 0 && (o = Z(n.height) / i2 || 1);
}
return { width: n.width / r2, height: n.height / o, top: n.top / o, right: n.right / r2, bottom: n.bottom / o, left: n.left / r2, x: n.left / r2, y: n.top / o };
}
function ke(t2) {
var e = ee(t2), n = t2.offsetWidth, r2 = t2.offsetHeight;
return Math.abs(e.width - n) <= 1 && (n = e.width), Math.abs(e.height - r2) <= 1 && (r2 = e.height), { x: t2.offsetLeft, y: t2.offsetTop, width: n, height: r2 };
}
function it(t2, e) {
var n = e.getRootNode && e.getRootNode();
if (t2.contains(e))
return true;
if (n && Pe(n)) {
var r2 = e;
do {
if (r2 && t2.isSameNode(r2))
return true;
r2 = r2.parentNode || r2.host;
} while (r2);
}
return false;
}
function N(t2) {
return H(t2).getComputedStyle(t2);
}
function Wt(t2) {
return ["table", "td", "th"].indexOf(C(t2)) >= 0;
}
function I(t2) {
return ((Q(t2) ? t2.ownerDocument : t2.document) || window.document).documentElement;
}
function ge(t2) {
return C(t2) === "html" ? t2 : t2.assignedSlot || t2.parentNode || (Pe(t2) ? t2.host : null) || I(t2);
}
function at(t2) {
return !B(t2) || N(t2).position === "fixed" ? null : t2.offsetParent;
}
function Bt(t2) {
var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, n = navigator.userAgent.indexOf("Trident") !== -1;
if (n && B(t2)) {
var r2 = N(t2);
if (r2.position === "fixed")
return null;
}
var o = ge(t2);
for (Pe(o) && (o = o.host); B(o) && ["html", "body"].indexOf(C(o)) < 0; ) {
var i2 = N(o);
if (i2.transform !== "none" || i2.perspective !== "none" || i2.contain === "paint" || ["transform", "perspective"].indexOf(i2.willChange) !== -1 || e && i2.willChange === "filter" || e && i2.filter && i2.filter !== "none")
return o;
o = o.parentNode;
}
return null;
}
function se(t2) {
for (var e = H(t2), n = at(t2); n && Wt(n) && N(n).position === "static"; )
n = at(n);
return n && (C(n) === "html" || C(n) === "body" && N(n).position === "static") ? e : n || Bt(t2) || e;
}
function Le(t2) {
return ["top", "bottom"].indexOf(t2) >= 0 ? "x" : "y";
}
function fe(t2, e, n) {
return X(t2, ve(e, n));
}
function St(t2, e, n) {
var r2 = fe(t2, e, n);
return r2 > n ? n : r2;
}
function st() {
return { top: 0, right: 0, bottom: 0, left: 0 };
}
function ft(t2) {
return Object.assign({}, st(), t2);
}
function ct(t2, e) {
return e.reduce(function(n, r2) {
return n[r2] = t2, n;
}, {});
}
var Tt = function(t2, e) {
return t2 = typeof t2 == "function" ? t2(Object.assign({}, e.rects, { placement: e.placement })) : t2, ft(typeof t2 != "number" ? t2 : ct(t2, G));
};
function Ht(t2) {
var e, n = t2.state, r2 = t2.name, o = t2.options, i2 = n.elements.arrow, a = n.modifiersData.popperOffsets, s = q(n.placement), f = Le(s), c = [P, W].indexOf(s) >= 0, u = c ? "height" : "width";
if (!(!i2 || !a)) {
var m = Tt(o.padding, n), v = ke(i2), l = f === "y" ? E : P, h2 = f === "y" ? R : W, p = n.rects.reference[u] + n.rects.reference[f] - a[f] - n.rects.popper[u], g = a[f] - n.rects.reference[f], x = se(i2), y = x ? f === "y" ? x.clientHeight || 0 : x.clientWidth || 0 : 0, $2 = p / 2 - g / 2, d2 = m[l], b = y - v[u] - m[h2], w = y / 2 - v[u] / 2 + $2, O = fe(d2, w, b), j = f;
n.modifiersData[r2] = (e = {}, e[j] = O, e.centerOffset = O - w, e);
}
}
function Ct(t2) {
var e = t2.state, n = t2.options, r2 = n.element, o = r2 === void 0 ? "[data-popper-arrow]" : r2;
o != null && (typeof o == "string" && (o = e.elements.popper.querySelector(o), !o) || !it(e.elements.popper, o) || (e.elements.arrow = o));
}
var pt = { name: "arrow", enabled: true, phase: "main", fn: Ht, effect: Ct, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] };
function te(t2) {
return t2.split("-")[1];
}
var qt = { top: "auto", right: "auto", bottom: "auto", left: "auto" };
function Vt(t2) {
var e = t2.x, n = t2.y, r2 = window, o = r2.devicePixelRatio || 1;
return { x: Z(e * o) / o || 0, y: Z(n * o) / o || 0 };
}
function ut(t2) {
var e, n = t2.popper, r2 = t2.popperRect, o = t2.placement, i2 = t2.variation, a = t2.offsets, s = t2.position, f = t2.gpuAcceleration, c = t2.adaptive, u = t2.roundOffsets, m = t2.isFixed, v = a.x, l = v === void 0 ? 0 : v, h2 = a.y, p = h2 === void 0 ? 0 : h2, g = typeof u == "function" ? u({ x: l, y: p }) : { x: l, y: p };
l = g.x, p = g.y;
var x = a.hasOwnProperty("x"), y = a.hasOwnProperty("y"), $2 = P, d2 = E, b = window;
if (c) {
var w = se(n), O = "clientHeight", j = "clientWidth";
if (w === H(n) && (w = I(n), N(w).position !== "static" && s === "absolute" && (O = "scrollHeight", j = "scrollWidth")), w = w, o === E || (o === P || o === W) && i2 === J) {
d2 = R;
var A = m && w === b && b.visualViewport ? b.visualViewport.height : w[O];
p -= A - r2.height, p *= f ? 1 : -1;
}
if (o === P || (o === E || o === R) && i2 === J) {
$2 = W;
var k = m && w === b && b.visualViewport ? b.visualViewport.width : w[j];
l -= k - r2.width, l *= f ? 1 : -1;
}
}
var D = Object.assign({ position: s }, c && qt), S = u === true ? Vt({ x: l, y: p }) : { x: l, y: p };
if (l = S.x, p = S.y, f) {
var L;
return Object.assign({}, D, (L = {}, L[d2] = y ? "0" : "", L[$2] = x ? "0" : "", L.transform = (b.devicePixelRatio || 1) <= 1 ? "translate(" + l + "px, " + p + "px)" : "translate3d(" + l + "px, " + p + "px, 0)", L));
}
return Object.assign({}, D, (e = {}, e[d2] = y ? p + "px" : "", e[$2] = x ? l + "px" : "", e.transform = "", e));
}
function Nt(t2) {
var e = t2.state, n = t2.options, r2 = n.gpuAcceleration, o = r2 === void 0 ? true : r2, i2 = n.adaptive, a = i2 === void 0 ? true : i2, s = n.roundOffsets, f = s === void 0 ? true : s, c = { placement: q(e.placement), variation: te(e.placement), popper: e.elements.popper, popperRect: e.rects.popper, gpuAcceleration: o, isFixed: e.options.strategy === "fixed" };
e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, ut(Object.assign({}, c, { offsets: e.modifiersData.popperOffsets, position: e.options.strategy, adaptive: a, roundOffsets: f })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, ut(Object.assign({}, c, { offsets: e.modifiersData.arrow, position: "absolute", adaptive: false, roundOffsets: f })))), e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-placement": e.placement });
}
var Me = { name: "computeStyles", enabled: true, phase: "beforeWrite", fn: Nt, data: {} }, ye = { passive: true };
function It(t2) {
var e = t2.state, n = t2.instance, r2 = t2.options, o = r2.scroll, i2 = o === void 0 ? true : o, a = r2.resize, s = a === void 0 ? true : a, f = H(e.elements.popper), c = [].concat(e.scrollParents.reference, e.scrollParents.popper);
return i2 && c.forEach(function(u) {
u.addEventListener("scroll", n.update, ye);
}), s && f.addEventListener("resize", n.update, ye), function() {
i2 && c.forEach(function(u) {
u.removeEventListener("scroll", n.update, ye);
}), s && f.removeEventListener("resize", n.update, ye);
};
}
var Re = { name: "eventListeners", enabled: true, phase: "write", fn: function() {
}, effect: It, data: {} }, _t = { left: "right", right: "left", bottom: "top", top: "bottom" };
function be(t2) {
return t2.replace(/left|right|bottom|top/g, function(e) {
return _t[e];
});
}
var zt = { start: "end", end: "start" };
function lt(t2) {
return t2.replace(/start|end/g, function(e) {
return zt[e];
});
}
function We(t2) {
var e = H(t2), n = e.pageXOffset, r2 = e.pageYOffset;
return { scrollLeft: n, scrollTop: r2 };
}
function Be(t2) {
return ee(I(t2)).left + We(t2).scrollLeft;
}
function Ft(t2) {
var e = H(t2), n = I(t2), r2 = e.visualViewport, o = n.clientWidth, i2 = n.clientHeight, a = 0, s = 0;
return r2 && (o = r2.width, i2 = r2.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (a = r2.offsetLeft, s = r2.offsetTop)), { width: o, height: i2, x: a + Be(t2), y: s };
}
function Ut(t2) {
var e, n = I(t2), r2 = We(t2), o = (e = t2.ownerDocument) == null ? void 0 : e.body, i2 = X(n.scrollWidth, n.clientWidth, o ? o.scrollWidth : 0, o ? o.clientWidth : 0), a = X(n.scrollHeight, n.clientHeight, o ? o.scrollHeight : 0, o ? o.clientHeight : 0), s = -r2.scrollLeft + Be(t2), f = -r2.scrollTop;
return N(o || n).direction === "rtl" && (s += X(n.clientWidth, o ? o.clientWidth : 0) - i2), { width: i2, height: a, x: s, y: f };
}
function Se(t2) {
var e = N(t2), n = e.overflow, r2 = e.overflowX, o = e.overflowY;
return /auto|scroll|overlay|hidden/.test(n + o + r2);
}
function dt(t2) {
return ["html", "body", "#document"].indexOf(C(t2)) >= 0 ? t2.ownerDocument.body : B(t2) && Se(t2) ? t2 : dt(ge(t2));
}
function ce(t2, e) {
var n;
e === void 0 && (e = []);
var r2 = dt(t2), o = r2 === ((n = t2.ownerDocument) == null ? void 0 : n.body), i2 = H(r2), a = o ? [i2].concat(i2.visualViewport || [], Se(r2) ? r2 : []) : r2, s = e.concat(a);
return o ? s : s.concat(ce(ge(a)));
}
function Te(t2) {
return Object.assign({}, t2, { left: t2.x, top: t2.y, right: t2.x + t2.width, bottom: t2.y + t2.height });
}
function Xt(t2) {
var e = ee(t2);
return e.top = e.top + t2.clientTop, e.left = e.left + t2.clientLeft, e.bottom = e.top + t2.clientHeight, e.right = e.left + t2.clientWidth, e.width = t2.clientWidth, e.height = t2.clientHeight, e.x = e.left, e.y = e.top, e;
}
function ht(t2, e) {
return e === je ? Te(Ft(t2)) : Q(e) ? Xt(e) : Te(Ut(I(t2)));
}
function Yt(t2) {
var e = ce(ge(t2)), n = ["absolute", "fixed"].indexOf(N(t2).position) >= 0, r2 = n && B(t2) ? se(t2) : t2;
return Q(r2) ? e.filter(function(o) {
return Q(o) && it(o, r2) && C(o) !== "body";
}) : [];
}
function Gt(t2, e, n) {
var r2 = e === "clippingParents" ? Yt(t2) : [].concat(e), o = [].concat(r2, [n]), i2 = o[0], a = o.reduce(function(s, f) {
var c = ht(t2, f);
return s.top = X(c.top, s.top), s.right = ve(c.right, s.right), s.bottom = ve(c.bottom, s.bottom), s.left = X(c.left, s.left), s;
}, ht(t2, i2));
return a.width = a.right - a.left, a.height = a.bottom - a.top, a.x = a.left, a.y = a.top, a;
}
function mt(t2) {
var e = t2.reference, n = t2.element, r2 = t2.placement, o = r2 ? q(r2) : null, i2 = r2 ? te(r2) : null, a = e.x + e.width / 2 - n.width / 2, s = e.y + e.height / 2 - n.height / 2, f;
switch (o) {
case E:
f = { x: a, y: e.y - n.height };
break;
case R:
f = { x: a, y: e.y + e.height };
break;
case W:
f = { x: e.x + e.width, y: s };
break;
case P:
f = { x: e.x - n.width, y: s };
break;
default:
f = { x: e.x, y: e.y };
}
var c = o ? Le(o) : null;
if (c != null) {
var u = c === "y" ? "height" : "width";
switch (i2) {
case U:
f[c] = f[c] - (e[u] / 2 - n[u] / 2);
break;
case J:
f[c] = f[c] + (e[u] / 2 - n[u] / 2);
break;
}
}
return f;
}
function ne(t2, e) {
e === void 0 && (e = {});
var n = e, r2 = n.placement, o = r2 === void 0 ? t2.placement : r2, i2 = n.boundary, a = i2 === void 0 ? Xe : i2, s = n.rootBoundary, f = s === void 0 ? je : s, c = n.elementContext, u = c === void 0 ? K : c, m = n.altBoundary, v = m === void 0 ? false : m, l = n.padding, h2 = l === void 0 ? 0 : l, p = ft(typeof h2 != "number" ? h2 : ct(h2, G)), g = u === K ? Ye : K, x = t2.rects.popper, y = t2.elements[v ? g : u], $2 = Gt(Q(y) ? y : y.contextElement || I(t2.elements.popper), a, f), d2 = ee(t2.elements.reference), b = mt({ reference: d2, element: x, strategy: "absolute", placement: o }), w = Te(Object.assign({}, x, b)), O = u === K ? w : d2, j = { top: $2.top - O.top + p.top, bottom: O.bottom - $2.bottom + p.bottom, left: $2.left - O.left + p.left, right: O.right - $2.right + p.right }, A = t2.modifiersData.offset;
if (u === K && A) {
var k = A[o];
Object.keys(j).forEach(function(D) {
var S = [W, R].indexOf(D) >= 0 ? 1 : -1, L = [E, R].indexOf(D) >= 0 ? "y" : "x";
j[D] += k[L] * S;
});
}
return j;
}
function Jt(t2, e) {
e === void 0 && (e = {});
var n = e, r2 = n.placement, o = n.boundary, i2 = n.rootBoundary, a = n.padding, s = n.flipVariations, f = n.allowedAutoPlacements, c = f === void 0 ? Ee : f, u = te(r2), m = u ? s ? De : De.filter(function(h2) {
return te(h2) === u;
}) : G, v = m.filter(function(h2) {
return c.indexOf(h2) >= 0;
});
v.length === 0 && (v = m);
var l = v.reduce(function(h2, p) {
return h2[p] = ne(t2, { placement: p, boundary: o, rootBoundary: i2, padding: a })[q(p)], h2;
}, {});
return Object.keys(l).sort(function(h2, p) {
return l[h2] - l[p];
});
}
function Kt(t2) {
if (q(t2) === me)
return [];
var e = be(t2);
return [lt(t2), e, lt(e)];
}
function Qt(t2) {
var e = t2.state, n = t2.options, r2 = t2.name;
if (!e.modifiersData[r2]._skip) {
for (var o = n.mainAxis, i2 = o === void 0 ? true : o, a = n.altAxis, s = a === void 0 ? true : a, f = n.fallbackPlacements, c = n.padding, u = n.boundary, m = n.rootBoundary, v = n.altBoundary, l = n.flipVariations, h2 = l === void 0 ? true : l, p = n.allowedAutoPlacements, g = e.options.placement, x = q(g), y = x === g, $2 = f || (y || !h2 ? [be(g)] : Kt(g)), d2 = [g].concat($2).reduce(function(z, V) {
return z.concat(q(V) === me ? Jt(e, { placement: V, boundary: u, rootBoundary: m, padding: c, flipVariations: h2, allowedAutoPlacements: p }) : V);
}, []), b = e.rects.reference, w = e.rects.popper, O = /* @__PURE__ */ new Map(), j = true, A = d2[0], k = 0; k < d2.length; k++) {
var D = d2[k], S = q(D), L = te(D) === U, re = [E, R].indexOf(S) >= 0, oe = re ? "width" : "height", M = ne(e, { placement: D, boundary: u, rootBoundary: m, altBoundary: v, padding: c }), T = re ? L ? W : P : L ? R : E;
b[oe] > w[oe] && (T = be(T));
var pe = be(T), _ = [];
if (i2 && _.push(M[S] <= 0), s && _.push(M[T] <= 0, M[pe] <= 0), _.every(function(z) {
return z;
})) {
A = D, j = false;
break;
}
O.set(D, _);
}
if (j)
for (var ue = h2 ? 3 : 1, xe = function(z) {
var V = d2.find(function(de) {
var ae = O.get(de);
if (ae)
return ae.slice(0, z).every(function(Y) {
return Y;
});
});
if (V)
return A = V, "break";
}, ie = ue; ie > 0; ie--) {
var le = xe(ie);
if (le === "break")
break;
}
e.placement !== A && (e.modifiersData[r2]._skip = true, e.placement = A, e.reset = true);
}
}
var vt = { name: "flip", enabled: true, phase: "main", fn: Qt, requiresIfExists: ["offset"], data: { _skip: false } };
function gt(t2, e, n) {
return n === void 0 && (n = { x: 0, y: 0 }), { top: t2.top - e.height - n.y, right: t2.right - e.width + n.x, bottom: t2.bottom - e.height + n.y, left: t2.left - e.width - n.x };
}
function yt(t2) {
return [E, W, R, P].some(function(e) {
return t2[e] >= 0;
});
}
function Zt(t2) {
var e = t2.state, n = t2.name, r2 = e.rects.reference, o = e.rects.popper, i2 = e.modifiersData.preventOverflow, a = ne(e, { elementContext: "reference" }), s = ne(e, { altBoundary: true }), f = gt(a, r2), c = gt(s, o, i2), u = yt(f), m = yt(c);
e.modifiersData[n] = { referenceClippingOffsets: f, popperEscapeOffsets: c, isReferenceHidden: u, hasPopperEscaped: m }, e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-reference-hidden": u, "data-popper-escaped": m });
}
var bt = { name: "hide", enabled: true, phase: "main", requiresIfExists: ["preventOverflow"], fn: Zt };
function en$1(t2, e, n) {
var r2 = q(t2), o = [P, E].indexOf(r2) >= 0 ? -1 : 1, i2 = typeof n == "function" ? n(Object.assign({}, e, { placement: t2 })) : n, a = i2[0], s = i2[1];
return a = a || 0, s = (s || 0) * o, [P, W].indexOf(r2) >= 0 ? { x: s, y: a } : { x: a, y: s };
}
function tn(t2) {
var e = t2.state, n = t2.options, r2 = t2.name, o = n.offset, i2 = o === void 0 ? [0, 0] : o, a = Ee.reduce(function(u, m) {
return u[m] = en$1(m, e.rects, i2), u;
}, {}), s = a[e.placement], f = s.x, c = s.y;
e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += f, e.modifiersData.popperOffsets.y += c), e.modifiersData[r2] = a;
}
var wt = { name: "offset", enabled: true, phase: "main", requires: ["popperOffsets"], fn: tn };
function nn(t2) {
var e = t2.state, n = t2.name;
e.modifiersData[n] = mt({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement });
}
var He = { name: "popperOffsets", enabled: true, phase: "read", fn: nn, data: {} };
function rn(t2) {
return t2 === "x" ? "y" : "x";
}
function on$2(t2) {
var e = t2.state, n = t2.options, r2 = t2.name, o = n.mainAxis, i2 = o === void 0 ? true : o, a = n.altAxis, s = a === void 0 ? false : a, f = n.boundary, c = n.rootBoundary, u = n.altBoundary, m = n.padding, v = n.tether, l = v === void 0 ? true : v, h2 = n.tetherOffset, p = h2 === void 0 ? 0 : h2, g = ne(e, { boundary: f, rootBoundary: c, padding: m, altBoundary: u }), x = q(e.placement), y = te(e.placement), $2 = !y, d2 = Le(x), b = rn(d2), w = e.modifiersData.popperOffsets, O = e.rects.reference, j = e.rects.popper, A = typeof p == "function" ? p(Object.assign({}, e.rects, { placement: e.placement })) : p, k = typeof A == "number" ? { mainAxis: A, altAxis: A } : Object.assign({ mainAxis: 0, altAxis: 0 }, A), D = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, S = { x: 0, y: 0 };
if (w) {
if (i2) {
var L, re = d2 === "y" ? E : P, oe = d2 === "y" ? R : W, M = d2 === "y" ? "height" : "width", T = w[d2], pe = T + g[re], _ = T - g[oe], ue = l ? -j[M] / 2 : 0, xe = y === U ? O[M] : j[M], ie = y === U ? -j[M] : -O[M], le = e.elements.arrow, z = l && le ? ke(le) : { width: 0, height: 0 }, V = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : st(), de = V[re], ae = V[oe], Y = fe(0, O[M], z[M]), jt = $2 ? O[M] / 2 - ue - Y - de - k.mainAxis : xe - Y - de - k.mainAxis, Dt = $2 ? -O[M] / 2 + ue + Y + ae + k.mainAxis : ie + Y + ae + k.mainAxis, Oe = e.elements.arrow && se(e.elements.arrow), Et = Oe ? d2 === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, Ce = (L = D == null ? void 0 : D[d2]) != null ? L : 0, Pt = T + jt - Ce - Et, At = T + Dt - Ce, qe = fe(l ? ve(pe, Pt) : pe, T, l ? X(_, At) : _);
w[d2] = qe, S[d2] = qe - T;
}
if (s) {
var Ve, kt = d2 === "x" ? E : P, Lt = d2 === "x" ? R : W, F = w[b], he = b === "y" ? "height" : "width", Ne = F + g[kt], Ie = F - g[Lt], $e = [E, P].indexOf(x) !== -1, _e = (Ve = D == null ? void 0 : D[b]) != null ? Ve : 0, ze = $e ? Ne : F - O[he] - j[he] - _e + k.altAxis, Fe = $e ? F + O[he] + j[he] - _e - k.altAxis : Ie, Ue = l && $e ? St(ze, F, Fe) : fe(l ? ze : Ne, F, l ? Fe : Ie);
w[b] = Ue, S[b] = Ue - F;
}
e.modifiersData[r2] = S;
}
}
var xt = { name: "preventOverflow", enabled: true, phase: "main", fn: on$2, requiresIfExists: ["offset"] };
function an(t2) {
return { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop };
}
function sn(t2) {
return t2 === H(t2) || !B(t2) ? We(t2) : an(t2);
}
function fn(t2) {
var e = t2.getBoundingClientRect(), n = Z(e.width) / t2.offsetWidth || 1, r2 = Z(e.height) / t2.offsetHeight || 1;
return n !== 1 || r2 !== 1;
}
function cn(t2, e, n) {
n === void 0 && (n = false);
var r2 = B(e), o = B(e) && fn(e), i2 = I(e), a = ee(t2, o), s = { scrollLeft: 0, scrollTop: 0 }, f = { x: 0, y: 0 };
return (r2 || !r2 && !n) && ((C(e) !== "body" || Se(i2)) && (s = sn(e)), B(e) ? (f = ee(e, true), f.x += e.clientLeft, f.y += e.clientTop) : i2 && (f.x = Be(i2))), { x: a.left + s.scrollLeft - f.x, y: a.top + s.scrollTop - f.y, width: a.width, height: a.height };
}
function pn(t2) {
var e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r2 = [];
t2.forEach(function(i2) {
e.set(i2.name, i2);
});
function o(i2) {
n.add(i2.name);
var a = [].concat(i2.requires || [], i2.requiresIfExists || []);
a.forEach(function(s) {
if (!n.has(s)) {
var f = e.get(s);
f && o(f);
}
}), r2.push(i2);
}
return t2.forEach(function(i2) {
n.has(i2.name) || o(i2);
}), r2;
}
function un(t2) {
var e = pn(t2);
return ot.reduce(function(n, r2) {
return n.concat(e.filter(function(o) {
return o.phase === r2;
}));
}, []);
}
function ln(t2) {
var e;
return function() {
return e || (e = new Promise(function(n) {
Promise.resolve().then(function() {
e = void 0, n(t2());
});
})), e;
};
}
function dn(t2) {
var e = t2.reduce(function(n, r2) {
var o = n[r2.name];
return n[r2.name] = o ? Object.assign({}, o, r2, { options: Object.assign({}, o.options, r2.options), data: Object.assign({}, o.data, r2.data) }) : r2, n;
}, {});
return Object.keys(e).map(function(n) {
return e[n];
});
}
var Ot = { placement: "bottom", modifiers: [], strategy: "absolute" };
function $t() {
for (var t2 = arguments.length, e = new Array(t2), n = 0; n < t2; n++)
e[n] = arguments[n];
return !e.some(function(r2) {
return !(r2 && typeof r2.getBoundingClientRect == "function");
});
}
function we(t2) {
t2 === void 0 && (t2 = {});
var e = t2, n = e.defaultModifiers, r2 = n === void 0 ? [] : n, o = e.defaultOptions, i2 = o === void 0 ? Ot : o;
return function(a, s, f) {
f === void 0 && (f = i2);
var c = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, Ot, i2), modifiersData: {}, elements: { reference: a, popper: s }, attributes: {}, styles: {} }, u = [], m = false, v = { state: c, setOptions: function(p) {
var g = typeof p == "function" ? p(c.options) : p;
h2(), c.options = Object.assign({}, i2, c.options, g), c.scrollParents = { reference: Q(a) ? ce(a) : a.contextElement ? ce(a.contextElement) : [], popper: ce(s) };
var x = un(dn([].concat(r2, c.options.modifiers)));
return c.orderedModifiers = x.filter(function(y) {
return y.enabled;
}), l(), v.update();
}, forceUpdate: function() {
if (!m) {
var p = c.elements, g = p.reference, x = p.popper;
if ($t(g, x)) {
c.rects = { reference: cn(g, se(x), c.options.strategy === "fixed"), popper: ke(x) }, c.reset = false, c.placement = c.options.placement, c.orderedModifiers.forEach(function(j) {
return c.modifiersData[j.name] = Object.assign({}, j.data);
});
for (var y = 0; y < c.orderedModifiers.length; y++) {
if (c.reset === true) {
c.reset = false, y = -1;
continue;
}
var $2 = c.orderedModifiers[y], d2 = $2.fn, b = $2.options, w = b === void 0 ? {} : b, O = $2.name;
typeof d2 == "function" && (c = d2({ state: c, options: w, name: O, instance: v }) || c);
}
}
}
}, update: ln(function() {
return new Promise(function(p) {
v.forceUpdate(), p(c);
});
}), destroy: function() {
h2(), m = true;
} };
if (!$t(a, s))
return v;
v.setOptions(f).then(function(p) {
!m && f.onFirstUpdate && f.onFirstUpdate(p);
});
function l() {
c.orderedModifiers.forEach(function(p) {
var g = p.name, x = p.options, y = x === void 0 ? {} : x, $2 = p.effect;
if (typeof $2 == "function") {
var d2 = $2({ state: c, name: g, instance: v, options: y }), b = function() {
};
u.push(d2 || b);
}
});
}
function h2() {
u.forEach(function(p) {
return p();
}), u = [];
}
return v;
};
}
we();
var mn = [Re, He, Me, Ae];
we({ defaultModifiers: mn });
var gn = [Re, He, Me, Ae, wt, vt, xt, pt, bt], yn = we({ defaultModifiers: gn });
const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
const stateUpdater = {
name: "updateState",
enabled: true,
phase: "write",
fn: ({ state }) => {
const derivedState = deriveState(state);
Object.assign(states.value, derivedState);
},
requires: ["computeStyles"]
};
const options2 = computed$1(() => {
const { onFirstUpdate, placement, strategy, modifiers } = unref(opts);
return {
onFirstUpdate,
placement: placement || "bottom",
strategy: strategy || "absolute",
modifiers: [
...modifiers || [],
stateUpdater,
{ name: "applyStyles", enabled: false }
]
};
});
const instanceRef = shallowRef();
const states = ref({
styles: {
popper: {
position: unref(options2).strategy,
left: "0",
top: "0"
},
arrow: {
position: "absolute"
}
},
attributes: {}
});
const destroy = () => {
if (!instanceRef.value)
return;
instanceRef.value.destroy();
instanceRef.value = void 0;
};
watch(options2, (newOptions) => {
const instance = unref(instanceRef);
if (instance) {
instance.setOptions(newOptions);
}
}, {
deep: true
});
watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
destroy();
if (!referenceElement || !popperElement)
return;
instanceRef.value = yn(referenceElement, popperElement, unref(options2));
});
onBeforeUnmount(() => {
destroy();
});
return {
state: computed$1(() => {
var _a2;
return { ...((_a2 = unref(instanceRef)) == null ? void 0 : _a2.state) || {} };
}),
styles: computed$1(() => unref(states).styles),
attributes: computed$1(() => unref(states).attributes),
update: () => {
var _a2;
return (_a2 = unref(instanceRef)) == null ? void 0 : _a2.update();
},
forceUpdate: () => {
var _a2;
return (_a2 = unref(instanceRef)) == null ? void 0 : _a2.forceUpdate();
},
instanceRef: computed$1(() => unref(instanceRef))
};
};
function deriveState(state) {
const elements = Object.keys(state.elements);
const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
return {
styles,
attributes
};
}
const useSameTarget = (handleClick) => {
if (!handleClick) {
return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
}
let mousedownTarget = false;
let mouseupTarget = false;
const onClick = (e) => {
if (mousedownTarget && mouseupTarget) {
handleClick(e);
}
mousedownTarget = mouseupTarget = false;
};
const onMousedown = (e) => {
mousedownTarget = e.target === e.currentTarget;
};
const onMouseup = (e) => {
mouseupTarget = e.target === e.currentTarget;
};
return { onClick, onMousedown, onMouseup };
};
function useTimeout() {
let timeoutHandle;
const registerTimeout = (fn2, delay) => {
cancelTimeout();
timeoutHandle = window.setTimeout(fn2, delay);
};
const cancelTimeout = () => window.clearTimeout(timeoutHandle);
tryOnScopeDispose(() => cancelTimeout());
return {
registerTimeout,
cancelTimeout
};
}
const defaultIdInjection = {
prefix: Math.floor(Math.random() * 1e4),
current: 0
};
const ID_INJECTION_KEY = Symbol("elIdInjection");
const useIdInjection = () => {
return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
};
const useId = (deterministicId) => {
const idInjection = useIdInjection();
const namespace = useGetDerivedNamespace();
const idRef = computed$1(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
return idRef;
};
let registeredEscapeHandlers = [];
const cachedHandler = (e) => {
const event2 = e;
if (event2.key === EVENT_CODE.esc) {
registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event2));
}
};
const useEscapeKeydown = (handler) => {
onMounted(() => {
if (registeredEscapeHandlers.length === 0) {
document.addEventListener("keydown", cachedHandler);
}
if (isClient)
registeredEscapeHandlers.push(handler);
});
onBeforeUnmount(() => {
registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
if (registeredEscapeHandlers.length === 0) {
if (isClient)
document.removeEventListener("keydown", cachedHandler);
}
});
};
let cachedContainer;
const usePopperContainerId = () => {
const namespace = useGetDerivedNamespace();
const idInjection = useIdInjection();
const id = computed$1(() => {
return `${namespace.value}-popper-container-${idInjection.prefix}`;
});
const selector = computed$1(() => `#${id.value}`);
return {
id,
selector
};
};
const createContainer = (id) => {
const container = document.createElement("div");
container.id = id;
document.body.appendChild(container);
return container;
};
const usePopperContainer = () => {
const { id, selector } = usePopperContainerId();
onBeforeMount(() => {
if (!isClient)
return;
if (!cachedContainer && !document.body.querySelector(selector.value)) {
cachedContainer = createContainer(id.value);
}
});
return {
id,
selector
};
};
const useDelayedToggleProps = buildProps({
showAfter: {
type: Number,
default: 0
},
hideAfter: {
type: Number,
default: 200
},
autoClose: {
type: Number,
default: 0
}
});
const useDelayedToggle = ({
showAfter,
hideAfter,
autoClose,
open,
close
}) => {
const { registerTimeout } = useTimeout();
const {
registerTimeout: registerTimeoutForAutoClose,
cancelTimeout: cancelTimeoutForAutoClose
} = useTimeout();
const onOpen = (event2) => {
registerTimeout(() => {
open(event2);
const _autoClose = unref(autoClose);
if (isNumber(_autoClose) && _autoClose > 0) {
registerTimeoutForAutoClose(() => {
close(event2);
}, _autoClose);
}
}, unref(showAfter));
};
const onClose = (event2) => {
cancelTimeoutForAutoClose();
registerTimeout(() => {
close(event2);
}, unref(hideAfter));
};
return {
onOpen,
onClose
};
};
const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
const useForwardRef = (forwardRef) => {
const setForwardRef = (el) => {
forwardRef.value = el;
};
provide(FORWARD_REF_INJECTION_KEY, {
setForwardRef
});
};
const useForwardRefDirective = (setForwardRef) => {
return {
mounted(el) {
setForwardRef(el);
},
updated(el) {
setForwardRef(el);
},
unmounted() {
setForwardRef(null);
}
};
};
const zIndex = ref(0);
const defaultInitialZIndex = 2e3;
const zIndexContextKey = Symbol("zIndexContextKey");
const useZIndex = (zIndexOverrides) => {
const zIndexInjection = zIndexOverrides || inject(zIndexContextKey, void 0);
const initialZIndex = computed$1(() => {
const zIndexFromInjection = unref(zIndexInjection);
return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
});
const currentZIndex = computed$1(() => initialZIndex.value + zIndex.value);
const nextZIndex = () => {
zIndex.value++;
return currentZIndex.value;
};
return {
initialZIndex,
currentZIndex,
nextZIndex
};
};
function useCursor(input) {
const selectionRef = ref();
function recordCursor() {
if (input.value == void 0)
return;
const { selectionStart, selectionEnd, value } = input.value;
if (selectionStart == null || selectionEnd == null)
return;
const beforeTxt = value.slice(0, Math.max(0, selectionStart));
const afterTxt = value.slice(Math.max(0, selectionEnd));
selectionRef.value = {
selectionStart,
selectionEnd,
value,
beforeTxt,
afterTxt
};
}
function setCursor() {
if (input.value == void 0 || selectionRef.value == void 0)
return;
const { value } = input.value;
const { beforeTxt, afterTxt, selectionStart } = selectionRef.value;
if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
return;
let startPos = value.length;
if (value.endsWith(afterTxt)) {
startPos = value.length - afterTxt.length;
} else if (value.startsWith(beforeTxt)) {
startPos = beforeTxt.length;
} else {
const beforeLastChar = beforeTxt[selectionStart - 1];
const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
if (newIndex !== -1) {
startPos = newIndex + 1;
}
}
input.value.setSelectionRange(startPos, startPos);
}
return [recordCursor, setCursor];
}
const useSizeProp = buildProp({
type: String,
values: componentSizes,
required: false
});
const SIZE_INJECTION_KEY = Symbol("size");
const useGlobalSize = () => {
const injectedSize = inject(SIZE_INJECTION_KEY, {});
return computed$1(() => {
return unref(injectedSize.size) || "";
});
};
const configProviderContextKey = Symbol();
const globalConfig = ref();
function useGlobalConfig(key, defaultValue2 = void 0) {
const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
if (key) {
return computed$1(() => {
var _a2, _b;
return (_b = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b : defaultValue2;
});
} else {
return config;
}
}
const provideGlobalConfig = (config, app, global2 = false) => {
var _a2;
const inSetup = !!getCurrentInstance();
const oldConfig = inSetup ? useGlobalConfig() : void 0;
const provideFn = (_a2 = app == null ? void 0 : app.provide) != null ? _a2 : inSetup ? provide : void 0;
if (!provideFn) {
return;
}
const context = computed$1(() => {
const cfg = unref(config);
if (!(oldConfig == null ? void 0 : oldConfig.value))
return cfg;
return mergeConfig(oldConfig.value, cfg);
});
provideFn(configProviderContextKey, context);
provideFn(localeContextKey, computed$1(() => context.value.locale));
provideFn(namespaceContextKey, computed$1(() => context.value.namespace));
provideFn(zIndexContextKey, computed$1(() => context.value.zIndex));
provideFn(SIZE_INJECTION_KEY, {
size: computed$1(() => context.value.size || "")
});
if (global2 || !globalConfig.value) {
globalConfig.value = context.value;
}
return context;
};
const mergeConfig = (a, b) => {
var _a2;
const keys3 = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
const obj = {};
for (const key of keys3) {
obj[key] = (_a2 = b[key]) != null ? _a2 : a[key];
}
return obj;
};
const configProviderProps = buildProps({
a11y: {
type: Boolean,
default: true
},
locale: {
type: definePropType(Object)
},
size: useSizeProp,
button: {
type: definePropType(Object)
},
experimentalFeatures: {
type: definePropType(Object)
},
keyboardNavigation: {
type: Boolean,
default: true
},
message: {
type: definePropType(Object)
},
zIndex: Number,
namespace: {
type: String,
default: "el"
}
});
const messageConfig = {};
const ConfigProvider = defineComponent({
name: "ElConfigProvider",
props: configProviderProps,
setup(props, { slots }) {
watch(() => props.message, (val) => {
Object.assign(messageConfig, val != null ? val : {});
}, { immediate: true, deep: true });
const config = provideGlobalConfig(props);
return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
}
});
const ElConfigProvider = withInstall(ConfigProvider);
var _export_sfc$1 = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
const iconProps = buildProps({
size: {
type: definePropType([Number, String])
},
color: {
type: String
}
});
const __default__$o = defineComponent({
name: "ElIcon",
inheritAttrs: false
});
const _sfc_main$B = /* @__PURE__ */ defineComponent({
...__default__$o,
props: iconProps,
setup(__props) {
const props = __props;
const ns = useNamespace("icon");
const style = computed$1(() => {
const { size, color: color2 } = props;
if (!size && !color2)
return {};
return {
fontSize: isUndefined(size) ? void 0 : addUnit(size),
"--color": color2
};
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("i", mergeProps({
class: unref(ns).b(),
style: unref(style)
}, _ctx.$attrs), [
renderSlot(_ctx.$slots, "default")
], 16);
};
}
});
var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
const ElIcon = withInstall(Icon);
const formContextKey = Symbol("formContextKey");
const formItemContextKey = Symbol("formItemContextKey");
const useFormSize = (fallback, ignore = {}) => {
const emptyRef = ref(void 0);
const size = ignore.prop ? emptyRef : useProp("size");
const globalConfig2 = ignore.global ? emptyRef : useGlobalSize();
const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
return computed$1(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
};
const useFormDisabled = (fallback) => {
const disabled = useProp("disabled");
const form = inject(formContextKey, void 0);
return computed$1(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
};
const useFormItem = () => {
const form = inject(formContextKey, void 0);
const formItem = inject(formItemContextKey, void 0);
return {
form,
formItem
};
};
const useFormItemInputId = (props, {
formItemContext,
disableIdGeneration,
disableIdManagement
}) => {
if (!disableIdGeneration) {
disableIdGeneration = ref(false);
}
if (!disableIdManagement) {
disableIdManagement = ref(false);
}
const inputId = ref();
let idUnwatch = void 0;
const isLabeledByFormItem = computed$1(() => {
var _a2;
return !!(!props.label && formItemContext && formItemContext.inputIds && ((_a2 = formItemContext.inputIds) == null ? void 0 : _a2.length) <= 1);
});
onMounted(() => {
idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
if (newId !== inputId.value) {
if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
inputId.value && formItemContext.removeInputId(inputId.value);
if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
formItemContext.addInputId(newId);
}
}
inputId.value = newId;
}
}, { immediate: true });
});
onUnmounted(() => {
idUnwatch && idUnwatch();
if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
inputId.value && formItemContext.removeInputId(inputId.value);
}
});
return {
isLabeledByFormItem,
inputId
};
};
let hiddenTextarea = void 0;
const HIDDEN_STYLE = `
height:0 !important;
visibility:hidden !important;
${isFirefox() ? "" : "overflow:hidden !important;"}
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important;
`;
const CONTEXT_STYLE = [
"letter-spacing",
"line-height",
"padding-top",
"padding-bottom",
"font-family",
"font-weight",
"font-size",
"text-rendering",
"text-transform",
"width",
"text-indent",
"padding-left",
"padding-right",
"border-width",
"box-sizing"
];
function calculateNodeStyling(targetElement) {
const style = window.getComputedStyle(targetElement);
const boxSizing = style.getPropertyValue("box-sizing");
const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
return { contextStyle, paddingSize, borderSize, boxSizing };
}
function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
var _a2;
if (!hiddenTextarea) {
hiddenTextarea = document.createElement("textarea");
document.body.appendChild(hiddenTextarea);
}
const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
let height2 = hiddenTextarea.scrollHeight;
const result = {};
if (boxSizing === "border-box") {
height2 = height2 + borderSize;
} else if (boxSizing === "content-box") {
height2 = height2 - paddingSize;
}
hiddenTextarea.value = "";
const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
if (isNumber(minRows)) {
let minHeight = singleRowHeight * minRows;
if (boxSizing === "border-box") {
minHeight = minHeight + paddingSize + borderSize;
}
height2 = Math.max(minHeight, height2);
result.minHeight = `${minHeight}px`;
}
if (isNumber(maxRows)) {
let maxHeight = singleRowHeight * maxRows;
if (boxSizing === "border-box") {
maxHeight = maxHeight + paddingSize + borderSize;
}
height2 = Math.min(maxHeight, height2);
}
result.height = `${height2}px`;
(_a2 = hiddenTextarea.parentNode) == null ? void 0 : _a2.removeChild(hiddenTextarea);
hiddenTextarea = void 0;
return result;
}
const inputProps = buildProps({
id: {
type: String,
default: void 0
},
size: useSizeProp,
disabled: Boolean,
modelValue: {
type: definePropType([
String,
Number,
Object
]),
default: ""
},
type: {
type: String,
default: "text"
},
resize: {
type: String,
values: ["none", "both", "horizontal", "vertical"]
},
autosize: {
type: definePropType([Boolean, Object]),
default: false
},
autocomplete: {
type: String,
default: "off"
},
formatter: {
type: Function
},
parser: {
type: Function
},
placeholder: {
type: String
},
form: {
type: String
},
readonly: {
type: Boolean,
default: false
},
clearable: {
type: Boolean,
default: false
},
showPassword: {
type: Boolean,
default: false
},
showWordLimit: {
type: Boolean,
default: false
},
suffixIcon: {
type: iconPropType
},
prefixIcon: {
type: iconPropType
},
containerRole: {
type: String,
default: void 0
},
label: {
type: String,
default: void 0
},
tabindex: {
type: [String, Number],
default: 0
},
validateEvent: {
type: Boolean,
default: true
},
inputStyle: {
type: definePropType([Object, Array, String]),
default: () => mutable({})
}
});
const inputEmits = {
[UPDATE_MODEL_EVENT]: (value) => isString(value),
input: (value) => isString(value),
change: (value) => isString(value),
focus: (evt) => evt instanceof FocusEvent,
blur: (evt) => evt instanceof FocusEvent,
clear: () => true,
mouseleave: (evt) => evt instanceof MouseEvent,
mouseenter: (evt) => evt instanceof MouseEvent,
keydown: (evt) => evt instanceof Event,
compositionstart: (evt) => evt instanceof CompositionEvent,
compositionupdate: (evt) => evt instanceof CompositionEvent,
compositionend: (evt) => evt instanceof CompositionEvent
};
const _hoisted_1$g = ["role"];
const _hoisted_2$a = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form"];
const _hoisted_3$6 = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"];
const __default__$n = defineComponent({
name: "ElInput",
inheritAttrs: false
});
const _sfc_main$A = /* @__PURE__ */ defineComponent({
...__default__$n,
props: inputProps,
emits: inputEmits,
setup(__props, { expose, emit }) {
const props = __props;
const rawAttrs = useAttrs$1();
const slots = useSlots();
const containerAttrs = computed$1(() => {
const comboBoxAttrs = {};
if (props.containerRole === "combobox") {
comboBoxAttrs["aria-haspopup"] = rawAttrs["aria-haspopup"];
comboBoxAttrs["aria-owns"] = rawAttrs["aria-owns"];
comboBoxAttrs["aria-expanded"] = rawAttrs["aria-expanded"];
}
return comboBoxAttrs;
});
const containerKls = computed$1(() => [
props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
nsInput.m(inputSize.value),
nsInput.is("disabled", inputDisabled.value),
nsInput.is("exceed", inputExceed.value),
{
[nsInput.b("group")]: slots.prepend || slots.append,
[nsInput.bm("group", "append")]: slots.append,
[nsInput.bm("group", "prepend")]: slots.prepend,
[nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
[nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
[nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value
},
rawAttrs.class
]);
const wrapperKls = computed$1(() => [
nsInput.e("wrapper"),
nsInput.is("focus", focused.value)
]);
const attrs = useAttrs({
excludeKeys: computed$1(() => {
return Object.keys(containerAttrs.value);
})
});
const { form, formItem } = useFormItem();
const { inputId } = useFormItemInputId(props, {
formItemContext: formItem
});
const inputSize = useFormSize();
const inputDisabled = useFormDisabled();
const nsInput = useNamespace("input");
const nsTextarea = useNamespace("textarea");
const input = shallowRef();
const textarea = shallowRef();
const focused = ref(false);
const hovering = ref(false);
const isComposing = ref(false);
const passwordVisible = ref(false);
const countStyle = ref();
const textareaCalcStyle = shallowRef(props.inputStyle);
const _ref = computed$1(() => input.value || textarea.value);
const needStatusIcon = computed$1(() => {
var _a2;
return (_a2 = form == null ? void 0 : form.statusIcon) != null ? _a2 : false;
});
const validateState = computed$1(() => (formItem == null ? void 0 : formItem.validateState) || "");
const validateIcon = computed$1(() => validateState.value && ValidateComponentsMap[validateState.value]);
const passwordIcon = computed$1(() => passwordVisible.value ? view_default : hide_default);
const containerStyle = computed$1(() => [
rawAttrs.style,
props.inputStyle
]);
const textareaStyle = computed$1(() => [
props.inputStyle,
textareaCalcStyle.value,
{ resize: props.resize }
]);
const nativeInputValue = computed$1(() => isNil(props.modelValue) ? "" : String(props.modelValue));
const showClear = computed$1(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
const showPwdVisible = computed$1(() => props.showPassword && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (!!nativeInputValue.value || focused.value));
const isWordLimitVisible = computed$1(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
const textLength = computed$1(() => nativeInputValue.value.length);
const inputExceed = computed$1(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
const suffixVisible = computed$1(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
const [recordCursor, setCursor] = useCursor(input);
useResizeObserver(textarea, (entries) => {
onceInitSizeTextarea();
if (!isWordLimitVisible.value || props.resize !== "both")
return;
const entry = entries[0];
const { width: width2 } = entry.contentRect;
countStyle.value = {
right: `calc(100% - ${width2 + 15 + 6}px)`
};
});
const resizeTextarea = () => {
const { type: type2, autosize } = props;
if (!isClient || type2 !== "textarea" || !textarea.value)
return;
if (autosize) {
const minRows = isObject$5(autosize) ? autosize.minRows : void 0;
const maxRows = isObject$5(autosize) ? autosize.maxRows : void 0;
const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
textareaCalcStyle.value = {
overflowY: "hidden",
...textareaStyle2
};
nextTick(() => {
textarea.value.offsetHeight;
textareaCalcStyle.value = textareaStyle2;
});
} else {
textareaCalcStyle.value = {
minHeight: calcTextareaHeight(textarea.value).minHeight
};
}
};
const createOnceInitResize = (resizeTextarea2) => {
let isInit = false;
return () => {
var _a2;
if (isInit || !props.autosize)
return;
const isElHidden = ((_a2 = textarea.value) == null ? void 0 : _a2.offsetParent) === null;
if (!isElHidden) {
resizeTextarea2();
isInit = true;
}
};
};
const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
const setNativeInputValue = () => {
const input2 = _ref.value;
if (!input2 || input2.value === nativeInputValue.value)
return;
input2.value = nativeInputValue.value;
};
const handleInput = async (event2) => {
recordCursor();
let { value } = event2.target;
if (props.formatter) {
value = props.parser ? props.parser(value) : value;
value = props.formatter(value);
}
if (isComposing.value)
return;
if (value === nativeInputValue.value) {
setNativeInputValue();
return;
}
emit(UPDATE_MODEL_EVENT, value);
emit("input", value);
await nextTick();
setNativeInputValue();
setCursor();
};
const handleChange = (event2) => {
emit("change", event2.target.value);
};
const handleCompositionStart = (event2) => {
emit("compositionstart", event2);
isComposing.value = true;
};
const handleCompositionUpdate = (event2) => {
var _a2;
emit("compositionupdate", event2);
const text = (_a2 = event2.target) == null ? void 0 : _a2.value;
const lastCharacter = text[text.length - 1] || "";
isComposing.value = !isKorean(lastCharacter);
};
const handleCompositionEnd = (event2) => {
emit("compositionend", event2);
if (isComposing.value) {
isComposing.value = false;
handleInput(event2);
}
};
const handlePasswordVisible = () => {
passwordVisible.value = !passwordVisible.value;
focus();
};
const focus = async () => {
var _a2;
await nextTick();
(_a2 = _ref.value) == null ? void 0 : _a2.focus();
};
const blur = () => {
var _a2;
return (_a2 = _ref.value) == null ? void 0 : _a2.blur();
};
const handleFocus = (event2) => {
focused.value = true;
emit("focus", event2);
};
const handleBlur = (event2) => {
var _a2;
focused.value = false;
emit("blur", event2);
if (props.validateEvent) {
(_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
}
};
const handleMouseLeave = (evt) => {
hovering.value = false;
emit("mouseleave", evt);
};
const handleMouseEnter = (evt) => {
hovering.value = true;
emit("mouseenter", evt);
};
const handleKeydown = (evt) => {
emit("keydown", evt);
};
const select = () => {
var _a2;
(_a2 = _ref.value) == null ? void 0 : _a2.select();
};
const clear = () => {
emit(UPDATE_MODEL_EVENT, "");
emit("change", "");
emit("clear");
emit("input", "");
};
watch(() => props.modelValue, () => {
var _a2;
nextTick(() => resizeTextarea());
if (props.validateEvent) {
(_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
}
});
watch(nativeInputValue, () => setNativeInputValue());
watch(() => props.type, async () => {
await nextTick();
setNativeInputValue();
resizeTextarea();
});
onMounted(() => {
if (!props.formatter && props.parser)
;
setNativeInputValue();
nextTick(resizeTextarea);
});
expose({
input,
textarea,
ref: _ref,
textareaStyle,
autosize: toRef(props, "autosize"),
focus,
blur,
select,
clear,
resizeTextarea
});
return (_ctx, _cache) => {
return withDirectives((openBlock(), createElementBlock("div", mergeProps(unref(containerAttrs), {
class: unref(containerKls),
style: unref(containerStyle),
role: _ctx.containerRole,
onMouseenter: handleMouseEnter,
onMouseleave: handleMouseLeave
}), [
createCommentVNode(" input "),
_ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
createCommentVNode(" prepend slot "),
_ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(nsInput).be("group", "prepend"))
}, [
renderSlot(_ctx.$slots, "prepend")
], 2)) : createCommentVNode("v-if", true),
createElementVNode("div", {
class: normalizeClass(unref(wrapperKls))
}, [
createCommentVNode(" prefix slot "),
_ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass(unref(nsInput).e("prefix"))
}, [
createElementVNode("span", {
class: normalizeClass(unref(nsInput).e("prefix-inner")),
onClick: focus
}, [
renderSlot(_ctx.$slots, "prefix"),
_ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(nsInput).e("icon"))
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)
], 2)
], 2)) : createCommentVNode("v-if", true),
createElementVNode("input", mergeProps({
id: unref(inputId),
ref_key: "input",
ref: input,
class: unref(nsInput).e("inner")
}, unref(attrs), {
type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
disabled: unref(inputDisabled),
formatter: _ctx.formatter,
parser: _ctx.parser,
readonly: _ctx.readonly,
autocomplete: _ctx.autocomplete,
tabindex: _ctx.tabindex,
"aria-label": _ctx.label,
placeholder: _ctx.placeholder,
style: _ctx.inputStyle,
form: props.form,
onCompositionstart: handleCompositionStart,
onCompositionupdate: handleCompositionUpdate,
onCompositionend: handleCompositionEnd,
onInput: handleInput,
onFocus: handleFocus,
onBlur: handleBlur,
onChange: handleChange,
onKeydown: handleKeydown
}), null, 16, _hoisted_2$a),
createCommentVNode(" suffix slot "),
unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
key: 1,
class: normalizeClass(unref(nsInput).e("suffix"))
}, [
createElementVNode("span", {
class: normalizeClass(unref(nsInput).e("suffix-inner")),
onClick: focus
}, [
!unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
renderSlot(_ctx.$slots, "suffix"),
_ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(nsInput).e("icon"))
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)
], 64)) : createCommentVNode("v-if", true),
unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
key: 1,
class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
onMousedown: withModifiers(unref(NOOP), ["prevent"]),
onClick: clear
}, {
default: withCtx(() => [
createVNode(unref(circle_close_default))
]),
_: 1
}, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
key: 2,
class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
onClick: handlePasswordVisible
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true),
unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
key: 3,
class: normalizeClass(unref(nsInput).e("count"))
}, [
createElementVNode("span", {
class: normalizeClass(unref(nsInput).e("count-inner"))
}, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)
], 2)) : createCommentVNode("v-if", true),
unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
key: 4,
class: normalizeClass([
unref(nsInput).e("icon"),
unref(nsInput).e("validateIcon"),
unref(nsInput).is("loading", unref(validateState) === "validating")
])
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)
], 2)
], 2)) : createCommentVNode("v-if", true)
], 2),
createCommentVNode(" append slot "),
_ctx.$slots.append ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(unref(nsInput).be("group", "append"))
}, [
renderSlot(_ctx.$slots, "append")
], 2)) : createCommentVNode("v-if", true)
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
createCommentVNode(" textarea "),
createElementVNode("textarea", mergeProps({
id: unref(inputId),
ref_key: "textarea",
ref: textarea,
class: unref(nsTextarea).e("inner")
}, unref(attrs), {
tabindex: _ctx.tabindex,
disabled: unref(inputDisabled),
readonly: _ctx.readonly,
autocomplete: _ctx.autocomplete,
style: unref(textareaStyle),
"aria-label": _ctx.label,
placeholder: _ctx.placeholder,
form: props.form,
onCompositionstart: handleCompositionStart,
onCompositionupdate: handleCompositionUpdate,
onCompositionend: handleCompositionEnd,
onInput: handleInput,
onFocus: handleFocus,
onBlur: handleBlur,
onChange: handleChange,
onKeydown: handleKeydown
}), null, 16, _hoisted_3$6),
unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
key: 0,
style: normalizeStyle(countStyle.value),
class: normalizeClass(unref(nsInput).e("count"))
}, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 7)) : createCommentVNode("v-if", true)
], 64))
], 16, _hoisted_1$g)), [
[vShow, _ctx.type !== "hidden"]
]);
};
}
});
var Input = /* @__PURE__ */ _export_sfc$1(_sfc_main$A, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);
const ElInput = withInstall(Input);
const GAP = 4;
const BAR_MAP = {
vertical: {
offset: "offsetHeight",
scroll: "scrollTop",
scrollSize: "scrollHeight",
size: "height",
key: "vertical",
axis: "Y",
client: "clientY",
direction: "top"
},
horizontal: {
offset: "offsetWidth",
scroll: "scrollLeft",
scrollSize: "scrollWidth",
size: "width",
key: "horizontal",
axis: "X",
client: "clientX",
direction: "left"
}
};
const renderThumbStyle = ({
move,
size,
bar
}) => ({
[bar.size]: size,
transform: `translate${bar.axis}(${move}%)`
});
const scrollbarContextKey = Symbol("scrollbarContextKey");
const thumbProps = buildProps({
vertical: Boolean,
size: String,
move: Number,
ratio: {
type: Number,
required: true
},
always: Boolean
});
const COMPONENT_NAME$4 = "Thumb";
const _sfc_main$z = /* @__PURE__ */ defineComponent({
__name: "thumb",
props: thumbProps,
setup(__props) {
const props = __props;
const scrollbar = inject(scrollbarContextKey);
const ns = useNamespace("scrollbar");
if (!scrollbar)
throwError(COMPONENT_NAME$4, "can not inject scrollbar context");
const instance = ref();
const thumb = ref();
const thumbState = ref({});
const visible = ref(false);
let cursorDown = false;
let cursorLeave = false;
let originalOnSelectStart = isClient ? document.onselectstart : null;
const bar = computed$1(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
const thumbStyle = computed$1(() => renderThumbStyle({
size: props.size,
move: props.move,
bar: bar.value
}));
const offsetRatio = computed$1(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
const clickThumbHandler = (e) => {
var _a2;
e.stopPropagation();
if (e.ctrlKey || [1, 2].includes(e.button))
return;
(_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges();
startDrag(e);
const el = e.currentTarget;
if (!el)
return;
thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
};
const clickTrackHandler = (e) => {
if (!thumb.value || !instance.value || !scrollbar.wrapElement)
return;
const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
const thumbHalf = thumb.value[bar.value.offset] / 2;
const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
};
const startDrag = (e) => {
e.stopImmediatePropagation();
cursorDown = true;
document.addEventListener("mousemove", mouseMoveDocumentHandler);
document.addEventListener("mouseup", mouseUpDocumentHandler);
originalOnSelectStart = document.onselectstart;
document.onselectstart = () => false;
};
const mouseMoveDocumentHandler = (e) => {
if (!instance.value || !thumb.value)
return;
if (cursorDown === false)
return;
const prevPage = thumbState.value[bar.value.axis];
if (!prevPage)
return;
const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
};
const mouseUpDocumentHandler = () => {
cursorDown = false;
thumbState.value[bar.value.axis] = 0;
document.removeEventListener("mousemove", mouseMoveDocumentHandler);
document.removeEventListener("mouseup", mouseUpDocumentHandler);
restoreOnselectstart();
if (cursorLeave)
visible.value = false;
};
const mouseMoveScrollbarHandler = () => {
cursorLeave = false;
visible.value = !!props.size;
};
const mouseLeaveScrollbarHandler = () => {
cursorLeave = true;
visible.value = cursorDown;
};
onBeforeUnmount(() => {
restoreOnselectstart();
document.removeEventListener("mouseup", mouseUpDocumentHandler);
});
const restoreOnselectstart = () => {
if (document.onselectstart !== originalOnSelectStart)
document.onselectstart = originalOnSelectStart;
};
useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
return (_ctx, _cache) => {
return openBlock(), createBlock(Transition, {
name: unref(ns).b("fade"),
persisted: ""
}, {
default: withCtx(() => [
withDirectives(createElementVNode("div", {
ref_key: "instance",
ref: instance,
class: normalizeClass([unref(ns).e("bar"), unref(ns).is(unref(bar).key)]),
onMousedown: clickTrackHandler
}, [
createElementVNode("div", {
ref_key: "thumb",
ref: thumb,
class: normalizeClass(unref(ns).e("thumb")),
style: normalizeStyle(unref(thumbStyle)),
onMousedown: clickThumbHandler
}, null, 38)
], 34), [
[vShow, _ctx.always || visible.value]
])
]),
_: 1
}, 8, ["name"]);
};
}
});
var Thumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);
const barProps = buildProps({
always: {
type: Boolean,
default: true
},
width: String,
height: String,
ratioX: {
type: Number,
default: 1
},
ratioY: {
type: Number,
default: 1
}
});
const _sfc_main$y = /* @__PURE__ */ defineComponent({
__name: "bar",
props: barProps,
setup(__props, { expose }) {
const props = __props;
const moveX = ref(0);
const moveY = ref(0);
const handleScroll = (wrap) => {
if (wrap) {
const offsetHeight = wrap.offsetHeight - GAP;
const offsetWidth = wrap.offsetWidth - GAP;
moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
}
};
expose({
handleScroll
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock(Fragment, null, [
createVNode(Thumb, {
move: moveX.value,
ratio: _ctx.ratioX,
size: _ctx.width,
always: _ctx.always
}, null, 8, ["move", "ratio", "size", "always"]),
createVNode(Thumb, {
move: moveY.value,
ratio: _ctx.ratioY,
size: _ctx.height,
vertical: "",
always: _ctx.always
}, null, 8, ["move", "ratio", "size", "always"])
], 64);
};
}
});
var Bar = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);
const scrollbarProps = buildProps({
height: {
type: [String, Number],
default: ""
},
maxHeight: {
type: [String, Number],
default: ""
},
native: {
type: Boolean,
default: false
},
wrapStyle: {
type: definePropType([String, Object, Array]),
default: ""
},
wrapClass: {
type: [String, Array],
default: ""
},
viewClass: {
type: [String, Array],
default: ""
},
viewStyle: {
type: [String, Array, Object],
default: ""
},
noresize: Boolean,
tag: {
type: String,
default: "div"
},
always: Boolean,
minSize: {
type: Number,
default: 20
}
});
const scrollbarEmits = {
scroll: ({
scrollTop,
scrollLeft
}) => [scrollTop, scrollLeft].every(isNumber)
};
const COMPONENT_NAME$3 = "ElScrollbar";
const __default__$m = defineComponent({
name: COMPONENT_NAME$3
});
const _sfc_main$x = /* @__PURE__ */ defineComponent({
...__default__$m,
props: scrollbarProps,
emits: scrollbarEmits,
setup(__props, { expose, emit }) {
const props = __props;
const ns = useNamespace("scrollbar");
let stopResizeObserver = void 0;
let stopResizeListener = void 0;
const scrollbarRef = ref();
const wrapRef = ref();
const resizeRef = ref();
const sizeWidth = ref("0");
const sizeHeight = ref("0");
const barRef = ref();
const ratioY = ref(1);
const ratioX = ref(1);
const style = computed$1(() => {
const style2 = {};
if (props.height)
style2.height = addUnit(props.height);
if (props.maxHeight)
style2.maxHeight = addUnit(props.maxHeight);
return [props.wrapStyle, style2];
});
const wrapKls = computed$1(() => {
return [
props.wrapClass,
ns.e("wrap"),
{ [ns.em("wrap", "hidden-default")]: !props.native }
];
});
const resizeKls = computed$1(() => {
return [ns.e("view"), props.viewClass];
});
const handleScroll = () => {
var _a2;
if (wrapRef.value) {
(_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrapRef.value);
emit("scroll", {
scrollTop: wrapRef.value.scrollTop,
scrollLeft: wrapRef.value.scrollLeft
});
}
};
function scrollTo(arg1, arg2) {
if (isObject$5(arg1)) {
wrapRef.value.scrollTo(arg1);
} else if (isNumber(arg1) && isNumber(arg2)) {
wrapRef.value.scrollTo(arg1, arg2);
}
}
const setScrollTop = (value) => {
if (!isNumber(value)) {
return;
}
wrapRef.value.scrollTop = value;
};
const setScrollLeft = (value) => {
if (!isNumber(value)) {
return;
}
wrapRef.value.scrollLeft = value;
};
const update = () => {
if (!wrapRef.value)
return;
const offsetHeight = wrapRef.value.offsetHeight - GAP;
const offsetWidth = wrapRef.value.offsetWidth - GAP;
const originalHeight = offsetHeight ** 2 / wrapRef.value.scrollHeight;
const originalWidth = offsetWidth ** 2 / wrapRef.value.scrollWidth;
const height2 = Math.max(originalHeight, props.minSize);
const width2 = Math.max(originalWidth, props.minSize);
ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height2 / (offsetHeight - height2));
ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width2 / (offsetWidth - width2));
sizeHeight.value = height2 + GAP < offsetHeight ? `${height2}px` : "";
sizeWidth.value = width2 + GAP < offsetWidth ? `${width2}px` : "";
};
watch(() => props.noresize, (noresize) => {
if (noresize) {
stopResizeObserver == null ? void 0 : stopResizeObserver();
stopResizeListener == null ? void 0 : stopResizeListener();
} else {
({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
stopResizeListener = useEventListener("resize", update);
}
}, { immediate: true });
watch(() => [props.maxHeight, props.height], () => {
if (!props.native)
nextTick(() => {
var _a2;
update();
if (wrapRef.value) {
(_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrapRef.value);
}
});
});
provide(scrollbarContextKey, reactive({
scrollbarElement: scrollbarRef,
wrapElement: wrapRef
}));
onMounted(() => {
if (!props.native)
nextTick(() => {
update();
});
});
onUpdated(() => update());
expose({
wrapRef,
update,
scrollTo,
setScrollTop,
setScrollLeft,
handleScroll
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
ref_key: "scrollbarRef",
ref: scrollbarRef,
class: normalizeClass(unref(ns).b())
}, [
createElementVNode("div", {
ref_key: "wrapRef",
ref: wrapRef,
class: normalizeClass(unref(wrapKls)),
style: normalizeStyle(unref(style)),
onScroll: handleScroll
}, [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
ref_key: "resizeRef",
ref: resizeRef,
class: normalizeClass(unref(resizeKls)),
style: normalizeStyle(_ctx.viewStyle)
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 8, ["class", "style"]))
], 38),
!_ctx.native ? (openBlock(), createBlock(Bar, {
key: 0,
ref_key: "barRef",
ref: barRef,
height: sizeHeight.value,
width: sizeWidth.value,
always: _ctx.always,
"ratio-x": ratioX.value,
"ratio-y": ratioY.value
}, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
], 2);
};
}
});
var Scrollbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$x, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);
const ElScrollbar = withInstall(Scrollbar);
const POPPER_INJECTION_KEY = Symbol("popper");
const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
const roleTypes = [
"dialog",
"grid",
"group",
"listbox",
"menu",
"navigation",
"tooltip",
"tree"
];
const popperProps = buildProps({
role: {
type: String,
values: roleTypes,
default: "tooltip"
}
});
const __default__$l = defineComponent({
name: "ElPopper",
inheritAttrs: false
});
const _sfc_main$w = /* @__PURE__ */ defineComponent({
...__default__$l,
props: popperProps,
setup(__props, { expose }) {
const props = __props;
const triggerRef2 = ref();
const popperInstanceRef = ref();
const contentRef = ref();
const referenceRef = ref();
const role = computed$1(() => props.role);
const popperProvides = {
triggerRef: triggerRef2,
popperInstanceRef,
contentRef,
referenceRef,
role
};
expose(popperProvides);
provide(POPPER_INJECTION_KEY, popperProvides);
return (_ctx, _cache) => {
return renderSlot(_ctx.$slots, "default");
};
}
});
var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$w, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
const popperArrowProps = buildProps({
arrowOffset: {
type: Number,
default: 5
}
});
const __default__$k = defineComponent({
name: "ElPopperArrow",
inheritAttrs: false
});
const _sfc_main$v = /* @__PURE__ */ defineComponent({
...__default__$k,
props: popperArrowProps,
setup(__props, { expose }) {
const props = __props;
const ns = useNamespace("popper");
const { arrowOffset, arrowRef, arrowStyle } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
watch(() => props.arrowOffset, (val) => {
arrowOffset.value = val;
});
onBeforeUnmount(() => {
arrowRef.value = void 0;
});
expose({
arrowRef
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("span", {
ref_key: "arrowRef",
ref: arrowRef,
class: normalizeClass(unref(ns).e("arrow")),
style: normalizeStyle(unref(arrowStyle)),
"data-popper-arrow": ""
}, null, 6);
};
}
});
var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
const NAME = "ElOnlyChild";
const OnlyChild = defineComponent({
name: NAME,
setup(_, {
slots,
attrs
}) {
var _a2;
const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
const forwardRefDirective = useForwardRefDirective((_a2 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a2 : NOOP);
return () => {
var _a22;
const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
if (!defaultSlot)
return null;
if (defaultSlot.length > 1) {
return null;
}
const firstLegitNode = findFirstLegitChild(defaultSlot);
if (!firstLegitNode) {
return null;
}
return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
};
}
});
function findFirstLegitChild(node) {
if (!node)
return null;
const children = node;
for (const child of children) {
if (isObject$5(child)) {
switch (child.type) {
case Comment$1:
continue;
case Text$1:
case "svg":
return wrapTextContent(child);
case Fragment:
return findFirstLegitChild(child.children);
default:
return child;
}
}
return wrapTextContent(child);
}
return null;
}
function wrapTextContent(s) {
const ns = useNamespace("only-child");
return createVNode("span", {
"class": ns.e("content")
}, [s]);
}
const popperTriggerProps = buildProps({
virtualRef: {
type: definePropType(Object)
},
virtualTriggering: Boolean,
onMouseenter: {
type: definePropType(Function)
},
onMouseleave: {
type: definePropType(Function)
},
onClick: {
type: definePropType(Function)
},
onKeydown: {
type: definePropType(Function)
},
onFocus: {
type: definePropType(Function)
},
onBlur: {
type: definePropType(Function)
},
onContextmenu: {
type: definePropType(Function)
},
id: String,
open: Boolean
});
const __default__$j = defineComponent({
name: "ElPopperTrigger",
inheritAttrs: false
});
const _sfc_main$u = /* @__PURE__ */ defineComponent({
...__default__$j,
props: popperTriggerProps,
setup(__props, { expose }) {
const props = __props;
const { role, triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
useForwardRef(triggerRef2);
const ariaControls = computed$1(() => {
return ariaHaspopup.value ? props.id : void 0;
});
const ariaDescribedby = computed$1(() => {
if (role && role.value === "tooltip") {
return props.open && props.id ? props.id : void 0;
}
return void 0;
});
const ariaHaspopup = computed$1(() => {
if (role && role.value !== "tooltip") {
return role.value;
}
return void 0;
});
const ariaExpanded = computed$1(() => {
return ariaHaspopup.value ? `${props.open}` : void 0;
});
let virtualTriggerAriaStopWatch = void 0;
onMounted(() => {
watch(() => props.virtualRef, (virtualEl) => {
if (virtualEl) {
triggerRef2.value = unrefElement(virtualEl);
}
}, {
immediate: true
});
watch(triggerRef2, (el, prevEl) => {
virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
virtualTriggerAriaStopWatch = void 0;
if (isElement(el)) {
[
"onMouseenter",
"onMouseleave",
"onClick",
"onKeydown",
"onFocus",
"onBlur",
"onContextmenu"
].forEach((eventName) => {
var _a2;
const handler = props[eventName];
if (handler) {
el.addEventListener(eventName.slice(2).toLowerCase(), handler);
(_a2 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a2.call(prevEl, eventName.slice(2).toLowerCase(), handler);
}
});
virtualTriggerAriaStopWatch = watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
[
"aria-controls",
"aria-describedby",
"aria-haspopup",
"aria-expanded"
].forEach((key, idx) => {
isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
});
}, { immediate: true });
}
if (isElement(prevEl)) {
[
"aria-controls",
"aria-describedby",
"aria-haspopup",
"aria-expanded"
].forEach((key) => prevEl.removeAttribute(key));
}
}, {
immediate: true
});
});
onBeforeUnmount(() => {
virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
virtualTriggerAriaStopWatch = void 0;
});
expose({
triggerRef: triggerRef2
});
return (_ctx, _cache) => {
return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
"aria-controls": unref(ariaControls),
"aria-describedby": unref(ariaDescribedby),
"aria-expanded": unref(ariaExpanded),
"aria-haspopup": unref(ariaHaspopup)
}), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : createCommentVNode("v-if", true);
};
}
});
var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
const FOCUS_AFTER_TRAPPED_OPTS = {
cancelable: true,
bubbles: false
};
const FOCUSOUT_PREVENTED_OPTS = {
cancelable: true,
bubbles: false
};
const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
const focusReason = ref();
const lastUserFocusTimestamp = ref(0);
const lastAutomatedFocusTimestamp = ref(0);
let focusReasonUserCount = 0;
const obtainAllFocusableElements = (element) => {
const nodes = [];
const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
acceptNode: (node) => {
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
if (node.disabled || node.hidden || isHiddenInput)
return NodeFilter.FILTER_SKIP;
return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
}
});
while (walker.nextNode())
nodes.push(walker.currentNode);
return nodes;
};
const getVisibleElement = (elements, container) => {
for (const element of elements) {
if (!isHidden(element, container))
return element;
}
};
const isHidden = (element, container) => {
if (getComputedStyle(element).visibility === "hidden")
return true;
while (element) {
if (container && element === container)
return false;
if (getComputedStyle(element).display === "none")
return true;
element = element.parentElement;
}
return false;
};
const getEdges = (container) => {
const focusable = obtainAllFocusableElements(container);
const first = getVisibleElement(focusable, container);
const last = getVisibleElement(focusable.reverse(), container);
return [first, last];
};
const isSelectable = (element) => {
return element instanceof HTMLInputElement && "select" in element;
};
const tryFocus = (element, shouldSelect) => {
if (element && element.focus) {
const prevFocusedElement = document.activeElement;
element.focus({ preventScroll: true });
lastAutomatedFocusTimestamp.value = window.performance.now();
if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
element.select();
}
}
};
function removeFromStack(list, item) {
const copy2 = [...list];
const idx = list.indexOf(item);
if (idx !== -1) {
copy2.splice(idx, 1);
}
return copy2;
}
const createFocusableStack = () => {
let stack = [];
const push = (layer) => {
const currentLayer = stack[0];
if (currentLayer && layer !== currentLayer) {
currentLayer.pause();
}
stack = removeFromStack(stack, layer);
stack.unshift(layer);
};
const remove2 = (layer) => {
var _a2, _b;
stack = removeFromStack(stack, layer);
(_b = (_a2 = stack[0]) == null ? void 0 : _a2.resume) == null ? void 0 : _b.call(_a2);
};
return {
push,
remove: remove2
};
};
const focusFirstDescendant = (elements, shouldSelect = false) => {
const prevFocusedElement = document.activeElement;
for (const element of elements) {
tryFocus(element, shouldSelect);
if (document.activeElement !== prevFocusedElement)
return;
}
};
const focusableStack = createFocusableStack();
const isFocusCausedByUserEvent = () => {
return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
};
const notifyFocusReasonPointer = () => {
focusReason.value = "pointer";
lastUserFocusTimestamp.value = window.performance.now();
};
const notifyFocusReasonKeydown = () => {
focusReason.value = "keyboard";
lastUserFocusTimestamp.value = window.performance.now();
};
const useFocusReason = () => {
onMounted(() => {
if (focusReasonUserCount === 0) {
document.addEventListener("mousedown", notifyFocusReasonPointer);
document.addEventListener("touchstart", notifyFocusReasonPointer);
document.addEventListener("keydown", notifyFocusReasonKeydown);
}
focusReasonUserCount++;
});
onBeforeUnmount(() => {
focusReasonUserCount--;
if (focusReasonUserCount <= 0) {
document.removeEventListener("mousedown", notifyFocusReasonPointer);
document.removeEventListener("touchstart", notifyFocusReasonPointer);
document.removeEventListener("keydown", notifyFocusReasonKeydown);
}
});
return {
focusReason,
lastUserFocusTimestamp,
lastAutomatedFocusTimestamp
};
};
const createFocusOutPreventedEvent = (detail) => {
return new CustomEvent(FOCUSOUT_PREVENTED, {
...FOCUSOUT_PREVENTED_OPTS,
detail
});
};
const _sfc_main$t = defineComponent({
name: "ElFocusTrap",
inheritAttrs: false,
props: {
loop: Boolean,
trapped: Boolean,
focusTrapEl: Object,
focusStartEl: {
type: [Object, String],
default: "first"
}
},
emits: [
ON_TRAP_FOCUS_EVT,
ON_RELEASE_FOCUS_EVT,
"focusin",
"focusout",
"focusout-prevented",
"release-requested"
],
setup(props, { emit }) {
const forwardRef = ref();
let lastFocusBeforeTrapped;
let lastFocusAfterTrapped;
const { focusReason: focusReason2 } = useFocusReason();
useEscapeKeydown((event2) => {
if (props.trapped && !focusLayer.paused) {
emit("release-requested", event2);
}
});
const focusLayer = {
paused: false,
pause() {
this.paused = true;
},
resume() {
this.paused = false;
}
};
const onKeydown = (e) => {
if (!props.loop && !props.trapped)
return;
if (focusLayer.paused)
return;
const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
const { loop } = props;
const isTabbing = key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
const currentFocusingEl = document.activeElement;
if (isTabbing && currentFocusingEl) {
const container = currentTarget;
const [first, last] = getEdges(container);
const isTabbable = first && last;
if (!isTabbable) {
if (currentFocusingEl === container) {
const focusoutPreventedEvent = createFocusOutPreventedEvent({
focusReason: focusReason2.value
});
emit("focusout-prevented", focusoutPreventedEvent);
if (!focusoutPreventedEvent.defaultPrevented) {
e.preventDefault();
}
}
} else {
if (!shiftKey && currentFocusingEl === last) {
const focusoutPreventedEvent = createFocusOutPreventedEvent({
focusReason: focusReason2.value
});
emit("focusout-prevented", focusoutPreventedEvent);
if (!focusoutPreventedEvent.defaultPrevented) {
e.preventDefault();
if (loop)
tryFocus(first, true);
}
} else if (shiftKey && [first, container].includes(currentFocusingEl)) {
const focusoutPreventedEvent = createFocusOutPreventedEvent({
focusReason: focusReason2.value
});
emit("focusout-prevented", focusoutPreventedEvent);
if (!focusoutPreventedEvent.defaultPrevented) {
e.preventDefault();
if (loop)
tryFocus(last, true);
}
}
}
}
};
provide(FOCUS_TRAP_INJECTION_KEY, {
focusTrapRef: forwardRef,
onKeydown
});
watch(() => props.focusTrapEl, (focusTrapEl) => {
if (focusTrapEl) {
forwardRef.value = focusTrapEl;
}
}, { immediate: true });
watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
if (forwardRef2) {
forwardRef2.addEventListener("keydown", onKeydown);
forwardRef2.addEventListener("focusin", onFocusIn);
forwardRef2.addEventListener("focusout", onFocusOut);
}
if (oldForwardRef) {
oldForwardRef.removeEventListener("keydown", onKeydown);
oldForwardRef.removeEventListener("focusin", onFocusIn);
oldForwardRef.removeEventListener("focusout", onFocusOut);
}
});
const trapOnFocus = (e) => {
emit(ON_TRAP_FOCUS_EVT, e);
};
const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
const onFocusIn = (e) => {
const trapContainer = unref(forwardRef);
if (!trapContainer)
return;
const target = e.target;
const relatedTarget = e.relatedTarget;
const isFocusedInTrap = target && trapContainer.contains(target);
if (!props.trapped) {
const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
if (!isPrevFocusedInTrap) {
lastFocusBeforeTrapped = relatedTarget;
}
}
if (isFocusedInTrap)
emit("focusin", e);
if (focusLayer.paused)
return;
if (props.trapped) {
if (isFocusedInTrap) {
lastFocusAfterTrapped = target;
} else {
tryFocus(lastFocusAfterTrapped, true);
}
}
};
const onFocusOut = (e) => {
const trapContainer = unref(forwardRef);
if (focusLayer.paused || !trapContainer)
return;
if (props.trapped) {
const relatedTarget = e.relatedTarget;
if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
setTimeout(() => {
if (!focusLayer.paused && props.trapped) {
const focusoutPreventedEvent = createFocusOutPreventedEvent({
focusReason: focusReason2.value
});
emit("focusout-prevented", focusoutPreventedEvent);
if (!focusoutPreventedEvent.defaultPrevented) {
tryFocus(lastFocusAfterTrapped, true);
}
}
}, 0);
}
} else {
const target = e.target;
const isFocusedInTrap = target && trapContainer.contains(target);
if (!isFocusedInTrap)
emit("focusout", e);
}
};
async function startTrap() {
await nextTick();
const trapContainer = unref(forwardRef);
if (trapContainer) {
focusableStack.push(focusLayer);
const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
lastFocusBeforeTrapped = prevFocusedElement;
const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
if (!isPrevFocusContained) {
const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
trapContainer.dispatchEvent(focusEvent);
if (!focusEvent.defaultPrevented) {
nextTick(() => {
let focusStartEl = props.focusStartEl;
if (!isString(focusStartEl)) {
tryFocus(focusStartEl);
if (document.activeElement !== focusStartEl) {
focusStartEl = "first";
}
}
if (focusStartEl === "first") {
focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
}
if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
tryFocus(trapContainer);
}
});
}
}
}
}
function stopTrap() {
const trapContainer = unref(forwardRef);
if (trapContainer) {
trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
...FOCUS_AFTER_TRAPPED_OPTS,
detail: {
focusReason: focusReason2.value
}
});
trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
trapContainer.dispatchEvent(releasedEvent);
if (!releasedEvent.defaultPrevented && (focusReason2.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
}
trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, trapOnFocus);
focusableStack.remove(focusLayer);
}
}
onMounted(() => {
if (props.trapped) {
startTrap();
}
watch(() => props.trapped, (trapped) => {
if (trapped) {
startTrap();
} else {
stopTrap();
}
});
});
onBeforeUnmount(() => {
if (props.trapped) {
stopTrap();
}
});
return {
onKeydown
};
}
});
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
return renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
}
var ElFocusTrap = /* @__PURE__ */ _export_sfc$1(_sfc_main$t, [["render", _sfc_render$7], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);
const POSITIONING_STRATEGIES = ["fixed", "absolute"];
const popperCoreConfigProps = buildProps({
boundariesPadding: {
type: Number,
default: 0
},
fallbackPlacements: {
type: definePropType(Array),
default: void 0
},
gpuAcceleration: {
type: Boolean,
default: true
},
offset: {
type: Number,
default: 12
},
placement: {
type: String,
values: Ee,
default: "bottom"
},
popperOptions: {
type: definePropType(Object),
default: () => ({})
},
strategy: {
type: String,
values: POSITIONING_STRATEGIES,
default: "absolute"
}
});
const popperContentProps = buildProps({
...popperCoreConfigProps,
id: String,
style: {
type: definePropType([String, Array, Object])
},
className: {
type: definePropType([String, Array, Object])
},
effect: {
type: String,
default: "dark"
},
visible: Boolean,
enterable: {
type: Boolean,
default: true
},
pure: Boolean,
focusOnShow: {
type: Boolean,
default: false
},
trapping: {
type: Boolean,
default: false
},
popperClass: {
type: definePropType([String, Array, Object])
},
popperStyle: {
type: definePropType([String, Array, Object])
},
referenceEl: {
type: definePropType(Object)
},
triggerTargetEl: {
type: definePropType(Object)
},
stopPopperMouseEvent: {
type: Boolean,
default: true
},
ariaLabel: {
type: String,
default: void 0
},
virtualTriggering: Boolean,
zIndex: Number
});
const popperContentEmits = {
mouseenter: (evt) => evt instanceof MouseEvent,
mouseleave: (evt) => evt instanceof MouseEvent,
focus: () => true,
blur: () => true,
close: () => true
};
const buildPopperOptions = (props, modifiers = []) => {
const { placement, strategy, popperOptions } = props;
const options2 = {
placement,
strategy,
...popperOptions,
modifiers: [...genModifiers(props), ...modifiers]
};
deriveExtraModifiers(options2, popperOptions == null ? void 0 : popperOptions.modifiers);
return options2;
};
const unwrapMeasurableEl = ($el) => {
if (!isClient)
return;
return unrefElement($el);
};
function genModifiers(options2) {
const { offset, gpuAcceleration, fallbackPlacements } = options2;
return [
{
name: "offset",
options: {
offset: [0, offset != null ? offset : 12]
}
},
{
name: "preventOverflow",
options: {
padding: {
top: 2,
bottom: 2,
left: 5,
right: 5
}
}
},
{
name: "flip",
options: {
padding: 5,
fallbackPlacements
}
},
{
name: "computeStyles",
options: {
gpuAcceleration
}
}
];
}
function deriveExtraModifiers(options2, modifiers) {
if (modifiers) {
options2.modifiers = [...options2.modifiers, ...modifiers != null ? modifiers : []];
}
}
const DEFAULT_ARROW_OFFSET = 0;
const usePopperContent = (props) => {
const { popperInstanceRef, contentRef, triggerRef: triggerRef2, role } = inject(POPPER_INJECTION_KEY, void 0);
const arrowRef = ref();
const arrowOffset = ref();
const eventListenerModifier = computed$1(() => {
return {
name: "eventListeners",
enabled: !!props.visible
};
});
const arrowModifier = computed$1(() => {
var _a2;
const arrowEl = unref(arrowRef);
const offset = (_a2 = unref(arrowOffset)) != null ? _a2 : DEFAULT_ARROW_OFFSET;
return {
name: "arrow",
enabled: !isUndefined$1(arrowEl),
options: {
element: arrowEl,
padding: offset
}
};
});
const options2 = computed$1(() => {
return {
onFirstUpdate: () => {
update();
},
...buildPopperOptions(props, [
unref(arrowModifier),
unref(eventListenerModifier)
])
};
});
const computedReference = computed$1(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef2));
const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options2);
watch(instanceRef, (instance) => popperInstanceRef.value = instance);
onMounted(() => {
watch(() => {
var _a2;
return (_a2 = unref(computedReference)) == null ? void 0 : _a2.getBoundingClientRect();
}, () => {
update();
});
});
return {
attributes,
arrowRef,
contentRef,
instanceRef,
state,
styles,
role,
forceUpdate,
update
};
};
const usePopperContentDOM = (props, {
attributes,
styles,
role
}) => {
const { nextZIndex } = useZIndex();
const ns = useNamespace("popper");
const contentAttrs = computed$1(() => unref(attributes).popper);
const contentZIndex = ref(props.zIndex || nextZIndex());
const contentClass = computed$1(() => [
ns.b(),
ns.is("pure", props.pure),
ns.is(props.effect),
props.popperClass
]);
const contentStyle = computed$1(() => {
return [
{ zIndex: unref(contentZIndex) },
props.popperStyle || {},
unref(styles).popper
];
});
const ariaModal = computed$1(() => role.value === "dialog" ? "false" : void 0);
const arrowStyle = computed$1(() => unref(styles).arrow || {});
const updateZIndex = () => {
contentZIndex.value = props.zIndex || nextZIndex();
};
return {
ariaModal,
arrowStyle,
contentAttrs,
contentClass,
contentStyle,
contentZIndex,
updateZIndex
};
};
const usePopperContentFocusTrap = (props, emit) => {
const trapped = ref(false);
const focusStartRef = ref();
const onFocusAfterTrapped = () => {
emit("focus");
};
const onFocusAfterReleased = (event2) => {
var _a2;
if (((_a2 = event2.detail) == null ? void 0 : _a2.focusReason) !== "pointer") {
focusStartRef.value = "first";
emit("blur");
}
};
const onFocusInTrap = (event2) => {
if (props.visible && !trapped.value) {
if (event2.target) {
focusStartRef.value = event2.target;
}
trapped.value = true;
}
};
const onFocusoutPrevented = (event2) => {
if (!props.trapping) {
if (event2.detail.focusReason === "pointer") {
event2.preventDefault();
}
trapped.value = false;
}
};
const onReleaseRequested = () => {
trapped.value = false;
emit("close");
};
return {
focusStartRef,
trapped,
onFocusAfterReleased,
onFocusAfterTrapped,
onFocusInTrap,
onFocusoutPrevented,
onReleaseRequested
};
};
const __default__$i = defineComponent({
name: "ElPopperContent"
});
const _sfc_main$s = /* @__PURE__ */ defineComponent({
...__default__$i,
props: popperContentProps,
emits: popperContentEmits,
setup(__props, { expose, emit }) {
const props = __props;
const {
focusStartRef,
trapped,
onFocusAfterReleased,
onFocusAfterTrapped,
onFocusInTrap,
onFocusoutPrevented,
onReleaseRequested
} = usePopperContentFocusTrap(props, emit);
const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
const {
ariaModal,
arrowStyle,
contentAttrs,
contentClass,
contentStyle,
updateZIndex
} = usePopperContentDOM(props, {
styles,
attributes,
role
});
const formItemContext = inject(formItemContextKey, void 0);
const arrowOffset = ref();
provide(POPPER_CONTENT_INJECTION_KEY, {
arrowStyle,
arrowRef,
arrowOffset
});
if (formItemContext && (formItemContext.addInputId || formItemContext.removeInputId)) {
provide(formItemContextKey, {
...formItemContext,
addInputId: NOOP,
removeInputId: NOOP
});
}
let triggerTargetAriaStopWatch = void 0;
const updatePopper = (shouldUpdateZIndex = true) => {
update();
shouldUpdateZIndex && updateZIndex();
};
const togglePopperAlive = () => {
updatePopper(false);
if (props.visible && props.focusOnShow) {
trapped.value = true;
} else if (props.visible === false) {
trapped.value = false;
}
};
onMounted(() => {
watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
triggerTargetAriaStopWatch = void 0;
const el = unref(triggerTargetEl || contentRef.value);
const prevEl = unref(prevTriggerTargetEl || contentRef.value);
if (isElement(el)) {
triggerTargetAriaStopWatch = watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
});
}, { immediate: true });
}
if (prevEl !== el && isElement(prevEl)) {
["role", "aria-label", "aria-modal", "id"].forEach((key) => {
prevEl.removeAttribute(key);
});
}
}, { immediate: true });
watch(() => props.visible, togglePopperAlive, { immediate: true });
});
onBeforeUnmount(() => {
triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
triggerTargetAriaStopWatch = void 0;
});
expose({
popperContentRef: contentRef,
popperInstanceRef: instanceRef,
updatePopper,
contentStyle
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", mergeProps({
ref_key: "contentRef",
ref: contentRef
}, unref(contentAttrs), {
style: unref(contentStyle),
class: unref(contentClass),
tabindex: "-1",
onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
}), [
createVNode(unref(ElFocusTrap), {
trapped: unref(trapped),
"trap-on-focus-in": true,
"focus-trap-el": unref(contentRef),
"focus-start-el": unref(focusStartRef),
onFocusAfterTrapped: unref(onFocusAfterTrapped),
onFocusAfterReleased: unref(onFocusAfterReleased),
onFocusin: unref(onFocusInTrap),
onFocusoutPrevented: unref(onFocusoutPrevented),
onReleaseRequested: unref(onReleaseRequested)
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
], 16);
};
}
});
var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
const ElPopper = withInstall(Popper);
const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
const useTooltipContentProps = buildProps({
...useDelayedToggleProps,
...popperContentProps,
appendTo: {
type: definePropType([String, Object])
},
content: {
type: String,
default: ""
},
rawContent: {
type: Boolean,
default: false
},
persistent: Boolean,
ariaLabel: String,
visible: {
type: definePropType(Boolean),
default: null
},
transition: String,
teleported: {
type: Boolean,
default: true
},
disabled: Boolean
});
const useTooltipTriggerProps = buildProps({
...popperTriggerProps,
disabled: Boolean,
trigger: {
type: definePropType([String, Array]),
default: "hover"
},
triggerKeys: {
type: definePropType(Array),
default: () => [EVENT_CODE.enter, EVENT_CODE.space]
}
});
const {
useModelToggleProps: useTooltipModelToggleProps,
useModelToggleEmits: useTooltipModelToggleEmits,
useModelToggle: useTooltipModelToggle
} = createModelToggleComposable("visible");
const useTooltipProps = buildProps({
...popperProps,
...useTooltipModelToggleProps,
...useTooltipContentProps,
...useTooltipTriggerProps,
...popperArrowProps,
showArrow: {
type: Boolean,
default: true
}
});
const tooltipEmits = [
...useTooltipModelToggleEmits,
"before-show",
"before-hide",
"show",
"hide",
"open",
"close"
];
const isTriggerType = (trigger2, type2) => {
if (isArray$2(trigger2)) {
return trigger2.includes(type2);
}
return trigger2 === type2;
};
const whenTrigger = (trigger2, type2, handler) => {
return (e) => {
isTriggerType(unref(trigger2), type2) && handler(e);
};
};
const __default__$h = defineComponent({
name: "ElTooltipTrigger"
});
const _sfc_main$r = /* @__PURE__ */ defineComponent({
...__default__$h,
props: useTooltipTriggerProps,
setup(__props, { expose }) {
const props = __props;
const ns = useNamespace("tooltip");
const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
const triggerRef2 = ref(null);
const stopWhenControlledOrDisabled = () => {
if (unref(controlled) || props.disabled) {
return true;
}
};
const trigger2 = toRef(props, "trigger");
const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "hover", onOpen));
const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "hover", onClose));
const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "click", (e) => {
if (e.button === 0) {
onToggle(e);
}
}));
const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "focus", onOpen));
const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "focus", onClose));
const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "contextmenu", (e) => {
e.preventDefault();
onToggle(e);
}));
const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
const { code } = e;
if (props.triggerKeys.includes(code)) {
e.preventDefault();
onToggle(e);
}
});
expose({
triggerRef: triggerRef2
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ElPopperTrigger), {
id: unref(id),
"virtual-ref": _ctx.virtualRef,
open: unref(open),
"virtual-triggering": _ctx.virtualTriggering,
class: normalizeClass(unref(ns).e("trigger")),
onBlur: unref(onBlur),
onClick: unref(onClick),
onContextmenu: unref(onContextMenu),
onFocus: unref(onFocus),
onMouseenter: unref(onMouseenter),
onMouseleave: unref(onMouseleave),
onKeydown: unref(onKeydown)
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
};
}
});
var ElTooltipTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$r, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);
const __default__$g = defineComponent({
name: "ElTooltipContent",
inheritAttrs: false
});
const _sfc_main$q = /* @__PURE__ */ defineComponent({
...__default__$g,
props: useTooltipContentProps,
setup(__props, { expose }) {
const props = __props;
const { selector } = usePopperContainerId();
const ns = useNamespace("tooltip");
const contentRef = ref(null);
const destroyed = ref(false);
const {
controlled,
id,
open,
trigger: trigger2,
onClose,
onOpen,
onShow,
onHide,
onBeforeShow,
onBeforeHide
} = inject(TOOLTIP_INJECTION_KEY, void 0);
const transitionClass = computed$1(() => {
return props.transition || `${ns.namespace.value}-fade-in-linear`;
});
const persistentRef = computed$1(() => {
return props.persistent;
});
onBeforeUnmount(() => {
destroyed.value = true;
});
const shouldRender = computed$1(() => {
return unref(persistentRef) ? true : unref(open);
});
const shouldShow = computed$1(() => {
return props.disabled ? false : unref(open);
});
const appendTo = computed$1(() => {
return props.appendTo || selector.value;
});
const contentStyle = computed$1(() => {
var _a2;
return (_a2 = props.style) != null ? _a2 : {};
});
const ariaHidden = computed$1(() => !unref(open));
const onTransitionLeave = () => {
onHide();
};
const stopWhenControlled = () => {
if (unref(controlled))
return true;
};
const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
if (props.enterable && unref(trigger2) === "hover") {
onOpen();
}
});
const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
if (unref(trigger2) === "hover") {
onClose();
}
});
const onBeforeEnter = () => {
var _a2, _b;
(_b = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
onBeforeShow == null ? void 0 : onBeforeShow();
};
const onBeforeLeave = () => {
onBeforeHide == null ? void 0 : onBeforeHide();
};
const onAfterShow = () => {
onShow();
stopHandle = onClickOutside(computed$1(() => {
var _a2;
return (_a2 = contentRef.value) == null ? void 0 : _a2.popperContentRef;
}), () => {
if (unref(controlled))
return;
const $trigger = unref(trigger2);
if ($trigger !== "hover") {
onClose();
}
});
};
const onBlur = () => {
if (!props.virtualTriggering) {
onClose();
}
};
let stopHandle;
watch(() => unref(open), (val) => {
if (!val) {
stopHandle == null ? void 0 : stopHandle();
}
}, {
flush: "post"
});
watch(() => props.content, () => {
var _a2, _b;
(_b = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
});
expose({
contentRef
});
return (_ctx, _cache) => {
return openBlock(), createBlock(Teleport, {
disabled: !_ctx.teleported,
to: unref(appendTo)
}, [
createVNode(Transition, {
name: unref(transitionClass),
onAfterLeave: onTransitionLeave,
onBeforeEnter,
onAfterEnter: onAfterShow,
onBeforeLeave
}, {
default: withCtx(() => [
unref(shouldRender) ? withDirectives((openBlock(), createBlock(unref(ElPopperContent), mergeProps({
key: 0,
id: unref(id),
ref_key: "contentRef",
ref: contentRef
}, _ctx.$attrs, {
"aria-label": _ctx.ariaLabel,
"aria-hidden": unref(ariaHidden),
"boundaries-padding": _ctx.boundariesPadding,
"fallback-placements": _ctx.fallbackPlacements,
"gpu-acceleration": _ctx.gpuAcceleration,
offset: _ctx.offset,
placement: _ctx.placement,
"popper-options": _ctx.popperOptions,
strategy: _ctx.strategy,
effect: _ctx.effect,
enterable: _ctx.enterable,
pure: _ctx.pure,
"popper-class": _ctx.popperClass,
"popper-style": [_ctx.popperStyle, unref(contentStyle)],
"reference-el": _ctx.referenceEl,
"trigger-target-el": _ctx.triggerTargetEl,
visible: unref(shouldShow),
"z-index": _ctx.zIndex,
onMouseenter: unref(onContentEnter),
onMouseleave: unref(onContentLeave),
onBlur,
onClose: unref(onClose)
}), {
default: withCtx(() => [
!destroyed.value ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
]),
_: 3
}, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
[vShow, unref(shouldShow)]
]) : createCommentVNode("v-if", true)
]),
_: 3
}, 8, ["name"])
], 8, ["disabled", "to"]);
};
}
});
var ElTooltipContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$q, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
const _hoisted_1$f = ["innerHTML"];
const _hoisted_2$9 = { key: 1 };
const __default__$f = defineComponent({
name: "ElTooltip"
});
const _sfc_main$p = /* @__PURE__ */ defineComponent({
...__default__$f,
props: useTooltipProps,
emits: tooltipEmits,
setup(__props, { expose, emit }) {
const props = __props;
usePopperContainer();
const id = useId();
const popperRef = ref();
const contentRef = ref();
const updatePopper = () => {
var _a2;
const popperComponent = unref(popperRef);
if (popperComponent) {
(_a2 = popperComponent.popperInstanceRef) == null ? void 0 : _a2.update();
}
};
const open = ref(false);
const toggleReason = ref();
const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
indicator: open,
toggleReason
});
const { onOpen, onClose } = useDelayedToggle({
showAfter: toRef(props, "showAfter"),
hideAfter: toRef(props, "hideAfter"),
autoClose: toRef(props, "autoClose"),
open: show,
close: hide
});
const controlled = computed$1(() => isBoolean(props.visible) && !hasUpdateHandler.value);
provide(TOOLTIP_INJECTION_KEY, {
controlled,
id,
open: readonly(open),
trigger: toRef(props, "trigger"),
onOpen: (event2) => {
onOpen(event2);
},
onClose: (event2) => {
onClose(event2);
},
onToggle: (event2) => {
if (unref(open)) {
onClose(event2);
} else {
onOpen(event2);
}
},
onShow: () => {
emit("show", toggleReason.value);
},
onHide: () => {
emit("hide", toggleReason.value);
},
onBeforeShow: () => {
emit("before-show", toggleReason.value);
},
onBeforeHide: () => {
emit("before-hide", toggleReason.value);
},
updatePopper
});
watch(() => props.disabled, (disabled) => {
if (disabled && open.value) {
open.value = false;
}
});
const isFocusInsideContent = () => {
var _a2, _b;
const popperContent = (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.contentRef) == null ? void 0 : _b.popperContentRef;
return popperContent && popperContent.contains(document.activeElement);
};
onDeactivated(() => open.value && hide());
expose({
popperRef,
contentRef,
isFocusInsideContent,
updatePopper,
onOpen,
onClose,
hide
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ElPopper), {
ref_key: "popperRef",
ref: popperRef,
role: _ctx.role
}, {
default: withCtx(() => [
createVNode(ElTooltipTrigger, {
disabled: _ctx.disabled,
trigger: _ctx.trigger,
"trigger-keys": _ctx.triggerKeys,
"virtual-ref": _ctx.virtualRef,
"virtual-triggering": _ctx.virtualTriggering
}, {
default: withCtx(() => [
_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
]),
_: 3
}, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
createVNode(ElTooltipContent, {
ref_key: "contentRef",
ref: contentRef,
"aria-label": _ctx.ariaLabel,
"boundaries-padding": _ctx.boundariesPadding,
content: _ctx.content,
disabled: _ctx.disabled,
effect: _ctx.effect,
enterable: _ctx.enterable,
"fallback-placements": _ctx.fallbackPlacements,
"hide-after": _ctx.hideAfter,
"gpu-acceleration": _ctx.gpuAcceleration,
offset: _ctx.offset,
persistent: _ctx.persistent,
"popper-class": _ctx.popperClass,
"popper-style": _ctx.popperStyle,
placement: _ctx.placement,
"popper-options": _ctx.popperOptions,
pure: _ctx.pure,
"raw-content": _ctx.rawContent,
"reference-el": _ctx.referenceEl,
"trigger-target-el": _ctx.triggerTargetEl,
"show-after": _ctx.showAfter,
strategy: _ctx.strategy,
teleported: _ctx.teleported,
transition: _ctx.transition,
"virtual-triggering": _ctx.virtualTriggering,
"z-index": _ctx.zIndex,
"append-to": _ctx.appendTo
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "content", {}, () => [
_ctx.rawContent ? (openBlock(), createElementBlock("span", {
key: 0,
innerHTML: _ctx.content
}, null, 8, _hoisted_1$f)) : (openBlock(), createElementBlock("span", _hoisted_2$9, toDisplayString(_ctx.content), 1))
]),
_ctx.showArrow ? (openBlock(), createBlock(unref(ElPopperArrow), {
key: 0,
"arrow-offset": _ctx.arrowOffset
}, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
]),
_: 3
}, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
]),
_: 3
}, 8, ["role"]);
};
}
});
var Tooltip = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);
const ElTooltip = withInstall(Tooltip);
const buttonGroupContextKey = Symbol("buttonGroupContextKey");
const useButton = (props, emit) => {
useDeprecated({
from: "type.text",
replacement: "link",
version: "3.0.0",
scope: "props",
ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
}, computed$1(() => props.type === "text"));
const buttonGroupContext = inject(buttonGroupContextKey, void 0);
const globalConfig2 = useGlobalConfig("button");
const { form } = useFormItem();
const _size = useFormSize(computed$1(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
const _disabled = useFormDisabled();
const _ref = ref();
const slots = useSlots();
const _type = computed$1(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
const autoInsertSpace = computed$1(() => {
var _a2, _b, _c;
return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
});
const _props = computed$1(() => {
if (props.tag === "button") {
return {
ariaDisabled: _disabled.value || props.loading,
disabled: _disabled.value || props.loading,
autofocus: props.autofocus,
type: props.nativeType
};
}
return {};
});
const shouldAddSpace = computed$1(() => {
var _a2;
const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
const slot = defaultSlot[0];
if ((slot == null ? void 0 : slot.type) === Text$1) {
const text = slot.children;
return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
}
}
return false;
});
const handleClick = (evt) => {
if (props.nativeType === "reset") {
form == null ? void 0 : form.resetFields();
}
emit("click", evt);
};
return {
_disabled,
_size,
_type,
_ref,
_props,
shouldAddSpace,
handleClick
};
};
const buttonTypes = [
"default",
"primary",
"success",
"warning",
"info",
"danger",
"text",
""
];
const buttonNativeTypes = ["button", "submit", "reset"];
const buttonProps = buildProps({
size: useSizeProp,
disabled: Boolean,
type: {
type: String,
values: buttonTypes,
default: ""
},
icon: {
type: iconPropType
},
nativeType: {
type: String,
values: buttonNativeTypes,
default: "button"
},
loading: Boolean,
loadingIcon: {
type: iconPropType,
default: () => loading_default
},
plain: Boolean,
text: Boolean,
link: Boolean,
bg: Boolean,
autofocus: Boolean,
round: Boolean,
circle: Boolean,
color: String,
dark: Boolean,
autoInsertSpace: {
type: Boolean,
default: void 0
},
tag: {
type: definePropType([String, Object]),
default: "button"
}
});
const buttonEmits = {
click: (evt) => evt instanceof MouseEvent
};
function bound01$1(n, max2) {
if (isOnePointZero$1(n)) {
n = "100%";
}
var isPercent = isPercentage$1(n);
n = max2 === 360 ? n : Math.min(max2, Math.max(0, parseFloat(n)));
if (isPercent) {
n = parseInt(String(n * max2), 10) / 100;
}
if (Math.abs(n - max2) < 1e-6) {
return 1;
}
if (max2 === 360) {
n = (n < 0 ? n % max2 + max2 : n % max2) / parseFloat(String(max2));
} else {
n = n % max2 / parseFloat(String(max2));
}
return n;
}
function clamp01(val) {
return Math.min(1, Math.max(0, val));
}
function isOnePointZero$1(n) {
return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
}
function isPercentage$1(n) {
return typeof n === "string" && n.indexOf("%") !== -1;
}
function boundAlpha(a) {
a = parseFloat(a);
if (isNaN(a) || a < 0 || a > 1) {
a = 1;
}
return a;
}
function convertToPercentage(n) {
if (n <= 1) {
return "".concat(Number(n) * 100, "%");
}
return n;
}
function pad2(c) {
return c.length === 1 ? "0" + c : String(c);
}
function rgbToRgb(r2, g, b) {
return {
r: bound01$1(r2, 255) * 255,
g: bound01$1(g, 255) * 255,
b: bound01$1(b, 255) * 255
};
}
function rgbToHsl(r2, g, b) {
r2 = bound01$1(r2, 255);
g = bound01$1(g, 255);
b = bound01$1(b, 255);
var max2 = Math.max(r2, g, b);
var min2 = Math.min(r2, g, b);
var h2 = 0;
var s = 0;
var l = (max2 + min2) / 2;
if (max2 === min2) {
s = 0;
h2 = 0;
} else {
var d2 = max2 - min2;
s = l > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
switch (max2) {
case r2:
h2 = (g - b) / d2 + (g < b ? 6 : 0);
break;
case g:
h2 = (b - r2) / d2 + 2;
break;
case b:
h2 = (r2 - g) / d2 + 4;
break;
}
h2 /= 6;
}
return { h: h2, s, l };
}
function hue2rgb(p, q2, t2) {
if (t2 < 0) {
t2 += 1;
}
if (t2 > 1) {
t2 -= 1;
}
if (t2 < 1 / 6) {
return p + (q2 - p) * (6 * t2);
}
if (t2 < 1 / 2) {
return q2;
}
if (t2 < 2 / 3) {
return p + (q2 - p) * (2 / 3 - t2) * 6;
}
return p;
}
function hslToRgb(h2, s, l) {
var r2;
var g;
var b;
h2 = bound01$1(h2, 360);
s = bound01$1(s, 100);
l = bound01$1(l, 100);
if (s === 0) {
g = l;
b = l;
r2 = l;
} else {
var q2 = l < 0.5 ? l * (1 + s) : l + s - l * s;
var p = 2 * l - q2;
r2 = hue2rgb(p, q2, h2 + 1 / 3);
g = hue2rgb(p, q2, h2);
b = hue2rgb(p, q2, h2 - 1 / 3);
}
return { r: r2 * 255, g: g * 255, b: b * 255 };
}
function rgbToHsv(r2, g, b) {
r2 = bound01$1(r2, 255);
g = bound01$1(g, 255);
b = bound01$1(b, 255);
var max2 = Math.max(r2, g, b);
var min2 = Math.min(r2, g, b);
var h2 = 0;
var v = max2;
var d2 = max2 - min2;
var s = max2 === 0 ? 0 : d2 / max2;
if (max2 === min2) {
h2 = 0;
} else {
switch (max2) {
case r2:
h2 = (g - b) / d2 + (g < b ? 6 : 0);
break;
case g:
h2 = (b - r2) / d2 + 2;
break;
case b:
h2 = (r2 - g) / d2 + 4;
break;
}
h2 /= 6;
}
return { h: h2, s, v };
}
function hsvToRgb(h2, s, v) {
h2 = bound01$1(h2, 360) * 6;
s = bound01$1(s, 100);
v = bound01$1(v, 100);
var i2 = Math.floor(h2);
var f = h2 - i2;
var p = v * (1 - s);
var q2 = v * (1 - f * s);
var t2 = v * (1 - (1 - f) * s);
var mod = i2 % 6;
var r2 = [v, q2, p, p, t2, v][mod];
var g = [t2, v, v, q2, p, p][mod];
var b = [p, p, t2, v, v, q2][mod];
return { r: r2 * 255, g: g * 255, b: b * 255 };
}
function rgbToHex(r2, g, b, allow3Char) {
var hex = [
pad2(Math.round(r2).toString(16)),
pad2(Math.round(g).toString(16)),
pad2(Math.round(b).toString(16))
];
if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
}
return hex.join("");
}
function rgbaToHex(r2, g, b, a, allow4Char) {
var hex = [
pad2(Math.round(r2).toString(16)),
pad2(Math.round(g).toString(16)),
pad2(Math.round(b).toString(16)),
pad2(convertDecimalToHex(a))
];
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))) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
}
return hex.join("");
}
function convertDecimalToHex(d2) {
return Math.round(parseFloat(d2) * 255).toString(16);
}
function convertHexToDecimal(h2) {
return parseIntFromHex(h2) / 255;
}
function parseIntFromHex(val) {
return parseInt(val, 16);
}
function numberInputToObject(color2) {
return {
r: color2 >> 16,
g: (color2 & 65280) >> 8,
b: color2 & 255
};
}
var names = {
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkgrey: "#a9a9a9",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkslategrey: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dimgrey: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
goldenrod: "#daa520",
gold: "#ffd700",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
grey: "#808080",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
indianred: "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavenderblush: "#fff0f5",
lavender: "#e6e6fa",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgray: "#d3d3d3",
lightgreen: "#90ee90",
lightgrey: "#d3d3d3",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightslategrey: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370db",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#db7093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
rebeccapurple: "#663399",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
slategrey: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
};
function inputToRGB(color2) {
var rgb = { r: 0, g: 0, b: 0 };
var a = 1;
var s = null;
var v = null;
var l = null;
var ok = false;
var format = false;
if (typeof color2 === "string") {
color2 = stringInputToObject(color2);
}
if (typeof color2 === "object") {
if (isValidCSSUnit(color2.r) && isValidCSSUnit(color2.g) && isValidCSSUnit(color2.b)) {
rgb = rgbToRgb(color2.r, color2.g, color2.b);
ok = true;
format = String(color2.r).substr(-1) === "%" ? "prgb" : "rgb";
} else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.v)) {
s = convertToPercentage(color2.s);
v = convertToPercentage(color2.v);
rgb = hsvToRgb(color2.h, s, v);
ok = true;
format = "hsv";
} else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.l)) {
s = convertToPercentage(color2.s);
l = convertToPercentage(color2.l);
rgb = hslToRgb(color2.h, s, l);
ok = true;
format = "hsl";
}
if (Object.prototype.hasOwnProperty.call(color2, "a")) {
a = color2.a;
}
}
a = boundAlpha(a);
return {
ok,
format: color2.format || format,
r: Math.min(255, Math.max(rgb.r, 0)),
g: Math.min(255, Math.max(rgb.g, 0)),
b: Math.min(255, Math.max(rgb.b, 0)),
a
};
}
var CSS_INTEGER = "[-\\+]?\\d+%?";
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
var matchers = {
CSS_UNIT: new RegExp(CSS_UNIT),
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
};
function stringInputToObject(color2) {
color2 = color2.trim().toLowerCase();
if (color2.length === 0) {
return false;
}
var named = false;
if (names[color2]) {
color2 = names[color2];
named = true;
} else if (color2 === "transparent") {
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
}
var match = matchers.rgb.exec(color2);
if (match) {
return { r: match[1], g: match[2], b: match[3] };
}
match = matchers.rgba.exec(color2);
if (match) {
return { r: match[1], g: match[2], b: match[3], a: match[4] };
}
match = matchers.hsl.exec(color2);
if (match) {
return { h: match[1], s: match[2], l: match[3] };
}
match = matchers.hsla.exec(color2);
if (match) {
return { h: match[1], s: match[2], l: match[3], a: match[4] };
}
match = matchers.hsv.exec(color2);
if (match) {
return { h: match[1], s: match[2], v: match[3] };
}
match = matchers.hsva.exec(color2);
if (match) {
return { h: match[1], s: match[2], v: match[3], a: match[4] };
}
match = matchers.hex8.exec(color2);
if (match) {
return {
r: parseIntFromHex(match[1]),
g: parseIntFromHex(match[2]),
b: parseIntFromHex(match[3]),
a: convertHexToDecimal(match[4]),
format: named ? "name" : "hex8"
};
}
match = matchers.hex6.exec(color2);
if (match) {
return {
r: parseIntFromHex(match[1]),
g: parseIntFromHex(match[2]),
b: parseIntFromHex(match[3]),
format: named ? "name" : "hex"
};
}
match = matchers.hex4.exec(color2);
if (match) {
return {
r: parseIntFromHex(match[1] + match[1]),
g: parseIntFromHex(match[2] + match[2]),
b: parseIntFromHex(match[3] + match[3]),
a: convertHexToDecimal(match[4] + match[4]),
format: named ? "name" : "hex8"
};
}
match = matchers.hex3.exec(color2);
if (match) {
return {
r: parseIntFromHex(match[1] + match[1]),
g: parseIntFromHex(match[2] + match[2]),
b: parseIntFromHex(match[3] + match[3]),
format: named ? "name" : "hex"
};
}
return false;
}
function isValidCSSUnit(color2) {
return Boolean(matchers.CSS_UNIT.exec(String(color2)));
}
var TinyColor = function() {
function TinyColor2(color2, opts) {
if (color2 === void 0) {
color2 = "";
}
if (opts === void 0) {
opts = {};
}
var _a2;
if (color2 instanceof TinyColor2) {
return color2;
}
if (typeof color2 === "number") {
color2 = numberInputToObject(color2);
}
this.originalInput = color2;
var rgb = inputToRGB(color2);
this.originalInput = color2;
this.r = rgb.r;
this.g = rgb.g;
this.b = rgb.b;
this.a = rgb.a;
this.roundA = Math.round(100 * this.a) / 100;
this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
this.gradientType = opts.gradientType;
if (this.r < 1) {
this.r = Math.round(this.r);
}
if (this.g < 1) {
this.g = Math.round(this.g);
}
if (this.b < 1) {
this.b = Math.round(this.b);
}
this.isValid = rgb.ok;
}
TinyColor2.prototype.isDark = function() {
return this.getBrightness() < 128;
};
TinyColor2.prototype.isLight = function() {
return !this.isDark();
};
TinyColor2.prototype.getBrightness = function() {
var rgb = this.toRgb();
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
};
TinyColor2.prototype.getLuminance = function() {
var rgb = this.toRgb();
var R2;
var G2;
var B2;
var RsRGB = rgb.r / 255;
var GsRGB = rgb.g / 255;
var BsRGB = rgb.b / 255;
if (RsRGB <= 0.03928) {
R2 = RsRGB / 12.92;
} else {
R2 = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
}
if (GsRGB <= 0.03928) {
G2 = GsRGB / 12.92;
} else {
G2 = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
}
if (BsRGB <= 0.03928) {
B2 = BsRGB / 12.92;
} else {
B2 = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
}
return 0.2126 * R2 + 0.7152 * G2 + 0.0722 * B2;
};
TinyColor2.prototype.getAlpha = function() {
return this.a;
};
TinyColor2.prototype.setAlpha = function(alpha) {
this.a = boundAlpha(alpha);
this.roundA = Math.round(100 * this.a) / 100;
return this;
};
TinyColor2.prototype.isMonochrome = function() {
var s = this.toHsl().s;
return s === 0;
};
TinyColor2.prototype.toHsv = function() {
var hsv = rgbToHsv(this.r, this.g, this.b);
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
};
TinyColor2.prototype.toHsvString = function() {
var hsv = rgbToHsv(this.r, this.g, this.b);
var h2 = Math.round(hsv.h * 360);
var s = Math.round(hsv.s * 100);
var v = Math.round(hsv.v * 100);
return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h2, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
};
TinyColor2.prototype.toHsl = function() {
var hsl = rgbToHsl(this.r, this.g, this.b);
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
};
TinyColor2.prototype.toHslString = function() {
var hsl = rgbToHsl(this.r, this.g, this.b);
var h2 = Math.round(hsl.h * 360);
var s = Math.round(hsl.s * 100);
var l = Math.round(hsl.l * 100);
return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h2, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
};
TinyColor2.prototype.toHex = function(allow3Char) {
if (allow3Char === void 0) {
allow3Char = false;
}
return rgbToHex(this.r, this.g, this.b, allow3Char);
};
TinyColor2.prototype.toHexString = function(allow3Char) {
if (allow3Char === void 0) {
allow3Char = false;
}
return "#" + this.toHex(allow3Char);
};
TinyColor2.prototype.toHex8 = function(allow4Char) {
if (allow4Char === void 0) {
allow4Char = false;
}
return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
};
TinyColor2.prototype.toHex8String = function(allow4Char) {
if (allow4Char === void 0) {
allow4Char = false;
}
return "#" + this.toHex8(allow4Char);
};
TinyColor2.prototype.toHexShortString = function(allowShortChar) {
if (allowShortChar === void 0) {
allowShortChar = false;
}
return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
};
TinyColor2.prototype.toRgb = function() {
return {
r: Math.round(this.r),
g: Math.round(this.g),
b: Math.round(this.b),
a: this.a
};
};
TinyColor2.prototype.toRgbString = function() {
var r2 = Math.round(this.r);
var g = Math.round(this.g);
var b = Math.round(this.b);
return this.a === 1 ? "rgb(".concat(r2, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r2, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
};
TinyColor2.prototype.toPercentageRgb = function() {
var fmt = function(x) {
return "".concat(Math.round(bound01$1(x, 255) * 100), "%");
};
return {
r: fmt(this.r),
g: fmt(this.g),
b: fmt(this.b),
a: this.a
};
};
TinyColor2.prototype.toPercentageRgbString = function() {
var rnd = function(x) {
return Math.round(bound01$1(x, 255) * 100);
};
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, ")");
};
TinyColor2.prototype.toName = function() {
if (this.a === 0) {
return "transparent";
}
if (this.a < 1) {
return false;
}
var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
var _b = _a2[_i], key = _b[0], value = _b[1];
if (hex === value) {
return key;
}
}
return false;
};
TinyColor2.prototype.toString = function(format) {
var formatSet = Boolean(format);
format = format !== null && format !== void 0 ? format : this.format;
var formattedString = false;
var hasAlpha = this.a < 1 && this.a >= 0;
var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
if (needsAlphaFormat) {
if (format === "name" && this.a === 0) {
return this.toName();
}
return this.toRgbString();
}
if (format === "rgb") {
formattedString = this.toRgbString();
}
if (format === "prgb") {
formattedString = this.toPercentageRgbString();
}
if (format === "hex" || format === "hex6") {
formattedString = this.toHexString();
}
if (format === "hex3") {
formattedString = this.toHexString(true);
}
if (format === "hex4") {
formattedString = this.toHex8String(true);
}
if (format === "hex8") {
formattedString = this.toHex8String();
}
if (format === "name") {
formattedString = this.toName();
}
if (format === "hsl") {
formattedString = this.toHslString();
}
if (format === "hsv") {
formattedString = this.toHsvString();
}
return formattedString || this.toHexString();
};
TinyColor2.prototype.toNumber = function() {
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
};
TinyColor2.prototype.clone = function() {
return new TinyColor2(this.toString());
};
TinyColor2.prototype.lighten = function(amount) {
if (amount === void 0) {
amount = 10;
}
var hsl = this.toHsl();
hsl.l += amount / 100;
hsl.l = clamp01(hsl.l);
return new TinyColor2(hsl);
};
TinyColor2.prototype.brighten = function(amount) {
if (amount === void 0) {
amount = 10;
}
var rgb = this.toRgb();
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
return new TinyColor2(rgb);
};
TinyColor2.prototype.darken = function(amount) {
if (amount === void 0) {
amount = 10;
}
var hsl = this.toHsl();
hsl.l -= amount / 100;
hsl.l = clamp01(hsl.l);
return new TinyColor2(hsl);
};
TinyColor2.prototype.tint = function(amount) {
if (amount === void 0) {
amount = 10;
}
return this.mix("white", amount);
};
TinyColor2.prototype.shade = function(amount) {
if (amount === void 0) {
amount = 10;
}
return this.mix("black", amount);
};
TinyColor2.prototype.desaturate = function(amount) {
if (amount === void 0) {
amount = 10;
}
var hsl = this.toHsl();
hsl.s -= amount / 100;
hsl.s = clamp01(hsl.s);
return new TinyColor2(hsl);
};
TinyColor2.prototype.saturate = function(amount) {
if (amount === void 0) {
amount = 10;
}
var hsl = this.toHsl();
hsl.s += amount / 100;
hsl.s = clamp01(hsl.s);
return new TinyColor2(hsl);
};
TinyColor2.prototype.greyscale = function() {
return this.desaturate(100);
};
TinyColor2.prototype.spin = function(amount) {
var hsl = this.toHsl();
var hue = (hsl.h + amount) % 360;
hsl.h = hue < 0 ? 360 + hue : hue;
return new TinyColor2(hsl);
};
TinyColor2.prototype.mix = function(color2, amount) {
if (amount === void 0) {
amount = 50;
}
var rgb1 = this.toRgb();
var rgb2 = new TinyColor2(color2).toRgb();
var p = amount / 100;
var rgba = {
r: (rgb2.r - rgb1.r) * p + rgb1.r,
g: (rgb2.g - rgb1.g) * p + rgb1.g,
b: (rgb2.b - rgb1.b) * p + rgb1.b,
a: (rgb2.a - rgb1.a) * p + rgb1.a
};
return new TinyColor2(rgba);
};
TinyColor2.prototype.analogous = function(results, slices) {
if (results === void 0) {
results = 6;
}
if (slices === void 0) {
slices = 30;
}
var hsl = this.toHsl();
var part = 360 / slices;
var ret = [this];
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
hsl.h = (hsl.h + part) % 360;
ret.push(new TinyColor2(hsl));
}
return ret;
};
TinyColor2.prototype.complement = function() {
var hsl = this.toHsl();
hsl.h = (hsl.h + 180) % 360;
return new TinyColor2(hsl);
};
TinyColor2.prototype.monochromatic = function(results) {
if (results === void 0) {
results = 6;
}
var hsv = this.toHsv();
var h2 = hsv.h;
var s = hsv.s;
var v = hsv.v;
var res = [];
var modification = 1 / results;
while (results--) {
res.push(new TinyColor2({ h: h2, s, v }));
v = (v + modification) % 1;
}
return res;
};
TinyColor2.prototype.splitcomplement = function() {
var hsl = this.toHsl();
var h2 = hsl.h;
return [
this,
new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
];
};
TinyColor2.prototype.onBackground = function(background) {
var fg = this.toRgb();
var bg = new TinyColor2(background).toRgb();
var alpha = fg.a + bg.a * (1 - fg.a);
return new TinyColor2({
r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
a: alpha
});
};
TinyColor2.prototype.triad = function() {
return this.polyad(3);
};
TinyColor2.prototype.tetrad = function() {
return this.polyad(4);
};
TinyColor2.prototype.polyad = function(n) {
var hsl = this.toHsl();
var h2 = hsl.h;
var result = [this];
var increment = 360 / n;
for (var i2 = 1; i2 < n; i2++) {
result.push(new TinyColor2({ h: (h2 + i2 * increment) % 360, s: hsl.s, l: hsl.l }));
}
return result;
};
TinyColor2.prototype.equals = function(color2) {
return this.toRgbString() === new TinyColor2(color2).toRgbString();
};
return TinyColor2;
}();
function darken(color2, amount = 20) {
return color2.mix("#141414", amount).toString();
}
function useButtonCustomStyle(props) {
const _disabled = useFormDisabled();
const ns = useNamespace("button");
return computed$1(() => {
let styles = {};
const buttonColor = props.color;
if (buttonColor) {
const color2 = new TinyColor(buttonColor);
const activeBgColor = props.dark ? color2.tint(20).toString() : darken(color2, 20);
if (props.plain) {
styles = ns.cssVarBlock({
"bg-color": props.dark ? darken(color2, 90) : color2.tint(90).toString(),
"text-color": buttonColor,
"border-color": props.dark ? darken(color2, 50) : color2.tint(50).toString(),
"hover-text-color": `var(${ns.cssVarName("color-white")})`,
"hover-bg-color": buttonColor,
"hover-border-color": buttonColor,
"active-bg-color": activeBgColor,
"active-text-color": `var(${ns.cssVarName("color-white")})`,
"active-border-color": activeBgColor
});
if (_disabled.value) {
styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color2, 90) : color2.tint(90).toString();
styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color2, 50) : color2.tint(50).toString();
styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color2, 80) : color2.tint(80).toString();
}
} else {
const hoverBgColor = props.dark ? darken(color2, 30) : color2.tint(30).toString();
const textColor = color2.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
styles = ns.cssVarBlock({
"bg-color": buttonColor,
"text-color": textColor,
"border-color": buttonColor,
"hover-bg-color": hoverBgColor,
"hover-text-color": textColor,
"hover-border-color": hoverBgColor,
"active-bg-color": activeBgColor,
"active-border-color": activeBgColor
});
if (_disabled.value) {
const disabledButtonColor = props.dark ? darken(color2, 50) : color2.tint(50).toString();
styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
}
}
}
return styles;
});
}
const __default__$e = defineComponent({
name: "ElButton"
});
const _sfc_main$o = /* @__PURE__ */ defineComponent({
...__default__$e,
props: buttonProps,
emits: buttonEmits,
setup(__props, { expose, emit }) {
const props = __props;
const buttonStyle = useButtonCustomStyle(props);
const ns = useNamespace("button");
const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit);
expose({
ref: _ref,
size: _size,
type: _type,
disabled: _disabled,
shouldAddSpace
});
return (_ctx, _cache) => {
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
ref_key: "_ref",
ref: _ref
}, unref(_props), {
class: [
unref(ns).b(),
unref(ns).m(unref(_type)),
unref(ns).m(unref(_size)),
unref(ns).is("disabled", unref(_disabled)),
unref(ns).is("loading", _ctx.loading),
unref(ns).is("plain", _ctx.plain),
unref(ns).is("round", _ctx.round),
unref(ns).is("circle", _ctx.circle),
unref(ns).is("text", _ctx.text),
unref(ns).is("link", _ctx.link),
unref(ns).is("has-bg", _ctx.bg)
],
style: unref(buttonStyle),
onClick: unref(handleClick)
}), {
default: withCtx(() => [
_ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
key: 1,
class: normalizeClass(unref(ns).is("loading"))
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
]),
_: 1
}, 8, ["class"]))
], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
default: withCtx(() => [
_ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
]),
_: 3
})) : createCommentVNode("v-if", true),
_ctx.$slots.default ? (openBlock(), createElementBlock("span", {
key: 2,
class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
}, [
renderSlot(_ctx.$slots, "default")
], 2)) : createCommentVNode("v-if", true)
]),
_: 3
}, 16, ["class", "style", "onClick"]);
};
}
});
var Button$2 = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
const buttonGroupProps = {
size: buttonProps.size,
type: buttonProps.type
};
const __default__$d = defineComponent({
name: "ElButtonGroup"
});
const _sfc_main$n = /* @__PURE__ */ defineComponent({
...__default__$d,
props: buttonGroupProps,
setup(__props) {
const props = __props;
provide(buttonGroupContextKey, reactive({
size: toRef(props, "size"),
type: toRef(props, "type")
}));
const ns = useNamespace("button");
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(`${unref(ns).b("group")}`)
}, [
renderSlot(_ctx.$slots, "default")
], 2);
};
}
});
var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);
const ElButton = withInstall(Button$2, {
ButtonGroup
});
const ElButtonGroup = withNoopInstall(ButtonGroup);
const nodeList = /* @__PURE__ */ new Map();
let startClick;
if (isClient) {
document.addEventListener("mousedown", (e) => startClick = e);
document.addEventListener("mouseup", (e) => {
for (const handlers of nodeList.values()) {
for (const { documentHandler } of handlers) {
documentHandler(e, startClick);
}
}
});
}
function createDocumentHandler(el, binding) {
let excludes = [];
if (Array.isArray(binding.arg)) {
excludes = binding.arg;
} else if (isElement(binding.arg)) {
excludes.push(binding.arg);
}
return function(mouseup, mousedown) {
const popperRef = binding.instance.popperRef;
const mouseUpTarget = mouseup.target;
const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
const isBound = !binding || !binding.instance;
const isTargetExists = !mouseUpTarget || !mouseDownTarget;
const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
const isSelf = el === mouseUpTarget;
const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
return;
}
binding.value(mouseup, mousedown);
};
}
const ClickOutside = {
beforeMount(el, binding) {
if (!nodeList.has(el)) {
nodeList.set(el, []);
}
nodeList.get(el).push({
documentHandler: createDocumentHandler(el, binding),
bindingFn: binding.value
});
},
updated(el, binding) {
if (!nodeList.has(el)) {
nodeList.set(el, []);
}
const handlers = nodeList.get(el);
const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
const newHandler = {
documentHandler: createDocumentHandler(el, binding),
bindingFn: binding.value
};
if (oldHandlerIndex >= 0) {
handlers.splice(oldHandlerIndex, 1, newHandler);
} else {
handlers.push(newHandler);
}
},
unmounted(el) {
nodeList.delete(el);
}
};
const REPEAT_INTERVAL = 100;
const REPEAT_DELAY = 600;
const vRepeatClick = {
beforeMount(el, binding) {
const value = binding.value;
const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$3(value) ? {} : value;
let intervalId;
let delayId;
const handler = () => isFunction$3(value) ? value() : value.handler();
const clear = () => {
if (delayId) {
clearTimeout(delayId);
delayId = void 0;
}
if (intervalId) {
clearInterval(intervalId);
intervalId = void 0;
}
};
el.addEventListener("mousedown", (evt) => {
if (evt.button !== 0)
return;
clear();
handler();
document.addEventListener("mouseup", () => clear(), {
once: true
});
delayId = setTimeout(() => {
intervalId = setInterval(() => {
handler();
}, interval);
}, delay);
});
}
};
const radioPropsBase = buildProps({
size: useSizeProp,
disabled: Boolean,
label: {
type: [String, Number, Boolean],
default: ""
}
});
const radioProps = buildProps({
...radioPropsBase,
modelValue: {
type: [String, Number, Boolean],
default: ""
},
name: {
type: String,
default: ""
},
border: Boolean
});
const radioEmits = {
[UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
[CHANGE_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val)
};
const radioGroupKey = Symbol("radioGroupKey");
const useRadio = (props, emit) => {
const radioRef = ref();
const radioGroup = inject(radioGroupKey, void 0);
const isGroup = computed$1(() => !!radioGroup);
const modelValue = computed$1({
get() {
return isGroup.value ? radioGroup.modelValue : props.modelValue;
},
set(val) {
if (isGroup.value) {
radioGroup.changeEvent(val);
} else {
emit && emit(UPDATE_MODEL_EVENT, val);
}
radioRef.value.checked = props.modelValue === props.label;
}
});
const size = useFormSize(computed$1(() => radioGroup == null ? void 0 : radioGroup.size));
const disabled = useFormDisabled(computed$1(() => radioGroup == null ? void 0 : radioGroup.disabled));
const focus = ref(false);
const tabIndex = computed$1(() => {
return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
});
return {
radioRef,
isGroup,
radioGroup,
focus,
size,
disabled,
tabIndex,
modelValue
};
};
const _hoisted_1$e = ["value", "name", "disabled"];
const __default__$c = defineComponent({
name: "ElRadio"
});
const _sfc_main$m = /* @__PURE__ */ defineComponent({
...__default__$c,
props: radioProps,
emits: radioEmits,
setup(__props, { emit }) {
const props = __props;
const ns = useNamespace("radio");
const { radioRef, radioGroup, focus, size, disabled, modelValue } = useRadio(props, emit);
function handleChange() {
nextTick(() => emit("change", modelValue.value));
}
return (_ctx, _cache) => {
var _a2;
return openBlock(), createElementBlock("label", {
class: normalizeClass([
unref(ns).b(),
unref(ns).is("disabled", unref(disabled)),
unref(ns).is("focus", unref(focus)),
unref(ns).is("bordered", _ctx.border),
unref(ns).is("checked", unref(modelValue) === _ctx.label),
unref(ns).m(unref(size))
])
}, [
createElementVNode("span", {
class: normalizeClass([
unref(ns).e("input"),
unref(ns).is("disabled", unref(disabled)),
unref(ns).is("checked", unref(modelValue) === _ctx.label)
])
}, [
withDirectives(createElementVNode("input", {
ref_key: "radioRef",
ref: radioRef,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
class: normalizeClass(unref(ns).e("original")),
value: _ctx.label,
name: _ctx.name || ((_a2 = unref(radioGroup)) == null ? void 0 : _a2.name),
disabled: unref(disabled),
type: "radio",
onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
onChange: handleChange
}, null, 42, _hoisted_1$e), [
[vModelRadio, unref(modelValue)]
]),
createElementVNode("span", {
class: normalizeClass(unref(ns).e("inner"))
}, null, 2)
], 2),
createElementVNode("span", {
class: normalizeClass(unref(ns).e("label")),
onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
}, ["stop"]))
}, [
renderSlot(_ctx.$slots, "default", {}, () => [
createTextVNode(toDisplayString(_ctx.label), 1)
])
], 34)
], 2);
};
}
});
var Radio = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio.vue"]]);
const radioButtonProps = buildProps({
...radioPropsBase,
name: {
type: String,
default: ""
}
});
const _hoisted_1$d = ["value", "name", "disabled"];
const __default__$b = defineComponent({
name: "ElRadioButton"
});
const _sfc_main$l = /* @__PURE__ */ defineComponent({
...__default__$b,
props: radioButtonProps,
setup(__props) {
const props = __props;
const ns = useNamespace("radio");
const { radioRef, focus, size, disabled, modelValue, radioGroup } = useRadio(props);
const activeStyle = computed$1(() => {
return {
backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
};
});
return (_ctx, _cache) => {
var _a2;
return openBlock(), createElementBlock("label", {
class: normalizeClass([
unref(ns).b("button"),
unref(ns).is("active", unref(modelValue) === _ctx.label),
unref(ns).is("disabled", unref(disabled)),
unref(ns).is("focus", unref(focus)),
unref(ns).bm("button", unref(size))
])
}, [
withDirectives(createElementVNode("input", {
ref_key: "radioRef",
ref: radioRef,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
class: normalizeClass(unref(ns).be("button", "original-radio")),
value: _ctx.label,
type: "radio",
name: _ctx.name || ((_a2 = unref(radioGroup)) == null ? void 0 : _a2.name),
disabled: unref(disabled),
onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false)
}, null, 42, _hoisted_1$d), [
[vModelRadio, unref(modelValue)]
]),
createElementVNode("span", {
class: normalizeClass(unref(ns).be("button", "inner")),
style: normalizeStyle(unref(modelValue) === _ctx.label ? unref(activeStyle) : {}),
onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
}, ["stop"]))
}, [
renderSlot(_ctx.$slots, "default", {}, () => [
createTextVNode(toDisplayString(_ctx.label), 1)
])
], 38)
], 2);
};
}
});
var RadioButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-button.vue"]]);
const radioGroupProps = buildProps({
id: {
type: String,
default: void 0
},
size: useSizeProp,
disabled: Boolean,
modelValue: {
type: [String, Number, Boolean],
default: ""
},
fill: {
type: String,
default: ""
},
label: {
type: String,
default: void 0
},
textColor: {
type: String,
default: ""
},
name: {
type: String,
default: void 0
},
validateEvent: {
type: Boolean,
default: true
}
});
const radioGroupEmits = radioEmits;
const _hoisted_1$c = ["id", "aria-label", "aria-labelledby"];
const __default__$a = defineComponent({
name: "ElRadioGroup"
});
const _sfc_main$k = /* @__PURE__ */ defineComponent({
...__default__$a,
props: radioGroupProps,
emits: radioGroupEmits,
setup(__props, { emit }) {
const props = __props;
const ns = useNamespace("radio");
const radioId = useId();
const radioGroupRef = ref();
const { formItem } = useFormItem();
const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
formItemContext: formItem
});
const changeEvent = (value) => {
emit(UPDATE_MODEL_EVENT, value);
nextTick(() => emit("change", value));
};
onMounted(() => {
const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
const firstLabel = radios[0];
if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
firstLabel.tabIndex = 0;
}
});
const name = computed$1(() => {
return props.name || radioId.value;
});
provide(radioGroupKey, reactive({
...toRefs(props),
changeEvent,
name
}));
watch(() => props.modelValue, () => {
if (props.validateEvent) {
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
}
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
id: unref(groupId),
ref_key: "radioGroupRef",
ref: radioGroupRef,
class: normalizeClass(unref(ns).b("group")),
role: "radiogroup",
"aria-label": !unref(isLabeledByFormItem) ? _ctx.label || "radio-group" : void 0,
"aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
}, [
renderSlot(_ctx.$slots, "default")
], 10, _hoisted_1$c);
};
}
});
var RadioGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-group.vue"]]);
withInstall(Radio, {
RadioButton,
RadioGroup
});
const ElRadioGroup = withNoopInstall(RadioGroup);
const ElRadioButton = withNoopInstall(RadioButton);
const tagProps = buildProps({
closable: Boolean,
type: {
type: String,
values: ["success", "info", "warning", "danger", ""],
default: ""
},
hit: Boolean,
disableTransitions: Boolean,
color: {
type: String,
default: ""
},
size: {
type: String,
values: componentSizes,
default: ""
},
effect: {
type: String,
values: ["dark", "light", "plain"],
default: "light"
},
round: Boolean
});
const tagEmits = {
close: (evt) => evt instanceof MouseEvent,
click: (evt) => evt instanceof MouseEvent
};
const __default__$9 = defineComponent({
name: "ElTag"
});
const _sfc_main$j = /* @__PURE__ */ defineComponent({
...__default__$9,
props: tagProps,
emits: tagEmits,
setup(__props, { emit }) {
const props = __props;
const tagSize = useFormSize();
const ns = useNamespace("tag");
const classes = computed$1(() => {
const { type: type2, hit, effect, closable, round: round2 } = props;
return [
ns.b(),
ns.is("closable", closable),
ns.m(type2),
ns.m(tagSize.value),
ns.m(effect),
ns.is("hit", hit),
ns.is("round", round2)
];
});
const handleClose = (event2) => {
emit("close", event2);
};
const handleClick = (event2) => {
emit("click", event2);
};
return (_ctx, _cache) => {
return _ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass(unref(classes)),
style: normalizeStyle({ backgroundColor: _ctx.color }),
onClick: handleClick
}, [
createElementVNode("span", {
class: normalizeClass(unref(ns).e("content"))
}, [
renderSlot(_ctx.$slots, "default")
], 2),
_ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(ns).e("close")),
onClick: withModifiers(handleClose, ["stop"])
}, {
default: withCtx(() => [
createVNode(unref(close_default))
]),
_: 1
}, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
], 6)) : (openBlock(), createBlock(Transition, {
key: 1,
name: `${unref(ns).namespace.value}-zoom-in-center`,
appear: ""
}, {
default: withCtx(() => [
createElementVNode("span", {
class: normalizeClass(unref(classes)),
style: normalizeStyle({ backgroundColor: _ctx.color }),
onClick: handleClick
}, [
createElementVNode("span", {
class: normalizeClass(unref(ns).e("content"))
}, [
renderSlot(_ctx.$slots, "default")
], 2),
_ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(ns).e("close")),
onClick: withModifiers(handleClose, ["stop"])
}, {
default: withCtx(() => [
createVNode(unref(close_default))
]),
_: 1
}, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
], 6)
]),
_: 3
}, 8, ["name"]));
};
}
});
var Tag = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);
const ElTag = withInstall(Tag);
const emitChangeFn = (value) => typeof isNumber(value);
const collapseProps = buildProps({
accordion: Boolean,
modelValue: {
type: definePropType([Array, String, Number]),
default: () => mutable([])
}
});
const collapseEmits = {
[UPDATE_MODEL_EVENT]: emitChangeFn,
[CHANGE_EVENT]: emitChangeFn
};
const collapseContextKey = Symbol("collapseContextKey");
const useCollapse = (props, emit) => {
const activeNames = ref(castArray(props.modelValue));
const setActiveNames = (_activeNames) => {
activeNames.value = _activeNames;
const value = props.accordion ? activeNames.value[0] : activeNames.value;
emit(UPDATE_MODEL_EVENT, value);
emit(CHANGE_EVENT, value);
};
const handleItemClick = (name) => {
if (props.accordion) {
setActiveNames([activeNames.value[0] === name ? "" : name]);
} else {
const _activeNames = [...activeNames.value];
const index2 = _activeNames.indexOf(name);
if (index2 > -1) {
_activeNames.splice(index2, 1);
} else {
_activeNames.push(name);
}
setActiveNames(_activeNames);
}
};
watch(() => props.modelValue, () => activeNames.value = castArray(props.modelValue), { deep: true });
provide(collapseContextKey, {
activeNames,
handleItemClick
});
return {
activeNames,
setActiveNames
};
};
const useCollapseDOM = () => {
const ns = useNamespace("collapse");
const rootKls = computed$1(() => ns.b());
return {
rootKls
};
};
const __default__$8 = defineComponent({
name: "ElCollapse"
});
const _sfc_main$i = /* @__PURE__ */ defineComponent({
...__default__$8,
props: collapseProps,
emits: collapseEmits,
setup(__props, { expose, emit }) {
const props = __props;
const { activeNames, setActiveNames } = useCollapse(props, emit);
const { rootKls } = useCollapseDOM();
expose({
activeNames,
setActiveNames
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(unref(rootKls)),
role: "tablist",
"aria-multiselectable": "true"
}, [
renderSlot(_ctx.$slots, "default")
], 2);
};
}
});
var Collapse = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse.vue"]]);
const __default__$7 = defineComponent({
name: "ElCollapseTransition"
});
const _sfc_main$h = /* @__PURE__ */ defineComponent({
...__default__$7,
setup(__props) {
const ns = useNamespace("collapse-transition");
const on3 = {
beforeEnter(el) {
if (!el.dataset)
el.dataset = {};
el.dataset.oldPaddingTop = el.style.paddingTop;
el.dataset.oldPaddingBottom = el.style.paddingBottom;
el.style.maxHeight = 0;
el.style.paddingTop = 0;
el.style.paddingBottom = 0;
},
enter(el) {
el.dataset.oldOverflow = el.style.overflow;
if (el.scrollHeight !== 0) {
el.style.maxHeight = `${el.scrollHeight}px`;
el.style.paddingTop = el.dataset.oldPaddingTop;
el.style.paddingBottom = el.dataset.oldPaddingBottom;
} else {
el.style.maxHeight = 0;
el.style.paddingTop = el.dataset.oldPaddingTop;
el.style.paddingBottom = el.dataset.oldPaddingBottom;
}
el.style.overflow = "hidden";
},
afterEnter(el) {
el.style.maxHeight = "";
el.style.overflow = el.dataset.oldOverflow;
},
beforeLeave(el) {
if (!el.dataset)
el.dataset = {};
el.dataset.oldPaddingTop = el.style.paddingTop;
el.dataset.oldPaddingBottom = el.style.paddingBottom;
el.dataset.oldOverflow = el.style.overflow;
el.style.maxHeight = `${el.scrollHeight}px`;
el.style.overflow = "hidden";
},
leave(el) {
if (el.scrollHeight !== 0) {
el.style.maxHeight = 0;
el.style.paddingTop = 0;
el.style.paddingBottom = 0;
}
},
afterLeave(el) {
el.style.maxHeight = "";
el.style.overflow = el.dataset.oldOverflow;
el.style.paddingTop = el.dataset.oldPaddingTop;
el.style.paddingBottom = el.dataset.oldPaddingBottom;
}
};
return (_ctx, _cache) => {
return openBlock(), createBlock(Transition, mergeProps({
name: unref(ns).b()
}, toHandlers(on3)), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["name"]);
};
}
});
var CollapseTransition = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse-transition/src/collapse-transition.vue"]]);
CollapseTransition.install = (app) => {
app.component(CollapseTransition.name, CollapseTransition);
};
const _CollapseTransition = CollapseTransition;
const collapseItemProps = buildProps({
title: {
type: String,
default: ""
},
name: {
type: definePropType([String, Number]),
default: () => generateId()
},
disabled: Boolean
});
const useCollapseItem = (props) => {
const collapse = inject(collapseContextKey);
const focusing = ref(false);
const isClick = ref(false);
const id = ref(generateId());
const isActive = computed$1(() => collapse == null ? void 0 : collapse.activeNames.value.includes(props.name));
const handleFocus = () => {
setTimeout(() => {
if (!isClick.value) {
focusing.value = true;
} else {
isClick.value = false;
}
}, 50);
};
const handleHeaderClick = () => {
if (props.disabled)
return;
collapse == null ? void 0 : collapse.handleItemClick(props.name);
focusing.value = false;
isClick.value = true;
};
const handleEnterClick = () => {
collapse == null ? void 0 : collapse.handleItemClick(props.name);
};
return {
focusing,
id,
isActive,
handleFocus,
handleHeaderClick,
handleEnterClick
};
};
const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
const ns = useNamespace("collapse");
const rootKls = computed$1(() => [
ns.b("item"),
ns.is("active", unref(isActive)),
ns.is("disabled", props.disabled)
]);
const headKls = computed$1(() => [
ns.be("item", "header"),
ns.is("active", unref(isActive)),
{ focusing: unref(focusing) && !props.disabled }
]);
const arrowKls = computed$1(() => [
ns.be("item", "arrow"),
ns.is("active", unref(isActive))
]);
const itemWrapperKls = computed$1(() => ns.be("item", "wrap"));
const itemContentKls = computed$1(() => ns.be("item", "content"));
const scopedContentId = computed$1(() => ns.b(`content-${unref(id)}`));
const scopedHeadId = computed$1(() => ns.b(`head-${unref(id)}`));
return {
arrowKls,
headKls,
rootKls,
itemWrapperKls,
itemContentKls,
scopedContentId,
scopedHeadId
};
};
const _hoisted_1$b = ["aria-expanded", "aria-controls", "aria-describedby"];
const _hoisted_2$8 = ["id", "tabindex"];
const _hoisted_3$5 = ["id", "aria-hidden", "aria-labelledby"];
const __default__$6 = defineComponent({
name: "ElCollapseItem"
});
const _sfc_main$g = /* @__PURE__ */ defineComponent({
...__default__$6,
props: collapseItemProps,
setup(__props, { expose }) {
const props = __props;
const {
focusing,
id,
isActive,
handleFocus,
handleHeaderClick,
handleEnterClick
} = useCollapseItem(props);
const {
arrowKls,
headKls,
rootKls,
itemWrapperKls,
itemContentKls,
scopedContentId,
scopedHeadId
} = useCollapseItemDOM(props, { focusing, isActive, id });
expose({
isActive
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(unref(rootKls))
}, [
createElementVNode("div", {
role: "tab",
"aria-expanded": unref(isActive),
"aria-controls": unref(scopedContentId),
"aria-describedby": unref(scopedContentId)
}, [
createElementVNode("div", {
id: unref(scopedHeadId),
class: normalizeClass(unref(headKls)),
role: "button",
tabindex: _ctx.disabled ? -1 : 0,
onClick: _cache[0] || (_cache[0] = (...args) => unref(handleHeaderClick) && unref(handleHeaderClick)(...args)),
onKeypress: _cache[1] || (_cache[1] = withKeys(withModifiers((...args) => unref(handleEnterClick) && unref(handleEnterClick)(...args), ["stop", "prevent"]), ["space", "enter"])),
onFocus: _cache[2] || (_cache[2] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
onBlur: _cache[3] || (_cache[3] = ($event) => focusing.value = false)
}, [
renderSlot(_ctx.$slots, "title", {}, () => [
createTextVNode(toDisplayString(_ctx.title), 1)
]),
createVNode(unref(ElIcon), {
class: normalizeClass(unref(arrowKls))
}, {
default: withCtx(() => [
createVNode(unref(arrow_right_default))
]),
_: 1
}, 8, ["class"])
], 42, _hoisted_2$8)
], 8, _hoisted_1$b),
createVNode(unref(_CollapseTransition), null, {
default: withCtx(() => [
withDirectives(createElementVNode("div", {
id: unref(scopedContentId),
class: normalizeClass(unref(itemWrapperKls)),
role: "tabpanel",
"aria-hidden": !unref(isActive),
"aria-labelledby": unref(scopedHeadId)
}, [
createElementVNode("div", {
class: normalizeClass(unref(itemContentKls))
}, [
renderSlot(_ctx.$slots, "default")
], 2)
], 10, _hoisted_3$5), [
[vShow, unref(isActive)]
])
]),
_: 3
})
], 2);
};
}
});
var CollapseItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse-item.vue"]]);
const ElCollapse = withInstall(Collapse, {
CollapseItem
});
const ElCollapseItem = withNoopInstall(CollapseItem);
const alphaSliderProps = buildProps({
color: {
type: definePropType(Object),
required: true
},
vertical: {
type: Boolean,
default: false
}
});
let isDragging = false;
function draggable(element, options2) {
if (!isClient)
return;
const moveFn = function(event2) {
var _a2;
(_a2 = options2.drag) == null ? void 0 : _a2.call(options2, event2);
};
const upFn = function(event2) {
var _a2;
document.removeEventListener("mousemove", moveFn);
document.removeEventListener("mouseup", upFn);
document.removeEventListener("touchmove", moveFn);
document.removeEventListener("touchend", upFn);
document.onselectstart = null;
document.ondragstart = null;
isDragging = false;
(_a2 = options2.end) == null ? void 0 : _a2.call(options2, event2);
};
const downFn = function(event2) {
var _a2;
if (isDragging)
return;
event2.preventDefault();
document.onselectstart = () => false;
document.ondragstart = () => false;
document.addEventListener("mousemove", moveFn);
document.addEventListener("mouseup", upFn);
document.addEventListener("touchmove", moveFn);
document.addEventListener("touchend", upFn);
isDragging = true;
(_a2 = options2.start) == null ? void 0 : _a2.call(options2, event2);
};
element.addEventListener("mousedown", downFn);
element.addEventListener("touchstart", downFn);
}
const useAlphaSlider = (props) => {
const instance = getCurrentInstance();
const thumb = shallowRef();
const bar = shallowRef();
function handleClick(event2) {
const target = event2.target;
if (target !== thumb.value) {
handleDrag(event2);
}
}
function handleDrag(event2) {
if (!bar.value || !thumb.value)
return;
const el = instance.vnode.el;
const rect = el.getBoundingClientRect();
const { clientX, clientY } = getClientXY(event2);
if (!props.vertical) {
let left = clientX - rect.left;
left = Math.max(thumb.value.offsetWidth / 2, left);
left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
} else {
let top = clientY - rect.top;
top = Math.max(thumb.value.offsetHeight / 2, top);
top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
}
}
return {
thumb,
bar,
handleDrag,
handleClick
};
};
const useAlphaSliderDOM = (props, {
bar,
thumb,
handleDrag
}) => {
const instance = getCurrentInstance();
const ns = useNamespace("color-alpha-slider");
const thumbLeft = ref(0);
const thumbTop = ref(0);
const background = ref();
function getThumbLeft() {
if (!thumb.value)
return 0;
if (props.vertical)
return 0;
const el = instance.vnode.el;
const alpha = props.color.get("alpha");
if (!el)
return 0;
return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
}
function getThumbTop() {
if (!thumb.value)
return 0;
const el = instance.vnode.el;
if (!props.vertical)
return 0;
const alpha = props.color.get("alpha");
if (!el)
return 0;
return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
}
function getBackground() {
if (props.color && props.color.value) {
const { r: r2, g, b } = props.color.toRgb();
return `linear-gradient(to right, rgba(${r2}, ${g}, ${b}, 0) 0%, rgba(${r2}, ${g}, ${b}, 1) 100%)`;
}
return "";
}
function update() {
thumbLeft.value = getThumbLeft();
thumbTop.value = getThumbTop();
background.value = getBackground();
}
onMounted(() => {
if (!bar.value || !thumb.value)
return;
const dragConfig = {
drag: (event2) => {
handleDrag(event2);
},
end: (event2) => {
handleDrag(event2);
}
};
draggable(bar.value, dragConfig);
draggable(thumb.value, dragConfig);
update();
});
watch(() => props.color.get("alpha"), () => update());
watch(() => props.color.value, () => update());
const rootKls = computed$1(() => [ns.b(), ns.is("vertical", props.vertical)]);
const barKls = computed$1(() => ns.e("bar"));
const thumbKls = computed$1(() => ns.e("thumb"));
const barStyle = computed$1(() => ({ background: background.value }));
const thumbStyle = computed$1(() => ({
left: addUnit(thumbLeft.value),
top: addUnit(thumbTop.value)
}));
return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update };
};
const COMPONENT_NAME$2 = "ElColorAlphaSlider";
const __default__$5 = defineComponent({
name: COMPONENT_NAME$2
});
const _sfc_main$f = /* @__PURE__ */ defineComponent({
...__default__$5,
props: alphaSliderProps,
setup(__props, { expose }) {
const props = __props;
const { bar, thumb, handleDrag, handleClick } = useAlphaSlider(props);
const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
bar,
thumb,
handleDrag
});
expose({
update,
bar,
thumb
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(unref(rootKls))
}, [
createElementVNode("div", {
ref_key: "bar",
ref: bar,
class: normalizeClass(unref(barKls)),
style: normalizeStyle(unref(barStyle)),
onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args))
}, null, 6),
createElementVNode("div", {
ref_key: "thumb",
ref: thumb,
class: normalizeClass(unref(thumbKls)),
style: normalizeStyle(unref(thumbStyle))
}, null, 6)
], 2);
};
}
});
var AlphaSlider = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/alpha-slider.vue"]]);
const _sfc_main$e = defineComponent({
name: "ElColorHueSlider",
props: {
color: {
type: Object,
required: true
},
vertical: Boolean
},
setup(props) {
const ns = useNamespace("color-hue-slider");
const instance = getCurrentInstance();
const thumb = ref();
const bar = ref();
const thumbLeft = ref(0);
const thumbTop = ref(0);
const hueValue = computed$1(() => {
return props.color.get("hue");
});
watch(() => hueValue.value, () => {
update();
});
function handleClick(event2) {
const target = event2.target;
if (target !== thumb.value) {
handleDrag(event2);
}
}
function handleDrag(event2) {
if (!bar.value || !thumb.value)
return;
const el = instance.vnode.el;
const rect = el.getBoundingClientRect();
const { clientX, clientY } = getClientXY(event2);
let hue;
if (!props.vertical) {
let left = clientX - rect.left;
left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
left = Math.max(thumb.value.offsetWidth / 2, left);
hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
} else {
let top = clientY - rect.top;
top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
top = Math.max(thumb.value.offsetHeight / 2, top);
hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
}
props.color.set("hue", hue);
}
function getThumbLeft() {
if (!thumb.value)
return 0;
const el = instance.vnode.el;
if (props.vertical)
return 0;
const hue = props.color.get("hue");
if (!el)
return 0;
return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
}
function getThumbTop() {
if (!thumb.value)
return 0;
const el = instance.vnode.el;
if (!props.vertical)
return 0;
const hue = props.color.get("hue");
if (!el)
return 0;
return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
}
function update() {
thumbLeft.value = getThumbLeft();
thumbTop.value = getThumbTop();
}
onMounted(() => {
if (!bar.value || !thumb.value)
return;
const dragConfig = {
drag: (event2) => {
handleDrag(event2);
},
end: (event2) => {
handleDrag(event2);
}
};
draggable(bar.value, dragConfig);
draggable(thumb.value, dragConfig);
update();
});
return {
bar,
thumb,
thumbLeft,
thumbTop,
hueValue,
handleClick,
update,
ns
};
}
});
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", {
class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
}, [
createElementVNode("div", {
ref: "bar",
class: normalizeClass(_ctx.ns.e("bar")),
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
}, null, 2),
createElementVNode("div", {
ref: "thumb",
class: normalizeClass(_ctx.ns.e("thumb")),
style: normalizeStyle({
left: _ctx.thumbLeft + "px",
top: _ctx.thumbTop + "px"
})
}, null, 6)
], 2);
}
var HueSlider = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["render", _sfc_render$6], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/hue-slider.vue"]]);
const colorPickerProps = buildProps({
modelValue: String,
id: String,
showAlpha: Boolean,
colorFormat: String,
disabled: Boolean,
size: useSizeProp,
popperClass: {
type: String,
default: ""
},
label: {
type: String,
default: void 0
},
tabindex: {
type: [String, Number],
default: 0
},
predefine: {
type: definePropType(Array)
},
validateEvent: {
type: Boolean,
default: true
}
});
const colorPickerEmits = {
[UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val),
[CHANGE_EVENT]: (val) => isString(val) || isNil(val),
activeChange: (val) => isString(val) || isNil(val)
};
const colorPickerContextKey = Symbol("colorPickerContextKey");
const hsv2hsl = function(hue, sat, val) {
return [
hue,
sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
hue / 2
];
};
const isOnePointZero = function(n) {
return typeof n === "string" && n.includes(".") && Number.parseFloat(n) === 1;
};
const isPercentage = function(n) {
return typeof n === "string" && n.includes("%");
};
const bound01 = function(value, max2) {
if (isOnePointZero(value))
value = "100%";
const processPercent = isPercentage(value);
value = Math.min(max2, Math.max(0, Number.parseFloat(`${value}`)));
if (processPercent) {
value = Number.parseInt(`${value * max2}`, 10) / 100;
}
if (Math.abs(value - max2) < 1e-6) {
return 1;
}
return value % max2 / Number.parseFloat(max2);
};
const INT_HEX_MAP = {
10: "A",
11: "B",
12: "C",
13: "D",
14: "E",
15: "F"
};
const hexOne = (value) => {
value = Math.min(Math.round(value), 255);
const high = Math.floor(value / 16);
const low = value % 16;
return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
};
const toHex = function({ r: r2, g, b }) {
if (Number.isNaN(+r2) || Number.isNaN(+g) || Number.isNaN(+b))
return "";
return `#${hexOne(r2)}${hexOne(g)}${hexOne(b)}`;
};
const HEX_INT_MAP = {
A: 10,
B: 11,
C: 12,
D: 13,
E: 14,
F: 15
};
const parseHexChannel = function(hex) {
if (hex.length === 2) {
return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
}
return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
};
const hsl2hsv = function(hue, sat, light) {
sat = sat / 100;
light = light / 100;
let smin = sat;
const lmin = Math.max(light, 0.01);
light *= 2;
sat *= light <= 1 ? light : 2 - light;
smin *= lmin <= 1 ? lmin : 2 - lmin;
const v = (light + sat) / 2;
const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
return {
h: hue,
s: sv * 100,
v: v * 100
};
};
const rgb2hsv = (r2, g, b) => {
r2 = bound01(r2, 255);
g = bound01(g, 255);
b = bound01(b, 255);
const max2 = Math.max(r2, g, b);
const min2 = Math.min(r2, g, b);
let h2;
const v = max2;
const d2 = max2 - min2;
const s = max2 === 0 ? 0 : d2 / max2;
if (max2 === min2) {
h2 = 0;
} else {
switch (max2) {
case r2: {
h2 = (g - b) / d2 + (g < b ? 6 : 0);
break;
}
case g: {
h2 = (b - r2) / d2 + 2;
break;
}
case b: {
h2 = (r2 - g) / d2 + 4;
break;
}
}
h2 /= 6;
}
return { h: h2 * 360, s: s * 100, v: v * 100 };
};
const hsv2rgb = function(h2, s, v) {
h2 = bound01(h2, 360) * 6;
s = bound01(s, 100);
v = bound01(v, 100);
const i2 = Math.floor(h2);
const f = h2 - i2;
const p = v * (1 - s);
const q2 = v * (1 - f * s);
const t2 = v * (1 - (1 - f) * s);
const mod = i2 % 6;
const r2 = [v, q2, p, p, t2, v][mod];
const g = [t2, v, v, q2, p, p][mod];
const b = [p, p, t2, v, v, q2][mod];
return {
r: Math.round(r2 * 255),
g: Math.round(g * 255),
b: Math.round(b * 255)
};
};
class Color$1 {
constructor(options2 = {}) {
this._hue = 0;
this._saturation = 100;
this._value = 100;
this._alpha = 100;
this.enableAlpha = false;
this.format = "hex";
this.value = "";
for (const option in options2) {
if (hasOwn(options2, option)) {
this[option] = options2[option];
}
}
if (options2.value) {
this.fromString(options2.value);
} else {
this.doOnChange();
}
}
set(prop, value) {
if (arguments.length === 1 && typeof prop === "object") {
for (const p in prop) {
if (hasOwn(prop, p)) {
this.set(p, prop[p]);
}
}
return;
}
this[`_${prop}`] = value;
this.doOnChange();
}
get(prop) {
if (prop === "alpha") {
return Math.floor(this[`_${prop}`]);
}
return this[`_${prop}`];
}
toRgb() {
return hsv2rgb(this._hue, this._saturation, this._value);
}
fromString(value) {
if (!value) {
this._hue = 0;
this._saturation = 100;
this._value = 100;
this.doOnChange();
return;
}
const fromHSV = (h2, s, v) => {
this._hue = Math.max(0, Math.min(360, h2));
this._saturation = Math.max(0, Math.min(100, s));
this._value = Math.max(0, Math.min(100, v));
this.doOnChange();
};
if (value.includes("hsl")) {
const parts = value.replace(/hsla|hsl|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
if (parts.length === 4) {
this._alpha = Number.parseFloat(parts[3]) * 100;
} else if (parts.length === 3) {
this._alpha = 100;
}
if (parts.length >= 3) {
const { h: h2, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
fromHSV(h2, s, v);
}
} else if (value.includes("hsv")) {
const parts = value.replace(/hsva|hsv|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
if (parts.length === 4) {
this._alpha = Number.parseFloat(parts[3]) * 100;
} else if (parts.length === 3) {
this._alpha = 100;
}
if (parts.length >= 3) {
fromHSV(parts[0], parts[1], parts[2]);
}
} else if (value.includes("rgb")) {
const parts = value.replace(/rgba|rgb|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
if (parts.length === 4) {
this._alpha = Number.parseFloat(parts[3]) * 100;
} else if (parts.length === 3) {
this._alpha = 100;
}
if (parts.length >= 3) {
const { h: h2, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
fromHSV(h2, s, v);
}
} else if (value.includes("#")) {
const hex = value.replace("#", "").trim();
if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
return;
let r2, g, b;
if (hex.length === 3) {
r2 = parseHexChannel(hex[0] + hex[0]);
g = parseHexChannel(hex[1] + hex[1]);
b = parseHexChannel(hex[2] + hex[2]);
} else if (hex.length === 6 || hex.length === 8) {
r2 = parseHexChannel(hex.slice(0, 2));
g = parseHexChannel(hex.slice(2, 4));
b = parseHexChannel(hex.slice(4, 6));
}
if (hex.length === 8) {
this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
} else if (hex.length === 3 || hex.length === 6) {
this._alpha = 100;
}
const { h: h2, s, v } = rgb2hsv(r2, g, b);
fromHSV(h2, s, v);
}
}
compare(color2) {
return Math.abs(color2._hue - this._hue) < 2 && Math.abs(color2._saturation - this._saturation) < 1 && Math.abs(color2._value - this._value) < 1 && Math.abs(color2._alpha - this._alpha) < 1;
}
doOnChange() {
const { _hue, _saturation, _value, _alpha, format } = this;
if (this.enableAlpha) {
switch (format) {
case "hsl": {
const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
break;
}
case "hsv": {
this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
break;
}
case "hex": {
this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
break;
}
default: {
const { r: r2, g, b } = hsv2rgb(_hue, _saturation, _value);
this.value = `rgba(${r2}, ${g}, ${b}, ${this.get("alpha") / 100})`;
}
}
} else {
switch (format) {
case "hsl": {
const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
break;
}
case "hsv": {
this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
break;
}
case "rgb": {
const { r: r2, g, b } = hsv2rgb(_hue, _saturation, _value);
this.value = `rgb(${r2}, ${g}, ${b})`;
break;
}
default: {
this.value = toHex(hsv2rgb(_hue, _saturation, _value));
}
}
}
}
}
const _sfc_main$d = defineComponent({
props: {
colors: {
type: Array,
required: true
},
color: {
type: Object,
required: true
}
},
setup(props) {
const ns = useNamespace("color-predefine");
const { currentColor } = inject(colorPickerContextKey);
const rgbaColors = ref(parseColors(props.colors, props.color));
watch(() => currentColor.value, (val) => {
const color2 = new Color$1();
color2.fromString(val);
rgbaColors.value.forEach((item) => {
item.selected = color2.compare(item);
});
});
watchEffect(() => {
rgbaColors.value = parseColors(props.colors, props.color);
});
function handleSelect(index2) {
props.color.fromString(props.colors[index2]);
}
function parseColors(colors, color2) {
return colors.map((value) => {
const c = new Color$1();
c.enableAlpha = true;
c.format = "rgba";
c.fromString(value);
c.selected = c.value === color2.value;
return c;
});
}
return {
rgbaColors,
handleSelect,
ns
};
}
});
const _hoisted_1$a = ["onClick"];
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", {
class: normalizeClass(_ctx.ns.b())
}, [
createElementVNode("div", {
class: normalizeClass(_ctx.ns.e("colors"))
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rgbaColors, (item, index2) => {
return openBlock(), createElementBlock("div", {
key: _ctx.colors[index2],
class: normalizeClass([
_ctx.ns.e("color-selector"),
_ctx.ns.is("alpha", item._alpha < 100),
{ selected: item.selected }
]),
onClick: ($event) => _ctx.handleSelect(index2)
}, [
createElementVNode("div", {
style: normalizeStyle({ backgroundColor: item.value })
}, null, 4)
], 10, _hoisted_1$a);
}), 128))
], 2)
], 2);
}
var Predefine = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["render", _sfc_render$5], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/predefine.vue"]]);
const _sfc_main$c = defineComponent({
name: "ElSlPanel",
props: {
color: {
type: Object,
required: true
}
},
setup(props) {
const ns = useNamespace("color-svpanel");
const instance = getCurrentInstance();
const cursorTop = ref(0);
const cursorLeft = ref(0);
const background = ref("hsl(0, 100%, 50%)");
const colorValue = computed$1(() => {
const hue = props.color.get("hue");
const value = props.color.get("value");
return { hue, value };
});
function update() {
const saturation = props.color.get("saturation");
const value = props.color.get("value");
const el = instance.vnode.el;
const { clientWidth: width2, clientHeight: height2 } = el;
cursorLeft.value = saturation * width2 / 100;
cursorTop.value = (100 - value) * height2 / 100;
background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
}
function handleDrag(event2) {
const el = instance.vnode.el;
const rect = el.getBoundingClientRect();
const { clientX, clientY } = getClientXY(event2);
let left = clientX - rect.left;
let top = clientY - rect.top;
left = Math.max(0, left);
left = Math.min(left, rect.width);
top = Math.max(0, top);
top = Math.min(top, rect.height);
cursorLeft.value = left;
cursorTop.value = top;
props.color.set({
saturation: left / rect.width * 100,
value: 100 - top / rect.height * 100
});
}
watch(() => colorValue.value, () => {
update();
});
onMounted(() => {
draggable(instance.vnode.el, {
drag: (event2) => {
handleDrag(event2);
},
end: (event2) => {
handleDrag(event2);
}
});
update();
});
return {
cursorTop,
cursorLeft,
background,
colorValue,
handleDrag,
update,
ns
};
}
});
const _hoisted_1$9 = /* @__PURE__ */ createElementVNode("div", null, null, -1);
const _hoisted_2$7 = [
_hoisted_1$9
];
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", {
class: normalizeClass(_ctx.ns.b()),
style: normalizeStyle({
backgroundColor: _ctx.background
})
}, [
createElementVNode("div", {
class: normalizeClass(_ctx.ns.e("white"))
}, null, 2),
createElementVNode("div", {
class: normalizeClass(_ctx.ns.e("black"))
}, null, 2),
createElementVNode("div", {
class: normalizeClass(_ctx.ns.e("cursor")),
style: normalizeStyle({
top: _ctx.cursorTop + "px",
left: _ctx.cursorLeft + "px"
})
}, _hoisted_2$7, 6)
], 6);
}
var SvPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render$4], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/sv-panel.vue"]]);
const _hoisted_1$8 = ["id", "aria-label", "aria-labelledby", "aria-description", "tabindex", "onKeydown"];
const __default__$4 = defineComponent({
name: "ElColorPicker"
});
const _sfc_main$b = /* @__PURE__ */ defineComponent({
...__default__$4,
props: colorPickerProps,
emits: colorPickerEmits,
setup(__props, { expose, emit }) {
const props = __props;
const { t: t2 } = useLocale();
const ns = useNamespace("color");
const { formItem } = useFormItem();
const colorSize = useFormSize();
const colorDisabled = useFormDisabled();
const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
formItemContext: formItem
});
const hue = ref();
const sv = ref();
const alpha = ref();
const popper = ref();
let shouldActiveChange = true;
const color2 = reactive(new Color$1({
enableAlpha: props.showAlpha,
format: props.colorFormat || "",
value: props.modelValue
}));
const showPicker = ref(false);
const showPanelColor = ref(false);
const customInput = ref("");
const displayedColor = computed$1(() => {
if (!props.modelValue && !showPanelColor.value) {
return "transparent";
}
return displayedRgb(color2, props.showAlpha);
});
const currentColor = computed$1(() => {
return !props.modelValue && !showPanelColor.value ? "" : color2.value;
});
const buttonAriaLabel = computed$1(() => {
return !isLabeledByFormItem.value ? props.label || t2("el.colorpicker.defaultLabel") : void 0;
});
const buttonAriaLabelledby = computed$1(() => {
return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
});
const btnKls = computed$1(() => {
return [
ns.b("picker"),
ns.is("disabled", colorDisabled.value),
ns.bm("picker", colorSize.value)
];
});
function displayedRgb(color22, showAlpha) {
if (!(color22 instanceof Color$1)) {
throw new TypeError("color should be instance of _color Class");
}
const { r: r2, g, b } = color22.toRgb();
return showAlpha ? `rgba(${r2}, ${g}, ${b}, ${color22.get("alpha") / 100})` : `rgb(${r2}, ${g}, ${b})`;
}
function setShowPicker(value) {
showPicker.value = value;
}
const debounceSetShowPicker = debounce$2(setShowPicker, 100);
function show() {
if (colorDisabled.value)
return;
setShowPicker(true);
}
function hide() {
debounceSetShowPicker(false);
resetColor();
}
function resetColor() {
nextTick(() => {
if (props.modelValue) {
color2.fromString(props.modelValue);
} else {
color2.value = "";
nextTick(() => {
showPanelColor.value = false;
});
}
});
}
function handleTrigger() {
if (colorDisabled.value)
return;
debounceSetShowPicker(!showPicker.value);
}
function handleConfirm() {
color2.fromString(customInput.value);
}
function confirmValue() {
const value = color2.value;
emit(UPDATE_MODEL_EVENT, value);
emit("change", value);
if (props.validateEvent) {
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
}
debounceSetShowPicker(false);
nextTick(() => {
const newColor = new Color$1({
enableAlpha: props.showAlpha,
format: props.colorFormat || "",
value: props.modelValue
});
if (!color2.compare(newColor)) {
resetColor();
}
});
}
function clear() {
debounceSetShowPicker(false);
emit(UPDATE_MODEL_EVENT, null);
emit("change", null);
if (props.modelValue !== null && props.validateEvent) {
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
}
resetColor();
}
onMounted(() => {
if (props.modelValue) {
customInput.value = currentColor.value;
}
});
watch(() => props.modelValue, (newVal) => {
if (!newVal) {
showPanelColor.value = false;
} else if (newVal && newVal !== color2.value) {
shouldActiveChange = false;
color2.fromString(newVal);
}
});
watch(() => currentColor.value, (val) => {
customInput.value = val;
shouldActiveChange && emit("activeChange", val);
shouldActiveChange = true;
});
watch(() => color2.value, () => {
if (!props.modelValue && !showPanelColor.value) {
showPanelColor.value = true;
}
});
watch(() => showPicker.value, () => {
nextTick(() => {
var _a2, _b, _c;
(_a2 = hue.value) == null ? void 0 : _a2.update();
(_b = sv.value) == null ? void 0 : _b.update();
(_c = alpha.value) == null ? void 0 : _c.update();
});
});
provide(colorPickerContextKey, {
currentColor
});
expose({
color: color2,
show,
hide
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ElTooltip), {
ref_key: "popper",
ref: popper,
visible: showPicker.value,
"show-arrow": false,
"fallback-placements": ["bottom", "top", "right", "left"],
offset: 0,
"gpu-acceleration": false,
"popper-class": [unref(ns).be("picker", "panel"), unref(ns).b("dropdown"), _ctx.popperClass],
"stop-popper-mouse-event": false,
effect: "light",
trigger: "click",
transition: `${unref(ns).namespace.value}-zoom-in-top`,
persistent: ""
}, {
content: withCtx(() => [
withDirectives((openBlock(), createElementBlock("div", null, [
createElementVNode("div", {
class: normalizeClass(unref(ns).be("dropdown", "main-wrapper"))
}, [
createVNode(HueSlider, {
ref_key: "hue",
ref: hue,
class: "hue-slider",
color: unref(color2),
vertical: ""
}, null, 8, ["color"]),
createVNode(SvPanel, {
ref: "svPanel",
color: unref(color2)
}, null, 8, ["color"])
], 2),
_ctx.showAlpha ? (openBlock(), createBlock(AlphaSlider, {
key: 0,
ref_key: "alpha",
ref: alpha,
color: unref(color2)
}, null, 8, ["color"])) : createCommentVNode("v-if", true),
_ctx.predefine ? (openBlock(), createBlock(Predefine, {
key: 1,
ref: "predefine",
color: unref(color2),
colors: _ctx.predefine
}, null, 8, ["color", "colors"])) : createCommentVNode("v-if", true),
createElementVNode("div", {
class: normalizeClass(unref(ns).be("dropdown", "btns"))
}, [
createElementVNode("span", {
class: normalizeClass(unref(ns).be("dropdown", "value"))
}, [
createVNode(unref(ElInput), {
modelValue: customInput.value,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event),
"validate-event": false,
size: "small",
onKeyup: withKeys(handleConfirm, ["enter"]),
onBlur: handleConfirm
}, null, 8, ["modelValue", "onKeyup"])
], 2),
createVNode(unref(ElButton), {
class: normalizeClass(unref(ns).be("dropdown", "link-btn")),
text: "",
size: "small",
onClick: clear
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(t2)("el.colorpicker.clear")), 1)
]),
_: 1
}, 8, ["class"]),
createVNode(unref(ElButton), {
plain: "",
size: "small",
class: normalizeClass(unref(ns).be("dropdown", "btn")),
onClick: confirmValue
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(t2)("el.colorpicker.confirm")), 1)
]),
_: 1
}, 8, ["class"])
], 2)
])), [
[unref(ClickOutside), hide]
])
]),
default: withCtx(() => [
createElementVNode("div", {
id: unref(buttonId),
class: normalizeClass(unref(btnKls)),
role: "button",
"aria-label": unref(buttonAriaLabel),
"aria-labelledby": unref(buttonAriaLabelledby),
"aria-description": unref(t2)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
tabindex: _ctx.tabindex,
onKeydown: withKeys(handleTrigger, ["enter"])
}, [
unref(colorDisabled) ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(ns).be("picker", "mask"))
}, null, 2)) : createCommentVNode("v-if", true),
createElementVNode("div", {
class: normalizeClass(unref(ns).be("picker", "trigger")),
onClick: handleTrigger
}, [
createElementVNode("span", {
class: normalizeClass([unref(ns).be("picker", "color"), unref(ns).is("alpha", _ctx.showAlpha)])
}, [
createElementVNode("span", {
class: normalizeClass(unref(ns).be("picker", "color-inner")),
style: normalizeStyle({
backgroundColor: unref(displayedColor)
})
}, [
withDirectives(createVNode(unref(ElIcon), {
class: normalizeClass([unref(ns).be("picker", "icon"), unref(ns).is("icon-arrow-down")])
}, {
default: withCtx(() => [
createVNode(unref(arrow_down_default))
]),
_: 1
}, 8, ["class"]), [
[vShow, _ctx.modelValue || showPanelColor.value]
]),
!_ctx.modelValue && !showPanelColor.value ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass([unref(ns).be("picker", "empty"), unref(ns).is("icon-close")])
}, {
default: withCtx(() => [
createVNode(unref(close_default))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)
], 6)
], 2)
], 2)
], 42, _hoisted_1$8)
]),
_: 1
}, 8, ["visible", "popper-class", "transition"]);
};
}
});
var ColorPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/color-picker.vue"]]);
const ElColorPicker = withInstall(ColorPicker);
const overlayProps = buildProps({
mask: {
type: Boolean,
default: true
},
customMaskEvent: {
type: Boolean,
default: false
},
overlayClass: {
type: definePropType([
String,
Array,
Object
])
},
zIndex: {
type: definePropType([String, Number])
}
});
const overlayEmits = {
click: (evt) => evt instanceof MouseEvent
};
const BLOCK = "overlay";
var Overlay = defineComponent({
name: "ElOverlay",
props: overlayProps,
emits: overlayEmits,
setup(props, { slots, emit }) {
const ns = useNamespace(BLOCK);
const onMaskClick = (e) => {
emit("click", e);
};
const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
return () => {
return props.mask ? createVNode("div", {
class: [ns.b(), props.overlayClass],
style: {
zIndex: props.zIndex
},
onClick,
onMousedown,
onMouseup
}, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h("div", {
class: props.overlayClass,
style: {
zIndex: props.zIndex,
position: "fixed",
top: "0px",
right: "0px",
bottom: "0px",
left: "0px"
}
}, [renderSlot(slots, "default")]);
};
}
});
const ElOverlay = Overlay;
const dialogInjectionKey = Symbol("dialogInjectionKey");
const dialogContentProps = buildProps({
center: {
type: Boolean,
default: false
},
alignCenter: {
type: Boolean,
default: false
},
closeIcon: {
type: iconPropType
},
customClass: {
type: String,
default: ""
},
draggable: {
type: Boolean,
default: false
},
fullscreen: {
type: Boolean,
default: false
},
showClose: {
type: Boolean,
default: true
},
title: {
type: String,
default: ""
}
});
const dialogContentEmits = {
close: () => true
};
const _hoisted_1$7 = ["aria-label"];
const _hoisted_2$6 = ["id"];
const __default__$3 = defineComponent({ name: "ElDialogContent" });
const _sfc_main$a = /* @__PURE__ */ defineComponent({
...__default__$3,
props: dialogContentProps,
emits: dialogContentEmits,
setup(__props) {
const props = __props;
const { t: t2 } = useLocale();
const { Close } = CloseComponents;
const { dialogRef, headerRef, bodyId, ns, style } = inject(dialogInjectionKey);
const { focusTrapRef } = inject(FOCUS_TRAP_INJECTION_KEY);
const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
const draggable2 = computed$1(() => props.draggable);
useDraggable(dialogRef, headerRef, draggable2);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
ref: unref(composedDialogRef),
class: normalizeClass([
unref(ns).b(),
unref(ns).is("fullscreen", _ctx.fullscreen),
unref(ns).is("draggable", unref(draggable2)),
unref(ns).is("align-center", _ctx.alignCenter),
{ [unref(ns).m("center")]: _ctx.center },
_ctx.customClass
]),
style: normalizeStyle(unref(style)),
tabindex: "-1"
}, [
createElementVNode("header", {
ref_key: "headerRef",
ref: headerRef,
class: normalizeClass(unref(ns).e("header"))
}, [
renderSlot(_ctx.$slots, "header", {}, () => [
createElementVNode("span", {
role: "heading",
class: normalizeClass(unref(ns).e("title"))
}, toDisplayString(_ctx.title), 3)
]),
_ctx.showClose ? (openBlock(), createElementBlock("button", {
key: 0,
"aria-label": unref(t2)("el.dialog.close"),
class: normalizeClass(unref(ns).e("headerbtn")),
type: "button",
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
}, [
createVNode(unref(ElIcon), {
class: normalizeClass(unref(ns).e("close"))
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
]),
_: 1
}, 8, ["class"])
], 10, _hoisted_1$7)) : createCommentVNode("v-if", true)
], 2),
createElementVNode("div", {
id: unref(bodyId),
class: normalizeClass(unref(ns).e("body"))
}, [
renderSlot(_ctx.$slots, "default")
], 10, _hoisted_2$6),
_ctx.$slots.footer ? (openBlock(), createElementBlock("footer", {
key: 0,
class: normalizeClass(unref(ns).e("footer"))
}, [
renderSlot(_ctx.$slots, "footer")
], 2)) : createCommentVNode("v-if", true)
], 6);
};
}
});
var ElDialogContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]);
const dialogProps = buildProps({
...dialogContentProps,
appendToBody: {
type: Boolean,
default: false
},
beforeClose: {
type: definePropType(Function)
},
destroyOnClose: {
type: Boolean,
default: false
},
closeOnClickModal: {
type: Boolean,
default: true
},
closeOnPressEscape: {
type: Boolean,
default: true
},
lockScroll: {
type: Boolean,
default: true
},
modal: {
type: Boolean,
default: true
},
openDelay: {
type: Number,
default: 0
},
closeDelay: {
type: Number,
default: 0
},
top: {
type: String
},
modelValue: {
type: Boolean,
default: false
},
modalClass: String,
width: {
type: [String, Number]
},
zIndex: {
type: Number
},
trapFocus: {
type: Boolean,
default: false
}
});
const dialogEmits = {
open: () => true,
opened: () => true,
close: () => true,
closed: () => true,
[UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
openAutoFocus: () => true,
closeAutoFocus: () => true
};
const useDialog = (props, targetRef) => {
const instance = getCurrentInstance();
const emit = instance.emit;
const { nextZIndex } = useZIndex();
let lastPosition = "";
const titleId = useId();
const bodyId = useId();
const visible = ref(false);
const closed = ref(false);
const rendered = ref(false);
const zIndex2 = ref(props.zIndex || nextZIndex());
let openTimer = void 0;
let closeTimer = void 0;
const namespace = useGlobalConfig("namespace", defaultNamespace);
const style = computed$1(() => {
const style2 = {};
const varPrefix = `--${namespace.value}-dialog`;
if (!props.fullscreen) {
if (props.top) {
style2[`${varPrefix}-margin-top`] = props.top;
}
if (props.width) {
style2[`${varPrefix}-width`] = addUnit(props.width);
}
}
return style2;
});
const overlayDialogStyle = computed$1(() => {
if (props.alignCenter) {
return { display: "flex" };
}
return {};
});
function afterEnter() {
emit("opened");
}
function afterLeave() {
emit("closed");
emit(UPDATE_MODEL_EVENT, false);
if (props.destroyOnClose) {
rendered.value = false;
}
}
function beforeLeave() {
emit("close");
}
function open() {
closeTimer == null ? void 0 : closeTimer();
openTimer == null ? void 0 : openTimer();
if (props.openDelay && props.openDelay > 0) {
({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
} else {
doOpen();
}
}
function close() {
openTimer == null ? void 0 : openTimer();
closeTimer == null ? void 0 : closeTimer();
if (props.closeDelay && props.closeDelay > 0) {
({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
} else {
doClose();
}
}
function handleClose() {
function hide(shouldCancel) {
if (shouldCancel)
return;
closed.value = true;
visible.value = false;
}
if (props.beforeClose) {
props.beforeClose(hide);
} else {
close();
}
}
function onModalClick() {
if (props.closeOnClickModal) {
handleClose();
}
}
function doOpen() {
if (!isClient)
return;
visible.value = true;
}
function doClose() {
visible.value = false;
}
function onOpenAutoFocus() {
emit("openAutoFocus");
}
function onCloseAutoFocus() {
emit("closeAutoFocus");
}
function onFocusoutPrevented(event2) {
var _a2;
if (((_a2 = event2.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
event2.preventDefault();
}
}
if (props.lockScroll) {
useLockscreen(visible);
}
function onCloseRequested() {
if (props.closeOnPressEscape) {
handleClose();
}
}
watch(() => props.modelValue, (val) => {
if (val) {
closed.value = false;
open();
rendered.value = true;
zIndex2.value = props.zIndex ? zIndex2.value++ : nextZIndex();
nextTick(() => {
emit("open");
if (targetRef.value) {
targetRef.value.scrollTop = 0;
}
});
} else {
if (visible.value) {
close();
}
}
});
watch(() => props.fullscreen, (val) => {
if (!targetRef.value)
return;
if (val) {
lastPosition = targetRef.value.style.transform;
targetRef.value.style.transform = "";
} else {
targetRef.value.style.transform = lastPosition;
}
});
onMounted(() => {
if (props.modelValue) {
visible.value = true;
rendered.value = true;
open();
}
});
return {
afterEnter,
afterLeave,
beforeLeave,
handleClose,
onModalClick,
close,
doClose,
onOpenAutoFocus,
onCloseAutoFocus,
onCloseRequested,
onFocusoutPrevented,
titleId,
bodyId,
closed,
style,
overlayDialogStyle,
rendered,
visible,
zIndex: zIndex2
};
};
const _hoisted_1$6 = ["aria-label", "aria-labelledby", "aria-describedby"];
const __default__$2 = defineComponent({
name: "ElDialog",
inheritAttrs: false
});
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
...__default__$2,
props: dialogProps,
emits: dialogEmits,
setup(__props, { expose }) {
const props = __props;
const slots = useSlots();
useDeprecated({
scope: "el-dialog",
from: "the title slot",
replacement: "the header slot",
version: "3.0.0",
ref: "https://element-plus.org/en-US/component/dialog.html#slots"
}, computed$1(() => !!slots.title));
useDeprecated({
scope: "el-dialog",
from: "custom-class",
replacement: "class",
version: "2.3.0",
ref: "https://element-plus.org/en-US/component/dialog.html#attributes",
type: "Attribute"
}, computed$1(() => !!props.customClass));
const ns = useNamespace("dialog");
const dialogRef = ref();
const headerRef = ref();
const dialogContentRef = ref();
const {
visible,
titleId,
bodyId,
style,
overlayDialogStyle,
rendered,
zIndex: zIndex2,
afterEnter,
afterLeave,
beforeLeave,
handleClose,
onModalClick,
onOpenAutoFocus,
onCloseAutoFocus,
onCloseRequested,
onFocusoutPrevented
} = useDialog(props, dialogRef);
provide(dialogInjectionKey, {
dialogRef,
headerRef,
bodyId,
ns,
rendered,
style
});
const overlayEvent = useSameTarget(onModalClick);
const draggable2 = computed$1(() => props.draggable && !props.fullscreen);
expose({
visible,
dialogContentRef
});
return (_ctx, _cache) => {
return openBlock(), createBlock(Teleport, {
to: "body",
disabled: !_ctx.appendToBody
}, [
createVNode(Transition, {
name: "dialog-fade",
onAfterEnter: unref(afterEnter),
onAfterLeave: unref(afterLeave),
onBeforeLeave: unref(beforeLeave),
persisted: ""
}, {
default: withCtx(() => [
withDirectives(createVNode(unref(ElOverlay), {
"custom-mask-event": "",
mask: _ctx.modal,
"overlay-class": _ctx.modalClass,
"z-index": unref(zIndex2)
}, {
default: withCtx(() => [
createElementVNode("div", {
role: "dialog",
"aria-modal": "true",
"aria-label": _ctx.title || void 0,
"aria-labelledby": !_ctx.title ? unref(titleId) : void 0,
"aria-describedby": unref(bodyId),
class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
style: normalizeStyle(unref(overlayDialogStyle)),
onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
}, [
createVNode(unref(ElFocusTrap), {
loop: "",
trapped: unref(visible),
"focus-start-el": "container",
onFocusAfterTrapped: unref(onOpenAutoFocus),
onFocusAfterReleased: unref(onCloseAutoFocus),
onFocusoutPrevented: unref(onFocusoutPrevented),
onReleaseRequested: unref(onCloseRequested)
}, {
default: withCtx(() => [
unref(rendered) ? (openBlock(), createBlock(ElDialogContent, mergeProps({
key: 0,
ref_key: "dialogContentRef",
ref: dialogContentRef
}, _ctx.$attrs, {
"custom-class": _ctx.customClass,
center: _ctx.center,
"align-center": _ctx.alignCenter,
"close-icon": _ctx.closeIcon,
draggable: unref(draggable2),
fullscreen: _ctx.fullscreen,
"show-close": _ctx.showClose,
title: _ctx.title,
onClose: unref(handleClose)
}), createSlots({
header: withCtx(() => [
!_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
key: 0,
close: unref(handleClose),
titleId: unref(titleId),
titleClass: unref(ns).e("title")
}) : renderSlot(_ctx.$slots, "title", { key: 1 })
]),
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 2
}, [
_ctx.$slots.footer ? {
name: "footer",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "footer")
])
} : void 0
]), 1040, ["custom-class", "center", "align-center", "close-icon", "draggable", "fullscreen", "show-close", "title", "onClose"])) : createCommentVNode("v-if", true)
]),
_: 3
}, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
], 46, _hoisted_1$6)
]),
_: 3
}, 8, ["mask", "overlay-class", "z-index"]), [
[vShow, unref(visible)]
])
]),
_: 3
}, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
], 8, ["disabled"]);
};
}
});
var Dialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]);
const ElDialog = withInstall(Dialog);
const inputNumberProps = buildProps({
id: {
type: String,
default: void 0
},
step: {
type: Number,
default: 1
},
stepStrictly: Boolean,
max: {
type: Number,
default: Number.POSITIVE_INFINITY
},
min: {
type: Number,
default: Number.NEGATIVE_INFINITY
},
modelValue: Number,
readonly: Boolean,
disabled: Boolean,
size: useSizeProp,
controls: {
type: Boolean,
default: true
},
controlsPosition: {
type: String,
default: "",
values: ["", "right"]
},
valueOnClear: {
type: [String, Number, null],
validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
default: null
},
name: String,
label: String,
placeholder: String,
precision: {
type: Number,
validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
},
validateEvent: {
type: Boolean,
default: true
}
});
const inputNumberEmits = {
[CHANGE_EVENT]: (cur, prev) => prev !== cur,
blur: (e) => e instanceof FocusEvent,
focus: (e) => e instanceof FocusEvent,
[INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
[UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
};
const _hoisted_1$5 = ["aria-label", "onKeydown"];
const _hoisted_2$5 = ["aria-label", "onKeydown"];
const __default__$1 = defineComponent({
name: "ElInputNumber"
});
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
...__default__$1,
props: inputNumberProps,
emits: inputNumberEmits,
setup(__props, { expose, emit }) {
const props = __props;
const { t: t2 } = useLocale();
const ns = useNamespace("input-number");
const input = ref();
const data = reactive({
currentValue: props.modelValue,
userInput: null
});
const { formItem } = useFormItem();
const minDisabled = computed$1(() => isNumber(props.modelValue) && props.modelValue <= props.min);
const maxDisabled = computed$1(() => isNumber(props.modelValue) && props.modelValue >= props.max);
const numPrecision = computed$1(() => {
const stepPrecision = getPrecision(props.step);
if (!isUndefined(props.precision)) {
if (stepPrecision > props.precision)
;
return props.precision;
} else {
return Math.max(getPrecision(props.modelValue), stepPrecision);
}
});
const controlsAtRight = computed$1(() => {
return props.controls && props.controlsPosition === "right";
});
const inputNumberSize = useFormSize();
const inputNumberDisabled = useFormDisabled();
const displayValue = computed$1(() => {
if (data.userInput !== null) {
return data.userInput;
}
let currentValue = data.currentValue;
if (isNil(currentValue))
return "";
if (isNumber(currentValue)) {
if (Number.isNaN(currentValue))
return "";
if (!isUndefined(props.precision)) {
currentValue = currentValue.toFixed(props.precision);
}
}
return currentValue;
});
const toPrecision = (num, pre) => {
if (isUndefined(pre))
pre = numPrecision.value;
if (pre === 0)
return Math.round(num);
let snum = String(num);
const pointPos = snum.indexOf(".");
if (pointPos === -1)
return num;
const nums = snum.replace(".", "").split("");
const datum = nums[pointPos + pre];
if (!datum)
return num;
const length = snum.length;
if (snum.charAt(length - 1) === "5") {
snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
}
return Number.parseFloat(Number(snum).toFixed(pre));
};
const getPrecision = (value) => {
if (isNil(value))
return 0;
const valueString = value.toString();
const dotPosition = valueString.indexOf(".");
let precision = 0;
if (dotPosition !== -1) {
precision = valueString.length - dotPosition - 1;
}
return precision;
};
const ensurePrecision = (val, coefficient = 1) => {
if (!isNumber(val))
return data.currentValue;
return toPrecision(val + props.step * coefficient);
};
const increase = () => {
if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
return;
const value = Number(displayValue.value) || 0;
const newVal = ensurePrecision(value);
setCurrentValue(newVal);
emit(INPUT_EVENT, data.currentValue);
};
const decrease = () => {
if (props.readonly || inputNumberDisabled.value || minDisabled.value)
return;
const value = Number(displayValue.value) || 0;
const newVal = ensurePrecision(value, -1);
setCurrentValue(newVal);
emit(INPUT_EVENT, data.currentValue);
};
const verifyValue = (value, update) => {
const { max: max2, min: min2, step, precision, stepStrictly, valueOnClear } = props;
let newVal = Number(value);
if (isNil(value) || Number.isNaN(newVal)) {
return null;
}
if (value === "") {
if (valueOnClear === null) {
return null;
}
newVal = isString(valueOnClear) ? { min: min2, max: max2 }[valueOnClear] : valueOnClear;
}
if (stepStrictly) {
newVal = toPrecision(Math.round(newVal / step) * step, precision);
}
if (!isUndefined(precision)) {
newVal = toPrecision(newVal, precision);
}
if (newVal > max2 || newVal < min2) {
newVal = newVal > max2 ? max2 : min2;
update && emit(UPDATE_MODEL_EVENT, newVal);
}
return newVal;
};
const setCurrentValue = (value, emitChange = true) => {
var _a2;
const oldVal = data.currentValue;
const newVal = verifyValue(value);
if (!emitChange) {
emit(UPDATE_MODEL_EVENT, newVal);
return;
}
if (oldVal === newVal)
return;
data.userInput = null;
emit(UPDATE_MODEL_EVENT, newVal);
emit(CHANGE_EVENT, newVal, oldVal);
if (props.validateEvent) {
(_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
}
data.currentValue = newVal;
};
const handleInput = (value) => {
data.userInput = value;
const newVal = value === "" ? null : Number(value);
emit(INPUT_EVENT, newVal);
setCurrentValue(newVal, false);
};
const handleInputChange = (value) => {
const newVal = value !== "" ? Number(value) : "";
if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
setCurrentValue(newVal);
}
data.userInput = null;
};
const focus = () => {
var _a2, _b;
(_b = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
};
const blur = () => {
var _a2, _b;
(_b = (_a2 = input.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b.call(_a2);
};
const handleFocus = (event2) => {
emit("focus", event2);
};
const handleBlur = (event2) => {
var _a2;
emit("blur", event2);
if (props.validateEvent) {
(_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
}
};
watch(() => props.modelValue, (value) => {
const userInput = verifyValue(data.userInput);
const newValue = verifyValue(value, true);
if (!isNumber(userInput) && (!userInput || userInput !== newValue)) {
data.currentValue = newValue;
data.userInput = null;
}
}, { immediate: true });
onMounted(() => {
var _a2;
const { min: min2, max: max2, modelValue } = props;
const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
innerInput.setAttribute("role", "spinbutton");
if (Number.isFinite(max2)) {
innerInput.setAttribute("aria-valuemax", String(max2));
} else {
innerInput.removeAttribute("aria-valuemax");
}
if (Number.isFinite(min2)) {
innerInput.setAttribute("aria-valuemin", String(min2));
} else {
innerInput.removeAttribute("aria-valuemin");
}
innerInput.setAttribute("aria-valuenow", String(data.currentValue));
innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
if (!isNumber(modelValue) && modelValue != null) {
let val = Number(modelValue);
if (Number.isNaN(val)) {
val = null;
}
emit(UPDATE_MODEL_EVENT, val);
}
});
onUpdated(() => {
var _a2;
const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${data.currentValue}`);
});
expose({
focus,
blur
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass([
unref(ns).b(),
unref(ns).m(unref(inputNumberSize)),
unref(ns).is("disabled", unref(inputNumberDisabled)),
unref(ns).is("without-controls", !_ctx.controls),
unref(ns).is("controls-right", unref(controlsAtRight))
]),
onDragstart: _cache[1] || (_cache[1] = withModifiers(() => {
}, ["prevent"]))
}, [
_ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
key: 0,
role: "button",
"aria-label": unref(t2)("el.inputNumber.decrease"),
class: normalizeClass([unref(ns).e("decrease"), unref(ns).is("disabled", unref(minDisabled))]),
onKeydown: withKeys(decrease, ["enter"])
}, [
createVNode(unref(ElIcon), null, {
default: withCtx(() => [
unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_down_default), { key: 0 })) : (openBlock(), createBlock(unref(minus_default), { key: 1 }))
]),
_: 1
})
], 42, _hoisted_1$5)), [
[unref(vRepeatClick), decrease]
]) : createCommentVNode("v-if", true),
_ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
key: 1,
role: "button",
"aria-label": unref(t2)("el.inputNumber.increase"),
class: normalizeClass([unref(ns).e("increase"), unref(ns).is("disabled", unref(maxDisabled))]),
onKeydown: withKeys(increase, ["enter"])
}, [
createVNode(unref(ElIcon), null, {
default: withCtx(() => [
unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_up_default), { key: 0 })) : (openBlock(), createBlock(unref(plus_default), { key: 1 }))
]),
_: 1
})
], 42, _hoisted_2$5)), [
[unref(vRepeatClick), increase]
]) : createCommentVNode("v-if", true),
createVNode(unref(ElInput), {
id: _ctx.id,
ref_key: "input",
ref: input,
type: "number",
step: _ctx.step,
"model-value": unref(displayValue),
placeholder: _ctx.placeholder,
readonly: _ctx.readonly,
disabled: unref(inputNumberDisabled),
size: unref(inputNumberSize),
max: _ctx.max,
min: _ctx.min,
name: _ctx.name,
label: _ctx.label,
"validate-event": false,
onWheel: _cache[0] || (_cache[0] = withModifiers(() => {
}, ["prevent"])),
onKeydown: [
withKeys(withModifiers(increase, ["prevent"]), ["up"]),
withKeys(withModifiers(decrease, ["prevent"]), ["down"])
],
onBlur: handleBlur,
onFocus: handleFocus,
onInput: handleInput,
onChange: handleInputChange
}, null, 8, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "label", "onKeydown"])
], 34);
};
}
});
var InputNumber = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input-number/src/input-number.vue"]]);
const ElInputNumber = withInstall(InputNumber);
const selectGroupKey = Symbol("ElSelectGroup");
const selectKey = Symbol("ElSelect");
function useOption(props, states) {
const select = inject(selectKey);
const selectGroup = inject(selectGroupKey, { disabled: false });
const isObject3 = computed$1(() => {
return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
});
const itemSelected = computed$1(() => {
if (!select.props.multiple) {
return isEqual2(props.value, select.props.modelValue);
} else {
return contains(select.props.modelValue, props.value);
}
});
const limitReached = computed$1(() => {
if (select.props.multiple) {
const modelValue = select.props.modelValue || [];
return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
} else {
return false;
}
});
const currentLabel = computed$1(() => {
return props.label || (isObject3.value ? "" : props.value);
});
const currentValue = computed$1(() => {
return props.value || props.label || "";
});
const isDisabled3 = computed$1(() => {
return props.disabled || states.groupDisabled || limitReached.value;
});
const instance = getCurrentInstance();
const contains = (arr = [], target) => {
if (!isObject3.value) {
return arr && arr.includes(target);
} else {
const valueKey = select.props.valueKey;
return arr && arr.some((item) => {
return toRaw$1(get$2(item, valueKey)) === get$2(target, valueKey);
});
}
};
const isEqual2 = (a, b) => {
if (!isObject3.value) {
return a === b;
} else {
const { valueKey } = select.props;
return get$2(a, valueKey) === get$2(b, valueKey);
}
};
const hoverItem = () => {
if (!props.disabled && !selectGroup.disabled) {
select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
}
};
watch(() => currentLabel.value, () => {
if (!props.created && !select.props.remote)
select.setSelected();
});
watch(() => props.value, (val, oldVal) => {
const { remote, valueKey } = select.props;
if (!Object.is(val, oldVal)) {
select.onOptionDestroy(oldVal, instance.proxy);
select.onOptionCreate(instance.proxy);
}
if (!props.created && !remote) {
if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
return;
}
select.setSelected();
}
});
watch(() => selectGroup.disabled, () => {
states.groupDisabled = selectGroup.disabled;
}, { immediate: true });
const { queryChange } = toRaw$1(select);
watch(queryChange, (changes) => {
const { query } = unref(changes);
const regexp = new RegExp(escapeStringRegexp(query), "i");
states.visible = regexp.test(currentLabel.value) || props.created;
if (!states.visible) {
select.filteredOptionsCount--;
}
}, { immediate: true });
return {
select,
currentLabel,
currentValue,
itemSelected,
isDisabled: isDisabled3,
hoverItem
};
}
const _sfc_main$7 = defineComponent({
name: "ElOption",
componentName: "ElOption",
props: {
value: {
required: true,
type: [String, Number, Boolean, Object]
},
label: [String, Number],
created: Boolean,
disabled: {
type: Boolean,
default: false
}
},
setup(props) {
const ns = useNamespace("select");
const states = reactive({
index: -1,
groupDisabled: false,
visible: true,
hitState: false,
hover: false
});
const { currentLabel, itemSelected, isDisabled: isDisabled3, select, hoverItem } = useOption(props, states);
const { visible, hover } = toRefs(states);
const vm = getCurrentInstance().proxy;
select.onOptionCreate(vm);
onBeforeUnmount(() => {
const key = vm.value;
const { selected } = select;
const selectedOptions = select.props.multiple ? selected : [selected];
const doesSelected = selectedOptions.some((item) => {
return item.value === vm.value;
});
nextTick(() => {
if (select.cachedOptions.get(key) === vm && !doesSelected) {
select.cachedOptions.delete(key);
}
});
select.onOptionDestroy(key, vm);
});
function selectOptionClick() {
if (props.disabled !== true && states.groupDisabled !== true) {
select.handleOptionSelect(vm, true);
}
}
return {
ns,
currentLabel,
itemSelected,
isDisabled: isDisabled3,
select,
hoverItem,
visible,
hover,
selectOptionClick,
states
};
}
});
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
return withDirectives((openBlock(), createElementBlock("li", {
class: normalizeClass([
_ctx.ns.be("dropdown", "item"),
_ctx.ns.is("disabled", _ctx.isDisabled),
{
selected: _ctx.itemSelected,
hover: _ctx.hover
}
]),
onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
}, [
renderSlot(_ctx.$slots, "default", {}, () => [
createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
])
], 34)), [
[vShow, _ctx.visible]
]);
}
var Option = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["render", _sfc_render$3], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);
const _sfc_main$6 = defineComponent({
name: "ElSelectDropdown",
componentName: "ElSelectDropdown",
setup() {
const select = inject(selectKey);
const ns = useNamespace("select");
const popperClass = computed$1(() => select.props.popperClass);
const isMultiple = computed$1(() => select.props.multiple);
const isFitInputWidth = computed$1(() => select.props.fitInputWidth);
const minWidth = ref("");
function updateMinWidth() {
var _a2;
minWidth.value = `${(_a2 = select.selectWrapper) == null ? void 0 : _a2.offsetWidth}px`;
}
onMounted(() => {
updateMinWidth();
useResizeObserver(select.selectWrapper, updateMinWidth);
});
return {
ns,
minWidth,
popperClass,
isMultiple,
isFitInputWidth
};
}
});
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", {
class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
}, [
renderSlot(_ctx.$slots, "default")
], 6);
}
var ElSelectMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["render", _sfc_render$2], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]);
function useSelectStates(props) {
const { t: t2 } = useLocale();
return reactive({
options: /* @__PURE__ */ new Map(),
cachedOptions: /* @__PURE__ */ new Map(),
createdLabel: null,
createdSelected: false,
selected: props.multiple ? [] : {},
inputLength: 20,
inputWidth: 0,
optionsCount: 0,
filteredOptionsCount: 0,
visible: false,
softFocus: false,
selectedLabel: "",
hoverIndex: -1,
query: "",
previousQuery: null,
inputHovering: false,
cachedPlaceHolder: "",
currentPlaceholder: t2("el.select.placeholder"),
menuVisibleOnFocus: false,
isOnComposition: false,
isSilentBlur: false,
prefixWidth: 11,
tagInMultiLine: false,
mouseEnter: false
});
}
const useSelect = (props, states, ctx) => {
const { t: t2 } = useLocale();
const ns = useNamespace("select");
useDeprecated({
from: "suffixTransition",
replacement: "override style scheme",
version: "2.3.0",
scope: "props",
ref: "https://element-plus.org/en-US/component/select.html#select-attributes"
}, computed$1(() => props.suffixTransition === false));
const reference = ref(null);
const input = ref(null);
const iOSInput = ref(null);
const tooltipRef = ref(null);
const tags = ref(null);
const selectWrapper = ref(null);
const scrollbar = ref(null);
const hoverOption = ref(-1);
const queryChange = shallowRef({ query: "" });
const groupQueryChange = shallowRef("");
const optionList = ref([]);
let originClientHeight = 0;
const { form, formItem } = useFormItem();
const readonly2 = computed$1(() => !props.filterable || props.multiple || !states.visible);
const selectDisabled = computed$1(() => props.disabled || (form == null ? void 0 : form.disabled));
const showClose = computed$1(() => {
const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
return criteria;
});
const iconComponent = computed$1(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
const iconReverse = computed$1(() => ns.is("reverse", iconComponent.value && states.visible && props.suffixTransition));
const debounce$12 = computed$1(() => props.remote ? 300 : 0);
const emptyText = computed$1(() => {
if (props.loading) {
return props.loadingText || t2("el.select.loading");
} else {
if (props.remote && states.query === "" && states.options.size === 0)
return false;
if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
return props.noMatchText || t2("el.select.noMatch");
}
if (states.options.size === 0) {
return props.noDataText || t2("el.select.noData");
}
}
return null;
});
const optionsArray = computed$1(() => {
const list = Array.from(states.options.values());
const newList = [];
optionList.value.forEach((item) => {
const index2 = list.findIndex((i2) => i2.currentLabel === item);
if (index2 > -1) {
newList.push(list[index2]);
}
});
return newList.length ? newList : list;
});
const cachedOptionsArray = computed$1(() => Array.from(states.cachedOptions.values()));
const showNewOption = computed$1(() => {
const hasExistingOption = optionsArray.value.filter((option) => {
return !option.created;
}).some((option) => {
return option.currentLabel === states.query;
});
return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
});
const selectSize = useFormSize();
const collapseTagSize = computed$1(() => ["small"].includes(selectSize.value) ? "small" : "default");
const dropMenuVisible = computed$1({
get() {
return states.visible && emptyText.value !== false;
},
set(val) {
states.visible = val;
}
});
watch([() => selectDisabled.value, () => selectSize.value, () => form == null ? void 0 : form.size], () => {
nextTick(() => {
resetInputHeight();
});
});
watch(() => props.placeholder, (val) => {
states.cachedPlaceHolder = states.currentPlaceholder = val;
});
watch(() => props.modelValue, (val, oldVal) => {
if (props.multiple) {
resetInputHeight();
if (val && val.length > 0 || input.value && states.query !== "") {
states.currentPlaceholder = "";
} else {
states.currentPlaceholder = states.cachedPlaceHolder;
}
if (props.filterable && !props.reserveKeyword) {
states.query = "";
handleQueryChange(states.query);
}
}
setSelected();
if (props.filterable && !props.multiple) {
states.inputLength = 20;
}
if (!isEqual(val, oldVal) && props.validateEvent) {
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
}
}, {
flush: "post",
deep: true
});
watch(() => states.visible, (val) => {
var _a2, _b, _c, _d, _e;
if (!val) {
if (props.filterable) {
if (isFunction$3(props.filterMethod)) {
props.filterMethod("");
}
if (isFunction$3(props.remoteMethod)) {
props.remoteMethod("");
}
}
input.value && input.value.blur();
states.query = "";
states.previousQuery = null;
states.selectedLabel = "";
states.inputLength = 20;
states.menuVisibleOnFocus = false;
resetHoverIndex();
nextTick(() => {
if (input.value && input.value.value === "" && states.selected.length === 0) {
states.currentPlaceholder = states.cachedPlaceHolder;
}
});
if (!props.multiple) {
if (states.selected) {
if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
states.selectedLabel = states.createdLabel;
} else {
states.selectedLabel = states.selected.currentLabel;
}
if (props.filterable)
states.query = states.selectedLabel;
}
if (props.filterable) {
states.currentPlaceholder = states.cachedPlaceHolder;
}
}
} else {
(_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
if (props.filterable) {
states.filteredOptionsCount = states.optionsCount;
states.query = props.remote ? "" : states.selectedLabel;
(_d = (_c = iOSInput.value) == null ? void 0 : _c.focus) == null ? void 0 : _d.call(_c);
if (props.multiple) {
(_e = input.value) == null ? void 0 : _e.focus();
} else {
if (states.selectedLabel) {
states.currentPlaceholder = `${states.selectedLabel}`;
states.selectedLabel = "";
}
}
handleQueryChange(states.query);
if (!props.multiple && !props.remote) {
queryChange.value.query = "";
triggerRef(queryChange);
triggerRef(groupQueryChange);
}
}
}
ctx.emit("visible-change", val);
});
watch(() => states.options.entries(), () => {
var _a2, _b, _c;
if (!isClient)
return;
(_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
if (props.multiple) {
resetInputHeight();
}
const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
if (!Array.from(inputs).includes(document.activeElement)) {
setSelected();
}
if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
checkDefaultFirstOption();
}
}, {
flush: "post"
});
watch(() => states.hoverIndex, (val) => {
if (isNumber(val) && val > -1) {
hoverOption.value = optionsArray.value[val] || {};
} else {
hoverOption.value = {};
}
optionsArray.value.forEach((option) => {
option.hover = hoverOption.value === option;
});
});
const resetInputHeight = () => {
nextTick(() => {
var _a2, _b;
if (!reference.value)
return;
const input2 = reference.value.$el.querySelector("input");
originClientHeight = originClientHeight || (input2.clientHeight > 0 ? input2.clientHeight + 2 : 0);
const _tags = tags.value;
const gotSize = getComponentSize(selectSize.value || (form == null ? void 0 : form.size));
const sizeInMap = selectSize.value || gotSize === originClientHeight || originClientHeight <= 0 ? gotSize : originClientHeight;
const isElHidden = input2.offsetParent === null;
!isElHidden && (input2.style.height = `${(states.selected.length === 0 ? sizeInMap : Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)) - 2}px`);
states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
if (states.visible && emptyText.value !== false) {
(_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
}
});
};
const handleQueryChange = async (val) => {
if (states.previousQuery === val || states.isOnComposition)
return;
if (states.previousQuery === null && (isFunction$3(props.filterMethod) || isFunction$3(props.remoteMethod))) {
states.previousQuery = val;
return;
}
states.previousQuery = val;
nextTick(() => {
var _a2, _b;
if (states.visible)
(_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
});
states.hoverIndex = -1;
if (props.multiple && props.filterable) {
nextTick(() => {
const length = input.value.value.length * 15 + 20;
states.inputLength = props.collapseTags ? Math.min(50, length) : length;
managePlaceholder();
resetInputHeight();
});
}
if (props.remote && isFunction$3(props.remoteMethod)) {
states.hoverIndex = -1;
props.remoteMethod(val);
} else if (isFunction$3(props.filterMethod)) {
props.filterMethod(val);
triggerRef(groupQueryChange);
} else {
states.filteredOptionsCount = states.optionsCount;
queryChange.value.query = val;
triggerRef(queryChange);
triggerRef(groupQueryChange);
}
if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
await nextTick();
checkDefaultFirstOption();
}
};
const managePlaceholder = () => {
if (states.currentPlaceholder !== "") {
states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
}
};
const checkDefaultFirstOption = () => {
const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
const userCreatedOption = optionsInDropdown.find((n) => n.created);
const firstOriginOption = optionsInDropdown[0];
states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
};
const setSelected = () => {
var _a2;
if (!props.multiple) {
const option = getOption(props.modelValue);
if ((_a2 = option.props) == null ? void 0 : _a2.created) {
states.createdLabel = option.props.value;
states.createdSelected = true;
} else {
states.createdSelected = false;
}
states.selectedLabel = option.currentLabel;
states.selected = option;
if (props.filterable)
states.query = states.selectedLabel;
return;
} else {
states.selectedLabel = "";
}
const result = [];
if (Array.isArray(props.modelValue)) {
props.modelValue.forEach((value) => {
result.push(getOption(value));
});
}
states.selected = result;
nextTick(() => {
resetInputHeight();
});
};
const getOption = (value) => {
let option;
const isObjectValue = toRawType(value).toLowerCase() === "object";
const isNull = toRawType(value).toLowerCase() === "null";
const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
for (let i2 = states.cachedOptions.size - 1; i2 >= 0; i2--) {
const cachedOption = cachedOptionsArray.value[i2];
const isEqualValue = isObjectValue ? get$2(cachedOption.value, props.valueKey) === get$2(value, props.valueKey) : cachedOption.value === value;
if (isEqualValue) {
option = {
value,
currentLabel: cachedOption.currentLabel,
isDisabled: cachedOption.isDisabled
};
break;
}
}
if (option)
return option;
const label = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
const newOption = {
value,
currentLabel: label
};
if (props.multiple) {
newOption.hitState = false;
}
return newOption;
};
const resetHoverIndex = () => {
setTimeout(() => {
const valueKey = props.valueKey;
if (!props.multiple) {
states.hoverIndex = optionsArray.value.findIndex((item) => {
return getValueKey(item) === getValueKey(states.selected);
});
} else {
if (states.selected.length > 0) {
states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
return optionsArray.value.findIndex((item) => {
return get$2(item, valueKey) === get$2(selected, valueKey);
});
}));
} else {
states.hoverIndex = -1;
}
}
}, 300);
};
const handleResize = () => {
var _a2, _b;
resetInputWidth();
(_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
if (props.multiple)
resetInputHeight();
};
const resetInputWidth = () => {
var _a2;
states.inputWidth = (_a2 = reference.value) == null ? void 0 : _a2.$el.offsetWidth;
};
const onInputChange = () => {
if (props.filterable && states.query !== states.selectedLabel) {
states.query = states.selectedLabel;
handleQueryChange(states.query);
}
};
const debouncedOnInputChange = debounce$2(() => {
onInputChange();
}, debounce$12.value);
const debouncedQueryChange = debounce$2((e) => {
handleQueryChange(e.target.value);
}, debounce$12.value);
const emitChange = (val) => {
if (!isEqual(props.modelValue, val)) {
ctx.emit(CHANGE_EVENT, val);
}
};
const deletePrevTag = (e) => {
if (e.code === EVENT_CODE.delete)
return;
if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
const value = props.modelValue.slice();
value.pop();
ctx.emit(UPDATE_MODEL_EVENT, value);
emitChange(value);
}
if (e.target.value.length === 1 && props.modelValue.length === 0) {
states.currentPlaceholder = states.cachedPlaceHolder;
}
};
const deleteTag = (event2, tag) => {
const index2 = states.selected.indexOf(tag);
if (index2 > -1 && !selectDisabled.value) {
const value = props.modelValue.slice();
value.splice(index2, 1);
ctx.emit(UPDATE_MODEL_EVENT, value);
emitChange(value);
ctx.emit("remove-tag", tag.value);
}
event2.stopPropagation();
};
const deleteSelected = (event2) => {
event2.stopPropagation();
const value = props.multiple ? [] : "";
if (!isString(value)) {
for (const item of states.selected) {
if (item.isDisabled)
value.push(item.value);
}
}
ctx.emit(UPDATE_MODEL_EVENT, value);
emitChange(value);
states.hoverIndex = -1;
states.visible = false;
ctx.emit("clear");
};
const handleOptionSelect = (option, byClick) => {
var _a2;
if (props.multiple) {
const value = (props.modelValue || []).slice();
const optionIndex = getValueIndex(value, option.value);
if (optionIndex > -1) {
value.splice(optionIndex, 1);
} else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
value.push(option.value);
}
ctx.emit(UPDATE_MODEL_EVENT, value);
emitChange(value);
if (option.created) {
states.query = "";
handleQueryChange("");
states.inputLength = 20;
}
if (props.filterable)
(_a2 = input.value) == null ? void 0 : _a2.focus();
} else {
ctx.emit(UPDATE_MODEL_EVENT, option.value);
emitChange(option.value);
states.visible = false;
}
states.isSilentBlur = byClick;
setSoftFocus();
if (states.visible)
return;
nextTick(() => {
scrollToOption(option);
});
};
const getValueIndex = (arr = [], value) => {
if (!isObject$5(value))
return arr.indexOf(value);
const valueKey = props.valueKey;
let index2 = -1;
arr.some((item, i2) => {
if (toRaw$1(get$2(item, valueKey)) === get$2(value, valueKey)) {
index2 = i2;
return true;
}
return false;
});
return index2;
};
const setSoftFocus = () => {
states.softFocus = true;
const _input = input.value || reference.value;
if (_input) {
_input == null ? void 0 : _input.focus();
}
};
const scrollToOption = (option) => {
var _a2, _b, _c, _d, _e;
const targetOption = Array.isArray(option) ? option[0] : option;
let target = null;
if (targetOption == null ? void 0 : targetOption.value) {
const options2 = optionsArray.value.filter((item) => item.value === targetOption.value);
if (options2.length > 0) {
target = options2[0].$el;
}
}
if (tooltipRef.value && target) {
const menu = (_d = (_c = (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${ns.be("dropdown", "wrap")}`);
if (menu) {
scrollIntoView(menu, target);
}
}
(_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
};
const onOptionCreate = (vm) => {
states.optionsCount++;
states.filteredOptionsCount++;
states.options.set(vm.value, vm);
states.cachedOptions.set(vm.value, vm);
};
const onOptionDestroy = (key, vm) => {
if (states.options.get(key) === vm) {
states.optionsCount--;
states.filteredOptionsCount--;
states.options.delete(key);
}
};
const resetInputState = (e) => {
if (e.code !== EVENT_CODE.backspace)
toggleLastOptionHitState(false);
states.inputLength = input.value.value.length * 15 + 20;
resetInputHeight();
};
const toggleLastOptionHitState = (hit) => {
if (!Array.isArray(states.selected))
return;
const option = states.selected[states.selected.length - 1];
if (!option)
return;
if (hit === true || hit === false) {
option.hitState = hit;
return hit;
}
option.hitState = !option.hitState;
return option.hitState;
};
const handleComposition = (event2) => {
const text = event2.target.value;
if (event2.type === "compositionend") {
states.isOnComposition = false;
nextTick(() => handleQueryChange(text));
} else {
const lastCharacter = text[text.length - 1] || "";
states.isOnComposition = !isKorean(lastCharacter);
}
};
const handleMenuEnter = () => {
nextTick(() => scrollToOption(states.selected));
};
const handleFocus = (event2) => {
if (!states.softFocus) {
if (props.automaticDropdown || props.filterable) {
if (props.filterable && !states.visible) {
states.menuVisibleOnFocus = true;
}
states.visible = true;
}
ctx.emit("focus", event2);
} else {
states.softFocus = false;
}
};
const blur = () => {
var _a2, _b, _c;
states.visible = false;
(_a2 = reference.value) == null ? void 0 : _a2.blur();
(_c = (_b = iOSInput.value) == null ? void 0 : _b.blur) == null ? void 0 : _c.call(_b);
};
const handleBlur = (event2) => {
nextTick(() => {
if (states.isSilentBlur) {
states.isSilentBlur = false;
} else {
ctx.emit("blur", event2);
}
});
states.softFocus = false;
};
const handleClearClick = (event2) => {
deleteSelected(event2);
};
const handleClose = () => {
states.visible = false;
};
const handleKeydownEscape = (event2) => {
if (states.visible) {
event2.preventDefault();
event2.stopPropagation();
states.visible = false;
}
};
const toggleMenu = (e) => {
var _a2;
if (e && !states.mouseEnter) {
return;
}
if (!selectDisabled.value) {
if (states.menuVisibleOnFocus) {
states.menuVisibleOnFocus = false;
} else {
if (!tooltipRef.value || !tooltipRef.value.isFocusInsideContent()) {
states.visible = !states.visible;
}
}
if (states.visible) {
(_a2 = input.value || reference.value) == null ? void 0 : _a2.focus();
}
}
};
const selectOption = () => {
if (!states.visible) {
toggleMenu();
} else {
if (optionsArray.value[states.hoverIndex]) {
handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
}
}
};
const getValueKey = (item) => {
return isObject$5(item.value) ? get$2(item.value, props.valueKey) : item.value;
};
const optionsAllDisabled = computed$1(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
const showTagList = computed$1(() => states.selected.slice(0, props.maxCollapseTags));
const collapseTagList = computed$1(() => states.selected.slice(props.maxCollapseTags));
const navigateOptions = (direction) => {
if (!states.visible) {
states.visible = true;
return;
}
if (states.options.size === 0 || states.filteredOptionsCount === 0)
return;
if (states.isOnComposition)
return;
if (!optionsAllDisabled.value) {
if (direction === "next") {
states.hoverIndex++;
if (states.hoverIndex === states.options.size) {
states.hoverIndex = 0;
}
} else if (direction === "prev") {
states.hoverIndex--;
if (states.hoverIndex < 0) {
states.hoverIndex = states.options.size - 1;
}
}
const option = optionsArray.value[states.hoverIndex];
if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
navigateOptions(direction);
}
nextTick(() => scrollToOption(hoverOption.value));
}
};
const handleMouseEnter = () => {
states.mouseEnter = true;
};
const handleMouseLeave = () => {
states.mouseEnter = false;
};
return {
optionList,
optionsArray,
selectSize,
handleResize,
debouncedOnInputChange,
debouncedQueryChange,
deletePrevTag,
deleteTag,
deleteSelected,
handleOptionSelect,
scrollToOption,
readonly: readonly2,
resetInputHeight,
showClose,
iconComponent,
iconReverse,
showNewOption,
collapseTagSize,
setSelected,
managePlaceholder,
selectDisabled,
emptyText,
toggleLastOptionHitState,
resetInputState,
handleComposition,
onOptionCreate,
onOptionDestroy,
handleMenuEnter,
handleFocus,
blur,
handleBlur,
handleClearClick,
handleClose,
handleKeydownEscape,
toggleMenu,
selectOption,
getValueKey,
navigateOptions,
dropMenuVisible,
queryChange,
groupQueryChange,
showTagList,
collapseTagList,
reference,
input,
iOSInput,
tooltipRef,
tags,
selectWrapper,
scrollbar,
handleMouseEnter,
handleMouseLeave
};
};
var ElOptions = defineComponent({
name: "ElOptions",
emits: ["update-options"],
setup(_, { slots, emit }) {
let cachedOptions = [];
function isSameOptions(a, b) {
if (a.length !== b.length)
return false;
for (const [index2] of a.entries()) {
if (a[index2] != b[index2]) {
return false;
}
}
return true;
}
return () => {
var _a2, _b;
const children = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
const filteredOptions = [];
function filterOptions(children2) {
if (!Array.isArray(children2))
return;
children2.forEach((item) => {
var _a22, _b2, _c, _d;
const name = (_a22 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a22.name;
if (name === "ElOptionGroup") {
filterOptions(!isString(item.children) && !Array.isArray(item.children) && isFunction$3((_b2 = item.children) == null ? void 0 : _b2.default) ? (_c = item.children) == null ? void 0 : _c.default() : item.children);
} else if (name === "ElOption") {
filteredOptions.push((_d = item.props) == null ? void 0 : _d.label);
} else if (Array.isArray(item.children)) {
filterOptions(item.children);
}
});
}
if (children.length) {
filterOptions((_b = children[0]) == null ? void 0 : _b.children);
}
if (!isSameOptions(filteredOptions, cachedOptions)) {
cachedOptions = filteredOptions;
emit("update-options", filteredOptions);
}
return children;
};
}
});
const COMPONENT_NAME$1 = "ElSelect";
const _sfc_main$5 = defineComponent({
name: COMPONENT_NAME$1,
componentName: COMPONENT_NAME$1,
components: {
ElInput,
ElSelectMenu,
ElOption: Option,
ElOptions,
ElTag,
ElScrollbar,
ElTooltip,
ElIcon
},
directives: { ClickOutside },
props: {
name: String,
id: String,
modelValue: {
type: [Array, String, Number, Boolean, Object],
default: void 0
},
autocomplete: {
type: String,
default: "off"
},
automaticDropdown: Boolean,
size: {
type: String,
validator: isValidComponentSize
},
effect: {
type: String,
default: "light"
},
disabled: Boolean,
clearable: Boolean,
filterable: Boolean,
allowCreate: Boolean,
loading: Boolean,
popperClass: {
type: String,
default: ""
},
popperOptions: {
type: Object,
default: () => ({})
},
remote: Boolean,
loadingText: String,
noMatchText: String,
noDataText: String,
remoteMethod: Function,
filterMethod: Function,
multiple: Boolean,
multipleLimit: {
type: Number,
default: 0
},
placeholder: {
type: String
},
defaultFirstOption: Boolean,
reserveKeyword: {
type: Boolean,
default: true
},
valueKey: {
type: String,
default: "value"
},
collapseTags: Boolean,
collapseTagsTooltip: {
type: Boolean,
default: false
},
maxCollapseTags: {
type: Number,
default: 1
},
teleported: useTooltipContentProps.teleported,
persistent: {
type: Boolean,
default: true
},
clearIcon: {
type: iconPropType,
default: circle_close_default
},
fitInputWidth: {
type: Boolean,
default: false
},
suffixIcon: {
type: iconPropType,
default: arrow_down_default
},
tagType: { ...tagProps.type, default: "info" },
validateEvent: {
type: Boolean,
default: true
},
remoteShowSuffix: {
type: Boolean,
default: false
},
suffixTransition: {
type: Boolean,
default: true
},
placement: {
type: String,
values: Ee,
default: "bottom-start"
}
},
emits: [
UPDATE_MODEL_EVENT,
CHANGE_EVENT,
"remove-tag",
"clear",
"visible-change",
"focus",
"blur"
],
setup(props, ctx) {
const nsSelect = useNamespace("select");
const nsInput = useNamespace("input");
const { t: t2 } = useLocale();
const states = useSelectStates(props);
const {
optionList,
optionsArray,
selectSize,
readonly: readonly2,
handleResize,
collapseTagSize,
debouncedOnInputChange,
debouncedQueryChange,
deletePrevTag,
deleteTag,
deleteSelected,
handleOptionSelect,
scrollToOption,
setSelected,
resetInputHeight,
managePlaceholder,
showClose,
selectDisabled,
iconComponent,
iconReverse,
showNewOption,
emptyText,
toggleLastOptionHitState,
resetInputState,
handleComposition,
onOptionCreate,
onOptionDestroy,
handleMenuEnter,
handleFocus,
blur,
handleBlur,
handleClearClick,
handleClose,
handleKeydownEscape,
toggleMenu,
selectOption,
getValueKey,
navigateOptions,
dropMenuVisible,
reference,
input,
iOSInput,
tooltipRef,
tags,
selectWrapper,
scrollbar,
queryChange,
groupQueryChange,
handleMouseEnter,
handleMouseLeave,
showTagList,
collapseTagList
} = useSelect(props, states, ctx);
const { focus } = useFocus(reference);
const {
inputWidth,
selected,
inputLength,
filteredOptionsCount,
visible,
softFocus,
selectedLabel,
hoverIndex,
query,
inputHovering,
currentPlaceholder,
menuVisibleOnFocus,
isOnComposition,
isSilentBlur,
options: options2,
cachedOptions,
optionsCount,
prefixWidth,
tagInMultiLine
} = toRefs(states);
const wrapperKls = computed$1(() => {
const classList = [nsSelect.b()];
const _selectSize = unref(selectSize);
if (_selectSize) {
classList.push(nsSelect.m(_selectSize));
}
if (props.disabled) {
classList.push(nsSelect.m("disabled"));
}
return classList;
});
const selectTagsStyle = computed$1(() => ({
maxWidth: `${unref(inputWidth) - 32}px`,
width: "100%"
}));
const tagTextStyle = computed$1(() => {
const maxWidth = unref(inputWidth) > 123 ? unref(inputWidth) - 123 : unref(inputWidth) - 75;
return { maxWidth: `${maxWidth}px` };
});
provide(selectKey, reactive({
props,
options: options2,
optionsArray,
cachedOptions,
optionsCount,
filteredOptionsCount,
hoverIndex,
handleOptionSelect,
onOptionCreate,
onOptionDestroy,
selectWrapper,
selected,
setSelected,
queryChange,
groupQueryChange
}));
onMounted(() => {
states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || (() => t2("el.select.placeholder"));
if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
currentPlaceholder.value = "";
}
useResizeObserver(selectWrapper, handleResize);
if (props.remote && props.multiple) {
resetInputHeight();
}
nextTick(() => {
const refEl = reference.value && reference.value.$el;
if (!refEl)
return;
inputWidth.value = refEl.getBoundingClientRect().width;
if (ctx.slots.prefix) {
const prefix = refEl.querySelector(`.${nsInput.e("prefix")}`);
prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
}
});
setSelected();
});
if (props.multiple && !Array.isArray(props.modelValue)) {
ctx.emit(UPDATE_MODEL_EVENT, []);
}
if (!props.multiple && Array.isArray(props.modelValue)) {
ctx.emit(UPDATE_MODEL_EVENT, "");
}
const popperPaneRef = computed$1(() => {
var _a2, _b;
return (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef;
});
const onOptionsRendered = (v) => {
optionList.value = v;
};
return {
isIOS,
onOptionsRendered,
tagInMultiLine,
prefixWidth,
selectSize,
readonly: readonly2,
handleResize,
collapseTagSize,
debouncedOnInputChange,
debouncedQueryChange,
deletePrevTag,
deleteTag,
deleteSelected,
handleOptionSelect,
scrollToOption,
inputWidth,
selected,
inputLength,
filteredOptionsCount,
visible,
softFocus,
selectedLabel,
hoverIndex,
query,
inputHovering,
currentPlaceholder,
menuVisibleOnFocus,
isOnComposition,
isSilentBlur,
options: options2,
resetInputHeight,
managePlaceholder,
showClose,
selectDisabled,
iconComponent,
iconReverse,
showNewOption,
emptyText,
toggleLastOptionHitState,
resetInputState,
handleComposition,
handleMenuEnter,
handleFocus,
blur,
handleBlur,
handleClearClick,
handleClose,
handleKeydownEscape,
toggleMenu,
selectOption,
getValueKey,
navigateOptions,
dropMenuVisible,
focus,
reference,
input,
iOSInput,
tooltipRef,
popperPaneRef,
tags,
selectWrapper,
scrollbar,
wrapperKls,
selectTagsStyle,
nsSelect,
tagTextStyle,
handleMouseEnter,
handleMouseLeave,
showTagList,
collapseTagList
};
}
});
const _hoisted_1$4 = ["disabled", "autocomplete"];
const _hoisted_2$4 = ["disabled"];
const _hoisted_3$4 = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
const _component_el_tag = resolveComponent("el-tag");
const _component_el_tooltip = resolveComponent("el-tooltip");
const _component_el_icon = resolveComponent("el-icon");
const _component_el_input = resolveComponent("el-input");
const _component_el_option = resolveComponent("el-option");
const _component_el_options = resolveComponent("el-options");
const _component_el_scrollbar = resolveComponent("el-scrollbar");
const _component_el_select_menu = resolveComponent("el-select-menu");
const _directive_click_outside = resolveDirective("click-outside");
return withDirectives((openBlock(), createElementBlock("div", {
ref: "selectWrapper",
class: normalizeClass(_ctx.wrapperKls),
onMouseenter: _cache[21] || (_cache[21] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
onMouseleave: _cache[22] || (_cache[22] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
onClick: _cache[23] || (_cache[23] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
}, [
createVNode(_component_el_tooltip, {
ref: "tooltipRef",
visible: _ctx.dropMenuVisible,
placement: _ctx.placement,
teleported: _ctx.teleported,
"popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
"popper-options": _ctx.popperOptions,
"fallback-placements": ["bottom-start", "top-start", "right", "left"],
effect: _ctx.effect,
pure: "",
trigger: "click",
transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
"stop-popper-mouse-event": false,
"gpu-acceleration": false,
persistent: _ctx.persistent,
onShow: _ctx.handleMenuEnter
}, {
default: withCtx(() => [
createElementVNode("div", {
class: "select-trigger",
onMouseenter: _cache[19] || (_cache[19] = ($event) => _ctx.inputHovering = true),
onMouseleave: _cache[20] || (_cache[20] = ($event) => _ctx.inputHovering = false)
}, [
_ctx.multiple ? (openBlock(), createElementBlock("div", {
key: 0,
ref: "tags",
class: normalizeClass([
_ctx.nsSelect.e("tags"),
_ctx.nsSelect.is("disabled", _ctx.selectDisabled)
]),
style: normalizeStyle(_ctx.selectTagsStyle)
}, [
_ctx.collapseTags && _ctx.selected.length ? (openBlock(), createBlock(Transition, {
key: 0,
onAfterLeave: _ctx.resetInputHeight
}, {
default: withCtx(() => [
createElementVNode("span", {
class: normalizeClass([
_ctx.nsSelect.b("tags-wrapper"),
{ "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
])
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
return openBlock(), createBlock(_component_el_tag, {
key: _ctx.getValueKey(item),
closable: !_ctx.selectDisabled && !item.isDisabled,
size: _ctx.collapseTagSize,
hit: item.hitState,
type: _ctx.tagType,
"disable-transitions": "",
onClose: ($event) => _ctx.deleteTag($event, item)
}, {
default: withCtx(() => [
createElementVNode("span", {
class: normalizeClass(_ctx.nsSelect.e("tags-text")),
style: normalizeStyle(_ctx.tagTextStyle)
}, toDisplayString(item.currentLabel), 7)
]),
_: 2
}, 1032, ["closable", "size", "hit", "type", "onClose"]);
}), 128)),
_ctx.selected.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tag, {
key: 0,
closable: false,
size: _ctx.collapseTagSize,
type: _ctx.tagType,
"disable-transitions": ""
}, {
default: withCtx(() => [
_ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
key: 0,
disabled: _ctx.dropMenuVisible,
"fallback-placements": ["bottom", "top", "right", "left"],
effect: _ctx.effect,
placement: "bottom",
teleported: _ctx.teleported
}, {
default: withCtx(() => [
createElementVNode("span", {
class: normalizeClass(_ctx.nsSelect.e("tags-text"))
}, "+ " + toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3)
]),
content: withCtx(() => [
createElementVNode("div", {
class: normalizeClass(_ctx.nsSelect.e("collapse-tags"))
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (item) => {
return openBlock(), createElementBlock("div", {
key: _ctx.getValueKey(item),
class: normalizeClass(_ctx.nsSelect.e("collapse-tag"))
}, [
createVNode(_component_el_tag, {
class: "in-tooltip",
closable: !_ctx.selectDisabled && !item.isDisabled,
size: _ctx.collapseTagSize,
hit: item.hitState,
type: _ctx.tagType,
"disable-transitions": "",
style: { margin: "2px" },
onClose: ($event) => _ctx.deleteTag($event, item)
}, {
default: withCtx(() => [
createElementVNode("span", {
class: normalizeClass(_ctx.nsSelect.e("tags-text")),
style: normalizeStyle({
maxWidth: _ctx.inputWidth - 75 + "px"
})
}, toDisplayString(item.currentLabel), 7)
]),
_: 2
}, 1032, ["closable", "size", "hit", "type", "onClose"])
], 2);
}), 128))
], 2)
]),
_: 1
}, 8, ["disabled", "effect", "teleported"])) : (openBlock(), createElementBlock("span", {
key: 1,
class: normalizeClass(_ctx.nsSelect.e("tags-text"))
}, "+ " + toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3))
]),
_: 1
}, 8, ["size", "type"])) : createCommentVNode("v-if", true)
], 2)
]),
_: 1
}, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
!_ctx.collapseTags ? (openBlock(), createBlock(Transition, {
key: 1,
onAfterLeave: _ctx.resetInputHeight
}, {
default: withCtx(() => [
createElementVNode("span", {
class: normalizeClass([
_ctx.nsSelect.b("tags-wrapper"),
{ "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
])
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item) => {
return openBlock(), createBlock(_component_el_tag, {
key: _ctx.getValueKey(item),
closable: !_ctx.selectDisabled && !item.isDisabled,
size: _ctx.collapseTagSize,
hit: item.hitState,
type: _ctx.tagType,
"disable-transitions": "",
onClose: ($event) => _ctx.deleteTag($event, item)
}, {
default: withCtx(() => [
createElementVNode("span", {
class: normalizeClass(_ctx.nsSelect.e("tags-text")),
style: normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
}, toDisplayString(item.currentLabel), 7)
]),
_: 2
}, 1032, ["closable", "size", "hit", "type", "onClose"]);
}), 128))
], 2)
]),
_: 1
}, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
_ctx.filterable ? withDirectives((openBlock(), createElementBlock("input", {
key: 2,
ref: "input",
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.query = $event),
type: "text",
class: normalizeClass([
_ctx.nsSelect.e("input"),
_ctx.nsSelect.is(_ctx.selectSize),
_ctx.nsSelect.is("disabled", _ctx.selectDisabled)
]),
disabled: _ctx.selectDisabled,
autocomplete: _ctx.autocomplete,
style: normalizeStyle({
marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
flexGrow: 1,
width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
maxWidth: `${_ctx.inputWidth - 42}px`
}),
onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
onKeyup: _cache[3] || (_cache[3] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
onKeydown: [
_cache[4] || (_cache[4] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
_cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
_cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
_cache[7] || (_cache[7] = withKeys((...args) => _ctx.handleKeydownEscape && _ctx.handleKeydownEscape(...args), ["esc"])),
_cache[8] || (_cache[8] = withKeys(withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
_cache[9] || (_cache[9] = withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
_cache[10] || (_cache[10] = withKeys(($event) => _ctx.visible = false, ["tab"]))
],
onCompositionstart: _cache[11] || (_cache[11] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
onCompositionupdate: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
onCompositionend: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
onInput: _cache[14] || (_cache[14] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
}, null, 46, _hoisted_1$4)), [
[vModelText, _ctx.query]
]) : createCommentVNode("v-if", true)
], 6)) : createCommentVNode("v-if", true),
createCommentVNode(" fix: https://github.com/element-plus/element-plus/issues/11415 "),
_ctx.isIOS && !_ctx.multiple && _ctx.filterable && _ctx.readonly ? (openBlock(), createElementBlock("input", {
key: 1,
ref: "iOSInput",
class: normalizeClass([
_ctx.nsSelect.e("input"),
_ctx.nsSelect.is(_ctx.selectSize),
_ctx.nsSelect.em("input", "iOS")
]),
disabled: _ctx.selectDisabled,
type: "text"
}, null, 10, _hoisted_2$4)) : createCommentVNode("v-if", true),
createVNode(_component_el_input, {
id: _ctx.id,
ref: "reference",
modelValue: _ctx.selectedLabel,
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.selectedLabel = $event),
type: "text",
placeholder: typeof _ctx.currentPlaceholder === "function" ? _ctx.currentPlaceholder() : _ctx.currentPlaceholder,
name: _ctx.name,
autocomplete: _ctx.autocomplete,
size: _ctx.selectSize,
disabled: _ctx.selectDisabled,
readonly: _ctx.readonly,
"validate-event": false,
class: normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
onFocus: _ctx.handleFocus,
onBlur: _ctx.handleBlur,
onInput: _ctx.debouncedOnInputChange,
onPaste: _ctx.debouncedOnInputChange,
onCompositionstart: _ctx.handleComposition,
onCompositionupdate: _ctx.handleComposition,
onCompositionend: _ctx.handleComposition,
onKeydown: [
_cache[16] || (_cache[16] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
_cache[17] || (_cache[17] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
withKeys(_ctx.handleKeydownEscape, ["esc"]),
_cache[18] || (_cache[18] = withKeys(($event) => _ctx.visible = false, ["tab"]))
]
}, createSlots({
suffix: withCtx(() => [
_ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
key: 0,
class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true),
_ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
key: 1,
class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
onClick: _ctx.handleClearClick
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
]),
_: 1
}, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
]),
_: 2
}, [
_ctx.$slots.prefix ? {
name: "prefix",
fn: withCtx(() => [
createElementVNode("div", _hoisted_3$4, [
renderSlot(_ctx.$slots, "prefix")
])
])
} : void 0
]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
], 32)
]),
content: withCtx(() => [
createVNode(_component_el_select_menu, null, {
default: withCtx(() => [
withDirectives(createVNode(_component_el_scrollbar, {
ref: "scrollbar",
tag: "ul",
"wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
"view-class": _ctx.nsSelect.be("dropdown", "list"),
class: normalizeClass([
_ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
])
}, {
default: withCtx(() => [
_ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
key: 0,
value: _ctx.query,
created: true
}, null, 8, ["value"])) : createCommentVNode("v-if", true),
createVNode(_component_el_options, { onUpdateOptions: _ctx.onOptionsRendered }, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 8, ["onUpdateOptions"])
]),
_: 3
}, 8, ["wrap-class", "view-class", "class"]), [
[vShow, _ctx.options.size > 0 && !_ctx.loading]
]),
_ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
_ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : (openBlock(), createElementBlock("p", {
key: 1,
class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
}, toDisplayString(_ctx.emptyText), 3))
], 64)) : createCommentVNode("v-if", true)
]),
_: 3
})
]),
_: 3
}, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "effect", "transition", "persistent", "onShow"])
], 34)), [
[_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
]);
}
var Select = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["render", _sfc_render$1], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);
const _sfc_main$4 = defineComponent({
name: "ElOptionGroup",
componentName: "ElOptionGroup",
props: {
label: String,
disabled: {
type: Boolean,
default: false
}
},
setup(props) {
const ns = useNamespace("select");
const visible = ref(true);
const instance = getCurrentInstance();
const children = ref([]);
provide(selectGroupKey, reactive({
...toRefs(props)
}));
const select = inject(selectKey);
onMounted(() => {
children.value = flattedChildren(instance.subTree);
});
const flattedChildren = (node) => {
const children2 = [];
if (Array.isArray(node.children)) {
node.children.forEach((child) => {
var _a2;
if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
children2.push(child.component.proxy);
} else if ((_a2 = child.children) == null ? void 0 : _a2.length) {
children2.push(...flattedChildren(child));
}
});
}
return children2;
};
const { groupQueryChange } = toRaw$1(select);
watch(groupQueryChange, () => {
visible.value = children.value.some((option) => option.visible === true);
}, { flush: "post" });
return {
visible,
ns
};
}
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return withDirectives((openBlock(), createElementBlock("ul", {
class: normalizeClass(_ctx.ns.be("group", "wrap"))
}, [
createElementVNode("li", {
class: normalizeClass(_ctx.ns.be("group", "title"))
}, toDisplayString(_ctx.label), 3),
createElementVNode("li", null, [
createElementVNode("ul", {
class: normalizeClass(_ctx.ns.b("group"))
}, [
renderSlot(_ctx.$slots, "default")
], 2)
])
], 2)), [
[vShow, _ctx.visible]
]);
}
var OptionGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["render", _sfc_render], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);
const ElSelect = withInstall(Select, {
Option,
OptionGroup
});
const ElOption = withNoopInstall(Option);
withNoopInstall(OptionGroup);
const switchProps = buildProps({
modelValue: {
type: [Boolean, String, Number],
default: false
},
value: {
type: [Boolean, String, Number],
default: false
},
disabled: {
type: Boolean,
default: false
},
width: {
type: [String, Number],
default: ""
},
inlinePrompt: {
type: Boolean,
default: false
},
activeIcon: {
type: iconPropType
},
inactiveIcon: {
type: iconPropType
},
activeText: {
type: String,
default: ""
},
inactiveText: {
type: String,
default: ""
},
activeColor: {
type: String,
default: ""
},
inactiveColor: {
type: String,
default: ""
},
borderColor: {
type: String,
default: ""
},
activeValue: {
type: [Boolean, String, Number],
default: true
},
inactiveValue: {
type: [Boolean, String, Number],
default: false
},
name: {
type: String,
default: ""
},
validateEvent: {
type: Boolean,
default: true
},
id: String,
loading: {
type: Boolean,
default: false
},
beforeChange: {
type: definePropType(Function)
},
size: {
type: String,
validator: isValidComponentSize
},
tabindex: {
type: [String, Number]
}
});
const switchEmits = {
[UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
[CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
[INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
};
const _hoisted_1$3 = ["onClick"];
const _hoisted_2$3 = ["id", "aria-checked", "aria-disabled", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"];
const _hoisted_3$3 = ["aria-hidden"];
const _hoisted_4$3 = ["aria-hidden"];
const _hoisted_5$3 = ["aria-hidden"];
const COMPONENT_NAME = "ElSwitch";
const __default__ = defineComponent({
name: COMPONENT_NAME
});
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
...__default__,
props: switchProps,
emits: switchEmits,
setup(__props, { expose, emit }) {
const props = __props;
const vm = getCurrentInstance();
const { formItem } = useFormItem();
const switchSize = useFormSize();
const ns = useNamespace("switch");
useDeprecated({
from: '"value"',
replacement: '"model-value" or "v-model"',
scope: COMPONENT_NAME,
version: "2.3.0",
ref: "https://element-plus.org/en-US/component/switch.html#attributes",
type: "Attribute"
}, computed$1(() => {
var _a2;
return !!((_a2 = vm.vnode.props) == null ? void 0 : _a2.value);
}));
const { inputId } = useFormItemInputId(props, {
formItemContext: formItem
});
const switchDisabled = useFormDisabled(computed$1(() => props.loading));
const isControlled = ref(props.modelValue !== false);
const input = ref();
const core = ref();
const switchKls = computed$1(() => [
ns.b(),
ns.m(switchSize.value),
ns.is("disabled", switchDisabled.value),
ns.is("checked", checked.value)
]);
const coreStyle = computed$1(() => ({
width: addUnit(props.width)
}));
watch(() => props.modelValue, () => {
isControlled.value = true;
});
watch(() => props.value, () => {
isControlled.value = false;
});
const actualValue = computed$1(() => {
return isControlled.value ? props.modelValue : props.value;
});
const checked = computed$1(() => actualValue.value === props.activeValue);
if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
emit(UPDATE_MODEL_EVENT, props.inactiveValue);
emit(CHANGE_EVENT, props.inactiveValue);
emit(INPUT_EVENT, props.inactiveValue);
}
watch(checked, (val) => {
var _a2;
input.value.checked = val;
if (props.validateEvent) {
(_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
}
});
const handleChange = () => {
const val = checked.value ? props.inactiveValue : props.activeValue;
emit(UPDATE_MODEL_EVENT, val);
emit(CHANGE_EVENT, val);
emit(INPUT_EVENT, val);
nextTick(() => {
input.value.checked = checked.value;
});
};
const switchValue = () => {
if (switchDisabled.value)
return;
const { beforeChange } = props;
if (!beforeChange) {
handleChange();
return;
}
const shouldChange = beforeChange();
const isPromiseOrBool = [
isPromise$2(shouldChange),
isBoolean(shouldChange)
].includes(true);
if (!isPromiseOrBool) {
throwError(COMPONENT_NAME, "beforeChange must return type `Promise` or `boolean`");
}
if (isPromise$2(shouldChange)) {
shouldChange.then((result) => {
if (result) {
handleChange();
}
}).catch((e) => {
});
} else if (shouldChange) {
handleChange();
}
};
const styles = computed$1(() => {
return ns.cssVarBlock({
...props.activeColor ? { "on-color": props.activeColor } : null,
...props.inactiveColor ? { "off-color": props.inactiveColor } : null,
...props.borderColor ? { "border-color": props.borderColor } : null
});
});
const focus = () => {
var _a2, _b;
(_b = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
};
onMounted(() => {
input.value.checked = checked.value;
});
expose({
focus,
checked
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(unref(switchKls)),
style: normalizeStyle(unref(styles)),
onClick: withModifiers(switchValue, ["prevent"])
}, [
createElementVNode("input", {
id: unref(inputId),
ref_key: "input",
ref: input,
class: normalizeClass(unref(ns).e("input")),
type: "checkbox",
role: "switch",
"aria-checked": unref(checked),
"aria-disabled": unref(switchDisabled),
name: _ctx.name,
"true-value": _ctx.activeValue,
"false-value": _ctx.inactiveValue,
disabled: unref(switchDisabled),
tabindex: _ctx.tabindex,
onChange: handleChange,
onKeydown: withKeys(switchValue, ["enter"])
}, null, 42, _hoisted_2$3),
!_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass([
unref(ns).e("label"),
unref(ns).em("label", "left"),
unref(ns).is("active", !unref(checked))
])
}, [
_ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
]),
_: 1
})) : createCommentVNode("v-if", true),
!_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
key: 1,
"aria-hidden": unref(checked)
}, toDisplayString(_ctx.inactiveText), 9, _hoisted_3$3)) : createCommentVNode("v-if", true)
], 2)) : createCommentVNode("v-if", true),
createElementVNode("span", {
ref_key: "core",
ref: core,
class: normalizeClass(unref(ns).e("core")),
style: normalizeStyle(unref(coreStyle))
}, [
_ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(ns).e("inner"))
}, [
_ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(ns).is("icon"))
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
]),
_: 1
}, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
key: 1,
class: normalizeClass(unref(ns).is("text")),
"aria-hidden": !unref(checked)
}, toDisplayString(unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, _hoisted_4$3)) : createCommentVNode("v-if", true)
], 2)) : createCommentVNode("v-if", true),
createElementVNode("div", {
class: normalizeClass(unref(ns).e("action"))
}, [
_ctx.loading ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(ns).is("loading"))
}, {
default: withCtx(() => [
createVNode(unref(loading_default))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)
], 2)
], 6),
!_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
key: 1,
class: normalizeClass([
unref(ns).e("label"),
unref(ns).em("label", "right"),
unref(ns).is("active", unref(checked))
])
}, [
_ctx.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
]),
_: 1
})) : createCommentVNode("v-if", true),
!_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
key: 1,
"aria-hidden": !unref(checked)
}, toDisplayString(_ctx.activeText), 9, _hoisted_5$3)) : createCommentVNode("v-if", true)
], 2)) : createCommentVNode("v-if", true)
], 14, _hoisted_1$3);
};
}
});
var Switch = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/switch/src/switch.vue"]]);
const ElSwitch = withInstall(Switch);
/*! Element Plus v2.3.4 */
var zhCn = {
name: "zh-cn",
el: {
colorpicker: {
confirm: "\u786E\u5B9A",
clear: "\u6E05\u7A7A"
},
datepicker: {
now: "\u6B64\u523B",
today: "\u4ECA\u5929",
cancel: "\u53D6\u6D88",
clear: "\u6E05\u7A7A",
confirm: "\u786E\u5B9A",
selectDate: "\u9009\u62E9\u65E5\u671F",
selectTime: "\u9009\u62E9\u65F6\u95F4",
startDate: "\u5F00\u59CB\u65E5\u671F",
startTime: "\u5F00\u59CB\u65F6\u95F4",
endDate: "\u7ED3\u675F\u65E5\u671F",
endTime: "\u7ED3\u675F\u65F6\u95F4",
prevYear: "\u524D\u4E00\u5E74",
nextYear: "\u540E\u4E00\u5E74",
prevMonth: "\u4E0A\u4E2A\u6708",
nextMonth: "\u4E0B\u4E2A\u6708",
year: "\u5E74",
month1: "1 \u6708",
month2: "2 \u6708",
month3: "3 \u6708",
month4: "4 \u6708",
month5: "5 \u6708",
month6: "6 \u6708",
month7: "7 \u6708",
month8: "8 \u6708",
month9: "9 \u6708",
month10: "10 \u6708",
month11: "11 \u6708",
month12: "12 \u6708",
weeks: {
sun: "\u65E5",
mon: "\u4E00",
tue: "\u4E8C",
wed: "\u4E09",
thu: "\u56DB",
fri: "\u4E94",
sat: "\u516D"
},
months: {
jan: "\u4E00\u6708",
feb: "\u4E8C\u6708",
mar: "\u4E09\u6708",
apr: "\u56DB\u6708",
may: "\u4E94\u6708",
jun: "\u516D\u6708",
jul: "\u4E03\u6708",
aug: "\u516B\u6708",
sep: "\u4E5D\u6708",
oct: "\u5341\u6708",
nov: "\u5341\u4E00\u6708",
dec: "\u5341\u4E8C\u6708"
}
},
select: {
loading: "\u52A0\u8F7D\u4E2D",
noMatch: "\u65E0\u5339\u914D\u6570\u636E",
noData: "\u65E0\u6570\u636E",
placeholder: "\u8BF7\u9009\u62E9"
},
cascader: {
noMatch: "\u65E0\u5339\u914D\u6570\u636E",
loading: "\u52A0\u8F7D\u4E2D",
placeholder: "\u8BF7\u9009\u62E9",
noData: "\u6682\u65E0\u6570\u636E"
},
pagination: {
goto: "\u524D\u5F80",
pagesize: "\u6761/\u9875",
total: "\u5171 {total} \u6761",
pageClassifier: "\u9875",
page: "\u9875",
prev: "\u4E0A\u4E00\u9875",
next: "\u4E0B\u4E00\u9875",
currentPage: "\u7B2C {pager} \u9875",
prevPages: "\u5411\u524D {pager} \u9875",
nextPages: "\u5411\u540E {pager} \u9875",
deprecationWarning: "\u4F60\u4F7F\u7528\u4E86\u4E00\u4E9B\u5DF2\u88AB\u5E9F\u5F03\u7684\u7528\u6CD5\uFF0C\u8BF7\u53C2\u8003 el-pagination \u7684\u5B98\u65B9\u6587\u6863"
},
messagebox: {
title: "\u63D0\u793A",
confirm: "\u786E\u5B9A",
cancel: "\u53D6\u6D88",
error: "\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!"
},
upload: {
deleteTip: "\u6309 delete \u952E\u53EF\u5220\u9664",
delete: "\u5220\u9664",
preview: "\u67E5\u770B\u56FE\u7247",
continue: "\u7EE7\u7EED\u4E0A\u4F20"
},
table: {
emptyText: "\u6682\u65E0\u6570\u636E",
confirmFilter: "\u7B5B\u9009",
resetFilter: "\u91CD\u7F6E",
clearFilter: "\u5168\u90E8",
sumText: "\u5408\u8BA1"
},
tree: {
emptyText: "\u6682\u65E0\u6570\u636E"
},
transfer: {
noMatch: "\u65E0\u5339\u914D\u6570\u636E",
noData: "\u65E0\u6570\u636E",
titles: ["\u5217\u8868 1", "\u5217\u8868 2"],
filterPlaceholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",
noCheckedFormat: "\u5171 {total} \u9879",
hasCheckedFormat: "\u5DF2\u9009 {checked}/{total} \u9879"
},
image: {
error: "\u52A0\u8F7D\u5931\u8D25"
},
pageHeader: {
title: "\u8FD4\u56DE"
},
popconfirm: {
confirmButtonText: "\u786E\u5B9A",
cancelButtonText: "\u53D6\u6D88"
}
}
};
/*! Element Plus v2.3.4 */
var en = {
name: "en",
el: {
colorpicker: {
confirm: "OK",
clear: "Clear",
defaultLabel: "color picker",
description: "current color is {color}. press enter to select a new color."
},
datepicker: {
now: "Now",
today: "Today",
cancel: "Cancel",
clear: "Clear",
confirm: "OK",
dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
monthTablePrompt: "Use the arrow keys and enter to select the month",
yearTablePrompt: "Use the arrow keys and enter to select the year",
selectedDate: "Selected date",
selectDate: "Select date",
selectTime: "Select time",
startDate: "Start Date",
startTime: "Start Time",
endDate: "End Date",
endTime: "End Time",
prevYear: "Previous Year",
nextYear: "Next Year",
prevMonth: "Previous Month",
nextMonth: "Next Month",
year: "",
month1: "January",
month2: "February",
month3: "March",
month4: "April",
month5: "May",
month6: "June",
month7: "July",
month8: "August",
month9: "September",
month10: "October",
month11: "November",
month12: "December",
week: "week",
weeks: {
sun: "Sun",
mon: "Mon",
tue: "Tue",
wed: "Wed",
thu: "Thu",
fri: "Fri",
sat: "Sat"
},
weeksFull: {
sun: "Sunday",
mon: "Monday",
tue: "Tuesday",
wed: "Wednesday",
thu: "Thursday",
fri: "Friday",
sat: "Saturday"
},
months: {
jan: "Jan",
feb: "Feb",
mar: "Mar",
apr: "Apr",
may: "May",
jun: "Jun",
jul: "Jul",
aug: "Aug",
sep: "Sep",
oct: "Oct",
nov: "Nov",
dec: "Dec"
}
},
inputNumber: {
decrease: "decrease number",
increase: "increase number"
},
select: {
loading: "Loading",
noMatch: "No matching data",
noData: "No data",
placeholder: "Select"
},
dropdown: {
toggleDropdown: "Toggle Dropdown"
},
cascader: {
noMatch: "No matching data",
loading: "Loading",
placeholder: "Select",
noData: "No data"
},
pagination: {
goto: "Go to",
pagesize: "/page",
total: "Total {total}",
pageClassifier: "",
page: "Page",
prev: "Go to previous page",
next: "Go to next page",
currentPage: "page {pager}",
prevPages: "Previous {pager} pages",
nextPages: "Next {pager} pages",
deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
},
dialog: {
close: "Close this dialog"
},
drawer: {
close: "Close this dialog"
},
messagebox: {
title: "Message",
confirm: "OK",
cancel: "Cancel",
error: "Illegal input",
close: "Close this dialog"
},
upload: {
deleteTip: "press delete to remove",
delete: "Delete",
preview: "Preview",
continue: "Continue"
},
slider: {
defaultLabel: "slider between {min} and {max}",
defaultRangeStartLabel: "pick start value",
defaultRangeEndLabel: "pick end value"
},
table: {
emptyText: "No Data",
confirmFilter: "Confirm",
resetFilter: "Reset",
clearFilter: "All",
sumText: "Sum"
},
tree: {
emptyText: "No Data"
},
transfer: {
noMatch: "No matching data",
noData: "No data",
titles: ["List 1", "List 2"],
filterPlaceholder: "Enter keyword",
noCheckedFormat: "{total} items",
hasCheckedFormat: "{checked}/{total} checked"
},
image: {
error: "FAILED"
},
pageHeader: {
title: "Back"
},
popconfirm: {
confirmButtonText: "Yes",
cancelButtonText: "No"
}
}
};
var jquery = { exports: {} };
/*!
* jQuery JavaScript Library v3.7.0
* https://jquery.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2023-05-11T18:29Z
*/
(function(module2) {
(function(global2, factory3) {
{
module2.exports = global2.document ? factory3(global2, true) : function(w) {
if (!w.document) {
throw new Error("jQuery requires a window with a document");
}
return factory3(w);
};
}
})(typeof window !== "undefined" ? window : commonjsGlobal, function(window2, noGlobal) {
var arr = [];
var getProto = Object.getPrototypeOf;
var slice = arr.slice;
var flat2 = arr.flat ? function(array) {
return arr.flat.call(array);
} : function(array) {
return arr.concat.apply([], array);
};
var push = arr.push;
var indexOf = arr.indexOf;
var class2type = {};
var toString2 = class2type.toString;
var hasOwn2 = class2type.hasOwnProperty;
var fnToString = hasOwn2.toString;
var ObjectFunctionString = fnToString.call(Object);
var support = {};
var isFunction2 = function isFunction3(obj) {
return typeof obj === "function" && typeof obj.nodeType !== "number" && typeof obj.item !== "function";
};
var isWindow = function isWindow2(obj) {
return obj != null && obj === obj.window;
};
var document2 = window2.document;
var preservedScriptAttributes = {
type: true,
src: true,
nonce: true,
noModule: true
};
function DOMEval(code, node, doc) {
doc = doc || document2;
var i2, val, script = doc.createElement("script");
script.text = code;
if (node) {
for (i2 in preservedScriptAttributes) {
val = node[i2] || node.getAttribute && node.getAttribute(i2);
if (val) {
script.setAttribute(i2, val);
}
}
}
doc.head.appendChild(script).parentNode.removeChild(script);
}
function toType(obj) {
if (obj == null) {
return obj + "";
}
return typeof obj === "object" || typeof obj === "function" ? class2type[toString2.call(obj)] || "object" : typeof obj;
}
var version2 = "3.7.0", rhtmlSuffix = /HTML$/i, jQuery = function(selector, context) {
return new jQuery.fn.init(selector, context);
};
jQuery.fn = jQuery.prototype = {
jquery: version2,
constructor: jQuery,
length: 0,
toArray: function() {
return slice.call(this);
},
get: function(num) {
if (num == null) {
return slice.call(this);
}
return num < 0 ? this[num + this.length] : this[num];
},
pushStack: function(elems) {
var ret = jQuery.merge(this.constructor(), elems);
ret.prevObject = this;
return ret;
},
each: function(callback2) {
return jQuery.each(this, callback2);
},
map: function(callback2) {
return this.pushStack(jQuery.map(this, function(elem, i2) {
return callback2.call(elem, i2, elem);
}));
},
slice: function() {
return this.pushStack(slice.apply(this, arguments));
},
first: function() {
return this.eq(0);
},
last: function() {
return this.eq(-1);
},
even: function() {
return this.pushStack(jQuery.grep(this, function(_elem, i2) {
return (i2 + 1) % 2;
}));
},
odd: function() {
return this.pushStack(jQuery.grep(this, function(_elem, i2) {
return i2 % 2;
}));
},
eq: function(i2) {
var len = this.length, j = +i2 + (i2 < 0 ? len : 0);
return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
},
end: function() {
return this.prevObject || this.constructor();
},
push,
sort: arr.sort,
splice: arr.splice
};
jQuery.extend = jQuery.fn.extend = function() {
var options2, name, src, copy2, copyIsArray, clone, target = arguments[0] || {}, i2 = 1, length = arguments.length, deep = false;
if (typeof target === "boolean") {
deep = target;
target = arguments[i2] || {};
i2++;
}
if (typeof target !== "object" && !isFunction2(target)) {
target = {};
}
if (i2 === length) {
target = this;
i2--;
}
for (; i2 < length; i2++) {
if ((options2 = arguments[i2]) != null) {
for (name in options2) {
copy2 = options2[name];
if (name === "__proto__" || target === copy2) {
continue;
}
if (deep && copy2 && (jQuery.isPlainObject(copy2) || (copyIsArray = Array.isArray(copy2)))) {
src = target[name];
if (copyIsArray && !Array.isArray(src)) {
clone = [];
} else if (!copyIsArray && !jQuery.isPlainObject(src)) {
clone = {};
} else {
clone = src;
}
copyIsArray = false;
target[name] = jQuery.extend(deep, clone, copy2);
} else if (copy2 !== void 0) {
target[name] = copy2;
}
}
}
}
return target;
};
jQuery.extend({
expando: "jQuery" + (version2 + Math.random()).replace(/\D/g, ""),
isReady: true,
error: function(msg) {
throw new Error(msg);
},
noop: function() {
},
isPlainObject: function(obj) {
var proto, Ctor;
if (!obj || toString2.call(obj) !== "[object Object]") {
return false;
}
proto = getProto(obj);
if (!proto) {
return true;
}
Ctor = hasOwn2.call(proto, "constructor") && proto.constructor;
return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
},
isEmptyObject: function(obj) {
var name;
for (name in obj) {
return false;
}
return true;
},
globalEval: function(code, options2, doc) {
DOMEval(code, { nonce: options2 && options2.nonce }, doc);
},
each: function(obj, callback2) {
var length, i2 = 0;
if (isArrayLike2(obj)) {
length = obj.length;
for (; i2 < length; i2++) {
if (callback2.call(obj[i2], i2, obj[i2]) === false) {
break;
}
}
} else {
for (i2 in obj) {
if (callback2.call(obj[i2], i2, obj[i2]) === false) {
break;
}
}
}
return obj;
},
text: function(elem) {
var node, ret = "", i2 = 0, nodeType = elem.nodeType;
if (!nodeType) {
while (node = elem[i2++]) {
ret += jQuery.text(node);
}
} else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
return elem.textContent;
} else if (nodeType === 3 || nodeType === 4) {
return elem.nodeValue;
}
return ret;
},
makeArray: function(arr2, results) {
var ret = results || [];
if (arr2 != null) {
if (isArrayLike2(Object(arr2))) {
jQuery.merge(
ret,
typeof arr2 === "string" ? [arr2] : arr2
);
} else {
push.call(ret, arr2);
}
}
return ret;
},
inArray: function(elem, arr2, i2) {
return arr2 == null ? -1 : indexOf.call(arr2, elem, i2);
},
isXMLDoc: function(elem) {
var namespace = elem && elem.namespaceURI, docElem = elem && (elem.ownerDocument || elem).documentElement;
return !rhtmlSuffix.test(namespace || docElem && docElem.nodeName || "HTML");
},
merge: function(first, second) {
var len = +second.length, j = 0, i2 = first.length;
for (; j < len; j++) {
first[i2++] = second[j];
}
first.length = i2;
return first;
},
grep: function(elems, callback2, invert) {
var callbackInverse, matches = [], i2 = 0, length = elems.length, callbackExpect = !invert;
for (; i2 < length; i2++) {
callbackInverse = !callback2(elems[i2], i2);
if (callbackInverse !== callbackExpect) {
matches.push(elems[i2]);
}
}
return matches;
},
map: function(elems, callback2, arg) {
var length, value, i2 = 0, ret = [];
if (isArrayLike2(elems)) {
length = elems.length;
for (; i2 < length; i2++) {
value = callback2(elems[i2], i2, arg);
if (value != null) {
ret.push(value);
}
}
} else {
for (i2 in elems) {
value = callback2(elems[i2], i2, arg);
if (value != null) {
ret.push(value);
}
}
}
return flat2(ret);
},
guid: 1,
support
});
if (typeof Symbol === "function") {
jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
}
jQuery.each(
"Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),
function(_i, name) {
class2type["[object " + name + "]"] = name.toLowerCase();
}
);
function isArrayLike2(obj) {
var length = !!obj && "length" in obj && obj.length, type2 = toType(obj);
if (isFunction2(obj) || isWindow(obj)) {
return false;
}
return type2 === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
}
function nodeName(elem, name) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
}
var pop = arr.pop;
var sort = arr.sort;
var splice2 = arr.splice;
var whitespace = "[\\x20\\t\\r\\n\\f]";
var rtrimCSS = new RegExp(
"^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
"g"
);
jQuery.contains = function(a, b) {
var bup = b && b.parentNode;
return a === bup || !!(bup && bup.nodeType === 1 && (a.contains ? a.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
};
var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
function fcssescape(ch, asCodePoint) {
if (asCodePoint) {
if (ch === "\0") {
return "\uFFFD";
}
return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
}
return "\\" + ch;
}
jQuery.escapeSelector = function(sel) {
return (sel + "").replace(rcssescape, fcssescape);
};
var preferredDoc = document2, pushNative = push;
(function() {
var i2, Expr, outermostContext, sortInput, hasDuplicate, push2 = pushNative, document3, documentElement2, documentIsHTML, rbuggyQSA, matches, expando = jQuery.expando, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), nonnativeSelectorCache = createCache(), sortOrder = function(a, b) {
if (a === b) {
hasDuplicate = true;
}
return 0;
}, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + "*([*^$|!~]?=)" + whitespace + `*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(` + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + `)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|` + attributes + ")*)|.*)\\)|)", rwhitespace = new RegExp(whitespace + "+", "g"), rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), rleadingCombinator = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"), rdescend = new RegExp(whitespace + "|>"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp("^" + identifier + "$"), matchExpr = {
ID: new RegExp("^#(" + identifier + ")"),
CLASS: new RegExp("^\\.(" + identifier + ")"),
TAG: new RegExp("^(" + identifier + "|[*])"),
ATTR: new RegExp("^" + attributes),
PSEUDO: new RegExp("^" + pseudos),
CHILD: new RegExp(
"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)",
"i"
),
bool: new RegExp("^(?:" + booleans + ")$", "i"),
needsContext: new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
}, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rquickExpr2 = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"), funescape = function(escape2, nonHex) {
var high = "0x" + escape2.slice(1) - 65536;
if (nonHex) {
return nonHex;
}
return high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320);
}, unloadHandler = function() {
setDocument();
}, inDisabledFieldset = addCombinator(
function(elem) {
return elem.disabled === true && nodeName(elem, "fieldset");
},
{ dir: "parentNode", next: "legend" }
);
function safeActiveElement() {
try {
return document3.activeElement;
} catch (err) {
}
}
try {
push2.apply(
arr = slice.call(preferredDoc.childNodes),
preferredDoc.childNodes
);
arr[preferredDoc.childNodes.length].nodeType;
} catch (e) {
push2 = {
apply: function(target, els) {
pushNative.apply(target, slice.call(els));
},
call: function(target) {
pushNative.apply(target, slice.call(arguments, 1));
}
};
}
function find2(selector, context, results, seed) {
var m, i3, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, nodeType = context ? context.nodeType : 9;
results = results || [];
if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
return results;
}
if (!seed) {
setDocument(context);
context = context || document3;
if (documentIsHTML) {
if (nodeType !== 11 && (match = rquickExpr2.exec(selector))) {
if (m = match[1]) {
if (nodeType === 9) {
if (elem = context.getElementById(m)) {
if (elem.id === m) {
push2.call(results, elem);
return results;
}
} else {
return results;
}
} else {
if (newContext && (elem = newContext.getElementById(m)) && find2.contains(context, elem) && elem.id === m) {
push2.call(results, elem);
return results;
}
}
} else if (match[2]) {
push2.apply(results, context.getElementsByTagName(selector));
return results;
} else if ((m = match[3]) && context.getElementsByClassName) {
push2.apply(results, context.getElementsByClassName(m));
return results;
}
}
if (!nonnativeSelectorCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
newSelector = selector;
newContext = context;
if (nodeType === 1 && (rdescend.test(selector) || rleadingCombinator.test(selector))) {
newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
if (newContext != context || !support.scope) {
if (nid = context.getAttribute("id")) {
nid = jQuery.escapeSelector(nid);
} else {
context.setAttribute("id", nid = expando);
}
}
groups = tokenize(selector);
i3 = groups.length;
while (i3--) {
groups[i3] = (nid ? "#" + nid : ":scope") + " " + toSelector(groups[i3]);
}
newSelector = groups.join(",");
}
try {
push2.apply(
results,
newContext.querySelectorAll(newSelector)
);
return results;
} catch (qsaError) {
nonnativeSelectorCache(selector, true);
} finally {
if (nid === expando) {
context.removeAttribute("id");
}
}
}
}
}
return select(selector.replace(rtrimCSS, "$1"), context, results, seed);
}
function createCache() {
var keys3 = [];
function cache(key, value) {
if (keys3.push(key + " ") > Expr.cacheLength) {
delete cache[keys3.shift()];
}
return cache[key + " "] = value;
}
return cache;
}
function markFunction(fn2) {
fn2[expando] = true;
return fn2;
}
function assert(fn2) {
var el = document3.createElement("fieldset");
try {
return !!fn2(el);
} catch (e) {
return false;
} finally {
if (el.parentNode) {
el.parentNode.removeChild(el);
}
el = null;
}
}
function createInputPseudo(type2) {
return function(elem) {
return nodeName(elem, "input") && elem.type === type2;
};
}
function createButtonPseudo(type2) {
return function(elem) {
return (nodeName(elem, "input") || nodeName(elem, "button")) && elem.type === type2;
};
}
function createDisabledPseudo(disabled) {
return function(elem) {
if ("form" in elem) {
if (elem.parentNode && elem.disabled === false) {
if ("label" in elem) {
if ("label" in elem.parentNode) {
return elem.parentNode.disabled === disabled;
} else {
return elem.disabled === disabled;
}
}
return elem.isDisabled === disabled || elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled;
}
return elem.disabled === disabled;
} else if ("label" in elem) {
return elem.disabled === disabled;
}
return false;
};
}
function createPositionalPseudo(fn2) {
return markFunction(function(argument) {
argument = +argument;
return markFunction(function(seed, matches2) {
var j, matchIndexes = fn2([], seed.length, argument), i3 = matchIndexes.length;
while (i3--) {
if (seed[j = matchIndexes[i3]]) {
seed[j] = !(matches2[j] = seed[j]);
}
}
});
});
}
function testContext(context) {
return context && typeof context.getElementsByTagName !== "undefined" && context;
}
function setDocument(node) {
var subWindow, doc = node ? node.ownerDocument || node : preferredDoc;
if (doc == document3 || doc.nodeType !== 9 || !doc.documentElement) {
return document3;
}
document3 = doc;
documentElement2 = document3.documentElement;
documentIsHTML = !jQuery.isXMLDoc(document3);
matches = documentElement2.matches || documentElement2.webkitMatchesSelector || documentElement2.msMatchesSelector;
if (preferredDoc != document3 && (subWindow = document3.defaultView) && subWindow.top !== subWindow) {
subWindow.addEventListener("unload", unloadHandler);
}
support.getById = assert(function(el) {
documentElement2.appendChild(el).id = jQuery.expando;
return !document3.getElementsByName || !document3.getElementsByName(jQuery.expando).length;
});
support.disconnectedMatch = assert(function(el) {
return matches.call(el, "*");
});
support.scope = assert(function() {
return document3.querySelectorAll(":scope");
});
support.cssHas = assert(function() {
try {
document3.querySelector(":has(*,:jqfake)");
return false;
} catch (e) {
return true;
}
});
if (support.getById) {
Expr.filter.ID = function(id) {
var attrId = id.replace(runescape, funescape);
return function(elem) {
return elem.getAttribute("id") === attrId;
};
};
Expr.find.ID = function(id, context) {
if (typeof context.getElementById !== "undefined" && documentIsHTML) {
var elem = context.getElementById(id);
return elem ? [elem] : [];
}
};
} else {
Expr.filter.ID = function(id) {
var attrId = id.replace(runescape, funescape);
return function(elem) {
var node2 = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
return node2 && node2.value === attrId;
};
};
Expr.find.ID = function(id, context) {
if (typeof context.getElementById !== "undefined" && documentIsHTML) {
var node2, i3, elems, elem = context.getElementById(id);
if (elem) {
node2 = elem.getAttributeNode("id");
if (node2 && node2.value === id) {
return [elem];
}
elems = context.getElementsByName(id);
i3 = 0;
while (elem = elems[i3++]) {
node2 = elem.getAttributeNode("id");
if (node2 && node2.value === id) {
return [elem];
}
}
}
return [];
}
};
}
Expr.find.TAG = function(tag, context) {
if (typeof context.getElementsByTagName !== "undefined") {
return context.getElementsByTagName(tag);
} else {
return context.querySelectorAll(tag);
}
};
Expr.find.CLASS = function(className, context) {
if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
return context.getElementsByClassName(className);
}
};
rbuggyQSA = [];
assert(function(el) {
var input;
documentElement2.appendChild(el).innerHTML = "";
if (!el.querySelectorAll("[selected]").length) {
rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
}
if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
rbuggyQSA.push("~=");
}
if (!el.querySelectorAll("a#" + expando + "+*").length) {
rbuggyQSA.push(".#.+[+~]");
}
if (!el.querySelectorAll(":checked").length) {
rbuggyQSA.push(":checked");
}
input = document3.createElement("input");
input.setAttribute("type", "hidden");
el.appendChild(input).setAttribute("name", "D");
documentElement2.appendChild(el).disabled = true;
if (el.querySelectorAll(":disabled").length !== 2) {
rbuggyQSA.push(":enabled", ":disabled");
}
input = document3.createElement("input");
input.setAttribute("name", "");
el.appendChild(input);
if (!el.querySelectorAll("[name='']").length) {
rbuggyQSA.push("\\[" + whitespace + "*name" + whitespace + "*=" + whitespace + `*(?:''|"")`);
}
});
if (!support.cssHas) {
rbuggyQSA.push(":has");
}
rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
sortOrder = function(a, b) {
if (a === b) {
hasDuplicate = true;
return 0;
}
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
if (compare) {
return compare;
}
compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;
if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
if (a === document3 || a.ownerDocument == preferredDoc && find2.contains(preferredDoc, a)) {
return -1;
}
if (b === document3 || b.ownerDocument == preferredDoc && find2.contains(preferredDoc, b)) {
return 1;
}
return sortInput ? indexOf.call(sortInput, a) - indexOf.call(sortInput, b) : 0;
}
return compare & 4 ? -1 : 1;
};
return document3;
}
find2.matches = function(expr, elements) {
return find2(expr, null, null, elements);
};
find2.matchesSelector = function(elem, expr) {
setDocument(elem);
if (documentIsHTML && !nonnativeSelectorCache[expr + " "] && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
try {
var ret = matches.call(elem, expr);
if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) {
return ret;
}
} catch (e) {
nonnativeSelectorCache(expr, true);
}
}
return find2(expr, document3, null, [elem]).length > 0;
};
find2.contains = function(context, elem) {
if ((context.ownerDocument || context) != document3) {
setDocument(context);
}
return jQuery.contains(context, elem);
};
find2.attr = function(elem, name) {
if ((elem.ownerDocument || elem) != document3) {
setDocument(elem);
}
var fn2 = Expr.attrHandle[name.toLowerCase()], val = fn2 && hasOwn2.call(Expr.attrHandle, name.toLowerCase()) ? fn2(elem, name, !documentIsHTML) : void 0;
if (val !== void 0) {
return val;
}
return elem.getAttribute(name);
};
find2.error = function(msg) {
throw new Error("Syntax error, unrecognized expression: " + msg);
};
jQuery.uniqueSort = function(results) {
var elem, duplicates = [], j = 0, i3 = 0;
hasDuplicate = !support.sortStable;
sortInput = !support.sortStable && slice.call(results, 0);
sort.call(results, sortOrder);
if (hasDuplicate) {
while (elem = results[i3++]) {
if (elem === results[i3]) {
j = duplicates.push(i3);
}
}
while (j--) {
splice2.call(results, duplicates[j], 1);
}
}
sortInput = null;
return results;
};
jQuery.fn.uniqueSort = function() {
return this.pushStack(jQuery.uniqueSort(slice.apply(this)));
};
Expr = jQuery.expr = {
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
attrHandle: {},
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
ATTR: function(match) {
match[1] = match[1].replace(runescape, funescape);
match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
if (match[2] === "~=") {
match[3] = " " + match[3] + " ";
}
return match.slice(0, 4);
},
CHILD: function(match) {
match[1] = match[1].toLowerCase();
if (match[1].slice(0, 3) === "nth") {
if (!match[3]) {
find2.error(match[0]);
}
match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
match[5] = +(match[7] + match[8] || match[3] === "odd");
} else if (match[3]) {
find2.error(match[0]);
}
return match;
},
PSEUDO: function(match) {
var excess, unquoted = !match[6] && match[2];
if (matchExpr.CHILD.test(match[0])) {
return null;
}
if (match[3]) {
match[2] = match[4] || match[5] || "";
} else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
match[0] = match[0].slice(0, excess);
match[2] = unquoted.slice(0, excess);
}
return match.slice(0, 3);
}
},
filter: {
TAG: function(nodeNameSelector) {
var expectedNodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
return nodeNameSelector === "*" ? function() {
return true;
} : function(elem) {
return nodeName(elem, expectedNodeName);
};
},
CLASS: function(className) {
var pattern = classCache[className + " "];
return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) {
return pattern.test(
typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || ""
);
});
},
ATTR: function(name, operator, check) {
return function(elem) {
var result = find2.attr(elem, name);
if (result == null) {
return operator === "!=";
}
if (!operator) {
return true;
}
result += "";
if (operator === "=") {
return result === check;
}
if (operator === "!=") {
return result !== check;
}
if (operator === "^=") {
return check && result.indexOf(check) === 0;
}
if (operator === "*=") {
return check && result.indexOf(check) > -1;
}
if (operator === "$=") {
return check && result.slice(-check.length) === check;
}
if (operator === "~=") {
return (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1;
}
if (operator === "|=") {
return result === check || result.slice(0, check.length + 1) === check + "-";
}
return false;
};
},
CHILD: function(type2, what, _argument, first, last) {
var simple = type2.slice(0, 3) !== "nth", forward = type2.slice(-4) !== "last", ofType = what === "of-type";
return first === 1 && last === 0 ? function(elem) {
return !!elem.parentNode;
} : function(elem, _context, xml) {
var cache, outerCache, node, nodeIndex, start2, dir2 = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false;
if (parent) {
if (simple) {
while (dir2) {
node = elem;
while (node = node[dir2]) {
if (ofType ? nodeName(node, name) : node.nodeType === 1) {
return false;
}
}
start2 = dir2 = type2 === "only" && !start2 && "nextSibling";
}
return true;
}
start2 = [forward ? parent.firstChild : parent.lastChild];
if (forward && useCache) {
outerCache = parent[expando] || (parent[expando] = {});
cache = outerCache[type2] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = nodeIndex && cache[2];
node = nodeIndex && parent.childNodes[nodeIndex];
while (node = ++nodeIndex && node && node[dir2] || (diff = nodeIndex = 0) || start2.pop()) {
if (node.nodeType === 1 && ++diff && node === elem) {
outerCache[type2] = [dirruns, nodeIndex, diff];
break;
}
}
} else {
if (useCache) {
outerCache = elem[expando] || (elem[expando] = {});
cache = outerCache[type2] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = nodeIndex;
}
if (diff === false) {
while (node = ++nodeIndex && node && node[dir2] || (diff = nodeIndex = 0) || start2.pop()) {
if ((ofType ? nodeName(node, name) : node.nodeType === 1) && ++diff) {
if (useCache) {
outerCache = node[expando] || (node[expando] = {});
outerCache[type2] = [dirruns, diff];
}
if (node === elem) {
break;
}
}
}
}
}
diff -= last;
return diff === first || diff % first === 0 && diff / first >= 0;
}
};
},
PSEUDO: function(pseudo, argument) {
var args, fn2 = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || find2.error("unsupported pseudo: " + pseudo);
if (fn2[expando]) {
return fn2(argument);
}
if (fn2.length > 1) {
args = [pseudo, pseudo, "", argument];
return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches2) {
var idx, matched = fn2(seed, argument), i3 = matched.length;
while (i3--) {
idx = indexOf.call(seed, matched[i3]);
seed[idx] = !(matches2[idx] = matched[i3]);
}
}) : function(elem) {
return fn2(elem, 0, args);
};
}
return fn2;
}
},
pseudos: {
not: markFunction(function(selector) {
var input = [], results = [], matcher = compile(selector.replace(rtrimCSS, "$1"));
return matcher[expando] ? markFunction(function(seed, matches2, _context, xml) {
var elem, unmatched = matcher(seed, null, xml, []), i3 = seed.length;
while (i3--) {
if (elem = unmatched[i3]) {
seed[i3] = !(matches2[i3] = elem);
}
}
}) : function(elem, _context, xml) {
input[0] = elem;
matcher(input, null, xml, results);
input[0] = null;
return !results.pop();
};
}),
has: markFunction(function(selector) {
return function(elem) {
return find2(selector, elem).length > 0;
};
}),
contains: markFunction(function(text) {
text = text.replace(runescape, funescape);
return function(elem) {
return (elem.textContent || jQuery.text(elem)).indexOf(text) > -1;
};
}),
lang: markFunction(function(lang) {
if (!ridentifier.test(lang || "")) {
find2.error("unsupported lang: " + lang);
}
lang = lang.replace(runescape, funescape).toLowerCase();
return function(elem) {
var elemLang;
do {
if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
}
} while ((elem = elem.parentNode) && elem.nodeType === 1);
return false;
};
}),
target: function(elem) {
var hash = window2.location && window2.location.hash;
return hash && hash.slice(1) === elem.id;
},
root: function(elem) {
return elem === documentElement2;
},
focus: function(elem) {
return elem === safeActiveElement() && document3.hasFocus() && !!(elem.type || elem.href || ~elem.tabIndex);
},
enabled: createDisabledPseudo(false),
disabled: createDisabledPseudo(true),
checked: function(elem) {
return nodeName(elem, "input") && !!elem.checked || nodeName(elem, "option") && !!elem.selected;
},
selected: function(elem) {
if (elem.parentNode) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
empty: function(elem) {
for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
if (elem.nodeType < 6) {
return false;
}
}
return true;
},
parent: function(elem) {
return !Expr.pseudos.empty(elem);
},
header: function(elem) {
return rheader.test(elem.nodeName);
},
input: function(elem) {
return rinputs.test(elem.nodeName);
},
button: function(elem) {
return nodeName(elem, "input") && elem.type === "button" || nodeName(elem, "button");
},
text: function(elem) {
var attr;
return nodeName(elem, "input") && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
},
first: createPositionalPseudo(function() {
return [0];
}),
last: createPositionalPseudo(function(_matchIndexes, length) {
return [length - 1];
}),
eq: createPositionalPseudo(function(_matchIndexes, length, argument) {
return [argument < 0 ? argument + length : argument];
}),
even: createPositionalPseudo(function(matchIndexes, length) {
var i3 = 0;
for (; i3 < length; i3 += 2) {
matchIndexes.push(i3);
}
return matchIndexes;
}),
odd: createPositionalPseudo(function(matchIndexes, length) {
var i3 = 1;
for (; i3 < length; i3 += 2) {
matchIndexes.push(i3);
}
return matchIndexes;
}),
lt: createPositionalPseudo(function(matchIndexes, length, argument) {
var i3;
if (argument < 0) {
i3 = argument + length;
} else if (argument > length) {
i3 = length;
} else {
i3 = argument;
}
for (; --i3 >= 0; ) {
matchIndexes.push(i3);
}
return matchIndexes;
}),
gt: createPositionalPseudo(function(matchIndexes, length, argument) {
var i3 = argument < 0 ? argument + length : argument;
for (; ++i3 < length; ) {
matchIndexes.push(i3);
}
return matchIndexes;
})
}
};
Expr.pseudos.nth = Expr.pseudos.eq;
for (i2 in { radio: true, checkbox: true, file: true, password: true, image: true }) {
Expr.pseudos[i2] = createInputPseudo(i2);
}
for (i2 in { submit: true, reset: true }) {
Expr.pseudos[i2] = createButtonPseudo(i2);
}
function setFilters() {
}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();
function tokenize(selector, parseOnly) {
var matched, match, tokens, type2, soFar, groups, preFilters, cached = tokenCache[selector + " "];
if (cached) {
return parseOnly ? 0 : cached.slice(0);
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while (soFar) {
if (!matched || (match = rcomma.exec(soFar))) {
if (match) {
soFar = soFar.slice(match[0].length) || soFar;
}
groups.push(tokens = []);
}
matched = false;
if (match = rleadingCombinator.exec(soFar)) {
matched = match.shift();
tokens.push({
value: matched,
type: match[0].replace(rtrimCSS, " ")
});
soFar = soFar.slice(matched.length);
}
for (type2 in Expr.filter) {
if ((match = matchExpr[type2].exec(soFar)) && (!preFilters[type2] || (match = preFilters[type2](match)))) {
matched = match.shift();
tokens.push({
value: matched,
type: type2,
matches: match
});
soFar = soFar.slice(matched.length);
}
}
if (!matched) {
break;
}
}
if (parseOnly) {
return soFar.length;
}
return soFar ? find2.error(selector) : tokenCache(selector, groups).slice(0);
}
function toSelector(tokens) {
var i3 = 0, len = tokens.length, selector = "";
for (; i3 < len; i3++) {
selector += tokens[i3].value;
}
return selector;
}
function addCombinator(matcher, combinator, base2) {
var dir2 = combinator.dir, skip = combinator.next, key = skip || dir2, checkNonElements = base2 && key === "parentNode", doneName = done++;
return combinator.first ? function(elem, context, xml) {
while (elem = elem[dir2]) {
if (elem.nodeType === 1 || checkNonElements) {
return matcher(elem, context, xml);
}
}
return false;
} : function(elem, context, xml) {
var oldCache, outerCache, newCache = [dirruns, doneName];
if (xml) {
while (elem = elem[dir2]) {
if (elem.nodeType === 1 || checkNonElements) {
if (matcher(elem, context, xml)) {
return true;
}
}
}
} else {
while (elem = elem[dir2]) {
if (elem.nodeType === 1 || checkNonElements) {
outerCache = elem[expando] || (elem[expando] = {});
if (skip && nodeName(elem, skip)) {
elem = elem[dir2] || elem;
} else if ((oldCache = outerCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
return newCache[2] = oldCache[2];
} else {
outerCache[key] = newCache;
if (newCache[2] = matcher(elem, context, xml)) {
return true;
}
}
}
}
}
return false;
};
}
function elementMatcher(matchers2) {
return matchers2.length > 1 ? function(elem, context, xml) {
var i3 = matchers2.length;
while (i3--) {
if (!matchers2[i3](elem, context, xml)) {
return false;
}
}
return true;
} : matchers2[0];
}
function multipleContexts(selector, contexts, results) {
var i3 = 0, len = contexts.length;
for (; i3 < len; i3++) {
find2(selector, contexts[i3], results);
}
return results;
}
function condense(unmatched, map, filter, context, xml) {
var elem, newUnmatched = [], i3 = 0, len = unmatched.length, mapped = map != null;
for (; i3 < len; i3++) {
if (elem = unmatched[i3]) {
if (!filter || filter(elem, context, xml)) {
newUnmatched.push(elem);
if (mapped) {
map.push(i3);
}
}
}
}
return newUnmatched;
}
function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
if (postFilter && !postFilter[expando]) {
postFilter = setMatcher(postFilter);
}
if (postFinder && !postFinder[expando]) {
postFinder = setMatcher(postFinder, postSelector);
}
return markFunction(function(seed, results, context, xml) {
var temp, i3, elem, matcherOut, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(
selector || "*",
context.nodeType ? [context] : context,
[]
), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems;
if (matcher) {
matcherOut = postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results;
matcher(matcherIn, matcherOut, context, xml);
} else {
matcherOut = matcherIn;
}
if (postFilter) {
temp = condense(matcherOut, postMap);
postFilter(temp, [], context, xml);
i3 = temp.length;
while (i3--) {
if (elem = temp[i3]) {
matcherOut[postMap[i3]] = !(matcherIn[postMap[i3]] = elem);
}
}
}
if (seed) {
if (postFinder || preFilter) {
if (postFinder) {
temp = [];
i3 = matcherOut.length;
while (i3--) {
if (elem = matcherOut[i3]) {
temp.push(matcherIn[i3] = elem);
}
}
postFinder(null, matcherOut = [], temp, xml);
}
i3 = matcherOut.length;
while (i3--) {
if ((elem = matcherOut[i3]) && (temp = postFinder ? indexOf.call(seed, elem) : preMap[i3]) > -1) {
seed[temp] = !(results[temp] = elem);
}
}
}
} else {
matcherOut = condense(
matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut
);
if (postFinder) {
postFinder(null, results, matcherOut, xml);
} else {
push2.apply(results, matcherOut);
}
}
});
}
function matcherFromTokens(tokens) {
var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[" "], i3 = leadingRelative ? 1 : 0, matchContext = addCombinator(function(elem) {
return elem === checkContext;
}, implicitRelative, true), matchAnyContext = addCombinator(function(elem) {
return indexOf.call(checkContext, elem) > -1;
}, implicitRelative, true), matchers2 = [function(elem, context, xml) {
var ret = !leadingRelative && (xml || context != outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
checkContext = null;
return ret;
}];
for (; i3 < len; i3++) {
if (matcher = Expr.relative[tokens[i3].type]) {
matchers2 = [addCombinator(elementMatcher(matchers2), matcher)];
} else {
matcher = Expr.filter[tokens[i3].type].apply(null, tokens[i3].matches);
if (matcher[expando]) {
j = ++i3;
for (; j < len; j++) {
if (Expr.relative[tokens[j].type]) {
break;
}
}
return setMatcher(
i3 > 1 && elementMatcher(matchers2),
i3 > 1 && toSelector(
tokens.slice(0, i3 - 1).concat({ value: tokens[i3 - 2].type === " " ? "*" : "" })
).replace(rtrimCSS, "$1"),
matcher,
i3 < j && matcherFromTokens(tokens.slice(i3, j)),
j < len && matcherFromTokens(tokens = tokens.slice(j)),
j < len && toSelector(tokens)
);
}
matchers2.push(matcher);
}
}
return elementMatcher(matchers2);
}
function matcherFromGroupMatchers(elementMatchers, setMatchers) {
var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function(seed, context, xml, results, outermost) {
var elem, j, matcher, matchedCount = 0, i3 = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find.TAG("*", outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len = elems.length;
if (outermost) {
outermostContext = context == document3 || context || outermost;
}
for (; i3 !== len && (elem = elems[i3]) != null; i3++) {
if (byElement && elem) {
j = 0;
if (!context && elem.ownerDocument != document3) {
setDocument(elem);
xml = !documentIsHTML;
}
while (matcher = elementMatchers[j++]) {
if (matcher(elem, context || document3, xml)) {
push2.call(results, elem);
break;
}
}
if (outermost) {
dirruns = dirrunsUnique;
}
}
if (bySet) {
if (elem = !matcher && elem) {
matchedCount--;
}
if (seed) {
unmatched.push(elem);
}
}
}
matchedCount += i3;
if (bySet && i3 !== matchedCount) {
j = 0;
while (matcher = setMatchers[j++]) {
matcher(unmatched, setMatched, context, xml);
}
if (seed) {
if (matchedCount > 0) {
while (i3--) {
if (!(unmatched[i3] || setMatched[i3])) {
setMatched[i3] = pop.call(results);
}
}
}
setMatched = condense(setMatched);
}
push2.apply(results, setMatched);
if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
jQuery.uniqueSort(results);
}
}
if (outermost) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ? markFunction(superMatcher) : superMatcher;
}
function compile(selector, match) {
var i3, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + " "];
if (!cached) {
if (!match) {
match = tokenize(selector);
}
i3 = match.length;
while (i3--) {
cached = matcherFromTokens(match[i3]);
if (cached[expando]) {
setMatchers.push(cached);
} else {
elementMatchers.push(cached);
}
}
cached = compilerCache(
selector,
matcherFromGroupMatchers(elementMatchers, setMatchers)
);
cached.selector = selector;
}
return cached;
}
function select(selector, context, results, seed) {
var i3, tokens, token, type2, find3, compiled = typeof selector === "function" && selector, match = !seed && tokenize(selector = compiled.selector || selector);
results = results || [];
if (match.length === 1) {
tokens = match[0] = match[0].slice(0);
if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
context = (Expr.find.ID(
token.matches[0].replace(runescape, funescape),
context
) || [])[0];
if (!context) {
return results;
} else if (compiled) {
context = context.parentNode;
}
selector = selector.slice(tokens.shift().value.length);
}
i3 = matchExpr.needsContext.test(selector) ? 0 : tokens.length;
while (i3--) {
token = tokens[i3];
if (Expr.relative[type2 = token.type]) {
break;
}
if (find3 = Expr.find[type2]) {
if (seed = find3(
token.matches[0].replace(runescape, funescape),
rsibling.test(tokens[0].type) && testContext(context.parentNode) || context
)) {
tokens.splice(i3, 1);
selector = seed.length && toSelector(tokens);
if (!selector) {
push2.apply(results, seed);
return results;
}
break;
}
}
}
}
(compiled || compile(selector, match))(
seed,
context,
!documentIsHTML,
results,
!context || rsibling.test(selector) && testContext(context.parentNode) || context
);
return results;
}
support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
setDocument();
support.sortDetached = assert(function(el) {
return el.compareDocumentPosition(document3.createElement("fieldset")) & 1;
});
jQuery.find = find2;
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.unique = jQuery.uniqueSort;
find2.compile = compile;
find2.select = select;
find2.setDocument = setDocument;
find2.escape = jQuery.escapeSelector;
find2.getText = jQuery.text;
find2.isXML = jQuery.isXMLDoc;
find2.selectors = jQuery.expr;
find2.support = jQuery.support;
find2.uniqueSort = jQuery.uniqueSort;
})();
var dir = function(elem, dir2, until) {
var matched = [], truncate = until !== void 0;
while ((elem = elem[dir2]) && elem.nodeType !== 9) {
if (elem.nodeType === 1) {
if (truncate && jQuery(elem).is(until)) {
break;
}
matched.push(elem);
}
}
return matched;
};
var siblings = function(n, elem) {
var matched = [];
for (; n; n = n.nextSibling) {
if (n.nodeType === 1 && n !== elem) {
matched.push(n);
}
}
return matched;
};
var rneedsContext = jQuery.expr.match.needsContext;
var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
function winnow(elements, qualifier, not) {
if (isFunction2(qualifier)) {
return jQuery.grep(elements, function(elem, i2) {
return !!qualifier.call(elem, i2, elem) !== not;
});
}
if (qualifier.nodeType) {
return jQuery.grep(elements, function(elem) {
return elem === qualifier !== not;
});
}
if (typeof qualifier !== "string") {
return jQuery.grep(elements, function(elem) {
return indexOf.call(qualifier, elem) > -1 !== not;
});
}
return jQuery.filter(qualifier, elements, not);
}
jQuery.filter = function(expr, elems, not) {
var elem = elems[0];
if (not) {
expr = ":not(" + expr + ")";
}
if (elems.length === 1 && elem.nodeType === 1) {
return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
}
return jQuery.find.matches(expr, jQuery.grep(elems, function(elem2) {
return elem2.nodeType === 1;
}));
};
jQuery.fn.extend({
find: function(selector) {
var i2, ret, len = this.length, self2 = this;
if (typeof selector !== "string") {
return this.pushStack(jQuery(selector).filter(function() {
for (i2 = 0; i2 < len; i2++) {
if (jQuery.contains(self2[i2], this)) {
return true;
}
}
}));
}
ret = this.pushStack([]);
for (i2 = 0; i2 < len; i2++) {
jQuery.find(selector, self2[i2], ret);
}
return len > 1 ? jQuery.uniqueSort(ret) : ret;
},
filter: function(selector) {
return this.pushStack(winnow(this, selector || [], false));
},
not: function(selector) {
return this.pushStack(winnow(this, selector || [], true));
},
is: function(selector) {
return !!winnow(
this,
typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [],
false
).length;
}
});
var rootjQuery, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, init = jQuery.fn.init = function(selector, context, root2) {
var match, elem;
if (!selector) {
return this;
}
root2 = root2 || rootjQuery;
if (typeof selector === "string") {
if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
match = [null, selector, null];
} else {
match = rquickExpr.exec(selector);
}
if (match && (match[1] || !context)) {
if (match[1]) {
context = context instanceof jQuery ? context[0] : context;
jQuery.merge(this, jQuery.parseHTML(
match[1],
context && context.nodeType ? context.ownerDocument || context : document2,
true
));
if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
for (match in context) {
if (isFunction2(this[match])) {
this[match](context[match]);
} else {
this.attr(match, context[match]);
}
}
}
return this;
} else {
elem = document2.getElementById(match[2]);
if (elem) {
this[0] = elem;
this.length = 1;
}
return this;
}
} else if (!context || context.jquery) {
return (context || root2).find(selector);
} else {
return this.constructor(context).find(selector);
}
} else if (selector.nodeType) {
this[0] = selector;
this.length = 1;
return this;
} else if (isFunction2(selector)) {
return root2.ready !== void 0 ? root2.ready(selector) : selector(jQuery);
}
return jQuery.makeArray(selector, this);
};
init.prototype = jQuery.fn;
rootjQuery = jQuery(document2);
var rparentsprev = /^(?:parents|prev(?:Until|All))/, guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
has: function(target) {
var targets = jQuery(target, this), l = targets.length;
return this.filter(function() {
var i2 = 0;
for (; i2 < l; i2++) {
if (jQuery.contains(this, targets[i2])) {
return true;
}
}
});
},
closest: function(selectors, context) {
var cur, i2 = 0, l = this.length, matched = [], targets = typeof selectors !== "string" && jQuery(selectors);
if (!rneedsContext.test(selectors)) {
for (; i2 < l; i2++) {
for (cur = this[i2]; cur && cur !== context; cur = cur.parentNode) {
if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 : cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
matched.push(cur);
break;
}
}
}
}
return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
},
index: function(elem) {
if (!elem) {
return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
}
if (typeof elem === "string") {
return indexOf.call(jQuery(elem), this[0]);
}
return indexOf.call(
this,
elem.jquery ? elem[0] : elem
);
},
add: function(selector, context) {
return this.pushStack(
jQuery.uniqueSort(
jQuery.merge(this.get(), jQuery(selector, context))
)
);
},
addBack: function(selector) {
return this.add(
selector == null ? this.prevObject : this.prevObject.filter(selector)
);
}
});
function sibling(cur, dir2) {
while ((cur = cur[dir2]) && cur.nodeType !== 1) {
}
return cur;
}
jQuery.each({
parent: function(elem) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function(elem) {
return dir(elem, "parentNode");
},
parentsUntil: function(elem, _i, until) {
return dir(elem, "parentNode", until);
},
next: function(elem) {
return sibling(elem, "nextSibling");
},
prev: function(elem) {
return sibling(elem, "previousSibling");
},
nextAll: function(elem) {
return dir(elem, "nextSibling");
},
prevAll: function(elem) {
return dir(elem, "previousSibling");
},
nextUntil: function(elem, _i, until) {
return dir(elem, "nextSibling", until);
},
prevUntil: function(elem, _i, until) {
return dir(elem, "previousSibling", until);
},
siblings: function(elem) {
return siblings((elem.parentNode || {}).firstChild, elem);
},
children: function(elem) {
return siblings(elem.firstChild);
},
contents: function(elem) {
if (elem.contentDocument != null && getProto(elem.contentDocument)) {
return elem.contentDocument;
}
if (nodeName(elem, "template")) {
elem = elem.content || elem;
}
return jQuery.merge([], elem.childNodes);
}
}, function(name, fn2) {
jQuery.fn[name] = function(until, selector) {
var matched = jQuery.map(this, fn2, until);
if (name.slice(-5) !== "Until") {
selector = until;
}
if (selector && typeof selector === "string") {
matched = jQuery.filter(selector, matched);
}
if (this.length > 1) {
if (!guaranteedUnique[name]) {
jQuery.uniqueSort(matched);
}
if (rparentsprev.test(name)) {
matched.reverse();
}
}
return this.pushStack(matched);
};
});
var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
function createOptions(options2) {
var object = {};
jQuery.each(options2.match(rnothtmlwhite) || [], function(_, flag) {
object[flag] = true;
});
return object;
}
jQuery.Callbacks = function(options2) {
options2 = typeof options2 === "string" ? createOptions(options2) : jQuery.extend({}, options2);
var firing, memory, fired, locked, list = [], queue = [], firingIndex = -1, fire = function() {
locked = locked || options2.once;
fired = firing = true;
for (; queue.length; firingIndex = -1) {
memory = queue.shift();
while (++firingIndex < list.length) {
if (list[firingIndex].apply(memory[0], memory[1]) === false && options2.stopOnFalse) {
firingIndex = list.length;
memory = false;
}
}
}
if (!options2.memory) {
memory = false;
}
firing = false;
if (locked) {
if (memory) {
list = [];
} else {
list = "";
}
}
}, self2 = {
add: function() {
if (list) {
if (memory && !firing) {
firingIndex = list.length - 1;
queue.push(memory);
}
(function add(args) {
jQuery.each(args, function(_, arg) {
if (isFunction2(arg)) {
if (!options2.unique || !self2.has(arg)) {
list.push(arg);
}
} else if (arg && arg.length && toType(arg) !== "string") {
add(arg);
}
});
})(arguments);
if (memory && !firing) {
fire();
}
}
return this;
},
remove: function() {
jQuery.each(arguments, function(_, arg) {
var index2;
while ((index2 = jQuery.inArray(arg, list, index2)) > -1) {
list.splice(index2, 1);
if (index2 <= firingIndex) {
firingIndex--;
}
}
});
return this;
},
has: function(fn2) {
return fn2 ? jQuery.inArray(fn2, list) > -1 : list.length > 0;
},
empty: function() {
if (list) {
list = [];
}
return this;
},
disable: function() {
locked = queue = [];
list = memory = "";
return this;
},
disabled: function() {
return !list;
},
lock: function() {
locked = queue = [];
if (!memory && !firing) {
list = memory = "";
}
return this;
},
locked: function() {
return !!locked;
},
fireWith: function(context, args) {
if (!locked) {
args = args || [];
args = [context, args.slice ? args.slice() : args];
queue.push(args);
if (!firing) {
fire();
}
}
return this;
},
fire: function() {
self2.fireWith(this, arguments);
return this;
},
fired: function() {
return !!fired;
}
};
return self2;
};
function Identity(v) {
return v;
}
function Thrower(ex) {
throw ex;
}
function adoptValue(value, resolve2, reject2, noValue) {
var method;
try {
if (value && isFunction2(method = value.promise)) {
method.call(value).done(resolve2).fail(reject2);
} else if (value && isFunction2(method = value.then)) {
method.call(value, resolve2, reject2);
} else {
resolve2.apply(void 0, [value].slice(noValue));
}
} catch (value2) {
reject2.apply(void 0, [value2]);
}
}
jQuery.extend({
Deferred: function(func) {
var tuples = [
[
"notify",
"progress",
jQuery.Callbacks("memory"),
jQuery.Callbacks("memory"),
2
],
[
"resolve",
"done",
jQuery.Callbacks("once memory"),
jQuery.Callbacks("once memory"),
0,
"resolved"
],
[
"reject",
"fail",
jQuery.Callbacks("once memory"),
jQuery.Callbacks("once memory"),
1,
"rejected"
]
], state = "pending", promise = {
state: function() {
return state;
},
always: function() {
deferred.done(arguments).fail(arguments);
return this;
},
"catch": function(fn2) {
return promise.then(null, fn2);
},
pipe: function() {
var fns = arguments;
return jQuery.Deferred(function(newDefer) {
jQuery.each(tuples, function(_i, tuple2) {
var fn2 = isFunction2(fns[tuple2[4]]) && fns[tuple2[4]];
deferred[tuple2[1]](function() {
var returned = fn2 && fn2.apply(this, arguments);
if (returned && isFunction2(returned.promise)) {
returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
} else {
newDefer[tuple2[0] + "With"](
this,
fn2 ? [returned] : arguments
);
}
});
});
fns = null;
}).promise();
},
then: function(onFulfilled, onRejected, onProgress) {
var maxDepth = 0;
function resolve2(depth, deferred2, handler, special) {
return function() {
var that = this, args = arguments, mightThrow = function() {
var returned, then;
if (depth < maxDepth) {
return;
}
returned = handler.apply(that, args);
if (returned === deferred2.promise()) {
throw new TypeError("Thenable self-resolution");
}
then = returned && (typeof returned === "object" || typeof returned === "function") && returned.then;
if (isFunction2(then)) {
if (special) {
then.call(
returned,
resolve2(maxDepth, deferred2, Identity, special),
resolve2(maxDepth, deferred2, Thrower, special)
);
} else {
maxDepth++;
then.call(
returned,
resolve2(maxDepth, deferred2, Identity, special),
resolve2(maxDepth, deferred2, Thrower, special),
resolve2(
maxDepth,
deferred2,
Identity,
deferred2.notifyWith
)
);
}
} else {
if (handler !== Identity) {
that = void 0;
args = [returned];
}
(special || deferred2.resolveWith)(that, args);
}
}, process2 = special ? mightThrow : function() {
try {
mightThrow();
} catch (e) {
if (jQuery.Deferred.exceptionHook) {
jQuery.Deferred.exceptionHook(
e,
process2.error
);
}
if (depth + 1 >= maxDepth) {
if (handler !== Thrower) {
that = void 0;
args = [e];
}
deferred2.rejectWith(that, args);
}
}
};
if (depth) {
process2();
} else {
if (jQuery.Deferred.getErrorHook) {
process2.error = jQuery.Deferred.getErrorHook();
} else if (jQuery.Deferred.getStackHook) {
process2.error = jQuery.Deferred.getStackHook();
}
window2.setTimeout(process2);
}
};
}
return jQuery.Deferred(function(newDefer) {
tuples[0][3].add(
resolve2(
0,
newDefer,
isFunction2(onProgress) ? onProgress : Identity,
newDefer.notifyWith
)
);
tuples[1][3].add(
resolve2(
0,
newDefer,
isFunction2(onFulfilled) ? onFulfilled : Identity
)
);
tuples[2][3].add(
resolve2(
0,
newDefer,
isFunction2(onRejected) ? onRejected : Thrower
)
);
}).promise();
},
promise: function(obj) {
return obj != null ? jQuery.extend(obj, promise) : promise;
}
}, deferred = {};
jQuery.each(tuples, function(i2, tuple2) {
var list = tuple2[2], stateString = tuple2[5];
promise[tuple2[1]] = list.add;
if (stateString) {
list.add(
function() {
state = stateString;
},
tuples[3 - i2][2].disable,
tuples[3 - i2][3].disable,
tuples[0][2].lock,
tuples[0][3].lock
);
}
list.add(tuple2[3].fire);
deferred[tuple2[0]] = function() {
deferred[tuple2[0] + "With"](this === deferred ? void 0 : this, arguments);
return this;
};
deferred[tuple2[0] + "With"] = list.fireWith;
});
promise.promise(deferred);
if (func) {
func.call(deferred, deferred);
}
return deferred;
},
when: function(singleValue) {
var remaining = arguments.length, i2 = remaining, resolveContexts = Array(i2), resolveValues = slice.call(arguments), primary = jQuery.Deferred(), updateFunc = function(i3) {
return function(value) {
resolveContexts[i3] = this;
resolveValues[i3] = arguments.length > 1 ? slice.call(arguments) : value;
if (!--remaining) {
primary.resolveWith(resolveContexts, resolveValues);
}
};
};
if (remaining <= 1) {
adoptValue(
singleValue,
primary.done(updateFunc(i2)).resolve,
primary.reject,
!remaining
);
if (primary.state() === "pending" || isFunction2(resolveValues[i2] && resolveValues[i2].then)) {
return primary.then();
}
}
while (i2--) {
adoptValue(resolveValues[i2], updateFunc(i2), primary.reject);
}
return primary.promise();
}
});
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
jQuery.Deferred.exceptionHook = function(error, asyncError) {
if (window2.console && window2.console.warn && error && rerrorNames.test(error.name)) {
window2.console.warn(
"jQuery.Deferred exception: " + error.message,
error.stack,
asyncError
);
}
};
jQuery.readyException = function(error) {
window2.setTimeout(function() {
throw error;
});
};
var readyList = jQuery.Deferred();
jQuery.fn.ready = function(fn2) {
readyList.then(fn2).catch(function(error) {
jQuery.readyException(error);
});
return this;
};
jQuery.extend({
isReady: false,
readyWait: 1,
ready: function(wait) {
if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
return;
}
jQuery.isReady = true;
if (wait !== true && --jQuery.readyWait > 0) {
return;
}
readyList.resolveWith(document2, [jQuery]);
}
});
jQuery.ready.then = readyList.then;
function completed() {
document2.removeEventListener("DOMContentLoaded", completed);
window2.removeEventListener("load", completed);
jQuery.ready();
}
if (document2.readyState === "complete" || document2.readyState !== "loading" && !document2.documentElement.doScroll) {
window2.setTimeout(jQuery.ready);
} else {
document2.addEventListener("DOMContentLoaded", completed);
window2.addEventListener("load", completed);
}
var access = function(elems, fn2, key, value, chainable, emptyGet, raw) {
var i2 = 0, len = elems.length, bulk = key == null;
if (toType(key) === "object") {
chainable = true;
for (i2 in key) {
access(elems, fn2, i2, key[i2], true, emptyGet, raw);
}
} else if (value !== void 0) {
chainable = true;
if (!isFunction2(value)) {
raw = true;
}
if (bulk) {
if (raw) {
fn2.call(elems, value);
fn2 = null;
} else {
bulk = fn2;
fn2 = function(elem, _key, value2) {
return bulk.call(jQuery(elem), value2);
};
}
}
if (fn2) {
for (; i2 < len; i2++) {
fn2(
elems[i2],
key,
raw ? value : value.call(elems[i2], i2, fn2(elems[i2], key))
);
}
}
}
if (chainable) {
return elems;
}
if (bulk) {
return fn2.call(elems);
}
return len ? fn2(elems[0], key) : emptyGet;
};
var rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g;
function fcamelCase(_all, letter) {
return letter.toUpperCase();
}
function camelCase3(string) {
return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
}
var acceptData = function(owner) {
return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
};
function Data() {
this.expando = jQuery.expando + Data.uid++;
}
Data.uid = 1;
Data.prototype = {
cache: function(owner) {
var value = owner[this.expando];
if (!value) {
value = {};
if (acceptData(owner)) {
if (owner.nodeType) {
owner[this.expando] = value;
} else {
Object.defineProperty(owner, this.expando, {
value,
configurable: true
});
}
}
}
return value;
},
set: function(owner, data, value) {
var prop, cache = this.cache(owner);
if (typeof data === "string") {
cache[camelCase3(data)] = value;
} else {
for (prop in data) {
cache[camelCase3(prop)] = data[prop];
}
}
return cache;
},
get: function(owner, key) {
return key === void 0 ? this.cache(owner) : owner[this.expando] && owner[this.expando][camelCase3(key)];
},
access: function(owner, key, value) {
if (key === void 0 || key && typeof key === "string" && value === void 0) {
return this.get(owner, key);
}
this.set(owner, key, value);
return value !== void 0 ? value : key;
},
remove: function(owner, key) {
var i2, cache = owner[this.expando];
if (cache === void 0) {
return;
}
if (key !== void 0) {
if (Array.isArray(key)) {
key = key.map(camelCase3);
} else {
key = camelCase3(key);
key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
}
i2 = key.length;
while (i2--) {
delete cache[key[i2]];
}
}
if (key === void 0 || jQuery.isEmptyObject(cache)) {
if (owner.nodeType) {
owner[this.expando] = void 0;
} else {
delete owner[this.expando];
}
}
},
hasData: function(owner) {
var cache = owner[this.expando];
return cache !== void 0 && !jQuery.isEmptyObject(cache);
}
};
var dataPriv = new Data();
var dataUser = new Data();
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g;
function getData(data) {
if (data === "true") {
return true;
}
if (data === "false") {
return false;
}
if (data === "null") {
return null;
}
if (data === +data + "") {
return +data;
}
if (rbrace.test(data)) {
return JSON.parse(data);
}
return data;
}
function dataAttr(elem, key, data) {
var name;
if (data === void 0 && elem.nodeType === 1) {
name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
data = elem.getAttribute(name);
if (typeof data === "string") {
try {
data = getData(data);
} catch (e) {
}
dataUser.set(elem, key, data);
} else {
data = void 0;
}
}
return data;
}
jQuery.extend({
hasData: function(elem) {
return dataUser.hasData(elem) || dataPriv.hasData(elem);
},
data: function(elem, name, data) {
return dataUser.access(elem, name, data);
},
removeData: function(elem, name) {
dataUser.remove(elem, name);
},
_data: function(elem, name, data) {
return dataPriv.access(elem, name, data);
},
_removeData: function(elem, name) {
dataPriv.remove(elem, name);
}
});
jQuery.fn.extend({
data: function(key, value) {
var i2, name, data, elem = this[0], attrs = elem && elem.attributes;
if (key === void 0) {
if (this.length) {
data = dataUser.get(elem);
if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
i2 = attrs.length;
while (i2--) {
if (attrs[i2]) {
name = attrs[i2].name;
if (name.indexOf("data-") === 0) {
name = camelCase3(name.slice(5));
dataAttr(elem, name, data[name]);
}
}
}
dataPriv.set(elem, "hasDataAttrs", true);
}
}
return data;
}
if (typeof key === "object") {
return this.each(function() {
dataUser.set(this, key);
});
}
return access(this, function(value2) {
var data2;
if (elem && value2 === void 0) {
data2 = dataUser.get(elem, key);
if (data2 !== void 0) {
return data2;
}
data2 = dataAttr(elem, key);
if (data2 !== void 0) {
return data2;
}
return;
}
this.each(function() {
dataUser.set(this, key, value2);
});
}, null, value, arguments.length > 1, null, true);
},
removeData: function(key) {
return this.each(function() {
dataUser.remove(this, key);
});
}
});
jQuery.extend({
queue: function(elem, type2, data) {
var queue;
if (elem) {
type2 = (type2 || "fx") + "queue";
queue = dataPriv.get(elem, type2);
if (data) {
if (!queue || Array.isArray(data)) {
queue = dataPriv.access(elem, type2, jQuery.makeArray(data));
} else {
queue.push(data);
}
}
return queue || [];
}
},
dequeue: function(elem, type2) {
type2 = type2 || "fx";
var queue = jQuery.queue(elem, type2), startLength = queue.length, fn2 = queue.shift(), hooks3 = jQuery._queueHooks(elem, type2), next = function() {
jQuery.dequeue(elem, type2);
};
if (fn2 === "inprogress") {
fn2 = queue.shift();
startLength--;
}
if (fn2) {
if (type2 === "fx") {
queue.unshift("inprogress");
}
delete hooks3.stop;
fn2.call(elem, next, hooks3);
}
if (!startLength && hooks3) {
hooks3.empty.fire();
}
},
_queueHooks: function(elem, type2) {
var key = type2 + "queueHooks";
return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
dataPriv.remove(elem, [type2 + "queue", key]);
})
});
}
});
jQuery.fn.extend({
queue: function(type2, data) {
var setter = 2;
if (typeof type2 !== "string") {
data = type2;
type2 = "fx";
setter--;
}
if (arguments.length < setter) {
return jQuery.queue(this[0], type2);
}
return data === void 0 ? this : this.each(function() {
var queue = jQuery.queue(this, type2, data);
jQuery._queueHooks(this, type2);
if (type2 === "fx" && queue[0] !== "inprogress") {
jQuery.dequeue(this, type2);
}
});
},
dequeue: function(type2) {
return this.each(function() {
jQuery.dequeue(this, type2);
});
},
clearQueue: function(type2) {
return this.queue(type2 || "fx", []);
},
promise: function(type2, obj) {
var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i2 = this.length, resolve2 = function() {
if (!--count) {
defer.resolveWith(elements, [elements]);
}
};
if (typeof type2 !== "string") {
obj = type2;
type2 = void 0;
}
type2 = type2 || "fx";
while (i2--) {
tmp = dataPriv.get(elements[i2], type2 + "queueHooks");
if (tmp && tmp.empty) {
count++;
tmp.empty.add(resolve2);
}
}
resolve2();
return defer.promise(obj);
}
});
var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
var cssExpand = ["Top", "Right", "Bottom", "Left"];
var documentElement = document2.documentElement;
var isAttached = function(elem) {
return jQuery.contains(elem.ownerDocument, elem);
}, composed = { composed: true };
if (documentElement.getRootNode) {
isAttached = function(elem) {
return jQuery.contains(elem.ownerDocument, elem) || elem.getRootNode(composed) === elem.ownerDocument;
};
}
var isHiddenWithinTree = function(elem, el) {
elem = el || elem;
return elem.style.display === "none" || elem.style.display === "" && isAttached(elem) && jQuery.css(elem, "display") === "none";
};
function adjustCSS(elem, prop, valueParts, tween) {
var adjusted, scale, maxIterations = 20, currentValue = tween ? function() {
return tween.cur();
} : function() {
return jQuery.css(elem, prop, "");
}, initial = currentValue(), unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"), initialInUnit = elem.nodeType && (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
if (initialInUnit && initialInUnit[3] !== unit) {
initial = initial / 2;
unit = unit || initialInUnit[3];
initialInUnit = +initial || 1;
while (maxIterations--) {
jQuery.style(elem, prop, initialInUnit + unit);
if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
maxIterations = 0;
}
initialInUnit = initialInUnit / scale;
}
initialInUnit = initialInUnit * 2;
jQuery.style(elem, prop, initialInUnit + unit);
valueParts = valueParts || [];
}
if (valueParts) {
initialInUnit = +initialInUnit || +initial || 0;
adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
if (tween) {
tween.unit = unit;
tween.start = initialInUnit;
tween.end = adjusted;
}
}
return adjusted;
}
var defaultDisplayMap = {};
function getDefaultDisplay(elem) {
var temp, doc = elem.ownerDocument, nodeName2 = elem.nodeName, display = defaultDisplayMap[nodeName2];
if (display) {
return display;
}
temp = doc.body.appendChild(doc.createElement(nodeName2));
display = jQuery.css(temp, "display");
temp.parentNode.removeChild(temp);
if (display === "none") {
display = "block";
}
defaultDisplayMap[nodeName2] = display;
return display;
}
function showHide(elements, show) {
var display, elem, values3 = [], index2 = 0, length = elements.length;
for (; index2 < length; index2++) {
elem = elements[index2];
if (!elem.style) {
continue;
}
display = elem.style.display;
if (show) {
if (display === "none") {
values3[index2] = dataPriv.get(elem, "display") || null;
if (!values3[index2]) {
elem.style.display = "";
}
}
if (elem.style.display === "" && isHiddenWithinTree(elem)) {
values3[index2] = getDefaultDisplay(elem);
}
} else {
if (display !== "none") {
values3[index2] = "none";
dataPriv.set(elem, "display", display);
}
}
}
for (index2 = 0; index2 < length; index2++) {
if (values3[index2] != null) {
elements[index2].style.display = values3[index2];
}
}
return elements;
}
jQuery.fn.extend({
show: function() {
return showHide(this, true);
},
hide: function() {
return showHide(this);
},
toggle: function(state) {
if (typeof state === "boolean") {
return state ? this.show() : this.hide();
}
return this.each(function() {
if (isHiddenWithinTree(this)) {
jQuery(this).show();
} else {
jQuery(this).hide();
}
});
}
});
var rcheckableType = /^(?:checkbox|radio)$/i;
var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i;
var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
(function() {
var fragment = document2.createDocumentFragment(), div = fragment.appendChild(document2.createElement("div")), input = document2.createElement("input");
input.setAttribute("type", "radio");
input.setAttribute("checked", "checked");
input.setAttribute("name", "t");
div.appendChild(input);
support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
div.innerHTML = "";
support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
div.innerHTML = "";
support.option = !!div.lastChild;
})();
var wrapMap = {
thead: [1, ""],
col: [2, ""],
tr: [2, ""],
td: [3, ""],
_default: [0, "", ""]
};
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
if (!support.option) {
wrapMap.optgroup = wrapMap.option = [1, ""];
}
function getAll(context, tag) {
var ret;
if (typeof context.getElementsByTagName !== "undefined") {
ret = context.getElementsByTagName(tag || "*");
} else if (typeof context.querySelectorAll !== "undefined") {
ret = context.querySelectorAll(tag || "*");
} else {
ret = [];
}
if (tag === void 0 || tag && nodeName(context, tag)) {
return jQuery.merge([context], ret);
}
return ret;
}
function setGlobalEval(elems, refElements) {
var i2 = 0, l = elems.length;
for (; i2 < l; i2++) {
dataPriv.set(
elems[i2],
"globalEval",
!refElements || dataPriv.get(refElements[i2], "globalEval")
);
}
}
var rhtml = /<|?\w+;/;
function buildFragment(elems, context, scripts, selection, ignored) {
var elem, tmp, tag, wrap, attached, j, fragment = context.createDocumentFragment(), nodes = [], i2 = 0, l = elems.length;
for (; i2 < l; i2++) {
elem = elems[i2];
if (elem || elem === 0) {
if (toType(elem) === "object") {
jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
} else if (!rhtml.test(elem)) {
nodes.push(context.createTextNode(elem));
} else {
tmp = tmp || fragment.appendChild(context.createElement("div"));
tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
wrap = wrapMap[tag] || wrapMap._default;
tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
j = wrap[0];
while (j--) {
tmp = tmp.lastChild;
}
jQuery.merge(nodes, tmp.childNodes);
tmp = fragment.firstChild;
tmp.textContent = "";
}
}
}
fragment.textContent = "";
i2 = 0;
while (elem = nodes[i2++]) {
if (selection && jQuery.inArray(elem, selection) > -1) {
if (ignored) {
ignored.push(elem);
}
continue;
}
attached = isAttached(elem);
tmp = getAll(fragment.appendChild(elem), "script");
if (attached) {
setGlobalEval(tmp);
}
if (scripts) {
j = 0;
while (elem = tmp[j++]) {
if (rscriptType.test(elem.type || "")) {
scripts.push(elem);
}
}
}
}
return fragment;
}
var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
function on3(elem, types, selector, data, fn2, one3) {
var origFn, type2;
if (typeof types === "object") {
if (typeof selector !== "string") {
data = data || selector;
selector = void 0;
}
for (type2 in types) {
on3(elem, type2, selector, data, types[type2], one3);
}
return elem;
}
if (data == null && fn2 == null) {
fn2 = selector;
data = selector = void 0;
} else if (fn2 == null) {
if (typeof selector === "string") {
fn2 = data;
data = void 0;
} else {
fn2 = data;
data = selector;
selector = void 0;
}
}
if (fn2 === false) {
fn2 = returnFalse;
} else if (!fn2) {
return elem;
}
if (one3 === 1) {
origFn = fn2;
fn2 = function(event2) {
jQuery().off(event2);
return origFn.apply(this, arguments);
};
fn2.guid = origFn.guid || (origFn.guid = jQuery.guid++);
}
return elem.each(function() {
jQuery.event.add(this, types, fn2, data, selector);
});
}
jQuery.event = {
global: {},
add: function(elem, types, handler, data, selector) {
var handleObjIn, eventHandle, tmp, events, t2, handleObj, special, handlers, type2, namespaces, origType, elemData = dataPriv.get(elem);
if (!acceptData(elem)) {
return;
}
if (handler.handler) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
if (selector) {
jQuery.find.matchesSelector(documentElement, selector);
}
if (!handler.guid) {
handler.guid = jQuery.guid++;
}
if (!(events = elemData.events)) {
events = elemData.events = /* @__PURE__ */ Object.create(null);
}
if (!(eventHandle = elemData.handle)) {
eventHandle = elemData.handle = function(e) {
return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : void 0;
};
}
types = (types || "").match(rnothtmlwhite) || [""];
t2 = types.length;
while (t2--) {
tmp = rtypenamespace.exec(types[t2]) || [];
type2 = origType = tmp[1];
namespaces = (tmp[2] || "").split(".").sort();
if (!type2) {
continue;
}
special = jQuery.event.special[type2] || {};
type2 = (selector ? special.delegateType : special.bindType) || type2;
special = jQuery.event.special[type2] || {};
handleObj = jQuery.extend({
type: type2,
origType,
data,
handler,
guid: handler.guid,
selector,
needsContext: selector && jQuery.expr.match.needsContext.test(selector),
namespace: namespaces.join(".")
}, handleObjIn);
if (!(handlers = events[type2])) {
handlers = events[type2] = [];
handlers.delegateCount = 0;
if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
if (elem.addEventListener) {
elem.addEventListener(type2, eventHandle);
}
}
}
if (special.add) {
special.add.call(elem, handleObj);
if (!handleObj.handler.guid) {
handleObj.handler.guid = handler.guid;
}
}
if (selector) {
handlers.splice(handlers.delegateCount++, 0, handleObj);
} else {
handlers.push(handleObj);
}
jQuery.event.global[type2] = true;
}
},
remove: function(elem, types, handler, selector, mappedTypes) {
var j, origCount, tmp, events, t2, handleObj, special, handlers, type2, namespaces, origType, elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
if (!elemData || !(events = elemData.events)) {
return;
}
types = (types || "").match(rnothtmlwhite) || [""];
t2 = types.length;
while (t2--) {
tmp = rtypenamespace.exec(types[t2]) || [];
type2 = origType = tmp[1];
namespaces = (tmp[2] || "").split(".").sort();
if (!type2) {
for (type2 in events) {
jQuery.event.remove(elem, type2 + types[t2], handler, selector, true);
}
continue;
}
special = jQuery.event.special[type2] || {};
type2 = (selector ? special.delegateType : special.bindType) || type2;
handlers = events[type2] || [];
tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
origCount = j = handlers.length;
while (j--) {
handleObj = handlers[j];
if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
handlers.splice(j, 1);
if (handleObj.selector) {
handlers.delegateCount--;
}
if (special.remove) {
special.remove.call(elem, handleObj);
}
}
}
if (origCount && !handlers.length) {
if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
jQuery.removeEvent(elem, type2, elemData.handle);
}
delete events[type2];
}
}
if (jQuery.isEmptyObject(events)) {
dataPriv.remove(elem, "handle events");
}
},
dispatch: function(nativeEvent) {
var i2, j, ret, matched, handleObj, handlerQueue, args = new Array(arguments.length), event2 = jQuery.event.fix(nativeEvent), handlers = (dataPriv.get(this, "events") || /* @__PURE__ */ Object.create(null))[event2.type] || [], special = jQuery.event.special[event2.type] || {};
args[0] = event2;
for (i2 = 1; i2 < arguments.length; i2++) {
args[i2] = arguments[i2];
}
event2.delegateTarget = this;
if (special.preDispatch && special.preDispatch.call(this, event2) === false) {
return;
}
handlerQueue = jQuery.event.handlers.call(this, event2, handlers);
i2 = 0;
while ((matched = handlerQueue[i2++]) && !event2.isPropagationStopped()) {
event2.currentTarget = matched.elem;
j = 0;
while ((handleObj = matched.handlers[j++]) && !event2.isImmediatePropagationStopped()) {
if (!event2.rnamespace || handleObj.namespace === false || event2.rnamespace.test(handleObj.namespace)) {
event2.handleObj = handleObj;
event2.data = handleObj.data;
ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
if (ret !== void 0) {
if ((event2.result = ret) === false) {
event2.preventDefault();
event2.stopPropagation();
}
}
}
}
}
if (special.postDispatch) {
special.postDispatch.call(this, event2);
}
return event2.result;
},
handlers: function(event2, handlers) {
var i2, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event2.target;
if (delegateCount && cur.nodeType && !(event2.type === "click" && event2.button >= 1)) {
for (; cur !== this; cur = cur.parentNode || this) {
if (cur.nodeType === 1 && !(event2.type === "click" && cur.disabled === true)) {
matchedHandlers = [];
matchedSelectors = {};
for (i2 = 0; i2 < delegateCount; i2++) {
handleObj = handlers[i2];
sel = handleObj.selector + " ";
if (matchedSelectors[sel] === void 0) {
matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
}
if (matchedSelectors[sel]) {
matchedHandlers.push(handleObj);
}
}
if (matchedHandlers.length) {
handlerQueue.push({ elem: cur, handlers: matchedHandlers });
}
}
}
}
cur = this;
if (delegateCount < handlers.length) {
handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) });
}
return handlerQueue;
},
addProp: function(name, hook3) {
Object.defineProperty(jQuery.Event.prototype, name, {
enumerable: true,
configurable: true,
get: isFunction2(hook3) ? function() {
if (this.originalEvent) {
return hook3(this.originalEvent);
}
} : function() {
if (this.originalEvent) {
return this.originalEvent[name];
}
},
set: function(value) {
Object.defineProperty(this, name, {
enumerable: true,
configurable: true,
writable: true,
value
});
}
});
},
fix: function(originalEvent) {
return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
},
special: {
load: {
noBubble: true
},
click: {
setup: function(data) {
var el = this || data;
if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) {
leverageNative(el, "click", true);
}
return false;
},
trigger: function(data) {
var el = this || data;
if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) {
leverageNative(el, "click");
}
return true;
},
_default: function(event2) {
var target = event2.target;
return rcheckableType.test(target.type) && target.click && nodeName(target, "input") && dataPriv.get(target, "click") || nodeName(target, "a");
}
},
beforeunload: {
postDispatch: function(event2) {
if (event2.result !== void 0 && event2.originalEvent) {
event2.originalEvent.returnValue = event2.result;
}
}
}
}
};
function leverageNative(el, type2, isSetup) {
if (!isSetup) {
if (dataPriv.get(el, type2) === void 0) {
jQuery.event.add(el, type2, returnTrue);
}
return;
}
dataPriv.set(el, type2, false);
jQuery.event.add(el, type2, {
namespace: false,
handler: function(event2) {
var result, saved = dataPriv.get(this, type2);
if (event2.isTrigger & 1 && this[type2]) {
if (!saved) {
saved = slice.call(arguments);
dataPriv.set(this, type2, saved);
this[type2]();
result = dataPriv.get(this, type2);
dataPriv.set(this, type2, false);
if (saved !== result) {
event2.stopImmediatePropagation();
event2.preventDefault();
return result;
}
} else if ((jQuery.event.special[type2] || {}).delegateType) {
event2.stopPropagation();
}
} else if (saved) {
dataPriv.set(this, type2, jQuery.event.trigger(
saved[0],
saved.slice(1),
this
));
event2.stopPropagation();
event2.isImmediatePropagationStopped = returnTrue;
}
}
});
}
jQuery.removeEvent = function(elem, type2, handle) {
if (elem.removeEventListener) {
elem.removeEventListener(type2, handle);
}
};
jQuery.Event = function(src, props) {
if (!(this instanceof jQuery.Event)) {
return new jQuery.Event(src, props);
}
if (src && src.type) {
this.originalEvent = src;
this.type = src.type;
this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === void 0 && src.returnValue === false ? returnTrue : returnFalse;
this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
this.currentTarget = src.currentTarget;
this.relatedTarget = src.relatedTarget;
} else {
this.type = src;
}
if (props) {
jQuery.extend(this, props);
}
this.timeStamp = src && src.timeStamp || Date.now();
this[jQuery.expando] = true;
};
jQuery.Event.prototype = {
constructor: jQuery.Event,
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
isSimulated: false,
preventDefault: function() {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if (e && !this.isSimulated) {
e.preventDefault();
}
},
stopPropagation: function() {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if (e && !this.isSimulated) {
e.stopPropagation();
}
},
stopImmediatePropagation: function() {
var e = this.originalEvent;
this.isImmediatePropagationStopped = returnTrue;
if (e && !this.isSimulated) {
e.stopImmediatePropagation();
}
this.stopPropagation();
}
};
jQuery.each({
altKey: true,
bubbles: true,
cancelable: true,
changedTouches: true,
ctrlKey: true,
detail: true,
eventPhase: true,
metaKey: true,
pageX: true,
pageY: true,
shiftKey: true,
view: true,
"char": true,
code: true,
charCode: true,
key: true,
keyCode: true,
button: true,
buttons: true,
clientX: true,
clientY: true,
offsetX: true,
offsetY: true,
pointerId: true,
pointerType: true,
screenX: true,
screenY: true,
targetTouches: true,
toElement: true,
touches: true,
which: true
}, jQuery.event.addProp);
jQuery.each({ focus: "focusin", blur: "focusout" }, function(type2, delegateType) {
function focusMappedHandler(nativeEvent) {
if (document2.documentMode) {
var handle = dataPriv.get(this, "handle"), event2 = jQuery.event.fix(nativeEvent);
event2.type = nativeEvent.type === "focusin" ? "focus" : "blur";
event2.isSimulated = true;
handle(nativeEvent);
if (event2.target === event2.currentTarget) {
handle(event2);
}
} else {
jQuery.event.simulate(
delegateType,
nativeEvent.target,
jQuery.event.fix(nativeEvent)
);
}
}
jQuery.event.special[type2] = {
setup: function() {
var attaches;
leverageNative(this, type2, true);
if (document2.documentMode) {
attaches = dataPriv.get(this, delegateType);
if (!attaches) {
this.addEventListener(delegateType, focusMappedHandler);
}
dataPriv.set(this, delegateType, (attaches || 0) + 1);
} else {
return false;
}
},
trigger: function() {
leverageNative(this, type2);
return true;
},
teardown: function() {
var attaches;
if (document2.documentMode) {
attaches = dataPriv.get(this, delegateType) - 1;
if (!attaches) {
this.removeEventListener(delegateType, focusMappedHandler);
dataPriv.remove(this, delegateType);
} else {
dataPriv.set(this, delegateType, attaches);
}
} else {
return false;
}
},
_default: function(event2) {
return dataPriv.get(event2.target, type2);
},
delegateType
};
jQuery.event.special[delegateType] = {
setup: function() {
var doc = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc, attaches = dataPriv.get(dataHolder, delegateType);
if (!attaches) {
if (document2.documentMode) {
this.addEventListener(delegateType, focusMappedHandler);
} else {
doc.addEventListener(type2, focusMappedHandler, true);
}
}
dataPriv.set(dataHolder, delegateType, (attaches || 0) + 1);
},
teardown: function() {
var doc = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc, attaches = dataPriv.get(dataHolder, delegateType) - 1;
if (!attaches) {
if (document2.documentMode) {
this.removeEventListener(delegateType, focusMappedHandler);
} else {
doc.removeEventListener(type2, focusMappedHandler, true);
}
dataPriv.remove(dataHolder, delegateType);
} else {
dataPriv.set(dataHolder, delegateType, attaches);
}
}
};
});
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout",
pointerenter: "pointerover",
pointerleave: "pointerout"
}, function(orig, fix) {
jQuery.event.special[orig] = {
delegateType: fix,
bindType: fix,
handle: function(event2) {
var ret, target = this, related = event2.relatedTarget, handleObj = event2.handleObj;
if (!related || related !== target && !jQuery.contains(target, related)) {
event2.type = handleObj.origType;
ret = handleObj.handler.apply(this, arguments);
event2.type = fix;
}
return ret;
}
};
});
jQuery.fn.extend({
on: function(types, selector, data, fn2) {
return on3(this, types, selector, data, fn2);
},
one: function(types, selector, data, fn2) {
return on3(this, types, selector, data, fn2, 1);
},
off: function(types, selector, fn2) {
var handleObj, type2;
if (types && types.preventDefault && types.handleObj) {
handleObj = types.handleObj;
jQuery(types.delegateTarget).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if (typeof types === "object") {
for (type2 in types) {
this.off(type2, selector, types[type2]);
}
return this;
}
if (selector === false || typeof selector === "function") {
fn2 = selector;
selector = void 0;
}
if (fn2 === false) {
fn2 = returnFalse;
}
return this.each(function() {
jQuery.event.remove(this, types, fn2, selector);
});
}
});
var rnoInnerhtml = /