import { F, K, Q, X, _, b, vt, z } from "./chunk-VBRY5KJM.js"; import { r } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/chunks/persistableUrlUtils.js function i(e, o) { const s = o && o.url && o.url.path; if (e && s && (e = Q(e, s, { preserveProtocolRelative: true }), o.portalItem && o.readResourcePaths)) { const r2 = _(e, o.portalItem.itemUrl); v.test(r2) && o.readResourcePaths.push(o.portalItem.resourceFromPath(r2).path); } return y(e, o && o.portal); } function c(e, a, u = I.YES) { if (!e) return e; !K(e) && a && a.blockedRelativeUrls && a.blockedRelativeUrls.push(e); let n = Q(e); if (a) { const r2 = a.verifyItemRelativeUrls && a.verifyItemRelativeUrls.rootPath || a.url && a.url.path; if (r2) { const o = y(r2, a.portal); n = _(y(n, a.portal), o, o), n !== e && a.verifyItemRelativeUrls && a.verifyItemRelativeUrls.writtenUrls.push(n); } } return n = U(n, a && a.portal), K(n) && (n = F(n)), a?.resources && a?.portalItem && !K(n) && !X(n) && u === I.YES && a.resources.toKeep.push({ resource: a.portalItem.resourceFromPath(n) }), n; } function m(e, r2, t) { return i(e, t); } function p(e, r2, t, o) { const s = c(e, o); s !== void 0 && (r2[t] = s); } var f = /\/items\/([^\/]+)\/resources\//; var v = /^\.\/resources\//; function h(r2) { const t = r(r2) ? r2.match(f) : null; return r(t) ? t[1] : null; } function U(e, r2) { return r2 && !r2.isPortal && r2.urlKey && r2.customBaseUrl ? vt(e, `${r2.urlKey}.${r2.customBaseUrl}`, r2.portalHostname) : e; } function y(e, r2) { if (!r2 || r2.isPortal || !r2.urlKey || !r2.customBaseUrl) return e; const t = `${r2.urlKey}.${r2.customBaseUrl}`, o = b(); return z(o, `${o.scheme}://${t}`) ? vt(e, r2.portalHostname, t) : vt(e, t, r2.portalHostname); } var I; !function(e) { e[e.YES = 0] = "YES", e[e.NO = 1] = "NO"; }(I || (I = {})); var R = Object.freeze(Object.defineProperty({ __proto__: null, fromJSON: i, toJSON: c, read: m, write: p, itemIdFromResourceUrl: h, ensureMainOnlineDomain: U, get MarkKeep() { return I; } }, Symbol.toStringTag, { value: "Module" })); export { i, c, m, p, h, U, I, R }; //# sourceMappingURL=chunk-65BYCSII.js.map