/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import r from"../../../request.js";import e from"../../../core/Error.js";import{parseUrl as s,asValidOptions as i,encode as o}from"../../utils.js";import{addServerVersion as t}from"./serverVersionUtils.js";const n=new Map;async function a(a,m,c,u){n.has(a)||await t(n,a);const p=n.get(a);if((p?.serverVersion??0)<=11.1)throw new e("alterVersion:enterprise-version","versioning API requires ArcGIS Enterprise version 11.2 or higher");if(!m)throw new e("alterVersion:missing-guid","guid for version is missing");const f=s(a),h=c.toJSON(),g=i(f.query,{query:o({...h,f:"json"}),...u,authMode:"immediate",method:"post"});m.startsWith("{")&&(m=m.slice(1,-1));const v=`${f.path}/versions/${m}/alter`,{data:w}=await r(v,g);return!!w&&w.success}export{a as alterVersion,n as serverVersionCacheMap};
