var PC=PC||{};(r=>{PC.layers=Backbone.Collection.extend({url:function(){var t=ajaxurl+"?action="+PC.actionParameter+"&data=layers";return this.product_id&&(t+="&id="+this.product_id),t+PC.get_ajax_nonce_param()},model:PC.layer,initialize:function(t,e){e&&e.product_id&&(this.product_id=e.product_id)},nextOrder:function(t){return t=t||"order",this.length?parseInt(this.last().get(t))+1:1},comparator:function(t){return this.orderBy?t.get(this.orderBy):t.get("order")},sync:function(t,e,r){},create_layer:function(t){return r.extend(t,{_id:PC.app.get_new_id(this),order:this.nextOrder(),image_order:this.nextOrder("image_order"),active:!0})},get_children:function(t){var e;return t.children||((e=this.where({parent:t.id})).length&&r.each(e,function(t){t=this.get_children(t);t.count&&(e=e.concat(t))}.bind(this)),t.children=e),t.children}})})(PC._us||window._);