!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("remotestoragejs"));else if("function"==typeof define&&define.amd)define(["remotestoragejs"],e);else{var n=e("object"==typeof exports?require("remotestoragejs"):t.RemoteStorage);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e0){var h=o(Math.max.apply(Math,r(a)).toString());return t.client.getObject(e+h)}return t.client.getListing(n).then(function(e){var s=Object.keys(e).map(function(t){return parseInt(t.substr(0,2))}).map(function(e){return e0){var a=o(Math.max.apply(Math,r(s)).toString());return t.client.getListing(n+a+"/").then(function(e){var i=Object.keys(e).map(function(t){return parseInt(t)}),s=o(Math.max.apply(Math,r(i)).toString());return t.client.getObject(n+a+"/"+s)})}return t.client.getListing(i).then(function(e){var n=Object.keys(e).map(function(t){return parseInt(t.substr(0,4))}).map(function(e){return e0){var s=Math.max.apply(Math,r(n)).toString();return t.client.getListing(i+s+"/").then(function(e){var n=Object.keys(e).map(function(t){return parseInt(t.substr(0,2))}),a=o(Math.max.apply(Math,r(n)).toString());return t.client.getListing(i+s+"/"+a+"/").then(function(e){var n=Object.keys(e).map(function(t){return parseInt(t)}),h=o(Math.max.apply(Math,r(n)).toString());return t.client.getObject(i+s+"/"+a+"/"+h)})})}return!1})})})},_sync:function(t){return s.log("[chat-messages] Writing archive object",t),this.client.storeObject("daily-archive",this.path,t).then(function(){return s.log("[chat-messages] Archive written to remote storage"),!0},function(t){return console.log("[chat-messages] Error trying to store object",t),t})}};var o=function(t){return t=String(t),1===t.length&&(t="0"+t),t},h=function(t){return{year:t.getUTCFullYear(),month:o(t.getUTCMonth()+1),day:o(t.getUTCDate())}},c={DailyArchive:a,privateClient:t,publicClient:e};return{exports:c}})},function(e,n){e.exports=t}])});