(function(){"use strict";u8.Crm.QueryRecordSelector=function(e){this.RecordSelector(e);$assert(this.from&&this.from.queryName,"Missing property 'queryname'")};$.extend(u8.Crm.QueryRecordSelector.prototype,{_showSelector:function(){var e={mode:"select",menu:"M_QuerySelectRecord",query:this.from.queryName};var r=this.from.infoAreaId,t=u8.services.navigation.getPageUrl("QueryRun",e);this._popup=new u8.Base.Widgets.Popup(t,{title:u8.services.schema.idToLabelPlural(r)||"",__data:{infoAreaId:r},commandBindings:{Select:this._onCommandSelect.bind(this)},size:{width:670,height:400},onClose:this._onSelectorClose.bind(this)});this._popup.open()},_onCommandSelect:function(e,r,t){this._popup.close({selection:{uid:t.uid,uids:t.uids}})}});u8.Crm.QueryRecordSelector.makeClass({name:"QueryRecordSelector",deriveFrom:u8.Crm.RecordSelector});u8.services.ready("selectors",function(){u8.services.selectors.register("selectRecordFromQuery",{execute:function(e,r){var t=new u8.Crm.QueryRecordSelector(e);t.execute(r);return t},prepareOptions:function(e,r){var t=e;if(r){if(!t.from){var i=r.schema;$assert(i,"Required field schema information missing for record selector.");t.from={infoAreaId:i.link.destinationInfoAreaId}}if(!t.target){t.target={infoAreaId:r.infoAreaId,uid:r.uid,linkFieldSchema:r.schema,fieldId:r.fieldId};if(t.target.linkFieldSchema){t.target.addLink=true}}t.target.adapter=r.adapter}return t}})})})();