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