/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../chunks/_rollupPluginBabelHelpers","../../chunks/tslib.es6","../../core/accessorSupport/decorators/aliasOf","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/property","../../core/accessorSupport/decorators/subclass","../Widget","./FeatureContent/FeatureContentViewModel","./support/featureUtils","../support/widget","../support/jsxFactory"],(function(e,r,t,o,a,s,n,i,d,c,l,u,p){"use strict";const h={base:"esri-feature-content",loaderContainer:"esri-feature-content__loader-container",loader:"esri-feature-content__loader"};let f=function(r){function t(e,t){var o;return(o=r.call(this,e,t)||this).creator=null,o.graphic=null,o.viewModel=null,o._addTargetToAnchors=e=>{Array.from(e.querySelectorAll("a")).forEach((e=>{l.shouldOpenInNewTab(e.href)&&!e.hasAttribute("target")&&e.setAttribute("target","_blank")}))},o}e._inheritsLoose(t,r);var o=t.prototype;return o.renderLoading=function(){return p.tsx("div",{class:h.loaderContainer,key:"loader"},p.tsx("div",{class:h.loader}))},o.renderCreated=function(){var e;const r=null==(e=this.viewModel)?void 0:e.created;return r?r instanceof HTMLElement?p.tsx("div",{key:r,bind:r,afterCreate:this._attachToNode}):u.isWidget(r)?p.tsx("div",{key:r},!r.destroyed&&r.render()):p.tsx("div",{key:r,innerHTML:r,afterCreate:this._addTargetToAnchors}):null},o.render=function(){var e;const r=null==(e=this.viewModel)?void 0:e.state;return p.tsx("div",{class:h.base},"loading"===r?this.renderLoading():this.renderCreated())},o._attachToNode=function(e){const r=this;e.appendChild(r)},t}(d);r.__decorate([t.aliasOf("viewModel.creator")],f.prototype,"creator",void 0),r.__decorate([t.aliasOf("viewModel.graphic")],f.prototype,"graphic",void 0),r.__decorate([n.property({type:c})],f.prototype,"viewModel",void 0),f=r.__decorate([i.subclass("esri.widgets.Feature.FeatureContent")],f);return f}));
