/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","./get","./utils","./extensions/serializableProperty"],(function(e,t,r,i){"use strict";function n(e,r,i){if(!e||!e.read||!1===e.read.enabled||!e.read.source)return!1;const n=e.read.source;if("string"==typeof n){if(n===r)return!0;if(n.includes(".")&&0===n.indexOf(r)&&t.exists(n,i))return!0}else for(const o of n){if(o===r)return!0;if(o.includes(".")&&0===o.indexOf(r)&&t.exists(o,i))return!0}return!1}function o(e){return e&&(!e.read||!1!==e.read.enabled&&!e.read.source)}function s(e,t,r,s,a){let f=i.originSpecificReadPropertyDefinition(t[r],a);o(f)&&(e[r]=!0);for(const o of Object.getOwnPropertyNames(t))f=i.originSpecificReadPropertyDefinition(t[o],a),n(f,r,s)&&(e[o]=!0)}function a(e,t,r,n){const o=r.metadatas,s=i.originSpecificPropertyDefinition(o[t],"any",n),a=s&&s.default;if(void 0===a)return;const f="function"==typeof a?a.call(e,t,n):a;void 0!==f&&r.set(t,f)}const f={origin:"service"};function c(e,n,o=f){if(!n||"object"!=typeof n)return;const c=r.getProperties(e),u=c.metadatas,d={};for(const t of Object.getOwnPropertyNames(n))s(d,u,t,n,o);c.setDefaultOrigin(o.origin);for(const r of Object.getOwnPropertyNames(d)){const s=i.originSpecificReadPropertyDefinition(u[r],o).read,a=s&&s.source;let f;f=a&&"string"==typeof a?t.valueOf(n,a):n[r],s&&s.reader&&(f=s.reader.call(e,f,n,o)),void 0!==f&&c.set(r,f)}if(!o||!o.ignoreDefaults){c.setDefaultOrigin("defaults");for(const t of Object.getOwnPropertyNames(u))d[t]||a(e,t,c,o)}c.setDefaultOrigin("user")}function u(e,t,r,i=f){var n;const o={...i,messages:[]};r(o),null==(n=o.messages)||n.forEach((t=>{"warning"!==t.type||e.loaded?i&&i.messages&&i.messages.push(t):e.loadWarnings.push(t)}))}e.read=c,e.readLoadable=u,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
