/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../chunks/_rollupPluginBabelHelpers","../../PopupTemplate","../../core/Error","../../intl/messages","./support/utils","../../support/popupUtils"],(function(e,n,r,t,s,i,l){"use strict";function p(e){return o.apply(this,arguments)}function o(){return(o=n._asyncToGenerator((function*(e){const{layer:n,renderer:r}=e;yield n.load();const s=r||n.renderer;if("simple"!==s.type)throw new t("simple-popup:invalid-parameters","renderer.type must be 'simple'");return{layer:n,renderer:s}}))).apply(this,arguments)}function a(e,n){return u.apply(this,arguments)}function u(){return(u=n._asyncToGenerator((function*(e,n,t="divide"){const{fieldInfos:s,expressionInfos:l}=yield i.getFieldAndExpressionInfos({renderer:e,layer:n,normFieldExpressionTemplate:t});return new r({content:yield i.getContentFromFieldInfos(n,{fieldInfos:s,expressionInfos:l}),expressionInfos:l,fieldInfos:s})}))).apply(this,arguments)}function m(e){return d.apply(this,arguments)}function d(){return(d=n._asyncToGenerator((function*(e){const[{renderer:n,layer:r},t]=yield Promise.all([p(e),s.fetchMessageBundle("esri/smartMapping/t9n/smartMapping")]),o=[];if(!i.getPrimaryVisualVariables(n).length){const e=l.createPopupTemplate(r);return e?{primaryTemplate:{name:"simple",title:t.simple,value:e},secondaryTemplates:o}:null}const u={name:"simple",title:t.simple,value:yield a(n,r)};return i.hasNormalizedField(n)&&o.push({name:"simple-percent",title:t.simpleNormFieldAsPercent,value:yield a(n,r,"percentage")}),{primaryTemplate:u,secondaryTemplates:o}}))).apply(this,arguments)}e.getTemplates=m,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
