/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import e from"../../core/Error.js";import{isSharedTemplate as t,isSharedTemplateOrMetadata as r}from"../templateUtils.js";import{getSharedTemplateProvider as a}from"./SharedTemplateProvider.js";async function o(o,l){if(null==l)return null;if(t(l))return l.load();if(r(l)){const t=(await import("./SharedTemplate.js")).default,r=a(o,{makeSharedTemplateFromJSON:e=>t.fromJSON(e)}),m=await r.getTemplates({templateIds:[l.templateId],featureService:l.featureService});if(0===m.length)throw new e("editor:failed-to-load-template","Unable to load the provided template");return m[0].load()}return l}export{o as getFullTemplate};
