var t=class{constructor(t,e){this.registry=e,this.type=t.type,this.name=t.name,this.description=t.description,this.labelNames=t.labelNames||[],this.unit=t.unit,this.aggregator=t.aggregator||e.opts.defaultAggregator,this.lastSnapshot=null,this.dirty=!0,this.values=new Map}setDirty(){this.dirty=!0}clearDirty(){this.dirty=!1}get(t){const e=this.hashingLabels(t);return this.values.get(e)}reset(){throw new Error("Not implemented")}resetAll(){throw new Error("Not implemented")}clear(){this.values=new Map,this.changed()}hashingLabels(t){if(0==this.labelNames.length||null==t||"object"!=typeof t)return"";const e=[];for(let s=0;s<this.labelNames.length;s++){const i=t[this.labelNames[s]];"number"==typeof i?e.push(i):"string"==typeof i?e.push('"'+i+'"'):"boolean"==typeof i?e.push(""+i):e.push("")}return e.join("|")}snapshot(){return!this.dirty&&this.lastSnapshot||(this.lastSnapshot=this.generateSnapshot(),this.clearDirty()),this.lastSnapshot}generateSnapshot(){throw new Error("Not implemented")}changed(t,e,s){this.setDirty(),this.registry.changed(this,t,e,s)}toObject(){return{type:this.type,name:this.name,description:this.description,labelNames:this.labelNames,unit:this.unit,values:this.snapshot()}}};export default t;
//# sourceMappingURL=base.js.map
