text: (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){var request=_dereq_("request");module.exports=Flatsheet;function Flatsheet(opts){if(!(this instanceof Flatsheet))return new Flatsheet(opts);opts||(opts={});this.token=opts.token||"";this.host=opts.host||"https://app.flatsheet.io";this.apiVersion=opts.apiVersion||"/v1/"}Flatsheet.prototype.list=function list(username,cb){return this.req("get","sheets",{username:username},cb)};Flatsheet.prototype.index=Flatsheet.prototype.list;Flatsheet.prototype.sheet=function sheet(slug,cb){return this.req("get","sheets/"+this.parseSlug(slug),{},cb)};Flatsheet.prototype.fetch=Flatsheet.prototype.sheet;Flatsheet.prototype.create=function create(sheet,cb){sheet.rows=JSON.stringify(sheet.rows);return this.req("post","sheets",{sheet:sheet},cb)};Flatsheet.prototype.update=function update(sheet,cb){sheet.rows=JSON.stringify(sheet.rows);return this.req("put","sheets/"+this.parseSlug(sheet.slug),{sheet:sheet},cb)};Flatsheet.prototype.destroy=function destroy(slug,cb){return this.req("delete","sheets/"+this.parseSlug(slug),{},cb)};Flatsheet.prototype.addRow=function addRow(slug,row,cb){var self=this;this.sheet(this.parseSlug(slug),function(err,req){var sheet=req;sheet.rows.push(row);self.update(sheet,cb)})};Flatsheet.prototype.req=function req(method,path,params,cb){var opts={method:method,uri:this.fullUrl(path,params),headers:{Authorization:"Token token="+this.token},qs:params,json:true};if(typeof cb==="undefined")return request(opts);else request(opts,getResponse);function getResponse(error,response,body){if(cb){if(error)return cb(error);if(response.statusCode>400)return cb({error:response.statusCode});return cb(null,body)}}};Flatsheet.prototype.fullUrl=function fullUrl(path,params){return this.host+"/api"+this.apiVersion+path+"/"};Flatsheet.prototype.parseSlug=function parseSlug(text){return text.substr(text.length-22)}},{1:2}],2:[function(require,module,exports){var window=_dereq_("global/window");var once=_dereq_("once");var messages={0:"Internal XMLHttpRequest Error",4:"4xx Client Error",5:"5xx Server Error"};var XHR=window.XMLHttpRequest||noop;var XDR="withCredentials"in new XHR?window.XMLHttpRequest:window.XDomainRequest;module.exports=createXHR;function createXHR(options,callback){if(typeof options==="string"){options={uri:options}}options=options||{};callback=once(callback);var xhr=options.xhr||null;if(!xhr&&options.cors){xhr=new XDR}else if(!xhr){xhr=new XHR}var uri=xhr.url=options.uri||options.url;var method=xhr.method=options.method||"GET";var body=options.body||options.data;var headers=xhr.headers=options.headers||{};var sync=!!options.sync;var isJson=false;if("json"in options){isJson=true;if(method!=="GET"&&method!=="HEAD"){headers["Content-Type"]="application/json";body=JSON.stringify(options.json)}}xhr.onreadystatechange=readystatechange;xhr.onload=load;xhr.onerror=error;xhr.onprogress=function(){};xhr.ontimeout=noop;xhr.open(method,uri,!sync);if(options.cors){xhr.withCredentials=true}if(!sync){xhr.timeout="timeout"in options?options.timeout:5e3}if(xhr.setRequestHeader){Object.keys(headers).forEach(function(key){xhr.setRequestHeader(key,headers[key])})}if("responseType"in options){xhr.responseType=options.responseType}xhr.send(body);return xhr;function readystatechange(){if(xhr.readyState===4){load()}}function load(){var error=null;var status=xhr.statusCode=xhr.status;var body=xhr.body=xhr.response||xhr.responseText||xhr.responseXML;if(status===1223){status=204}if(status===0||status>=400&&status<600){var message=xhr.responseText||messages[String(xhr.status).charAt(0)];error=new Error(message);error.statusCode=xhr.status}if(isJson){try{body=xhr.body=JSON.parse(body)}catch(e){}}callback(error,xhr,body)}function error(evt){callback(evt,xhr)}}function noop(){}},{1:3,2:4}],3:[function(require,module,exports){(function(global){if(typeof window!=="undefined"){module.exports=window}else if(typeof global!=="undefined"){module.exports=global}else{module.exports={}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],4:[function(require,module,exports){module.exports=once;once.proto=once(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:true})});function once(fn){var called=false;return function(){if(called)return;called=true;return fn.apply(this,arguments)}}},{}]},{},[1]);