{"version":3,"sources":["https://lively-kernel.org/lively4/lively4-constraints/src/client/bootlog.js"],"names":["Dexie","Bootlog","current","_current","clear","db","files","constructor","name","bootlogDB","version","stores","logs","upgrade","addLogs","logArray","transaction","ea","put"],"mappings":";;;;;;AAIOA,W;;;;;;;;;;;;;;;;;;AAEQ,YAAMC,OAAN,CAAc;;AAE3B,eAAOC,OAAP,GAAiB;AACf,cAAI,CAAC,KAAKC,QAAV,EAAoB;AAClB,iBAAKA,QAAL,GAAgB,IAAIF,OAAJ,CAAY,SAAZ,CAAhB;AACD;AACD,iBAAO,KAAKE,QAAZ;AACD;;AAEDC,gBAAQ;AACN,eAAKC,EAAL,CAAQC,KAAR,CAAcF,KAAd;AACD;;AAEDG,oBAAYC,IAAZ,EAAkB;AAChB,eAAKA,IAAL,GAAYA,IAAZ;AACA,eAAKH,EAAL,GAAU,KAAKI,SAAL,EAAV;AACD;;AAEDA,oBAAY;AACV,cAAIJ,KAAK,IAAIL,KAAJ,CAAU,KAAKQ,IAAf,CAAT;AACAH,aAAGK,OAAH,CAAW,GAAX,EACGC,MADH,CACU;AACNC,kBAAM;AADA,WADV,EAIGC,OAJH,CAIW,YAAY,CAAE,CAJzB;AAKA,iBAAOR,EAAP;AACD;;AAED,cAAMS,OAAN,CAAcC,QAAd,EAAwB;AACtB,eAAKV,EAAL,CAAQW,WAAR,CAAoB,IAApB,EAA0B,KAAKX,EAAL,CAAQO,IAAlC,EAAwC,MAAM;AAC5C,iBAAI,IAAIK,EAAR,IAAcF,QAAd,EAAwB;AACtB,mBAAKV,EAAL,CAAQO,IAAR,CAAaM,GAAb,CAAiBD,EAAjB;AACD;AACF,WAJD;AAKD;;AAlC0B;;yBAARhB,O","file":"bootlog.js","sourcesContent":["/*\n * Bootlog DB\n *\n */\nimport Dexie from \"src/external/dexie.js\"\n\nexport default class Bootlog {\n\n  static current() {\n    if (!this._current) {\n      this._current = new Bootlog(\"bootlog\")\n    }\n    return this._current\n  }\n  \n  clear() {\n    this.db.files.clear()\n  }\n\n  constructor(name) {\n    this.name = name\n    this.db = this.bootlogDB()\n  }\n\n  bootlogDB() {\n    var db = new Dexie(this.name);\n    db.version(\"1\")\n      .stores({\n        logs: '++id,url, date, mode',\n      })\n      .upgrade(function () {});\n    return db;\n  }\n  \n  async addLogs(logArray) {\n    this.db.transaction(\"rw\", this.db.logs, () => {\n      for(var ea of logArray) {\n        this.db.logs.put(ea)\n      }\n    })\n  }\n\n}\n"]}