@r/api-client
Version:
A wrapper for Reddit's API
2 lines • 116 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("lodash/array"),require("lodash/collection"),require("lodash/lang"),require("lodash/object"),require("superagent")):"function"==typeof define&&define.amd?define(["lodash/array","lodash/collection","lodash/lang","lodash/object","superagent"],e):"object"==typeof exports?exports["build.js"]=e(require("lodash/array"),require("lodash/collection"),require("lodash/lang"),require("lodash/object"),require("superagent")):t["build.js"]=e(t["lodash/array"],t["lodash/collection"],t["lodash/lang"],t["lodash/object"],t.superagent)}(this,function(t,e,r,n,o){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,e,r){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=240)}([function(t,e,r){"use strict";var n=r(98),o=r.n(n),i=r(23),a=r(16),u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.a=function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=n.query,c=void 0===s?{}:s,f=n.body,l=void 0===f?{}:f,p=n.type,d=void 0===p?null:p,h=t.origin,b=t.appName,v=t.env,y=t.token,m=t.headers,_=void 0===m?{}:m,g=t.queryParams,w=void 0===g?{}:g,O=e.toLowerCase(),j=y?u({},_,{Authorization:"Bearer "+y}):_,x=u({},w,c,{app:b+"-"+v}),k=r.startsWith("/")?r:"/"+r,P=""+h+k,E=o.a[O](P).set(j).query(x);return d&&E.type(d),"post"===O&&E.send(l),new Promise(function(t,e){E.end(function(r,n){r?(r&&r.timeout&&(r.status=504),e(new a.a(r,k))):t(new i.a(n))})})}},function(t,e,r){"use strict";function n(t){return x[t.substring(0,2)]}r.d(e,"COMMENT",function(){return o}),r.d(e,"COMMENT_TYPE",function(){return i}),r.d(e,"COMMENT_LOAD_MORE",function(){return a}),r.d(e,"ACCOUNT",function(){return u}),r.d(e,"ACCOUNT_TYPE",function(){return s}),r.d(e,"POST",function(){return c}),r.d(e,"POST_TYPE",function(){return f}),r.d(e,"MESSAGE",function(){return l}),r.d(e,"MESSAGE_TYPE",function(){return p}),r.d(e,"SUBREDDIT",function(){return d}),r.d(e,"SUBREDDIT_TYPE",function(){return h}),r.d(e,"TROPHIE",function(){return b}),r.d(e,"TROPHIE_TYPE",function(){return v}),r.d(e,"PROMOCAMPAIGN",function(){return y}),r.d(e,"PROMOCAMPAIGN_TYPE",function(){return m}),r.d(e,"WIKI",function(){return _}),r.d(e,"WIKI_TYPE",function(){return g}),r.d(e,"SUBREDDIT_RULE",function(){return w}),r.d(e,"SUBREDDIT_RULE_TYPE",function(){return O}),r.d(e,"TYPES",function(){return x}),r.d(e,"TYPE_TO_THING_TYPE",function(){return k}),e.thingType=n;var o="comment",i="t1",a="comment_load_more",u="account",s="t2",c="post",f="t3",l="message",p="t4",d="subreddit",h="t5",b="trophie",v="t6",y="promocampaign",m="t8",_="wiki",g="wiki",w="subreddit_rule",O="subreddit_rule",j=[[o,i],[u,s],[c,f],[l,p],[d,h],[b,v],[y,m],[_,g],[w,O]],x=j.reduce(function(t,e){return t[e[1]]=e[0],t},{}),k=j.reduce(function(t,e){return t[e[0]]=e[1],t},{})},function(t,e){var r=Array.isArray;t.exports=r},function(t,e,r){"use strict";var n=r(98),o=r.n(n),i=r(118),a=r(23),u=r(26),s=r(16),c=r(14);r.d(e,"e",function(){return d}),r.d(e,"f",function(){return _}),r.d(e,"a",function(){return g}),r.d(e,"d",function(){return w}),r.d(e,"b",function(){return O}),r.d(e,"c",function(){return j});var f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},l={emit:function(){},on:function(){},off:function(){}},p={userAgent:"snoodev3",origin:"https://www.reddit.com",appName:"node-api-client-v3",env:"develop",token:"",timeout:5e3,eventEmitter:l},d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return f({},p,t)},h=function(t){return t.eventEmitter||l},b=function(t){var e=t.token;return e?{Authorization:"Bearer "+e}:{}},v=function(t){var e=b(t);return f({},t.headers||{},e)},y=function(t,e){var r="/";return 0===e.indexOf("/")&&(r=""),""+t.origin+r+e},m=function(t){return t.appName+"-"+t.env},_=function(t,e,r,n,a,u){var s=t.origin,c=y(t,r),l={origin:s,path:r,url:c,method:e,query:f({},n)};h(t).emit(i.a.request,l);var p=o.a[e](c);p.set(v(t)),"query"===a?(n.app=m(t),p.query(f({},t.queryParams||{},n,{app:m(t)})),p.redirects&&p.redirects(0)):(p.query({app:m(t)}),p.type(a),p.send(n)),p.end(function(t,e){var r=e?e.request:l;u(t,e,r)})},g=function(t,e,r,n){if(!t||!n)throw new c.a(r,(void 0));if(!n(t))throw new c.a(r,t)},w=function(t,e,r,n,o,i){if(!(t&&e&&r&&n))throw new u.a;return new Promise(function(a,u){_(t,e,r,n,"json",function(s,c,f){k(t,a,u,s,c,f,e,r,n,o,i)})})},O=function(t,e,r,n,o,i){if(!(t&&e&&r&&n))throw new u.a;return new Promise(function(a,u){_(t,e,r,n,"form",function(s,c,f){k(t,a,u,s,c,f,e,r,n,o,i)})})},j=function(t,e,r,n,o,i,a){if(!(t&&e&&r&&n&&o))throw new u.a;return"get"===e&&(n.raw_json=1),new Promise(function(u,s){_(t,e,r,n,"query",function(n,c,f){k(t,u,s,n,c,f,e,r,o,i,a)})})},x=function(t,e){return t&&!e?t.request||t.req:e},k=function(t,e,r,n,o,a,u,s,c,f,l){if(a=x(o,a),!P(t,n,o,a,u,s,r)){h(t).emit(i.a.response,a,o);var p=E(r,o,a,u,s,c,f,l);h(t).emit(i.a.result,p),e(p)}},P=function(t,e,r,n,o,a,u){if(!(!e&&!r||r&&r.ok))return e?(h(t).emit(i.a.error,e,n),e&&e.timeout&&(e.status=504),u(new s.a(e,a))):u(new s.a(r,a))},E=function(t,e,r,n,o,i,a,u){try{return R(e,r,n,i,a,u)}catch(c){console.trace(c),t(new s.a(c,o))}},R=function(t,e,r,n,o,i){if(!o)return t.body;var u=i?i(t,e,r):t.headers,s=new a.a(t,u,n);return o(t,s,e,r),s}},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=r(6),u=r(1),s=r(70),c=r(69),f=a.a.Types,l=new Set(["default","image","self","nsfw","spoiler"]),p=function(t){return l.has(t)?"":t},d=function(t){function e(){return n(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),e}(a.a);d.type=u.POST,d.PROPERTIES={adserverImpPixel:f.string,archived:f.bool,author:f.string,cleanPermalink:f.link,cleanUrl:f.link,distinguished:f.string,domain:f.string,downs:f.number,gilded:f.number,hidden:f.bool,id:f.string,impPixel:f.string,likes:f.likes,locked:f.bool,malink:f.link,media:f.nop,name:f.string,over18:f.bool,postHint:f.string,promoted:f.bool,quarantine:f.bool,saved:f.bool,score:f.number,spoiler:f.bool,stickied:f.bool,subreddit:f.string,subredditDetail:f.nop,subredditId:f.string,thumbnail:f.string,title:f.string,ups:f.number,removed:f.bool,approved:f.bool,spam:f.bool,approvedBy:f.string,authorFlairCSSClass:f.string,authorFlairText:f.string,bannedBy:f.string,createdUTC:f.number,disableComments:f.bool,hideScore:f.bool,isSelf:f.bool,isBlankAd:f.bool,linkFlairCSSClass:f.string,linkFlairText:f.string,mediaOembed:f.nop,modReports:f.array,numComments:f.number,originalLink:f.string,outboundLink:f.nop,promotedBy:f.string,promotedDisplayName:f.string,promotedUrl:f.string,secureMedia:f.nop,selfTextHTML:f.string,selfTextMD:f.string,sendReplies:f.bool,suggestedSort:f.string,thirdPartyTracking:f.string,thirdPartyTracking2:f.string,userReports:f.array,expandable:f.bool,expandedContent:f.html,preview:f.nop},d.API_ALIASES={adserver_imp_pixel:"adserverImpPixel",approved_by:"approvedBy",author_flair_css_class:"authorFlairCSSClass",author_flair_text:"authorFlairText",banned_by:"bannedBy",created_utc:"createdUTC",disable_comments:"disableComments",hide_score:"hideScore",imp_pixel:"impPixel",is_self:"isSelf",is_blank_ad:"isBlankAd",link_flair_css_class:"linkFlairCSSClass",link_flair_text:"linkFlairText",media_oembed:"mediaOembed",mod_reports:"modReports",num_comments:"numComments",original_link:"originalLink",over_18:"over18",outbound_link:"outboundLink",permalink:"cleanPermalink",promoted_by:"promotedBy",promoted_display_name:"promotedDisplayName",promoted_url:"promotedUrl",post_hint:"postHint",secure_media:"secureMedia",selftext:"selfTextMD",selftext_html:"selfTextHTML",suggested_sort:"suggestedSort",sr_detail:"subredditDetail",subreddit_id:"subredditId",sendreplies:"sendReplies",third_party_tracking:"thirdPartyTracking",third_party_tracking_2:"thirdPartyTracking2",url:"cleanUrl",user_reports:"userReports"},d.DERIVED_PROPERTIES={expandable:function(t){return t.expandable?t.expandable:!!(t.secure_media&&t.secure_media.content||t.media_embed&&t.media_embed.content||t.selftext_html)},expandedContent:function(t){if(t.expandedContent)return t.expandedContent;var e=void 0;return e=t.secure_media_embed&&t.secure_media_embed.content||t.media_embed&&t.media_embed.content,!e&&t.selftext_html&&(e=t.selftext_html),e},preview:function(t){if(!t.promoted||t.preview)return t.preview;var e=[];t.mobile_ad_url&&e.push({url:t.mobile_ad_url,height:628,width:1200});var r=p(t.thumbnail);return r&&e.push({url:r,height:140,width:140}),{images:[{resolutions:e}]}},thumbnail:function(t){return p(t.thumbnail)}},e.a=d,r.i(s.a)(d),r.i(c.a)(d)},function(t,e,r){var n=r(82),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=r(52),u=r(1),s=r(121),c=(r(122),r(123)),f=r(125),l=r(126),p=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},d=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),h=function v(t,e,r){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,e);if(void 0===n){var o=Object.getPrototypeOf(t);return null===o?void 0:v(o,e,r)}if("value"in n)return n.value;var i=n.get;if(void 0!==i)return i.call(r)},b=function(t){function e(){return n(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),d(e,[{key:"makeUUID",value:function(t){return r.i(s.a)(t.name)?t.name:r.i(s.a)(t.id)?t.id:h(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"makeUUID",this).call(this,t)}},{key:"getType",value:function(t,n){return h(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"getType",this).call(this,t,n)||u.TYPES[t.kind]||r.i(u.thingType)(n)||"Unknown"}}]),e}(a.a);b.Types=p({},a.a.Types,{html:function(t){return a.a.Types.string(t)},link:function(t){return r.i(c.a)(a.a.Types.string(t))}}),b.MockTypes=p({},a.a.MockTypes,{html:f.a,link:l.a}),e.a=b},function(t,e,r){function n(t,e){var r=i(t,e);return o(r)?r:void 0}var o=r(150),i=r(186);t.exports=n},function(t,e){function r(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}t.exports=r},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=r(6),u=r(25),s=r(1),c=r(70),f=r(69),l=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),p=function b(t,e,r){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,e);if(void 0===n){var o=Object.getPrototypeOf(t);return null===o?void 0:b(o,e,r)}if("value"in n)return n.value;var i=n.get;if(void 0!==i)return i.call(r)},d=a.a.Types,h=function(t){function e(){return n(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),l(e,[{key:"makeUUID",value:function(t){return"t1__"===t.name&&t.parent_id?t.parent_id:t.name}},{key:"toRecord",value:function(){return this.uuid===this.name?p(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"toRecord",this).call(this):new u.a(s.COMMENT_LOAD_MORE,this.parentId)}}]),e}(a.a);h.type=s.COMMENT,h.PROPERTIES={archived:d.bool,author:d.string,authorFlairCSSClass:d.string,authorFlairText:d.string,children:d.nop,controversiality:d.number,distinguished:d.string,downs:d.number,edited:d.bool,gilded:d.number,id:d.string,likes:d.likes,name:d.string,replies:d.array,numReplies:d.number,loadMore:d.bool,loadMoreIds:d.arrayOf(d.string),saved:d.bool,score:d.number,stickied:d.bool,subreddit:d.string,ups:d.number,removed:d.bool,approved:d.bool,spam:d.bool,approvedBy:d.string,bannedBy:d.string,bodyHTML:d.html,bodyMD:d.html,createdUTC:d.number,linkId:d.string,linkTitle:d.string,modReports:d.array,numReports:d.number,parentId:d.string,reportReasons:d.array,scoreHidden:d.bool,subredditId:d.string,userReports:d.array,cleanPermalink:d.link,canContinueThread:d.bool},h.API_ALIASES={approved_by:"approvedBy",author_flair_css_class:"authorFlairCSSClass",author_flair_text:"authorFlairText",banned_by:"bannedBy",body_html:"bodyHTML",body:"bodyMD",created_utc:"createdUTC",link_id:"linkId",link_title:"linkTitle",mod_reports:"modReports",num_reports:"numReports",parent_id:"parentId",report_reasons:"reportReasons",score_hidden:"scoreHidden",subreddit_id:"subredditId",user_reports:"userReports"},h.DERIVED_PROPERTIES={cleanPermalink:function(t){if(t.cleanPermalink)return t.cleanPermalink;var e=t.subreddit,r=t.link_id,n=t.id,o=t.context;return o?o:"/r/"+e+"/comments/"+r.substr(3)+"/comment/"+n},canContinueThread:function(t){return t.loadMore&&0===t.loadMoreIds.length}},e.a=h,r.i(c.a)(h),r.i(f.a)(h)},function(t,e,r){var n=r(5),o=n.Symbol;t.exports=o},function(t,e,r){function n(t){return null==t?void 0===t?s:u:c&&c in Object(t)?i(t):a(t)}var o=r(10),i=r(185),a=r(214),u="[object Null]",s="[object Undefined]",c=o?o.toStringTag:void 0;t.exports=n},function(t,e){function r(t){return null!=t&&"object"==typeof t}t.exports=r},function(t,e){t.exports=require("lodash/object")},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=r(17),u=function(t,e){return t+" had errors in "+e.join(",")},s=function(t){function e(t,r,i){n(this,e);var a=r&&r.length?u(t,r):"Validation error in '"+t+"'",s=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a));return s.name="ValidationError",s.errors=r,s.status=i,s}return i(e,t),e}(a.a);e.a=s},function(t,e,r){"use strict";function n(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){function n(o,i){try{var a=e[o](i),u=a.value}catch(s){return void r(s)}return a.done?void t(u):Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)})}return n("next")})}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=r(6),s=r(1),c=r(60),f=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),l=u.a.Types,p=["default_set","subreddit_id","domain","show_media","wiki_edit_age","submit_text","spam_links","title","collapse_deleted_comments","wikimode","over_18","related_subreddits","suggested_comment_sort","description","submit_link_label","spam_comments","spam_selfposts","submit_text_label","key_color","language","wiki_edit_karma","hide_ads","header_hover_text","public_traffic","public_description","comment_score_hide_mins","subreddit_type","exclude_banned_modqueue","submission_type"].sort(),d=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),f(e,[{key:"makeUUID",value:function(t){var r=t.url;return e.cleanName(r)}},{key:"makePaginationId",value:function(t){return t.name}},{key:"toggleSubscribed",value:function(t){var e=this,r=this.userIsSubscriber,o=!r,i=this,a=this.stub("userIsSubscriber",o,n(regeneratorRuntime.mark(function u(){var r,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r={subreddit:i.name},n=o?c.a.post:c.a.del,e.next=5,n(t,r);case 5:return e.abrupt("return",a);case 8:throw e.prev=8,e.t0=e["catch"](0),i;case 11:case"end":return e.stop()}},u,e,[[0,8]])})));return a}}]),e}(u.a);d.type=s.SUBREDDIT,d.fields=p,d.PROPERTIES={accountsActive:l.number,bannerImage:l.string,bannerSize:l.arrayOf(l.number),collapseDeletedComments:l.bool,commentScoreHideMins:l.number,createdUTC:l.number,description:l.string,descriptionHTML:l.string,displayName:l.string,headerImage:l.string,headerSize:l.arrayOf(l.number),headerTitle:l.string,hideAds:l.bool,iconImage:l.string,iconSize:l.arrayOf(l.number),id:l.string,keyColor:l.string,lang:l.string,name:l.string,over18:l.bool,publicDescription:l.string,publicTraffic:l.nop,quarantine:l.bool,relatedSubreddits:l.array,spoilersEnabled:l.bool,submissionType:l.string,submitLinkLabel:l.string,submitText:l.string,submitTextLabel:l.string,subredditType:l.string,subscribers:l.number,suggestedCommentSort:l.string,title:l.string,url:l.string,userIsBanned:l.bool,userIsContributor:l.bool,userIsModerator:l.bool,userIsMuted:l.bool,userIsSubscriber:l.bool,userSrThemeEnabled:l.bool,whitelistStatus:l.string,wikiEnabled:l.bool},d.API_ALIASES={accounts_active:"accountsActive",banner_img:"bannerImage",banner_size:"bannerSize",collapse_deleted_comments:"collapseDeletedComments",comment_score_hide_mins:"commentScoreHideMins",created_utc:"createdUTC",description_html:"descriptionHTML",display_name:"displayName",header_img:"headerImage",header_size:"headerSize",header_title:"headerTitle",hide_ads:"hideAds",icon_img:"iconImage",icon_size:"iconSize",key_color:"keyColor",public_description:"publicDescription",public_traffic:"publicTraffic",related_subreddits:"relatedSubreddits",spoilers_enabled:"spoilersEnabled",submission_type:"submissionType",submit_link_label:"submitLinkLabel",submit_text_label:"submitTextLabel",submit_text:"submitText",subreddit_type:"subredditType",user_is_banned:"userIsBanned",user_is_contributor:"userIsContributor",user_is_moderator:"userIsModerator",user_is_muted:"userIsMuted",user_is_subscriber:"userIsSubscriber",user_sr_theme_enabled:"userSrThemeEnabled",whitelist_status:"whitelistStatus",wiki_enabled:"wikiEnabled"},d.cleanName=function(t){return t?t.replace(/^\/?r\//,"").replace(/\/?$/,"").toLowerCase():t},e.a=d},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=r(17);r.d(e,"b",function(){return s});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),s=function(t){function e(t,r){n(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"URL "+r+" not reachable. You are probably disconnected from the internet."));return i.safeAssignProps(t),i}return i(e,t),e}(a.a),c={ECONNREFUSED:s,ENOTFOUND:s},f=function(t){function e(t,r){if(n(this,e),!t)throw new Error("No error passed to ResponseError");if(!r)throw new Error("No url passed to ResponseError");var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"Status "+t.status+" returned from API request to "+r));if(i.safeAssignProps(t),i.name="ResponseError",t.code&&t.syscall){var a;return a=e.getSystemLevelError(t,r),o(i,a)}return i}return i(e,t),u(e,null,[{key:"getSystemLevelError",value:function(t,e){var r=c[t.code]||Error;return new r(t,e)}}]),e}(a.a);e.a=f},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=r(234),i=r.n(o),a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),u=function(){function t(e){n(this,t),Object.defineProperty(this,"message",{value:e}),Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,this.constructor):Object.defineProperty(this,"stack",{value:(new Error).stack})}return a(t,[{key:"safeAssignProps",value:function(t){Object.assign(this,i()(t,["message","stack"]))}}]),t}();e.a=u},function(t,e,r){"use strict";function n(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){function n(o,i){try{var a=e[o](i),u=a.value}catch(s){return void r(s)}return a.done?void t(u):Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)})}return n("next")})}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(24),a=r(13),u=(r.n(a),Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}),s=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),c=function(t){return t},f=function(){function t(e){o(this,t),this.apiResponse=e,this.nextResponse=this.nextResponse.bind(this),this.prevResponse=this.prevResponse.bind(this)}return s(t,null,[{key:"baseOptions",value:function(){return{}}},{key:"getResponse",value:function(){function t(t){return e.apply(this,arguments)}var e=n(regeneratorRuntime.mark(function r(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.endpoint.get(t,u({},this.baseOptions(),n));case 2:return e=r.sent,r.abrupt("return",e);case 4:case"end":return r.stop()}},r,this)}));return t}()},{key:"fetch",value:function(){function t(t){return e.apply(this,arguments)}var e=n(regeneratorRuntime.mark(function r(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.t0=this,r.next=3,this.getResponse(t,e);case 3:return r.t1=r.sent,r.abrupt("return",new r.t0(r.t1));case 5:case"end":return r.stop()}},r,this)}));return t}()}]),s(t,[{key:"afterId",value:function(t){return r.i(i.b)(t)}},{key:"hasNextPage",value:function(){return!!this.afterId}},{key:"prevId",value:function(t){return r.i(i.c)(t)}},{key:"hasPreviousPage",value:function(){return!!this.prevId}},{key:"nextResponse",value:function(){function t(t){return e.apply(this,arguments)}var e=n(regeneratorRuntime.mark(function o(t){var e,n;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(e=this.afterId(this.apiResponse)){o.next=3;break}return o.abrupt("return");case 3:return n=r.i(a.omit)(u({},this.apiResponse.query,{after:e}),"before"),o.next=6,this.constructor.getResponse(t,n);case 6:return o.abrupt("return",o.sent);case 7:case"end":return o.stop()}},o,this)}));return t}()},{key:"prevResponse",value:function(){function t(t){return e.apply(this,arguments)}var e=n(regeneratorRuntime.mark(function o(t){var e,n;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(e=this.prevId(this.apiResponse)){o.next=3;break}return o.abrupt("return");case 3:return n=r.i(a.omit)(u({},this.apiResponse.query,{before:e}),"after"),o.next=6,this.constructor.getResponse(t,n);case 6:return o.abrupt("return",o.sent);case 7:case"end":return o.stop()}},o,this)}));return t}()},{key:"fetchAndMakeInstance",value:function(){function t(t,r,n){return e.apply(this,arguments)}var e=n(regeneratorRuntime.mark(function r(t,e,n){var o;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t(e);case 2:if(o=r.sent,!o){r.next=5;break}return r.abrupt("return",new this.constructor(n(o)));case 5:case"end":return r.stop()}},r,this)}));return t}()},{key:"nextPage",value:function(){function t(t){return e.apply(this,arguments)}var e=n(regeneratorRuntime.mark(function r(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.fetchAndMakeInstance(this.nextResponse,t,c));case 1:case"end":return e.stop()}},r,this)}));return t}()},{key:"withNextPage",value:function(){function t(t){return e.apply(this,arguments)}var e=n(regeneratorRuntime.mark(function r(t){var e,n;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return e=this.nextResponse,n=this.apiResponse,r.abrupt("return",this.fetchAndMakeInstance(e,t,n.appendResponse));case 2:case"end":return r.stop()}},r,this)}));return t}()},{key:"prevPage",value:function(){function t(t){return e.apply(this,arguments)}var e=n(regeneratorRuntime.mark(function r(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.fetchAndMakeInstance(this.prevResponse,t,c));case 1:case"end":return e.stop()}},r,this)}));return t}()},{key:"withPrevPage",value:function(){function t(t){return e.apply(this,arguments)}var e=n(regeneratorRuntime.mark(function r(t){var e=this;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",this.fetchAndMakeInstance(this.prevResponse,t,function(t){return t.appendResponse(e.apiResponse)}));case 1:case"end":return r.stop()}},r,this)}));return t}()}]),t}();f.endpoint={get:function(){}},e.a=f},function(t,e,r){function n(t,e,r,n){var a=!r;r||(r={});for(var u=-1,s=e.length;++u<s;){var c=e[u],f=n?n(r[c],t[c],c,r,t):void 0;void 0===f&&(f=t[c]),a?i(r,c,f):o(r,c,f)}return r}var o=r(76),i=r(77);t.exports=n},function(t,e,r){function n(t){if("string"==typeof t||o(t))return t;var e=t+"";return"0"==e&&1/t==-i?"-0":e}var o=r(50),i=1/0;t.exports=n},function(t,e,r){function n(t){return a(t)?o(t):i(t)}var o=r(72),i=r(153),a=r(33);t.exports=n},function(t,e){t.exports=require("lodash/lang")},function(t,e,r){"use strict";function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var u=r(239),s=(r.n(u),r(51)),c=(r.n(s),r(1));r.d(e,"a",function(){return p}),r.d(e,"b",function(){return d});var f=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),l=function(){function t(){var e;a(this,t),this.results=[],this.posts={},this.comments={},this.accounts={},this.messages={},this.subreddits={},this.subreddit_rules={},this.wikis={},this.typeToTable=(e={},i(e,c.COMMENT,this.comments),i(e,c.POST,this.posts),i(e,c.ACCOUNT,this.accounts),i(e,c.MESSAGE,this.messages),i(e,c.SUBREDDIT,this.subreddits),i(e,c.SUBREDDIT_RULE,this.subreddit_rules),i(e,c.WIKI,this.wikis),e),this.addResult=this.addResult.bind(this),this.addModel=this.addModel.bind(this),this.makeRecord=this.makeRecord.bind(this),this.addToTable=this.addToTable.bind(this),this.getModelFromRecord=this.getModelFromRecord.bind(this),this.appendResponse=this.appendResponse.bind(this)}return f(t,[{key:"addResult",value:function(t){if(!t)return this;var e=this.makeRecord(t);return e&&(this.results.push(e),this.addToTable(e,t)),this}},{key:"addModel",value:function(t){if(!t)return this;var e=this.makeRecord(t);return e&&this.addToTable(e,t),this}},{key:"makeRecord",value:function(t){if(t.toRecord)return t.toRecord();var e=t.uuid;if(e){var n=c.TYPES[t.kind]||r.i(c.thingType)(e);if(n)return{type:n,uuid:e}}}},{key:"addToTable",value:function(t,e){var r=this.typeToTable[t.type];return r&&(r[t.uuid]=e),this}},{key:"getModelFromRecord",value:function(t){var e=this.typeToTable[t.type];if(e)return e[t.uuid]}},{key:"appendResponse",value:function(){throw new Error("Not implemented in base class")}}]),t}(),p=function(t){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};a(this,e);var i=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return i.request=t.req,i.response=t,i.meta=r,i.query=o,i}return o(e,t),f(e,[{key:"appendResponse",value:function(t){return new d([this,t])}}]),e}(l),d=function(t){function e(t){a(this,e);var o=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));o.metas=t.map(function(t){return t.meta}),o.querys=t.map(function(t){return t.query}),o.apiResponses=t;var i=new Set,s=[c.COMMENT,c.ACCOUNT,c.POST,c.MESSAGE,c.SUBREDDIT];
return r.i(u.forEach)(t,function(t){r.i(u.forEach)(t.results,function(t){i.has(t.uuid)||(i.add(t.uuid),o.results.push(t))}),r.i(u.forEach)(s,function(e){var r=o.typeToTable[e];Object.assign(r,t.typeToTable[e])})}),o}return o(e,t),f(e,[{key:"appendResponse",value:function(t){var r=this.apiResponses.slice();return r.push(t),new e(r)}},{key:"lastResponse",get:function(){return r.i(s.last)(this.apiResponses)}},{key:"lastQuery",get:function(){return r.i(s.last)(this.querys)}},{key:"lastMeta",get:function(){return r.i(s.last)(this.meta)}},{key:"query",get:function(){return this.latQuery}}]),e}(l)},function(t,e,r){"use strict";function n(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){function n(o,i){try{var a=e[o](i),u=a.value}catch(s){return void r(s)}return a.done?void t(u):Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)})}return n("next")})}}var o=r(51),i=(r.n(o),r(23));r.d(e,"a",function(){return s}),r.d(e,"b",function(){return c}),r.d(e,"c",function(){return f}),r.d(e,"d",function(){return l});var a=this,u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=function(t,e){var r=void 0,n=void 0;return t instanceof i.b?(r=t.lastQuery,n=t.lastResponse.results):(r=t.query,n=t.results),e(r,n)},c=function(t){return s(t,function(t,e){var n=t.limit||25;return e.length>=n?r.i(o.last)(e).paginationId:null})},f=function(t){return s(t,function(t,e){return t.after?e[0].paginationId:null})},l=function(){var t=n(regeneratorRuntime.mark(function e(t,r,n){var o,i,s,f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=u({},n),e.next=3,t(r,o);case 3:i=e.sent,s=f(i);case 5:if(!s){e.next=15;break}return o=u({},o,{after:s}),e.t0=i,e.next=10,t(r,o);case 10:e.t1=e.sent,i=e.t0.appendResponse.call(e.t0,e.t1),s=c(i),e.next=5;break;case 15:return e.abrupt("return",i);case 16:case"end":return e.stop()}},e,a)}));return function(e,r,n){return t.apply(this,arguments)}}()},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=function i(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;n(this,i),this.type=t,this.uuid=e,this.paginationId=r};e.a=o},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=r(17),u=function(t){function e(t){n(this,e);var r=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"No model given for api endpoint "+t));return r.name="NoModelError",r.status=400,r}return i(e,t),e}(a.a);e.a=u},function(t,e,r){function n(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}var o=r(200),i=r(201),a=r(202),u=r(203),s=r(204);n.prototype.clear=o,n.prototype["delete"]=i,n.prototype.get=a,n.prototype.has=u,n.prototype.set=s,t.exports=n},function(t,e,r){function n(t,e){for(var r=t.length;r--;)if(o(t[r][0],e))return r;return-1}var o=r(32);t.exports=n},function(t,e,r){function n(t,e){return o(t)?t:i(t,e)?[t]:a(u(t))}var o=r(2),i=r(45),a=r(226),u=r(238);t.exports=n},function(t,e,r){function n(t,e){var r=t.__data__;return o(e)?r["string"==typeof e?"string":"hash"]:r.map}var o=r(198);t.exports=n},function(t,e,r){var n=r(7),o=n(Object,"create");t.exports=o},function(t,e){function r(t,e){return t===e||t!==t&&e!==e}t.exports=r},function(t,e,r){function n(t){return null!=t&&i(t.length)&&!o(t)}var o=r(94),i=r(49);t.exports=n},function(t,e,r){"use strict";var n=r(0),o=r(66),i=r(13),a=(r.n(i),r(9)),u=r(4),s=r(120),c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},f=function(t,e){return r.i(o.a)(t,e),t.commentIds?(t.children=t.commentIds.join(","),t.api_type="json",t.link_id=t.linkId,delete t.commentIds,delete t.linkId):r.i(i.has)(t,"query.comment")&&(t.comment=t.query.comment,t.context=1),t},l=function(t){return t.user?"user/"+t.user+"/comments.json":t.commentIds?"api/morechildren.json":"comments/"+(t.id||t.linkId).replace(/^t3_/,"")+".json"},p=function(t,e){var n=t.response.body,o=[];if(Array.isArray(n)){var i=n[0].data;i&&i.children&&i.children.length&&i.children.forEach(function(e){t.addModel(u.a.fromJSON(e.data))}),o=n[1].data.children.map(s.a)}else if(n.json&&n.json.data){var c=n.json.data.things;o=r.i(s.b)(c.map(s.a))}return r.i(s.c)(o,!0,function(e,r){var n=a.a.fromJSON(e);return r?t.addResult(n):t.addModel(n),n.toRecord()}),t},d=function(t){var e=t.response.body;if(r.i(i.has)(e,"json.data.things.0.data")){var n=e.json.data.things[0].data;t.addResult(a.a.fromJSON(n))}return t};e.a={get:function(t,e){var o=!!e.children,i=l(e),a=f(c({raw_json:1},e));return r.i(n.a)(t,"GET",i,{query:a}).then(function(t){return p(t,o)})},post:function(t,e){var o="api/comment",i={api_type:"json",thing_id:e.thingId,text:e.text,raw_json:1};return r.i(n.a)(t,"POST",o,{body:i,type:"form"}).then(d)},del:function(t,e){var o={id:e};return r.i(n.a)(t,"POST","api/del",{body:o,type:"form"})}}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,configurable:!1,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,configurable:!1,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){var n=r(7),o=r(5),i=n(o,"Map");t.exports=i},function(t,e,r){function n(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}var o=r(205),i=r(206),a=r(207),u=r(208),s=r(209);n.prototype.clear=o,n.prototype["delete"]=i,n.prototype.get=a,n.prototype.has=u,n.prototype.set=s,t.exports=n},function(t,e,r){function n(t){var e=this.__data__=new o(t);this.size=e.size}var o=r(27),i=r(221),a=r(222),u=r(223),s=r(224),c=r(225);n.prototype.clear=i,n.prototype["delete"]=a,n.prototype.get=u,n.prototype.has=s,n.prototype.set=c,t.exports=n},function(t,e){function r(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}t.exports=r},function(t,e,r){function n(t,e){e=o(e,t);for(var r=0,n=e.length;null!=t&&r<n;)t=t[i(e[r++])];return r&&r==n?t:void 0}var o=r(29),i=r(20);t.exports=n},function(t,e,r){function n(t){var e=new t.constructor(t.byteLength);return new o(e).set(new o(t)),e}var o=r(71);t.exports=n},function(t,e,r){var n=r(90),o=n(Object.getPrototypeOf,Object);t.exports=o},function(t,e,r){var n=r(137),o=r(97),i=Object.prototype,a=i.propertyIsEnumerable,u=Object.getOwnPropertySymbols,s=u?function(t){return null==t?[]:(t=Object(t),n(u(t),function(e){return a.call(t,e)}))}:o;t.exports=s},function(t,e){function r(t,e){return e=null==e?n:e,!!e&&("number"==typeof t||o.test(t))&&t>-1&&t%1==0&&t<e}var n=9007199254740991,o=/^(?:0|[1-9]\d*)$/;t.exports=r},function(t,e,r){function n(t,e){if(o(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!i(t))||(u.test(t)||!a.test(t)||null!=e&&t in Object(e))}var o=r(2),i=r(50),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,u=/^\w*$/;t.exports=n},function(t,e){function r(t){var e=t&&t.constructor,r="function"==typeof e&&e.prototype||n;return t===r}var n=Object.prototype;t.exports=r},function(t,e,r){var n=r(147),o=r(12),i=Object.prototype,a=i.hasOwnProperty,u=i.propertyIsEnumerable,s=n(function(){return arguments}())?n:function(t){return o(t)&&a.call(t,"callee")&&!u.call(t,"callee")};t.exports=s},function(t,e,r){(function(t){var n=r(5),o=r(237),i="object"==typeof e&&e&&!e.nodeType&&e,a=i&&"object"==typeof t&&t&&!t.nodeType&&t,u=a&&a.exports===i,s=u?n.Buffer:void 0,c=s?s.isBuffer:void 0,f=c||o;t.exports=f}).call(e,r(35)(t))},function(t,e){function r(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}var n=9007199254740991;t.exports=r},function(t,e,r){function n(t){return"symbol"==typeof t||i(t)&&o(t)==a}var o=r(11),i=r(12),a="[object Symbol]";t.exports=n},function(t,e){t.exports=require("lodash/array")},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(25),a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),c=function(){return(16*Math.random()).toFixed()},f=function(){function t(e,r){o(this,t);for(var n=this.constructor,i=n.API_ALIASES,a=n.PROPERTIES,u=n.DERIVED_PROPERTIES,s=Object.keys(e),c=0;c<s.length;c++){var f=s[c];if(!u[f]){var l=i[f];l||(l=f);var p=a[l];p&&(this[l]=p(e[f]))}}for(var d in a)void 0===this[d]&&(this[d]=a[d]());for(var h=Object.keys(u),b=0;b<h.length;b++){var v=h[b],y=u[v],m=a[v];y&&m&&(this[v]=m(y(e)))}this.uuid=this.makeUUID(e),this.paginationId=this.makePaginationId(e),this.type=this.getType(e,this.uuid),r||Object.freeze(this)}return s(t,null,[{key:"fromJSON",value:function(t){return new this(t)}},{key:"Mock",value:function(){var t=this,e=Object.keys(this.PROPERTIES).reduce(function(e,r){return u({},e,n({},r,t.MOCKS[r]?t.MOCKS[r]():null))},{});return new this(e)}}]),s(t,[{key:"_diff",value:function(t,e){return"object"===("undefined"==typeof t?"undefined":a(t))?t:n({},t,e)}},{key:"set",value:function(t,e){return new this.constructor(u({},this.toJSON(),this._diff(t,e)))}},{key:"stub",value:function e(t,r,n){n||(n=r);var o=u({},this.toJSON(),this._diff(t,r)),e=new this.constructor(o,(!0));return e.promise=n,Object.freeze(e),e}},{key:"makeUUID",value:function(t){return t.uuid?t.uuid:t.id?t.id:(console.warn("generating fake uuid"),c())}},{key:"makePaginationId",value:function(t){return this.uuid||this.makeUUID(t)}},{key:"getType",value:function(){return this.constructor.type}},{key:"toRecord",value:function(){return new i.a(this.type,this.uuid,this.paginationId)}},{key:"toJSON",value:function(){var t=this,e={};return Object.keys(this).forEach(function(r){t.constructor.PROPERTIES[r]&&(e[r]=t[r])}),e.__type=this.type,e}}]),t}();f.Types={string:function(t){return t?String(t):""},number:function(t){return void 0===t?0:Number(t)},array:function(t){return Array.isArray(t)?t:[]},arrayOf:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f.Types.nop;return function(e){return f.Types.array(e).map(t)}},bool:function(t){return Boolean(t)},likes:function(t){switch(t){case!0:return 1;case!1:return-1;case null:return 0;default:return t}},nop:function(t){return t}},f.MockTypes={string:function(){return Math.random().toString(36).substring(Math.floor(10*Math.random())+5)},number:function(){return Math.floor(100*Math.random())},array:function(){return Array.apply(null,Array(Math.floor(10*Math.random())))},bool:function(){return Math.floor(10*Math.random())<5},likes:function(){return Math.round(2*Math.random()+-1)},nop:function(){return null}},f.API_ALIASES={},f.PROPERTIES={},f.MOCKS={},f.DERIVED_PROPERTIES={},e.a=f},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=r(17),u="Incorrect captcha provided.",s="No captcha provided.",c=function(t){function e(t,r,i){n(this,e);var a=t?u:s,c=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a));return c.name="BadCaptchaError",c.captcha=t,c.newCaptcha=r,c.errors=i,c.status=200,c}return i(e,t),e}(a.a);e.a=c},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=r(17),u=function(t){function e(t,r){n(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"Method "+t+" not implemented for api endpoint "+r));return i.name="NotImplementedError",i.status=405,i}return i(e,t),e}(a.a);e.a=u},function(t,e,r){"use strict";var n=r(67),o=function(t){return"user/"+t.user+"/hidden.json"};e.a=r.i(n.a)(o,"api/unhide","api/hide")},function(t,e,r){"use strict";var n=r(236),o=r.n(n),i=r(0),a=r(53),u=r(14),s=r(4),c=r(66),f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},l="BAD_CAPTCHA",p=function(t){return t.user?"user/"+t.user+"/submitted.json":t.id?"by_id/"+t.id+".json":t.ids?"by_id/"+t.ids.join(",")+".json":t.subredditName?t.sort?"r/"+t.subredditName+"/"+t.sort+".json":"r/"+t.subredditName+".json":t.multi?"user/"+t.multiUser+"/m/"+t.multi+".json":(t.sort||"hot")+".json"},d=function(t,e){return r.i(c.a)(t,e),"patch"!==e&&(t.feature="link_preview",t.sr_detail="true"),"del"===e&&(t._method="post"),t},h=function(t){var e={api_type:"json",thing_id:t.thingId,title:t.title,kind:t.kind,sendreplies:t.sendreplies,sr:t.sr,iden:t.iden,"g-recaptcha-response":t.gRecaptchaResponse,resubmit:t.resubmit};return t.text?e.text=t.text:t.url&&(e.url=t.url),e},b=function(t){var e=t.response.body.data;return e&&e.children&&e.children[0]&&(1===e.children.length?t.addResult(s.a.fromJSON(e.children[0].data)):e.children.forEach(function(e){return t.addResult(s.a.fromJSON(e.data))})),t};e.a={get:function(t,e){var n=p(e),o=d(f({raw_json:1},e),"get");return r.i(i.a)(t,"GET",n,{query:o}).then(b)},post:function(t,e){var n="api/submit",s=h(e);return r.i(i.a)(t,"POST",n,{query:s}).then(function(t){var r=t.response.body.json;if(r.errors.length&&o()(r.errors,function(t){return t[0]===l}))throw new a.a(e.gRecaptchaResponse,r.captcha,r.errors);if(r.errors.length)throw new u.a(n,r.errors,200);return t.response.body})}}},function(t,e,r){"use strict";var n=r(67),o=function(t){return"user/"+t.user+"/saved.json"};e.a=r.i(n.a)(o,"api/unsave","api/save")},function(t,e,r){"use strict";var n=r(3),o=r(4),i=r(15),a=r(1),u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=function(t){var e="";return t.subreddit&&(e="r/"+t.subreddit+"/"),e+"search.json"},c=function(t){return t.subreddit&&(t.restrict_sr="on",delete t.subreddit),t},f=function(t){var e=t.body;return e?Array.isArray(e)?e:[e]:[]},l=function(t,e){var r=f(t);r.forEach(function(t){t.data.children.length&&(t.data.children[0].kind===a.POST_TYPE?(t.data.children.forEach(function(t){e.addResult(o.a.fromJSON(t.data))}),e.meta.after=t.data.after,e.meta.before=t.data.before):t.data.children.forEach(function(t){e.addResult(i.a.fromJSON(t.data))}))})};e.a={get:function(t,e){var o=s(e),i=c(u({},e));return r.i(n.c)(t,"get",o,i,e,l)}}},function(t,e,r){"use strict";var n=r(3),o=r(13),i=(r.n(o),r(22)),a=(r.n(i),r(15)),u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s={allow_top:!0,collapse_deleted_comments:!1,comment_score_hide_mins:0,description:"",exclude_banned_modqueue:!1,"header-title":"",hide_ads:!1,lang:"en",link_type:"any",name:"",over_18:!1,public_description:"",public_traffic:!1,show_media:!0,spam_comments:"low",spam_links:"high",spam_selfposts:"high",sr:"",submission_type:"",submit_link_label:"",submit_text:"",submit_text_label:"",suggested_comment_sort:"confidence",title:"",type:"public",wiki_edit_age:0,wiki_edit_karma:100,wikimode:"disabled"},c="api/site_admin",f=function(t){return t.id&&"mod"===t.view?"r/"+t.id+"/about/edit.json":t.id?"r/"+t.id+"/about.json":"subreddits/"+(t.sort||"default")+".json"},l=function(t,e){return"get"!==e&&(t.api_type="json"),t},p=function(t,e){var n=t.body;n.data&&Array.isArray(n.data.children)?n.data.children.forEach(function(t){return e.addResult(a.a.fromJSON(t.data))}):r.i(i.isEmpty)(n)||e.addResult(a.a.fromJSON(n.data||n))},d=function(t,e){var o=f(e),i=l(u({},e));return r.i(n.c)(t,"get",o,i,e,p)},h=function(t,e){return Object.keys(e).sort()!==a.a.fields?new Promise(function(n,i){d(t,{id:e.id,view:"mod"}).then(function(n){1===!n.results.length&&i();var a=n.getModelFromRecord(n.results[0]),c=r.i(o.pick)(u({},s,a,e,{sr: