import { A, E as E2, F, G as G2, I as I2, J as J2, K, M as M2, N, O, P, S, U, V, W, b, d as d2, g, h, j as j2, k, l as l2, m as m3, p as p2, q, v as v2, w, x, y } from "./chunk-UDNYCFF2.js"; import { e, l, s, u } from "./chunk-HEFAWVPH.js"; import { a, c, r } from "./chunk-PJ6KSXOD.js"; import { E, G, I, J, L, Se, X, ge, he, ne, oe, se, ye, z } from "./chunk-25BNEBXZ.js"; import { z as z2 } from "./chunk-O4FY3ITT.js"; import { d } from "./chunk-2Z6LERTI.js"; import { m, m2, v2 as v } from "./chunk-OWVBLVP3.js"; import { s as s2 } from "./chunk-R5IG2D6H.js"; import { M2 as M, j2 as j, p } from "./chunk-ECW2QABR.js"; // node_modules/@arcgis/core/arcade/functions/geomasync.js function ln(t) { return s2.indexOf("4.") === 0 ? v.fromExtent(t) : new v({ spatialReference: t.spatialReference, rings: [[[t.xmin, t.ymin], [t.xmin, t.ymax], [t.xmax, t.ymax], [t.xmax, t.ymin], [t.xmin, t.ymin]]] }); } function un(n) { if (G(n, 2, 2), n[0] instanceof p && n[1] instanceof p) ; else if (n[0] instanceof p && n[1] === null) ; else if (n[1] instanceof p && n[0] === null) ; else if (n[0] !== null || n[1] !== null) throw new Error("Illegal Argument"); } async function an(n, t) { if (n.type !== "polygon" && n.type !== "polyline" && n.type !== "extent") return 0; let r2 = 1; if (n.spatialReference.vcsWkid || n.spatialReference.latestVcsWkid) { r2 = s(n.spatialReference) / z2(n.spatialReference); } let e2 = 0; if (n.type === "polyline") for (const o of n.paths) for (let n2 = 1; n2 < o.length; n2++) e2 += e(o[n2], o[n2 - 1], r2); else if (n.type === "polygon") for (const o of n.rings) { for (let n2 = 1; n2 < o.length; n2++) e2 += e(o[n2], o[n2 - 1], r2); (o[0][0] !== o[o.length - 1][0] || o[0][1] !== o[o.length - 1][1] || o[0][2] !== void 0 && o[0][2] !== o[o.length - 1][2]) && (e2 += e(o[0], o[o.length - 1], r2)); } else n.type === "extent" && (e2 += 2 * e([n.xmin, n.ymin, 0], [n.xmax, n.ymin, 0], r2), e2 += 2 * e([n.xmin, n.ymin, 0], [n.xmin, n.ymax, 0], r2), e2 *= 2, e2 += 4 * Math.abs(I(n.zmax, 0) * r2 - I(n.zmin, 0) * r2)); const i = new m2({ hasZ: false, hasM: false, spatialReference: n.spatialReference, paths: [[0, 0], [0, e2]] }); return F(i, t); } function sn(n) { n.mode === "async" && (n.functions.disjoint = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { return un(r3 = ye(r3)), r3[0] === null || r3[1] === null || S(r3[0], r3[1]); }); }, n.functions.intersects = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { return un(r3 = ye(r3)), r3[0] !== null && r3[1] !== null && g(r3[0], r3[1]); }); }, n.functions.touches = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { return un(r3 = ye(r3)), r3[0] !== null && r3[1] !== null && A(r3[0], r3[1]); }); }, n.functions.crosses = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { return un(r3 = ye(r3)), r3[0] !== null && r3[1] !== null && w(r3[0], r3[1]); }); }, n.functions.within = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { return un(r3 = ye(r3)), r3[0] !== null && r3[1] !== null && x(r3[0], r3[1]); }); }, n.functions.contains = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { return un(r3 = ye(r3)), r3[0] !== null && r3[1] !== null && p2(r3[0], r3[1]); }); }, n.functions.overlaps = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { return un(r3 = ye(r3)), r3[0] !== null && r3[1] !== null && O(r3[0], r3[1]); }); }, n.functions.equals = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { return G(r3, 2, 2), r3[0] === r3[1] || (r3[0] instanceof p && r3[1] instanceof p ? d2(r3[0], r3[1]) : !(!z(r3[0]) || !z(r3[1])) && r3[0].getTime() === r3[1].getTime()); }); }, n.functions.relate = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { if (r3 = ye(r3), G(r3, 3, 3), r3[0] instanceof p && r3[1] instanceof p) return h(r3[0], r3[1], X(r3[2])); if (r3[0] instanceof p && r3[1] === null) return false; if (r3[1] instanceof p && r3[0] === null) return false; if (r3[0] === null && r3[1] === null) return false; throw new Error("Illegal Argument"); }); }, n.functions.intersection = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { return un(r3 = ye(r3)), r3[0] === null || r3[1] === null ? null : k(r3[0], r3[1]); }); }, n.functions.union = function(r2, e2) { return n.standardFunctionAsync(r2, e2, function(n2, e3, o) { const l3 = []; if ((o = ye(o)).length === 0) throw new Error("Function called with wrong number of Parameters"); if (o.length === 1) if (L(o[0])) { const n3 = ye(o[0]); for (let t = 0; t < n3.length; t++) if (n3[t] !== null) { if (!(n3[t] instanceof p)) throw new Error("Illegal Argument"); l3.push(n3[t]); } } else { if (!E(o[0])) { if (o[0] instanceof p) return se(c(o[0]), r2.spatialReference); if (o[0] === null) return null; throw new Error("Illegal Argument"); } { const n3 = ye(o[0].toArray()); for (let t = 0; t < n3.length; t++) if (n3[t] !== null) { if (!(n3[t] instanceof p)) throw new Error("Illegal Argument"); l3.push(n3[t]); } } } else for (let t = 0; t < o.length; t++) if (o[t] !== null) { if (!(o[t] instanceof p)) throw new Error("Illegal Argument"); l3.push(o[t]); } return l3.length === 0 ? null : I2(l3); }); }, n.functions.difference = function(r2, e2) { return n.standardFunctionAsync(r2, e2, function(n2, r3, e3) { return un(e3 = ye(e3)), e3[0] !== null && e3[1] === null ? c(e3[0]) : e3[0] === null ? null : E2(e3[0], e3[1]); }); }, n.functions.symmetricdifference = function(r2, e2) { return n.standardFunctionAsync(r2, e2, function(n2, r3, e3) { return un(e3 = ye(e3)), e3[0] === null && e3[1] === null ? null : e3[0] === null ? c(e3[1]) : e3[1] === null ? c(e3[0]) : j2(e3[0], e3[1]); }); }, n.functions.clip = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { if (r3 = ye(r3), G(r3, 2, 2), !(r3[1] instanceof M) && r3[1] !== null) throw new Error("Illegal Argument"); if (r3[0] === null) return null; if (!(r3[0] instanceof p)) throw new Error("Illegal Argument"); return r3[1] === null ? null : l2(r3[0], r3[1]); }); }, n.functions.cut = function(r2, e2) { return n.standardFunctionAsync(r2, e2, function(n2, r3, e3) { if (e3 = ye(e3), G(e3, 2, 2), !(e3[1] instanceof m2) && e3[1] !== null) throw new Error("Illegal Argument"); if (e3[0] === null) return []; if (!(e3[0] instanceof p)) throw new Error("Illegal Argument"); return e3[1] === null ? [c(e3[0])] : y(e3[0], e3[1]); }); }, n.functions.area = function(t, e2) { return n.standardFunctionAsync(t, e2, async function(n2, e3, l3) { if (G(l3, 1, 2), (l3 = ye(l3))[0] === null) return 0; if (J(l3[0])) { const n3 = await l3[0].sumArea(r(I(l3[1], -1)), false, t.abortSignal); if (t.abortSignal.aborted) throw new Error("Operation has been cancelled."); return n3; } if (L(l3[0]) || E(l3[0])) { const n3 = ge(l3[0], t.spatialReference); return n3 === null ? 0 : W(n3, r(I(l3[1], -1))); } if (!(l3[0] instanceof p)) throw new Error("Illegal Argument"); return W(l3[0], r(I(l3[1], -1))); }); }, n.functions.areageodetic = function(t, e2) { return n.standardFunctionAsync(t, e2, async function(n2, e3, l3) { if (G(l3, 1, 2), (l3 = ye(l3))[0] === null) return 0; if (J(l3[0])) { const n3 = await l3[0].sumArea(r(I(l3[1], -1)), true, t.abortSignal); if (t.abortSignal.aborted) throw new Error("Operation has been cancelled."); return n3; } if (L(l3[0]) || E(l3[0])) { const n3 = ge(l3[0], t.spatialReference); return n3 === null ? 0 : K(n3, r(I(l3[1], -1))); } if (!(l3[0] instanceof p)) throw new Error("Illegal Argument"); return K(l3[0], r(I(l3[1], -1))); }); }, n.functions.length = function(t, r2) { return n.standardFunctionAsync(t, r2, async function(n2, r3, l3) { if (G(l3, 1, 2), (l3 = ye(l3))[0] === null) return 0; if (J(l3[0])) { const n3 = await l3[0].sumLength(a(I(l3[1], -1)), false, t.abortSignal); if (t.abortSignal.aborted) throw new Error("Operation has been cancelled."); return n3; } if (L(l3[0]) || E(l3[0])) { const n3 = he(l3[0], t.spatialReference); return n3 === null ? 0 : F(n3, a(I(l3[1], -1))); } if (!(l3[0] instanceof p)) throw new Error("Illegal Argument"); return F(l3[0], a(I(l3[1], -1))); }); }, n.functions.length3d = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, r3, l3) { if (G(l3, 1, 2), (l3 = ye(l3))[0] === null) return 0; if (L(l3[0]) || E(l3[0])) { const n3 = he(l3[0], t.spatialReference); return n3 === null ? 0 : n3.hasZ === true ? an(n3, a(I(l3[1], -1))) : F(n3, a(I(l3[1], -1))); } if (!(l3[0] instanceof p)) throw new Error("Illegal Argument"); return l3[0].hasZ === true ? an(l3[0], a(I(l3[1], -1))) : F(l3[0], a(I(l3[1], -1))); }); }, n.functions.lengthgeodetic = function(t, r2) { return n.standardFunctionAsync(t, r2, async function(n2, r3, l3) { if (G(l3, 1, 2), (l3 = ye(l3))[0] === null) return 0; if (J(l3[0])) { const n3 = await l3[0].sumLength(a(I(l3[1], -1)), true, t.abortSignal); if (t.abortSignal.aborted) throw new Error("Operation has been cancelled."); return n3; } if (L(l3[0]) || E(l3[0])) { const n3 = he(l3[0], t.spatialReference); return n3 === null ? 0 : M2(n3, a(I(l3[1], -1))); } if (!(l3[0] instanceof p)) throw new Error("Illegal Argument"); return M2(l3[0], a(I(l3[1], -1))); }); }, n.functions.distance = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, r3, l3) { l3 = ye(l3), G(l3, 2, 3); let u2 = l3[0]; (L(l3[0]) || E(l3[0])) && (u2 = Se(l3[0], t.spatialReference)); let c2 = l3[1]; if ((L(l3[1]) || E(l3[1])) && (c2 = Se(l3[1], t.spatialReference)), !(u2 instanceof p)) throw new Error("Illegal Argument"); if (!(c2 instanceof p)) throw new Error("Illegal Argument"); return m3(u2, c2, a(I(l3[2], -1))); }); }, n.functions.distancegeodetic = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { r3 = ye(r3), G(r3, 2, 3); const l3 = r3[0], u2 = r3[1]; if (!(l3 instanceof j)) throw new Error("Illegal Argument"); if (!(u2 instanceof j)) throw new Error("Illegal Argument"); const a2 = new m2({ paths: [], spatialReference: l3.spatialReference }); return a2.addPath([l3, u2]), M2(a2, a(I(r3[2], -1))); }); }, n.functions.densify = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { if (r3 = ye(r3), G(r3, 2, 3), r3[0] === null) return null; if (!(r3[0] instanceof p)) throw new Error("Illegal Argument"); const l3 = ne(r3[1]); if (isNaN(l3)) throw new Error("Illegal Argument"); if (l3 <= 0) throw new Error("Illegal Argument"); return r3[0] instanceof v || r3[0] instanceof m2 ? P(r3[0], l3, a(I(r3[2], -1))) : r3[0] instanceof M ? P(ln(r3[0]), l3, a(I(r3[2], -1))) : r3[0]; }); }, n.functions.densifygeodetic = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { if (r3 = ye(r3), G(r3, 2, 3), r3[0] === null) return null; if (!(r3[0] instanceof p)) throw new Error("Illegal Argument"); const l3 = ne(r3[1]); if (isNaN(l3)) throw new Error("Illegal Argument"); if (l3 <= 0) throw new Error("Illegal Argument"); return r3[0] instanceof v || r3[0] instanceof m2 ? U(r3[0], l3, a(I(r3[2], -1))) : r3[0] instanceof M ? U(ln(r3[0]), l3, a(I(r3[2], -1))) : r3[0]; }); }, n.functions.generalize = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { if (r3 = ye(r3), G(r3, 2, 4), r3[0] === null) return null; if (!(r3[0] instanceof p)) throw new Error("Illegal Argument"); const l3 = ne(r3[1]); if (isNaN(l3)) throw new Error("Illegal Argument"); return G2(r3[0], l3, oe(I(r3[2], true)), a(I(r3[3], -1))); }); }, n.functions.buffer = function(r2, l3) { return n.standardFunctionAsync(r2, l3, function(n2, r3, l4) { if (l4 = ye(l4), G(l4, 2, 3), l4[0] === null) return null; if (!(l4[0] instanceof p)) throw new Error("Illegal Argument"); const u2 = ne(l4[1]); if (isNaN(u2)) throw new Error("Illegal Argument"); return u2 === 0 ? c(l4[0]) : V(l4[0], u2, a(I(l4[2], -1))); }); }, n.functions.buffergeodetic = function(r2, l3) { return n.standardFunctionAsync(r2, l3, function(n2, r3, l4) { if (l4 = ye(l4), G(l4, 2, 3), l4[0] === null) return null; if (!(l4[0] instanceof p)) throw new Error("Illegal Argument"); const u2 = ne(l4[1]); if (isNaN(u2)) throw new Error("Illegal Argument"); return u2 === 0 ? c(l4[0]) : b(l4[0], u2, a(I(l4[2], -1))); }); }, n.functions.offset = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { if (r3 = ye(r3), G(r3, 2, 6), r3[0] === null) return null; if (!(r3[0] instanceof v || r3[0] instanceof m2)) throw new Error("Illegal Argument"); const l3 = ne(r3[1]); if (isNaN(l3)) throw new Error("Illegal Argument"); const a2 = ne(I(r3[4], 10)); if (isNaN(a2)) throw new Error("Illegal Argument"); const s3 = ne(I(r3[5], 0)); if (isNaN(s3)) throw new Error("Illegal Argument"); return v2(r3[0], l3, a(I(r3[2], -1)), X(I(r3[3], "round")).toLowerCase(), a2, s3); }); }, n.functions.rotate = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { r3 = ye(r3), G(r3, 2, 3); let e2 = r3[0]; if (e2 === null) return null; if (!(e2 instanceof p)) throw new Error("Illegal Argument"); e2 instanceof M && (e2 = v.fromExtent(e2)); const l3 = ne(r3[1]); if (isNaN(l3)) throw new Error("Illegal Argument"); const u2 = I(r3[2], null); if (u2 === null) return q(e2, l3); if (u2 instanceof j) return q(e2, l3, u2); throw new Error("Illegal Argument"); }); }, n.functions.centroid = function(r2, e2) { return n.standardFunctionAsync(r2, e2, function(n2, e3, l3) { if (l3 = ye(l3), G(l3, 1, 1), l3[0] === null) return null; let u2 = l3[0]; if ((L(l3[0]) || E(l3[0])) && (u2 = Se(l3[0], r2.spatialReference)), u2 === null) return null; if (!(u2 instanceof p)) throw new Error("Illegal Argument"); return u2 instanceof j ? se(c(l3[0]), r2.spatialReference) : u2 instanceof v ? u2.centroid : u2 instanceof m2 ? l(u2) : u2 instanceof m ? u(u2) : u2 instanceof M ? u2.center : null; }); }, n.functions.multiparttosinglepart = function(r2, e2) { return n.standardFunctionAsync(r2, e2, async function(n2, e3, l3) { l3 = ye(l3), G(l3, 1, 1); const u2 = []; if (l3[0] === null) return null; if (!(l3[0] instanceof p)) throw new Error("Illegal Argument"); if (l3[0] instanceof j) return [se(c(l3[0]), r2.spatialReference)]; if (l3[0] instanceof M) return [se(c(l3[0]), r2.spatialReference)]; const a2 = await N(l3[0]); if (a2 instanceof v) { const n3 = [], t = []; for (let r3 = 0; r3 < a2.rings.length; r3++) if (a2.isClockwise(a2.rings[r3])) { const t2 = d({ rings: [a2.rings[r3]], hasZ: a2.hasZ === true, hazM: a2.hasM === true, spatialReference: a2.spatialReference.toJSON() }); n3.push(t2); } else t.push({ ring: a2.rings[r3], pt: a2.getPoint(r3, 0) }); for (let r3 = 0; r3 < t.length; r3++) for (let e4 = 0; e4 < n3.length; e4++) if (n3[e4].contains(t[r3].pt)) { n3[e4].addRing(t[r3].ring); break; } return n3; } if (a2 instanceof m2) { const n3 = []; for (let t = 0; t < a2.paths.length; t++) { const r3 = d({ paths: [a2.paths[t]], hasZ: a2.hasZ === true, hazM: a2.hasM === true, spatialReference: a2.spatialReference.toJSON() }); n3.push(r3); } return n3; } if (l3[0] instanceof m) { const n3 = se(c(l3[0]), r2.spatialReference); for (let t = 0; t < n3.points.length; t++) u2.push(n3.getPoint(t)); return u2; } return null; }); }, n.functions.issimple = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { if (r3 = ye(r3), G(r3, 1, 1), r3[0] === null) return true; if (!(r3[0] instanceof p)) throw new Error("Illegal Argument"); return J2(r3[0]); }); }, n.functions.simplify = function(t, r2) { return n.standardFunctionAsync(t, r2, function(n2, t2, r3) { if (r3 = ye(r3), G(r3, 1, 1), r3[0] === null) return null; if (!(r3[0] instanceof p)) throw new Error("Illegal Argument"); return N(r3[0]); }); }); } export { sn }; //# sourceMappingURL=chunk-V7YK62XD.js.map