(function(){var t,e;t=this,e=function(t){"use strict";t.Config={},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RB=t.RB||{}),RB.Config.ResourceListItem=Djblets.Config.ListItem.extend({defaults:_.defaults({resource:null},Djblets.Config.ListItem.prototype.defaults),syncAttrs:[],initialize(){let t=this.get("resource");t?this.set(_.pick(t.attributes,this.syncAttrs)):(t=this.createResource(_.extend({id:this.get("id")},_.pick(this.attributes,this.syncAttrs))),this.set("resource",t)),this.resource=t,Djblets.Config.ListItem.prototype.initialize.apply(this,arguments),this.listenTo(t,"request",(...t)=>this.trigger("request",...t)),this.listenTo(t,"sync",(...t)=>this.trigger("sync",...t)),this.listenTo(t,"destroy",this.destroy),this.syncAttrs.forEach(e=>this.listenTo(t,`change:${e}`,(t,s)=>this.set(e,s)))},createResource(){console.assert(!1,"createResource must be implemented")},destroy(t={}){this.stopListening(this.resource),this.trigger("destroy",this,this.collection,t),_.isFunction(t.success)&&t.success(this,null,t)}})}).call(this);
