/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@microsoft/app-manifest@1.1.0/build/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,a,i)}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||__createBinding(t,e,r)},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ManifestUtil=void 0;const ajv_draft_04_1=__importDefault(require("ajv-draft-04")),ajv_formats_1=__importDefault(require("ajv-formats")),_2020_1=__importDefault(require("ajv/dist/2020")),fs_extra_1=__importDefault(require("fs-extra")),fetchHelper_1=__importDefault(require("./fetchHelper")),generated_types_1=require("./generated-types");__exportStar(require("./declarativeCopilotManifest"),exports),__exportStar(require("./generated-types"),exports),__exportStar(require("./manifest"),exports),__exportStar(require("./pluginManifest"),exports),__exportStar(require("./wrappers"),exports);class ManifestUtil{static async loadFromPath(e){const t=await fs_extra_1.default.readFile(e,"utf8");return generated_types_1.TeamsManifestConverter.jsonToManifest(t)}static async loadAndValidateFromPath(e){const t=await this.loadFromPath(e);return[t,await generated_types_1.AppManifestUtils.validateAgainstSchema(t)]}static async writeToPath(e,t){return fs_extra_1.default.writeJson(e,t,{spaces:4})}static validateManifestAgainstSchema(e,t){let r;if(t.$schema?.includes("2020-12")){const e=new _2020_1.default({allErrors:!0,strictTypes:!1});(0,ajv_formats_1.default)(e,["uri","email","regex"]),r=e.compile(t)}else{const e=new ajv_draft_04_1.default({allErrors:!0,strictTypes:!1});(0,ajv_formats_1.default)(e,["uri","email","regex"]),r=e.compile(t)}return!r(e)&&r.errors?Promise.resolve(r.errors?.map((e=>`${e.instancePath} ${e.message||""}. Details: ${e.params?JSON.stringify(e.params):""}`))):Promise.resolve([])}static async fetchSchema(e){const t=e.$schema||e.schema;if(!t)throw new Error("Manifest does not have a $schema property or schema url is not provided.");let r;try{const e=await(0,fetchHelper_1.default)(t),a=(await e.text()).replace(/\\a/g,"\\x07");r=JSON.parse(a)}catch(e){throw e instanceof Error?new Error(`Failed to get manifest at url ${t} due to: ${e.message}`):new Error(`Failed to get manifest at url ${t} due to: unknown error`)}return r}static async validateManifest(e){const t=await this.fetchSchema(e);return ManifestUtil.validateManifestAgainstSchema(e,t)}}exports.ManifestUtil=ManifestUtil;
//# sourceMappingURL=/sm/546a92160cec057e468e7b04da8fa066402cb4a9f584219d639ec7d17adbb1af.map