var __spreadArray=this&&this.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var n=0,r=t.length,a;n<r;n++){if(a||!(n in t)){if(!a)a=Array.prototype.slice.call(t,0,n);a[n]=t[n]}}return e.concat(a||Array.prototype.slice.call(t))};System.register(["./p-343b3b10.system.js","./p-fed348c1.system.js","./p-4ef1fed0.system.js","./p-dd23d264.system.js","./p-37c980e2.system.js","./p-2d3773e2.system.js","./p-ece63a69.system.js","./p-5f7bc72e.system.js","./p-a56cdd14.system.js","./p-da593370.system.js","./p-f3cc88e3.system.js","./p-86f17250.system.js","./p-d33249d4.system.js","./p-dd9cd9b3.system.js","./p-fe1f76a3.system.js"],(function(e){"use strict";var t,i,n,r,a,o,l,s,d;return{setters:[function(e){t=e.r;i=e.c;n=e.h;r=e.H},function(e){a=e.D},function(e){o=e.D},function(e){l=e.r},function(e){s=e.D},function(e){d=e.g},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){var c="dvn-field-input-cell-reference{display:-ms-flexbox;display:flex;overflow:auto;padding:0 4px}";var u=function(){var e="prod";var t="mentornity";if(window.location.hostname==="console.qa-one.mentornity.com"){e="qa";t="mentornity-qa"}return"/api-data/".concat(e,"/").concat(t,"/")};var f=e("dvn_field_input_cell_reference",function(){function e(e){t(this,e);this.cellFormCancel=i(this,"cellFormCancel",7);this.cellFormSubmit=i(this,"cellFormSubmit",7)}e.prototype.onAction=function(e){if(e.detail.name==="dvn-field-input-cell-reference.remove-item"){e.stopImmediatePropagation();var t=e.detail.params.item;this.internalValue=this.internalValue.filter((function(e){return e._id!==t._id}))}};e.prototype.componentWillLoad=function(){this.internalValue=this.value||[];this.dataProvider=m(this.field)};e.prototype.render=function(){var e;var t=this;var i=this,o=i.field,s=i.internalValue,d=i.meta;var c=this.value||[];return n(r,null,Array.isArray(c)?c.map((function(e){return l(o,e,d)})):l(o,c,d),n("dvn-dialog",{shown:true,onDismiss:function(){return t.cellFormCancel.emit()}},n("dvn-select",{dataAdapter:new a(o.titleField,"_id"),dataProvider:this.dataProvider,onChange:function(e){var i,n;e.stopImmediatePropagation();var r=(n=(i=t.dataProvider.list)===null||i===void 0?void 0:i.data)===null||n===void 0?void 0:n.find((function(t){return t._id===e.detail}));t.internalValue=__spreadArray(__spreadArray([],t.internalValue,true),[r],false)},leaned:true,width:"100%",value:[]}),n("dvn-list-view-table",{config:{hideHeader:true,separation:1,actions:[{ui:{name:"dvn-field-input-cell-reference.remove-item",buttonType:"icon-button",iconName:"uil uil-trash-alt",tint:"danger",view:"flat"}}],fields:[{fieldId:o.imageField},{fieldId:o.titleField}],columns:(e={},e[o.imageField]={width:50},e)},fields:o.fields,items:s,isEndReached:true}),n("div",{slot:"actions"},n("dvn-button",{view:"flat",onClick:function(e){e.stopImmediatePropagation();t.cellFormCancel.emit()}},"Cancel"),n("dvn-button",{tint:"primary",view:"flat",onClick:function(e){e.stopImmediatePropagation();t.cellFormSubmit.emit({value:t.internalValue,apiValue:t.internalValue.map((function(e){return p(o,e)}))})}},"Save"))))};return e}());function m(e){var t=new o(u(),{Authorization:"Bearer ".concat(d().token)});return new s(t,e.otherCollection,{fields:e.fields,sort:[{id:e.titleField,order:1}]},undefined,{fields:[{fieldId:e.imageField},{fieldId:e.titleField}]})}function p(e,t){var i=t._id;return{_ref:e.otherCollection,_id:i}}f.style=c}}}));