/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{clone as r}from"../../core/lang.js";import t from"../../core/Logger.js";import{urlToObject as o,join as e}from"../../core/urlUtils.js";import{writeUrlWithLayerId as l,sanitizeUrlWithLayerId as n}from"./arcgisLayerUrl.js";import{url as a}from"./commonProperties.js";function i(o){const{nonStandardUrlAllowed:e=!1,separator:i}=o??{},s=r(a),u=s.json?.write;return"object"==typeof u&&u&&(u.writer=function(r,t,o,e){l(this,r,i,t,e)}),{...s,set:function(r){if(null==r)return void this._set("url",r);const o=n({layer:this,url:r,nonStandardUrlAllowed:e,logger:t.getLogger(this)});this._set("url",o.url),null!=o.layerId&&this._set("layerId",o.layerId)}}}function s(r,t){const{separator:l}=t??{},n=o(r.url);return null!=n&&(null!=r.dynamicDataSource?n.path=e(n.path,"dynamicLayer"):null!=r.layerId&&(n.path=e(n.path,l??"",r.layerId.toString()))),n}export{s as normalizeParsedUrlObject,i as urlProperty};
