define(["require","exports","tslib","../../Validation","../../forms/utils","../../TemplateUtils"],function(e,t,l,d,m,v){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),v=l.__importStar(v);o.prototype._isLabelFieldName=function(e,t){return void 0!==(t&&0<t.length?t[0][e]:void 0)},o.prototype._getTokenValues=function(e,t){for(var l={},o=0,a=e;o<a.length;o++){var i,n=a[o].token;l.hasOwnProperty(n)||(i=t[n],i=v.getTokenValueString(n,i),l[n]=m.text.escapeTextForMarkdown(i))}return l},o.prototype.execute=function(e,t){for(var l=e.labelFieldName||void 0,o=d.validation.array("collection",e.collection,d.validation.never),a={},i=this._isLabelFieldName(l,o),n=i?[]:v.findTokenInstances(l),r=0;r<o.length;++r){var s=o[r],u=void 0;null==(u=i?s[e.labelFieldName]:l?(c=this._getTokenValues(n,s),v.replacePlaceholders(l,n,c)):s)&&(u="");var c={};e.valueFieldName?c.value=s[e.valueFieldName]:c.value={refValueType:"data",type:"object",data:s},m.text.isMarkdown(u)?c.label=u:c.label=u.toString(),a[r]=c}return{items:a}},o.action="gcx:wf:forms::GetFormElementItemsFromCollection",o.suite="gcx:wf:builtin",l=o;function o(){}t.GetFormElementItemsFromCollection=l});