/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{A as n}from"../../chunks/ajv.bundle.js";import{json as t}from"../../portal/schemas/webScene.js";import{convertAjvErrors as e}from"../../support/validationUtilsAjv.js";let o=null;function i(n,t){s(t);const o=a();return o.validate(c(t),n)?[]:e(o.errors??[])}function r(n){const e=n?t.definitions[c(n)]:void 0;if(!e)throw new Error(`invalid schema name to validate against '${n}'`);const o={};for(const t in e)o[t]=e[t];return o.definitions=t.definitions,o}function s(n){const t=c(n),e=a();if(!e.getSchema(t)){const o=r(n);e.addSchema(o,t)}}function a(){return o||(o=new n({allErrors:!0,extendRefs:!0}),o.addSchema(t,c()),o)}function c(n){return n?`${n}_schema.json`:"webScene_schema.json"}export{i as validate};
